statusbartint stuff

This commit is contained in:
Andrew Dolgov 2014-10-15 23:07:52 +04:00
parent 34f23b9901
commit a88c49c633
9 changed files with 55 additions and 2 deletions

View File

@ -13,3 +13,4 @@ android.library.reference.1=..\\Android-ViewPagerIndicator\\library
android.library.reference.2=..\\tasker-locale-api
android.library.reference.3=..\\appcompat
android.library.reference.4=..\\SlidingMenu\\library
android.library.reference.5=../SystemBarTint/SystemBarTint-library

View File

@ -27,4 +27,5 @@
<attr name="unreadSelectedCounterBackground" format="reference|color" />
<attr name="articleNoteBackground" format="reference|color" />
<attr name="articleNoteTextColor" format="reference|color" />
<attr name="statusBarHintColor" format="reference|color" />
</resources>

View File

@ -1,5 +1,10 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:fitsSystemWindows">true</item>
<item name="statusBarHintColor">#6482AF</item>
<item name="smallScreenBackground">#eeeeee</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_bright</item>
<item name="feedlistBackground"><!-- #e0e0e0 -->@drawable/shadow_feeds</item>
@ -31,6 +36,11 @@
</style>
<style name="SepiaTheme" parent="LightTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:fitsSystemWindows">true</item>
<item name="statusBarHintColor">#7F3F3F</item>
<item name="smallScreenBackground">@drawable/paper_sepia</item>
<item name="feedlistBackground">@drawable/shadow_feeds_sepia</item>
<item name="headlinesBackground">@drawable/shadow_headlines_sepia</item>
@ -48,6 +58,11 @@
</style>
<style name="HoloTheme" parent="Theme.AppCompat">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:fitsSystemWindows">true</item>
<item name="statusBarHintColor">@android:color/black</item>
<item name="smallScreenBackground">@android:color/transparent</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">@android:color/transparent</item>
@ -78,6 +93,11 @@
</style>
<style name="DarkTheme" parent="HoloTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:fitsSystemWindows">true</item>
<item name="statusBarHintColor">#394A63</item>
<item name="smallScreenBackground">@color/feeds_dark_gray</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">@drawable/shadow_feeds_gray</item>

View File

@ -2,6 +2,8 @@ package org.fox.ttrss;
import org.fox.ttrss.util.DatabaseHelper;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
@ -11,6 +13,7 @@ import android.preference.PreferenceManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
import android.widget.TextView;
@ -132,6 +135,21 @@ public class CommonActivity extends ActionBarActivity {
super.onCreate(savedInstanceState);
}
public void setStatusBarTint() {
if (android.os.Build.VERSION.SDK_INT == android.os.Build.VERSION_CODES.KITKAT) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
TypedValue tv = new TypedValue();
getTheme().resolveAttribute(R.attr.statusBarHintColor, tv, true);
tintManager.setStatusBarTintColor(tv.data);
}
}
@Override
public void onSaveInstanceState(Bundle out) {

View File

@ -20,11 +20,15 @@ import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import com.google.gson.JsonElement;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.readystatesoftware.systembartint.SystemBarTintManager;
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
private final String TAG = this.getClass().getSimpleName();
@ -50,7 +54,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onCreate(savedInstanceState);
setContentView(R.layout.headlines);
setContentView(R.layout.headlines);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null &&
findViewById(R.id.sw600dp_port_anchor) == null);

View File

@ -34,6 +34,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState);

View File

@ -170,6 +170,8 @@ public class OnlineActivity extends CommonActivity {
Log.d(TAG, "m_isOffline=" + isOffline);
setContentView(R.layout.login);
setStatusBarTint();
//m_pullToRefreshAttacher = PullToRefreshAttacher.get(this);

View File

@ -39,7 +39,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
super.onCreate(savedInstanceState);
setContentView(R.layout.headlines);
setContentView(R.layout.headlines);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null &&
findViewById(R.id.sw600dp_port_anchor) == null);

View File

@ -36,6 +36,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setStatusBarTint();
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
if (isPortrait() || m_prefs.getBoolean("headlines_hide_sidebar", false)) {