diff options
author | Andrew Dolgov <[email protected]> | 2013-11-28 21:01:12 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-11-28 21:01:12 +0400 |
commit | 1459b681fce654c72a180a746646be4a9b4ab9e5 (patch) | |
tree | c151fa54995a11f92ed58abad279551888091423 /src | |
parent | 6a30739a17392825d6eff46541bbbdd190473ab6 (diff) |
target api 19, support immersive mode
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttcomics/ComicFragment.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttcomics/ComicPager.java | 7 | ||||
-rw-r--r-- | src/org/fox/ttcomics/CommonActivity.java | 45 | ||||
-rw-r--r-- | src/org/fox/ttcomics/ViewComicActivity.java | 13 |
4 files changed, 56 insertions, 11 deletions
diff --git a/src/org/fox/ttcomics/ComicFragment.java b/src/org/fox/ttcomics/ComicFragment.java index 43bf77f..1523726 100644 --- a/src/org/fox/ttcomics/ComicFragment.java +++ b/src/org/fox/ttcomics/ComicFragment.java @@ -319,7 +319,9 @@ public class ComicFragment extends Fragment implements GestureDetector.OnDoubleT if (bar.isShowing()) {
bar.hide();
+ m_activity.hideSystemUiIfNecessary();
} else {
+ m_activity.showSystemUiIfNecessary();
bar.show();
}
}
diff --git a/src/org/fox/ttcomics/ComicPager.java b/src/org/fox/ttcomics/ComicPager.java index 55b71d1..260194c 100644 --- a/src/org/fox/ttcomics/ComicPager.java +++ b/src/org/fox/ttcomics/ComicPager.java @@ -115,6 +115,7 @@ public class ComicPager extends Fragment { m_activity.onComicSelected(m_fileName, position);
m_activity.setProgress(Math.round(((float)position / (float)(m_archive.getCount()-1)) * 10000));
+ m_activity.hideSystemUiIfNecessary();
} catch (IOException e) {
m_activity.toast(R.string.error_could_not_open_comic_archive);
@@ -129,10 +130,8 @@ public class ComicPager extends Fragment { m_activity.onComicSelected(m_fileName, position);
m_activity.setProgress(Math.round(((float)position / (float)(m_archive.getCount()-1)) * 10000));
-
- if (!CommonActivity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) {
- view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
- }
+
+ m_activity.hideSystemUiIfNecessary();
}
public void onPageScrolled(int arg0, float arg1, int arg2) {
diff --git a/src/org/fox/ttcomics/CommonActivity.java b/src/org/fox/ttcomics/CommonActivity.java index 9069949..4df6de7 100644 --- a/src/org/fox/ttcomics/CommonActivity.java +++ b/src/org/fox/ttcomics/CommonActivity.java @@ -21,6 +21,8 @@ import android.preference.PreferenceManager; import android.provider.BaseColumns;
import android.util.Log;
import android.view.Display;
+import android.view.View;
+import android.view.WindowManager;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity;
@@ -531,4 +533,47 @@ public class CommonActivity extends SherlockFragmentActivity { c.close();
}
+ public void showSystemUiIfNecessary() {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
+ getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+ }
+
+ public void hideSystemUiIfNecessary() {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
+ if (m_prefs.getBoolean("use_full_screen", false)) {
+
+ getWindow().getDecorView().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);
+
+ } else if (m_prefs.getBoolean("dim_status_bar", false)) {
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
+ }
+
+ } else {
+
+ if (!isCompatMode()) {
+ if (m_prefs.getBoolean("dim_status_bar", false)) {
+ getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
+ }
+ }
+
+ if (m_prefs.getBoolean("use_full_screen", false)) {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ getSupportActionBar().hide();
+ }
+
+ }
+
+
+ }
}
diff --git a/src/org/fox/ttcomics/ViewComicActivity.java b/src/org/fox/ttcomics/ViewComicActivity.java index e38d54d..3b8f8c9 100644 --- a/src/org/fox/ttcomics/ViewComicActivity.java +++ b/src/org/fox/ttcomics/ViewComicActivity.java @@ -64,13 +64,12 @@ public class ViewComicActivity extends CommonActivity { setTitle(new File(m_fileName).getName());
- if (m_prefs.getBoolean("use_full_screen", false)) {
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
-
- getSupportActionBar().hide();
- }
-
+ /* if (m_prefs.getBoolean("use_full_screen", false)) {
+ //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ // WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ //getSupportActionBar().hide();
+ } */
}
@Override
|