正在查看: Telegram v11.13.0 应用的 StarsIntroActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Telegram v11.13.0 应用的 StarsIntroActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui.Stars;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ImageSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.ReplacementSpan;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.NestedScrollingParent3;
import androidx.core.view.NestedScrollingParentHelper;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Objects;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BillingController;
import org.telegram.messenger.BirthdayController;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.DocumentObject;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.WebFile;
import org.telegram.messenger.browser.Browser;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.tgnet.tl.TL_payments;
import org.telegram.tgnet.tl.TL_stars;
import org.telegram.tgnet.tl.TL_stories;
import org.telegram.ui.AccountFrozenAlert;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.BottomSheet$;
import org.telegram.ui.ActionBar.SimpleTextView;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.ChatActionCell$;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.SessionCell;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.ChatEditActivity;
import org.telegram.ui.ChatUsersActivity;
import org.telegram.ui.Components.AnimatedFloat;
import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.BottomSheetWithRecyclerListView;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ButtonSpan;
import org.telegram.ui.Components.ColoredImageSpan;
import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.FireworksOverlay;
import org.telegram.ui.Components.FlickerLoadingView;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.LinkSpanDrawable;
import org.telegram.ui.Components.LoadingSpan;
import org.telegram.ui.Components.OutlineTextContainerView;
import org.telegram.ui.Components.Premium.GLIcon.GLIconRenderer;
import org.telegram.ui.Components.Premium.GLIcon.GLIconTextureView;
import org.telegram.ui.Components.Premium.StarParticlesView;
import org.telegram.ui.Components.Premium.boosts.UserSelectorBottomSheet;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.ScaleStateListAnimator;
import org.telegram.ui.Components.StarAppsSheet;
import org.telegram.ui.Components.TableView;
import org.telegram.ui.Components.Text;
import org.telegram.ui.Components.UItem;
import org.telegram.ui.Components.UniversalAdapter;
import org.telegram.ui.Components.UniversalRecyclerView;
import org.telegram.ui.Components.ViewPagerFixed;
import org.telegram.ui.Gifts.GiftSheet;
import org.telegram.ui.GradientHeaderActivity;
import org.telegram.ui.ImageReceiverSpan;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PostSuggestionsEditActivity;
import org.telegram.ui.PrivacyControlActivity;
import org.telegram.ui.ProfileActivity;
import org.telegram.ui.Stars.StarsIntroActivity;
import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
import org.telegram.ui.Stories.recorder.HintView2;
import org.telegram.ui.bots.AffiliateProgramFragment;
import org.telegram.ui.bots.ChannelAffiliateProgramsFragment;
public class StarsIntroActivity extends GradientHeaderActivity implements NotificationCenter.NotificationCenterDelegate {
private static DecimalFormat floatFormat;
private FrameLayout aboveTitleView;
private UniversalAdapter adapter;
private LinearLayout balanceLayout;
private ButtonWithCounterView buyButton;
private View emptyLayout;
private FireworksOverlay fireworksOverlay;
private ButtonWithCounterView giftButton;
private boolean hadTransactions;
private GLIconTextureView iconTextureView;
private FrameLayout oneButtonsLayout;
private SpannableStringBuilder starBalanceIcon;
private AnimatedTextView starBalanceTextView;
private TextView starBalanceTitleView;
private ButtonWithCounterView topupButton;
private StarsTransactionsLayout transactionsLayout;
private boolean twoButtons;
private LinearLayout twoButtonsLayout;
private ButtonWithCounterView withdrawButton;
private boolean expanded = false;
private final int BUTTON_EXPAND = -1;
private final int BUTTON_GIFT = -2;
private final int BUTTON_SUBSCRIPTIONS_EXPAND = -3;
private final int BUTTON_AFFILIATE = -4;
class AnonymousClass4 extends StarParticlesView {
Paint[] paints;
final int val$particlesCount;
final int val$type;
AnonymousClass4(Context context, int i, int i2) {
super(context);
this.val$particlesCount = i;
this.val$type = i2;
setClipWithGradient();
}
public Paint lambda$configure$0(Integer num) {
return this.paints[num.intValue() % this.paints.length];
}
protected void configure() {
StarParticlesView.Drawable drawable = new StarParticlesView.Drawable(this.val$particlesCount);
((StarParticlesView) this).drawable = drawable;
drawable.type = 105;
int i = 0;
drawable.roundEffect = false;
drawable.useRotate = false;
drawable.useBlur = true;
drawable.checkBounds = true;
drawable.isCircle = false;
drawable.useScale = true;
drawable.startFromCenter = true;
if (this.val$type == 1) {
drawable.centerOffsetY = AndroidUtilities.dp(24.0f);
}
this.paints = new Paint[20];
while (true) {
Paint[] paintArr = this.paints;
if (i >= paintArr.length) {
((StarParticlesView) this).drawable.getPaint = new Utilities.CallbackReturn() {
public final Object run(Object obj) {
Paint lambda$configure$0;
lambda$configure$0 = StarsIntroActivity.AnonymousClass4.this.lambda$configure$0((Integer) obj);
return lambda$configure$0;
}
};
StarParticlesView.Drawable drawable2 = ((StarParticlesView) this).drawable;
drawable2.size1 = 17;
drawable2.size2 = 18;
drawable2.size3 = 19;
drawable2.colorKey = Theme.key_windowBackgroundWhiteBlackText;
drawable2.init();
return;
}
paintArr[i] = new Paint(1);
this.paints[i].setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(-371690, -14281, i / (this.paints.length - 1)), PorterDuff.Mode.SRC_IN));
i++;
}
}
protected int getStarsRectWidth() {
return getMeasuredWidth();
}
}
public static class ExpandView extends FrameLayout {
public final ImageView arrowView;
private int lastId;
private boolean needDivider;
public final AnimatedTextView textView;
public static class Factory extends UItem.UItemFactory {
static {
UItem.UItemFactory.setup(new Factory());
}
public static UItem asExpand(int i, CharSequence charSequence, boolean z) {
UItem ofFactory = UItem.ofFactory(Factory.class);
ofFactory.id = i;
ofFactory.text = charSequence;
ofFactory.collapsed = z;
return ofFactory;
}
public void bindView(View view, UItem uItem, boolean z, UniversalAdapter universalAdapter, UniversalRecyclerView universalRecyclerView) {
((ExpandView) view).set(uItem, z);
}
public ExpandView createView(Context context, int i, int i2, Theme.ResourcesProvider resourcesProvider) {
return new ExpandView(context, resourcesProvider);
}
}
public ExpandView(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context);
View animatedTextView = new AnimatedTextView(context);
this.textView = animatedTextView;
animatedTextView.getDrawable().setHacks(true, true, true);
animatedTextView.setTextSize(AndroidUtilities.dp(15.0f));
addView(animatedTextView, LayoutHelper.createFrameRelatively(-1.0f, -1.0f, 8388627, 22.0f, 0.0f, 58.0f, 0.0f));
ImageView imageView = new ImageView(context);
this.arrowView = imageView;
imageView.setScaleType(ImageView.ScaleType.CENTER);
imageView.setImageResource(R.drawable.arrow_more);
addView(imageView, LayoutHelper.createFrameRelatively(24.0f, 24.0f, 8388629, 0.0f, 0.0f, 17.0f, 0.0f));
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.lastId = Integer.MAX_VALUE;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (this.needDivider) {
canvas.drawRect(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(22.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(22.0f) : 0), getMeasuredHeight(), Theme.dividerPaint);
}
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48.0f), 1073741824));
}
public void set(String str, boolean z, boolean z2, boolean z3) {
boolean z4 = this.lastId == -1;
this.lastId = -1;
this.textView.setText(str, z4);
int color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText2);
this.textView.setTextColor(color);
this.arrowView.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
if (z4) {
this.arrowView.animate().rotation(z ? 0.0f : 180.0f).setDuration(340L).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
} else {
this.arrowView.setRotation(z ? 0.0f : 180.0f);
}
this.needDivider = z3;
setWillNotDraw(!z3);
}
public void set(UItem uItem, boolean z) {
int i = this.lastId;
int i2 = uItem.id;
boolean z2 = i == i2;
this.lastId = i2;
this.textView.setText(uItem.text, z2);
int color = Theme.getColor(uItem.accent ? Theme.key_windowBackgroundWhiteBlueText2 : Theme.key_windowBackgroundWhiteBlackText);
this.textView.setTextColor(color);
this.arrowView.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
if (z2) {
this.arrowView.animate().rotation(uItem.collapsed ? 0.0f : 180.0f).setDuration(340L).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
} else {
this.arrowView.setRotation(uItem.collapsed ? 0.0f : 180.0f);
}
this.needDivider = z;
setWillNotDraw(!z);
}
}
public static class GiftStarsSheet extends BottomSheetWithRecyclerListView implements NotificationCenter.NotificationCenterDelegate {
private final int BUTTON_EXPAND;
private UniversalAdapter adapter;
private boolean expanded;
private final FireworksOverlay fireworksOverlay;
private final FrameLayout footerView;
private final HeaderView headerView;
private final TLRPC.User user;
private final Runnable whenPurchased;
public static class HeaderView extends LinearLayout {
public final BackupImageView avatarImageView;
public final StarParticlesView particlesView;
public final LinkSpanDrawable.LinksTextView subtitleView;
public final TextView titleView;
private final FrameLayout topView;
public HeaderView(Context context, int i, Theme.ResourcesProvider resourcesProvider) {
super(context);
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
this.topView = frameLayout;
frameLayout.setClipChildren(false);
frameLayout.setClipToPadding(false);
StarParticlesView makeParticlesView = StarsIntroActivity.makeParticlesView(context, 70, 0);
this.particlesView = makeParticlesView;
frameLayout.addView((View) makeParticlesView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
BackupImageView backupImageView = new BackupImageView(context);
this.avatarImageView = backupImageView;
backupImageView.setRoundRadius(AndroidUtilities.dp(50.0f));
frameLayout.addView((View) backupImageView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(100, 100.0f, 17, 0.0f, 32.0f, 0.0f, 24.0f));
addView(frameLayout, LayoutHelper.createFrame(-1, 150.0f));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 20.0f);
textView.setTypeface(AndroidUtilities.bold());
int i2 = Theme.key_dialogTextBlack;
textView.setTextColor(Theme.getColor(i2, resourcesProvider));
textView.setGravity(17);
addView(textView, LayoutHelper.createLinear(-2, -2, 1, 0, 2, 0, 0));
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
this.subtitleView = linksTextView;
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linksTextView.setTextSize(1, 14.0f);
linksTextView.setTextColor(Theme.getColor(i2, resourcesProvider));
linksTextView.setGravity(17);
addView((View) linksTextView, LayoutHelper.createLinear(-2, -2, 1, 0, 9, 0, 18));
}
}
public GiftStarsSheet(Context context, Theme.ResourcesProvider resourcesProvider, TLRPC.User user, Runnable runnable) {
super(context, (BaseFragment) null, false, false, false, resourcesProvider);
this.BUTTON_EXPAND = -1;
this.user = user;
this.whenPurchased = runnable;
((BottomSheetWithRecyclerListView) this).topPadding = 0.2f;
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starGiftOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated);
fixNavigationBar();
RecyclerListView recyclerListView = ((BottomSheetWithRecyclerListView) this).recyclerListView;
int i = ((BottomSheet) this).backgroundPaddingLeft;
recyclerListView.setPadding(i, 0, i, 0);
((BottomSheetWithRecyclerListView) this).recyclerListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view, int i2) {
StarsIntroActivity.GiftStarsSheet.this.lambda$new$0(view, i2);
}
});
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setSupportsChangeAnimations(false);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDurations(350L);
((BottomSheetWithRecyclerListView) this).recyclerListView.setItemAnimator(defaultItemAnimator);
setBackgroundColor(Theme.getColor(Theme.key_dialogBackgroundGray, resourcesProvider));
HeaderView headerView = new HeaderView(context, ((BottomSheet) this).currentAccount, resourcesProvider);
this.headerView = headerView;
headerView.titleView.setText(LocaleController.getString(R.string.GiftStarsTitle));
headerView.subtitleView.setText(TextUtils.concat(AndroidUtilities.replaceTags(LocaleController.formatString(R.string.GiftStarsSubtitle, new Object[]{UserObject.getForcedFirstName(user)})), " ", AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.GiftStarsSubtitleLinkName).replace(' ', (char) 160), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.GiftStarsSheet.this.lambda$new$1();
}
}), true)));
LinkSpanDrawable.LinksTextView linksTextView = headerView.subtitleView;
linksTextView.setMaxWidth(HintView2.cutInFancyHalf(linksTextView.getText(), headerView.subtitleView.getPaint()) + 1);
((BottomSheetWithRecyclerListView) this).actionBar.setTitle(getTitle());
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setInfo(user);
headerView.avatarImageView.setForUserOrChat(user, avatarDrawable);
FrameLayout frameLayout = new FrameLayout(context);
this.footerView = frameLayout;
LinkSpanDrawable.LinksTextView linksTextView2 = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
frameLayout.setPadding(0, AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(11.0f));
linksTextView2.setTextSize(1, 12.0f);
linksTextView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4, resourcesProvider));
linksTextView2.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linksTextView2.setText(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.StarsTOS), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.GiftStarsSheet.this.lambda$new$2();
}
}));
linksTextView2.setGravity(17);
linksTextView2.setMaxWidth(HintView2.cutInFancyHalf(linksTextView2.getText(), linksTextView2.getPaint()));
frameLayout.addView((View) linksTextView2, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2, -1, 17));
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider));
View fireworksOverlay = new FireworksOverlay(getContext());
this.fireworksOverlay = fireworksOverlay;
((BottomSheet) this).containerView.addView(fireworksOverlay, LayoutHelper.createFrame(-1, -1.0f));
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter != null) {
universalAdapter.update(false);
}
}
public void lambda$new$0(View view, int i) {
UItem item;
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter == null || (item = universalAdapter.getItem(i - 1)) == null) {
return;
}
onItemClick(item, this.adapter);
}
public void lambda$new$1() {
BaseFragment baseFragment;
StarAppsSheet starAppsSheet = new StarAppsSheet(getContext());
if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(((BottomSheet) this).attachedFragment) && (baseFragment = ((BottomSheet) this).attachedFragment) != null) {
starAppsSheet.makeAttached(baseFragment);
}
starAppsSheet.show();
}
public void lambda$new$2() {
Browser.openUrl(getContext(), LocaleController.getString(R.string.StarsTOSLink));
}
public static void lambda$onItemClick$3(long j) {
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public void lambda$onItemClick$4(UItem uItem, final long j, Boolean bool, String str) {
Runnable runnable;
if (getContext() == null) {
return;
}
if ((bool.booleanValue() || str != null) && (runnable = this.whenPurchased) != null) {
runnable.run();
}
dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
FireworksOverlay fireworksOverlay = LaunchActivity.instance.getFireworksOverlay();
if (safeLastFragment == null) {
return;
}
if (!bool.booleanValue()) {
if (str != null) {
BulletinFactory.of(safeLastFragment).createSimpleBulletin(R.raw.error, LocaleController.formatString(R.string.UnknownErrorCode, new Object[]{str})).show();
}
} else {
BulletinFactory.of(safeLastFragment).createSimpleBulletin(R.raw.stars_send, LocaleController.getString(R.string.StarsGiftSentPopup), AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsGiftSentPopupInfo", (int) uItem.longValue, new Object[]{UserObject.getForcedFirstName(this.user)})), LocaleController.getString(R.string.ViewInChat), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.GiftStarsSheet.lambda$onItemClick$3(j);
}
}).setDuration(5000).show(true);
if (fireworksOverlay != null) {
fireworksOverlay.start(true);
}
StarsController.getInstance(((BottomSheet) this).currentAccount).invalidateTransactions(true);
}
}
protected RecyclerListView.SelectionAdapter createAdapter(RecyclerListView recyclerListView) {
UniversalAdapter universalAdapter = new UniversalAdapter(((BottomSheetWithRecyclerListView) this).recyclerListView, getContext(), ((BottomSheet) this).currentAccount, 0, true, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.GiftStarsSheet.this.fillItems((ArrayList) obj, (UniversalAdapter) obj2);
}
}, ((BottomSheet) this).resourcesProvider);
this.adapter = universalAdapter;
return universalAdapter;
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
UniversalAdapter universalAdapter;
if ((i == NotificationCenter.starGiftOptionsLoaded || i == NotificationCenter.starBalanceUpdated) && (universalAdapter = this.adapter) != null) {
universalAdapter.update(true);
}
}
public void dismiss() {
super/*org.telegram.ui.ActionBar.BottomSheet*/.dismiss();
}
public void dismissInternal() {
super/*org.telegram.ui.ActionBar.BottomSheet*/.dismissInternal();
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starGiftOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated);
}
public void fillItems(ArrayList arrayList, UniversalAdapter universalAdapter) {
UItem asFlicker;
arrayList.add(UItem.asCustom(this.headerView));
arrayList.add(UItem.asHeader(LocaleController.getString(R.string.TelegramStarsChoose)));
ArrayList giftOptions = StarsController.getInstance(((BottomSheet) this).currentAccount).getGiftOptions();
if (giftOptions != null && !giftOptions.isEmpty()) {
int i = 0;
int i2 = 1;
for (int i3 = 0; i3 < giftOptions.size(); i3++) {
TL_stars.TL_starsGiftOption tL_starsGiftOption = (TL_stars.TL_starsGiftOption) giftOptions.get(i3);
if (this.expanded || !tL_starsGiftOption.extended) {
arrayList.add(StarTierView.Factory.asStarTier(i3, i2, tL_starsGiftOption));
i2++;
} else {
i++;
}
}
boolean z = this.expanded;
if (!z && i > 0) {
asFlicker = ExpandView.Factory.asExpand(-1, LocaleController.getString(z ? R.string.NotifyLessOptions : R.string.NotifyMoreOptions), !this.expanded).accent();
}
arrayList.add(UItem.asCustom(this.footerView));
}
arrayList.add(UItem.asFlicker(31));
arrayList.add(UItem.asFlicker(31));
asFlicker = UItem.asFlicker(31);
arrayList.add(asFlicker);
arrayList.add(UItem.asCustom(this.footerView));
}
protected CharSequence getTitle() {
HeaderView headerView = this.headerView;
if (headerView == null) {
return null;
}
return headerView.titleView.getText();
}
public void onItemClick(final UItem uItem, UniversalAdapter universalAdapter) {
if (uItem.id == -1) {
this.expanded = !this.expanded;
universalAdapter.update(true);
((BottomSheetWithRecyclerListView) this).recyclerListView.smoothScrollBy(0, AndroidUtilities.dp(200.0f), CubicBezierInterpolator.EASE_OUT);
} else if (uItem.instanceOf(StarTierView.Factory.class) && (uItem.object instanceof TL_stars.TL_starsGiftOption)) {
LaunchActivity findActivity = AndroidUtilities.findActivity(getContext());
if (findActivity == null) {
findActivity = LaunchActivity.instance;
}
LaunchActivity launchActivity = findActivity;
if (launchActivity == null) {
return;
}
final long j = this.user.id;
StarsController.getInstance(((BottomSheet) this).currentAccount).buyGift(launchActivity, (TL_stars.TL_starsGiftOption) uItem.object, j, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.GiftStarsSheet.this.lambda$onItemClick$4(uItem, j, (Boolean) obj, (String) obj2);
}
});
}
}
public void show() {
ChatActivity lastFragment = LaunchActivity.getLastFragment();
if (lastFragment instanceof ChatActivity) {
ChatActivity chatActivity = lastFragment;
if (chatActivity.isKeyboardVisible() && chatActivity.getChatActivityEnterView() != null) {
chatActivity.getChatActivityEnterView().closeKeyboard();
}
}
super/*org.telegram.ui.ActionBar.BottomSheet*/.show();
}
}
class NestedFrameLayout extends GradientHeaderActivity.ContentView implements NestedScrollingParent3 {
private NestedScrollingParentHelper nestedScrollingParentHelper;
public NestedFrameLayout(Context context) {
super(StarsIntroActivity.this, context);
this.nestedScrollingParentHelper = new NestedScrollingParentHelper(this);
}
public void lambda$onNestedScroll$0() {
try {
RecyclerListView currentListView = StarsIntroActivity.this.transactionsLayout.getCurrentListView();
if (currentListView == null || currentListView.getAdapter() == null) {
return;
}
currentListView.getAdapter().notifyDataSetChanged();
} catch (Throwable unused) {
}
}
public boolean onNestedPreFling(View view, float f, float f2) {
return super/*org.telegram.ui.Components.NestedSizeNotifierLayout*/.onNestedPreFling(view, f, f2);
}
public void onNestedPreScroll(View view, int i, int i2, int[] iArr, int i3) {
int i4;
if (view == ((GradientHeaderActivity) StarsIntroActivity.this).listView && StarsIntroActivity.this.transactionsLayout.isAttachedToWindow()) {
boolean isSearchFieldVisible = ((BaseFragment) StarsIntroActivity.this).actionBar.isSearchFieldVisible();
int top = (((View) StarsIntroActivity.this.transactionsLayout.getParent()).getTop() - AndroidUtilities.statusBarHeight) - ActionBar.getCurrentActionBarHeight();
int bottom = ((View) StarsIntroActivity.this.transactionsLayout.getParent()).getBottom();
boolean z = false;
if (i2 < 0) {
if (((GradientHeaderActivity) StarsIntroActivity.this).listView.getHeight() - bottom >= 0) {
RecyclerListView currentListView = StarsIntroActivity.this.transactionsLayout.getCurrentListView();
int findFirstVisibleItemPosition = currentListView.getLayoutManager().findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition != -1) {
RecyclerView.ViewHolder findViewHolderForAdapterPosition = currentListView.findViewHolderForAdapterPosition(findFirstVisibleItemPosition);
int top2 = findViewHolderForAdapterPosition != null ? findViewHolderForAdapterPosition.itemView.getTop() : -1;
int paddingTop = currentListView.getPaddingTop();
if (top2 != paddingTop || findFirstVisibleItemPosition != 0) {
iArr[1] = findFirstVisibleItemPosition != 0 ? i2 : Math.max(i2, top2 - paddingTop);
currentListView.scrollBy(0, i2);
z = true;
}
}
}
if (isSearchFieldVisible) {
if (z || top >= 0) {
iArr[1] = i2;
return;
} else {
iArr[1] = i2 - Math.max(top, i2);
return;
}
}
return;
}
if (isSearchFieldVisible) {
RecyclerListView currentListView2 = StarsIntroActivity.this.transactionsLayout.getCurrentListView();
iArr[1] = i2;
if (top > 0) {
iArr[1] = i2 - i2;
}
if (currentListView2 == null || (i4 = iArr[1]) <= 0) {
return;
}
currentListView2.scrollBy(0, i4);
return;
}
if (i2 > 0) {
RecyclerListView currentListView3 = StarsIntroActivity.this.transactionsLayout.getCurrentListView();
if (((GradientHeaderActivity) StarsIntroActivity.this).listView.getHeight() - bottom < 0 || currentListView3 == null || currentListView3.canScrollVertically(1)) {
return;
}
iArr[1] = i2;
((GradientHeaderActivity) StarsIntroActivity.this).listView.stopScroll();
}
}
}
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5) {
}
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
try {
if (view == ((GradientHeaderActivity) StarsIntroActivity.this).listView && StarsIntroActivity.this.transactionsLayout.isAttachedToWindow()) {
RecyclerListView currentListView = StarsIntroActivity.this.transactionsLayout.getCurrentListView();
if (((GradientHeaderActivity) StarsIntroActivity.this).listView.getHeight() - ((View) StarsIntroActivity.this.transactionsLayout.getParent()).getBottom() >= 0) {
iArr[1] = i4;
currentListView.scrollBy(0, i4);
}
}
} catch (Throwable th) {
FileLog.e(th);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.NestedFrameLayout.this.lambda$onNestedScroll$0();
}
});
}
}
public void onNestedScrollAccepted(View view, View view2, int i, int i2) {
this.nestedScrollingParentHelper.onNestedScrollAccepted(view, view2, i);
}
public boolean onStartNestedScroll(View view, View view2, int i, int i2) {
return i == 2;
}
public void onStopNestedScroll(View view) {
}
public void onStopNestedScroll(View view, int i) {
this.nestedScrollingParentHelper.onStopNestedScroll(view);
}
}
public static class StarTierView extends FrameLayout {
private final AnimatedFloat animatedStarsCount;
private SpannableString loading;
private boolean needDivider;
private final Drawable starDrawable;
private final Drawable starDrawableOutline;
private int starsCount;
private final TextView textView;
private final AnimatedTextView textView2;
public static class Factory extends UItem.UItemFactory {
static {
UItem.UItemFactory.setup(new Factory());
}
public static UItem asStarTier(int i, int i2, TL_stars.TL_starsGiftOption tL_starsGiftOption) {
UItem ofFactory = UItem.ofFactory(Factory.class);
ofFactory.id = i;
ofFactory.intValue = i2;
long j = tL_starsGiftOption.stars;
ofFactory.longValue = j;
ofFactory.text = LocaleController.formatPluralStringSpaced("StarsCount", (int) j);
ofFactory.subtext = tL_starsGiftOption.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(tL_starsGiftOption.amount, tL_starsGiftOption.currency);
ofFactory.object = tL_starsGiftOption;
return ofFactory;
}
public static UItem asStarTier(int i, int i2, TL_stars.TL_starsTopupOption tL_starsTopupOption) {
UItem ofFactory = UItem.ofFactory(Factory.class);
ofFactory.id = i;
ofFactory.intValue = i2;
long j = tL_starsTopupOption.stars;
ofFactory.longValue = j;
ofFactory.text = LocaleController.formatPluralStringSpaced("StarsCount", (int) j);
ofFactory.subtext = tL_starsTopupOption.loadingStorePrice ? null : BillingController.getInstance().formatCurrency(tL_starsTopupOption.amount, tL_starsTopupOption.currency);
ofFactory.object = tL_starsTopupOption;
return ofFactory;
}
public void bindView(View view, UItem uItem, boolean z, UniversalAdapter universalAdapter, UniversalRecyclerView universalRecyclerView) {
((StarTierView) view).set(uItem.intValue, uItem.text, uItem.subtext, z);
}
public boolean contentsEquals(UItem uItem, UItem uItem2) {
return uItem.intValue == uItem2.intValue && uItem.id == uItem2.id && TextUtils.equals(uItem.subtext, uItem2.subtext);
}
public StarTierView createView(Context context, int i, int i2, Theme.ResourcesProvider resourcesProvider) {
return new StarTierView(context, resourcesProvider);
}
public boolean equals(UItem uItem, UItem uItem2) {
return uItem.id == uItem2.id;
}
}
public StarTierView(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.animatedStarsCount = new AnimatedFloat(this, 0L, 500L, CubicBezierInterpolator.EASE_OUT_QUINT);
Drawable mutate = context.getResources().getDrawable(R.drawable.star_small_outline).mutate();
this.starDrawableOutline = mutate;
mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogBackground, resourcesProvider), PorterDuff.Mode.SRC_IN));
this.starDrawable = context.getResources().getDrawable(R.drawable.star_small_inner).mutate();
setWillNotDraw(false);
TextView textView = new TextView(context);
this.textView = textView;
textView.setTypeface(AndroidUtilities.bold());
textView.setTextSize(1, 15.0f);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider));
addView(textView, LayoutHelper.createFrameRelatively(-2.0f, -2.0f, 8388627, 48.0f, 0.0f, 0.0f, 0.0f));
View animatedTextView = new AnimatedTextView(context);
this.textView2 = animatedTextView;
animatedTextView.setTextSize(AndroidUtilities.dp(15.0f));
animatedTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
animatedTextView.setGravity(LocaleController.isRTL ? 3 : 5);
addView(animatedTextView, LayoutHelper.createFrameRelatively(-2.0f, 21.0f, 8388629, 0.0f, 0.0f, 19.0f, 0.0f));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
float f = this.animatedStarsCount.set(this.starsCount);
float f2 = LocaleController.isRTL ? -1.0f : 1.0f;
float dp = AndroidUtilities.dp(24.0f);
float dp2 = AndroidUtilities.dp(24.0f);
float dp3 = AndroidUtilities.dp(2.5f);
float width = LocaleController.isRTL ? (getWidth() - AndroidUtilities.dp(19.0f)) - dp : AndroidUtilities.dp(19.0f);
int ceil = (int) Math.ceil(f);
while (true) {
ceil--;
if (ceil < 0) {
break;
}
float clamp = Utilities.clamp(f - ceil, 1.0f, 0.0f);
float f3 = (((ceil - 1) - (1.0f - clamp)) * dp3 * f2) + width;
float measuredHeight = (getMeasuredHeight() - dp2) / 2.0f;
int i = (int) f3;
int i2 = (int) measuredHeight;
int i3 = (int) (f3 + dp);
int i4 = (int) (measuredHeight + dp2);
this.starDrawableOutline.setBounds(i, i2, i3, i4);
int i5 = (int) (clamp * 255.0f);
this.starDrawableOutline.setAlpha(i5);
this.starDrawableOutline.draw(canvas);
this.starDrawable.setBounds(i, i2, i3, i4);
this.starDrawable.setAlpha(i5);
this.starDrawable.draw(canvas);
}
if (this.needDivider) {
canvas.drawRect(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(22.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(22.0f) : 0), getMeasuredHeight(), Theme.dividerPaint);
}
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48.0f), 1073741824));
}
public void set(int i, CharSequence charSequence, CharSequence charSequence2, boolean z) {
boolean equals = TextUtils.equals(this.textView.getText(), charSequence);
this.starsCount = i;
if (!equals) {
this.animatedStarsCount.set(i, true);
}
this.textView.setText(charSequence);
if (charSequence2 == null) {
if (this.loading == null) {
SpannableString spannableString = new SpannableString("x");
this.loading = spannableString;
spannableString.setSpan(new LoadingSpan(this.textView2, AndroidUtilities.dp(55.0f)), 0, this.loading.length(), 33);
}
charSequence2 = this.loading;
}
this.textView2.setText(charSequence2);
float f = LocaleController.isRTL ? -1.0f : 1.0f;
if (equals) {
this.textView.animate().translationX(f * (i - 1) * AndroidUtilities.dp(2.66f)).setDuration(320L).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).start();
} else {
this.textView.setTranslationX(f * (i - 1) * AndroidUtilities.dp(2.66f));
}
this.needDivider = z;
invalidate();
}
}
public static class StarsBalanceView extends LinearLayout implements NotificationCenter.NotificationCenterDelegate {
private final AnimatedTextView amountTextView;
private ValueAnimator bounceAnimator;
private final int currentAccount;
private long dialogId;
private final TextView headerTextView;
public long lastBalance;
private SpannableString loadingString;
public StarsBalanceView(Context context, int i) {
super(context);
this.lastBalance = -1L;
this.currentAccount = i;
this.dialogId = UserConfig.getInstance(i).getClientUserId();
setOrientation(1);
setGravity(21);
TextView textView = new TextView(context);
this.headerTextView = textView;
int i2 = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i2));
textView.setTextSize(1, 13.0f);
textView.setText(LocaleController.getString(R.string.StarsBalance));
textView.setGravity(5);
textView.setTypeface(AndroidUtilities.bold());
addView(textView, LayoutHelper.createLinear(-2, -2, 5));
final Drawable mutate = context.getResources().getDrawable(R.drawable.star_small_inner).mutate();
View view = new AnimatedTextView(context) {
protected void dispatchDraw(Canvas canvas) {
int measuredWidth = (int) ((getMeasuredWidth() - getDrawable().getCurrentWidth()) - AndroidUtilities.dp(20.0f));
mutate.setBounds(measuredWidth, (getMeasuredHeight() - AndroidUtilities.dp(17.0f)) / 2, AndroidUtilities.dp(17.0f) + measuredWidth, (getMeasuredHeight() + AndroidUtilities.dp(17.0f)) / 2);
mutate.draw(canvas);
StarsBalanceView.super.dispatchDraw(canvas);
}
};
this.amountTextView = view;
((AnimatedTextView) view).adaptWidth = true;
view.getDrawable().setHacks(false, true, true);
view.setTypeface(AndroidUtilities.bold());
view.setTextColor(Theme.getColor(i2));
view.setTextSize(AndroidUtilities.dp(13.0f));
view.setGravity(5);
view.setPadding(AndroidUtilities.dp(19.0f), 0, 0, 0);
addView(view, LayoutHelper.createLinear(-2, 20, 5, 0, -2, 0, 0));
updateBalance(false);
setPadding(AndroidUtilities.dp(15.0f), AndroidUtilities.dp(4.0f), AndroidUtilities.dp(15.0f), AndroidUtilities.dp(4.0f));
}
public void lambda$bounce$0(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.amountTextView.setScaleX(floatValue);
this.amountTextView.setScaleY(floatValue);
}
public void bounce() {
ValueAnimator valueAnimator = this.bounceAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.9f, 1.0f);
this.bounceAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
StarsIntroActivity.StarsBalanceView.this.lambda$bounce$0(valueAnimator2);
}
});
this.bounceAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
StarsBalanceView.this.amountTextView.setScaleX(1.0f);
StarsBalanceView.this.amountTextView.setScaleY(1.0f);
}
});
this.bounceAnimator.setDuration(320L);
this.bounceAnimator.setInterpolator(new OvershootInterpolator());
this.bounceAnimator.start();
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (i == NotificationCenter.starBalanceUpdated || (i == NotificationCenter.botStarsUpdated && ((Long) objArr[0]).longValue() == this.dialogId)) {
updateBalance(true);
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
updateBalance(false);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.botStarsUpdated);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.botStarsUpdated);
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(ActionBar.getCurrentActionBarHeight(), 1073741824));
}
public void setDialogId(long j) {
if (this.dialogId != j) {
this.dialogId = j;
updateBalance(true);
}
}
public void updateBalance(boolean z) {
long j;
boolean z2;
TLRPC.TL_starsRevenueStatus tL_starsRevenueStatus;
StarsController starsController = StarsController.getInstance(this.currentAccount);
this.amountTextView.cancelAnimation();
boolean z3 = true;
if (this.dialogId == UserConfig.getInstance(this.currentAccount).getClientUserId()) {
z2 = !starsController.balanceAvailable();
j = starsController.getBalance().amount;
} else {
TLRPC.TL_payments_starsRevenueStats starsRevenueStats = BotStarsController.getInstance(this.currentAccount).getStarsRevenueStats(this.dialogId);
if (starsRevenueStats != null && starsRevenueStats.status != null) {
z3 = false;
}
j = (starsRevenueStats == null || (tL_starsRevenueStatus = starsRevenueStats.status) == null) ? 0L : tL_starsRevenueStatus.current_balance.amount;
z2 = z3;
}
long j2 = this.lastBalance;
if (j > j2 && j2 != -1) {
bounce();
}
if (!z2) {
this.amountTextView.setText(LocaleController.formatNumber(j, ' '));
this.lastBalance = j;
return;
}
if (this.loadingString == null) {
SpannableString spannableString = new SpannableString("x");
this.loadingString = spannableString;
spannableString.setSpan(new LoadingSpan(this.amountTextView, AndroidUtilities.dp(48.0f)), 0, this.loadingString.length(), 33);
}
this.amountTextView.setText(this.loadingString, z);
this.lastBalance = -1L;
}
}
public static class StarsNeededSheet extends BottomSheetWithRecyclerListView implements NotificationCenter.NotificationCenterDelegate {
private final int BUTTON_EXPAND;
private UniversalAdapter adapter;
private boolean expanded;
private final FireworksOverlay fireworksOverlay;
private final FrameLayout footerView;
private final HeaderView headerView;
private final long starsNeeded;
private Runnable whenPurchased;
public static class HeaderView extends LinearLayout {
public final StarsBalanceView balanceView;
public final GLIconTextureView iconView;
public final StarParticlesView particlesView;
public final TextView subtitleView;
public final TextView titleView;
private final FrameLayout topView;
public HeaderView(Context context, int i, Theme.ResourcesProvider resourcesProvider) {
super(context);
setOrientation(1);
FrameLayout frameLayout = new FrameLayout(context);
this.topView = frameLayout;
frameLayout.setClipChildren(false);
frameLayout.setClipToPadding(false);
View makeParticlesView = StarsIntroActivity.makeParticlesView(context, 70, 0);
this.particlesView = makeParticlesView;
frameLayout.addView(makeParticlesView, LayoutHelper.createFrame(-1, -1.0f));
View gLIconTextureView = new GLIconTextureView(context, 1, 2);
this.iconView = gLIconTextureView;
GLIconRenderer gLIconRenderer = ((GLIconTextureView) gLIconTextureView).mRenderer;
gLIconRenderer.colorKey1 = Theme.key_starsGradient1;
gLIconRenderer.colorKey2 = Theme.key_starsGradient2;
gLIconRenderer.updateColors();
gLIconTextureView.setStarParticlesView(makeParticlesView);
frameLayout.addView(gLIconTextureView, LayoutHelper.createFrame(170, 170.0f, 17, 0.0f, 32.0f, 0.0f, 24.0f));
gLIconTextureView.setPaused(false);
StarsBalanceView starsBalanceView = new StarsBalanceView(context, i);
this.balanceView = starsBalanceView;
ScaleStateListAnimator.apply(starsBalanceView);
starsBalanceView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.StarsNeededSheet.HeaderView.this.lambda$new$0(view);
}
});
frameLayout.addView(starsBalanceView, LayoutHelper.createFrame(-2, -2.0f, 53, 0.0f, 0.0f, 0.0f, 0.0f));
addView(frameLayout, LayoutHelper.createFrame(-1, 150.0f));
TextView textView = new TextView(context);
this.titleView = textView;
textView.setTextSize(1, 20.0f);
textView.setTypeface(AndroidUtilities.bold());
int i2 = Theme.key_dialogTextBlack;
textView.setTextColor(Theme.getColor(i2, resourcesProvider));
textView.setGravity(17);
addView(textView, LayoutHelper.createLinear(-2, -2, 1, 0, 2, 0, 0));
TextView textView2 = new TextView(context);
this.subtitleView = textView2;
textView2.setTextSize(1, 14.0f);
textView2.setTextColor(Theme.getColor(i2, resourcesProvider));
textView2.setGravity(17);
addView(textView2, LayoutHelper.createLinear(-2, -2, 1, 0, 9, 0, 18));
}
public void lambda$new$0(View view) {
BaseFragment lastFragment;
if (this.balanceView.lastBalance > 0 && (lastFragment = LaunchActivity.getLastFragment()) != null) {
BaseFragment.BottomSheetParams bottomSheetParams = new BaseFragment.BottomSheetParams();
bottomSheetParams.transitionFromLeft = true;
bottomSheetParams.allowNestedScroll = false;
lastFragment.showAsSheet(new StarsIntroActivity(), bottomSheetParams);
}
}
}
public StarsNeededSheet(Context context, Theme.ResourcesProvider resourcesProvider, long j, int i, String str, Runnable runnable) {
super(context, (BaseFragment) null, false, false, false, resourcesProvider);
String str2;
String str3;
this.BUTTON_EXPAND = -1;
((BottomSheetWithRecyclerListView) this).topPadding = 0.2f;
this.whenPurchased = runnable;
fixNavigationBar();
RecyclerListView recyclerListView = ((BottomSheetWithRecyclerListView) this).recyclerListView;
int i2 = ((BottomSheet) this).backgroundPaddingLeft;
recyclerListView.setPadding(i2, 0, i2, 0);
((BottomSheetWithRecyclerListView) this).recyclerListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view, int i3) {
StarsIntroActivity.StarsNeededSheet.this.lambda$new$0(view, i3);
}
});
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setSupportsChangeAnimations(false);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDurations(350L);
((BottomSheetWithRecyclerListView) this).recyclerListView.setItemAnimator(defaultItemAnimator);
setBackgroundColor(Theme.getColor(Theme.key_dialogBackgroundGray, resourcesProvider));
this.starsNeeded = j;
HeaderView headerView = new HeaderView(context, ((BottomSheet) this).currentAccount, resourcesProvider);
this.headerView = headerView;
headerView.titleView.setText(LocaleController.formatPluralString("StarsNeededTitle", (int) Math.max(0L, j - StarsController.getInstance(((BottomSheet) this).currentAccount).getBalance().amount), new Object[0]));
if (i == 1) {
str2 = "StarsNeededTextBuySubscription";
} else {
if (i != 2) {
if (i == 7) {
str2 = "StarsNeededTextKeepBotSubscription";
} else if (i == 8) {
str2 = "StarsNeededTextKeepBizSubscription";
} else if (i != 3) {
if (i == 4) {
str2 = "StarsNeededTextLink";
if (str == null) {
str3 = "StarsNeededTextLink";
} else {
str3 = "StarsNeededTextLink_" + str.toLowerCase();
}
if (LocaleController.nullable(LocaleController.getString(str3)) != null) {
str2 = str3;
}
} else {
str2 = i == 5 ? "StarsNeededTextReactions" : i == 6 ? "StarsNeededTextGift" : i == 12 ? "StarsNeededTextGiftChannel" : i == 13 ? "StarsNeededTextPrivateMessage" : i == 10 ? "StarsNeededTextGiftUpgrade" : i == 11 ? "StarsNeededTextGiftTransfer" : i == 9 ? "StarsNeededBizText" : "StarsNeededText";
}
}
}
str2 = "StarsNeededTextKeepSubscription";
}
if (TextUtils.isEmpty(str2)) {
headerView.subtitleView.setText("");
} else {
String nullable = LocaleController.nullable(LocaleController.formatString(str2, LocaleController.getStringResId(str2), new Object[]{str}));
headerView.subtitleView.setText(AndroidUtilities.replaceTags(nullable == null ? LocaleController.getString(str2) : nullable));
TextView textView = headerView.subtitleView;
textView.setMaxWidth(HintView2.cutInFancyHalf(textView.getText(), headerView.subtitleView.getPaint()));
}
((BottomSheetWithRecyclerListView) this).actionBar.setTitle(getTitle());
FrameLayout frameLayout = new FrameLayout(context);
this.footerView = frameLayout;
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
frameLayout.setPadding(0, AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(11.0f));
linksTextView.setTextSize(1, 12.0f);
linksTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4, resourcesProvider));
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linksTextView.setText(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.StarsTOS), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.StarsNeededSheet.this.lambda$new$1();
}
}));
linksTextView.setGravity(17);
linksTextView.setMaxWidth(HintView2.cutInFancyHalf(linksTextView.getText(), linksTextView.getPaint()));
frameLayout.addView((View) linksTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2, -1, 17));
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider));
View fireworksOverlay = new FireworksOverlay(getContext());
this.fireworksOverlay = fireworksOverlay;
((BottomSheet) this).containerView.addView(fireworksOverlay, LayoutHelper.createFrame(-1, -1.0f));
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter != null) {
universalAdapter.update(false);
}
}
public void lambda$new$0(View view, int i) {
UItem item;
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter == null || (item = universalAdapter.getItem(i - 1)) == null) {
return;
}
onItemClick(item, this.adapter);
}
public void lambda$new$1() {
Browser.openUrl(getContext(), LocaleController.getString(R.string.StarsTOSLink));
}
public void lambda$onItemClick$2(UItem uItem, Boolean bool, String str) {
if (getContext() == null) {
return;
}
if (bool.booleanValue()) {
BulletinFactory.of((FrameLayout) ((BottomSheet) this).containerView, ((BottomSheet) this).resourcesProvider).createSimpleBulletin(R.raw.stars_topup, LocaleController.getString(R.string.StarsAcquired), AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsAcquiredInfo", (int) uItem.longValue, new Object[0]))).show();
this.fireworksOverlay.start(true);
StarsController.getInstance(((BottomSheet) this).currentAccount).invalidateTransactions(true);
} else if (str != null) {
BulletinFactory.of((FrameLayout) ((BottomSheet) this).containerView, ((BottomSheet) this).resourcesProvider).createSimpleBulletin(R.raw.error, LocaleController.formatString(R.string.UnknownErrorCode, new Object[]{str})).show();
}
}
protected RecyclerListView.SelectionAdapter createAdapter(RecyclerListView recyclerListView) {
UniversalAdapter universalAdapter = new UniversalAdapter(((BottomSheetWithRecyclerListView) this).recyclerListView, getContext(), ((BottomSheet) this).currentAccount, 0, true, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.StarsNeededSheet.this.fillItems((ArrayList) obj, (UniversalAdapter) obj2);
}
}, ((BottomSheet) this).resourcesProvider);
this.adapter = universalAdapter;
return universalAdapter;
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
Runnable runnable;
if (i == NotificationCenter.starOptionsLoaded || i == NotificationCenter.starBalanceUpdated) {
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter != null) {
universalAdapter.update(true);
}
long j = StarsController.getInstance(((BottomSheet) this).currentAccount).getBalance().amount;
this.headerView.titleView.setText(LocaleController.formatPluralStringComma("StarsNeededTitle", (int) (this.starsNeeded - j)));
ActionBar actionBar = ((BottomSheetWithRecyclerListView) this).actionBar;
if (actionBar != null) {
actionBar.setTitle(getTitle());
}
if (j < this.starsNeeded || (runnable = this.whenPurchased) == null) {
return;
}
runnable.run();
this.whenPurchased = null;
dismiss();
}
}
public void dismiss() {
super/*org.telegram.ui.ActionBar.BottomSheet*/.dismiss();
HeaderView headerView = this.headerView;
if (headerView != null) {
headerView.iconView.setPaused(true);
}
}
public void dismissInternal() {
super/*org.telegram.ui.ActionBar.BottomSheet*/.dismissInternal();
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated);
}
public void fillItems(java.util.ArrayList r14, org.telegram.ui.Components.UniversalAdapter r15) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.StarsNeededSheet.fillItems(java.util.ArrayList, org.telegram.ui.Components.UniversalAdapter):void");
}
protected CharSequence getTitle() {
HeaderView headerView = this.headerView;
if (headerView == null) {
return null;
}
return headerView.titleView.getText();
}
public void onItemClick(final UItem uItem, UniversalAdapter universalAdapter) {
if (uItem.id == -1) {
this.expanded = !this.expanded;
universalAdapter.update(true);
} else if (uItem.instanceOf(StarTierView.Factory.class) && (uItem.object instanceof TL_stars.TL_starsTopupOption)) {
LaunchActivity findActivity = AndroidUtilities.findActivity(getContext());
if (findActivity == null) {
findActivity = LaunchActivity.instance;
}
if (findActivity == null) {
return;
}
StarsController.getInstance(((BottomSheet) this).currentAccount).buy(findActivity, (TL_stars.TL_starsTopupOption) uItem.object, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.StarsNeededSheet.this.lambda$onItemClick$2(uItem, (Boolean) obj, (String) obj2);
}
});
}
}
public void show() {
if (StarsController.getInstance(((BottomSheet) this).currentAccount).getBalance().amount >= this.starsNeeded) {
Runnable runnable = this.whenPurchased;
if (runnable != null) {
runnable.run();
this.whenPurchased = null;
return;
}
return;
}
ChatActivity lastFragment = LaunchActivity.getLastFragment();
if (lastFragment instanceof ChatActivity) {
ChatActivity chatActivity = lastFragment;
if (chatActivity.isKeyboardVisible() && chatActivity.getChatActivityEnterView() != null) {
chatActivity.getChatActivityEnterView().closeKeyboard();
}
}
super/*org.telegram.ui.ActionBar.BottomSheet*/.show();
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated);
}
}
public static class StarsOptionsSheet extends BottomSheetWithRecyclerListView implements NotificationCenter.NotificationCenterDelegate {
private final int BUTTON_EXPAND;
private UniversalAdapter adapter;
private boolean expanded;
private final FireworksOverlay fireworksOverlay;
private final FrameLayout footerView;
public StarsOptionsSheet(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context, (BaseFragment) null, false, false, false, resourcesProvider);
this.BUTTON_EXPAND = -1;
RecyclerListView recyclerListView = ((BottomSheetWithRecyclerListView) this).recyclerListView;
int i = ((BottomSheet) this).backgroundPaddingLeft;
recyclerListView.setPadding(i, 0, i, 0);
((BottomSheetWithRecyclerListView) this).recyclerListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view, int i2) {
StarsIntroActivity.StarsOptionsSheet.this.lambda$new$0(view, i2);
}
});
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setSupportsChangeAnimations(false);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDurations(350L);
((BottomSheetWithRecyclerListView) this).recyclerListView.setItemAnimator(defaultItemAnimator);
int i2 = Theme.key_windowBackgroundWhite;
setBackgroundColor(Theme.getColor(i2, resourcesProvider));
fixNavigationBar(Theme.getColor(i2, resourcesProvider));
((BottomSheetWithRecyclerListView) this).actionBar.setTitle(getTitle());
FrameLayout frameLayout = new FrameLayout(context);
this.footerView = frameLayout;
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
frameLayout.setPadding(0, AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(11.0f));
linksTextView.setTextSize(1, 12.0f);
linksTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4, resourcesProvider));
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linksTextView.setText(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.StarsTOS), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.StarsOptionsSheet.this.lambda$new$1();
}
}));
linksTextView.setGravity(17);
linksTextView.setMaxWidth(HintView2.cutInFancyHalf(linksTextView.getText(), linksTextView.getPaint()));
frameLayout.addView((View) linksTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2, -1, 17));
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider));
View fireworksOverlay = new FireworksOverlay(getContext());
this.fireworksOverlay = fireworksOverlay;
((BottomSheet) this).containerView.addView(fireworksOverlay, LayoutHelper.createFrame(-1, -1.0f));
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter != null) {
universalAdapter.update(false);
}
}
public void lambda$new$0(View view, int i) {
UItem item;
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter == null || (item = universalAdapter.getItem(i - 1)) == null) {
return;
}
onItemClick(item, this.adapter);
}
public void lambda$new$1() {
Browser.openUrl(getContext(), LocaleController.getString(R.string.StarsTOSLink));
}
public void lambda$onItemClick$2(UItem uItem, Boolean bool, String str) {
if (getContext() == null) {
return;
}
dismiss();
StarsController.getInstance(((BottomSheet) this).currentAccount).invalidateTransactions(true);
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment == null) {
return;
}
if (!bool.booleanValue()) {
if (str != null) {
BulletinFactory.of(safeLastFragment).createSimpleBulletin(R.raw.error, LocaleController.formatString(R.string.UnknownErrorCode, new Object[]{str})).show();
}
} else {
BulletinFactory.of(safeLastFragment).createSimpleBulletin(R.raw.stars_topup, LocaleController.getString(R.string.StarsAcquired), AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsAcquiredInfo", (int) uItem.longValue, new Object[0]))).show();
LaunchActivity launchActivity = LaunchActivity.instance;
if (launchActivity != null) {
launchActivity.getFireworksOverlay().start(true);
}
}
}
protected RecyclerListView.SelectionAdapter createAdapter(RecyclerListView recyclerListView) {
UniversalAdapter universalAdapter = new UniversalAdapter(((BottomSheetWithRecyclerListView) this).recyclerListView, getContext(), ((BottomSheet) this).currentAccount, 0, true, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.StarsOptionsSheet.this.fillItems((ArrayList) obj, (UniversalAdapter) obj2);
}
}, ((BottomSheet) this).resourcesProvider);
this.adapter = universalAdapter;
universalAdapter.setApplyBackground(false);
return this.adapter;
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
UniversalAdapter universalAdapter;
if ((i == NotificationCenter.starOptionsLoaded || i == NotificationCenter.starBalanceUpdated) && (universalAdapter = this.adapter) != null) {
universalAdapter.update(true);
}
}
public void dismissInternal() {
super/*org.telegram.ui.ActionBar.BottomSheet*/.dismissInternal();
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated);
}
public void fillItems(ArrayList arrayList, UniversalAdapter universalAdapter) {
UItem asFlicker;
arrayList.add(UItem.asHeader(LocaleController.getString(R.string.TelegramStarsChoose)));
ArrayList options = StarsController.getInstance(((BottomSheet) this).currentAccount).getOptions();
if (options != null && !options.isEmpty()) {
int i = 0;
int i2 = 1;
for (int i3 = 0; i3 < options.size(); i3++) {
TL_stars.TL_starsTopupOption tL_starsTopupOption = (TL_stars.TL_starsTopupOption) options.get(i3);
if (!tL_starsTopupOption.extended || this.expanded) {
arrayList.add(StarTierView.Factory.asStarTier(i3, i2, tL_starsTopupOption));
i2++;
} else {
i++;
}
}
boolean z = this.expanded;
if (!z && i > 0) {
asFlicker = ExpandView.Factory.asExpand(-1, LocaleController.getString(z ? R.string.NotifyLessOptions : R.string.NotifyMoreOptions), !this.expanded).accent();
}
arrayList.add(UItem.asCustom(this.footerView));
}
arrayList.add(UItem.asFlicker(31));
arrayList.add(UItem.asFlicker(31));
arrayList.add(UItem.asFlicker(31));
arrayList.add(UItem.asFlicker(31));
asFlicker = UItem.asFlicker(31);
arrayList.add(asFlicker);
arrayList.add(UItem.asCustom(this.footerView));
}
protected CharSequence getTitle() {
return LocaleController.getString(R.string.StarsBuy);
}
public void onItemClick(final UItem uItem, UniversalAdapter universalAdapter) {
if (uItem.id == -1) {
this.expanded = !this.expanded;
universalAdapter.update(true);
((BottomSheetWithRecyclerListView) this).recyclerListView.smoothScrollBy(0, AndroidUtilities.dp(300.0f));
} else if (uItem.instanceOf(StarTierView.Factory.class) && (uItem.object instanceof TL_stars.TL_starsTopupOption)) {
LaunchActivity findActivity = AndroidUtilities.findActivity(getContext());
if (findActivity == null) {
findActivity = LaunchActivity.instance;
}
if (findActivity == null) {
return;
}
StarsController.getInstance(((BottomSheet) this).currentAccount).buy(findActivity, (TL_stars.TL_starsTopupOption) uItem.object, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.StarsOptionsSheet.this.lambda$onItemClick$2(uItem, (Boolean) obj, (String) obj2);
}
});
}
}
public void show() {
long j = StarsController.getInstance(((BottomSheet) this).currentAccount).getBalance().amount;
ChatActivity lastFragment = LaunchActivity.getLastFragment();
if (lastFragment instanceof ChatActivity) {
ChatActivity chatActivity = lastFragment;
if (chatActivity.isKeyboardVisible() && chatActivity.getChatActivityEnterView() != null) {
chatActivity.getChatActivityEnterView().closeKeyboard();
}
}
super/*org.telegram.ui.ActionBar.BottomSheet*/.show();
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BottomSheet) this).currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated);
}
}
public static class StarsSubscriptionView extends LinearLayout {
private final int currentAccount;
public final BackupImageView imageView;
private boolean needDivider;
public final LinearLayout priceLayout;
public final TextView priceSubtitleView;
public final TextView priceTitleView;
public final TextView productView;
private final Theme.ResourcesProvider resourcesProvider;
public final TextView subtitleView;
public final LinearLayout textLayout;
private boolean threeLines;
public final SimpleTextView titleView;
public static class Factory extends UItem.UItemFactory {
static {
UItem.UItemFactory.setup(new Factory());
}
public static UItem asSubscription(TL_stars.StarsSubscription starsSubscription) {
UItem ofFactory = UItem.ofFactory(Factory.class);
ofFactory.object = starsSubscription;
return ofFactory;
}
public void bindView(View view, UItem uItem, boolean z, UniversalAdapter universalAdapter, UniversalRecyclerView universalRecyclerView) {
((StarsSubscriptionView) view).set((TL_stars.StarsSubscription) uItem.object, z);
}
public StarsSubscriptionView createView(Context context, int i, int i2, Theme.ResourcesProvider resourcesProvider) {
StarsSubscriptionView starsSubscriptionView = (StarsSubscriptionView) getCached();
return starsSubscriptionView != null ? starsSubscriptionView : new StarsSubscriptionView(context, i, resourcesProvider);
}
public boolean equals(UItem uItem, UItem uItem2) {
if (uItem == null && uItem2 == null) {
return true;
}
if (uItem != null && uItem2 != null) {
Object obj = uItem.object;
if (obj instanceof TL_stars.StarsSubscription) {
Object obj2 = uItem2.object;
if (obj2 instanceof TL_stars.StarsSubscription) {
return TextUtils.equals(((TL_stars.StarsSubscription) obj).id, ((TL_stars.StarsSubscription) obj2).id);
}
}
}
return false;
}
}
public StarsSubscriptionView(Context context, int i, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.currentAccount = i;
this.resourcesProvider = resourcesProvider;
setOrientation(0);
View backupImageView = new BackupImageView(context);
this.imageView = backupImageView;
backupImageView.setRoundRadius(AndroidUtilities.dp(46.0f));
addView(backupImageView, LayoutHelper.createLinear(46, 46, 0.0f, 19, 13, 0, 13, 0));
LinearLayout linearLayout = new LinearLayout(context);
this.textLayout = linearLayout;
linearLayout.setOrientation(1);
addView(linearLayout, LayoutHelper.createLinear(-1, -2, 1.0f, 16, 0, 0, 0, 0));
View simpleTextView = new SimpleTextView(context);
this.titleView = simpleTextView;
int i2 = Theme.key_windowBackgroundWhiteBlackText;
simpleTextView.setTextColor(Theme.getColor(i2, resourcesProvider));
simpleTextView.setTextSize(16);
simpleTextView.setTypeface(AndroidUtilities.bold());
NotificationCenter.listenEmojiLoading(simpleTextView);
linearLayout.addView(simpleTextView, LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 2.0f));
TextView textView = new TextView(context);
this.productView = textView;
textView.setTextColor(Theme.getColor(i2, resourcesProvider));
textView.setTextSize(1, 13.0f);
textView.setVisibility(8);
linearLayout.addView(textView, LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 1.0f));
TextView textView2 = new TextView(context);
this.subtitleView = textView2;
int i3 = Theme.key_windowBackgroundWhiteGrayText2;
textView2.setTextColor(Theme.getColor(i3, resourcesProvider));
textView2.setTextSize(1, 14.0f);
linearLayout.addView(textView2, LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 0.0f));
LinearLayout linearLayout2 = new LinearLayout(context);
this.priceLayout = linearLayout2;
linearLayout2.setOrientation(1);
addView(linearLayout2, LayoutHelper.createLinear(-2, -2, 0.0f, 16, 0, 0, 18, 0));
TextView textView3 = new TextView(context);
this.priceTitleView = textView3;
textView3.setTextColor(Theme.getColor(i2, resourcesProvider));
textView3.setTextSize(1, 16.0f);
textView3.setTypeface(AndroidUtilities.bold());
textView3.setGravity(5);
linearLayout2.addView(textView3, LayoutHelper.createLinear(-1, -2, 5, 0, 0, 0, 1));
TextView textView4 = new TextView(context);
this.priceSubtitleView = textView4;
textView4.setTextColor(Theme.getColor(i3, resourcesProvider));
textView4.setTextSize(1, 13.0f);
textView4.setGravity(5);
linearLayout2.addView(textView4, LayoutHelper.createLinear(-1, -2, 5, 0, 0, 0, 0));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (this.needDivider) {
canvas.drawRect(AndroidUtilities.dp(72.0f), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight(), Theme.dividerPaint);
}
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(this.threeLines ? 68.0f : 58.0f), 1073741824));
}
public void set(TL_stars.StarsSubscription starsSubscription, boolean z) {
boolean z2;
String str;
TextView textView;
String str2;
int i;
long peerDialogId = DialogObject.getPeerDialogId(starsSubscription.peer);
this.threeLines = !TextUtils.isEmpty(starsSubscription.title);
MessagesController messagesController = MessagesController.getInstance(this.currentAccount);
if (peerDialogId < 0) {
TLRPC.Chat chat = messagesController.getChat(Long.valueOf(-peerDialogId));
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setInfo(chat);
this.imageView.setForUserOrChat(chat, avatarDrawable);
str = chat != null ? chat.title : null;
z2 = false;
} else {
TLRPC.User user = messagesController.getUser(Long.valueOf(peerDialogId));
AvatarDrawable avatarDrawable2 = new AvatarDrawable();
avatarDrawable2.setInfo(user);
this.imageView.setForUserOrChat(user, avatarDrawable2);
String userName = UserObject.getUserName(user);
z2 = !UserObject.isBot(user);
str = userName;
}
long currentTime = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
SimpleTextView simpleTextView = this.titleView;
simpleTextView.setText(Emoji.replaceEmoji(str, simpleTextView.getPaint().getFontMetricsInt(), false));
if (TextUtils.isEmpty(starsSubscription.title)) {
this.productView.setVisibility(8);
} else {
this.productView.setVisibility(0);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
if (starsSubscription.photo != null) {
ImageReceiverSpan imageReceiverSpan = new ImageReceiverSpan(this.productView, this.currentAccount, 14.0f);
imageReceiverSpan.setRoundRadius(4.0f);
imageReceiverSpan.enableShadow(false);
SpannableString spannableString = new SpannableString("x");
spannableString.setSpan(imageReceiverSpan, 0, 1, 33);
imageReceiverSpan.imageReceiver.setImage(ImageLocation.getForWebFile(WebFile.createWithWebDocument(starsSubscription.photo)), "14_14", (Drawable) null, (String) null, 0, 0);
spannableStringBuilder.append((CharSequence) spannableString).append((CharSequence) " ");
}
spannableStringBuilder.append(Emoji.replaceEmoji(starsSubscription.title, this.titleView.getPaint().getFontMetricsInt(), false));
this.productView.setText(spannableStringBuilder);
}
this.subtitleView.setTextSize(1, this.threeLines ? 13.0f : 14.0f);
if (starsSubscription.canceled || starsSubscription.bot_canceled) {
TextView textView2 = this.subtitleView;
long j = starsSubscription.until_date;
textView2.setText(LocaleController.formatString(j < currentTime ? R.string.StarsSubscriptionExpired : R.string.StarsSubscriptionExpires, new Object[]{LocaleController.formatDateChat(j)}));
this.priceTitleView.setVisibility(8);
this.priceSubtitleView.setTextColor(Theme.getColor(Theme.key_color_red, this.resourcesProvider));
this.priceSubtitleView.setText(LocaleController.getString(starsSubscription.bot_canceled ? z2 ? R.string.StarsSubscriptionStatusBizCancelled : R.string.StarsSubscriptionStatusBotCancelled : R.string.StarsSubscriptionStatusCancelled));
} else {
long j2 = starsSubscription.until_date;
if (j2 < currentTime) {
this.subtitleView.setText(LocaleController.formatString(R.string.StarsSubscriptionExpired, new Object[]{LocaleController.formatDateChat(j2)}));
this.priceTitleView.setVisibility(8);
this.priceSubtitleView.setTextColor(Theme.getColor(Theme.key_color_red, this.resourcesProvider));
textView = this.priceSubtitleView;
i = R.string.StarsSubscriptionStatusExpired;
} else {
this.subtitleView.setText(LocaleController.formatString(R.string.StarsSubscriptionRenews, new Object[]{LocaleController.formatDateChat(j2)}));
this.priceTitleView.setVisibility(0);
this.priceTitleView.setText(StarsIntroActivity.replaceStarsWithPlain("⭐️ " + Long.toString(starsSubscription.pricing.amount), 0.8f));
this.priceSubtitleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, this.resourcesProvider));
int i2 = starsSubscription.pricing.period;
if (i2 == 2592000) {
textView = this.priceSubtitleView;
i = R.string.StarsParticipantSubscriptionPerMonth;
} else {
if (i2 == 60) {
textView = this.priceSubtitleView;
str2 = "per minute";
} else if (i2 == 300) {
textView = this.priceSubtitleView;
str2 = "per 5 minutes";
}
textView.setText(str2);
}
}
str2 = LocaleController.getString(i);
textView.setText(str2);
}
this.needDivider = z;
setWillNotDraw(!z);
}
}
public static class StarsTransactionView extends LinearLayout {
public static HashMap cachedPlatformDrawables;
private final TextView amountTextView;
private final AvatarDrawable avatarDrawable;
private Runnable cancelCurrentGift;
private final int currentAccount;
private final TextView dateTextView;
private final LinearLayout.LayoutParams dateTextViewParams;
private final BackupImageView imageView;
private final BackupImageView imageView2;
private final FrameLayout imageViewContainer;
private int imageViewCount;
private boolean needDivider;
private final SpannableString star;
private final TextView subtitleTextView;
private final LinearLayout textLayout;
private boolean threeLines;
private final TextView titleTextView;
private final LinearLayout.LayoutParams titleTextViewParams;
private final SpannableString ton;
public static class Factory extends UItem.UItemFactory {
static {
UItem.UItemFactory.setup(new Factory());
}
public static UItem asTransaction(TL_stars.StarsTransaction starsTransaction, boolean z) {
UItem ofFactory = UItem.ofFactory(Factory.class);
ofFactory.object = starsTransaction;
ofFactory.accent = z;
return ofFactory;
}
public void bindView(View view, UItem uItem, boolean z, UniversalAdapter universalAdapter, UniversalRecyclerView universalRecyclerView) {
((StarsTransactionView) view).set((TL_stars.StarsTransaction) uItem.object, uItem.accent, z);
}
public StarsTransactionView createView(Context context, int i, int i2, Theme.ResourcesProvider resourcesProvider) {
StarsTransactionView starsTransactionView = (StarsTransactionView) getCached();
return starsTransactionView != null ? starsTransactionView : new StarsTransactionView(context, i, resourcesProvider);
}
}
public StarsTransactionView(Context context, int i, final Theme.ResourcesProvider resourcesProvider) {
super(context);
this.imageViewCount = 1;
this.currentAccount = i;
setOrientation(0);
FrameLayout frameLayout = new FrameLayout(context) {
private final Paint backgroundPaint = new Paint(1);
@Override
protected boolean drawChild(Canvas canvas, View view, long j) {
if (StarsTransactionView.this.imageViewCount > 1) {
this.backgroundPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(view.getX(), view.getY(), view.getX() + view.getWidth(), view.getY() + view.getHeight());
rectF.inset(-AndroidUtilities.dp(1.66f), -AndroidUtilities.dp(1.66f));
canvas.drawRoundRect(rectF, AndroidUtilities.dp(13.0f), AndroidUtilities.dp(13.0f), this.backgroundPaint);
}
return super.drawChild(canvas, view, j);
}
};
this.imageViewContainer = frameLayout;
addView(frameLayout, LayoutHelper.createLinear(72, -1, 0.0f, 115));
BackupImageView backupImageView = new BackupImageView(context);
this.imageView2 = backupImageView;
backupImageView.setRoundRadius(AndroidUtilities.dp(46.0f));
frameLayout.addView((View) backupImageView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(46, 46.0f, 16, 13.0f, 0.0f, 13.0f, 0.0f));
this.avatarDrawable = new AvatarDrawable();
BackupImageView backupImageView2 = new BackupImageView(context);
this.imageView = backupImageView2;
backupImageView2.setRoundRadius(AndroidUtilities.dp(46.0f));
frameLayout.addView((View) backupImageView2, (ViewGroup.LayoutParams) LayoutHelper.createFrame(46, 46.0f, 16, 13.0f, 0.0f, 13.0f, 0.0f));
LinearLayout linearLayout = new LinearLayout(context);
this.textLayout = linearLayout;
linearLayout.setOrientation(1);
linearLayout.setGravity(19);
addView(linearLayout, LayoutHelper.createLinear(-2, -1, 1.0f, 119));
TextView textView = new TextView(context);
this.titleTextView = textView;
textView.setTypeface(AndroidUtilities.bold());
int i2 = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i2, resourcesProvider));
textView.setTextSize(1, 16.0f);
TextUtils.TruncateAt truncateAt = TextUtils.TruncateAt.END;
textView.setEllipsize(truncateAt);
textView.setSingleLine(true);
LinearLayout.LayoutParams createLinear = LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 4.33f);
this.titleTextViewParams = createLinear;
linearLayout.addView(textView, createLinear);
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context);
this.subtitleTextView = linksTextView;
linksTextView.setTextColor(Theme.getColor(i2, resourcesProvider));
linksTextView.setTextSize(1, 13.0f);
linksTextView.setEllipsize(truncateAt);
linksTextView.setSingleLine(true);
linearLayout.addView((View) linksTextView, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 0.33f));
TextView textView2 = new TextView(context);
this.dateTextView = textView2;
textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
textView2.setTextSize(1, 14.0f);
textView2.setEllipsize(truncateAt);
textView2.setSingleLine(true);
LinearLayout.LayoutParams createLinear2 = LayoutHelper.createLinear(-1, -2);
this.dateTextViewParams = createLinear2;
linearLayout.addView(textView2, createLinear2);
TextView textView3 = new TextView(context);
this.amountTextView = textView3;
textView3.setTypeface(AndroidUtilities.bold());
textView3.setTextSize(1, 15.3f);
textView3.setGravity(5);
addView(textView3, LayoutHelper.createLinear(-2, -2, 0.0f, 21, 8, 0, 20, 0));
SpannableString spannableString = new SpannableString("⭐️");
this.star = spannableString;
Drawable mutate = context.getResources().getDrawable(R.drawable.star_small_inner).mutate();
mutate.setBounds(0, 0, AndroidUtilities.dp(21.0f), AndroidUtilities.dp(21.0f));
spannableString.setSpan(new ImageSpan(mutate), 0, spannableString.length(), 33);
SpannableString spannableString2 = new SpannableString("TON");
this.ton = spannableString2;
ColoredImageSpan coloredImageSpan = new ColoredImageSpan(context.getResources().getDrawable(R.drawable.ton).mutate());
coloredImageSpan.setSize(AndroidUtilities.dp(18.0f));
coloredImageSpan.setTranslateY(AndroidUtilities.dp(0.5f));
spannableString2.setSpan(coloredImageSpan, 0, spannableString2.length(), 33);
}
public static CombinedDrawable getPlatformDrawable(String str) {
return getPlatformDrawable(str, 44);
}
public static CombinedDrawable getPlatformDrawable(String str, int i) {
if (i != 44) {
return SessionCell.createDrawable(i, str);
}
if (cachedPlatformDrawables == null) {
cachedPlatformDrawables = new HashMap();
}
CombinedDrawable combinedDrawable = (CombinedDrawable) cachedPlatformDrawables.get(str);
if (combinedDrawable != null) {
return combinedDrawable;
}
HashMap hashMap = cachedPlatformDrawables;
CombinedDrawable createDrawable = SessionCell.createDrawable(44, str);
hashMap.put(str, createDrawable);
return createDrawable;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (this.needDivider) {
canvas.drawRect(LocaleController.isRTL ? 0.0f : AndroidUtilities.dp(72.0f), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(72.0f) : 0), getMeasuredHeight(), Theme.dividerPaint);
}
}
@Override
protected void onMeasure(int i, int i2) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(this.threeLines ? 71.0f : 58.0f), 1073741824));
}
public void set(org.telegram.tgnet.tl.TL_stars.StarsTransaction r26, boolean r27, boolean r28) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.StarsTransactionView.set(org.telegram.tgnet.tl.TL_stars$StarsTransaction, boolean, boolean):void");
}
}
public static class StarsTransactionsLayout extends LinearLayout implements NotificationCenter.NotificationCenterDelegate {
private final PageAdapter adapter;
private final long bot_id;
private final int currentAccount;
private final ViewPagerFixed.TabsView tabsView;
private final boolean ton;
private final ViewPagerFixed viewPager;
public static class Page extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
private final long bot_id;
private final int currentAccount;
private final UniversalRecyclerView listView;
private final Runnable loadTransactionsRunnable;
private final Theme.ResourcesProvider resourcesProvider;
private final boolean ton;
private final int type;
public Page(Context context, final boolean z, final long j, final int i, final int i2, int i3, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.type = i;
this.ton = z;
this.currentAccount = i2;
this.bot_id = j;
this.resourcesProvider = resourcesProvider;
this.loadTransactionsRunnable = new Runnable() {
@Override
public final void run() {
StarsIntroActivity.StarsTransactionsLayout.Page.lambda$new$0(j, i2, i, z);
}
};
UniversalRecyclerView universalRecyclerView = new UniversalRecyclerView(context, i2, i3, true, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.StarsTransactionsLayout.Page.this.fillItems((ArrayList) obj, (UniversalAdapter) obj2);
}
}, new Utilities.Callback5() {
public final void run(Object obj, Object obj2, Object obj3, Object obj4, Object obj5) {
StarsIntroActivity.StarsTransactionsLayout.Page.this.onClick((UItem) obj, (View) obj2, ((Integer) obj3).intValue(), ((Float) obj4).floatValue(), ((Float) obj5).floatValue());
}
}, (Utilities.Callback5Return) null, resourcesProvider);
this.listView = universalRecyclerView;
addView((View) universalRecyclerView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
universalRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int i4, int i5) {
if (!Page.this.listView.canScrollVertically(1) || Page.this.isLoadingVisible()) {
Page.this.loadTransactionsRunnable.run();
}
}
});
}
public void fillItems(ArrayList arrayList, UniversalAdapter universalAdapter) {
if (this.bot_id != 0) {
BotStarsController botStarsController = BotStarsController.getInstance(this.currentAccount);
Iterator it = botStarsController.getTransactions(this.bot_id, this.type).iterator();
while (it.hasNext()) {
arrayList.add(StarsTransactionView.Factory.asTransaction((TL_stars.StarsTransaction) it.next(), true));
}
if (botStarsController.didFullyLoadTransactions(this.bot_id, this.type)) {
return;
}
} else {
StarsController starsController = StarsController.getInstance(this.currentAccount, this.ton);
Iterator it2 = starsController.transactions[this.type].iterator();
while (it2.hasNext()) {
arrayList.add(StarsTransactionView.Factory.asTransaction((TL_stars.StarsTransaction) it2.next(), false));
}
if (starsController.didFullyLoadTransactions(this.type)) {
return;
}
}
arrayList.add(UItem.asFlicker(arrayList.size(), 7));
arrayList.add(UItem.asFlicker(arrayList.size(), 7));
arrayList.add(UItem.asFlicker(arrayList.size(), 7));
}
public static void lambda$new$0(long j, int i, int i2, boolean z) {
if (j != 0) {
BotStarsController.getInstance(i).loadTransactions(j, i2);
} else {
StarsController.getInstance(i, z).loadTransactions(i2);
}
}
public void onClick(UItem uItem, View view, int i, float f, float f2) {
if (uItem.object instanceof TL_stars.StarsTransaction) {
StarsIntroActivity.showTransactionSheet(getContext(), false, 0L, this.currentAccount, (TL_stars.StarsTransaction) uItem.object, this.resourcesProvider);
}
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (i != NotificationCenter.starTransactionsLoaded) {
if (i == NotificationCenter.botStarsTransactionsLoaded && ((Long) objArr[0]).longValue() == this.bot_id) {
this.listView.adapter.update(true);
return;
}
return;
}
this.listView.adapter.update(true);
if (!this.listView.canScrollVertically(1) || isLoadingVisible()) {
this.loadTransactionsRunnable.run();
}
}
public boolean isLoadingVisible() {
for (int i = 0; i < this.listView.getChildCount(); i++) {
if (this.listView.getChildAt(i) instanceof FlickerLoadingView) {
return true;
}
}
return false;
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
NotificationCenter.getInstance(this.currentAccount).addObserver(this, this.bot_id != 0 ? NotificationCenter.botStarsTransactionsLoaded : NotificationCenter.starTransactionsLoaded);
this.listView.adapter.update(false);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, this.bot_id != 0 ? NotificationCenter.botStarsTransactionsLoaded : NotificationCenter.starTransactionsLoaded);
}
}
private static class PageAdapter extends ViewPagerFixed.Adapter {
private final long bot_id;
private final int classGuid;
private final Context context;
private final int currentAccount;
private final ArrayList items = new ArrayList();
private final Theme.ResourcesProvider resourcesProvider;
private final boolean ton;
public PageAdapter(Context context, int i, boolean z, long j, int i2, Theme.ResourcesProvider resourcesProvider) {
this.context = context;
this.currentAccount = i;
this.ton = z;
this.classGuid = i2;
this.resourcesProvider = resourcesProvider;
this.bot_id = j;
fill();
}
public void bindView(View view, int i, int i2) {
}
public View createView(int i) {
return new Page(this.context, this.ton, this.bot_id, i, this.currentAccount, this.classGuid, this.resourcesProvider);
}
public void fill() {
this.items.clear();
long j = this.bot_id;
int i = this.currentAccount;
if (j == 0) {
StarsController starsController = StarsController.getInstance(i, this.ton);
this.items.add(UItem.asSpace(0));
if (starsController.hasTransactions(1)) {
this.items.add(UItem.asSpace(1));
}
if (!starsController.hasTransactions(2)) {
return;
}
} else {
BotStarsController botStarsController = BotStarsController.getInstance(i);
this.items.add(UItem.asSpace(0));
if (botStarsController.hasTransactions(this.bot_id, 1)) {
this.items.add(UItem.asSpace(1));
}
if (!botStarsController.hasTransactions(this.bot_id, 2)) {
return;
}
}
this.items.add(UItem.asSpace(2));
}
public int getItemCount() {
return this.items.size();
}
public String getItemTitle(int i) {
int i2;
int itemViewType = getItemViewType(i);
if (itemViewType == 0) {
i2 = R.string.StarsTransactionsAll;
} else if (itemViewType == 1) {
i2 = R.string.StarsTransactionsIncoming;
} else {
if (itemViewType != 2) {
return "";
}
i2 = R.string.StarsTransactionsOutgoing;
}
return LocaleController.getString(i2);
}
public int getItemViewType(int i) {
if (i < 0 || i >= this.items.size()) {
return 0;
}
return ((UItem) this.items.get(i)).intValue;
}
}
public StarsTransactionsLayout(Context context, int i, boolean z, long j, int i2, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.currentAccount = i;
this.ton = z;
this.bot_id = j;
setOrientation(1);
ViewPagerFixed viewPagerFixed = new ViewPagerFixed(context);
this.viewPager = viewPagerFixed;
PageAdapter pageAdapter = new PageAdapter(context, i, z, j, i2, resourcesProvider);
this.adapter = pageAdapter;
viewPagerFixed.setAdapter(pageAdapter);
ViewPagerFixed.TabsView createTabsView = viewPagerFixed.createTabsView(true, 3);
this.tabsView = createTabsView;
View view = new View(context);
view.setBackgroundColor(Theme.getColor(Theme.key_divider, resourcesProvider));
addView((View) createTabsView, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, 48));
addView(view, LayoutHelper.createLinear(-1.0f, 1.0f / AndroidUtilities.density));
addView((View) viewPagerFixed, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -1));
setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider));
}
public void didReceivedNotification(int i, int i2, Object... objArr) {
if (i == NotificationCenter.starTransactionsLoaded) {
this.adapter.fill();
this.viewPager.fillTabs(true);
}
}
public RecyclerListView getCurrentListView() {
View currentView = this.viewPager.getCurrentView();
if (currentView instanceof Page) {
return ((Page) currentView).listView;
}
return null;
}
@Override
protected void onAttachedToWindow() {
this.adapter.fill();
this.viewPager.fillTabs(false);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.starTransactionsLoaded);
super.onAttachedToWindow();
}
@Override
protected void onDetachedFromWindow() {
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.starTransactionsLoaded);
super.onDetachedFromWindow();
}
}
public StarsIntroActivity() {
setWhiteBackground(true);
}
public static void addAvailabilityRow(TableView tableView, int i, TL_stars.StarGift starGift, Theme.ResourcesProvider resourcesProvider) {
CharSequence formatPluralStringComma;
int i2;
String str;
final TextView textView = (TextView) tableView.addRow(LocaleController.getString(R.string.Gift2Availability), "").getChildAt(1).getChildAt(0);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("x ");
LoadingSpan loadingSpan = new LoadingSpan(textView, AndroidUtilities.dp(90.0f), 0, resourcesProvider);
loadingSpan.setColors(Theme.multAlpha(textView.getPaint().getColor(), 0.21f), Theme.multAlpha(textView.getPaint().getColor(), 0.08f));
spannableStringBuilder.setSpan(loadingSpan, 0, 1, 33);
textView.setText(spannableStringBuilder, TextView.BufferType.SPANNABLE);
if (!starGift.sold_out) {
StarsController.getInstance(i).getStarGift(starGift.id, new Utilities.Callback() {
public final void run(Object obj) {
StarsIntroActivity.lambda$addAvailabilityRow$102(textView, (TL_stars.StarGift) obj);
}
});
return;
}
if (!(starGift instanceof TL_stars.TL_starGiftUnique)) {
int i3 = starGift.availability_remains;
if (i3 > 0) {
formatPluralStringComma = LocaleController.formatPluralStringComma("Gift2Availability4Value", i3, new Object[]{LocaleController.formatNumber(starGift.availability_total, ',')});
textView.setText(formatPluralStringComma);
} else {
i2 = starGift.availability_total;
str = "Gift2Availability2ValueNone";
formatPluralStringComma = LocaleController.formatPluralStringComma(str, i2);
textView.setText(formatPluralStringComma);
}
}
if (starGift.availability_remains <= 0) {
i2 = starGift.availability_total;
str = "Gift2QuantityIssuedNone";
formatPluralStringComma = LocaleController.formatPluralStringComma(str, i2);
textView.setText(formatPluralStringComma);
}
formatPluralStringComma = LocaleController.formatPluralStringComma("Gift2QuantityIssued1", starGift.availability_issued) + LocaleController.formatPluralStringComma("Gift2QuantityIssued2", starGift.availability_total);
textView.setText(formatPluralStringComma);
}
private static CharSequence appendStatus(SpannableStringBuilder spannableStringBuilder, TextView textView, String str) {
spannableStringBuilder.append(" ");
SpannableString spannableString = new SpannableString(str);
spannableString.setSpan(new ReplacementSpan(textView.getCurrentTextColor(), str) {
private final Paint backgroundPaint;
private final Text layout;
final int val$color;
final String val$string;
{
this.val$color = r3;
this.val$string = str;
Paint paint = new Paint(1);
this.backgroundPaint = paint;
paint.setColor(Theme.multAlpha(r3, 0.1f));
this.layout = new Text(str, 13.0f, AndroidUtilities.bold());
}
@Override
public void draw(Canvas canvas, CharSequence charSequence, int i, int i2, float f, int i3, int i4, int i5, Paint paint) {
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(f, (r12 - AndroidUtilities.dp(20.0f)) / 2.0f, AndroidUtilities.dp(12.0f) + f + this.layout.getCurrentWidth(), (AndroidUtilities.dp(20.0f) + r12) / 2.0f);
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), this.backgroundPaint);
this.layout.draw(canvas, f + AndroidUtilities.dp(6.0f), (i3 + i5) / 2.0f, this.val$color, 1.0f);
}
@Override
public int getSize(Paint paint, CharSequence charSequence, int i, int i2, Paint.FontMetricsInt fontMetricsInt) {
return (int) (AndroidUtilities.dp(12.0f) + this.layout.getCurrentWidth());
}
}, 0, spannableString.length(), 33);
spannableStringBuilder.append((CharSequence) spannableString);
return spannableStringBuilder;
}
public static CharSequence formatStarsAmount(TL_stars.StarsAmount starsAmount) {
return formatStarsAmount(starsAmount, 0.777f, ',');
}
public static CharSequence formatStarsAmount(TL_stars.StarsAmount starsAmount, float f, char c) {
if (floatFormat == null) {
floatFormat = new DecimalFormat("0.################", new DecimalFormatSymbols(Locale.US));
}
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
if (starsAmount instanceof TL_stars.TL_starsTonAmount) {
DecimalFormat decimalFormat = floatFormat;
double d = starsAmount.amount;
Double.isNaN(d);
String format = decimalFormat.format(d / 1.0E9d);
spannableStringBuilder.append((CharSequence) format);
int indexOf = format.indexOf(".");
if (indexOf >= 0) {
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), indexOf, spannableStringBuilder.length(), 33);
}
} else {
long j = starsAmount.amount;
int i = starsAmount.nanos;
boolean z = false;
long j2 = ((i >= 0 || j <= 0) ? (i <= 0 || j >= 0) ? 0 : 1 : -1) + j;
if (j != 0 ? j < 0 : i < 0) {
z = true;
}
if (i != 0) {
StringBuilder sb = new StringBuilder();
sb.append(z ? "-" : "");
sb.append(LocaleController.formatNumber(Math.abs(j2), c));
spannableStringBuilder.append((CharSequence) sb.toString());
DecimalFormat decimalFormat2 = floatFormat;
int i2 = starsAmount.nanos;
double d2 = i2;
if (i2 < 0) {
Double.isNaN(d2);
d2 += 1.0E9d;
}
String format2 = decimalFormat2.format(d2 / 1.0E9d);
int indexOf2 = format2.indexOf(".");
if (indexOf2 >= 0) {
int length = spannableStringBuilder.length();
spannableStringBuilder.append((CharSequence) format2.substring(indexOf2));
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), length + 1, spannableStringBuilder.length(), 33);
}
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append(z ? "-" : "");
sb2.append(LocaleController.formatNumber(Math.abs(j2), ' '));
spannableStringBuilder.append((CharSequence) sb2.toString());
}
}
return spannableStringBuilder;
}
public static CharSequence formatStarsAmountShort(TL_stars.StarsAmount starsAmount) {
return formatStarsAmountShort(starsAmount, 0.777f, ' ');
}
public static CharSequence formatStarsAmountShort(TL_stars.StarsAmount starsAmount, float f, char c) {
StringBuilder sb;
String formatWholeNumber;
if (floatFormat == null) {
floatFormat = new DecimalFormat("0.################", new DecimalFormatSymbols(Locale.US));
}
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
if (starsAmount instanceof TL_stars.TL_starsTonAmount) {
DecimalFormat decimalFormat = floatFormat;
double d = starsAmount.amount;
Double.isNaN(d);
String format = decimalFormat.format(d / 1.0E9d);
spannableStringBuilder.append((CharSequence) format);
int indexOf = format.indexOf(".");
if (indexOf >= 0) {
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), indexOf, spannableStringBuilder.length(), 33);
}
} else {
long j = starsAmount.amount;
int i = starsAmount.nanos;
long j2 = ((i >= 0 || j <= 0) ? (i <= 0 || j >= 0) ? 0 : 1 : -1) + j;
boolean z = j != 0 ? j < 0 : i < 0;
if (Math.abs(j2) > 1000 || starsAmount.nanos == 0) {
if (starsAmount.amount <= 1000) {
sb = new StringBuilder();
sb.append(z ? "-" : "");
formatWholeNumber = LocaleController.formatNumber(Math.abs(j2), c);
} else {
sb = new StringBuilder();
sb.append(z ? "-" : "");
formatWholeNumber = AndroidUtilities.formatWholeNumber((int) Math.abs(j2), 0);
}
sb.append(formatWholeNumber);
spannableStringBuilder.append((CharSequence) sb.toString());
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append(z ? "-" : "");
sb2.append(LocaleController.formatNumber(Math.abs(j2), c));
spannableStringBuilder.append((CharSequence) sb2.toString());
DecimalFormat decimalFormat2 = floatFormat;
int i2 = starsAmount.nanos;
double d2 = i2;
if (i2 < 0) {
Double.isNaN(d2);
d2 += 1.0E9d;
}
String format2 = decimalFormat2.format(d2 / 1.0E9d);
int indexOf2 = format2.indexOf(".");
if (indexOf2 >= 0) {
int length = spannableStringBuilder.length();
String substring = format2.substring(indexOf2);
if (substring.length() > 1) {
spannableStringBuilder.append((CharSequence) substring.substring(0, Math.min(substring.length(), 3)));
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), length + 1, spannableStringBuilder.length(), 33);
}
}
}
}
return spannableStringBuilder;
}
public static CharSequence formatStarsAmountString(TL_stars.StarsAmount starsAmount) {
return formatStarsAmountString(starsAmount, 0.777f, ',');
}
public static CharSequence formatStarsAmountString(TL_stars.StarsAmount starsAmount, float f, char c) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
if (starsAmount instanceof TL_stars.TL_starsTonAmount) {
DecimalFormat decimalFormat = floatFormat;
double d = starsAmount.amount;
Double.isNaN(d);
String format = decimalFormat.format(d / 1.0E9d);
spannableStringBuilder.append((CharSequence) format);
int indexOf = format.indexOf(".");
if (indexOf >= 0) {
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), indexOf, spannableStringBuilder.length(), 33);
}
} else {
long j = starsAmount.amount;
int i = starsAmount.nanos;
boolean z = false;
long j2 = ((i >= 0 || j <= 0) ? (i <= 0 || j >= 0) ? 0 : 1 : -1) + j;
if (j != 0 ? j < 0 : i < 0) {
z = true;
}
if (i != 0) {
StringBuilder sb = new StringBuilder();
sb.append(z ? "-" : "");
sb.append(LocaleController.formatNumber(Math.abs(j2), c));
spannableStringBuilder.append((CharSequence) sb.toString());
if (floatFormat == null) {
floatFormat = new DecimalFormat("0.################", new DecimalFormatSymbols(Locale.US));
}
DecimalFormat decimalFormat2 = floatFormat;
int i2 = starsAmount.nanos;
double d2 = i2;
if (i2 < 0) {
Double.isNaN(d2);
d2 += 1.0E9d;
}
String format2 = decimalFormat2.format(d2 / 1.0E9d);
int indexOf2 = format2.indexOf(".");
if (indexOf2 >= 0) {
int length = spannableStringBuilder.length();
spannableStringBuilder.append((CharSequence) format2.substring(indexOf2));
spannableStringBuilder.setSpan(new RelativeSizeSpan(f), length + 1, spannableStringBuilder.length(), 33);
}
spannableStringBuilder.append((CharSequence) " ").append((CharSequence) LocaleController.getString(R.string.StarsNano));
} else {
spannableStringBuilder.append((CharSequence) LocaleController.formatPluralStringComma("Stars", (int) j));
}
}
return spannableStringBuilder;
}
public static String getGiftStarsEmoji(long j) {
return j <= 1000 ? "2⃣" : j < 2500 ? "3⃣" : "4⃣";
}
public static String getPremiumGiftMonthsEmoji(int i) {
return i != 3 ? i != 6 ? i != 12 ? i != 24 ? "1⃣" : "5⃣" : "4⃣" : "3⃣" : "2⃣";
}
public static String getTonGiftEmoji(long j) {
return j <= 10000000000L ? "2⃣" : j <= 50000000000L ? "1⃣" : "3⃣";
}
public static java.lang.CharSequence getTransactionTitle(int r5, boolean r6, org.telegram.tgnet.tl.TL_stars.StarsTransaction r7) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.getTransactionTitle(int, boolean, org.telegram.tgnet.tl.TL_stars$StarsTransaction):java.lang.CharSequence");
}
public static void lambda$addAvailabilityRow$102(TextView textView, TL_stars.StarGift starGift) {
int i;
String formatPluralStringComma;
String str;
if (starGift == null) {
return;
}
if (!(starGift instanceof TL_stars.TL_starGiftUnique)) {
int i2 = starGift.availability_remains;
i = starGift.availability_total;
if (i2 > 0) {
formatPluralStringComma = LocaleController.formatPluralStringComma("Gift2Availability4Value", i2, new Object[]{LocaleController.formatNumber(i, ',')});
textView.setText(formatPluralStringComma);
} else {
str = "Gift2Availability2ValueNone";
formatPluralStringComma = LocaleController.formatPluralStringComma(str, i);
textView.setText(formatPluralStringComma);
}
}
if (starGift.availability_remains <= 0) {
i = starGift.availability_total;
str = "Gift2QuantityIssuedNone";
formatPluralStringComma = LocaleController.formatPluralStringComma(str, i);
textView.setText(formatPluralStringComma);
}
formatPluralStringComma = LocaleController.formatPluralStringComma("Gift2QuantityIssued1", starGift.availability_issued) + LocaleController.formatPluralStringComma("Gift2QuantityIssued2", starGift.availability_total);
textView.setText(formatPluralStringComma);
}
public static void lambda$createView$0(Context context) {
new ExplainStarsSheet(context).show();
}
public void lambda$createView$1(View view, int i) {
UItem item;
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter == null || (item = universalAdapter.getItem(i)) == null) {
return;
}
onItemClick(item, i);
}
public void lambda$createView$2(Context context, View view) {
if (MessagesController.getInstance(((BaseFragment) this).currentAccount).isFrozen()) {
AccountFrozenAlert.show(((BaseFragment) this).currentAccount);
} else {
new StarsOptionsSheet(context, ((BaseFragment) this).resourceProvider).show();
}
}
public void lambda$createView$3(Context context, View view) {
new StarsOptionsSheet(context, ((BaseFragment) this).resourceProvider).show();
}
public void lambda$createView$4(View view) {
presentFragment(new BotStarsActivity(0, getUserConfig().getClientUserId()));
}
public void lambda$createView$5(View view) {
StarsController.getInstance(((BaseFragment) this).currentAccount).getGiftOptions();
UserSelectorBottomSheet.open(1, 0L, BirthdayController.getInstance(((BaseFragment) this).currentAccount).getState());
}
public void lambda$onItemClick$8(UItem uItem, Boolean bool, String str) {
if (getContext() == null) {
return;
}
if (bool.booleanValue()) {
BulletinFactory.of(this).createSimpleBulletin(R.raw.stars_topup, LocaleController.getString(R.string.StarsAcquired), AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsAcquiredInfo", (int) uItem.longValue, new Object[0]))).show();
this.fireworksOverlay.start(true);
StarsController.getInstance(((BaseFragment) this).currentAccount).invalidateTransactions(true);
} else if (str != null) {
BulletinFactory.of(this).createSimpleBulletin(R.raw.error, LocaleController.formatString(R.string.UnknownErrorCode, new Object[]{str})).show();
}
}
public static void lambda$openConfirmPurchaseSheet$10(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTOSLink));
}
public static void lambda$openConfirmPurchaseSheet$11(BottomSheet bottomSheet, ButtonWithCounterView buttonWithCounterView) {
bottomSheet.setCanDismissWithSwipe(false);
buttonWithCounterView.setLoading(false);
}
public static void lambda$openConfirmPurchaseSheet$12(final BottomSheet bottomSheet, final ButtonWithCounterView buttonWithCounterView, Boolean bool) {
if (bool.booleanValue()) {
bottomSheet.dismiss();
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$openConfirmPurchaseSheet$11(bottomSheet, buttonWithCounterView);
}
}, 400L);
}
}
public static void lambda$openConfirmPurchaseSheet$13(Utilities.Callback callback, final BottomSheet bottomSheet, final ButtonWithCounterView buttonWithCounterView, View view) {
if (callback == null) {
bottomSheet.dismiss();
return;
}
bottomSheet.setCanDismissWithSwipe(false);
buttonWithCounterView.setLoading(true);
callback.run(new Utilities.Callback() {
public final void run(Object obj) {
StarsIntroActivity.lambda$openConfirmPurchaseSheet$12(bottomSheet, buttonWithCounterView, (Boolean) obj);
}
});
}
public static void lambda$openConfirmPurchaseSheet$14(Runnable runnable, DialogInterface dialogInterface) {
if (runnable != null) {
runnable.run();
}
}
public static void lambda$openConfirmPurchaseSheet$9(StarsBalanceView starsBalanceView, View view) {
BaseFragment lastFragment;
if (starsBalanceView.lastBalance > 0 && (lastFragment = LaunchActivity.getLastFragment()) != null) {
BaseFragment.BottomSheetParams bottomSheetParams = new BaseFragment.BottomSheetParams();
bottomSheetParams.transitionFromLeft = true;
bottomSheetParams.allowNestedScroll = false;
lastFragment.showAsSheet(new StarsIntroActivity(), bottomSheetParams);
}
}
public static void lambda$openStarsChannelInviteSheet$15(StarsBalanceView starsBalanceView, View view) {
BaseFragment lastFragment;
if (starsBalanceView.lastBalance > 0 && (lastFragment = LaunchActivity.getLastFragment()) != null) {
BaseFragment.BottomSheetParams bottomSheetParams = new BaseFragment.BottomSheetParams();
bottomSheetParams.transitionFromLeft = true;
bottomSheetParams.allowNestedScroll = false;
lastFragment.showAsSheet(new StarsIntroActivity(), bottomSheetParams);
}
}
public static void lambda$openStarsChannelInviteSheet$16(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsSubscribeInfoLink));
}
public static void lambda$openStarsChannelInviteSheet$17(BottomSheet bottomSheet, ButtonWithCounterView buttonWithCounterView) {
bottomSheet.setCanDismissWithSwipe(false);
buttonWithCounterView.setLoading(false);
}
public static void lambda$openStarsChannelInviteSheet$18(final BottomSheet bottomSheet, final ButtonWithCounterView buttonWithCounterView, Boolean bool) {
if (bool.booleanValue()) {
bottomSheet.dismiss();
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$17(bottomSheet, buttonWithCounterView);
}
}, 400L);
}
}
public static void lambda$openStarsChannelInviteSheet$19(Utilities.Callback callback, final BottomSheet bottomSheet, final ButtonWithCounterView buttonWithCounterView, View view) {
if (callback == null) {
bottomSheet.dismiss();
return;
}
bottomSheet.setCanDismissWithSwipe(false);
buttonWithCounterView.setLoading(true);
callback.run(new Utilities.Callback() {
public final void run(Object obj) {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$18(bottomSheet, buttonWithCounterView, (Boolean) obj);
}
});
}
public static void lambda$openStarsChannelInviteSheet$20(Runnable runnable, DialogInterface dialogInterface) {
if (runnable != null) {
runnable.run();
}
}
public static void lambda$setGiftImage$21(boolean z, int i, String str, ImageReceiver imageReceiver, final boolean[] zArr) {
String str2;
TLRPC.Document document;
UserConfig userConfig = UserConfig.getInstance(i);
if (z) {
str2 = userConfig.premiumTonStickerPack;
if (str2 == null) {
MediaDataController.getInstance(i).checkTonGiftStickers();
return;
}
} else {
str2 = userConfig.premiumGiftsStickerPack;
if (str2 == null) {
MediaDataController.getInstance(i).checkPremiumGiftStickers();
return;
}
}
TLRPC.TL_messages_stickerSet stickerSetByName = MediaDataController.getInstance(i).getStickerSetByName(str2);
if (stickerSetByName == null) {
stickerSetByName = MediaDataController.getInstance(i).getStickerSetByEmojiOrName(str2);
}
TLRPC.TL_messages_stickerSet tL_messages_stickerSet = stickerSetByName;
if (tL_messages_stickerSet != null) {
int i2 = 0;
while (true) {
if (i2 >= ((TLRPC.messages_StickerSet) tL_messages_stickerSet).packs.size()) {
break;
}
TLRPC.TL_stickerPack tL_stickerPack = (TLRPC.TL_stickerPack) ((TLRPC.messages_StickerSet) tL_messages_stickerSet).packs.get(i2);
if (TextUtils.equals(tL_stickerPack.emoticon, str) && !tL_stickerPack.documents.isEmpty()) {
long longValue = ((Long) tL_stickerPack.documents.get(0)).longValue();
for (int i3 = 0; i3 < ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.size(); i3++) {
document = (TLRPC.Document) ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.get(i3);
if (document != null && document.id == longValue) {
break;
}
}
} else {
i2++;
}
}
document = null;
if (document == null && !((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.isEmpty()) {
document = (TLRPC.Document) ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.get(0);
}
} else {
document = null;
}
if (document == null) {
MediaDataController.getInstance(i).loadStickersByEmojiOrName(str2, false, tL_messages_stickerSet == null);
return;
}
imageReceiver.setAllowStartLottieAnimation(true);
imageReceiver.setDelegate(new ImageReceiver.ImageReceiverDelegate() {
public void didSetImage(ImageReceiver imageReceiver2, boolean z2, boolean z3, boolean z4) {
RLottieDrawable lottieAnimation;
if (!z2 || (lottieAnimation = imageReceiver2.getLottieAnimation()) == null || zArr[0]) {
return;
}
lottieAnimation.setCurrentFrame(0, false);
AndroidUtilities.runOnUIThread(new ChatActionCell$.ExternalSyntheticLambda8(lottieAnimation));
zArr[0] = true;
}
public void didSetImageBitmap(int i4, String str3, Drawable drawable) {
ImageReceiver.ImageReceiverDelegate.-CC.$default$didSetImageBitmap(this, i4, str3, drawable);
}
public void onAnimationReady(ImageReceiver imageReceiver2) {
ImageReceiver.ImageReceiverDelegate.-CC.$default$onAnimationReady(this, imageReceiver2);
}
});
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, Theme.key_windowBackgroundGray, 0.3f);
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 160, true, (TLRPC.PhotoSize) null, true);
imageReceiver.setAutoRepeat(0);
imageReceiver.setImage(ImageLocation.getForDocument(document), "160_160_nr", ImageLocation.getForDocument(closestPhotoSizeWithSize, document), "160_160", svgThumb, document.size, "tgs", tL_messages_stickerSet, 1);
}
public static void lambda$setGiftImage$24(Runnable runnable, Runnable runnable2) {
runnable.run();
runnable2.run();
}
public static void lambda$showBoostsSheet$78(BottomSheet[] bottomSheetArr, long j) {
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment == null) {
return;
}
safeLastFragment.presentFragment(ChatActivity.of(j));
}
public static void lambda$showBoostsSheet$79(BottomSheet[] bottomSheetArr, long j, TL_stories.Boost boost) {
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment == null) {
return;
}
safeLastFragment.presentFragment(ChatActivity.of(j, boost.giveaway_msg_id));
}
public static void lambda$showBoostsSheet$80(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTOSLink));
}
public static void lambda$showBoostsSheet$81(BottomSheet[] bottomSheetArr, View view) {
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
}
public static void lambda$showGiftResellPriceSheet$100(BottomSheet[] bottomSheetArr, final EditTextBoldCursor editTextBoldCursor) {
bottomSheetArr[0].setFocusable(true);
editTextBoldCursor.requestFocus();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
AndroidUtilities.showKeyboard(editTextBoldCursor);
}
});
}
public static void lambda$showGiftResellPriceSheet$94(OutlineTextContainerView outlineTextContainerView, EditTextBoldCursor editTextBoldCursor, View view, boolean z) {
outlineTextContainerView.animateSelection(z, !TextUtils.isEmpty(editTextBoldCursor.getText()));
}
public static void lambda$showGiftResellPriceSheet$95(BottomSheet[] bottomSheetArr) {
bottomSheetArr[0].dismiss();
}
public static boolean lambda$showGiftResellPriceSheet$96(boolean[] zArr, Utilities.Callback2 callback2, ButtonWithCounterView buttonWithCounterView, EditTextBoldCursor editTextBoldCursor, OutlineTextContainerView outlineTextContainerView, long j, final BottomSheet[] bottomSheetArr, TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
if (zArr[0]) {
return true;
}
if (callback2 != null) {
zArr[0] = true;
buttonWithCounterView.setLoading(true);
try {
long parseLong = Long.parseLong(editTextBoldCursor.getText().toString());
if (parseLong < j) {
AndroidUtilities.shakeViewSpring(outlineTextContainerView);
return true;
}
callback2.run(Long.valueOf(parseLong), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showGiftResellPriceSheet$95(bottomSheetArr);
}
});
} catch (Exception e) {
FileLog.e(e);
AndroidUtilities.shakeViewSpring(outlineTextContainerView);
return true;
}
} else {
bottomSheetArr[0].dismiss();
}
return true;
}
public static void lambda$showGiftResellPriceSheet$97(BottomSheet[] bottomSheetArr) {
bottomSheetArr[0].dismiss();
}
public static void lambda$showGiftResellPriceSheet$98(boolean[] zArr, Utilities.Callback2 callback2, ButtonWithCounterView buttonWithCounterView, EditTextBoldCursor editTextBoldCursor, OutlineTextContainerView outlineTextContainerView, long j, final BottomSheet[] bottomSheetArr, View view) {
if (zArr[0]) {
return;
}
if (callback2 == null) {
bottomSheetArr[0].dismiss();
return;
}
zArr[0] = true;
buttonWithCounterView.setLoading(true);
try {
long parseLong = Long.parseLong(editTextBoldCursor.getText().toString());
if (parseLong < j) {
AndroidUtilities.shakeViewSpring(outlineTextContainerView);
} else {
callback2.run(Long.valueOf(parseLong), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showGiftResellPriceSheet$97(bottomSheetArr);
}
});
}
} catch (Exception e) {
FileLog.e(e);
AndroidUtilities.shakeViewSpring(outlineTextContainerView);
}
}
public static void lambda$showMediaPriceSheet$83(OutlineTextContainerView outlineTextContainerView, EditTextBoldCursor editTextBoldCursor, View view, boolean z) {
outlineTextContainerView.animateSelection(z, !TextUtils.isEmpty(editTextBoldCursor.getText()));
}
public static void lambda$showMediaPriceSheet$84(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.PaidContentInfoLink));
}
public static void lambda$showMediaPriceSheet$85(EditTextBoldCursor editTextBoldCursor, BottomSheet[] bottomSheetArr) {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
}
public static boolean lambda$showMediaPriceSheet$86(boolean[] zArr, Utilities.Callback2 callback2, ButtonWithCounterView buttonWithCounterView, final EditTextBoldCursor editTextBoldCursor, final BottomSheet[] bottomSheetArr, TextView textView, int i, KeyEvent keyEvent) {
if (i != 5) {
return false;
}
if (zArr[0]) {
return true;
}
if (callback2 != null) {
zArr[0] = true;
buttonWithCounterView.setLoading(true);
callback2.run(Long.valueOf(Long.parseLong(editTextBoldCursor.getText().toString())), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showMediaPriceSheet$85(editTextBoldCursor, bottomSheetArr);
}
});
} else {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
}
return true;
}
public static void lambda$showMediaPriceSheet$87(EditTextBoldCursor editTextBoldCursor, BottomSheet[] bottomSheetArr) {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
}
public static void lambda$showMediaPriceSheet$88(boolean[] zArr, Utilities.Callback2 callback2, final EditTextBoldCursor editTextBoldCursor, ButtonWithCounterView buttonWithCounterView, final BottomSheet[] bottomSheetArr, View view) {
if (zArr[0]) {
return;
}
if (callback2 == null) {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
} else {
String obj = editTextBoldCursor.getText().toString();
zArr[0] = true;
buttonWithCounterView.setLoading(true);
callback2.run(Long.valueOf(TextUtils.isEmpty(obj) ? 0L : Long.parseLong(obj)), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showMediaPriceSheet$87(editTextBoldCursor, bottomSheetArr);
}
});
}
}
public static void lambda$showMediaPriceSheet$89(boolean[] zArr, EditTextBoldCursor editTextBoldCursor, BottomSheet[] bottomSheetArr) {
zArr[0] = false;
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
}
public static void lambda$showMediaPriceSheet$90(final boolean[] zArr, Utilities.Callback2 callback2, ButtonWithCounterView buttonWithCounterView, final EditTextBoldCursor editTextBoldCursor, final BottomSheet[] bottomSheetArr, View view) {
if (zArr[0]) {
return;
}
if (callback2 == null) {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
bottomSheetArr[0].dismiss();
} else {
zArr[0] = true;
buttonWithCounterView.setLoading(true);
callback2.run(0L, new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showMediaPriceSheet$89(zArr, editTextBoldCursor, bottomSheetArr);
}
});
}
}
public static void lambda$showMediaPriceSheet$93(BottomSheet[] bottomSheetArr, final EditTextBoldCursor editTextBoldCursor) {
bottomSheetArr[0].setFocusable(true);
editTextBoldCursor.requestFocus();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
AndroidUtilities.showKeyboard(editTextBoldCursor);
}
});
}
public static void lambda$showSoldOutGiftSheet$101(BottomSheet[] bottomSheetArr, View view) {
bottomSheetArr[0].dismiss();
}
public static void lambda$showSubscriptionSheet$60(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTOSLink));
}
public static void lambda$showSubscriptionSheet$61(ButtonWithCounterView buttonWithCounterView, BottomSheet[] bottomSheetArr, int i, long j) {
buttonWithCounterView.setLoading(false);
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
StarsController.getInstance(i).invalidateSubscriptions(true);
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment == null) {
return;
}
safeLastFragment.presentFragment(ChatActivity.of(j));
}
public static void lambda$showSubscriptionSheet$62(final ButtonWithCounterView buttonWithCounterView, final BottomSheet[] bottomSheetArr, final int i, final long j, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$61(ButtonWithCounterView.this, bottomSheetArr, i, j);
}
});
}
public static void lambda$showSubscriptionSheet$63(final ButtonWithCounterView buttonWithCounterView, TL_stars.StarsSubscription starsSubscription, final int i, final BottomSheet[] bottomSheetArr, final long j) {
buttonWithCounterView.setLoading(true);
TL_stars.TL_fulfillStarsSubscription tL_fulfillStarsSubscription = new TL_stars.TL_fulfillStarsSubscription();
tL_fulfillStarsSubscription.subscription_id = starsSubscription.id;
tL_fulfillStarsSubscription.peer = new TLRPC.TL_inputPeerSelf();
ConnectionsManager.getInstance(i).sendRequest(tL_fulfillStarsSubscription, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
StarsIntroActivity.lambda$showSubscriptionSheet$62(ButtonWithCounterView.this, bottomSheetArr, i, j, tLObject, tL_error);
}
});
}
public static void lambda$showSubscriptionSheet$64(final ButtonWithCounterView buttonWithCounterView, final int i, final TL_stars.StarsSubscription starsSubscription, final BottomSheet[] bottomSheetArr, final long j, Context context, Theme.ResourcesProvider resourcesProvider, boolean z, String str, View view) {
if (buttonWithCounterView.isLoading()) {
return;
}
StarsController starsController = StarsController.getInstance(i);
Runnable runnable = new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$63(ButtonWithCounterView.this, starsSubscription, i, bottomSheetArr, j);
}
};
if (starsController.balance.amount < starsSubscription.pricing.amount) {
new StarsNeededSheet(context, resourcesProvider, starsSubscription.pricing.amount, z ? 8 : j < 0 ? 2 : 7, str, runnable).show();
} else {
runnable.run();
}
}
public static void lambda$showSubscriptionSheet$65(ButtonWithCounterView buttonWithCounterView, BottomSheet[] bottomSheetArr, int i, TLObject tLObject, String str) {
buttonWithCounterView.setLoading(false);
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
StarsController.getInstance(i).invalidateSubscriptions(true);
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
BulletinFactory.of(safeLastFragment).createUsersBulletin(Collections.singletonList(tLObject), LocaleController.getString(R.string.StarsSubscriptionRenewedToast), AndroidUtilities.replaceTags(LocaleController.formatString(R.string.StarsSubscriptionRenewedToastText, new Object[]{str}))).show(false);
}
}
public static void lambda$showSubscriptionSheet$66(final ButtonWithCounterView buttonWithCounterView, final BottomSheet[] bottomSheetArr, final int i, final TLObject tLObject, final String str, TLObject tLObject2, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$65(ButtonWithCounterView.this, bottomSheetArr, i, tLObject, str);
}
});
}
public static void lambda$showSubscriptionSheet$67(final ButtonWithCounterView buttonWithCounterView, TL_stars.StarsSubscription starsSubscription, final int i, final BottomSheet[] bottomSheetArr, final TLObject tLObject, final String str, View view) {
if (buttonWithCounterView.isLoading()) {
return;
}
buttonWithCounterView.setLoading(true);
TL_stars.TL_changeStarsSubscription tL_changeStarsSubscription = new TL_stars.TL_changeStarsSubscription();
tL_changeStarsSubscription.canceled = Boolean.FALSE;
tL_changeStarsSubscription.peer = new TLRPC.TL_inputPeerSelf();
tL_changeStarsSubscription.subscription_id = starsSubscription.id;
ConnectionsManager.getInstance(i).sendRequest(tL_changeStarsSubscription, new RequestDelegate() {
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error) {
StarsIntroActivity.lambda$showSubscriptionSheet$66(ButtonWithCounterView.this, bottomSheetArr, i, tLObject, str, tLObject2, tL_error);
}
});
}
public static void lambda$showSubscriptionSheet$68(ButtonWithCounterView buttonWithCounterView, BottomSheet[] bottomSheetArr, int i, boolean z, TL_stars.StarsSubscription starsSubscription, boolean z2, TLObject tLObject) {
buttonWithCounterView.setLoading(false);
BottomSheet bottomSheet = bottomSheetArr[0];
if (bottomSheet != null) {
bottomSheet.dismiss();
}
StarsController.getInstance(i).invalidateSubscriptions(true);
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
BulletinFactory.of(safeLastFragment).createUsersBulletin(Collections.singletonList(tLObject), LocaleController.getString(R.string.StarsSubscriptionCancelledToast), AndroidUtilities.replaceTags((!z || TextUtils.isEmpty(starsSubscription.title)) ? (!z2 || TextUtils.isEmpty(starsSubscription.title)) ? LocaleController.formatString(R.string.StarsSubscriptionCancelledToastText, new Object[]{LocaleController.formatDateChat(starsSubscription.until_date)}) : LocaleController.formatString(R.string.StarsSubscriptionCancelledBotToastText, new Object[]{LocaleController.formatDateChat(starsSubscription.until_date), starsSubscription.title}) : LocaleController.formatString(R.string.StarsSubscriptionCancelledBizToastText, new Object[]{LocaleController.formatDateChat(starsSubscription.until_date), starsSubscription.title}))).show(false);
}
}
public static void lambda$showSubscriptionSheet$69(final ButtonWithCounterView buttonWithCounterView, final BottomSheet[] bottomSheetArr, final int i, final boolean z, final TL_stars.StarsSubscription starsSubscription, final boolean z2, final TLObject tLObject, TLObject tLObject2, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$68(ButtonWithCounterView.this, bottomSheetArr, i, z, starsSubscription, z2, tLObject);
}
});
}
public static void lambda$showSubscriptionSheet$70(final ButtonWithCounterView buttonWithCounterView, final TL_stars.StarsSubscription starsSubscription, final int i, final BottomSheet[] bottomSheetArr, final boolean z, final boolean z2, final TLObject tLObject, View view) {
if (buttonWithCounterView.isLoading()) {
return;
}
buttonWithCounterView.setLoading(true);
TL_stars.TL_changeStarsSubscription tL_changeStarsSubscription = new TL_stars.TL_changeStarsSubscription();
tL_changeStarsSubscription.canceled = Boolean.TRUE;
tL_changeStarsSubscription.peer = new TLRPC.TL_inputPeerSelf();
tL_changeStarsSubscription.subscription_id = starsSubscription.id;
ConnectionsManager.getInstance(i).sendRequest(tL_changeStarsSubscription, new RequestDelegate() {
public final void run(TLObject tLObject2, TLRPC.TL_error tL_error) {
StarsIntroActivity.lambda$showSubscriptionSheet$69(ButtonWithCounterView.this, bottomSheetArr, i, z, starsSubscription, z2, tLObject, tLObject2, tL_error);
}
});
}
public static void lambda$showSubscriptionSheet$71(BaseFragment baseFragment, long j, TLRPC.Chat chat) {
BulletinFactory.of(baseFragment).createSimpleBulletin(R.raw.stars_send, LocaleController.getString(R.string.StarsSubscriptionCompleted), AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsSubscriptionCompletedText", (int) j, new Object[]{chat.title}))).show(true);
}
public static void lambda$showSubscriptionSheet$72(Long l, int i, final long j) {
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment == null) {
return;
}
final ChatActivity of = ChatActivity.of(l.longValue());
safeLastFragment.presentFragment(of);
final TLRPC.Chat chat = MessagesController.getInstance(i).getChat(Long.valueOf(-l.longValue()));
if (chat != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$71(of, j, chat);
}
}, 250L);
}
}
public static void lambda$showSubscriptionSheet$73(final int i, final long j, String str, final Long l) {
if (!"paid".equals(str) || l.longValue() == 0) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$72(l, i, j);
}
});
}
public static void lambda$showSubscriptionSheet$74(ButtonWithCounterView buttonWithCounterView, TLObject tLObject, BottomSheet[] bottomSheetArr, Theme.ResourcesProvider resourcesProvider, final int i, TLRPC.TL_messages_checkChatInvite tL_messages_checkChatInvite) {
buttonWithCounterView.setLoading(false);
if (!(tLObject instanceof TLRPC.ChatInvite)) {
BulletinFactory.of(bottomSheetArr[0].topBulletinContainer, resourcesProvider).createErrorBulletin(LocaleController.getString(R.string.LinkHashExpired)).show(false);
return;
}
TLRPC.ChatInvite chatInvite = (TLRPC.ChatInvite) tLObject;
TL_stars.TL_starsSubscriptionPricing tL_starsSubscriptionPricing = chatInvite.subscription_pricing;
if (tL_starsSubscriptionPricing == null) {
BulletinFactory.of(bottomSheetArr[0].topBulletinContainer, resourcesProvider).createErrorBulletin(LocaleController.getString(R.string.UnknownError)).show(false);
} else {
final long j = tL_starsSubscriptionPricing.amount;
StarsController.getInstance(i).subscribeTo(tL_messages_checkChatInvite.hash, chatInvite, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.lambda$showSubscriptionSheet$73(i, j, (String) obj, (Long) obj2);
}
});
}
}
public static void lambda$showSubscriptionSheet$75(final ButtonWithCounterView buttonWithCounterView, final BottomSheet[] bottomSheetArr, final Theme.ResourcesProvider resourcesProvider, final int i, final TLRPC.TL_messages_checkChatInvite tL_messages_checkChatInvite, final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showSubscriptionSheet$74(ButtonWithCounterView.this, tLObject, bottomSheetArr, resourcesProvider, i, tL_messages_checkChatInvite);
}
});
}
public static void lambda$showSubscriptionSheet$76(final ButtonWithCounterView buttonWithCounterView, TL_stars.StarsSubscription starsSubscription, final int i, final BottomSheet[] bottomSheetArr, final Theme.ResourcesProvider resourcesProvider, boolean[] zArr, Context context, View view) {
if (buttonWithCounterView.isLoading()) {
return;
}
buttonWithCounterView.setLoading(true);
if (starsSubscription.chat_invite_hash != null) {
final TLRPC.TL_messages_checkChatInvite tL_messages_checkChatInvite = new TLRPC.TL_messages_checkChatInvite();
tL_messages_checkChatInvite.hash = starsSubscription.chat_invite_hash;
ConnectionsManager.getInstance(i).sendRequest(tL_messages_checkChatInvite, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
StarsIntroActivity.lambda$showSubscriptionSheet$75(ButtonWithCounterView.this, bottomSheetArr, resourcesProvider, i, tL_messages_checkChatInvite, tLObject, tL_error);
}
});
} else if (starsSubscription.invoice_slug != null) {
zArr[0] = true;
Browser.openUrl(context, Uri.parse("https://t.me/$" + starsSubscription.invoice_slug), true, false, false, new Browser.Progress() {
public void end() {
ButtonWithCounterView.this.setLoading(false);
}
}, (String) null, false, true, false);
}
}
public static void lambda$showSubscriptionSheet$77(int i, NotificationCenter.NotificationCenterDelegate notificationCenterDelegate, DialogInterface dialogInterface) {
NotificationCenter.getInstance(i).removeObserver(notificationCenterDelegate, NotificationCenter.starSubscriptionsLoaded);
}
public static void lambda$showTransactionSheet$25(Context context, int i, TL_stars.TL_starGiftUnique tL_starGiftUnique, View view) {
Browser.openUrl(context, "https://" + MessagesController.getInstance(i).linkPrefix + "/nft/" + ((TL_stars.StarGift) tL_starGiftUnique).slug);
}
public static void lambda$showTransactionSheet$26(boolean z, long j, TL_stars.StarsTransaction starsTransaction, int i, Theme.ResourcesProvider resourcesProvider, final BackupImageView backupImageView, final LinearLayout linearLayout, View view) {
final long peerDialogId = z ? j : DialogObject.getPeerDialogId(starsTransaction.peer.peer);
ArrayList arrayList = new ArrayList();
for (int i2 = 0; i2 < starsTransaction.extended_media.size(); i2++) {
TLRPC.MessageMedia messageMedia = (TLRPC.MessageMedia) starsTransaction.extended_media.get(i2);
TLRPC.TL_message tL_message = new TLRPC.TL_message();
((TLRPC.Message) tL_message).id = starsTransaction.msg_id;
((TLRPC.Message) tL_message).dialog_id = peerDialogId;
TLRPC.TL_peerChannel tL_peerChannel = new TLRPC.TL_peerChannel();
((TLRPC.Message) tL_message).from_id = tL_peerChannel;
long j2 = -peerDialogId;
((TLRPC.Peer) tL_peerChannel).channel_id = j2;
TLRPC.TL_peerChannel tL_peerChannel2 = new TLRPC.TL_peerChannel();
((TLRPC.Message) tL_message).peer_id = tL_peerChannel2;
((TLRPC.Peer) tL_peerChannel2).channel_id = j2;
((TLRPC.Message) tL_message).date = starsTransaction.date;
((TLRPC.Message) tL_message).flags |= 512;
((TLRPC.Message) tL_message).media = messageMedia;
((TLRPC.Message) tL_message).noforwards = true;
arrayList.add(new MessageObject(i, tL_message, false, false));
}
if (arrayList.isEmpty()) {
return;
}
PhotoViewer.getInstance().setParentActivity(LaunchActivity.getLastFragment(), resourcesProvider);
PhotoViewer.getInstance().openPhoto(arrayList, 0, peerDialogId, 0L, 0L, new PhotoViewer.EmptyPhotoViewerProvider() {
public boolean forceAllInGroup() {
return true;
}
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i3, boolean z2, boolean z3) {
ImageReceiver imageReceiver = backupImageView.getImageReceiver();
int[] iArr = new int[2];
backupImageView.getLocationInWindow(iArr);
PhotoViewer.PlaceProviderObject placeProviderObject = new PhotoViewer.PlaceProviderObject();
placeProviderObject.viewX = iArr[0];
placeProviderObject.viewY = iArr[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
placeProviderObject.parentView = linearLayout;
placeProviderObject.animatingImageView = null;
placeProviderObject.imageReceiver = imageReceiver;
if (z2) {
placeProviderObject.thumb = imageReceiver.getBitmapSafe();
}
placeProviderObject.radius = imageReceiver.getRoundRadius(true);
placeProviderObject.dialogId = peerDialogId;
placeProviderObject.clipTopAddition = 0;
placeProviderObject.clipBottomAddition = 0;
return placeProviderObject;
}
});
}
public static void lambda$showTransactionSheet$27(long j, int i) {
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
if (j >= 0) {
safeLastFragment.presentFragment(new PrivacyControlActivity(10));
return;
}
long j2 = -j;
if (ChatObject.isChannelAndNotMegaGroup(MessagesController.getInstance(i).getChat(Long.valueOf(j2)))) {
safeLastFragment.presentFragment(new PostSuggestionsEditActivity(j2));
return;
}
Bundle bundle = new Bundle();
bundle.putLong("chat_id", j2);
bundle.putInt("type", 3);
ChatUsersActivity chatUsersActivity = new ChatUsersActivity(bundle);
chatUsersActivity.setInfo(MessagesController.getInstance(i).getChatFull(j2));
safeLastFragment.presentFragment(chatUsersActivity);
}
}
public static void lambda$showTransactionSheet$28(Context context, BottomSheet[] bottomSheetArr) {
BottomSheet bottomSheet;
BaseFragment baseFragment;
StarAppsSheet starAppsSheet = new StarAppsSheet(context);
if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(bottomSheetArr[0].attachedFragment) && (bottomSheet = bottomSheetArr[0]) != null && (baseFragment = bottomSheet.attachedFragment) != null) {
starAppsSheet.makeAttached(baseFragment);
}
starAppsSheet.show();
}
public static void lambda$showTransactionSheet$29(int i, Context context, Theme.ResourcesProvider resourcesProvider, TL_stars.SavedStarGift savedStarGift) {
new StarGiftSheet(context, i, UserConfig.getInstance(i).getClientUserId(), resourcesProvider).set(savedStarGift, null).show();
}
public static void lambda$showTransactionSheet$30(ButtonSpan.TextViewButtons textViewButtons, final int i, final Context context, final Theme.ResourcesProvider resourcesProvider, final TL_stars.SavedStarGift savedStarGift) {
if (savedStarGift != null) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(textViewButtons.getText());
spannableStringBuilder.append((CharSequence) " ").append(ButtonSpan.make(LocaleController.getString(R.string.StarGiftReasonUpgradeView), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showTransactionSheet$29(i, context, resourcesProvider, savedStarGift);
}
}, resourcesProvider));
textViewButtons.setText(spannableStringBuilder);
}
}
public static void lambda$showTransactionSheet$31(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$32(Context context, int i, String str) {
Browser.openUrl(context, "https://" + MessagesController.getInstance(i).linkPrefix + "/nft/" + str);
}
public static void lambda$showTransactionSheet$33(BottomSheet[] bottomSheetArr, long j, long j2) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("user_id", j);
if (j == j2) {
bundle.putBoolean("my_profile", true);
}
bundle.putBoolean("open_gifts", true);
safeLastFragment.presentFragment(new ProfileActivity(bundle));
}
}
public static void lambda$showTransactionSheet$34(BottomSheet[] bottomSheetArr, long j, long j2) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("user_id", j);
if (j == j2) {
bundle.putBoolean("my_profile", true);
}
bundle.putBoolean("open_gifts", true);
safeLastFragment.presentFragment(new ProfileActivity(bundle));
}
}
public static void lambda$showTransactionSheet$35(BottomSheet[] bottomSheetArr, TL_stars.StarsTransaction starsTransaction, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment((starsTransaction.flags & 8192) != 0 ? ChatActivity.of(j, starsTransaction.giveaway_post_id) : ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$36(Context context, int i, long j, BottomSheet[] bottomSheetArr) {
BottomSheet bottomSheet = bottomSheetArr[0];
Objects.requireNonNull(bottomSheet);
new GiftSheet(context, i, j, new BottomSheet$.ExternalSyntheticLambda11(bottomSheet)).show();
}
public static void lambda$showTransactionSheet$37(BottomSheet[] bottomSheetArr, int i) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("user_id", UserConfig.getInstance(i).getClientUserId());
bundle.putBoolean("my_profile", true);
bundle.putBoolean("open_gifts", true);
safeLastFragment.presentFragment(new ProfileActivity(bundle));
}
}
public static void lambda$showTransactionSheet$38(BottomSheet[] bottomSheetArr, int i) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("user_id", UserConfig.getInstance(i).getClientUserId());
bundle.putBoolean("my_profile", true);
bundle.putBoolean("open_gifts", true);
safeLastFragment.presentFragment(new ProfileActivity(bundle));
}
}
public static void lambda$showTransactionSheet$39(BottomSheet[] bottomSheetArr, TL_stars.StarsTransaction starsTransaction, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment((starsTransaction.flags & 8192) != 0 ? ChatActivity.of(j, starsTransaction.giveaway_post_id) : ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$40(Context context, int i, long j, BottomSheet[] bottomSheetArr) {
BottomSheet bottomSheet = bottomSheetArr[0];
Objects.requireNonNull(bottomSheet);
new GiftSheet(context, i, j, new BottomSheet$.ExternalSyntheticLambda11(bottomSheet)).show();
}
public static void lambda$showTransactionSheet$41(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$42(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(new AffiliateProgramFragment(j));
}
}
public static void lambda$showTransactionSheet$43(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ProfileActivity.of(j));
}
}
public static void lambda$showTransactionSheet$44(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ProfileActivity.of(j));
}
}
public static void lambda$showTransactionSheet$45(BottomSheet[] bottomSheetArr, Context context, int i, long j, Theme.ResourcesProvider resourcesProvider, TL_payments.connectedBotStarRef connectedbotstarref) {
bottomSheetArr[0].dismiss();
ChannelAffiliateProgramsFragment.showShareAffiliateAlert(context, i, connectedbotstarref, j, resourcesProvider);
}
public static void lambda$showTransactionSheet$46(final int i, final Context context, final long j, long j2, final BottomSheet[] bottomSheetArr, final Theme.ResourcesProvider resourcesProvider) {
BotStarsController.getInstance(i).getConnectedBot(context, j, j2, new Utilities.Callback() {
public final void run(Object obj) {
StarsIntroActivity.lambda$showTransactionSheet$45(bottomSheetArr, context, i, j, resourcesProvider, (TL_payments.connectedBotStarRef) obj);
}
});
}
public static void lambda$showTransactionSheet$47(BottomSheet[] bottomSheetArr, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ProfileActivity.of(j));
}
}
public static void lambda$showTransactionSheet$48(BottomSheet[] bottomSheetArr, TL_stars.StarsTransaction starsTransaction, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment((starsTransaction.flags & 8192) != 0 ? ChatActivity.of(j, starsTransaction.giveaway_post_id) : ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$49(BottomSheet[] bottomSheetArr, int i) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("user_id", UserConfig.getInstance(i).getClientUserId());
bundle.putBoolean("my_profile", true);
safeLastFragment.presentFragment(new ProfileActivity(bundle));
}
}
public static void lambda$showTransactionSheet$50(BottomSheet[] bottomSheetArr, TL_stars.StarsTransaction starsTransaction, long j) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment((starsTransaction.flags & 8192) != 0 ? ChatActivity.of(j, starsTransaction.giveaway_post_id) : ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$51(BottomSheet[] bottomSheetArr, long j, Context context) {
bottomSheetArr[0].dismiss();
if (UserObject.isService(j)) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTransactionUnknownLink));
return;
}
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$52(BottomSheet[] bottomSheetArr, long j, Context context) {
bottomSheetArr[0].dismiss();
if (UserObject.isService(j)) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTransactionUnknownLink));
return;
}
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$53(BottomSheet[] bottomSheetArr, long j, Context context) {
bottomSheetArr[0].dismiss();
if (UserObject.isService(j)) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTransactionUnknownLink));
return;
}
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
safeLastFragment.presentFragment(ChatActivity.of(j));
}
}
public static void lambda$showTransactionSheet$54(BottomSheet[] bottomSheetArr, long j, TL_stars.StarsTransaction starsTransaction) {
bottomSheetArr[0].dismiss();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (safeLastFragment != null) {
Bundle bundle = new Bundle();
bundle.putLong("chat_id", -j);
bundle.putInt("message_id", starsTransaction.msg_id);
safeLastFragment.presentFragment(new ChatActivity(bundle));
}
}
public static void lambda$showTransactionSheet$56(BottomSheet[] bottomSheetArr, Theme.ResourcesProvider resourcesProvider) {
BulletinFactory.of(bottomSheetArr[0].topBulletinContainer, resourcesProvider).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.StarsTransactionIDCopied)).show(false);
}
public static void lambda$showTransactionSheet$57(Context context) {
Browser.openUrl(context, LocaleController.getString(R.string.StarsTOSLink));
}
public static void lambda$showTransactionSheet$58(Context context, TL_stars.StarsTransaction starsTransaction, View view) {
Browser.openUrl(context, starsTransaction.transaction_url);
}
public static void lambda$showTransactionSheet$59(BottomSheet[] bottomSheetArr, View view) {
bottomSheetArr[0].dismiss();
}
public void lambda$updateButtonsLayouts$6(boolean z) {
if (z) {
this.oneButtonsLayout.setVisibility(8);
}
}
public void lambda$updateButtonsLayouts$7(boolean z) {
if (z) {
return;
}
this.twoButtonsLayout.setVisibility(8);
}
public static StarParticlesView makeParticlesView(Context context, int i, int i2) {
return new AnonymousClass4(context, i, i2);
}
public static org.telegram.ui.ActionBar.BottomSheet openConfirmPurchaseSheet(final android.content.Context r32, org.telegram.ui.ActionBar.Theme.ResourcesProvider r33, int r34, org.telegram.messenger.MessageObject r35, long r36, java.lang.String r38, long r39, org.telegram.tgnet.TLRPC.WebDocument r41, int r42, final org.telegram.messenger.Utilities.Callback r43, final java.lang.Runnable r44) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.openConfirmPurchaseSheet(android.content.Context, org.telegram.ui.ActionBar.Theme$ResourcesProvider, int, org.telegram.messenger.MessageObject, long, java.lang.String, long, org.telegram.tgnet.TLRPC$WebDocument, int, org.telegram.messenger.Utilities$Callback, java.lang.Runnable):org.telegram.ui.ActionBar.BottomSheet");
}
public static BottomSheet openStarsChannelInviteSheet(final Context context, Theme.ResourcesProvider resourcesProvider, int i, TLRPC.ChatInvite chatInvite, final Utilities.Callback callback, final Runnable runnable) {
BottomSheet.Builder builder = new BottomSheet.Builder(context, false, resourcesProvider);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setPadding(AndroidUtilities.dp(16.0f), 0, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(8.0f));
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.addView(makeParticlesView(context, 40, 0), LayoutHelper.createFrame(-1, -1.0f));
View backupImageView = new BackupImageView(context);
backupImageView.setRoundRadius(AndroidUtilities.dp(80.0f));
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setPeerColor(chatInvite.color);
avatarDrawable.setText(chatInvite.title);
TLRPC.Photo photo = chatInvite.photo;
if (photo != null) {
backupImageView.setImage(ImageLocation.getForPhoto(FileLoader.getClosestPhotoSizeWithSize(photo.sizes, AndroidUtilities.dp(80.0f)), chatInvite.photo), "80_80", avatarDrawable, chatInvite);
} else {
backupImageView.setImageDrawable(avatarDrawable);
}
frameLayout.addView(backupImageView, LayoutHelper.createFrame(80, 80, 17));
Drawable drawable = context.getResources().getDrawable(R.drawable.star_small_outline);
int i2 = Theme.key_dialogBackground;
drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(i2, resourcesProvider), PorterDuff.Mode.SRC_IN));
Drawable drawable2 = context.getResources().getDrawable(R.drawable.star_small_inner);
ImageView imageView = new ImageView(context);
imageView.setImageDrawable(drawable);
frameLayout.addView(imageView, LayoutHelper.createFrame(26, 26, 17));
imageView.setTranslationX(AndroidUtilities.dp(26.0f));
imageView.setTranslationY(AndroidUtilities.dp(26.0f));
imageView.setScaleX(1.2f);
imageView.setScaleY(1.2f);
ImageView imageView2 = new ImageView(context);
imageView2.setImageDrawable(drawable2);
frameLayout.addView(imageView2, LayoutHelper.createFrame(26, 26, 17));
imageView2.setTranslationX(AndroidUtilities.dp(26.0f));
imageView2.setTranslationY(AndroidUtilities.dp(26.0f));
final StarsBalanceView starsBalanceView = new StarsBalanceView(context, i);
ScaleStateListAnimator.apply(starsBalanceView);
starsBalanceView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$15(StarsIntroActivity.StarsBalanceView.this, view);
}
});
frameLayout.addView(starsBalanceView, LayoutHelper.createFrame(-2, -2.0f, 53, 0.0f, 0.0f, -8.0f, 0.0f));
linearLayout.addView(frameLayout, LayoutHelper.createLinear(-1, 117, 7));
TextView textView = new TextView(context);
textView.setTextSize(1, 20.0f);
textView.setTypeface(AndroidUtilities.bold());
int i3 = Theme.key_dialogTextBlack;
textView.setTextColor(Theme.getColor(i3, resourcesProvider));
textView.setText(LocaleController.getString(R.string.StarsSubscribeTitle));
textView.setGravity(17);
linearLayout.addView(textView, LayoutHelper.createLinear(-2, -2, 1, 0, 8, 0, 0));
TextView textView2 = new TextView(context);
textView2.setTextSize(1, 14.0f);
textView2.setTextColor(Theme.getColor(i3, resourcesProvider));
TL_stars.TL_starsSubscriptionPricing tL_starsSubscriptionPricing = chatInvite.subscription_pricing;
int i4 = tL_starsSubscriptionPricing.period;
if (i4 == 2592000) {
textView2.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsSubscribeText", (int) tL_starsSubscriptionPricing.amount, new Object[]{chatInvite.title})));
} else {
textView2.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("StarsSubscribeTextTest", (int) tL_starsSubscriptionPricing.amount, new Object[]{chatInvite.title, i4 == 300 ? "5 minutes" : "a minute"})));
}
textView2.setMaxWidth(HintView2.cutInFancyHalf(textView2.getText(), textView2.getPaint()));
textView2.setGravity(17);
linearLayout.addView(textView2, LayoutHelper.createLinear(-2, -2, 1, 0, 6, 0, 22));
if (!TextUtils.isEmpty(chatInvite.about)) {
TextView textView3 = new TextView(context);
textView3.setTextSize(1, 14.0f);
textView3.setTextColor(Theme.getColor(i3, resourcesProvider));
textView3.setText(Emoji.replaceEmoji(chatInvite.about, textView3.getPaint().getFontMetricsInt(), false));
textView3.setGravity(17);
linearLayout.addView(textView3, LayoutHelper.createLinear(-2, -2, 1, 0, 6, 0, 22));
}
final ButtonWithCounterView buttonWithCounterView = new ButtonWithCounterView(context, resourcesProvider);
buttonWithCounterView.setText(LocaleController.getString(R.string.StarsSubscribeButton), false);
linearLayout.addView(buttonWithCounterView, LayoutHelper.createLinear(-1, 48));
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
linksTextView.setText(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.StarsSubscribeInfo), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$16(context);
}
}));
linksTextView.setGravity(17);
linksTextView.setTextSize(1, 13.0f);
linksTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4, resourcesProvider));
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linearLayout.addView((View) linksTextView, LayoutHelper.createLinear(-1, -2, 49, 14, 14, 14, 6));
builder.setCustomView(linearLayout);
final BottomSheet create = builder.create();
buttonWithCounterView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$19(callback, create, buttonWithCounterView, view);
}
});
create.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
StarsIntroActivity.lambda$openStarsChannelInviteSheet$20(runnable, dialogInterface);
}
});
create.fixNavigationBar(Theme.getColor(i2, resourcesProvider));
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (!AndroidUtilities.isTablet() && safeLastFragment != null && !AndroidUtilities.hasDialogOnTop(safeLastFragment)) {
create.makeAttached(safeLastFragment);
}
create.show();
return create;
}
public static SpannableStringBuilder replaceStars(CharSequence charSequence) {
return replaceStars(charSequence, 1.13f);
}
public static SpannableStringBuilder replaceStars(CharSequence charSequence, float f) {
return replaceStars(charSequence, f, (ColoredImageSpan[]) null);
}
public static SpannableStringBuilder replaceStars(CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr) {
return replaceStars(charSequence, f, coloredImageSpanArr, 0.0f, 0.0f, 1.0f);
}
public static SpannableStringBuilder replaceStars(CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr, float f2, float f3, float f4) {
return replaceStars(false, charSequence, f, coloredImageSpanArr, f2, f3, f4);
}
public static SpannableStringBuilder replaceStars(CharSequence charSequence, ColoredImageSpan[] coloredImageSpanArr) {
return replaceStars(false, charSequence, coloredImageSpanArr);
}
public static SpannableStringBuilder replaceStars(TL_stars.StarsAmount starsAmount, CharSequence charSequence, float f) {
return replaceStars(starsAmount instanceof TL_stars.TL_starsTonAmount, charSequence, f, null);
}
public static SpannableStringBuilder replaceStars(boolean z, CharSequence charSequence) {
return replaceStars(z, charSequence, 1.13f);
}
public static SpannableStringBuilder replaceStars(boolean z, CharSequence charSequence, float f) {
return replaceStars(z, charSequence, f, null);
}
public static SpannableStringBuilder replaceStars(boolean z, CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr) {
return replaceStars(z, charSequence, f, coloredImageSpanArr, 0.0f, 0.0f, 1.0f);
}
public static SpannableStringBuilder replaceStars(boolean z, CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr, float f2, float f3, float f4) {
ColoredImageSpan coloredImageSpan;
if (charSequence == null) {
return null;
}
SpannableStringBuilder spannableStringBuilder = !(charSequence instanceof SpannableStringBuilder) ? new SpannableStringBuilder(charSequence) : (SpannableStringBuilder) charSequence;
SpannableString spannableString = new SpannableString((z ? "TON" : "⭐") + " ");
if (coloredImageSpanArr == null || (coloredImageSpan = coloredImageSpanArr[0]) == null) {
coloredImageSpan = new ColoredImageSpan(z ? R.drawable.ton : R.drawable.msg_premium_liststar);
if (coloredImageSpanArr != null) {
coloredImageSpanArr[0] = coloredImageSpan;
}
}
coloredImageSpan.translate(f2, f3);
coloredImageSpan.spaceScaleX = f4;
if (z) {
f *= 0.2f;
}
coloredImageSpan.setScale(f, f);
spannableString.setSpan(coloredImageSpan, 0, spannableString.length() - 1, 33);
AndroidUtilities.replaceMultipleCharSequence("⭐️", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐ ", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐", spannableStringBuilder, spannableString);
AndroidUtilities.replaceMultipleCharSequence("XTR ", spannableStringBuilder, "XTR");
AndroidUtilities.replaceMultipleCharSequence("XTR", spannableStringBuilder, spannableString);
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceStars(boolean z, CharSequence charSequence, ColoredImageSpan[] coloredImageSpanArr) {
ColoredImageSpan coloredImageSpan;
if (charSequence == null) {
return null;
}
SpannableStringBuilder spannableStringBuilder = !(charSequence instanceof SpannableStringBuilder) ? new SpannableStringBuilder(charSequence) : (SpannableStringBuilder) charSequence;
if (coloredImageSpanArr == null || (coloredImageSpan = coloredImageSpanArr[0]) == null) {
coloredImageSpan = new ColoredImageSpan(z ? R.drawable.ton : R.drawable.msg_premium_liststar);
coloredImageSpan.setScale(z ? 0.222f : 1.13f, z ? 0.222f : 1.13f);
}
if (coloredImageSpanArr != null) {
coloredImageSpanArr[0] = coloredImageSpan;
}
SpannableString spannableString = new SpannableString("⭐ ");
spannableString.setSpan(coloredImageSpan, 0, spannableString.length() - 1, 33);
AndroidUtilities.replaceMultipleCharSequence("⭐️", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐ ", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐", spannableStringBuilder, spannableString);
AndroidUtilities.replaceMultipleCharSequence("XTR ", spannableStringBuilder, "XTR");
AndroidUtilities.replaceMultipleCharSequence("XTR", spannableStringBuilder, spannableString);
return spannableStringBuilder;
}
public static SpannableStringBuilder replaceStarsWithPlain(CharSequence charSequence, float f) {
return replaceStarsWithPlain(charSequence, f, (ColoredImageSpan[]) null);
}
public static SpannableStringBuilder replaceStarsWithPlain(CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr) {
return replaceStarsWithPlain(false, charSequence, f, coloredImageSpanArr);
}
public static SpannableStringBuilder replaceStarsWithPlain(TL_stars.StarsAmount starsAmount, CharSequence charSequence, float f) {
return replaceStarsWithPlain(starsAmount instanceof TL_stars.TL_starsTonAmount, charSequence, f, null);
}
public static SpannableStringBuilder replaceStarsWithPlain(boolean z, CharSequence charSequence, float f, ColoredImageSpan[] coloredImageSpanArr) {
ColoredImageSpan coloredImageSpan;
if (charSequence == null) {
return null;
}
SpannableStringBuilder spannableStringBuilder = !(charSequence instanceof SpannableStringBuilder) ? new SpannableStringBuilder(charSequence) : (SpannableStringBuilder) charSequence;
String str = z ? "TON" : "⭐";
int i = z ? R.drawable.ton : R.drawable.star_small_inner;
SpannableString spannableString = new SpannableString(str + " ");
if (coloredImageSpanArr == null || (coloredImageSpan = coloredImageSpanArr[0]) == null) {
if (coloredImageSpanArr == null || coloredImageSpanArr.length <= 0) {
coloredImageSpan = new ColoredImageSpan(i);
} else {
coloredImageSpan = new ColoredImageSpan(i);
coloredImageSpanArr[0] = coloredImageSpan;
}
}
if (z) {
f *= 0.33f;
} else {
coloredImageSpan.recolorDrawable = false;
}
coloredImageSpan.setScale(f, f);
spannableString.setSpan(coloredImageSpan, 0, spannableString.length() - 1, 33);
AndroidUtilities.replaceMultipleCharSequence("⭐️", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐ ", spannableStringBuilder, "⭐");
AndroidUtilities.replaceMultipleCharSequence("⭐", spannableStringBuilder, spannableString);
AndroidUtilities.replaceMultipleCharSequence("XTR ", spannableStringBuilder, "XTR");
AndroidUtilities.replaceMultipleCharSequence("XTR", spannableStringBuilder, spannableString);
return spannableStringBuilder;
}
public static Runnable setGiftImage(View view, ImageReceiver imageReceiver, long j) {
return setGiftImage(view, imageReceiver, getGiftStarsEmoji(j));
}
public static Runnable setGiftImage(View view, ImageReceiver imageReceiver, String str) {
return setGiftImage(view, imageReceiver, str, false);
}
public static Runnable setGiftImage(View view, final ImageReceiver imageReceiver, final String str, final boolean z) {
final boolean[] zArr = new boolean[1];
final int currentAccount = imageReceiver.getCurrentAccount();
final Runnable runnable = new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$setGiftImage$21(z, currentAccount, str, imageReceiver, zArr);
}
};
runnable.run();
final Runnable listen = NotificationCenter.getInstance(currentAccount).listen(view, z ? NotificationCenter.didUpdateTonGiftStickers : NotificationCenter.didUpdatePremiumGiftStickers, new Utilities.Callback() {
public final void run(Object obj) {
runnable.run();
}
});
final Runnable listen2 = NotificationCenter.getInstance(currentAccount).listen(view, NotificationCenter.diceStickersDidLoad, new Utilities.Callback() {
public final void run(Object obj) {
runnable.run();
}
});
return new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$setGiftImage$24(listen, listen2);
}
};
}
public static void setGiftImage(ImageReceiver imageReceiver, TLRPC.Document document, int i) {
if (document == null) {
imageReceiver.clearImage();
return;
}
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, i);
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundGray, 0.35f);
imageReceiver.setImage(ImageLocation.getForDocument(document), i + "_" + i, ImageLocation.getForDocument(closestPhotoSizeWithSize, document), i + "_" + i, svgThumb, 0L, (String) null, (Object) null, 0);
}
public static void setGiftImage(ImageReceiver imageReceiver, TL_stars.StarGift starGift, int i) {
setGiftImage(imageReceiver, starGift == null ? null : starGift.getDocument(), i);
}
public static Runnable setPremiumGiftImage(View view, ImageReceiver imageReceiver, int i) {
return setGiftImage(view, imageReceiver, getPremiumGiftMonthsEmoji(i));
}
public static Runnable setTonGiftImage(View view, ImageReceiver imageReceiver, long j) {
return setGiftImage(view, imageReceiver, getTonGiftEmoji(j), true);
}
public static BottomSheet showBoostsSheet(final Context context, int i, final long j, final TL_stories.Boost boost, Theme.ResourcesProvider resourcesProvider) {
if (boost == null || context == null) {
return null;
}
BottomSheet.Builder builder = new BottomSheet.Builder(context, false, resourcesProvider);
final BottomSheet[] bottomSheetArr = new BottomSheet[1];
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setPadding(0, AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(4.0f));
linearLayout.setClipChildren(false);
linearLayout.setClipToPadding(false);
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setClipChildren(false);
frameLayout.setClipToPadding(false);
linearLayout.addView(frameLayout, LayoutHelper.createLinear(-1, 150, 7, 0, 0, 0, 10));
StarParticlesView makeParticlesView = makeParticlesView(context, 70, 0);
frameLayout.addView((View) makeParticlesView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
final GLIconTextureView gLIconTextureView = new GLIconTextureView(context, 1, 2);
GLIconRenderer gLIconRenderer = gLIconTextureView.mRenderer;
gLIconRenderer.colorKey1 = Theme.key_starsGradient1;
gLIconRenderer.colorKey2 = Theme.key_starsGradient2;
gLIconRenderer.updateColors();
gLIconTextureView.setStarParticlesView(makeParticlesView);
frameLayout.addView((View) gLIconTextureView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(170, 170.0f, 17, 0.0f, 32.0f, 0.0f, 24.0f));
gLIconTextureView.setPaused(false);
TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider));
textView.setTextSize(1, 20.0f);
textView.setTypeface(AndroidUtilities.bold());
textView.setGravity(17);
textView.setText(LocaleController.formatPluralStringSpaced("BoostStars", (int) boost.stars));
linearLayout.addView(textView, LayoutHelper.createLinear(-1, -2, 17, 20, 0, 20, 4));
TextView textView2 = new TextView(context);
textView2.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(20.0f), -6915073));
textView2.setTextColor(-1);
textView2.setTextSize(1, 11.33f);
textView2.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(8.33f), 0);
textView2.setGravity(17);
textView2.setTypeface(AndroidUtilities.bold());
StringBuilder sb = new StringBuilder();
sb.append("x");
int i2 = boost.multiplier;
if (i2 == 0) {
i2 = 1;
}
sb.append(LocaleController.formatPluralStringSpaced("BoostingBoostsCount", i2));
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(sb.toString());
ColoredImageSpan coloredImageSpan = new ColoredImageSpan(R.drawable.mini_boost_badge, 2);
coloredImageSpan.translate(0.0f, AndroidUtilities.dp(0.66f));
spannableStringBuilder.setSpan(coloredImageSpan, 0, 1, 33);
textView2.setText(spannableStringBuilder);
linearLayout.addView(textView2, LayoutHelper.createLinear(-2, 20, 17, 20, 4, 20, 4));
View tableView = new TableView(context, resourcesProvider);
tableView.addRowUser(LocaleController.getString(R.string.BoostFrom), i, j, new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showBoostsSheet$78(bottomSheetArr, j);
}
});
tableView.addRow(LocaleController.getString(R.string.BoostGift), LocaleController.formatPluralString("BoostStars", (int) boost.stars, new Object[0]));
if (boost.giveaway_msg_id != 0) {
tableView.addRowLink(LocaleController.getString(R.string.BoostReason), LocaleController.getString(R.string.BoostReasonGiveaway), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showBoostsSheet$79(bottomSheetArr, j, boost);
}
});
}
String string = LocaleController.getString(R.string.BoostDate);
int i3 = R.string.formatDateAtTime;
tableView.addRow(string, LocaleController.formatString(i3, new Object[]{LocaleController.getInstance().getFormatterGiveawayCard().format(new Date(boost.date * 1000)), LocaleController.getInstance().getFormatterDay().format(new Date(boost.date * 1000))}));
tableView.addRow(LocaleController.getString(R.string.BoostUntil), LocaleController.formatString(i3, new Object[]{LocaleController.getInstance().getFormatterGiveawayCard().format(new Date(boost.expires * 1000)), LocaleController.getInstance().getFormatterDay().format(new Date(boost.expires * 1000))}));
linearLayout.addView(tableView, LayoutHelper.createLinear(-1, -2, 16.0f, 17.0f, 16.0f, 0.0f));
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider);
linksTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linksTextView.setTextSize(1, 14.0f);
linksTextView.setText(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.StarsTransactionTOS), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showBoostsSheet$80(context);
}
}));
linksTextView.setGravity(17);
linearLayout.addView((View) linksTextView, LayoutHelper.createLinear(-1, -2, 14.0f, 15.0f, 14.0f, 7.0f));
ButtonWithCounterView buttonWithCounterView = new ButtonWithCounterView(context, resourcesProvider);
buttonWithCounterView.setText(LocaleController.getString(R.string.OK), false);
buttonWithCounterView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$showBoostsSheet$81(bottomSheetArr, view);
}
});
linearLayout.addView(buttonWithCounterView, LayoutHelper.createLinear(-1, 48, 16.0f, 8.0f, 16.0f, 0.0f));
builder.setCustomView(linearLayout);
BottomSheet create = builder.create();
bottomSheetArr[0] = create;
create.useBackgroundTopPadding = false;
create.fixNavigationBar();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(safeLastFragment)) {
bottomSheetArr[0].makeAttached(safeLastFragment);
}
gLIconTextureView.setPaused(false);
bottomSheetArr[0].show();
bottomSheetArr[0].setOnDismissListener(new Runnable() {
@Override
public final void run() {
gLIconTextureView.setPaused(true);
}
});
return bottomSheetArr[0];
}
public static BottomSheet showGiftResellPriceSheet(Context context, int i, long j, final Utilities.Callback2 callback2, final Theme.ResourcesProvider resourcesProvider) {
final long j2 = MessagesController.getInstance(i).starsStargiftResaleAmountMin;
final long j3 = MessagesController.getInstance(i).starsStargiftResaleAmountMax;
final int i2 = MessagesController.getInstance(i).starsStargiftResaleCommisionPermille;
BottomSheet.Builder builder = new BottomSheet.Builder(context, false, resourcesProvider);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setClipChildren(false);
linearLayout.setClipToPadding(false);
linearLayout.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(8.0f));
TextView textView = new TextView(context);
textView.setTypeface(AndroidUtilities.bold());
textView.setText(LocaleController.getString(R.string.ResellGiftTitle));
textView.setTextSize(1, 20.0f);
int i3 = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i3, resourcesProvider));
linearLayout.addView(textView, LayoutHelper.createLinear(-1, -2, 4.0f, 0.0f, 4.0f, 14.0f));
final EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
final OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context, resourcesProvider);
outlineTextContainerView.setForceForceUseCenter(true);
outlineTextContainerView.setText(LocaleController.getString(R.string.ResellGiftPriceTitle));
outlineTextContainerView.setLeftPadding(AndroidUtilities.dp(36.0f));
editTextBoldCursor.setTextColor(Theme.getColor(i3, resourcesProvider));
editTextBoldCursor.setCursorSize(AndroidUtilities.dp(20.0f));
editTextBoldCursor.setCursorWidth(1.5f);
editTextBoldCursor.setBackground(null);
editTextBoldCursor.setTextSize(1, 18.0f);
editTextBoldCursor.setMaxLines(1);
int dp = AndroidUtilities.dp(16.0f);
editTextBoldCursor.setPadding(AndroidUtilities.dp(6.0f), dp, dp, dp);
editTextBoldCursor.setInputType(2);
editTextBoldCursor.setTypeface(Typeface.DEFAULT);
editTextBoldCursor.setSelectAllOnFocus(true);
editTextBoldCursor.setHighlightColor(Theme.getColor(Theme.key_chat_inTextSelectionHighlight, resourcesProvider));
editTextBoldCursor.setHandlesColor(Theme.getColor(Theme.key_chat_TextSelectionCursor, resourcesProvider));
editTextBoldCursor.setGravity(LocaleController.isRTL ? 5 : 3);
editTextBoldCursor.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z) {
StarsIntroActivity.lambda$showGiftResellPriceSheet$94(outlineTextContainerView, editTextBoldCursor, view, z);
}
});
LinearLayout linearLayout2 = new LinearLayout(context);
linearLayout2.setOrientation(0);
ImageView imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageResource(R.drawable.star_small_inner);
linearLayout2.addView(imageView, LayoutHelper.createLinear(-2, -2, 0.0f, 19, 14, 0, 0, 0));
linearLayout2.addView((View) editTextBoldCursor, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2, 1.0f, 119));
outlineTextContainerView.attachEditText(editTextBoldCursor);
outlineTextContainerView.addView(linearLayout2, LayoutHelper.createFrame(-1, -2, 48));
linearLayout.addView((View) outlineTextContainerView, LayoutHelper.createLinear(-1, -2));
FrameLayout frameLayout = new FrameLayout(context);
linearLayout.addView(frameLayout, LayoutHelper.createLinear(-1, -2, 14.0f, 3.0f, 14.0f, 21.0f));
final LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context);
float f = i2 / 1000.0f;
linksTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralStringComma("ResellGiftInfo", (int) (j2 * f))));
linksTextView.setTextSize(1, 12.0f);
int i4 = Theme.key_windowBackgroundWhiteGrayText2;
linksTextView.setTextColor(Theme.getColor(i4, resourcesProvider));
int i5 = Theme.key_chat_messageLinkIn;
linksTextView.setLinkTextColor(Theme.getColor(i5, resourcesProvider));
linksTextView.setGravity(3);
frameLayout.addView((View) linksTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1, 19));
final LinkSpanDrawable.LinksTextView linksTextView2 = new LinkSpanDrawable.LinksTextView(context);
linksTextView2.setTextSize(1, 12.0f);
linksTextView2.setTextColor(Theme.getColor(i4, resourcesProvider));
linksTextView2.setLinkTextColor(Theme.getColor(i5, resourcesProvider));
linksTextView2.setGravity(5);
frameLayout.addView((View) linksTextView2, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1, 21));
final ButtonWithCounterView buttonWithCounterView = new ButtonWithCounterView(context, resourcesProvider);
buttonWithCounterView.setText(LocaleController.getString(R.string.ResellGiftButton), false);
linearLayout.addView(buttonWithCounterView, LayoutHelper.createLinear(-1, 48));
builder.setCustomView(linearLayout);
final BottomSheet[] bottomSheetArr = {builder.create()};
editTextBoldCursor.setText(Long.toString(j));
linksTextView2.setAlpha(1.0f);
StringBuilder sb = new StringBuilder();
sb.append("≈");
BillingController billingController = BillingController.getInstance();
double d = j * f;
Double.isNaN(d);
double d2 = MessagesController.getInstance(UserConfig.selectedAccount).starsUsdWithdrawRate1000;
Double.isNaN(d2);
sb.append(billingController.formatCurrency((long) ((d / 1000.0d) * d2), "USD"));
linksTextView2.setText(sb.toString());
editTextBoldCursor.addTextChangedListener(new TextWatcher() {
private boolean ignore;
private int shakeDp = 2;
@Override
public void afterTextChanged(Editable editable) {
long j4;
LinkSpanDrawable.LinksTextView linksTextView3;
String formatPluralStringComma;
if (this.ignore) {
return;
}
try {
j4 = TextUtils.isEmpty(editable) ? 0L : Long.parseLong(editable.toString());
long j5 = j3;
if (j4 > j5) {
this.ignore = true;
editTextBoldCursor.setText(Long.toString(j5));
EditTextBoldCursor editTextBoldCursor2 = editTextBoldCursor;
editTextBoldCursor2.setSelection(editTextBoldCursor2.getText().length());
OutlineTextContainerView outlineTextContainerView2 = outlineTextContainerView;
int i6 = -this.shakeDp;
this.shakeDp = i6;
AndroidUtilities.shakeViewSpring(outlineTextContainerView2, i6);
j4 = j5;
}
} catch (Exception unused) {
this.ignore = true;
EditTextBoldCursor editTextBoldCursor3 = editTextBoldCursor;
j4 = j2;
editTextBoldCursor3.setText(Long.toString(j4));
EditTextBoldCursor editTextBoldCursor4 = editTextBoldCursor;
editTextBoldCursor4.setSelection(editTextBoldCursor4.getText().length());
}
boolean z = false;
this.ignore = false;
ButtonWithCounterView buttonWithCounterView2 = buttonWithCounterView;
if (j4 >= j2 && j4 <= j3) {
z = true;
}
buttonWithCounterView2.setEnabled(z);
long j6 = j2;
LinkSpanDrawable.LinksTextView linksTextView4 = linksTextView;
if (j4 < j6) {
linksTextView4.setTextColor(Theme.getColor(Theme.key_text_RedRegular, resourcesProvider));
linksTextView3 = linksTextView;
formatPluralStringComma = LocaleController.formatPluralStringComma("ResellGiftInfoMin", (int) j2);
} else {
linksTextView4.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
linksTextView3 = linksTextView;
formatPluralStringComma = LocaleController.formatPluralStringComma("ResellGiftInfo", (int) (j4 * (i2 / 1000.0f)));
}
linksTextView3.setText(AndroidUtilities.replaceTags(formatPluralStringComma));
outlineTextContainerView.animateSelection(editTextBoldCursor.isFocused(), true ^ TextUtils.isEmpty(editTextBoldCursor.getText()));
if (j4 < j2) {
linksTextView2.animate().alpha(0.0f).start();
linksTextView2.setText("");
return;
}
linksTextView2.animate().alpha(1.0f).start();
LinkSpanDrawable.LinksTextView linksTextView5 = linksTextView2;
StringBuilder sb2 = new StringBuilder();
sb2.append("≈");
BillingController billingController2 = BillingController.getInstance();
double d3 = j4 * (i2 / 1000.0f);
Double.isNaN(d3);
double d4 = MessagesController.getInstance(UserConfig.selectedAccount).starsUsdWithdrawRate1000;
Double.isNaN(d4);
sb2.append(billingController2.formatCurrency((long) ((d3 / 1000.0d) * d4), "USD"));
linksTextView5.setText(sb2.toString());
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i6, int i7, int i8) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i6, int i7, int i8) {
}
});
final boolean[] zArr = {false};
editTextBoldCursor.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView2, int i6, KeyEvent keyEvent) {
boolean lambda$showGiftResellPriceSheet$96;
lambda$showGiftResellPriceSheet$96 = StarsIntroActivity.lambda$showGiftResellPriceSheet$96(zArr, callback2, buttonWithCounterView, editTextBoldCursor, outlineTextContainerView, j2, bottomSheetArr, textView2, i6, keyEvent);
return lambda$showGiftResellPriceSheet$96;
}
});
buttonWithCounterView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$showGiftResellPriceSheet$98(zArr, callback2, buttonWithCounterView, editTextBoldCursor, outlineTextContainerView, j2, bottomSheetArr, view);
}
});
bottomSheetArr[0].fixNavigationBar();
bottomSheetArr[0].show();
ChatActivity lastFragment = LaunchActivity.getLastFragment();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showGiftResellPriceSheet$100(bottomSheetArr, editTextBoldCursor);
}
}, lastFragment instanceof ChatActivity ? lastFragment.needEnterText() : false ? 200L : 80L);
return bottomSheetArr[0];
}
public static BottomSheet showGiftResellPriceSheet(Context context, int i, Utilities.Callback2 callback2, Theme.ResourcesProvider resourcesProvider) {
return showGiftResellPriceSheet(context, i, MessagesController.getInstance(i).starsStargiftResaleAmountMin, callback2, resourcesProvider);
}
public static BottomSheet showMediaPriceSheet(final Context context, final long j, final boolean z, final Utilities.Callback2 callback2, Theme.ResourcesProvider resourcesProvider) {
BottomSheet.Builder builder = new BottomSheet.Builder(context, false, resourcesProvider);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setClipChildren(false);
linearLayout.setClipToPadding(false);
linearLayout.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(8.0f));
TextView textView = new TextView(context);
textView.setTypeface(AndroidUtilities.bold());
textView.setText(LocaleController.getString(R.string.PaidContentTitle));
textView.setTextSize(1, 20.0f);
int i = Theme.key_windowBackgroundWhiteBlackText;
textView.setTextColor(Theme.getColor(i, resourcesProvider));
linearLayout.addView(textView, LayoutHelper.createLinear(-1, -2, 4.0f, 0.0f, 4.0f, 18.0f));
final EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
final OutlineTextContainerView outlineTextContainerView = new OutlineTextContainerView(context, resourcesProvider);
outlineTextContainerView.setForceForceUseCenter(true);
outlineTextContainerView.setText(LocaleController.getString(R.string.PaidContentPriceTitle));
outlineTextContainerView.setLeftPadding(AndroidUtilities.dp(36.0f));
editTextBoldCursor.setTextColor(Theme.getColor(i, resourcesProvider));
editTextBoldCursor.setCursorSize(AndroidUtilities.dp(20.0f));
editTextBoldCursor.setCursorWidth(1.5f);
ButtonWithCounterView buttonWithCounterView = null;
editTextBoldCursor.setBackground(null);
editTextBoldCursor.setTextSize(1, 18.0f);
editTextBoldCursor.setMaxLines(1);
int dp = AndroidUtilities.dp(16.0f);
editTextBoldCursor.setPadding(AndroidUtilities.dp(6.0f), dp, dp, dp);
editTextBoldCursor.setInputType(2);
editTextBoldCursor.setTypeface(Typeface.DEFAULT);
editTextBoldCursor.setSelectAllOnFocus(true);
editTextBoldCursor.setHighlightColor(Theme.getColor(Theme.key_chat_inTextSelectionHighlight, resourcesProvider));
editTextBoldCursor.setHandlesColor(Theme.getColor(Theme.key_chat_TextSelectionCursor, resourcesProvider));
editTextBoldCursor.setGravity(LocaleController.isRTL ? 5 : 3);
editTextBoldCursor.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public final void onFocusChange(View view, boolean z2) {
StarsIntroActivity.lambda$showMediaPriceSheet$83(outlineTextContainerView, editTextBoldCursor, view, z2);
}
});
LinearLayout linearLayout2 = new LinearLayout(context);
linearLayout2.setOrientation(0);
ImageView imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageResource(R.drawable.star_small_inner);
linearLayout2.addView(imageView, LayoutHelper.createLinear(-2, -2, 0.0f, 19, 14, 0, 0, 0));
linearLayout2.addView((View) editTextBoldCursor, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2, 1.0f, 119));
outlineTextContainerView.attachEditText(editTextBoldCursor);
outlineTextContainerView.addView(linearLayout2, LayoutHelper.createFrame(-1, -2, 48));
linearLayout.addView((View) outlineTextContainerView, LayoutHelper.createLinear(-1, -2));
final TextView textView2 = new TextView(context);
textView2.setTextSize(1, 16.0f);
textView2.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
outlineTextContainerView.addView(textView2, LayoutHelper.createFrame(-2, -2.0f, 21, 0.0f, 0.0f, 14.0f, 0.0f));
LinkSpanDrawable.LinksTextView linksTextView = new LinkSpanDrawable.LinksTextView(context);
linksTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.PaidContentInfo), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showMediaPriceSheet$84(context);
}
}), true));
linksTextView.setTextSize(1, 12.0f);
linksTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
linksTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider));
linearLayout.addView((View) linksTextView, LayoutHelper.createLinear(-1, -2, 14.0f, 3.0f, 14.0f, 24.0f));
final ButtonWithCounterView buttonWithCounterView2 = new ButtonWithCounterView(context, resourcesProvider);
buttonWithCounterView2.setText(LocaleController.getString(j > 0 ? R.string.PaidContentUpdateButton : R.string.PaidContentButton), false);
linearLayout.addView(buttonWithCounterView2, LayoutHelper.createLinear(-1, 48));
if (j > 0 && z) {
buttonWithCounterView = new ButtonWithCounterView(context, false, resourcesProvider);
buttonWithCounterView.setText(LocaleController.getString(R.string.PaidContentClearButton), false, false);
linearLayout.addView(buttonWithCounterView, LayoutHelper.createLinear(-1, 48, 0.0f, 4.0f, 0.0f, 0.0f));
}
final ButtonWithCounterView buttonWithCounterView3 = buttonWithCounterView;
builder.setCustomView(linearLayout);
final BottomSheet[] bottomSheetArr = {builder.create()};
editTextBoldCursor.setText(j <= 0 ? "" : Long.toString(j));
editTextBoldCursor.addTextChangedListener(new TextWatcher() {
private boolean ignore;
private int shakeDp = 2;
@Override
public void afterTextChanged(android.text.Editable r10) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.AnonymousClass16.afterTextChanged(android.text.Editable):void");
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
});
final boolean[] zArr = {false};
editTextBoldCursor.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView3, int i2, KeyEvent keyEvent) {
boolean lambda$showMediaPriceSheet$86;
lambda$showMediaPriceSheet$86 = StarsIntroActivity.lambda$showMediaPriceSheet$86(zArr, callback2, buttonWithCounterView2, editTextBoldCursor, bottomSheetArr, textView3, i2, keyEvent);
return lambda$showMediaPriceSheet$86;
}
});
buttonWithCounterView2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$showMediaPriceSheet$88(zArr, callback2, editTextBoldCursor, buttonWithCounterView2, bottomSheetArr, view);
}
});
if (buttonWithCounterView3 != null) {
buttonWithCounterView3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$showMediaPriceSheet$90(zArr, callback2, buttonWithCounterView3, editTextBoldCursor, bottomSheetArr, view);
}
});
}
bottomSheetArr[0].fixNavigationBar();
bottomSheetArr[0].setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
AndroidUtilities.hideKeyboard(editTextBoldCursor);
}
});
bottomSheetArr[0].show();
ChatActivity lastFragment = LaunchActivity.getLastFragment();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$showMediaPriceSheet$93(bottomSheetArr, editTextBoldCursor);
}
}, lastFragment instanceof ChatActivity ? lastFragment.needEnterText() : false ? 200L : 80L);
return bottomSheetArr[0];
}
public static BottomSheet showSoldOutGiftSheet(Context context, int i, TL_stars.StarGift starGift, Theme.ResourcesProvider resourcesProvider) {
if (starGift == null || context == null) {
return null;
}
BottomSheet.Builder builder = new BottomSheet.Builder(context, false, resourcesProvider);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
linearLayout.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(20.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(8.0f));
linearLayout.setClipChildren(false);
linearLayout.setClipToPadding(false);
View backupImageView = new BackupImageView(context);
setGiftImage(backupImageView.getImageReceiver(), starGift, 160);
linearLayout.addView(backupImageView, LayoutHelper.createLinear(160, 160, 17, 0, -8, 0, 10));
TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider));
textView.setTextSize(1, 20.0f);
textView.setTypeface(AndroidUtilities.bold());
textView.setGravity(17);
textView.setText(LocaleController.getString(R.string.Gift2SoldOutSheetTitle));
linearLayout.addView(textView, LayoutHelper.createLinear(-1, -2, 17, 20, 0, 20, 4));
TextView textView2 = new TextView(context);
textView2.setTextSize(1, 14.0f);
textView2.setTypeface(AndroidUtilities.bold());
textView2.setGravity(17);
textView2.setTextColor(Theme.getColor(Theme.key_text_RedBold, resourcesProvider));
textView2.setText(LocaleController.getString(R.string.Gift2SoldOutSheetSubtitle));
linearLayout.addView(textView2, LayoutHelper.createLinear(-1, -2, 17, 20, 0, 20, 4));
View tableView = new TableView(context, resourcesProvider);
if (starGift.first_sale_date != 0) {
tableView.addRowDateTime(LocaleController.getString(R.string.Gift2SoldOutSheetFirstSale), starGift.first_sale_date);
}
if (starGift.last_sale_date != 0) {
tableView.addRowDateTime(LocaleController.getString(R.string.Gift2SoldOutSheetLastSale), starGift.last_sale_date);
}
tableView.addRow(LocaleController.getString(R.string.Gift2SoldOutSheetValue), replaceStarsWithPlain("⭐️ " + LocaleController.formatNumber(starGift.stars, ','), 0.8f));
if (starGift.limited) {
addAvailabilityRow(tableView, i, starGift, resourcesProvider);
}
linearLayout.addView(tableView, LayoutHelper.createLinear(-1, -2, 0.0f, 17.0f, 0.0f, 12.0f));
ButtonWithCounterView buttonWithCounterView = new ButtonWithCounterView(context, resourcesProvider);
buttonWithCounterView.setText(LocaleController.getString(R.string.OK), false);
linearLayout.addView(buttonWithCounterView, LayoutHelper.createLinear(-1, 48));
builder.setCustomView(linearLayout);
final BottomSheet[] bottomSheetArr = {builder.create()};
bottomSheetArr[0].useBackgroundTopPadding = false;
buttonWithCounterView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
StarsIntroActivity.lambda$showSoldOutGiftSheet$101(bottomSheetArr, view);
}
});
bottomSheetArr[0].fixNavigationBar();
BaseFragment safeLastFragment = LaunchActivity.getSafeLastFragment();
if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(safeLastFragment)) {
bottomSheetArr[0].makeAttached(safeLastFragment);
}
bottomSheetArr[0].show();
return bottomSheetArr[0];
}
public static org.telegram.ui.ActionBar.BottomSheet showSubscriptionSheet(final android.content.Context r39, final int r40, final org.telegram.tgnet.tl.TL_stars.StarsSubscription r41, final org.telegram.ui.ActionBar.Theme.ResourcesProvider r42) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.showSubscriptionSheet(android.content.Context, int, org.telegram.tgnet.tl.TL_stars$StarsSubscription, org.telegram.ui.ActionBar.Theme$ResourcesProvider):org.telegram.ui.ActionBar.BottomSheet");
}
public static BottomSheet showTransactionSheet(Context context, int i, int i2, TLRPC.Peer peer, TLRPC.Peer peer2, TLRPC.TL_messageActionGiftStars tL_messageActionGiftStars, Theme.ResourcesProvider resourcesProvider) {
TL_stars.StarsTransaction starsTransaction = new TL_stars.StarsTransaction();
starsTransaction.title = null;
starsTransaction.description = null;
starsTransaction.photo = null;
TL_stars.TL_starsTransactionPeer tL_starsTransactionPeer = new TL_stars.TL_starsTransactionPeer();
starsTransaction.peer = tL_starsTransactionPeer;
((TL_stars.StarsTransactionPeer) tL_starsTransactionPeer).peer = peer;
starsTransaction.date = i2;
starsTransaction.amount = TL_stars.StarsAmount.ofStars(tL_messageActionGiftStars.stars);
starsTransaction.id = tL_messageActionGiftStars.transaction_id;
starsTransaction.gift = true;
starsTransaction.sent_by = peer;
starsTransaction.received_by = peer2;
return showTransactionSheet(context, false, 0L, i, starsTransaction, resourcesProvider);
}
public static BottomSheet showTransactionSheet(Context context, int i, int i2, TLRPC.Peer peer, TLRPC.Peer peer2, TLRPC.TL_messageActionGiftTon tL_messageActionGiftTon, Theme.ResourcesProvider resourcesProvider) {
TL_stars.StarsTransaction starsTransaction = new TL_stars.StarsTransaction();
starsTransaction.title = null;
starsTransaction.description = null;
starsTransaction.photo = null;
TL_stars.TL_starsTransactionPeer tL_starsTransactionPeer = new TL_stars.TL_starsTransactionPeer();
starsTransaction.peer = tL_starsTransactionPeer;
((TL_stars.StarsTransactionPeer) tL_starsTransactionPeer).peer = peer;
starsTransaction.date = i2;
TL_stars.TL_starsTonAmount tL_starsTonAmount = new TL_stars.TL_starsTonAmount();
starsTransaction.amount = tL_starsTonAmount;
((TL_stars.StarsAmount) tL_starsTonAmount).amount = ((TLRPC.MessageAction) tL_messageActionGiftTon).cryptoAmount;
starsTransaction.id = tL_messageActionGiftTon.transaction_id;
starsTransaction.gift = true;
starsTransaction.sent_by = peer;
starsTransaction.received_by = peer2;
return showTransactionSheet(context, false, 0L, i, starsTransaction, resourcesProvider);
}
public static BottomSheet showTransactionSheet(Context context, int i, int i2, TLRPC.Peer peer, TLRPC.Peer peer2, TLRPC.TL_messageActionPrizeStars tL_messageActionPrizeStars, Theme.ResourcesProvider resourcesProvider) {
TL_stars.StarsTransaction starsTransaction = new TL_stars.StarsTransaction();
starsTransaction.title = null;
starsTransaction.description = null;
starsTransaction.photo = null;
TL_stars.TL_starsTransactionPeer tL_starsTransactionPeer = new TL_stars.TL_starsTransactionPeer();
starsTransaction.peer = tL_starsTransactionPeer;
((TL_stars.StarsTransactionPeer) tL_starsTransactionPeer).peer = tL_messageActionPrizeStars.boost_peer;
starsTransaction.date = i2;
starsTransaction.amount = TL_stars.StarsAmount.ofStars(tL_messageActionPrizeStars.stars);
starsTransaction.id = tL_messageActionPrizeStars.transaction_id;
starsTransaction.gift = true;
starsTransaction.flags |= 8192;
starsTransaction.giveaway_post_id = tL_messageActionPrizeStars.giveaway_msg_id;
starsTransaction.sent_by = peer;
starsTransaction.received_by = peer2;
return showTransactionSheet(context, false, 0L, i, starsTransaction, resourcesProvider);
}
public static BottomSheet showTransactionSheet(Context context, int i, int i2, TLRPC.TL_messageActionPaymentRefunded tL_messageActionPaymentRefunded, Theme.ResourcesProvider resourcesProvider) {
TL_stars.StarsTransaction starsTransaction = new TL_stars.StarsTransaction();
starsTransaction.title = null;
starsTransaction.description = null;
starsTransaction.photo = null;
TL_stars.TL_starsTransactionPeer tL_starsTransactionPeer = new TL_stars.TL_starsTransactionPeer();
starsTransaction.peer = tL_starsTransactionPeer;
((TL_stars.StarsTransactionPeer) tL_starsTransactionPeer).peer = ((TLRPC.MessageAction) tL_messageActionPaymentRefunded).peer;
starsTransaction.date = i2;
starsTransaction.amount = TL_stars.StarsAmount.ofStars(((TLRPC.MessageAction) tL_messageActionPaymentRefunded).total_amount);
starsTransaction.id = tL_messageActionPaymentRefunded.charge.id;
starsTransaction.refund = true;
return showTransactionSheet(context, false, 0L, i, starsTransaction, resourcesProvider);
}
public static BottomSheet showTransactionSheet(Context context, boolean z, int i, TLRPC.TL_payments_paymentReceiptStars tL_payments_paymentReceiptStars, Theme.ResourcesProvider resourcesProvider) {
TL_stars.StarsTransaction starsTransaction = new TL_stars.StarsTransaction();
starsTransaction.title = ((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).title;
starsTransaction.description = ((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).description;
starsTransaction.photo = ((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).photo;
TL_stars.TL_starsTransactionPeer tL_starsTransactionPeer = new TL_stars.TL_starsTransactionPeer();
starsTransaction.peer = tL_starsTransactionPeer;
((TL_stars.StarsTransactionPeer) tL_starsTransactionPeer).peer = MessagesController.getInstance(i).getPeer(((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).bot_id);
starsTransaction.date = ((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).date;
starsTransaction.amount = TL_stars.StarsAmount.ofStars(-((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).total_amount);
starsTransaction.id = ((TLRPC.PaymentReceipt) tL_payments_paymentReceiptStars).transaction_id;
return showTransactionSheet(context, z, 0L, i, starsTransaction, resourcesProvider);
}
public static org.telegram.ui.ActionBar.BottomSheet showTransactionSheet(final android.content.Context r59, final boolean r60, final long r61, final int r63, final org.telegram.tgnet.tl.TL_stars.StarsTransaction r64, final org.telegram.ui.ActionBar.Theme.ResourcesProvider r65) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.showTransactionSheet(android.content.Context, boolean, long, int, org.telegram.tgnet.tl.TL_stars$StarsTransaction, org.telegram.ui.ActionBar.Theme$ResourcesProvider):org.telegram.ui.ActionBar.BottomSheet");
}
private void updateBalance() {
TLRPC.TL_starsRevenueStatus tL_starsRevenueStatus;
StarsController starsController = StarsController.getInstance(((BaseFragment) this).currentAccount);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append((CharSequence) this.starBalanceIcon);
spannableStringBuilder.append(formatStarsAmount(starsController.getBalance(), 0.66f, ' '));
this.starBalanceTextView.setText(spannableStringBuilder);
this.buyButton.setText(LocaleController.getString(starsController.getBalance().amount > 0 ? R.string.StarsBuyMore : R.string.StarsBuy), true);
TLRPC.TL_payments_starsRevenueStats starsRevenueStats = BotStarsController.getInstance(((BaseFragment) this).currentAccount).getStarsRevenueStats(getUserConfig().getClientUserId());
updateButtonsLayouts((starsRevenueStats == null || (tL_starsRevenueStatus = starsRevenueStats.status) == null || !tL_starsRevenueStatus.overall_revenue.positive()) ? false : true, true);
}
private void updateButtonsLayouts(final boolean z, boolean z2) {
this.twoButtons = z;
if (z2) {
this.oneButtonsLayout.setVisibility(0);
this.twoButtonsLayout.setVisibility(0);
this.oneButtonsLayout.animate().alpha(z ? 0.0f : 1.0f).withEndAction(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.this.lambda$updateButtonsLayouts$6(z);
}
}).start();
this.twoButtonsLayout.animate().alpha(z ? 1.0f : 0.0f).withEndAction(new Runnable() {
@Override
public final void run() {
StarsIntroActivity.this.lambda$updateButtonsLayouts$7(z);
}
}).start();
return;
}
this.oneButtonsLayout.animate().cancel();
this.twoButtonsLayout.animate().cancel();
this.twoButtonsLayout.setAlpha(z ? 1.0f : 0.0f);
this.oneButtonsLayout.setAlpha(z ? 0.0f : 1.0f);
this.twoButtonsLayout.setVisibility(z ? 0 : 8);
this.oneButtonsLayout.setVisibility(z ? 8 : 0);
}
public boolean attachedTransactionsLayout() {
StarsTransactionsLayout starsTransactionsLayout = this.transactionsLayout;
if (starsTransactionsLayout == null || !(starsTransactionsLayout.getParent() instanceof View)) {
return false;
}
return ((GradientHeaderActivity) this).listView.getHeight() - ((View) this.transactionsLayout.getParent()).getBottom() >= 0;
}
protected RecyclerView.Adapter createAdapter() {
UniversalAdapter universalAdapter = new UniversalAdapter(((GradientHeaderActivity) this).listView, getContext(), ((BaseFragment) this).currentAccount, ((BaseFragment) this).classGuid, true, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.this.fillItems((ArrayList) obj, (UniversalAdapter) obj2);
}
}, getResourceProvider()) {
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
if (i != 42) {
return super.onCreateViewHolder(viewGroup, i);
}
HeaderCell headerCell = new HeaderCell(StarsIntroActivity.this.getContext(), Theme.key_windowBackgroundWhiteBlueHeader, 21, 0, false, ((BaseFragment) StarsIntroActivity.this).resourceProvider);
headerCell.setHeight(25);
return new RecyclerListView.Holder(headerCell);
}
};
this.adapter = universalAdapter;
return universalAdapter;
}
protected GradientHeaderActivity.ContentView createContentView() {
return new NestedFrameLayout(getContext());
}
public StarParticlesView createParticlesView() {
return makeParticlesView(getContext(), 75, 1);
}
public View createView(final Context context) {
TLRPC.TL_starsRevenueStatus tL_starsRevenueStatus;
((GradientHeaderActivity) this).useFillLastLayoutManager = false;
((GradientHeaderActivity) this).particlesViewHeight = AndroidUtilities.dp(238.0f);
this.transactionsLayout = new StarsTransactionsLayout(context, ((BaseFragment) this).currentAccount, false, 0L, getClassGuid(), getResourceProvider());
View view = new View(context) {
@Override
protected void onMeasure(int i, int i2) {
int i3;
StarsIntroActivity starsIntroActivity = StarsIntroActivity.this;
if (((GradientHeaderActivity) starsIntroActivity).isLandscapeMode) {
i3 = (((GradientHeaderActivity) starsIntroActivity).statusBarHeight + ((BaseFragment) starsIntroActivity).actionBar.getMeasuredHeight()) - AndroidUtilities.dp(16.0f);
} else {
int dp = AndroidUtilities.dp(140.0f);
StarsIntroActivity starsIntroActivity2 = StarsIntroActivity.this;
int i4 = dp + ((GradientHeaderActivity) starsIntroActivity2).statusBarHeight;
if (((GradientHeaderActivity) starsIntroActivity2).backgroundView.getMeasuredHeight() + AndroidUtilities.dp(24.0f) > i4) {
i3 = AndroidUtilities.dp(24.0f) + ((GradientHeaderActivity) StarsIntroActivity.this).backgroundView.getMeasuredHeight();
} else {
i3 = i4;
}
}
super.onMeasure(i, View.MeasureSpec.makeMeasureSpec((int) (i3 - (((GradientHeaderActivity) StarsIntroActivity.this).yOffset * 2.5f)), 1073741824));
}
};
this.emptyLayout = view;
view.setBackgroundColor(Theme.getColor(Theme.key_dialogBackgroundGray));
super.createView(context);
FrameLayout frameLayout = new FrameLayout(context);
this.aboveTitleView = frameLayout;
frameLayout.setClickable(true);
GLIconTextureView gLIconTextureView = new GLIconTextureView(context, 1, 2);
this.iconTextureView = gLIconTextureView;
GLIconRenderer gLIconRenderer = gLIconTextureView.mRenderer;
gLIconRenderer.colorKey1 = Theme.key_starsGradient1;
gLIconRenderer.colorKey2 = Theme.key_starsGradient2;
gLIconRenderer.updateColors();
this.iconTextureView.setStarParticlesView(((GradientHeaderActivity) this).particlesView);
this.aboveTitleView.addView((View) this.iconTextureView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(190, 190.0f, 17, 0.0f, 32.0f, 0.0f, 24.0f));
configureHeader(LocaleController.getString(R.string.TelegramStars), AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.TelegramStarsInfo2), new Runnable() {
@Override
public final void run() {
StarsIntroActivity.lambda$createView$0(context);
}
}), true), this.aboveTitleView, (View) null);
((GradientHeaderActivity) this).listView.setOverScrollMode(2);
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setSupportsChangeAnimations(false);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDurations(350L);
((GradientHeaderActivity) this).listView.setItemAnimator(defaultItemAnimator);
((GradientHeaderActivity) this).listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view2, int i) {
StarsIntroActivity.this.lambda$createView$1(view2, i);
}
});
View fireworksOverlay = new FireworksOverlay(getContext());
this.fireworksOverlay = fireworksOverlay;
((GradientHeaderActivity) this).contentView.addView(fireworksOverlay, LayoutHelper.createFrame(-1, -1.0f));
StarsController starsController = StarsController.getInstance(((BaseFragment) this).currentAccount);
LinearLayout linearLayout = new LinearLayout(getContext());
this.balanceLayout = linearLayout;
linearLayout.setOrientation(1);
this.balanceLayout.setPadding(0, 0, 0, AndroidUtilities.dp(10.0f));
AnimatedTextView animatedTextView = new AnimatedTextView(getContext(), false, true, false);
this.starBalanceTextView = animatedTextView;
animatedTextView.setTypeface(AndroidUtilities.bold());
this.starBalanceTextView.setTextSize(AndroidUtilities.dp(32.0f));
this.starBalanceTextView.setGravity(17);
this.starBalanceTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, ((BaseFragment) this).resourceProvider));
this.starBalanceIcon = new SpannableStringBuilder("S");
ImageReceiverSpan imageReceiverSpan = new ImageReceiverSpan(this.starBalanceTextView, ((BaseFragment) this).currentAccount, 42.0f);
ImageReceiver imageReceiver = imageReceiverSpan.imageReceiver;
int i = R.raw.star_reaction;
imageReceiver.setImageBitmap(new RLottieDrawable(i, "s" + i, AndroidUtilities.dp(42.0f), AndroidUtilities.dp(42.0f)));
imageReceiverSpan.imageReceiver.setAutoRepeat(2);
imageReceiverSpan.enableShadow(false);
imageReceiverSpan.translate((float) (-AndroidUtilities.dp(3.0f)), 0.0f);
this.starBalanceIcon.setSpan(imageReceiverSpan, 0, 1, 33);
this.balanceLayout.addView((View) this.starBalanceTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, 40.0f, 17, 24.0f, 0.0f, 24.0f, 0.0f));
TextView textView = new TextView(getContext());
this.starBalanceTitleView = textView;
textView.setTextSize(1, 14.0f);
this.starBalanceTitleView.setGravity(17);
this.starBalanceTitleView.setText(LocaleController.getString(R.string.YourStarsBalance));
this.starBalanceTitleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, ((BaseFragment) this).resourceProvider));
this.balanceLayout.addView(this.starBalanceTitleView, LayoutHelper.createFrame(-1, -2.0f, 17, 24.0f, 0.0f, 24.0f, 0.0f));
FrameLayout frameLayout2 = new FrameLayout(getContext());
FrameLayout frameLayout3 = new FrameLayout(getContext()) {
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (StarsIntroActivity.this.twoButtons) {
return false;
}
return super.dispatchTouchEvent(motionEvent);
}
};
this.oneButtonsLayout = frameLayout3;
frameLayout2.addView(frameLayout3);
ButtonWithCounterView buttonWithCounterView = new ButtonWithCounterView(getContext(), ((BaseFragment) this).resourceProvider);
this.buyButton = buttonWithCounterView;
buttonWithCounterView.setText("", false);
this.buyButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
StarsIntroActivity.this.lambda$createView$2(context, view2);
}
});
this.oneButtonsLayout.addView(this.buyButton, LayoutHelper.createFrame(-1, 48, 119));
LinearLayout linearLayout2 = new LinearLayout(getContext()) {
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (StarsIntroActivity.this.twoButtons) {
return super.dispatchTouchEvent(motionEvent);
}
return false;
}
};
this.twoButtonsLayout = linearLayout2;
frameLayout2.addView(linearLayout2);
this.topupButton = new ButtonWithCounterView(getContext(), ((BaseFragment) this).resourceProvider);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("x ");
spannableStringBuilder.setSpan(new ColoredImageSpan(R.drawable.mini_topup, 2), 0, 1, 33);
spannableStringBuilder.append((CharSequence) LocaleController.getString(R.string.StarsTopUp));
this.topupButton.setText(spannableStringBuilder, false);
this.topupButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
StarsIntroActivity.this.lambda$createView$3(context, view2);
}
});
this.twoButtonsLayout.addView(this.topupButton, LayoutHelper.createLinear(-1, 48, 17.0f, 1, 0, 0, 8, 0));
this.withdrawButton = new ButtonWithCounterView(getContext(), ((BaseFragment) this).resourceProvider);
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder("x ");
spannableStringBuilder2.setSpan(new ColoredImageSpan(R.drawable.mini_stats, 2), 0, 1, 33);
spannableStringBuilder2.append((CharSequence) LocaleController.getString(R.string.StarsStats));
this.withdrawButton.setText(spannableStringBuilder2, false);
this.withdrawButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
StarsIntroActivity.this.lambda$createView$4(view2);
}
});
this.twoButtonsLayout.addView(this.withdrawButton, LayoutHelper.createLinear(-1, 48, 17.0f, 1, 0, 0, 0, 0));
this.balanceLayout.addView(frameLayout2, LayoutHelper.createFrame(-1, 48.0f, 17, 20.0f, 17.0f, 20.0f, 0.0f));
this.giftButton = new ButtonWithCounterView(getContext(), false, ((BaseFragment) this).resourceProvider);
SpannableStringBuilder spannableStringBuilder3 = new SpannableStringBuilder();
spannableStringBuilder3.append((CharSequence) "G ");
spannableStringBuilder3.setSpan(new ColoredImageSpan(R.drawable.menu_stars_gift), 0, 1, 33);
spannableStringBuilder3.append((CharSequence) LocaleController.getString(R.string.TelegramStarsGift));
this.giftButton.setText(spannableStringBuilder3, false);
this.giftButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
StarsIntroActivity.this.lambda$createView$5(view2);
}
});
this.balanceLayout.addView(this.giftButton, LayoutHelper.createFrame(-1, 48.0f, 17, 20.0f, 8.0f, 20.0f, 0.0f));
updateBalance();
UniversalAdapter universalAdapter = this.adapter;
if (universalAdapter != null) {
universalAdapter.update(false);
}
BotStarsController.getInstance(((BaseFragment) this).currentAccount).preloadStarsStats(getUserConfig().getClientUserId());
TLRPC.TL_payments_starsRevenueStats starsRevenueStats = BotStarsController.getInstance(((BaseFragment) this).currentAccount).getStarsRevenueStats(getUserConfig().getClientUserId());
updateButtonsLayouts(starsController.getBalance().amount > 0 && starsRevenueStats != null && (tL_starsRevenueStatus = starsRevenueStats.status) != null && tL_starsRevenueStatus.overall_revenue.positive(), false);
return ((BaseFragment) this).fragmentView;
}
public void didReceivedNotification(int r3, int r4, java.lang.Object... r5) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Stars.StarsIntroActivity.didReceivedNotification(int, int, java.lang.Object[]):void");
}
protected boolean drawActionBarShadow() {
return !attachedTransactionsLayout();
}
public void fillItems(ArrayList arrayList, UniversalAdapter universalAdapter) {
UItem accent;
if (getContext() == null) {
return;
}
StarsController starsController = StarsController.getInstance(((BaseFragment) this).currentAccount);
arrayList.add(UItem.asFullyCustom(getHeader(getContext())));
arrayList.add(UItem.asCustom(this.balanceLayout));
ButtonWithCounterView buttonWithCounterView = this.giftButton;
if (buttonWithCounterView != null) {
buttonWithCounterView.setVisibility(getMessagesController().starsGiftsEnabled ? 0 : 8);
}
arrayList.add(UItem.asShadow((CharSequence) null));
if (getMessagesController().starrefConnectAllowed) {
arrayList.add(AffiliateProgramFragment.ColorfulTextCell.Factory.as(-4, getThemedColor(Theme.key_color_green), R.drawable.filled_earn_stars, ChatEditActivity.applyNewSpan(LocaleController.getString(R.string.UserAffiliateProgramRowTitle)), LocaleController.getString(R.string.UserAffiliateProgramRowText)));
arrayList.add(UItem.asShadow((CharSequence) null));
}
if (starsController.hasSubscriptions()) {
arrayList.add(UItem.asHeader(LocaleController.getString(R.string.StarMySubscriptions)));
for (int i = 0; i < starsController.subscriptions.size(); i++) {
arrayList.add(StarsSubscriptionView.Factory.asSubscription((TL_stars.StarsSubscription) starsController.subscriptions.get(i)));
}
if (starsController.isLoadingSubscriptions()) {
accent = UItem.asFlicker(arrayList.size(), 33);
} else {
if (!starsController.didFullyLoadSubscriptions()) {
accent = UItem.asButton(-3, R.drawable.arrow_more, LocaleController.getString(R.string.StarMySubscriptionsExpand)).accent();
}
arrayList.add(UItem.asShadow((CharSequence) null));
}
arrayList.add(accent);
arrayList.add(UItem.asShadow((CharSequence) null));
}
boolean hasTransactions = starsController.hasTransactions();
this.hadTransactions = hasTransactions;
arrayList.add(hasTransactions ? UItem.asFullscreenCustom(this.transactionsLayout, ActionBar.getCurrentActionBarHeight() + AndroidUtilities.statusBarHeight) : UItem.asCustom(this.emptyLayout));
}
protected View getHeader(Context context) {
return super.getHeader(context);
}
public int getNavigationBarColor() {
return Theme.getColor(Theme.key_dialogBackgroundGray);
}
public boolean onFragmentCreate() {
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.starTransactionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.starSubscriptionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).addObserver(this, NotificationCenter.botStarsUpdated);
StarsController.getInstance(((BaseFragment) this).currentAccount).invalidateTransactions(true);
StarsController.getInstance(((BaseFragment) this).currentAccount).invalidateSubscriptions(true);
StarsController.getInstance(((BaseFragment) this).currentAccount).getOptions();
return super/*org.telegram.ui.ActionBar.BaseFragment*/.onFragmentCreate();
}
public void onFragmentDestroy() {
super/*org.telegram.ui.ActionBar.BaseFragment*/.onFragmentDestroy();
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.starOptionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.starTransactionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.starSubscriptionsLoaded);
NotificationCenter.getInstance(((BaseFragment) this).currentAccount).removeObserver(this, NotificationCenter.botStarsUpdated);
}
public void onItemClick(final UItem uItem, int i) {
int i2 = uItem.id;
if (i2 == -1) {
this.expanded = !this.expanded;
} else {
if (i2 == -2) {
StarsController.getInstance(((BaseFragment) this).currentAccount).getGiftOptions();
UserSelectorBottomSheet.open(1, 0L, BirthdayController.getInstance(((BaseFragment) this).currentAccount).getState());
return;
}
if (i2 != -3) {
if (i2 == -4) {
if (MessagesController.getInstance(((BaseFragment) this).currentAccount).isFrozen()) {
AccountFrozenAlert.show(((BaseFragment) this).currentAccount);
return;
} else {
presentFragment(new ChannelAffiliateProgramsFragment(getUserConfig().getClientUserId()));
return;
}
}
if (uItem.instanceOf(StarTierView.Factory.class)) {
if (uItem.object instanceof TL_stars.TL_starsTopupOption) {
StarsController.getInstance(((BaseFragment) this).currentAccount).buy(getParentActivity(), (TL_stars.TL_starsTopupOption) uItem.object, new Utilities.Callback2() {
public final void run(Object obj, Object obj2) {
StarsIntroActivity.this.lambda$onItemClick$8(uItem, (Boolean) obj, (String) obj2);
}
});
return;
}
return;
} else {
if (uItem.instanceOf(StarsSubscriptionView.Factory.class) && (uItem.object instanceof TL_stars.StarsSubscription)) {
showSubscriptionSheet(getContext(), ((BaseFragment) this).currentAccount, (TL_stars.StarsSubscription) uItem.object, getResourceProvider());
return;
}
return;
}
}
StarsController.getInstance(((BaseFragment) this).currentAccount).loadSubscriptions();
}
this.adapter.update(true);
}
public void onPause() {
super.onPause();
GLIconTextureView gLIconTextureView = this.iconTextureView;
if (gLIconTextureView != null) {
gLIconTextureView.setPaused(true);
this.iconTextureView.setDialogVisible(true);
}
}
public void onResume() {
super.onResume();
GLIconTextureView gLIconTextureView = this.iconTextureView;
if (gLIconTextureView != null) {
gLIconTextureView.setPaused(false);
this.iconTextureView.setDialogVisible(false);
}
}
}