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="ssl">SSL</string>
<string name="error_ssl_hostname_rejected">Error: SSL hostname not verified</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="offline_oldest_first">Show oldest articles first</string>
<string name="prefs_dim_status_bar">Dim status bar when reading</string>
</resources> </resources>

View File

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

View File

@ -7,8 +7,11 @@ import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.Feed;
import org.fox.ttrss.util.HeadlinesRequest; import org.fox.ttrss.util.HeadlinesRequest;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
@ -30,6 +33,7 @@ public class ArticlePager extends Fragment {
private OnlineActivity m_activity; private OnlineActivity m_activity;
private String m_searchQuery = ""; private String m_searchQuery = "";
private Feed m_feed; private Feed m_feed;
private SharedPreferences m_prefs;
private class PagerAdapter extends FragmentStatePagerAdapter { 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; return view;
} }
@ -229,8 +238,11 @@ public class ArticlePager extends Fragment {
m_listener = (HeadlinesEventListener)activity; m_listener = (HeadlinesEventListener)activity;
m_activity = (OnlineActivity)activity; m_activity = (OnlineActivity)activity;
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
} }
@SuppressLint("NewApi")
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -241,6 +253,10 @@ public class ArticlePager extends Fragment {
} }
m_activity.initMenu(); 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() { public Article getSelectedArticle() {