mirror of https://github.com/beemdevelopment/Aegis
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
7 years ago
|
package com.beemdevelopment.aegis.ui;
|
||
8 years ago
|
|
||
|
import android.os.Bundle;
|
||
7 years ago
|
import androidx.appcompat.app.AppCompatActivity;
|
||
7 years ago
|
import android.view.WindowManager;
|
||
8 years ago
|
|
||
7 years ago
|
import com.beemdevelopment.aegis.AegisApplication;
|
||
|
import com.beemdevelopment.aegis.Preferences;
|
||
|
import com.beemdevelopment.aegis.R;
|
||
8 years ago
|
|
||
8 years ago
|
public abstract class AegisActivity extends AppCompatActivity {
|
||
|
private AegisApplication _app;
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
_app = (AegisApplication) getApplication();
|
||
|
|
||
7 years ago
|
// set FLAG_SECURE on the window of every AegisActivity
|
||
7 years ago
|
if (getPreferences().isSecureScreenEnabled()) {
|
||
7 years ago
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||
|
}
|
||
7 years ago
|
|
||
|
// set the theme
|
||
7 years ago
|
setPreferredTheme(getPreferences().isDarkModeEnabled());
|
||
8 years ago
|
}
|
||
|
|
||
|
protected AegisApplication getApp() {
|
||
|
return _app;
|
||
|
}
|
||
|
|
||
7 years ago
|
protected Preferences getPreferences() {
|
||
|
return _app.getPreferences();
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
protected void setPreferredTheme(boolean darkMode) {
|
||
|
if (darkMode) {
|
||
|
setTheme(R.style.AppTheme_Dark);
|
||
|
} else {
|
||
|
setTheme(R.style.AppTheme);
|
||
|
}
|
||
|
}
|
||
8 years ago
|
}
|