fix: follow official emoji view

This commit is contained in:
Next Alone 2022-08-20 02:15:25 +08:00 committed by xtaodada
parent af5b218234
commit a9ac72d207
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -1327,46 +1327,19 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
this.allowAnimatedEmoji = needAnimatedEmoji;
this.resourcesProvider = resourcesProvider;
int color = getThemedColor(Theme.key_chat_messagePanelIcons);
int color = getThemedColor(Theme.key_chat_emojiBottomPanelIcon);
color = Color.argb(30, Color.red(color), Color.green(color), Color.blue(color));
searchFieldHeight = AndroidUtilities.dp(64);
needEmojiSearch = needSearch;
tabIcons = new Drawable[]{
Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.baseline_emoticon_outline_24, R.drawable.baseline_emoticon_24, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.deproko_baseline_gif_24, R.drawable.deproko_baseline_gif_filled_24, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.deproko_baseline_stickers_24, R.drawable.deproko_baseline_stickers_filled_24, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected))
Theme.createEmojiIconSelectorDrawable(context, R.drawable.smiles_tab_smiles, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawable(context, R.drawable.smiles_tab_gif, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawable(context, R.drawable.smiles_tab_stickers, getThemedColor(Theme.key_chat_emojiPanelBackspace), getThemedColor(Theme.key_chat_emojiPanelIconSelected))
};
// emojiIcons = new Drawable[]{
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.baseline_access_time_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.baseline_emoticon_outline_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.deproko_baseline_animals_outline_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.baseline_restaurant_menu_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.outline_sports_baseball_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.baseline_directions_car_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.deproko_baseline_lamp_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.baseline_emoji_symbols_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.deproko_baseline_flag_outline_24, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// };
// stickerIcons = new Drawable[]{
// Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.baseline_access_time_24, R.drawable.baseline_access_time_filled_24, getThemedColor(Theme.key_chat_messagePanelIcons), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.baseline_star_border_24, R.drawable.baseline_star_24, getThemedColor(Theme.key_chat_messagePanelIcons), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.emoji_tabs_new3, getThemedColor(Theme.key_chat_messagePanelIcons), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// new LayerDrawable(new Drawable[]{
// searchIconDrawable = Theme.createEmojiIconSelectorDrawable(context, R.drawable.emoji_tabs_new1, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// searchIconDotDrawable = Theme.createEmojiIconSelectorDrawable(context, R.drawable.emoji_tabs_new2, getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine), getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine))
// })
// };
//
// gifIcons = new Drawable[]{
// Theme.createEmojiIconSelectorDrawableWithPressedResources(context, R.drawable.baseline_access_time_24, R.drawable.baseline_access_time_filled_24, getThemedColor(Theme.key_chat_messagePanelIcons), getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine)),
// Theme.createEmojiIconSelectorDrawable(context, R.drawable.stickers_gifs_trending, getThemedColor(Theme.key_chat_messagePanelIcons), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
// };
stickerIcons = new Drawable[]{
stickerIcons = new Drawable[]{
Theme.createEmojiIconSelectorDrawable(context, R.drawable.msg_emoji_recent, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawable(context, R.drawable.emoji_tabs_faves, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
Theme.createEmojiIconSelectorDrawable(context, R.drawable.emoji_tabs_new3, getThemedColor(Theme.key_chat_emojiPanelIcon), getThemedColor(Theme.key_chat_emojiPanelIconSelected)),
@ -1832,7 +1805,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
gifTabs.setUnderlineHeight(AndroidUtilities.getShadowHeight());
gifTabs.setIndicatorColor(getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine));
gifTabs.setUnderlineColor(getThemedColor(Theme.key_chat_emojiPanelShadowLine));
gifTabs.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
gifTabs.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
gifContainer.addView(gifTabs, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, StickerTabView.SMALL_HEIGHT, Gravity.LEFT | Gravity.TOP));
updateGifTabs();
@ -1983,7 +1956,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
}
});
stickersGridView.setPadding(0, AndroidUtilities.dp(4 + 48), 0, AndroidUtilities.dp(44));
stickersGridView.setPadding(0, AndroidUtilities.dp(4 + 36), 0, AndroidUtilities.dp(44));
stickersGridView.setClipToPadding(false);
Tab stickersTabHolder = new Tab();
@ -2111,8 +2084,8 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (searchProgressOffset != 0) {
canvas.clipRect(0, searchProgressOffset, getMeasuredWidth(), getMeasuredHeight());
}
paint.setColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
canvas.drawRect(0, 0, getMeasuredWidth(), AndroidUtilities.dp(48) + stickersTab.getExpandedOffset(), paint);
paint.setColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
canvas.drawRect(0, 0, getMeasuredWidth(), AndroidUtilities.dp(36) + stickersTab.getExpandedOffset(), paint);
super.dispatchDraw(canvas);
stickersTab.drawOverlays(canvas);
canvas.restore();
@ -2124,10 +2097,10 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
updateStickerTabsPosition();
}
};
stickersTabContainer.addView(stickersTab, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.TOP));
stickersTabContainer.addView(stickersTab, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.LEFT | Gravity.TOP));
parentView.addView(stickersTabContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
} else {
stickersContainer.addView(stickersTab, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.TOP));
stickersContainer.addView(stickersTab, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.LEFT | Gravity.TOP));
}
updateStickerTabs();
stickersTab.setDelegate(page -> {
@ -5094,7 +5067,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
} else {
setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
if (needEmojiSearch) {
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
}
@ -5139,12 +5112,12 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (stickersTab != null) {
stickersTab.setIndicatorColor(getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine));
stickersTab.setUnderlineColor(getThemedColor(Theme.key_chat_emojiPanelShadowLine));
stickersTab.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
stickersTab.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
if (gifTabs != null) {
gifTabs.setIndicatorColor(getThemedColor(Theme.key_chat_emojiPanelStickerPackSelectorLine));
gifTabs.setUnderlineColor(getThemedColor(Theme.key_chat_emojiPanelShadowLine));
gifTabs.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
gifTabs.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
if (backspaceButton != null) {
backspaceButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelBackspace), PorterDuff.Mode.SRC_IN));
@ -5173,18 +5146,18 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
for (int a = 0; a < tabIcons.length; a++) {
Theme.setEmojiDrawableColor(tabIcons[a], getThemedColor(Theme.key_chat_messagePanelIcons), false);
Theme.setEmojiDrawableColor(tabIcons[a], getThemedColor(Theme.key_chat_emojiBottomPanelIcon), false);
Theme.setEmojiDrawableColor(tabIcons[a], getThemedColor(Theme.key_chat_emojiPanelIconSelected), true);
}
if (emojiTabs != null) {
emojiTabs.updateColors();
}
for (int a = 0; a < stickerIcons.length; a++) {
Theme.setEmojiDrawableColor(stickerIcons[a], getThemedColor(Theme.key_chat_messagePanelIcons), false);
Theme.setEmojiDrawableColor(stickerIcons[a], getThemedColor(Theme.key_chat_emojiPanelIcon), false);
Theme.setEmojiDrawableColor(stickerIcons[a], getThemedColor(Theme.key_chat_emojiPanelIconSelected), true);
}
for (int a = 0; a < gifIcons.length; a++) {
Theme.setEmojiDrawableColor(gifIcons[a], getThemedColor(Theme.key_chat_messagePanelIcons), false);
Theme.setEmojiDrawableColor(gifIcons[a], getThemedColor(Theme.key_chat_emojiPanelIcon), false);
Theme.setEmojiDrawableColor(gifIcons[a], getThemedColor(Theme.key_chat_emojiPanelIconSelected), true);
}
if (searchIconDrawable != null) {
@ -5217,7 +5190,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
setBackgroundResource(R.drawable.smiles_popup);
getBackground().setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelBackground), PorterDuff.Mode.SRC_IN));
if (needEmojiSearch) {
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
currentBackgroundType = 1;
}
@ -5230,7 +5203,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
if (needEmojiSearch) {
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
bottomTabContainerBackground.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
currentBackgroundType = 0;
}