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