Cleaned up setStatusBarTranslucent method
This commit is contained in:
parent
fa40a6915c
commit
9334fa1f20
2 changed files with 5 additions and 15 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue