forked from mirrors/Fedilab
Fix issue #663 - Support nav & status bar colors for Android 5
This commit is contained in:
parent
f4a38504cd
commit
4fa8959f11
3 changed files with 26 additions and 3 deletions
|
@ -19,8 +19,11 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -32,7 +35,6 @@ import com.vanniktech.emoji.one.EmojiOneProvider;
|
|||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.helper.ThemeHelper;
|
||||
|
||||
|
||||
@SuppressLint("Registered")
|
||||
|
@ -125,8 +127,11 @@ public class BaseActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
||||
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.BLACK);
|
||||
window.setNavigationBarColor(Color.BLACK);
|
||||
}
|
||||
Helper.setLocale(this);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,11 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -111,6 +114,12 @@ public class BaseBarActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.BLACK);
|
||||
window.setNavigationBarColor(Color.BLACK);
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
||||
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
||||
}
|
||||
|
|
|
@ -19,8 +19,11 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -111,6 +114,12 @@ public class BaseTransparentActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.BLACK);
|
||||
window.setNavigationBarColor(Color.BLACK);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) {
|
||||
ThemeHelper.adjustFontScale(this, getResources().getConfiguration());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue