support KK tint and fullscreen mode when viewing article images

This commit is contained in:
Andrew Dolgov 2014-10-29 17:01:47 +03:00
parent f29dc70125
commit 3e535c4b24

View File

@ -1,10 +1,12 @@
package org.fox.ttrss; package org.fox.ttrss;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.util.Log; import android.util.Log;
@ -14,6 +16,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -149,6 +152,9 @@ public class ArticleImagesPagerActivity extends CommonActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
// we use that before parent onCreate so let's init locally
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
setTheme(R.style.DarkTheme); setTheme(R.style.DarkTheme);
@ -156,6 +162,8 @@ public class ArticleImagesPagerActivity extends CommonActivity {
setContentView(R.layout.article_images_pager); setContentView(R.layout.article_images_pager);
setStatusBarTint();
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState == null) { if (savedInstanceState == null) {
@ -179,6 +187,22 @@ public class ArticleImagesPagerActivity extends CommonActivity {
indicator.setViewPager(pager); indicator.setViewPager(pager);
} }
@SuppressLint("NewApi")
@Override
public void onResume() {
super.onResume();
/* if (isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) {
setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
} */
if (m_prefs.getBoolean("full_screen_mode", false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
@Override @Override
public void onCreateContextMenu(ContextMenu menu, View v, public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) { ContextMenu.ContextMenuInfo menuInfo) {
@ -215,6 +239,7 @@ public class ArticleImagesPagerActivity extends CommonActivity {
return onContextItemSelected(item); // this is really bad :() return onContextItemSelected(item); // this is really bad :()
} }
@Override @Override
public boolean onContextItemSelected(android.view.MenuItem item) { public boolean onContextItemSelected(android.view.MenuItem item) {
ViewPager pager = (ViewPager) findViewById(R.id.article_images_pager); ViewPager pager = (ViewPager) findViewById(R.id.article_images_pager);