Merge branch 'dev' into m_10.14.0
This commit is contained in:
commit
d70a33b2d5
@ -14,12 +14,12 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
def verName = "10.14.2"
|
||||
def verCode = 1184
|
||||
def verName = "10.14.5"
|
||||
def verCode = 1186
|
||||
|
||||
|
||||
def officialVer = "10.14.3"
|
||||
def officialCode = 4927
|
||||
def officialVer = "10.14.5"
|
||||
def officialCode = 4945
|
||||
|
||||
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
|
||||
|
||||
|
@ -121,19 +121,6 @@
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<data android:scheme="ton"/>
|
||||
</intent>
|
||||
|
||||
<package android:name="com.android.chrome" />
|
||||
<package android:name="org.mozilla.firefox" />
|
||||
<package android:name="com.microsoft.emmx" />
|
||||
<package android:name="com.opera.browser" />
|
||||
<package android:name="com.opera.mini.native" />
|
||||
<package android:name="com.brave.browser" />
|
||||
<package android:name="com.duckduckgo.mobile.android" />
|
||||
<package android:name="com.sec.android.app.sbrowser" />
|
||||
<package android:name="com.vivaldi.browser" />
|
||||
<package android:name="com.kiwibrowser.browser" />
|
||||
<package android:name="com.UCMobile.intl" />
|
||||
<package android:name="org.torproject.torbrowser" />
|
||||
</queries>
|
||||
|
||||
<application
|
||||
|
@ -40,11 +40,13 @@ import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.ui.Cells.DialogCell;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
|
||||
/**
|
||||
* This is a utility class to add swipe to dismiss and drag & drop support to RecyclerView.
|
||||
@ -1257,6 +1259,11 @@ public class ItemTouchHelper extends RecyclerView.ItemDecoration
|
||||
}
|
||||
|
||||
public int checkHorizontalSwipe(ViewHolder viewHolder, int flags) {
|
||||
if (viewHolder != null && viewHolder.itemView instanceof DialogCell) {
|
||||
if (((DialogCell) viewHolder.itemView).getCurrentDialogFolderId() == 0 && NaConfig.INSTANCE.getDoNotUnarchiveBySwipe().Bool()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if ((flags & (LEFT | RIGHT)) != 0) {
|
||||
final int dirFlag = mDx > 0 ? RIGHT : LEFT;
|
||||
if (mVelocityTracker != null && mActivePointerId > -1) {
|
||||
|
@ -27,7 +27,6 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
@ -36,7 +35,6 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorMatrix;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
@ -44,10 +42,6 @@ import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.fonts.Font;
|
||||
import android.graphics.fonts.FontFamily;
|
||||
import android.graphics.fonts.FontStyle;
|
||||
import android.graphics.fonts.SystemFonts;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -79,7 +73,6 @@ import android.text.style.DynamicDrawableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.StateSet;
|
||||
import android.util.TypedValue;
|
||||
@ -101,7 +94,6 @@ import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
@ -122,9 +114,7 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.graphics.TypefaceCompatUtil;
|
||||
import androidx.core.math.MathUtils;
|
||||
import androidx.core.provider.FontRequest;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.dynamicanimation.animation.DynamicAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
@ -3850,7 +3840,7 @@ public class AndroidUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean openForView(File f, String fileName, String mimeType, final Activity activity, Theme.ResourcesProvider resourcesProvider) {
|
||||
public static boolean openForView(File f, String fileName, String mimeType, final Activity activity, Theme.ResourcesProvider resourcesProvider, boolean restrict) {
|
||||
if (f != null && f.exists()) {
|
||||
String realMimeType = null;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
@ -3859,6 +3849,10 @@ public class AndroidUtilities {
|
||||
int idx = fileName.lastIndexOf('.');
|
||||
if (idx != -1) {
|
||||
String ext = fileName.substring(idx + 1);
|
||||
int h = ext.toLowerCase().hashCode();
|
||||
if (restrict && (h == 0x17a1c || h == 0x3107ab || h == 0x19a1b || h == 0xe55 || h == 0x18417)) {
|
||||
return true;
|
||||
}
|
||||
realMimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase());
|
||||
if (realMimeType == null) {
|
||||
realMimeType = mimeType;
|
||||
@ -3867,9 +3861,12 @@ public class AndroidUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && realMimeType != null && realMimeType.equals("application/vnd.android.package-archive") && !ApplicationLoader.applicationContext.getPackageManager().canRequestPackageInstalls()) {
|
||||
AlertsCreator.createApkRestrictedDialog(activity, resourcesProvider).show();
|
||||
return true;
|
||||
if (realMimeType != null && realMimeType.equals("application/vnd.android.package-archive")) {
|
||||
if (restrict) return true;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !ApplicationLoader.applicationContext.getPackageManager().canRequestPackageInstalls()) {
|
||||
AlertsCreator.createApkRestrictedDialog(activity, resourcesProvider).show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.setDataAndType(FileProvider.getUriForFile(activity, ApplicationLoader.getApplicationId() + ".provider", f), realMimeType != null ? realMimeType : "text/plain");
|
||||
@ -3896,10 +3893,10 @@ public class AndroidUtilities {
|
||||
}
|
||||
|
||||
public static boolean openForView(MessageObject message, Activity activity) {
|
||||
return openForView(message, activity, null);
|
||||
return openForView(message, activity, null, false);
|
||||
}
|
||||
|
||||
public static boolean openForView(MessageObject message, Activity activity, Theme.ResourcesProvider resourcesProvider) {
|
||||
public static boolean openForView(MessageObject message, Activity activity, Theme.ResourcesProvider resourcesProvider, boolean restrict) {
|
||||
File f = null;
|
||||
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
||||
f = new File(message.messageOwner.attachPath);
|
||||
@ -3908,13 +3905,13 @@ public class AndroidUtilities {
|
||||
f = FileLoader.getInstance(message.currentAccount).getPathToMessage(message.messageOwner);
|
||||
}
|
||||
String mimeType = message.type == MessageObject.TYPE_FILE || message.type == MessageObject.TYPE_TEXT ? message.getMimeType() : null;
|
||||
return openForView(f, message.getFileName(), mimeType, activity, resourcesProvider);
|
||||
return openForView(f, message.getFileName(), mimeType, activity, resourcesProvider, restrict);
|
||||
}
|
||||
|
||||
public static boolean openForView(TLRPC.Document document, boolean forceCache, Activity activity) {
|
||||
String fileName = FileLoader.getAttachFileName(document);
|
||||
File f = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(document, true);
|
||||
return openForView(f, fileName, document.mime_type, activity, null);
|
||||
return openForView(f, fileName, document.mime_type, activity, null, false);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder formatSpannableSimple(CharSequence format, CharSequence... cs) {
|
||||
|
@ -1573,8 +1573,10 @@ public class LocaleController {
|
||||
value = BuildVars.USE_CLOUD_STRINGS ? getInstance().localeValues.get(key + "_other") : null;
|
||||
}
|
||||
if (value == null) {
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(param, "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
value = ApplicationLoader.applicationContext.getString(resourceId);
|
||||
try {
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(param, "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
value = ApplicationLoader.applicationContext.getString(resourceId);
|
||||
} catch (Exception e2) {}
|
||||
}
|
||||
if (value == null) {
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key + "_other", "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
|
@ -8463,6 +8463,7 @@ public class MessageObject {
|
||||
}
|
||||
boolean isAnimated = false;
|
||||
boolean isVideo = false;
|
||||
String filename = null;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
for (int a = 0; a < document.attributes.size(); a++) {
|
||||
@ -8476,6 +8477,20 @@ public class MessageObject {
|
||||
height = attribute.h;
|
||||
} else if (attribute instanceof TLRPC.TL_documentAttributeAnimated) {
|
||||
isAnimated = true;
|
||||
} else if (attribute instanceof TLRPC.TL_documentAttributeFilename) {
|
||||
filename = attribute.file_name;
|
||||
}
|
||||
}
|
||||
if (filename != null) {
|
||||
int index = filename.lastIndexOf(".");
|
||||
if (index >= 0) {
|
||||
String ext = filename.substring(index + 1);
|
||||
switch (ext.toLowerCase().hashCode()) {
|
||||
case 0x17a1c: case 0x3107ab: case 0x19a1b:
|
||||
case 0xe55: case 0x18417: case 0x184fe:
|
||||
case 0x18181:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isAnimated && (width > 1280 || height > 1280)) {
|
||||
|
@ -20257,13 +20257,13 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||
@Override
|
||||
public void onMessagesLoaded(boolean fromCache) {
|
||||
progress.end();
|
||||
fragment.presentFragment(new ChatActivity(bundle), true);
|
||||
fragment.presentFragment(new ChatActivity(bundle));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
progress.end();
|
||||
fragment.presentFragment(new ChatActivity(bundle), true);
|
||||
fragment.presentFragment(new ChatActivity(bundle));
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
|
@ -51,6 +51,7 @@ import org.telegram.ui.LaunchActivity;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
@ -264,11 +265,9 @@ public class Browser {
|
||||
boolean[] forceBrowser = new boolean[]{false};
|
||||
boolean internalUri = isInternalUri(uri, forceBrowser);
|
||||
String browserPackage = getBrowserPackageName(browser);
|
||||
if (isBrowserPackageInstalled(context, browserPackage, uri)) {
|
||||
if (browserPackage != null) {
|
||||
tryTelegraph = false;
|
||||
_allowCustom = false;
|
||||
} else {
|
||||
browserPackage = null;
|
||||
}
|
||||
final boolean allowCustom = _allowCustom;
|
||||
if (tryTelegraph) {
|
||||
@ -456,7 +455,16 @@ public class Browser {
|
||||
intent.putExtra(LaunchActivity.EXTRA_FORCE_NOT_INTERNAL_APPS, forceNotInternalForApps);
|
||||
((LaunchActivity) context).onNewIntent(intent, inCaseLoading);
|
||||
} else {
|
||||
context.startActivity(intent);
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e2) {
|
||||
if (browserPackage != null) {
|
||||
intent.setPackage(browserPackage = null);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
FileLog.e(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
@ -620,14 +628,6 @@ public class Browser {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isBrowserPackageInstalled(Context context, String packageName, Uri uri) {
|
||||
if (packageName == null) return false;
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
intent.setPackage(packageName);
|
||||
return packageManager.resolveActivity(intent, 0) != null;
|
||||
}
|
||||
|
||||
public static String replaceHostname(Uri originalUri, String newHostname) {
|
||||
String scheme = originalUri.getScheme();
|
||||
String userInfo = originalUri.getUserInfo();
|
||||
|
@ -332,7 +332,7 @@ public class CachedMediaLayout extends FrameLayout implements NestedSizeNotifier
|
||||
photoEntries.add(new MediaController.PhotoEntry(0, 0, 0, fileInfo.file.getPath(), 0, fileInfo.type == TYPE_VIDEOS, 0, 0, 0));
|
||||
PhotoViewer.getInstance().openPhotoForSelect(photoEntries, 0, PhotoViewer.SELECT_TYPE_NO_SELECT, false, placeProvider, null);
|
||||
} else {
|
||||
AndroidUtilities.openForView(fileInfo.file, fileInfo.file.getName(), null, parentFragment.getParentActivity(), null);
|
||||
AndroidUtilities.openForView(fileInfo.file, fileInfo.file.getName(), null, parentFragment.getParentActivity(), null, false);
|
||||
}
|
||||
}
|
||||
if (cacheCell.type == TYPE_MUSIC) {
|
||||
|
@ -19646,7 +19646,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
buttonX -= AndroidUtilities.dp(10);
|
||||
}
|
||||
commentButtonRect.set(
|
||||
buttonX - AndroidUtilities.dp((currentMessageObject == null || !currentMessageObject.isOut()) && !drawPinnedBottom && currentPosition == null && (currentMessageObject == null || currentMessageObject.type != MessageObject.TYPE_POLL || pollInstantViewTouchesBottom) ? 6 : 0),
|
||||
buttonX - AndroidUtilities.dp((currentMessageObject == null || !currentMessageObject.isOutOwner()) && !drawPinnedBottom && currentPosition == null && (currentMessageObject == null || currentMessageObject.type != MessageObject.TYPE_POLL || pollInstantViewTouchesBottom) ? 6 : 0),
|
||||
(int) buttonY,
|
||||
endX - AndroidUtilities.dp(14),
|
||||
layoutHeight - AndroidUtilities.dp(h) + 1
|
||||
|
@ -3178,7 +3178,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
||||
}
|
||||
}
|
||||
try {
|
||||
AndroidUtilities.openForView(message, getParentActivity(), null);
|
||||
AndroidUtilities.openForView(message, getParentActivity(), null, false);
|
||||
} catch (Exception e) {
|
||||
alertUserOpenError(message);
|
||||
}
|
||||
|
@ -293,6 +293,7 @@ public class ChannelMonetizationLayout extends SizeNotifierFrameLayout implement
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
};
|
||||
starsBalanceEditTextContainer.setVisibility(GONE);
|
||||
starsBalanceEditTextContainer.setText(getString(R.string.BotStarsWithdrawPlaceholder));
|
||||
starsBalanceEditTextContainer.setLeftPadding(dp(14 + 22));
|
||||
starsBalanceEditText = new EditTextBoldCursor(context) {
|
||||
@ -671,13 +672,14 @@ public class ChannelMonetizationLayout extends SizeNotifierFrameLayout implement
|
||||
starsBalance = crypto_amount;
|
||||
starsBalanceTitle.setText(ssb);
|
||||
starsBalanceSubtitle.setText("≈" + BillingController.getInstance().formatCurrency(amount, "USD"));
|
||||
starsBalanceEditTextContainer.setVisibility(crypto_amount > 0 ? VISIBLE : GONE);
|
||||
if (starsBalanceEditTextAll) {
|
||||
starsBalanceEditTextIgnore = true;
|
||||
starsBalanceEditText.setText(Long.toString(starsBalanceEditTextValue = crypto_amount));
|
||||
starsBalanceEditText.setSelection(starsBalanceEditText.getText().length());
|
||||
starsBalanceEditTextIgnore = false;
|
||||
|
||||
balanceButton.setEnabled(starsBalanceEditTextValue > 0);
|
||||
starsBalanceButton.setEnabled(starsBalanceEditTextValue > 0);
|
||||
}
|
||||
starsBalanceBlockedUntil = blockedUntil;
|
||||
|
||||
|
@ -1175,8 +1175,10 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
||||
return minValue;
|
||||
}
|
||||
|
||||
public void setData(T chartData) {
|
||||
public boolean setData(T chartData) {
|
||||
boolean updated = false;
|
||||
if (this.chartData != chartData) {
|
||||
updated = true;
|
||||
invalidate();
|
||||
lines.clear();
|
||||
if (chartData != null && chartData.lines != null) {
|
||||
@ -1236,6 +1238,7 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
||||
alphaAnimator.cancel();
|
||||
}
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
protected float getMinDistance() {
|
||||
|
@ -233,6 +233,12 @@ public class ChartPickerDelegate {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void set(float start, float end) {
|
||||
pickerStart = start;
|
||||
pickerEnd = end;
|
||||
view.onPickerDataChanged();
|
||||
}
|
||||
|
||||
public boolean uncapture(MotionEvent event, int pointerIndex) {
|
||||
if (pointerIndex == 0) {
|
||||
if (tryMoveTo) {
|
||||
|
@ -314,13 +314,14 @@ public class PieChartView extends StackLinearChartView<PieChartViewData> {
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(StackLinearChartData chartData) {
|
||||
super.setData(chartData);
|
||||
public boolean setData(StackLinearChartData chartData) {
|
||||
boolean u = super.setData(chartData);
|
||||
if (chartData != null) {
|
||||
values = new float[chartData.lines.size()];
|
||||
darawingValuesPercentage = new float[chartData.lines.size()];
|
||||
onPickerDataChanged(false, true, false);
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -897,6 +897,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private boolean premiumInvoiceBot;
|
||||
private boolean showScrollToMessageError;
|
||||
private int startLoadFromMessageId;
|
||||
private int startReplyTo;
|
||||
private int startLoadFromDate;
|
||||
private int startLoadFromMessageIdSaved;
|
||||
private int startLoadFromMessageOffset = Integer.MAX_VALUE;
|
||||
@ -2546,6 +2547,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
textToSet = arguments.getString("start_text");
|
||||
premiumInvoiceBot = arguments.getBoolean("premium_bot", false);
|
||||
startLoadFromMessageId = arguments.getInt("message_id", 0);
|
||||
startReplyTo = arguments.getInt("reply_to", 0);
|
||||
startLoadFromDate = arguments.getInt("start_from_date", 0);
|
||||
startFromVideoTimestamp = arguments.getInt("video_timestamp", -1);
|
||||
threadUnreadMessagesCount = arguments.getInt("unread_count", 0);
|
||||
@ -20801,6 +20803,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (chatMode == MODE_SEARCH) {
|
||||
updateSearchUpDownButtonVisibility(true);
|
||||
}
|
||||
if (startReplyTo != 0) {
|
||||
MessageObject msg = messagesDict[0].get(startReplyTo);
|
||||
if (msg != null) {
|
||||
showFieldPanelForReply(msg);
|
||||
startReplyTo = 0;
|
||||
}
|
||||
}
|
||||
} else if (id == NotificationCenter.invalidateMotionBackground) {
|
||||
if (chatListView != null) {
|
||||
chatListView.invalidateViews();
|
||||
@ -29581,7 +29590,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
if (canViewStats) {
|
||||
items.add(LocaleController.getString("ViewStats", R.string.ViewStats));
|
||||
options.add(28);
|
||||
options.add(OPTION_STATISTICS);
|
||||
icons.add(R.drawable.msg_stats);
|
||||
}
|
||||
if (allowUnpin) {
|
||||
@ -38162,7 +38171,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
if (!handled) {
|
||||
try {
|
||||
AndroidUtilities.openForView(message, getParentActivity(), themeDelegate);
|
||||
AndroidUtilities.openForView(message, getParentActivity(), themeDelegate, false);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
alertUserOpenError(message);
|
||||
@ -41717,7 +41726,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
dialog.setItemOptions(options);
|
||||
if (span instanceof URLSpanReplacement) {
|
||||
SpannableString s = new SpannableString(((URLSpanReplacement) span).getURL());
|
||||
String formattedUrl = ((URLSpanReplacement) span).getURL();
|
||||
try {
|
||||
try {
|
||||
Uri uri = Uri.parse(formattedUrl);
|
||||
formattedUrl = Browser.replaceHostname(uri, IDN.toUnicode(uri.getHost(), IDN.ALLOW_UNASSIGNED));
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e, false);
|
||||
}
|
||||
formattedUrl = URLDecoder.decode(formattedUrl.replaceAll("\\+", "%2b"), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
if (formattedUrl.length() > 204) {
|
||||
formattedUrl = formattedUrl.substring(0, 204) + "…";
|
||||
}
|
||||
SpannableString s = new SpannableString(formattedUrl);
|
||||
s.setSpan(span, 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
dialog.setScrim(cell, span, s);
|
||||
} else {
|
||||
|
@ -388,8 +388,10 @@ public class ThanosEffect extends TextureView {
|
||||
|
||||
public void kill() {
|
||||
if (!alive) {
|
||||
FileLog.d("ThanosEffect: kill failed, already dead");
|
||||
return;
|
||||
}
|
||||
FileLog.d("ThanosEffect: kill");
|
||||
try {
|
||||
Handler handler = getHandler();
|
||||
if (handler != null) {
|
||||
@ -400,8 +402,10 @@ public class ThanosEffect extends TextureView {
|
||||
|
||||
private void killInternal() {
|
||||
if (!alive) {
|
||||
FileLog.d("ThanosEffect: killInternal failed, already dead");
|
||||
return;
|
||||
}
|
||||
FileLog.d("ThanosEffect: killInternal");
|
||||
alive = false;
|
||||
for (int i = 0; i < pendingAnimations.size(); ++i) {
|
||||
Animation animation = pendingAnimations.get(i);
|
||||
@ -454,11 +458,13 @@ public class ThanosEffect extends TextureView {
|
||||
|
||||
eglDisplay = egl.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
|
||||
if (eglDisplay == egl.EGL_NO_DISPLAY) {
|
||||
FileLog.e("ThanosEffect: eglDisplay == egl.EGL_NO_DISPLAY");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
int[] version = new int[2];
|
||||
if (!egl.eglInitialize(eglDisplay, version)) {
|
||||
FileLog.e("ThanosEffect: failed eglInitialize");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
@ -474,6 +480,7 @@ public class ThanosEffect extends TextureView {
|
||||
EGLConfig[] eglConfigs = new EGLConfig[1];
|
||||
int[] numConfigs = new int[1];
|
||||
if (!egl.eglChooseConfig(eglDisplay, configAttributes, eglConfigs, 1, numConfigs)) {
|
||||
FileLog.e("ThanosEffect: failed eglChooseConfig");
|
||||
kill();
|
||||
return;
|
||||
}
|
||||
@ -485,17 +492,20 @@ public class ThanosEffect extends TextureView {
|
||||
};
|
||||
eglContext = egl.eglCreateContext(eglDisplay, eglConfig, egl.EGL_NO_CONTEXT, contextAttributes);
|
||||
if (eglContext == null) {
|
||||
FileLog.e("ThanosEffect: eglContext == null");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, surfaceTexture, null);
|
||||
if (eglSurface == null) {
|
||||
FileLog.e("ThanosEffect: eglSurface == null");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
|
||||
FileLog.e("ThanosEffect: failed eglMakeCurrent");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
@ -503,6 +513,7 @@ public class ThanosEffect extends TextureView {
|
||||
int vertexShader = GLES31.glCreateShader(GLES31.GL_VERTEX_SHADER);
|
||||
int fragmentShader = GLES31.glCreateShader(GLES31.GL_FRAGMENT_SHADER);
|
||||
if (vertexShader == 0 || fragmentShader == 0) {
|
||||
FileLog.e("ThanosEffect: vertexShader == 0 || fragmentShader == 0");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
@ -527,6 +538,7 @@ public class ThanosEffect extends TextureView {
|
||||
}
|
||||
drawProgram = GLES31.glCreateProgram();
|
||||
if (drawProgram == 0) {
|
||||
FileLog.e("ThanosEffect: drawProgram == 0");
|
||||
killInternal();
|
||||
return;
|
||||
}
|
||||
|
@ -2688,12 +2688,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
|
||||
@Override
|
||||
public float getSwipeThreshold(RecyclerView.ViewHolder viewHolder) {
|
||||
if (viewHolder != null && viewHolder.itemView instanceof DialogCell) {
|
||||
if (((DialogCell) viewHolder.itemView).getCurrentDialogFolderId() == 0
|
||||
&& NaConfig.INSTANCE.getDoNotUnarchiveBySwipe().Bool()) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
return 0.45f;
|
||||
}
|
||||
|
||||
|
@ -1004,11 +1004,11 @@ public class MessageStatisticActivity extends BaseFragment implements Notificati
|
||||
HeaderCell headerCell = (HeaderCell) holder.itemView;
|
||||
if (position == overviewHeaderRow) {
|
||||
headerCell.setTopMargin(9);
|
||||
headerCell.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||
headerCell.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), AndroidUtilities.dp(8));
|
||||
headerCell.setText(LocaleController.formatString("StatisticOverview", R.string.StatisticOverview));
|
||||
} else {
|
||||
headerCell.setTopMargin(11);
|
||||
headerCell.setPadding(0, 0, 0, 0);
|
||||
headerCell.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);
|
||||
headerCell.setText(LocaleController.formatString("PublicShares", R.string.PublicShares));
|
||||
}
|
||||
break;
|
||||
|
@ -2032,6 +2032,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
private final static int gallery_menu_paint = 20;
|
||||
private final static int gallery_menu_translate = 21;
|
||||
private final static int gallery_menu_hide_translation = 22;
|
||||
private final static int gallery_menu_reply = 23;
|
||||
|
||||
private final static int gallery_menu_copy = 100;
|
||||
private final static int gallery_menu_set_photo = 101;
|
||||
@ -4971,7 +4972,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
((LaunchActivity) parentActivity).presentFragment(mediaActivity, false, true);
|
||||
}
|
||||
}
|
||||
} else if (id == gallery_menu_showinchat) {
|
||||
} else if (id == gallery_menu_showinchat || id == gallery_menu_reply) {
|
||||
if (currentMessageObject == null) {
|
||||
return;
|
||||
}
|
||||
@ -4993,6 +4994,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
args.putLong("chat_id", -dialogId);
|
||||
}
|
||||
args.putInt("message_id", currentMessageObject.getId());
|
||||
if (id == gallery_menu_reply) {
|
||||
args.putInt("reply_to", currentMessageObject.getId());
|
||||
}
|
||||
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
|
||||
if (parentActivity instanceof LaunchActivity) {
|
||||
LaunchActivity launchActivity = (LaunchActivity) parentActivity;
|
||||
@ -5327,7 +5331,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
Browser.openUrl(parentActivity, MessageObject.getMedia(currentMessageObject.messageOwner).webpage.url);
|
||||
closePhoto(false, false);
|
||||
} else if (currentMessageObject != null) {
|
||||
if (AndroidUtilities.openForView(currentMessageObject, parentActivity, resourcesProvider)) {
|
||||
if (AndroidUtilities.openForView(currentMessageObject, parentActivity, resourcesProvider, currentMessageObject.isVideo() || currentMessageObject.isPhoto() || currentMessageObject.isSticker())) {
|
||||
closePhoto(false, false);
|
||||
} else {
|
||||
showDownloadAlert();
|
||||
@ -5683,6 +5687,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
menuItem.addSubItem(gallery_menu_savegif, R.drawable.msg_gif, LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_showinchat, R.drawable.msg_message, LocaleController.getString("ShowInChat", R.string.ShowInChat)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_masks2, R.drawable.msg_sticker, LocaleController.getString("ShowStickers", R.string.ShowStickers)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_reply, R.drawable.menu_reply, LocaleController.getString(R.string.Reply)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_share, R.drawable.msg_shareout, LocaleController.getString("ShareFile", R.string.ShareFile)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_save, R.drawable.msg_gallery, LocaleController.getString("SaveToGallery", R.string.SaveToGallery)).setColors(0xfffafafa, 0xfffafafa);
|
||||
menuItem.addSubItem(gallery_menu_copy, R.drawable.msg_copy, LocaleController.getString("CopyPhoto", R.string.CopyPhoto)).setColors(0xfffafafa, 0xfffafafa);
|
||||
@ -9639,7 +9644,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
builder.setMessage(LocaleController.getString("CantPlayVideo", R.string.CantPlayVideo));
|
||||
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), (dialog, which) -> {
|
||||
try {
|
||||
AndroidUtilities.openForView(currentMessageObject, parentActivity, resourcesProvider);
|
||||
AndroidUtilities.openForView(currentMessageObject, parentActivity, resourcesProvider, true);
|
||||
closePhoto(false, false);
|
||||
} catch (Exception e1) {
|
||||
FileLog.e(e1);
|
||||
@ -12810,6 +12815,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
dateOverride = 0;
|
||||
menuItem.hideSubItem(gallery_menu_showall);
|
||||
menuItem.hideSubItem(gallery_menu_showinchat);
|
||||
menuItem.hideSubItem(gallery_menu_reply);
|
||||
menuItem.hideSubItem(gallery_menu_share);
|
||||
menuItem.hideSubItem(gallery_menu_openin);
|
||||
menuItem.hideSubItem(gallery_menu_savegif);
|
||||
@ -12956,6 +12962,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
imagesByIds[0].put(messageObject.getId(), messageObject);
|
||||
if (parentChatActivity == null || !parentChatActivity.isThreadChat() && parentChatActivity.getChatMode() != ChatActivity.MODE_SAVED && parentChatActivity.getChatMode() != ChatActivity.MODE_QUICK_REPLIES) {
|
||||
menuItem.showSubItem(gallery_menu_showinchat);
|
||||
boolean canWrite = true;
|
||||
long dialogId = messageObject.getDialogId();
|
||||
if (dialogId < 0) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(messageObject.currentAccount).getChat(-dialogId);
|
||||
canWrite = ChatObject.canWriteToChat(chat);
|
||||
}
|
||||
if (canWrite) {
|
||||
menuItem.showSubItem(gallery_menu_reply);
|
||||
} else {
|
||||
menuItem.hideSubItem(gallery_menu_reply);
|
||||
}
|
||||
menuItem.showSubItem(gallery_menu_showall);
|
||||
}
|
||||
setItemVisible(sendItem, !noforwards, false);
|
||||
@ -13028,6 +13045,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
startOffset = object.starOffset;
|
||||
}
|
||||
menuItem.showSubItem(gallery_menu_showinchat);
|
||||
boolean canWrite = true;
|
||||
long dialogId = openingObject.getDialogId();
|
||||
if (dialogId < 0) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(openingObject.currentAccount).getChat(-dialogId);
|
||||
canWrite = ChatObject.canWriteToChat(chat);
|
||||
}
|
||||
if (canWrite) {
|
||||
menuItem.showSubItem(gallery_menu_reply);
|
||||
} else {
|
||||
menuItem.hideSubItem(gallery_menu_reply);
|
||||
}
|
||||
if (openingObject.canForwardMessage() && !noforwards) {
|
||||
setItemVisible(sendNoQuoteItem, true, false);
|
||||
setItemVisible(sendItem, true, false);
|
||||
|
@ -30,6 +30,7 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Space;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -116,7 +117,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
private boolean balanceEditTextAll = true;
|
||||
private long balanceEditTextValue;
|
||||
private EditTextBoldCursor balanceEditText;
|
||||
private ButtonWithCounterView balanceButton;
|
||||
private ButtonWithCounterView balanceButton, adsButton;
|
||||
private ColoredImageSpan[] starRef = new ColoredImageSpan[1];
|
||||
private int shakeDp = 4;
|
||||
|
||||
@ -241,7 +242,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
long balance = BotStarsController.getInstance(currentAccount).getBalance(bot_id);
|
||||
long balance = BotStarsController.getInstance(currentAccount).getAvailableBalance(bot_id);
|
||||
balanceEditTextValue = TextUtils.isEmpty(s) ? 0 : Long.parseLong(s.toString());
|
||||
if (balanceEditTextValue > balance) {
|
||||
balanceEditTextValue = balance;
|
||||
@ -274,37 +275,46 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
return false;
|
||||
});
|
||||
balanceLayout.addView(balanceEditTextContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 18, 14, 18, 2));
|
||||
balanceEditTextContainer.setVisibility(View.GONE);
|
||||
|
||||
final CircularProgressDrawable circularProgressDrawable = new CircularProgressDrawable(dp(15), dpf2(2), Theme.getColor(Theme.key_featuredStickers_buttonText, getResourceProvider())) {
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return dp(24);
|
||||
}
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
return dp(24);
|
||||
}
|
||||
};
|
||||
circularProgressDrawable.setBounds(0, 0, dp(24), dp(24));
|
||||
LinearLayout balanceButtonsLayout = new LinearLayout(context);
|
||||
balanceButtonsLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
|
||||
balanceButton = new ButtonWithCounterView(context, getResourceProvider()) {
|
||||
@Override
|
||||
protected boolean verifyDrawable(@NonNull Drawable who) {
|
||||
return who == circularProgressDrawable || super.verifyDrawable(who);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean subTextSplitToWords() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
balanceButton.setEnabled(MessagesController.getInstance(currentAccount).channelRevenueWithdrawalEnabled);
|
||||
circularProgressDrawable.setCallback(balanceButton);
|
||||
balanceButton.setText(getString(R.string.BotStarsButtonWithdrawAll), false);
|
||||
balanceButton.setText(getString(R.string.BotStarsButtonWithdrawShortAll), false);
|
||||
balanceButton.setOnClickListener(v -> {
|
||||
withdraw();
|
||||
});
|
||||
balanceLayout.addView(balanceButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.TOP | Gravity.FILL_HORIZONTAL, 18, 13, 18, 0));
|
||||
|
||||
adsButton = new ButtonWithCounterView(context, getResourceProvider());
|
||||
adsButton.setEnabled(true);
|
||||
adsButton.setText(getString(R.string.MonetizationStarsAds), false);
|
||||
adsButton.setOnClickListener(v -> {
|
||||
if (!v.isEnabled() || adsButton.isLoading()) return;
|
||||
|
||||
adsButton.setLoading(true);
|
||||
TLRPC.TL_payments_getStarsRevenueAdsAccountUrl req = new TLRPC.TL_payments_getStarsRevenueAdsAccountUrl();
|
||||
req.peer = MessagesController.getInstance(currentAccount).getInputPeer(bot_id);
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
|
||||
if (res instanceof TLRPC.TL_payments_starsRevenueAdsAccountUrl) {
|
||||
Browser.openUrl(context, ((TLRPC.TL_payments_starsRevenueAdsAccountUrl) res).url);
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
adsButton.setLoading(false);
|
||||
}, 1000);
|
||||
}));
|
||||
});
|
||||
|
||||
balanceButtonsLayout.addView(balanceButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 1, Gravity.FILL));
|
||||
balanceButtonsLayout.addView(new Space(context), LayoutHelper.createLinear(8, 48, 0, Gravity.FILL));
|
||||
balanceButtonsLayout.addView(adsButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 1, Gravity.FILL));
|
||||
balanceLayout.addView(balanceButtonsLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.TOP | Gravity.FILL_HORIZONTAL, 18, 13, 18, 0));
|
||||
|
||||
|
||||
listView = new UniversalRecyclerView(this, this::fillItems, this::onItemClick, this::onItemLongClick);
|
||||
@ -330,7 +340,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
Drawable starDrawable = getContext().getResources().getDrawable(R.drawable.star_small_inner).mutate();
|
||||
BulletinFactory.of(this).createSimpleBulletin(starDrawable, AndroidUtilities.replaceSingleTag(LocaleController.formatPluralString("BotStarsWithdrawMinLimit", (int) getMessagesController().starsRevenueWithdrawalMin), () -> {
|
||||
Bulletin.hideVisible();
|
||||
long balance = BotStarsController.getInstance(currentAccount).getBalance(bot_id);
|
||||
long balance = BotStarsController.getInstance(currentAccount).getAvailableBalance(bot_id);
|
||||
if (balance < getMessagesController().starsRevenueWithdrawalMin) {
|
||||
balanceEditTextAll = true;
|
||||
balanceEditTextValue = balance;
|
||||
@ -407,6 +417,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
balanceTitle.setText(ssb);
|
||||
balanceSubtitle.setText("≈" + BillingController.getInstance().formatCurrency(amount, "USD"));
|
||||
balanceEditTextContainer.setVisibility(amount > 0 ? View.VISIBLE : View.GONE);
|
||||
if (balanceEditTextAll) {
|
||||
balanceEditTextIgnore = true;
|
||||
balanceEditText.setText(Long.toString(balanceEditTextValue = crypto_amount));
|
||||
@ -426,7 +437,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
final int now = getConnectionsManager().getCurrentTime();
|
||||
balanceButton.setEnabled(balanceEditTextValue > 0 || balanceBlockedUntil > now);
|
||||
if (now < balanceBlockedUntil) {
|
||||
balanceButton.setText(getString(R.string.BotStarsButtonWithdrawUntil), true);
|
||||
balanceButton.setText(getString(R.string.BotStarsButtonWithdrawShortUntil), true);
|
||||
|
||||
if (lock == null) {
|
||||
lock = new SpannableStringBuilder("l");
|
||||
@ -446,7 +457,7 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
AndroidUtilities.runOnUIThread(this.setBalanceButtonText, 1000);
|
||||
} else {
|
||||
balanceButton.setSubText(null, true);
|
||||
balanceButton.setText(StarsIntroActivity.replaceStars(balanceEditTextAll ? getString(R.string.BotStarsButtonWithdrawAll) : LocaleController.formatPluralStringComma("BotStarsButtonWithdraw", (int) balanceEditTextValue, ' '), starRef), true);
|
||||
balanceButton.setText(StarsIntroActivity.replaceStars(balanceEditTextAll ? getString(R.string.BotStarsButtonWithdrawShortAll) : LocaleController.formatPluralStringComma("BotStarsButtonWithdrawShort", (int) balanceEditTextValue, ' '), starRef), true);
|
||||
}
|
||||
};
|
||||
|
||||
@ -492,7 +503,8 @@ public class BotStarsActivity extends BaseFragment implements NotificationCenter
|
||||
rate = stats.usd_rate;
|
||||
revenueChartData = StatisticActivity.createViewData(stats.revenue_graph, getString(R.string.BotStarsChartRevenue), 2);
|
||||
if (revenueChartData != null && revenueChartData.chartData != null && revenueChartData.chartData.lines != null && !revenueChartData.chartData.lines.isEmpty() && revenueChartData.chartData.lines.get(0) != null) {
|
||||
revenueChartData.chartData.lines.get(0).colorKey = Theme.key_statisticChartLine_golden;
|
||||
revenueChartData.showAll = true;
|
||||
revenueChartData.chartData.lines.get(0).colorKey = Theme.key_color_yellow;
|
||||
revenueChartData.chartData.yRate = (float) (1.0 / rate / 100.0);
|
||||
}
|
||||
setBalance(stats.status.available_balance, stats.status.next_withdrawal_at);
|
||||
|
@ -79,6 +79,11 @@ public class BotStarsController {
|
||||
return botStats == null ? 0 : botStats.status.current_balance;
|
||||
}
|
||||
|
||||
public long getAvailableBalance(long bot_id) {
|
||||
TLRPC.TL_payments_starsRevenueStats botStats = getRevenueStats(bot_id);
|
||||
return botStats == null ? 0 : botStats.status.available_balance;
|
||||
}
|
||||
|
||||
public boolean isBalanceAvailable(long bot_id) {
|
||||
return getRevenueStats(bot_id) != null;
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ public class StarsController {
|
||||
b.createSimpleBulletin(starDrawable, getString(R.string.StarsPurchaseCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsPurchaseCompletedInfo", (int) stars, product, bot))).show();
|
||||
}
|
||||
if (LaunchActivity.instance != null && LaunchActivity.instance.getFireworksOverlay() != null) {
|
||||
LaunchActivity.instance.getFireworksOverlay().start();
|
||||
LaunchActivity.instance.getFireworksOverlay().start(true);
|
||||
}
|
||||
|
||||
invalidateTransactions(true);
|
||||
|
@ -1636,7 +1636,7 @@ public class StatisticActivity extends BaseFragment implements NotificationCente
|
||||
}
|
||||
currentW += getChildAt(i).getMeasuredWidth();
|
||||
}
|
||||
setMeasuredDimension(getMeasuredWidth(), firstH + currentH + dp(16));
|
||||
setMeasuredDimension(getMeasuredWidth(), getChildCount() == 0 ? 0 : firstH + currentH + dp(16));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1999,7 +1999,11 @@ public class StatisticActivity extends BaseFragment implements NotificationCente
|
||||
progressView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
chartView.setData(viewData.chartData);
|
||||
if (chartView.setData(viewData.chartData)) {
|
||||
if (viewData.showAll) {
|
||||
chartView.pickerDelegate.set(0f, 1f);
|
||||
}
|
||||
}
|
||||
chartHeaderView.setUseWeekInterval(viewData.useWeekFormat);
|
||||
chartView.legendSignatureView.setUseWeek(viewData.useWeekFormat);
|
||||
|
||||
@ -2191,6 +2195,7 @@ public class StatisticActivity extends BaseFragment implements NotificationCente
|
||||
ChartData childChartData;
|
||||
String token;
|
||||
String zoomToken;
|
||||
public boolean showAll;
|
||||
|
||||
final int graphType;
|
||||
final String title;
|
||||
|
@ -2185,21 +2185,27 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
openCloseAnimator = ValueAnimator.ofFloat(0, 1f);
|
||||
openCloseAnimator.addUpdateListener(animation -> {
|
||||
progressToOpen = (float) animation.getAnimatedValue();
|
||||
containerView.checkHwAcceleration(progressToOpen);
|
||||
if (containerView != null) {
|
||||
containerView.checkHwAcceleration(progressToOpen);
|
||||
}
|
||||
checkNavBarColor();
|
||||
if (windowView != null) {
|
||||
windowView.invalidate();
|
||||
}
|
||||
});
|
||||
locker.lock();
|
||||
containerView.enableHwAcceleration();
|
||||
if (containerView != null) {
|
||||
containerView.enableHwAcceleration();
|
||||
}
|
||||
openCloseAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
progressToOpen = 1f;
|
||||
checkNavBarColor();
|
||||
animationInProgress = false;
|
||||
containerView.disableHwAcceleration();
|
||||
if (containerView != null) {
|
||||
containerView.disableHwAcceleration();
|
||||
}
|
||||
if (windowView != null) {
|
||||
windowView.invalidate();
|
||||
}
|
||||
@ -2221,42 +2227,43 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
showViewsAfterOpening = false;
|
||||
openViews();
|
||||
} else if (!SharedConfig.storiesIntroShown) {
|
||||
if (storiesIntro == null) {
|
||||
if (storiesIntro == null && containerView != null) {
|
||||
storiesIntro = new StoriesIntro(containerView.getContext(), windowView);
|
||||
storiesIntro.setAlpha(0f);
|
||||
containerView.addView(storiesIntro);
|
||||
}
|
||||
|
||||
storiesIntro.setOnClickListener(v -> {
|
||||
if (storiesIntro != null) {
|
||||
storiesIntro.setOnClickListener(v -> {
|
||||
storiesIntro.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(150L)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (storiesIntro != null) {
|
||||
storiesIntro.stopAnimation();
|
||||
containerView.removeView(storiesIntro);
|
||||
}
|
||||
storiesIntro = null;
|
||||
updatePlayingMode();
|
||||
}
|
||||
})
|
||||
.start();
|
||||
});
|
||||
storiesIntro.animate()
|
||||
.alpha(0f)
|
||||
.alpha(1f)
|
||||
.setDuration(150L)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (storiesIntro != null) {
|
||||
storiesIntro.stopAnimation();
|
||||
containerView.removeView(storiesIntro);
|
||||
storiesIntro.startAnimation(true);
|
||||
}
|
||||
storiesIntro = null;
|
||||
updatePlayingMode();
|
||||
}
|
||||
})
|
||||
.start();
|
||||
});
|
||||
storiesIntro.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(150L)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
if (storiesIntro != null) {
|
||||
storiesIntro.startAnimation(true);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}).start();
|
||||
}
|
||||
|
||||
SharedConfig.setStoriesIntroShown(true);
|
||||
}
|
||||
@ -2297,7 +2304,9 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
}
|
||||
transitionViewHolder.storyImage = null;
|
||||
transitionViewHolder.avatarImage = null;
|
||||
containerView.disableHwAcceleration();
|
||||
if (containerView != null) {
|
||||
containerView.disableHwAcceleration();
|
||||
}
|
||||
locker.unlock();
|
||||
if (currentPlayerScope != null) {
|
||||
currentPlayerScope.invalidate();
|
||||
@ -2349,17 +2358,21 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (openCloseAnimator == null) {
|
||||
return;
|
||||
}
|
||||
containerView.enableHwAcceleration();
|
||||
if (containerView != null) {
|
||||
containerView.enableHwAcceleration();
|
||||
}
|
||||
openCloseAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
containerView.disableHwAcceleration();
|
||||
if (containerView != null) {
|
||||
containerView.disableHwAcceleration();
|
||||
}
|
||||
checkNavBarColor();
|
||||
locker.unlock();
|
||||
if (storiesIntro != null) {
|
||||
storiesIntro.stopAnimation();
|
||||
containerView.removeView(storiesIntro);
|
||||
AndroidUtilities.removeFromParent(storiesIntro);
|
||||
storiesIntro = null;
|
||||
}
|
||||
if (transitionViewHolder.avatarImage != null) {
|
||||
@ -2621,7 +2634,9 @@ public class StoryViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
if (peerStoriesView != null) {
|
||||
peerStoriesView.invalidate();
|
||||
}
|
||||
containerView.invalidate();
|
||||
if (containerView != null) {
|
||||
containerView.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void openViews() {
|
||||
|
@ -139,7 +139,7 @@ public class BotBiometry {
|
||||
|
||||
public void updateToken(String reason, String token, Utilities.Callback<Boolean> whenDone) {
|
||||
prompt(reason, false, token, result -> {
|
||||
boolean success = true;
|
||||
boolean success = result != null;
|
||||
if (result != null) {
|
||||
try {
|
||||
BiometricPrompt.CryptoObject cryptoObject = result.getCryptoObject();
|
||||
|
@ -250,9 +250,6 @@ public class BotWebViewAttachedSheet implements NotificationCenter.NotificationC
|
||||
if (backDrawable != null) {
|
||||
backDrawable.setRotation(backButtonShown ? 0f : 1f, false);
|
||||
}
|
||||
if (settingsItem != null) {
|
||||
settingsItem.setVisibility(tab.settings ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (tab.main != null) {
|
||||
setMainButton(tab.main);
|
||||
}
|
||||
@ -288,6 +285,9 @@ public class BotWebViewAttachedSheet implements NotificationCenter.NotificationC
|
||||
tab.props.responseTime = 0;
|
||||
}
|
||||
requestWebView(fragment, tab.props);
|
||||
if (settingsItem != null) {
|
||||
settingsItem.setVisibility(tab.settings ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -250,6 +250,7 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
|
||||
tab.backButton = backButtonShown;
|
||||
tab.main = mainButtonSettings;
|
||||
tab.confirmDismiss = needCloseConfirmation;
|
||||
tab.settings = settingsItem != null && settingsItem.getVisibility() == View.VISIBLE;
|
||||
BotWebViewContainer.MyWebView webView = webViewContainer == null ? null : webViewContainer.getWebView();
|
||||
if (webView != null) {
|
||||
webViewContainer.preserveWebView();
|
||||
@ -313,6 +314,9 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
|
||||
tab.props.responseTime = 0;
|
||||
}
|
||||
requestWebView(fragment, tab.props);
|
||||
if (settingsItem != null) {
|
||||
settingsItem.setVisibility(tab.settings ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public final class ApkInstaller {
|
||||
dialog = null;
|
||||
}
|
||||
AlertsCreator.createSimpleAlert(context, LocaleController.getString(R.string.ErrorOccurred) + "\n" + e.getLocalizedMessage()).show();
|
||||
AndroidUtilities.openForView(apk, "install.apk", "application/vnd.android.package-archive", context, null);
|
||||
AndroidUtilities.openForView(apk, "install.apk", "application/vnd.android.package-archive", context, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9024,6 +9024,10 @@
|
||||
<string name="BotStarsWithdrawInfoLink">https://telegram.org/privacy</string>
|
||||
<string name="BotStarsButtonWithdrawUntil">Withdraw via Fragment</string>
|
||||
<string name="BotStarsButtonWithdrawAll">Withdraw all via Fragment</string>
|
||||
<string name="BotStarsButtonWithdrawShortAll">Withdraw all</string>
|
||||
<string name="BotStarsButtonWithdrawShort_one">Withdraw ⭐️%d</string>
|
||||
<string name="BotStarsButtonWithdrawShort_other">Withdraw ⭐️%d</string>
|
||||
<string name="BotStarsButtonWithdrawShortUntil">Withdraw</string>
|
||||
<string name="BotStarsWithdrawPlaceholder">Enter amount to withdraw</string>
|
||||
<string name="BotStarsButtonWithdraw_one">Withdraw ⭐️%d via Fragment</string>
|
||||
<string name="BotStarsButtonWithdraw_other">Withdraw ⭐️%d via Fragment</string>
|
||||
|
Loading…
Reference in New Issue
Block a user