From 4eb910bebf6cab6eca2a3e71f2f8fdea31bff38e Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Apr 2015 17:19:23 -0700 Subject: Make pull to refresh be based on precense of touchscreen --- src/github/daneren2005/dsub/activity/SubsonicActivity.java | 13 +++++++++++-- .../daneren2005/dsub/activity/SubsonicFragmentActivity.java | 10 +++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index de0809db..fca60b5e 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Color; @@ -89,6 +90,7 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte protected View primaryContainer; protected View secondaryContainer; protected boolean tv = false; + protected boolean touchscreen = true; Spinner actionBarSpinner; ArrayAdapter spinnerAdapter; ViewGroup rootView; @@ -106,6 +108,10 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { tv = true; } + PackageManager pm = getPackageManager(); + if(!pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) { + touchscreen = false; + } setUncaughtExceptionHandler(); applyTheme(); @@ -370,8 +376,8 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte currentFragment.setContext(this); currentFragment.onCreateOptionsMenu(menu, menuInflater); - if(!isTv()) { - menu.setGroupVisible(R.id.tv, false); + if(isTouchscreen()) { + menu.setGroupVisible(R.id.not_touchscreen, false); } } catch(Exception e) { Log.w(TAG, "Error on creating options menu", e); @@ -796,6 +802,9 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte public boolean isTv() { return tv; } + public boolean isTouchscreen() { + return touchscreen; + } private void setUncaughtExceptionHandler() { Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index fde9ca77..21ed9893 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -252,9 +252,13 @@ public class SubsonicFragmentActivity extends SubsonicActivity { ChangeLog changeLog = new ChangeLog(this, Util.getPreferences(this)); if(changeLog.isFirstRun()) { - Dialog log = changeLog.getLogDialog(); - if(log != null) { - log.show(); + if(changeLog.isFirstRunEver()) { + changeLog.updateVersionInPreferences(); + } else { + Dialog log = changeLog.getLogDialog(); + if (log != null) { + log.show(); + } } } } -- cgit v1.2.3