So I made this little Android app that now lets me quickly open an app that shows my front doorstep...
MainActivity.java
package com.user.frontdoor;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private WebView bView;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bView = (WebView) findViewById(R.id.browserView);
bView.loadUrl("http://192.168.1.108:8081");
bView.setPadding(0, 0, 0, 0);
bView.getSettings().setLoadWithOverviewMode(true);
bView.getSettings().setUseWideViewPort(true);
Button exitButton = (Button) findViewById(R.id.exit);
exitButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
finish();
}
});
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_WIFI_STATE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_WIFI_STATE }, 1);
}
}
@Override
public void onBackPressed() {
finish();
}
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context="com.user.frontdoor.MainActivity">
<Button
android:id="@+id/exit"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/button"
android:text="@string/exit"
android:textColor="#ffff00" />
<WebView
android:id="@+id/browserView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/exit"
android:layout_marginTop="4dp" />
</RelativeLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.user.frontdoor" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/camera"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" android:label="@string/app_name">
<intent-enhancement>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-enhancement>
</activity>
</application>
</manifest>
button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<stroke android:width="1dip" android:color="#080808"/>
<gradient android:angle="-90" android:startColor="#161616" android:endColor="#161616"/>
<padding android:left="5dip" android:right="5dip" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<stroke android:width="1dip" android:color="#080808"/>
<solid android:color="#58857e"/>
<padding android:left="5dip" android:right="5dip" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<stroke android:width="1dip" android:color="#080808"/>
<gradient android:angle="-90" android:startColor="#121212" android:endColor="#121212"/>
<padding android:left="5dip" android:right="5dip" />
</shape>
</item>
</selector>