Cleaned up setStatusBarTranslucent method

This commit is contained in:
Karim Abou Zeid 2015-07-21 17:59:05 +02:00
commit 9334fa1f20
2 changed files with 5 additions and 15 deletions

View file

@ -105,7 +105,7 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
Util.setAllowDrawUnderStatusBar(getWindow());
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
Util.setStatusBarTranslucent(getWindow(), true);
Util.setStatusBarTranslucent(getWindow());
}
protected final void setNavigationBarColor(int color) {

View file

@ -45,20 +45,10 @@ public class Util {
}
@TargetApi(19)
public static void setStatusBarTranslucent(@NonNull Window window, boolean translucent) {
if (translucent) {
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
return;
}
final WindowManager.LayoutParams attrs = window
.getAttributes();
attrs.flags &= (~WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setAttributes(attrs);
window.clearFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
public static void setStatusBarTranslucent(@NonNull Window window) {
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
public static void setAllowDrawUnderStatusBar(@NonNull Window window) {