Fixed issues with statusBar coloring appearing on KitKat, read the instructions in ThemeBaseActivity
This commit is contained in:
parent
69ffac805a
commit
9f9fc51088
6 changed files with 26 additions and 7 deletions
|
|
@ -94,7 +94,7 @@ public class MainActivity extends AbsFabActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldColorStatusBar() {
|
protected boolean shouldColorStatusBar() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
||||||
import com.kabouzeid.gramophone.util.PreferenceUtils;
|
import com.kabouzeid.gramophone.util.PreferenceUtils;
|
||||||
|
import com.kabouzeid.gramophone.util.Util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ public class PlaylistDetailActivity extends AbsFabActivity {
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setStatusBarTranslucent(false);
|
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_playlist_detail);
|
setContentView(R.layout.activity_playlist_detail);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,22 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
|
||||||
/**
|
/**
|
||||||
* @author Aidan Follestad (afollestad)
|
* @author Aidan Follestad (afollestad)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* READ!
|
||||||
|
*
|
||||||
|
* Instructions:
|
||||||
|
*
|
||||||
|
* KitKat or Lollipop solid statusBar with the right color (primaryDark):
|
||||||
|
* - shouldColorStatusBar return true OR return false and call setStatusBarColor() in the activity with a custom color
|
||||||
|
* - setStatusBarTranslucent(!Util.hasLollipopSDK())
|
||||||
|
*
|
||||||
|
* KitKat or Lollipop translucent statusBar (not the color is too dark on Lollipop and KitKat only does fading but MUCH better performance the setStatusBarColor in onScrollCallback)
|
||||||
|
* - shouldColorStatusBar return false DO NOT return true and do not call setStatusBarColor() in this case at all here
|
||||||
|
* - setStatusBarTranslucent(true)
|
||||||
|
* - use a view below the statusBar to color it
|
||||||
|
*/
|
||||||
|
|
||||||
public abstract class ThemeBaseActivity extends ActionBarActivity implements KabViewsDisableAble {
|
public abstract class ThemeBaseActivity extends ActionBarActivity implements KabViewsDisableAble {
|
||||||
|
|
||||||
// private boolean mLastDarkTheme;
|
// private boolean mLastDarkTheme;
|
||||||
|
|
@ -39,7 +55,7 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
getWindow().setNavigationBarColor(primaryDark);
|
getWindow().setNavigationBarColor(primaryDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatusBarColor(primaryDark, false);
|
if (shouldColorStatusBar()) setStatusBarColor(primaryDark, false);
|
||||||
|
|
||||||
// Persist current values so the Activity knows if they change
|
// Persist current values so the Activity knows if they change
|
||||||
// mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
|
// mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
|
||||||
|
|
@ -77,7 +93,7 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
|
|
||||||
protected void setStatusBarTranslucent(boolean statusBarTranslucent) {
|
protected void setStatusBarTranslucent(boolean statusBarTranslucent) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent);
|
Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setStatusBarTranslucent(false);
|
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(getContentViewResId());
|
setContentView(getContentViewResId());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true">
|
android:focusableInTouchMode="true">
|
||||||
|
|
||||||
|
|
@ -26,13 +27,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/image"
|
android:layout_alignBottom="@+id/image"
|
||||||
|
android:elevation="@dimen/toolbar_elevation"
|
||||||
android:minHeight="@dimen/title_view_height"
|
android:minHeight="@dimen/title_view_height"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:elevation="@dimen/toolbar_elevation"
|
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.views.DynamicEditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:focusableInTouchMode="true">
|
android:focusableInTouchMode="true">
|
||||||
|
|
||||||
|
|
@ -26,13 +27,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/image"
|
android:layout_alignBottom="@+id/image"
|
||||||
|
android:elevation="@dimen/toolbar_elevation"
|
||||||
android:minHeight="@dimen/title_view_height"
|
android:minHeight="@dimen/title_view_height"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:elevation="@dimen/toolbar_elevation"
|
|
||||||
tools:ignore="UnusedAttribute">
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
<com.kabouzeid.gramophone.views.DynamicEditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue