AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
@Override public void addContentView(View view, ViewGroup.LayoutParams params) { getDelegate().addContentView(view, params); }
@Override public MenuInflater getMenuInflater() { return getDelegate().getMenuInflater(); }
@Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); }
private static void activateFollowSystemMode(Context context, Boolean notifyUser) { // save the new state saveNightModeState(context, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // switch to Undefined Mode / Follow System AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); // notify user if (notifyUser) { Toast.makeText(context, context.getText(R.string.toastmessage_theme_follow_system), Toast.LENGTH_LONG).show(); } }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { // Don't initialize analytics with debug build if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); Utils.DARK_THEME = Themes.isDarkTheme(this); Themes.Theme theme = Themes.getTheme(this, Utils.DARK_THEME); if (Utils.DARK_THEME) { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); } else { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); } setTheme(theme.getStyle()); super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && setStatusBarColor()) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(statusBarColor()); } }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig); }
@Override protected void onDestroy() { super.onDestroy(); getDelegate().onDestroy(); }
public void invalidateOptionsMenu() { getDelegate().invalidateOptionsMenu(); }
public ActionBar getSupportActionBar() { return getDelegate().getSupportActionBar(); }
@Override public boolean onOptionsItemSelected(MenuItem menuItem) { if (menuItem.getItemId() == R.id.menu_night_mode) { menuItem.setChecked(!menuItem.isChecked()); if (menuItem.isChecked()) { AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); } else { AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); } getDelegate().applyDayNight(); } return true; }
@Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); }
private static void activateNightMode(Context context, Boolean notifyUser) { saveNightModeState(context, AppCompatDelegate.MODE_NIGHT_YES); // switch to Night Mode AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); // notify user if (notifyUser) { Toast.makeText(context, context.getText(R.string.toastmessage_theme_night), Toast.LENGTH_LONG).show(); } }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig); }
@Override protected void onDestroy() { super.onDestroy(); getDelegate().onDestroy(); }
@Override public void invalidateOptionsMenu() { getDelegate().invalidateOptionsMenu(); }
public ActionBar getSupportActionBar() { return getDelegate().getSupportActionBar(); }
@Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { LangHelper.updateLanguage(this); super.onCreate(savedInstanceState); AppCompatDelegate.setDefaultNightMode(SpHelper.getThemeMode(this)); }
@Override public void onCreate() { super.onCreate(); SugarContext.init(getApplicationContext()); SchemaGenerator schemaGenerator = new SchemaGenerator(this); schemaGenerator.createDatabase(new SugarDb(this).getDB()); mPrefs = new PreferenceManager(this); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig()) .setResizeAndRotateEnabledForNetwork(true) .setDownsampleEnabled(true) .build(); Fresco.initialize(this,config); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); if (mPrefs.getRemoteAccessActive()) startServer(); }