Java Code Examples for org.telegram.ui.ActionBar.ThemeDescription#setColor()

The following examples show how to use org.telegram.ui.ActionBar.ThemeDescription#setColor() . 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: ThemePreviewActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void applyColor(int color, int num) {
    if (colorType == 1) {
        accent.accentColor = color;
        Theme.refreshThemeColors();
    } else if (colorType == 2) {
        if (lastPickedColorNum == 0) {
            accent.backgroundOverrideColor = color;
        } else {
            int defaultGradientColor = Theme.getDefaultAccentColor(Theme.key_chat_wallpaper_gradient_to);
            if (color == 0 && defaultGradientColor != 0) {
                accent.backgroundGradientOverrideColor = (1L << 32);
            } else {
                accent.backgroundGradientOverrideColor = color;
            }
        }
        Theme.refreshThemeColors();
        colorPicker.setHasChanges(hasChanges(colorType));
    } else if (colorType == 3) {
        if (lastPickedColorNum == 0) {
            accent.myMessagesAccentColor = color;
        } else {
            accent.myMessagesGradientAccentColor = color;
        }
        Theme.refreshThemeColors();
        listView2.invalidateViews();
        colorPicker.setHasChanges(hasChanges(colorType));
    }

    for (int i = 0, size = themeDescriptions.size(); i < size; i++) {
        ThemeDescription description = themeDescriptions.get(i);
        description.setColor(Theme.getColor(description.getCurrentKey()), false, false);
    }

    listView.invalidateViews();
    listView2.invalidateViews();
    if (dotsContainer != null) {
        dotsContainer.invalidate();
    }
}
 
Example 2
Source File: StickersAlert.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void updateColors(boolean applyDescriptions) {
    adapter.updateColors();

    titleTextView.setHighlightColor(Theme.getColor(Theme.key_dialogLinkSelection));
    stickerPreviewLayout.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground) & 0xdfffffff);

    optionsButton.setIconColor(Theme.getColor(Theme.key_sheet_other));
    optionsButton.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false);
    optionsButton.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true);
    optionsButton.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector));
    optionsButton.redrawPopup(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));

    if (applyDescriptions) {
        if (Theme.isAnimatingColor() && animatingDescriptions == null) {
            animatingDescriptions = getThemeDescriptions();
            for (int i = 0, N = animatingDescriptions.size(); i < N; i++) {
                animatingDescriptions.get(i).setDelegateDisabled();
            }
        }
        for (int i = 0, N = animatingDescriptions.size(); i < N; i++) {
            final ThemeDescription description = animatingDescriptions.get(i);
            description.setColor(Theme.getColor(description.getCurrentKey()), false, false);
        }
    }

    if (!Theme.isAnimatingColor() && animatingDescriptions != null) {
        animatingDescriptions = null;
    }
}
 
Example 3
Source File: ThemePreviewActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void applyColor(int color, int num) {
    if (colorType == 1) {
        accent.accentColor = color;
        Theme.refreshThemeColors();
    } else if (colorType == 2) {
        if (lastPickedColorNum == 0) {
            accent.backgroundOverrideColor = color;
        } else {
            int defaultGradientColor = Theme.getDefaultAccentColor(Theme.key_chat_wallpaper_gradient_to);
            if (color == 0 && defaultGradientColor != 0) {
                accent.backgroundGradientOverrideColor = (1L << 32);
            } else {
                accent.backgroundGradientOverrideColor = color;
            }
        }
        Theme.refreshThemeColors();
        colorPicker.setHasChanges(hasChanges(colorType));
    } else if (colorType == 3) {
        if (lastPickedColorNum == 0) {
            accent.myMessagesAccentColor = color;
        } else {
            accent.myMessagesGradientAccentColor = color;
        }
        Theme.refreshThemeColors();
        listView2.invalidateViews();
        colorPicker.setHasChanges(hasChanges(colorType));
    }

    for (int i = 0, size = themeDescriptions.size(); i < size; i++) {
        ThemeDescription description = themeDescriptions.get(i);
        description.setColor(Theme.getColor(description.getCurrentKey()), false, false);
    }

    listView.invalidateViews();
    listView2.invalidateViews();
    if (dotsContainer != null) {
        dotsContainer.invalidate();
    }
}
 
Example 4
Source File: StickersAlert.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void updateColors(boolean applyDescriptions) {
    adapter.updateColors();

    titleTextView.setHighlightColor(Theme.getColor(Theme.key_dialogLinkSelection));
    stickerPreviewLayout.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground) & 0xdfffffff);

    optionsButton.setIconColor(Theme.getColor(Theme.key_sheet_other));
    optionsButton.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false);
    optionsButton.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true);
    optionsButton.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector));
    optionsButton.redrawPopup(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));

    if (applyDescriptions) {
        if (Theme.isAnimatingColor() && animatingDescriptions == null) {
            animatingDescriptions = getThemeDescriptions();
            for (int i = 0, N = animatingDescriptions.size(); i < N; i++) {
                animatingDescriptions.get(i).setDelegateDisabled();
            }
        }
        for (int i = 0, N = animatingDescriptions.size(); i < N; i++) {
            final ThemeDescription description = animatingDescriptions.get(i);
            description.setColor(Theme.getColor(description.getCurrentKey()), false, false);
        }
    }

    if (!Theme.isAnimatingColor() && animatingDescriptions != null) {
        animatingDescriptions = null;
    }
}