Commit 086b4224 authored by Antek Grzanka's avatar Antek Grzanka

merge

parents 53a0ae14 9988b3e4
...@@ -3,6 +3,30 @@ ...@@ -3,6 +3,30 @@
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<entry_points version="2.0" /> <entry_points version="2.0" />
</component> </component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" /> <OptionsSetting value="true" id="Remove" />
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="" /> <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component> </component>
</project> </project>
\ No newline at end of file
This diff is collapsed.
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</configuration> </configuration>
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" /> <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" /> <output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output /> <exclude-output />
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
...@@ -30,17 +30,17 @@ ...@@ -30,17 +30,17 @@
android:name=".PeepersApplication" android:name=".PeepersApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher_peepers" android:icon="@drawable/ic_launcher_peepers"
android:label="@string/app_name" android:label="@string/app_name">
android:theme="@android:style/Theme.NoTitleBar" >
<activity <activity
android:name=".StreamCameraActivity" android:name=".StreamCameraActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" > android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity> </activity>
<activity android:name=".PeepersPreferenceActivity" /> <activity android:name=".PeepersPreferenceActivity" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/title_activity_main" > android:label="@string/title_activity_main">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -20,6 +20,7 @@ public class MainActivity extends Activity { ...@@ -20,6 +20,7 @@ public class MainActivity extends Activity {
EditText mEdit; EditText mEdit;
String myIp; String myIp;
TextView myIpView; TextView myIpView;
private MenuItem mSettingsMenuItem = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -32,26 +33,24 @@ public class MainActivity extends Activity { ...@@ -32,26 +33,24 @@ public class MainActivity extends Activity {
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(final Menu menu)
// Inflate the menu; this adds items to the action bar if it is present. {
getMenuInflater().inflate(R.menu.menu_main, menu); super.onCreateOptionsMenu(menu);
mSettingsMenuItem = menu.add(R.string.settings);
mSettingsMenuItem.setIcon(android.R.drawable.ic_menu_manage);
return true; return true;
} } // onCreateOptionsMenu(Menu)
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(final MenuItem item)
// Handle action bar item clicks here. The action bar will {
// automatically handle clicks on the Home/Up button, so long if (item != mSettingsMenuItem)
// as you specify a parent activity in AndroidManifest.xml. {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} } // if
startActivity(new Intent(this, PeepersPreferenceActivity.class));
return true;
} // onOptionsItemSelected(MenuItem)
public void startView(View myView){ public void startView(View myView){
Intent intent = new Intent(MainActivity.this, StreamCameraActivity.class); Intent intent = new Intent(MainActivity.this, StreamCameraActivity.class);
......
...@@ -37,17 +37,16 @@ import android.view.Menu; ...@@ -37,17 +37,16 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.View;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import org.apache.http.conn.util.InetAddressUtils;
public final class StreamCameraActivity extends Activity public final class StreamCameraActivity extends Activity
implements SurfaceHolder.Callback implements SurfaceHolder.Callback
{ {
private static final String TAG = StreamCameraActivity.class.getSimpleName();
private static final String WAKE_LOCK_TAG = "peepers"; private static final String WAKE_LOCK_TAG = "peepers";
private static final String PREF_CAMERA = "camera"; private static final String PREF_CAMERA = "camera";
...@@ -73,11 +72,12 @@ public final class StreamCameraActivity extends Activity ...@@ -73,11 +72,12 @@ public final class StreamCameraActivity extends Activity
private int mPort = PREF_PORT_DEF; private int mPort = PREF_PORT_DEF;
private int mJpegQuality = PREF_JPEG_QUALITY_DEF; private int mJpegQuality = PREF_JPEG_QUALITY_DEF;
private int mPrevieSizeIndex = PREF_PREVIEW_SIZE_INDEX_DEF; private int mPrevieSizeIndex = PREF_PREVIEW_SIZE_INDEX_DEF;
private TextView mIpAddressView = null;
private LoadPreferencesTask mLoadPreferencesTask = null;
private SharedPreferences mPrefs = null; private SharedPreferences mPrefs = null;
private MenuItem mSettingsMenuItem = null;
private WakeLock mWakeLock = null; private WakeLock mWakeLock = null;
private WebView myWebView = null;
private String clientAddressIp = "";
private Button webViewButton = null;
public StreamCameraActivity() public StreamCameraActivity()
{ {
...@@ -92,7 +92,7 @@ public final class StreamCameraActivity extends Activity ...@@ -92,7 +92,7 @@ public final class StreamCameraActivity extends Activity
Intent iin= getIntent(); Intent iin= getIntent();
Bundle b = iin.getExtras(); Bundle b = iin.getExtras();
String address = (String) b.get("ip"); clientAddressIp = b.get("ip") + ":8080"; // client ip
new LoadPreferencesTask().execute(); new LoadPreferencesTask().execute();
...@@ -101,36 +101,16 @@ public final class StreamCameraActivity extends Activity ...@@ -101,36 +101,16 @@ public final class StreamCameraActivity extends Activity
mPreviewDisplay.addCallback(this); mPreviewDisplay.addCallback(this);
mIpAddress = (String) b.get("myIp"); mIpAddress = (String) b.get("myIp");
mIpAddressView = (TextView) findViewById(R.id.ip_address);
updatePrefCacheAndUi(); updatePrefCacheAndUi();
final PowerManager powerManager = final PowerManager powerManager =
(PowerManager) getSystemService(POWER_SERVICE); (PowerManager) getSystemService(POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,
WAKE_LOCK_TAG); WAKE_LOCK_TAG);
myWebView = (WebView) findViewById(R.id.webview);
webViewButton = (Button) findViewById(R.id.client_mode);
WebView myWebView = (WebView) findViewById(R.id.webview);
String mDescText = "<head>\n" +
"\n" +
"</head>\n" +
"<body>\n" +
"\t<div style='width:50%;display:inline-block;height:auto'>\n" +
"\t\t<img style='width:100%' src='" + "http://" + address +"'/>\n" +
"\t</div>\n" +
"\t<div style='float:right;width:50%;display:inline-block;height:auto'> \n" +
"\t\t<img style='width:100%' src='" + "http://" + address +"'/>\n" +
"\t</div>\n" +
"\n" +
"</body>";
WebSettings settings = myWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
settings.setJavaScriptEnabled(true);
myWebView.loadData(mDescText, "text/html; charset=utf-8",null);
} // onCreate(Bundle) } // onCreate(Bundle)
@Override @Override
...@@ -202,25 +182,7 @@ public final class StreamCameraActivity extends Activity ...@@ -202,25 +182,7 @@ public final class StreamCameraActivity extends Activity
} // if } // if
} // stopCameraStreamer() } // stopCameraStreamer()
@Override
public boolean onCreateOptionsMenu(final Menu menu)
{
super.onCreateOptionsMenu(menu);
mSettingsMenuItem = menu.add(R.string.settings);
mSettingsMenuItem.setIcon(android.R.drawable.ic_menu_manage);
return true;
} // onCreateOptionsMenu(Menu)
@Override
public boolean onOptionsItemSelected(final MenuItem item)
{
if (item != mSettingsMenuItem)
{
return super.onOptionsItemSelected(item);
} // if
startActivity(new Intent(this, PeepersPreferenceActivity.class));
return true;
} // onOptionsItemSelected(MenuItem)
private final class LoadPreferencesTask private final class LoadPreferencesTask
extends AsyncTask<Void, Void, SharedPreferences> extends AsyncTask<Void, Void, SharedPreferences>
...@@ -324,7 +286,6 @@ public final class StreamCameraActivity extends Activity ...@@ -324,7 +286,6 @@ public final class StreamCameraActivity extends Activity
{ {
mJpegQuality = 100; mJpegQuality = 100;
} // else if } // else if
mIpAddressView.setText("http://" + mIpAddress + ":" + mPort + "/");
} // updatePrefCacheAndUi() } // updatePrefCacheAndUi()
private boolean hasFlashLight() private boolean hasFlashLight()
...@@ -333,6 +294,31 @@ public final class StreamCameraActivity extends Activity ...@@ -333,6 +294,31 @@ public final class StreamCameraActivity extends Activity
PackageManager.FEATURE_CAMERA_FLASH); PackageManager.FEATURE_CAMERA_FLASH);
} // hasFlashLight() } // hasFlashLight()
public void showWebView(View myView){
webViewButton.setVisibility(View.INVISIBLE);
String mDescText = "<head>\n" +
"\n" +
"</head>\n" +
"<body>\n" +
"<style>\n" +
"* { margin: 0; padding: 0 }" +
"</style>\n" +
"\t<div style='width:50%;display:inline-block;height:auto'>\n" +
"\t\t<img style='width:100%' src='" + "http://" + clientAddressIp +"'/>\n" +
"\t</div>\n" +
"\t<div style='float:right;width:50%;display:inline-block;height:auto'> \n" +
"\t\t<img style='width:100%' src='" + "http://" + clientAddressIp +"'/>\n" +
"\t</div>\n" +
"\n" +
"</body>";
WebSettings settings = myWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
settings.setJavaScriptEnabled(true);
myWebView.loadData(mDescText, "text/html; charset=utf-8",null);
}
} // class StreamCameraActivity } // class StreamCameraActivity
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/input_address" android:id="@+id/input_address"
android:text="192.168.43.116:8080" android:text="192.168.43.116"
android:layout_alignEnd="@+id/go_to_view" /> android:layout_alignEnd="@+id/go_to_view" />
<TextView <TextView
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
android:onClick="startView" android:onClick="startView"
android:text="Dupa" android:text="Dupa"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"></Button> android:layout_alignParentEnd="true"/>
</RelativeLayout> </RelativeLayout>
...@@ -15,25 +15,36 @@ ...@@ -15,25 +15,36 @@
limitations under the License. limitations under the License.
--> -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
<SurfaceView <SurfaceView
android:id="@+id/camera" android:id="@+id/camera"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:background="#000000"/>
<WebView <WebView
android:id="@+id/webview" android:id="@+id/webview"
android:layout_width="fill_parent" android:layout_centerInParent="true"
android:layout_height="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:layout_centerVertical="true"
/> />
<Button
android:layout_width="100dp"
<TextView
android:id="@+id/ip_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|top" android:text="Go!"
android:background="@android:color/black" /> android:id="@+id/client_mode"
</merge> android:onClick="showWebView"
android:layout_centerInParent="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</configuration> </configuration>
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment