add option to dim statusbar while reading

This commit is contained in:
Andrew Dolgov 2012-10-09 13:16:05 +04:00
parent 2de1fc8130
commit 2424b72246
3 changed files with 25 additions and 4 deletions

View File

@ -144,4 +144,5 @@
<string name="ssl">SSL</string>
<string name="error_ssl_hostname_rejected">Error: SSL hostname not verified</string>
<string name="offline_oldest_first">Show oldest articles first</string>
<string name="prefs_dim_status_bar">Dim status bar when reading</string>
</resources>

View File

@ -23,9 +23,7 @@
android:title="@string/ttrss_url" >
</EditTextPreference>
</PreferenceCategory>
<PreferenceCategory
android:summary="blah blah blah"
android:title="@string/ssl" >
<PreferenceCategory android:title="@string/ssl" >
<CheckBoxPreference
android:defaultValue="false"
android:key="ssl_trust_any"
@ -113,6 +111,12 @@
android:key="use_volume_keys"
android:summary="@string/use_volume_keys_long"
android:title="@string/use_volume_keys" />
<CheckBoxPreference
android:defaultValue="false"
android:key="dim_status_bar"
android:title="@string/prefs_dim_status_bar" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" >
<CheckBoxPreference

View File

@ -7,8 +7,11 @@ import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed;
import org.fox.ttrss.util.HeadlinesRequest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
@ -30,6 +33,7 @@ public class ArticlePager extends Fragment {
private OnlineActivity m_activity;
private String m_searchQuery = "";
private Feed m_feed;
private SharedPreferences m_prefs;
private class PagerAdapter extends FragmentStatePagerAdapter {
@ -123,6 +127,11 @@ public class ArticlePager extends Fragment {
}
});
if (m_prefs.getBoolean("dim_status_bar", false)) {
view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
}
return view;
}
@ -229,8 +238,11 @@ public class ArticlePager extends Fragment {
m_listener = (HeadlinesEventListener)activity;
m_activity = (OnlineActivity)activity;
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
}
@SuppressLint("NewApi")
@Override
public void onResume() {
super.onResume();
@ -241,6 +253,10 @@ public class ArticlePager extends Fragment {
}
m_activity.initMenu();
if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) {
getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
}
}
public Article getSelectedArticle() {