diff options
Diffstat (limited to 'src/github/daneren2005/dsub')
4 files changed, 20 insertions, 7 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 46f7421f..90e7dda5 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<CharSequence> 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();
+ }
}
}
}
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 8bd01cd6..b6b67a7b 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -609,7 +609,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
protected void setupScrollList(final AbsListView listView) {
- if(context.isTv()) {
+ if(!context.isTouchscreen()) {
refreshLayout.setEnabled(false);
} else {
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
diff --git a/src/github/daneren2005/dsub/view/ChangeLog.java b/src/github/daneren2005/dsub/view/ChangeLog.java index 5a7850ff..096583c7 100644 --- a/src/github/daneren2005/dsub/view/ChangeLog.java +++ b/src/github/daneren2005/dsub/view/ChangeLog.java @@ -324,7 +324,7 @@ public class ChangeLog { /** * Write current version code to the preferences. */ - protected void updateVersionInPreferences() { + public void updateVersionInPreferences() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sp.edit(); editor.putInt(VERSION_KEY, mCurrentVersionCode); |