private void changedMode(boolean isNight, int position) {
SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, isNight);
AppCompatDelegate.setDefaultNightMode(isNight ? AppCompatDelegate.MODE_NIGHT_YES
: AppCompatDelegate.MODE_NIGHT_NO);
if (position >= 0) {
curTheme = position;
} else {
curTheme = SettingManager.getInstance().getReadTheme();
}
gvAdapter.select(curTheme);
mPageWidget.setTheme(isNight ? ThemeManager.NIGHT : curTheme);
mPageWidget.setTextColor(ContextCompat.getColor(mContext, isNight ? R.color.chapter_content_night : R.color.chapter_content_day),
ContextCompat.getColor(mContext, isNight ? R.color.chapter_title_night : R.color.chapter_title_day));
mTvBookReadMode.setText(getString(isNight ? R.string.book_read_mode_day_manual_setting
: R.string.book_read_mode_night_manual_setting));
Drawable drawable = ContextCompat.getDrawable(this, isNight ? R.drawable.ic_menu_mode_day_manual
: R.drawable.ic_menu_mode_night_manual);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
mTvBookReadMode.setCompoundDrawables(null, drawable, null, null);
ThemeManager.setReaderTheme(curTheme, mRlBookReadRoot);
}
ReadActivity.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录