Skip to content

Commit

Permalink
Version 0.6, dropped API minimum to API16 (4.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
quadportnick committed Apr 25, 2017
1 parent e7fec93 commit 11b5a41
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 24 deletions.
4 changes: 2 additions & 2 deletions WallPanelApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ android {
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "de.rhuber.homedash"
minSdkVersion 19
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName '0.5'
versionName '0.6'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion WallPanelApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="de.rhuber.homedash">

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25"
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25"
tools:ignore="GradleOverrides" />

<!-- Permissions the Application Requires -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.opengl.GLES11Ext;
import android.os.Build;
import android.os.Handler;
import android.util.Log;

Expand Down Expand Up @@ -107,7 +108,9 @@ public MotionDetector(int cameraId) {
mCameraId = cameraId;
detector = new AggregateLumaMotionDetection();

mSurfaceTexture = new SurfaceTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
mSurfaceTexture = new SurfaceTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
}
}

public void setMotionDetectorCallback(MotionDetectorCallback motionDetectorCallback) {
Expand Down
25 changes: 16 additions & 9 deletions WallPanelApp/src/main/java/de/rhuber/homedash/BrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
Expand Down Expand Up @@ -40,8 +41,11 @@ protected void onCreate(Bundle savedInstanceState) {
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN ;
int uiOptions = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
}

decorView.setSystemUiVisibility(uiOptions);

Expand All @@ -61,13 +65,16 @@ protected void onCreate(Bundle savedInstanceState) {
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
}

// handler for received data from service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ protected void loadUrl(final String url) {

@Override
protected void evaluateJavascript(final String js) {
mWebView.evaluateJavascript(js, null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mWebView.evaluateJavascript(js, null);
}
}

@Override
Expand Down
23 changes: 13 additions & 10 deletions WallPanelApp/src/main/java/de/rhuber/homedash/WallPanelService.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ private void startForeground(){
Intent notificationIntent = new Intent(this, WallPanelService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

Notification notification;
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
Notification notification = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
notification = new Notification.Builder(this)
.setContentTitle(getText(R.string.wallpanel_service_notification_title))
.setContentText(getText(R.string.wallpanel_service_notification_message))
Expand All @@ -168,16 +168,19 @@ private void startForeground(){
.setLocalOnly(true)
.build();
} else {
notification = new Notification.Builder(this)
.setContentTitle(getText(R.string.wallpanel_service_notification_title))
.setContentText(getText(R.string.wallpanel_service_notification_message))
.setSmallIcon(R.drawable.ic_home_white_24dp)
.setLargeIcon(BitmapFactory.decodeResource(getApplication().getResources(),R.mipmap.wallpanel_icon))
.setContentIntent(pendingIntent)
.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification = new Notification.Builder(this)
.setContentTitle(getText(R.string.wallpanel_service_notification_title))
.setContentText(getText(R.string.wallpanel_service_notification_message))
.setSmallIcon(R.drawable.ic_home_white_24dp)
.setLargeIcon(BitmapFactory.decodeResource(getApplication().getResources(),R.mipmap.wallpanel_icon))
.setContentIntent(pendingIntent)
.build();
}
}

startForeground(ONGOING_NOTIFICATION_ID, notification);
if (notification != null)
startForeground(ONGOING_NOTIFICATION_ID, notification);
}

private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
Expand Down

0 comments on commit 11b5a41

Please sign in to comment.