aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-25 16:11:14 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-25 16:11:14 -0800
commit0997eec5eb80b874933036e1b42b6fbd50196ee0 (patch)
tree343476d7067a08498d480b33d735fde2724f1c3c
parent47823caa33966e573bcadb25613dbfa87befc65d (diff)
downloaddsub-0997eec5eb80b874933036e1b42b6fbd50196ee0.tar.gz
dsub-0997eec5eb80b874933036e1b42b6fbd50196ee0.tar.bz2
dsub-0997eec5eb80b874933036e1b42b6fbd50196ee0.zip
Add full screen logic, immersive mode for KitKat
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index c475d321..dc149def 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -610,25 +610,40 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
private void applyTheme() {
theme = Util.getTheme(this);
+
+ if(theme != null && theme.indexOf("fullscreen") != -1) {
+ theme = theme.substring(0, theme.indexOf("_fullscreen"));
+ }
+
if ("dark".equals(theme)) {
setTheme(R.style.Theme_DSub_Dark);
} else if ("black".equals(theme)) {
setTheme(R.style.Theme_DSub_Black);
} else if ("light".equals(theme)) {
setTheme(R.style.Theme_DSub_Light);
- } else if ("dark_fullscreen".equals(theme)) {
- setTheme(R.style.Theme_DSub_Dark_Fullscreen);
- } else if ("black_fullscreen".equals(theme)) {
- setTheme(R.style.Theme_DSub_Black_Fullscreen);
- } else if ("light_fullscreen".equals(theme)) {
- setTheme(R.style.Theme_DSub_Light_Fullscreen);
- } else if("holo".equals(theme)) {
- setTheme(R.style.Theme_DSub_Holo);
- } else if("holo_fullscreen".equals(theme)) {
- setTheme(R.style.Theme_DSub_Holo_Fullscreen);
- }else {
+ } else {
setTheme(R.style.Theme_DSub_Holo);
}
+
+ if(Util.getPreferences(this).getBoolean(Constants.PREFERENCES_KEY_FULL_SCREEN, false)) {
+ getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ // Hide additional elements on higher Android versions
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ int flags = 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;
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ flags = flags | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+ }
+
+ getWindow().getDecorView().setSystemUiVisibility(flags);
+ }
+ }
}
public boolean isDestroyed() {