Java Code Examples for org.telegram.ui.ActionBar.Theme#getCurrentNightTheme()
The following examples show how to use
org.telegram.ui.ActionBar.Theme#getCurrentNightTheme() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThemesHorizontalListCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void scrollToCurrentTheme(int width, boolean animated) { if (width == 0) { View parent = (View) getParent(); if (parent != null) { width = parent.getMeasuredWidth(); } } if (width == 0) { return; } prevThemeInfo = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); int index = defaultThemes.indexOf(prevThemeInfo); if (index < 0) { index = darkThemes.indexOf(prevThemeInfo) + defaultThemes.size(); if (index < 0) { return; } } if (animated) { smoothScrollToPosition(index); } else { horizontalLayoutManager.scrollToPositionWithOffset(index, (width - AndroidUtilities.dp(76)) / 2); } }
Example 2
Source File: ThemesHorizontalListCell.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void scrollToCurrentTheme(int width, boolean animated) { if (width == 0) { View parent = (View) getParent(); if (parent != null) { width = parent.getMeasuredWidth(); } } if (width == 0) { return; } prevThemeInfo = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); int index = defaultThemes.indexOf(prevThemeInfo); if (index < 0) { index = darkThemes.indexOf(prevThemeInfo) + defaultThemes.size(); if (index < 0) { return; } } if (animated) { smoothScrollToPosition(index); } else { horizontalLayoutManager.scrollToPositionWithOffset(index, (width - AndroidUtilities.dp(76)) / 2); } }
Example 3
Source File: ThemeCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo currentTheme; if (isNightTheme) { currentTheme = Theme.getCurrentNightTheme(); } else { currentTheme = Theme.getCurrentTheme(); } int newVisibility = currentThemeInfo == currentTheme ? VISIBLE : INVISIBLE; if (checkImage.getVisibility() != newVisibility) { checkImage.setVisibility(newVisibility); } }
Example 4
Source File: ThemeCell.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo currentTheme; if (isNightTheme) { currentTheme = Theme.getCurrentNightTheme(); } else { currentTheme = Theme.getCurrentTheme(); } int newVisibility = currentThemeInfo == currentTheme ? VISIBLE : INVISIBLE; if (checkImage.getVisibility() != newVisibility) { checkImage.setVisibility(newVisibility); } }
Example 5
Source File: ThemesHorizontalListCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); button.setChecked(themeInfo == t, false); if (themeInfo != null && themeInfo.info != null && !themeInfo.themeLoaded) { String name = FileLoader.getAttachFileName(themeInfo.info.document); if (!loadingThemes.containsKey(name) && !loadingWallpapers.containsKey(themeInfo)) { themeInfo.themeLoaded = true; placeholderAlpha = 0.0f; parseTheme(); applyTheme(); } } }
Example 6
Source File: ThemesHorizontalListCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void selectTheme(Theme.ThemeInfo themeInfo) { if (themeInfo.info != null) { if (!themeInfo.themeLoaded) { return; } if (themeInfo.info.document == null) { presentFragment(new ThemeSetUrlActivity(themeInfo, null, true)); return; } } if (!TextUtils.isEmpty(themeInfo.assetName)) { Theme.PatternsLoader.createLoader(false); } if (currentType != ThemeActivity.THEME_TYPE_OTHER) { SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE).edit(); editor.putString(currentType == ThemeActivity.THEME_TYPE_NIGHT || themeInfo.isDark() ? "lastDarkTheme" : "lastDayTheme", themeInfo.getKey()); editor.commit(); } if (currentType == ThemeActivity.THEME_TYPE_NIGHT) { if (themeInfo == Theme.getCurrentNightTheme()) { return; } Theme.setCurrentNightTheme(themeInfo); } else { if (themeInfo == Theme.getCurrentTheme()) { return; } NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, themeInfo, false, null, -1); } updateRows(); int count = getChildCount(); for (int a = 0; a < count; a++) { View child = getChildAt(a); if (child instanceof InnerThemeView) { ((InnerThemeView) child).updateCurrentThemeCheck(); } } }
Example 7
Source File: ThemesHorizontalListCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void notifyDataSetChanged(int width) { if (prevCount == adapter.getItemCount()) { return; } adapter.notifyDataSetChanged(); Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); if (prevThemeInfo != t) { scrollToCurrentTheme(width, false); } }
Example 8
Source File: ThemeCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo currentTheme; if (isNightTheme) { currentTheme = Theme.getCurrentNightTheme(); } else { currentTheme = Theme.getCurrentTheme(); } int newVisibility = currentThemeInfo == currentTheme ? VISIBLE : INVISIBLE; if (checkImage.getVisibility() != newVisibility) { checkImage.setVisibility(newVisibility); } }
Example 9
Source File: ThemesHorizontalListCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); button.setChecked(themeInfo == t, false); if (themeInfo != null && themeInfo.info != null && !themeInfo.themeLoaded) { String name = FileLoader.getAttachFileName(themeInfo.info.document); if (!loadingThemes.containsKey(name) && !loadingWallpapers.containsKey(themeInfo)) { themeInfo.themeLoaded = true; placeholderAlpha = 0.0f; parseTheme(); applyTheme(); } } }
Example 10
Source File: ThemesHorizontalListCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void selectTheme(Theme.ThemeInfo themeInfo) { if (themeInfo.info != null) { if (!themeInfo.themeLoaded) { return; } if (themeInfo.info.document == null) { presentFragment(new ThemeSetUrlActivity(themeInfo, null, true)); return; } } if (!TextUtils.isEmpty(themeInfo.assetName)) { Theme.PatternsLoader.createLoader(false); } if (currentType != ThemeActivity.THEME_TYPE_OTHER) { SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE).edit(); editor.putString(currentType == ThemeActivity.THEME_TYPE_NIGHT || themeInfo.isDark() ? "lastDarkTheme" : "lastDayTheme", themeInfo.getKey()); editor.commit(); } if (currentType == ThemeActivity.THEME_TYPE_NIGHT) { if (themeInfo == Theme.getCurrentNightTheme()) { return; } Theme.setCurrentNightTheme(themeInfo); } else { if (themeInfo == Theme.getCurrentTheme()) { return; } NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, themeInfo, false, null, -1); } updateRows(); int count = getChildCount(); for (int a = 0; a < count; a++) { View child = getChildAt(a); if (child instanceof InnerThemeView) { ((InnerThemeView) child).updateCurrentThemeCheck(); } } }
Example 11
Source File: ThemesHorizontalListCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void notifyDataSetChanged(int width) { if (prevCount == adapter.getItemCount()) { return; } adapter.notifyDataSetChanged(); Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); if (prevThemeInfo != t) { scrollToCurrentTheme(width, false); } }
Example 12
Source File: ThemeCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo currentTheme; if (isNightTheme) { currentTheme = Theme.getCurrentNightTheme(); } else { currentTheme = Theme.getCurrentTheme(); } int newVisibility = currentThemeInfo == currentTheme ? VISIBLE : INVISIBLE; if (checkImage.getVisibility() != newVisibility) { checkImage.setVisibility(newVisibility); } }
Example 13
Source File: ThemesHorizontalListCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); button.setChecked(themeInfo == t, true); }
Example 14
Source File: ThemeActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void notifyDataSetChanged() { currentTheme = currentType == THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); themeAccents = new ArrayList<>(currentTheme.themeAccents); super.notifyDataSetChanged(); }
Example 15
Source File: ThemesHorizontalListCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void updateCurrentThemeCheck() { Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); button.setChecked(themeInfo == t, true); }
Example 16
Source File: ThemeActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public void notifyDataSetChanged() { currentTheme = currentType == THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme(); themeAccents = new ArrayList<>(currentTheme.themeAccents); super.notifyDataSetChanged(); }