Java Code Examples for org.telegram.ui.ActionBar.Theme#key_windowBackgroundWhiteRedText5()

The following examples show how to use org.telegram.ui.ActionBar.Theme#key_windowBackgroundWhiteRedText5() . 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: FilterCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void setTextLeft(View cell) {
    if (cell instanceof PollEditTextCell) {
        PollEditTextCell textCell = (PollEditTextCell) cell;
        int left = MAX_NAME_LENGTH - (newFilterName != null ? newFilterName.length() : 0);
        if (left <= MAX_NAME_LENGTH - MAX_NAME_LENGTH * 0.7f) {
            textCell.setText2(String.format("%d", left));
            SimpleTextView textView = textCell.getTextView2();
            String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
            textView.setTextColor(Theme.getColor(key));
            textView.setTag(key);
            textView.setAlpha(((PollEditTextCell) cell).getTextView().isFocused() || left < 0 ? 1.0f : 0.0f);
        } else {
            textCell.setText2("");
        }
    }
}
 
Example 2
Source File: FilterCreateActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void setTextLeft(View cell) {
    if (cell instanceof PollEditTextCell) {
        PollEditTextCell textCell = (PollEditTextCell) cell;
        int left = MAX_NAME_LENGTH - (newFilterName != null ? newFilterName.length() : 0);
        if (left <= MAX_NAME_LENGTH - MAX_NAME_LENGTH * 0.7f) {
            textCell.setText2(String.format("%d", left));
            SimpleTextView textView = textCell.getTextView2();
            String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
            textView.setTextColor(Theme.getColor(key));
            textView.setTag(key);
            textView.setAlpha(((PollEditTextCell) cell).getTextView().isFocused() || left < 0 ? 1.0f : 0.0f);
        } else {
            textCell.setText2("");
        }
    }
}
 
Example 3
Source File: ChatRightsEditActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell) {
    if (cell instanceof HeaderCell) {
        HeaderCell headerCell = (HeaderCell) cell;
        int left = MAX_RANK_LENGTH - (currentRank != null ? currentRank.codePointCount(0, currentRank.length()) : 0);
        if (left <= MAX_RANK_LENGTH - MAX_RANK_LENGTH * 0.7f) {
            headerCell.setText2(String.format("%d", left));
            SimpleTextView textView = headerCell.getTextView2();
            String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
            textView.setTextColor(Theme.getColor(key));
            textView.setTag(key);
        } else {
            headerCell.setText2("");
        }
    }
}
 
Example 4
Source File: PollCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell, int index) {
    if (!(cell instanceof PollEditTextCell)) {
        return;
    }
    PollEditTextCell textCell = (PollEditTextCell) cell;
    int max;
    int left;
    if (index == questionRow) {
        max = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
    } else if (index == solutionRow) {
        max = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
    } else if (index >= answerStartRow && index < answerStartRow + answersCount) {
        index -= answerStartRow;
        max = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
    } else {
        return;
    }
    if (left <= max - max * 0.7f) {
        textCell.setText2(String.format("%d", left));
        SimpleTextView textView = textCell.getTextView2();
        String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
        textView.setTextColor(Theme.getColor(key));
        textView.setTag(key);
    } else {
        textCell.setText2("");
    }
}
 
Example 5
Source File: ChatAttachAlertPollLayout.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell, int index) {
    if (!(cell instanceof PollEditTextCell)) {
        return;
    }
    PollEditTextCell textCell = (PollEditTextCell) cell;
    int max;
    int left;
    if (index == questionRow) {
        max = MAX_QUESTION_LENGTH;
        left = MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
    } else if (index == solutionRow) {
        max = MAX_SOLUTION_LENGTH;
        left = MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
    } else if (index >= answerStartRow && index < answerStartRow + answersCount) {
        index -= answerStartRow;
        max = MAX_ANSWER_LENGTH;
        left = MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
    } else {
        return;
    }
    if (left <= max - max * 0.7f) {
        textCell.setText2(String.format("%d", left));
        SimpleTextView textView = textCell.getTextView2();
        String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
        textView.setTextColor(Theme.getColor(key));
        textView.setTag(key);
    } else {
        textCell.setText2("");
    }
}
 
Example 6
Source File: ChatRightsEditActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell) {
    if (cell instanceof HeaderCell) {
        HeaderCell headerCell = (HeaderCell) cell;
        int left = MAX_RANK_LENGTH - (currentRank != null ? currentRank.codePointCount(0, currentRank.length()) : 0);
        if (left <= MAX_RANK_LENGTH - MAX_RANK_LENGTH * 0.7f) {
            headerCell.setText2(String.format("%d", left));
            SimpleTextView textView = headerCell.getTextView2();
            String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
            textView.setTextColor(Theme.getColor(key));
            textView.setTag(key);
        } else {
            headerCell.setText2("");
        }
    }
}
 
Example 7
Source File: PollCreateActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell, int index) {
    if (!(cell instanceof PollEditTextCell)) {
        return;
    }
    PollEditTextCell textCell = (PollEditTextCell) cell;
    int max;
    int left;
    if (index == questionRow) {
        max = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
    } else if (index == solutionRow) {
        max = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
    } else if (index >= answerStartRow && index < answerStartRow + answersCount) {
        index -= answerStartRow;
        max = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH;
        left = ChatAttachAlertPollLayout.MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
    } else {
        return;
    }
    if (left <= max - max * 0.7f) {
        textCell.setText2(String.format("%d", left));
        SimpleTextView textView = textCell.getTextView2();
        String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
        textView.setTextColor(Theme.getColor(key));
        textView.setTag(key);
    } else {
        textCell.setText2("");
    }
}
 
Example 8
Source File: ChatAttachAlertPollLayout.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void setTextLeft(View cell, int index) {
    if (!(cell instanceof PollEditTextCell)) {
        return;
    }
    PollEditTextCell textCell = (PollEditTextCell) cell;
    int max;
    int left;
    if (index == questionRow) {
        max = MAX_QUESTION_LENGTH;
        left = MAX_QUESTION_LENGTH - (questionString != null ? questionString.length() : 0);
    } else if (index == solutionRow) {
        max = MAX_SOLUTION_LENGTH;
        left = MAX_SOLUTION_LENGTH - (solutionString != null ? solutionString.length() : 0);
    } else if (index >= answerStartRow && index < answerStartRow + answersCount) {
        index -= answerStartRow;
        max = MAX_ANSWER_LENGTH;
        left = MAX_ANSWER_LENGTH - (answers[index] != null ? answers[index].length() : 0);
    } else {
        return;
    }
    if (left <= max - max * 0.7f) {
        textCell.setText2(String.format("%d", left));
        SimpleTextView textView = textCell.getTextView2();
        String key = left < 0 ? Theme.key_windowBackgroundWhiteRedText5 : Theme.key_windowBackgroundWhiteGrayText3;
        textView.setTextColor(Theme.getColor(key));
        textView.setTag(key);
    } else {
        textCell.setText2("");
    }
}
 
Example 9
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ThemeDescription[] getThemeDescriptions() {
    ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
        if (listView != null) {
            int count = listView.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = listView.getChildAt(a);
                if (child instanceof ManageChatUserCell) {
                    ((ManageChatUserCell) child).update(0);
                }
            }
        }
    };
    return new ThemeDescription[]{
            new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ManageChatTextCell.class, ManageChatUserCell.class}, null, null, null, Theme.key_windowBackgroundWhite),
            new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem),

            new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
            new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_avatar_actionBarSelectorBlue),

            new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector),
            new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),

            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGreenText2),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText5),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ManageChatTextCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatTextCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon),

            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"statusColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"statusOnlineColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"optionsButton"}, null, null, null, Theme.key_stickers_menu),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, null, new Drawable[]{Theme.avatar_photoDrawable, Theme.avatar_broadcastDrawable, Theme.avatar_savedDrawable}, null, Theme.key_avatar_text),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink),

            new ThemeDescription(listView, 0, new Class[]{LoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle),

            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGray),

            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGray),
            new ThemeDescription(listView, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4),
    };
}
 
Example 10
Source File: ChannelEditActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ThemeDescription[] getThemeDescriptions() {
    ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
        if (listView != null) {
            int count = listView.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = listView.getChildAt(a);
                if (child instanceof ManageChatUserCell) {
                    ((ManageChatUserCell) child).update(0);
                }
            }
        }
    };
    return new ThemeDescription[]{
            new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ManageChatTextCell.class, ManageChatUserCell.class}, null, null, null, Theme.key_windowBackgroundWhite),
            new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem),

            new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
            new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
            new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_avatar_actionBarSelectorBlue),

            new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector),
            new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),

            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGreenText2),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{ManageChatTextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText5),
            new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ManageChatTextCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatTextCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon),

            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"statusColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"statusOnlineColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, new String[]{"optionsButton"}, null, null, null, Theme.key_stickers_menu),
            new ThemeDescription(listView, 0, new Class[]{ManageChatUserCell.class}, null, new Drawable[]{Theme.avatar_photoDrawable, Theme.avatar_broadcastDrawable, Theme.avatar_savedDrawable}, null, Theme.key_avatar_text),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue),
            new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink),

            new ThemeDescription(listView, 0, new Class[]{LoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle),

            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGray),

            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
            new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGray),
            new ThemeDescription(listView, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4),
    };
}