A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/TGX-Android/Telegram-X/commit/a760ab4108deedb4ca6ef17f908901d7866f5224 below:

Emoji status (closes #311 and #312) (#388) · TGX-Android/Telegram-X@a760ab4 · GitHub

34 34

import androidx.annotation.Nullable;

35 35

import androidx.annotation.StringRes;

36 36 37 +

import org.drinkless.tdlib.TdApi;

37 38

import org.thunderdog.challegram.R;

38 39

import org.thunderdog.challegram.U;

39 40

import org.thunderdog.challegram.component.user.RemoveHelper;

53 54

import org.thunderdog.challegram.tool.UI;

54 55

import org.thunderdog.challegram.tool.Views;

55 56

import org.thunderdog.challegram.util.DrawModifier;

57 +

import org.thunderdog.challegram.util.EmojiStatusHelper;

56 58

import org.thunderdog.challegram.util.text.Counter;

57 59

import org.thunderdog.challegram.util.text.Text;

58 60

import org.thunderdog.challegram.util.text.TextColorSet;

@@ -106,6 +108,7 @@ public interface IconOverlay {

106 108

private CharSequence itemData;

107 109

private CharSequence displayItemData;

108 110

private Layout displayItemDataLayout;

111 +

private EmojiStatusHelper emojiStatusHelper;

109 112 110 113

private TogglerView togglerView;

111 114

@@ -131,6 +134,7 @@ public SettingView (Context context, Tdlib tdlib) {

131 134

super(context);

132 135

this.tdlib = tdlib;

133 136

this.complexReceiver = new ComplexReceiver(this);

137 +

this.emojiStatusHelper = new EmojiStatusHelper(tdlib, this, null);

134 138

setWillNotDraw(false);

135 139

}

136 140

@@ -199,6 +203,7 @@ public void attach () {

199 203

if (receiver != null)

200 204

receiver.attach();

201 205

complexReceiver.attach();

206 +

emojiStatusHelper.attach();

202 207

}

203 208 204 209

@Override

@@ -208,6 +213,7 @@ public void detach () {

208 213

if (receiver != null)

209 214

receiver.detach();

210 215

complexReceiver.detach();

216 +

emojiStatusHelper.detach();

211 217

}

212 218 213 219

@Override

@@ -216,6 +222,7 @@ public void performDestroy () {

216 222

if (receiver != null)

217 223

receiver.destroy();

218 224

complexReceiver.performDestroy();

225 +

emojiStatusHelper.performDestroy();

219 226

if (subscribedToEmojiUpdates) {

220 227

TGLegacyManager.instance().removeEmojiListener(this);

221 228

subscribedToEmojiUpdates = false;

@@ -433,6 +440,10 @@ public void setText (TextWrapper text) {

433 440

invalidate();

434 441

}

435 442 443 +

public void setEmojiStatus (@Nullable TdApi.User user) {

444 +

emojiStatusHelper.updateEmoji(user, TextColorSets.Regular.NORMAL);

445 +

}

446 + 436 447

public int getType () {

437 448

return type;

438 449

}

@@ -558,6 +569,8 @@ private void buildLayout (int totalWidth, int totalHeight) {

558 569

availWidth -= counter.getScaledWidth(Screen.dp(24f) + Screen.dp(8f));

559 570

}

560 571 572 +

availWidth -= emojiStatusHelper.getWidth(Screen.dp(6));

573 + 561 574

if (type == TYPE_INFO_COMPACT) {

562 575

pTop = Screen.dp(15f + 13f);

563 576

} else {

@@ -681,7 +694,7 @@ public void setVisuallyEnabled (boolean enabled, boolean animated) {

681 694

isEnabled.setValue(enabled, animated);

682 695

}

683 696 684 -

private static void drawText (Canvas c, CharSequence text, Layout layout, float x, float y, int textY, Paint paint, boolean rtl, int viewWidth, float textWidth, Text wrap, TextColorSet textColorSet) {

697 +

private static void drawText (Canvas c, CharSequence text, Layout layout, float x, float y, int textY, Paint paint, boolean rtl, int viewWidth, float textWidth, Text wrap, TextColorSet textColorSet, EmojiStatusHelper emojiStatusHelper) {

685 698

if (wrap != null) {

686 699

wrap.draw(c, (int) x, (int) (viewWidth - x), 0, textY, textColorSet != null ? textColorSet : TextColorSets.Regular.NEGATIVE);

687 700

} else if (layout != null) {

@@ -691,6 +704,7 @@ private static void drawText (Canvas c, CharSequence text, Layout layout, float

691 704

c.restore();

692 705

} else {

693 706

c.drawText((String) text, rtl ? viewWidth - textWidth - x : x, y, paint);

707 +

emojiStatusHelper.draw(c, (int) (x + textWidth + Screen.dp(6)), (int) textY);

694 708

}

695 709

}

696 710

@@ -811,10 +825,10 @@ protected void onDraw (Canvas c) {

811 825

if ((flags & FLAG_DATA_SUBTITLE) != 0) {

812 826

subtitleColor = ColorUtils.alphaColor(Theme.getSubtitleAlpha(), subtitleColor);

813 827

}

814 -

drawText(c, displayItemName, displayItemNameLayout, pLeft, pTop, (int) (pTop - Screen.dp(12f)), Paints.getRegularTextPaint(13f, subtitleColor), rtl, width, displayItemNameWidth, displayItemNameText, subtitleColorSet);

828 +

drawText(c, displayItemName, displayItemNameLayout, pLeft, pTop, (int) (pTop - Screen.dp(12f)), Paints.getRegularTextPaint(13f, subtitleColor), rtl, width, displayItemNameWidth, displayItemNameText, subtitleColorSet, emojiStatusHelper);

815 829

}

816 830

if (displayItemData != null) {

817 -

drawText(c, displayItemData, displayItemDataLayout, pDataLeft, pDataTop, (int) (pDataTop - Screen.dp(15f)), Paints.getTextPaint16(dataColor), rtl, width, displayItemDataWidth, null, null);

831 +

drawText(c, displayItemData, displayItemDataLayout, pDataLeft, pDataTop, (int) (pDataTop - Screen.dp(15f)), Paints.getTextPaint16(dataColor), rtl, width, displayItemDataWidth, null, null, emojiStatusHelper);

818 832

}

819 833

} else if (type == TYPE_INFO_MULTILINE) {

820 834

if (displayItemName != null) {

@@ -823,7 +837,7 @@ protected void onDraw (Canvas c) {

823 837

subtitleColor = ColorUtils.alphaColor(Theme.getSubtitleAlpha(), subtitleColor);

824 838

}

825 839

float top = (int) pDataTop - Screen.dp(13f) + text.getHeight() + Screen.dp(17f);

826 -

drawText(c, displayItemName, displayItemNameLayout, pLeft, (int) pDataTop - Screen.dp(13f) + text.getHeight() + Screen.dp(17f), (int) (top - Screen.dp(12f)), Paints.getRegularTextPaint(13f, subtitleColor), rtl, width, displayItemNameWidth, displayItemNameText, subtitleColorSet);

840 +

drawText(c, displayItemName, displayItemNameLayout, pLeft, (int) pDataTop - Screen.dp(13f) + text.getHeight() + Screen.dp(17f), (int) (top - Screen.dp(12f)), Paints.getRegularTextPaint(13f, subtitleColor), rtl, width, displayItemNameWidth, displayItemNameText, subtitleColorSet, emojiStatusHelper);

827 841

}

828 842

if (text != null) {

829 843

if (rtl) {

@@ -834,10 +848,10 @@ protected void onDraw (Canvas c) {

834 848

}

835 849

} else {

836 850

if (displayItemData != null) {

837 -

drawText(c, displayItemData, displayItemDataLayout, pDataLeft, pDataTop, (int) (pDataTop - Screen.dp(15)), Paints.getTextPaint16(dataColor), rtl, width, displayItemDataWidth, null, null);

851 +

drawText(c, displayItemData, displayItemDataLayout, pDataLeft, pDataTop, (int) (pDataTop - Screen.dp(15)), Paints.getTextPaint16(dataColor), rtl, width, displayItemDataWidth, null, null, emojiStatusHelper);

838 852

}

839 853

if (displayItemName != null) {

840 -

drawText(c, displayItemName, displayItemNameLayout, pLeft, pTop, (int) (pTop - Screen.dp(15f)), Paints.getTextPaint16(dataColor), rtl, width, displayItemNameWidth, displayItemNameText, this);

854 +

drawText(c, displayItemName, displayItemNameLayout, pLeft, pTop, (int) (pTop - Screen.dp(15f)), Paints.getTextPaint16(dataColor), rtl, width, displayItemNameWidth, displayItemNameText, this, emojiStatusHelper);

841 855

}

842 856

}

843 857

if (progressComponent != null) {


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4