androidx.appcompat.app.AppCompatDelegate类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(279)

本文整理了Java中androidx.appcompat.app.AppCompatDelegate类的一些代码示例,展示了AppCompatDelegate类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatDelegate类的具体详情如下:
包路径:androidx.appcompat.app.AppCompatDelegate
类名称:AppCompatDelegate

AppCompatDelegate介绍

暂无

代码示例

代码示例来源:origin: aurelhubert/ahbottomnavigation

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

代码示例来源:origin: ankidroid/Anki-Android

@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
  getDelegate().addContentView(view, params);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public MenuInflater getMenuInflater() {
  return getDelegate().getMenuInflater();
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected void onCreate(Bundle savedInstanceState) {
  getDelegate().installViewFactory();
  getDelegate().onCreate(savedInstanceState);
  super.onCreate(savedInstanceState);
}

代码示例来源:origin: y20k/transistor

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();
  }
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@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());
  }
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  getDelegate().onConfigurationChanged(newConfig);
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
protected void onDestroy() {
  super.onDestroy();
  getDelegate().onDestroy();
}

代码示例来源:origin: ankidroid/Anki-Android

public void invalidateOptionsMenu() {
  getDelegate().invalidateOptionsMenu();
}

代码示例来源:origin: ankidroid/Anki-Android

public ActionBar getSupportActionBar() {
  return getDelegate().getSupportActionBar();
}

代码示例来源:origin: PureWriter/about-page

@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;
}

代码示例来源:origin: skydoves/ColorPickerPreference

@Override
protected void onCreate(Bundle savedInstanceState) {
 getDelegate().installViewFactory();
 getDelegate().onCreate(savedInstanceState);
 super.onCreate(savedInstanceState);
}

代码示例来源:origin: y20k/transistor

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();
  }
}

代码示例来源:origin: skydoves/ColorPickerPreference

@Override
public void onConfigurationChanged(Configuration newConfig) {
 super.onConfigurationChanged(newConfig);
 getDelegate().onConfigurationChanged(newConfig);
}

代码示例来源:origin: AndroidDeveloperLB/MaterialPreferenceLibrary

@Override
protected void onDestroy() {
  super.onDestroy();
  getDelegate().onDestroy();
}

代码示例来源:origin: KDE/kdeconnect-android

@Override
public void invalidateOptionsMenu() {
  getDelegate().invalidateOptionsMenu();
}

代码示例来源:origin: AndroidDeveloperLB/MaterialPreferenceLibrary

public ActionBar getSupportActionBar() {
  return getDelegate().getSupportActionBar();
}

代码示例来源:origin: sschueller/peertube-android

@Override
protected void onCreate(Bundle savedInstanceState) {
  getDelegate().installViewFactory();
  getDelegate().onCreate(savedInstanceState);
  super.onCreate(savedInstanceState);
}

代码示例来源:origin: 8enet/AppOpsX

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
 LangHelper.updateLanguage(this);
 super.onCreate(savedInstanceState);
 AppCompatDelegate.setDefaultNightMode(SpHelper.getThemeMode(this));
}

代码示例来源:origin: guardianproject/haven

@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();
}

相关文章