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

merge

parents 53a0ae14 9988b3e4
......@@ -3,6 +3,30 @@
<component name="EntryPointsManager">
<entry_points version="2.0" />
</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">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -24,7 +24,7 @@
</configuration>
</facet>
</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-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
......@@ -82,7 +82,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -30,17 +30,17 @@
android:name=".PeepersApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher_peepers"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
android:label="@string/app_name">
<activity
android:name=".StreamCameraActivity"
android:label="@string/app_name"
android:screenOrientation="landscape" >
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>
<activity android:name=".PeepersPreferenceActivity" />
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
android:label="@string/title_activity_main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -20,6 +20,7 @@ public class MainActivity extends Activity {
EditText mEdit;
String myIp;
TextView myIpView;
private MenuItem mSettingsMenuItem = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -32,26 +33,24 @@ public class MainActivity extends Activity {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
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(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// 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);
}
public boolean onOptionsItemSelected(final MenuItem item)
{
if (item != mSettingsMenuItem)
{
return super.onOptionsItemSelected(item);
} // if
startActivity(new Intent(this, PeepersPreferenceActivity.class));
return true;
} // onOptionsItemSelected(MenuItem)
public void startView(View myView){
Intent intent = new Intent(MainActivity.this, StreamCameraActivity.class);
......
......@@ -37,17 +37,16 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
import org.apache.http.conn.util.InetAddressUtils;
public final class StreamCameraActivity extends Activity
implements SurfaceHolder.Callback
{
private static final String TAG = StreamCameraActivity.class.getSimpleName();
private static final String WAKE_LOCK_TAG = "peepers";
private static final String PREF_CAMERA = "camera";
......@@ -73,11 +72,12 @@ public final class StreamCameraActivity extends Activity
private int mPort = PREF_PORT_DEF;
private int mJpegQuality = PREF_JPEG_QUALITY_DEF;
private int mPrevieSizeIndex = PREF_PREVIEW_SIZE_INDEX_DEF;
private TextView mIpAddressView = null;
private LoadPreferencesTask mLoadPreferencesTask = null;
private SharedPreferences mPrefs = null;
private MenuItem mSettingsMenuItem = null;
private WakeLock mWakeLock = null;
private WebView myWebView = null;
private String clientAddressIp = "";
private Button webViewButton = null;
public StreamCameraActivity()
{
......@@ -92,7 +92,7 @@ public final class StreamCameraActivity extends Activity
Intent iin= getIntent();
Bundle b = iin.getExtras();
String address = (String) b.get("ip");
clientAddressIp = b.get("ip") + ":8080"; // client ip
new LoadPreferencesTask().execute();
......@@ -101,36 +101,16 @@ public final class StreamCameraActivity extends Activity
mPreviewDisplay.addCallback(this);
mIpAddress = (String) b.get("myIp");
mIpAddressView = (TextView) findViewById(R.id.ip_address);
updatePrefCacheAndUi();
final PowerManager powerManager =
(PowerManager) getSystemService(POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,
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)
@Override
......@@ -202,25 +182,7 @@ public final class StreamCameraActivity extends Activity
} // if
} // 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
extends AsyncTask<Void, Void, SharedPreferences>
......@@ -324,7 +286,6 @@ public final class StreamCameraActivity extends Activity
{
mJpegQuality = 100;
} // else if
mIpAddressView.setText("http://" + mIpAddress + ":" + mPort + "/");
} // updatePrefCacheAndUi()
private boolean hasFlashLight()
......@@ -333,6 +294,31 @@ public final class StreamCameraActivity extends Activity
PackageManager.FEATURE_CAMERA_FLASH);
} // 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
......
......@@ -10,7 +10,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
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" />
<TextView
......@@ -27,6 +27,6 @@
android:onClick="startView"
android:text="Dupa"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"></Button>
android:layout_alignParentEnd="true"/>
</RelativeLayout>
......@@ -15,25 +15,36 @@
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
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:background="#000000"/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000000"
android:layout_centerVertical="true"
/>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Go!"
android:id="@+id/client_mode"
android:onClick="showWebView"
android:layout_centerInParent="true"
android:layout_alignParentBottom="true"
/>
<TextView
android:id="@+id/ip_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|top"
android:background="@android:color/black" />
</merge>
</RelativeLayout>
......@@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<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