android.support.v7.app.AppCompatDelegate.applyDayNight()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(113)

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

AppCompatDelegate.applyDayNight介绍

暂无

代码示例

代码示例来源:origin: nekocode/JarFilterPlugin

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  // !!! Make some modifications
  Toast.makeText(getApplicationContext(), "Hello World!", Toast.LENGTH_SHORT).show();
  final AppCompatDelegate delegate = getDelegate();
  delegate.installViewFactory();
  delegate.onCreate(savedInstanceState);
  if (delegate.applyDayNight() && mThemeId != 0) {
    // If DayNight has been applied, we need to re-apply the theme for
    // the changes to take effect. On API 23+, we should bypass
    // setTheme(), which will no-op if the theme ID is identical to the
    // current theme ID.
    if (Build.VERSION.SDK_INT >= 23) {
      onApplyThemeResource(getTheme(), mThemeId, false);
    } else {
      setTheme(mThemeId);
    }
  }
  super.onCreate(savedInstanceState);
}

代码示例来源:origin: achenglike/NightModel

public void applyNightModel(AppCompatActivity activity){
  invokeResources(activity);
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
  activity.getDelegate().applyDayNight();
  applyNewModel();
  PersistenceUtils.setNightModel(activity.getApplicationContext(), true);
  ModelChangeManager.getInstance().notifyChange(true);
}

代码示例来源:origin: achenglike/NightModel

public void applyDayModel(AppCompatActivity activity) {
  invokeResources(activity);
  AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
  activity.getDelegate().applyDayNight();
  applyNewModel();
  PersistenceUtils.setNightModel(activity.getApplicationContext(), false);
  ModelChangeManager.getInstance().notifyChange(false);
}

代码示例来源:origin: gigabytedevelopers/FireFiles

@Override
protected void onCreate(Bundle savedInstanceState) {
  Utils.changeThemeStyle(getDelegate());
  getDelegate().installViewFactory();
  getDelegate().onCreate(savedInstanceState);
  if (mDelegate.applyDayNight() && mThemeId != 0) {
    // If DayNight has been applied, we need to re-apply the theme for
    // the changes to take effect. On API 23+, we should bypass
    // setTheme(), which will no-op if the theme ID is identical to the
    // current theme ID.
    if (Build.VERSION.SDK_INT >= 23) {
      onApplyThemeResource(getTheme(), mThemeId, false);
    } else {
      setTheme(mThemeId);
    }
  }
  super.onCreate(savedInstanceState);
  AnalyticsManager.setCurrentScreen(this, getTag());
}

相关文章

微信公众号

最新文章

更多