mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Update to 8.3.1
This commit is contained in:
parent
3477d72367
commit
4a43f809b3
35 changed files with 1206 additions and 870 deletions
|
@ -299,7 +299,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 2493
|
||||
defaultConfig.versionCode = 2495
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
|
@ -318,7 +318,7 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionName "8.3.0"
|
||||
versionName "8.3.1"
|
||||
|
||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
@ -18,7 +18,7 @@
|
|||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
|
||||
<permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
@ -18,7 +18,7 @@
|
|||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
|
||||
<permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS"/>
|
||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ"/>
|
||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
|
@ -80,6 +80,7 @@
|
|||
android:manageSpaceActivity="org.telegram.ui.ExternalActionActivity"
|
||||
android:supportsRtl="false"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
android:allowAudioPlaybackCapture="true"
|
||||
tools:replace="android:supportsRtl">
|
||||
|
||||
|
@ -448,6 +449,7 @@
|
|||
<!-- <service android:name=".FeedWidgetService"-->
|
||||
<!-- android:permission="android.permission.BIND_REMOTEVIEWS"-->
|
||||
<!-- android:exported="false" />-->
|
||||
<service android:name=".FilesMigrationService" android:exported="false"/>
|
||||
|
||||
<uses-library android:name="com.sec.android.app.multiwindow" android:required="false" />
|
||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||
|
|
|
@ -19,18 +19,14 @@ public class BuildVars {
|
|||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||
public static int BUILD_VERSION = 2493;
|
||||
public static String BUILD_VERSION_STRING = "8.3.0";
|
||||
public static int BUILD_VERSION = 2495;
|
||||
public static String BUILD_VERSION_STRING = "8.3.1";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";
|
||||
// PUBLIC
|
||||
|
||||
public static boolean DEBUG_PRIVATE_VERSION = false;
|
||||
// public static String APPCENTER_HASH_DEBUG = "f9726602-67c9-48d2-b5d0-4761f1c1a8f3";
|
||||
// PRIVATE
|
||||
//public static boolean DEBUG_PRIVATE_VERSION = true;
|
||||
//public static String APPCENTER_HASH_DEBUG = DEBUG_PRIVATE_VERSION ? "29d0a6f1-b92f-493a-9fce-445681d767ec" : "f9726602-67c9-48d2-b5d0-4761f1c1a8f3";
|
||||
//
|
||||
|
||||
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
|
||||
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ public class FileLog {
|
|||
if (!BuildVars.LOGS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
if (BuildVars.DEBUG_VERSION && needSent(e)) {
|
||||
if (BuildVars.DEBUG_VERSION && needSent(e) && logToAppCenter) {
|
||||
AndroidUtilities.appCenterLog(e);
|
||||
}
|
||||
ensureInitied();
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
package org.telegram.messenger;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.ActionBar.BottomSheet;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.StickerImageView;
|
||||
import org.telegram.ui.DialogsActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.R)
|
||||
public class FilesMigrationService extends Service {
|
||||
|
||||
public static boolean hasOldFolder;
|
||||
public static boolean isRunning;
|
||||
public static FilesMigrationBottomSheet filesMigrationBottomSheet;
|
||||
private int totalFilesCount;
|
||||
private int movedFilesCount;
|
||||
private static boolean wasShown = false;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void start() {
|
||||
Intent intent = new Intent(ApplicationLoader.applicationContext, FilesMigrationService.class);
|
||||
ApplicationLoader.applicationContext.startService(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
NotificationsController.checkOtherNotificationsChannel();
|
||||
Notification notification = new Notification.Builder(this, NotificationsController.OTHER_NOTIFICATIONS_CHANNEL)
|
||||
.setContentTitle(getText(R.string.MigratingFiles))
|
||||
.setAutoCancel(false)
|
||||
.setSmallIcon(R.drawable.notification)
|
||||
.build();
|
||||
|
||||
isRunning = true;
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
migrateOldFolder();
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
isRunning = false;
|
||||
stopForeground(true);
|
||||
stopSelf();
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
startForeground(301, notification);
|
||||
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
public void migrateOldFolder() {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
|
||||
ArrayList<File> dirs = AndroidUtilities.getRootDirs();
|
||||
if (dirs != null) {
|
||||
for (int a = 0, N = dirs.size(); a < N; a++) {
|
||||
File dir = dirs.get(a);
|
||||
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
|
||||
path = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File newPath = ApplicationLoader.applicationContext.getExternalFilesDir(null);
|
||||
File telegramPath = new File(newPath, "Telegram");
|
||||
File oldPath = new File(path, "Telegram");
|
||||
|
||||
totalFilesCount = getFilesCount(oldPath);
|
||||
|
||||
long moveStart = System.currentTimeMillis();
|
||||
if (oldPath.canRead() && oldPath.canWrite()) {
|
||||
moveDirectory(oldPath, telegramPath);
|
||||
}
|
||||
long dt = System.currentTimeMillis() - moveStart;
|
||||
|
||||
FileLog.d("move time = " + dt);
|
||||
|
||||
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
||||
sharedPreferences.edit().putBoolean("migration_to_scoped_storage_finished", true).apply();
|
||||
}
|
||||
|
||||
private int getFilesCount(File source) {
|
||||
if (!source.exists()) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
File[] fileList = source.listFiles();
|
||||
if (fileList != null) {
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].isDirectory()) {
|
||||
count += getFilesCount(fileList[i]);
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void moveDirectory(File source, File target) {
|
||||
if (!source.exists() || (!target.exists() && !target.mkdir())) {
|
||||
return;
|
||||
}
|
||||
try (Stream<Path> files = Files.list(source.toPath())) {
|
||||
files.forEach(path -> {
|
||||
File dest = new File(target, path.getFileName().toString());
|
||||
if (Files.isDirectory(path)) {
|
||||
moveDirectory(path.toFile(), dest);
|
||||
} else {
|
||||
try {
|
||||
Files.move(path, dest.toPath());
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e, false);
|
||||
try {
|
||||
path.toFile().delete();
|
||||
} catch (Exception e1) {
|
||||
FileLog.e(e1);
|
||||
}
|
||||
}
|
||||
movedFilesCount++;
|
||||
updateProgress();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
try {
|
||||
source.delete();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
long lastUpdateTime;
|
||||
private void updateProgress() {
|
||||
long time = System.currentTimeMillis();
|
||||
if (time - lastUpdateTime > 20 || movedFilesCount >= totalFilesCount - 1) {
|
||||
int currentCount = movedFilesCount;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
Notification notification = new Notification.Builder(FilesMigrationService.this, NotificationsController.OTHER_NOTIFICATIONS_CHANNEL)
|
||||
.setContentTitle(getText(R.string.MigratingFiles))
|
||||
.setContentText(String.format("%s/%s", currentCount, totalFilesCount))
|
||||
.setSmallIcon(R.drawable.notification)
|
||||
.setAutoCancel(false)
|
||||
.setProgress(totalFilesCount, currentCount, false)
|
||||
.build();
|
||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(301, notification);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkBottomSheet(BaseFragment fragment) {
|
||||
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
||||
if (!Environment.isExternalStorageLegacy() || sharedPreferences.getBoolean("migration_to_scoped_storage_finished", false) || sharedPreferences.getInt("migration_to_scoped_storage_count", 0) >= 5 || wasShown || filesMigrationBottomSheet != null || isRunning) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
|
||||
ArrayList<File> dirs = AndroidUtilities.getRootDirs();
|
||||
if (dirs != null) {
|
||||
for (int a = 0, N = dirs.size(); a < N; a++) {
|
||||
File dir = dirs.get(a);
|
||||
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
|
||||
path = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File oldDirectory = new File(path, "Telegram");
|
||||
hasOldFolder = oldDirectory.exists();
|
||||
}
|
||||
if (hasOldFolder) {
|
||||
filesMigrationBottomSheet = new FilesMigrationBottomSheet(fragment);
|
||||
filesMigrationBottomSheet.show();
|
||||
wasShown = true;
|
||||
sharedPreferences.edit().putInt("migration_to_scoped_storage_count", sharedPreferences.getInt("migration_to_scoped_storage_count", 0) + 1).apply();
|
||||
} else {
|
||||
sharedPreferences.edit().putBoolean("migration_to_scoped_storage_finished", true).apply();
|
||||
}
|
||||
}
|
||||
|
||||
public static class FilesMigrationBottomSheet extends BottomSheet {
|
||||
|
||||
BaseFragment fragment;
|
||||
|
||||
@Override
|
||||
protected boolean canDismissWithSwipe() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDismissWithTouchOutside() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public FilesMigrationBottomSheet(BaseFragment fragment) {
|
||||
super(fragment.getParentActivity(), false);
|
||||
this.fragment = fragment;
|
||||
setCanceledOnTouchOutside(false);
|
||||
Context context = fragment.getParentActivity();
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
StickerImageView imageView = new StickerImageView(context, currentAccount);
|
||||
imageView.setStickerNum(7);
|
||||
imageView.getImageReceiver().setAutoRepeat(1);
|
||||
linearLayout.addView(imageView, LayoutHelper.createLinear(144, 144, Gravity.CENTER_HORIZONTAL, 0, 16, 0, 0));
|
||||
|
||||
TextView title = new TextView(context);
|
||||
title.setGravity(Gravity.START);
|
||||
title.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||
title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
|
||||
title.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
title.setText(LocaleController.getString("MigrateOldFolderTitle", R.string.MigrateOldFolderTitle));
|
||||
linearLayout.addView(title, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 21, 30, 21, 0));
|
||||
|
||||
TextView description = new TextView(context);
|
||||
description.setGravity(Gravity.START);
|
||||
description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
description.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||
description.setText(AndroidUtilities.replaceTags(LocaleController.getString("MigrateOldFolderDescription", R.string.MigrateOldFolderDescription)));
|
||||
linearLayout.addView(description, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 21, 15, 21, 16));
|
||||
|
||||
|
||||
TextView buttonTextView = new TextView(context);
|
||||
buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0);
|
||||
buttonTextView.setGravity(Gravity.CENTER);
|
||||
buttonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
buttonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
buttonTextView.setText(LocaleController.getString("MigrateOldFolderButton", R.string.MigrateOldFolderButton));
|
||||
|
||||
buttonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
|
||||
buttonTextView.setBackgroundDrawable(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_featuredStickers_addButton), ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_windowBackgroundWhite), 120)));
|
||||
|
||||
linearLayout.addView(buttonTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, 0, 16, 15, 16, 16));
|
||||
|
||||
buttonTextView.setOnClickListener(view -> {
|
||||
migrateOldFolder();
|
||||
});
|
||||
|
||||
ScrollView scrollView = new ScrollView(context);
|
||||
scrollView.addView(linearLayout);
|
||||
setCustomView(scrollView);
|
||||
}
|
||||
|
||||
public void migrateOldFolder() {
|
||||
Activity activity = fragment.getParentActivity();
|
||||
boolean canWrite = activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
||||
boolean canRead = activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
if (!canRead || !canWrite) {
|
||||
ArrayList<String> permissions = new ArrayList<>();
|
||||
if (!canRead) {
|
||||
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
if (!canWrite) {
|
||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
String[] string = new String[permissions.size()];
|
||||
activity.requestPermissions(permissions.toArray(string), 4);
|
||||
return;
|
||||
}
|
||||
start();
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
filesMigrationBottomSheet = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4722,20 +4722,26 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
});
|
||||
}
|
||||
|
||||
public void deleteUserChannelHistory(TLRPC.Chat chat, TLRPC.User user, int offset) {
|
||||
public void deleteUserChannelHistory(TLRPC.Chat currentChat, TLRPC.User fromUser, TLRPC.Chat fromChat, int offset) {
|
||||
long fromId = 0;
|
||||
if (fromUser != null) {
|
||||
fromId = fromUser.id;
|
||||
} else if (fromChat != null){
|
||||
fromId = fromChat.id;
|
||||
}
|
||||
if (offset == 0) {
|
||||
getMessagesStorage().deleteUserChatHistory(-chat.id, user.id);
|
||||
getMessagesStorage().deleteUserChatHistory(-currentChat.id, fromId);
|
||||
}
|
||||
TLRPC.TL_channels_deleteParticipantHistory req = new TLRPC.TL_channels_deleteParticipantHistory();
|
||||
req.channel = getInputChannel(chat);
|
||||
req.participant = getInputPeer(user);
|
||||
req.channel = getInputChannel(currentChat);
|
||||
req.participant = fromUser != null ? getInputPeer(fromUser) : getInputPeer(fromChat);
|
||||
getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||
if (error == null) {
|
||||
TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response;
|
||||
if (res.offset > 0) {
|
||||
deleteUserChannelHistory(chat, user, res.offset);
|
||||
deleteUserChannelHistory(currentChat, fromUser, fromChat, res.offset);
|
||||
}
|
||||
processNewChannelDifferenceParams(res.pts, res.pts_count, chat.id);
|
||||
processNewChannelDifferenceParams(res.pts, res.pts_count, currentChat.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -14810,10 +14816,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
}
|
||||
|
||||
public void markSponsoredAsRead(long dialog_id, MessageObject object) {
|
||||
ArrayList<MessageObject> messages = getSponsoredMessages(dialog_id);
|
||||
if (messages != null) {
|
||||
messages.remove(object);
|
||||
}
|
||||
sponsoredMessages.remove(dialog_id);
|
||||
}
|
||||
|
||||
public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) {
|
||||
|
|
|
@ -292,7 +292,7 @@ public class MessagesStorage extends BaseController {
|
|||
shmCacheFile = new File(filesDir, "cache4.db-shm");
|
||||
|
||||
boolean createTable = false;
|
||||
//cacheFile.delete();
|
||||
|
||||
if (!cacheFile.exists()) {
|
||||
createTable = true;
|
||||
}
|
||||
|
@ -452,6 +452,9 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
cursor.dispose();
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null && e.getMessage().contains("malformed")) {
|
||||
throw new RuntimeException("malformed");
|
||||
}
|
||||
FileLog.e(e);
|
||||
try {
|
||||
database.executeFast("CREATE TABLE IF NOT EXISTS params(id INTEGER PRIMARY KEY, seq INTEGER, pts INTEGER, date INTEGER, qts INTEGER, lsv INTEGER, sg INTEGER, pbytes BLOB)").stepThis().dispose();
|
||||
|
@ -6015,6 +6018,9 @@ public class MessagesStorage extends BaseController {
|
|||
participant = TLRPC.ChannelParticipant.TLdeserialize(data, data.readInt32(false), false);
|
||||
data.reuse();
|
||||
}
|
||||
if (participant != null && participant.user_id == getUserConfig().clientUserId) {
|
||||
user = getUserConfig().getCurrentUser();
|
||||
}
|
||||
if (user != null && participant != null) {
|
||||
if (user.status != null) {
|
||||
user.status.expires = cursor.intValue(1);
|
||||
|
@ -8748,7 +8754,7 @@ public class MessagesStorage extends BaseController {
|
|||
try {
|
||||
SQLitePreparedStatement state = database.executeFast("UPDATE messages_v2 SET replies_data = ? WHERE mid = ? AND uid = ?");
|
||||
TLRPC.MessageReplies currentReplies = null;
|
||||
SQLiteCursor cursor = database.queryFinalized(String.format("SELECT replies_data FROM messages_v2 WHERE mid = %d AND uid = %d", mid, -chatId));
|
||||
SQLiteCursor cursor = database.queryFinalized(String.format(Locale.ENGLISH, "SELECT replies_data FROM messages_v2 WHERE mid = %d AND uid = %d", mid, -chatId));
|
||||
if (cursor.next()) {
|
||||
NativeByteBuffer data = cursor.byteBufferValue(0);
|
||||
if (data != null) {
|
||||
|
|
|
@ -13,6 +13,8 @@ import androidx.annotation.UiThread;
|
|||
import android.os.SystemClock;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
|
|
@ -1025,7 +1025,7 @@ public class ConnectionsManager extends BaseController {
|
|||
httpConnectionStream.close();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
FileLog.e(e, false);
|
||||
}
|
||||
try {
|
||||
if (outbuf != null) {
|
||||
|
|
|
@ -49906,10 +49906,10 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_channels_reportSpam extends TLObject {
|
||||
public static int constructor = 0xfe087810;
|
||||
public static int constructor = 0xf44a8315;
|
||||
|
||||
public InputChannel channel;
|
||||
public InputUser user_id;
|
||||
public InputPeer participant;
|
||||
public ArrayList<Integer> id = new ArrayList<>();
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
|
@ -49919,7 +49919,7 @@ public class TLRPC {
|
|||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
channel.serializeToStream(stream);
|
||||
user_id.serializeToStream(stream);
|
||||
participant.serializeToStream(stream);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = id.size();
|
||||
stream.writeInt32(count);
|
||||
|
|
|
@ -1590,6 +1590,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||
if (view != null && view.getVisibility() != GONE) {
|
||||
view.setVisibility(GONE);
|
||||
measurePopup = true;
|
||||
checkHideMenuItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1618,6 +1619,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||
popupLayout.getItemAt(a).setVisibility(GONE);
|
||||
}
|
||||
measurePopup = true;
|
||||
checkHideMenuItem();
|
||||
}
|
||||
|
||||
public boolean isSubItemVisible(int id) {
|
||||
|
@ -1636,6 +1638,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||
if (view != null && view.getVisibility() != VISIBLE) {
|
||||
view.setVisibility(VISIBLE);
|
||||
measurePopup = true;
|
||||
checkHideMenuItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,11 @@ package org.telegram.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.transition.ChangeBounds;
|
||||
import android.transition.Fade;
|
||||
|
@ -25,7 +23,6 @@ import android.transition.TransitionSet;
|
|||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
@ -35,18 +32,14 @@ import androidx.core.widget.NestedScrollView;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
|
||||
import org.telegram.SQLite.SQLiteCursor;
|
||||
import org.telegram.SQLite.SQLiteDatabase;
|
||||
import org.telegram.SQLite.SQLitePreparedStatement;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.BuildConfig;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.DialogObject;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.FilesMigrationService;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
|
@ -79,11 +72,7 @@ import org.telegram.ui.Components.StroageUsageView;
|
|||
import org.telegram.ui.Components.UndoView;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.CopyOption;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CacheControlActivity extends BaseFragment {
|
||||
|
||||
|
@ -118,7 +107,6 @@ public class CacheControlActivity extends BaseFragment {
|
|||
private boolean calculating = true;
|
||||
|
||||
private volatile boolean canceled = false;
|
||||
private boolean hasOldFolder;
|
||||
|
||||
private View bottomSheetView;
|
||||
private BottomSheet bottomSheet;
|
||||
|
@ -213,24 +201,6 @@ public class CacheControlActivity extends BaseFragment {
|
|||
});
|
||||
|
||||
fragmentCreateTime = System.currentTimeMillis();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
|
||||
ArrayList<File> dirs = AndroidUtilities.getRootDirs();
|
||||
if (dirs != null) {
|
||||
for (int a = 0, N = dirs.size(); a < N; a++) {
|
||||
File dir = dirs.get(a);
|
||||
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
|
||||
path = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File oldDirectory = new File(path, "Telegram");
|
||||
hasOldFolder = oldDirectory.exists();
|
||||
}
|
||||
updateRows();
|
||||
return true;
|
||||
}
|
||||
|
@ -247,9 +217,6 @@ public class CacheControlActivity extends BaseFragment {
|
|||
cacheInfoRow = rowCount++;
|
||||
databaseRow = rowCount++;
|
||||
databaseInfoRow = rowCount++;
|
||||
// if (hasOldFolder) {
|
||||
// migrateOldFolderRow = rowCount++;
|
||||
// }
|
||||
}
|
||||
|
||||
private void updateStorageUsageRow() {
|
||||
|
@ -569,111 +536,7 @@ public class CacheControlActivity extends BaseFragment {
|
|||
|
||||
@RequiresApi(api = Build.VERSION_CODES.R)
|
||||
private void migrateOldFolder() {
|
||||
boolean isExternalStorageManager = Environment.isExternalStorageManager();
|
||||
|
||||
if (!BuildVars.NO_SCOPED_STORAGE && !isExternalStorageManager) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("MigrateOldFolder", R.string.MigrateOldFolder));
|
||||
builder.setMessage(LocaleController.getString("ManageAllFilesRational2", R.string.ManageAllFilesRational2));
|
||||
builder.setPositiveButton(LocaleController.getString("Allow", R.string.Allow), (i1, i2) -> {
|
||||
Uri uri = Uri.parse("package:" + BuildConfig.APPLICATION_ID);
|
||||
getParentActivity().startActivity(new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri));
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (i1, i2) -> {
|
||||
|
||||
});
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
|
||||
Thread thread = new Thread() {
|
||||
|
||||
int totalFilesCount;
|
||||
int movedFilesCount;
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
|
||||
ArrayList<File> dirs = AndroidUtilities.getRootDirs();
|
||||
if (dirs != null) {
|
||||
for (int a = 0, N = dirs.size(); a < N; a++) {
|
||||
File dir = dirs.get(a);
|
||||
if (dir.getAbsolutePath().startsWith(SharedConfig.storageCacheDir)) {
|
||||
path = dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File newPath = ApplicationLoader.applicationContext.getExternalFilesDir(null);
|
||||
File telegramPath = new File(newPath, "Telegram");
|
||||
File oldPath = new File(path, "Telegram");
|
||||
|
||||
totalFilesCount = getFilesCount(oldPath);
|
||||
|
||||
long moveStart = System.currentTimeMillis();
|
||||
moveDirectory(oldPath, telegramPath);
|
||||
long dt = System.currentTimeMillis() - moveStart;
|
||||
FileLog.d("move time = " + dt);
|
||||
}
|
||||
|
||||
private int getFilesCount(File source) {
|
||||
if (!source.exists()) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
File[] fileList = source.listFiles();
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].isDirectory()) {
|
||||
count += getFilesCount(fileList[i]);
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void moveDirectory(File source, File target) {
|
||||
if (!source.exists() || (!target.exists() && !target.mkdir())) {
|
||||
return;
|
||||
}
|
||||
try (Stream<Path> files = Files.list(source.toPath())) {
|
||||
files.forEach(path -> {
|
||||
File dest = new File(target, path.getFileName().toString());
|
||||
if (Files.isDirectory(path)) {
|
||||
moveDirectory(path.toFile(), dest);
|
||||
} else {
|
||||
try {
|
||||
Files.move(path, dest.toPath());
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
try {
|
||||
path.toFile().delete();
|
||||
} catch (Exception e1) {
|
||||
FileLog.e(e1);
|
||||
}
|
||||
}
|
||||
movedFilesCount++;
|
||||
updateProgress();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
try {
|
||||
source.delete();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProgress() {
|
||||
float p = movedFilesCount / (float) totalFilesCount;
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
FilesMigrationService.checkBottomSheet(this);
|
||||
}
|
||||
|
||||
private void clearDatabase() {
|
||||
|
@ -982,4 +845,21 @@ public class CacheControlActivity extends BaseFragment {
|
|||
arrayList.add(new ThemeDescription(bottomSheetView, 0, null, null, null, null, Theme.key_statisticChartLine_indigo));
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (requestCode == 4) {
|
||||
boolean allGranted = true;
|
||||
for (int a = 0; a < grantResults.length; a++) {
|
||||
if (grantResults[a] != PackageManager.PERMISSION_GRANTED) {
|
||||
allGranted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allGranted && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && FilesMigrationService.filesMigrationBottomSheet != null) {
|
||||
FilesMigrationService.filesMigrationBottomSheet.migrateOldFolder();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD
|
|||
} else if (url.startsWith("http")) {
|
||||
Browser.openUrl(getContext(), url);
|
||||
} else {
|
||||
delegate.needOpenUserProfile(Integer.parseInt(url));
|
||||
delegate.needOpenUserProfile(Long.parseLong(url));
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
|
|
|
@ -105,6 +105,16 @@ public class SessionCell extends FrameLayout {
|
|||
linearLayout.addView(onlineTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.RIGHT | Gravity.TOP, 0, 2, 0, 0));
|
||||
}
|
||||
|
||||
int leftMargin;
|
||||
int rightMargin;
|
||||
if (LocaleController.isRTL) {
|
||||
rightMargin = type == 0 ? 72 : 21;
|
||||
leftMargin = 21;
|
||||
} else {
|
||||
leftMargin = type == 0 ? 72 : 21;
|
||||
rightMargin = 21;
|
||||
}
|
||||
|
||||
detailTextView = new TextView(context);
|
||||
detailTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
detailTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
|
@ -113,7 +123,7 @@ public class SessionCell extends FrameLayout {
|
|||
detailTextView.setSingleLine(true);
|
||||
detailTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
detailTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(detailTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, type == 0 ? 72 : 21, 36, 21, 0));
|
||||
addView(detailTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, leftMargin, 36, rightMargin, 0));
|
||||
|
||||
detailExTextView = new TextView(context);
|
||||
detailExTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
|
||||
|
@ -123,7 +133,7 @@ public class SessionCell extends FrameLayout {
|
|||
detailExTextView.setSingleLine(true);
|
||||
detailExTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
detailExTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, type == 0 ? 72 : 21, 59, 21, 0));
|
||||
addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, leftMargin, 59, rightMargin, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,11 +146,7 @@ public class SessionCell extends FrameLayout {
|
|||
|
||||
if (object instanceof TLRPC.TL_authorization) {
|
||||
TLRPC.TL_authorization session = (TLRPC.TL_authorization) object;
|
||||
|
||||
|
||||
imageView.setImageDrawable(createDrawable(session));
|
||||
// nameTextView.setText(String.format(Locale.US, "%s %s", session.app_name, session.app_version));
|
||||
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (session.device_model.length() != 0) {
|
||||
|
|
|
@ -1794,9 +1794,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
* @return Other same chats index difference
|
||||
*/
|
||||
public int getOtherSameChatsDiff() {
|
||||
if (parentLayout == null || parentLayout.fragmentsStack == null) {
|
||||
return 0;
|
||||
}
|
||||
int cur = parentLayout.fragmentsStack.indexOf(this);
|
||||
if (cur == -1)
|
||||
if (cur == -1) {
|
||||
cur = parentLayout.fragmentsStack.size();
|
||||
}
|
||||
int i = cur;
|
||||
for (int a = 0; a < parentLayout.fragmentsStack.size(); a++) {
|
||||
BaseFragment fragment = parentLayout.fragmentsStack.get(a);
|
||||
|
@ -2344,6 +2348,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
actionBar.setSubtitle(LocaleController.getString("NoMessagesForThisDay", R.string.NoMessagesForThisDay));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2388,7 +2394,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, true, 0.95f, true);
|
||||
if (editTextItem != null && editTextItem.getTag() != null) {
|
||||
if (headerItem != null) {
|
||||
Log.d("kek", "2");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (editTextItem != null) {
|
||||
|
@ -2405,7 +2410,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
} else if (chatActivityEnterView.hasText() && TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer()) && (currentChat == null || ChatObject.canSendMessages(currentChat))) {
|
||||
if (headerItem != null) {
|
||||
Log.d("kek", "3");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (editTextItem != null) {
|
||||
|
@ -2516,7 +2520,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
searchItemVisible = false;
|
||||
}
|
||||
|
||||
if (chatMode == 0 && threadMessageId == 0 && !UserObject.isReplyUser(currentUser) && reportType < 0) {
|
||||
if (chatMode == 0 && threadMessageId == 0 && !UserObject.isReplyUser(currentUser) && reportType < 0 && !inMenuMode) {
|
||||
TLRPC.UserFull userFull = null;
|
||||
if (currentUser != null) {
|
||||
audioCallIconItem = menu.addItem(call, R.drawable.ic_call, themeDelegate);
|
||||
|
@ -6972,7 +6976,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (editTextItem.getTag() == null) {
|
||||
editTextItem.setTag(1);
|
||||
editTextItem.setVisibility(View.VISIBLE);
|
||||
Log.d("kek", "4");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
attachItem.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -6983,7 +6986,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
editTextItem.setTag(null);
|
||||
editTextItem.setVisibility(View.GONE);
|
||||
if (chatActivityEnterView.hasText() && TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer())) {
|
||||
Log.d("kek", "5");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
attachItem.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
@ -7045,7 +7047,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
if (TextUtils.isEmpty(chatActivityEnterView.getSlowModeTimer())) {
|
||||
if (headerItem != null) {
|
||||
Log.d("kek", "6");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (attachItem != null) {
|
||||
|
@ -14171,14 +14172,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
if (startLoadFromDate != 0) {
|
||||
int dateObjectIndex = -1;
|
||||
int closeDateObjectIndex = -1;
|
||||
int closeDateDiff = 0;
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
if (messages.get(i).isDateObject && Math.abs(startLoadFromDate - messages.get(i).messageOwner.date) <= 100) {
|
||||
dateObjectIndex = i;
|
||||
break;
|
||||
}
|
||||
if (messages.get(i).isDateObject) {
|
||||
int timeDiff = Math.abs(startLoadFromDate - messages.get(i).messageOwner.date);
|
||||
if (closeDateObjectIndex == -1 || timeDiff < closeDateDiff) {
|
||||
closeDateDiff = timeDiff;
|
||||
closeDateObjectIndex = i;
|
||||
}
|
||||
if (dateObjectIndex > 0) {
|
||||
}
|
||||
}
|
||||
if (dateObjectIndex >= 0) {
|
||||
chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + dateObjectIndex, (int) (AndroidUtilities.dp(4)), false);
|
||||
} else if (closeDateObjectIndex >= 0) {
|
||||
chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + closeDateObjectIndex, chatListView.getMeasuredHeight() / 2 - AndroidUtilities.dp(24), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21901,7 +21913,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (!actionBar.isSearchFieldVisible()) {
|
||||
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, false, 0.95f, true);
|
||||
if (headerItem != null) {
|
||||
Log.d("kek", "1");
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (attachItem != null) {
|
||||
|
@ -22964,7 +22975,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
view = new ChatMessageCell(mContext, true, themeDelegate);
|
||||
}
|
||||
ChatMessageCell chatMessageCell = (ChatMessageCell) view;
|
||||
if (!inPreviewMode) {
|
||||
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
|
||||
|
||||
@Override
|
||||
|
@ -23361,7 +23371,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
|
||||
@Override
|
||||
public boolean canPerformActions() {
|
||||
return actionBar != null && !actionBar.isActionModeShowed() && reportType < 0;
|
||||
return actionBar != null && !actionBar.isActionModeShowed() && reportType < 0 || inPreviewMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23634,11 +23644,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
return contentView.getMeasuredWidth() > contentView.getMeasuredHeight();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
|
||||
|
||||
});
|
||||
}
|
||||
if (currentEncryptedChat == null) {
|
||||
chatMessageCell.setAllowAssistant(true);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe
|
|||
}
|
||||
isPrivate = !isForcePublic && TextUtils.isEmpty(currentChat.username);
|
||||
isChannel = ChatObject.isChannel(currentChat) && !currentChat.megagroup;
|
||||
isSaveRestricted = isPrivate && currentChat.noforwards;
|
||||
isSaveRestricted = currentChat.noforwards;
|
||||
if (isForcePublic && TextUtils.isEmpty(currentChat.username) || isPrivate && currentChat.creator) {
|
||||
TLRPC.TL_channels_checkUsername req = new TLRPC.TL_channels_checkUsername();
|
||||
req.username = "1";
|
||||
|
@ -470,7 +470,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe
|
|||
}
|
||||
|
||||
private void processDone() {
|
||||
if (isPrivate && currentChat.noforwards != isSaveRestricted) {
|
||||
if (currentChat.noforwards != isSaveRestricted) {
|
||||
getMessagesController().toggleChatNoForwards(chatId, currentChat.noforwards = isSaveRestricted);
|
||||
}
|
||||
if (trySetUsername()) {
|
||||
|
@ -616,7 +616,7 @@ public class ChatEditTypeActivity extends BaseFragment implements NotificationCe
|
|||
}
|
||||
publicContainer.setVisibility(isPrivate ? View.GONE : View.VISIBLE);
|
||||
privateContainer.setVisibility(isPrivate ? View.VISIBLE : View.GONE);
|
||||
saveContainer.setVisibility(isPrivate ? View.VISIBLE : View.GONE);
|
||||
saveContainer.setVisibility(View.VISIBLE);
|
||||
manageLinksTextView.setVisibility(View.VISIBLE);
|
||||
manageLinksInfoCell.setVisibility(View.VISIBLE);
|
||||
linkContainer.setPadding(0, 0, 0, isPrivate ? 0 : AndroidUtilities.dp(7));
|
||||
|
|
|
@ -4130,6 +4130,7 @@ public class AlertsCreator {
|
|||
final boolean[] checks = new boolean[3];
|
||||
final boolean[] deleteForAll = new boolean[1];
|
||||
TLRPC.User actionUser = null;
|
||||
TLRPC.Chat actionChat = null;
|
||||
boolean canRevokeInbox = user != null && MessagesController.getInstance(currentAccount).canRevokePmInbox;
|
||||
int revokeTimeLimit;
|
||||
if (user != null) {
|
||||
|
@ -4148,7 +4149,13 @@ public class AlertsCreator {
|
|||
selectedMessage.messageOwner.action instanceof TLRPC.TL_messageActionChatDeleteUser ||
|
||||
selectedMessage.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByLink ||
|
||||
selectedMessage.messageOwner.action instanceof TLRPC.TL_messageActionChatAddUser) {
|
||||
if (selectedMessage.messageOwner.from_id.user_id != 0) {
|
||||
actionUser = MessagesController.getInstance(currentAccount).getUser(selectedMessage.messageOwner.from_id.user_id);
|
||||
} else if (selectedMessage.messageOwner.from_id.channel_id != 0) {
|
||||
actionChat = MessagesController.getInstance(currentAccount).getChat(selectedMessage.messageOwner.from_id.channel_id);
|
||||
} else if (selectedMessage.messageOwner.from_id.chat_id != 0) {
|
||||
actionChat = MessagesController.getInstance(currentAccount).getChat(selectedMessage.messageOwner.from_id.chat_id);
|
||||
}
|
||||
}
|
||||
boolean hasOutgoing = !selectedMessage.isSendError() && selectedMessage.getDialogId() == mergeDialogId && (selectedMessage.messageOwner.action == null || selectedMessage.messageOwner.action instanceof TLRPC.TL_messageActionEmpty) && selectedMessage.isOut() && (currentDate - selectedMessage.messageOwner.date) <= revokeTimeLimit;
|
||||
if (hasOutgoing) {
|
||||
|
@ -4188,8 +4195,8 @@ public class AlertsCreator {
|
|||
actionUser = MessagesController.getInstance(currentAccount).getUser(from_id);
|
||||
}
|
||||
}
|
||||
if (actionUser != null && actionUser.id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
||||
if (loadParticipant == 1 && !chat.creator) {
|
||||
if ((actionUser != null && actionUser.id != UserConfig.getInstance(currentAccount).getClientUserId()) || (actionChat != null && !ChatObject.hasAdminRights(actionChat))) {
|
||||
if (loadParticipant == 1 && !chat.creator && actionUser != null) {
|
||||
final AlertDialog[] progressDialog = new AlertDialog[]{new AlertDialog(activity, 3)};
|
||||
|
||||
TLRPC.TL_channels_getParticipant req = new TLRPC.TL_channels_getParticipant();
|
||||
|
@ -4224,6 +4231,7 @@ public class AlertsCreator {
|
|||
}
|
||||
FrameLayout frameLayout = new FrameLayout(activity);
|
||||
int num = 0;
|
||||
String name = actionUser != null ? ContactsController.formatName(actionUser.first_name, actionUser.last_name) : actionChat.title;
|
||||
for (int a = 0; a < 3; a++) {
|
||||
if ((loadParticipant == 2 || !canBan) && a == 0) {
|
||||
continue;
|
||||
|
@ -4236,7 +4244,7 @@ public class AlertsCreator {
|
|||
} else if (a == 1) {
|
||||
cell.setText(LocaleController.getString("DeleteReportSpam", R.string.DeleteReportSpam), "", false, false);
|
||||
} else {
|
||||
cell.setText(LocaleController.formatString("DeleteAllFrom", R.string.DeleteAllFrom, ContactsController.formatName(actionUser.first_name, actionUser.last_name)), "", false, false);
|
||||
cell.setText(LocaleController.formatString("DeleteAllFrom", R.string.DeleteAllFrom, name), "", false, false);
|
||||
}
|
||||
cell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16) : AndroidUtilities.dp(8), 0, LocaleController.isRTL ? AndroidUtilities.dp(8) : AndroidUtilities.dp(16), 0);
|
||||
frameLayout.addView(cell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.TOP | Gravity.LEFT, 0, 48 * num, 0, 0));
|
||||
|
@ -4335,6 +4343,7 @@ public class AlertsCreator {
|
|||
}
|
||||
}
|
||||
final TLRPC.User userFinal = actionUser;
|
||||
final TLRPC.Chat chatFinal = actionChat;
|
||||
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
|
||||
ArrayList<Integer> ids = null;
|
||||
if (selectedMessage != null) {
|
||||
|
@ -4386,21 +4395,25 @@ public class AlertsCreator {
|
|||
selectedMessages[a].clear();
|
||||
}
|
||||
}
|
||||
if (userFinal != null) {
|
||||
if (userFinal != null || chatFinal != null) {
|
||||
if (checks[0]) {
|
||||
MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat.id, userFinal, chatInfo);
|
||||
MessagesController.getInstance(currentAccount).deleteParticipantFromChat(chat.id, userFinal, chatFinal, chatInfo, false, false);
|
||||
}
|
||||
if (checks[1]) {
|
||||
TLRPC.TL_channels_reportSpam req = new TLRPC.TL_channels_reportSpam();
|
||||
req.channel = MessagesController.getInputChannel(chat);
|
||||
req.user_id = MessagesController.getInstance(currentAccount).getInputUser(userFinal);
|
||||
if (userFinal != null) {
|
||||
req.participant = MessagesController.getInputPeer(userFinal);
|
||||
} else {
|
||||
req.participant = MessagesController.getInputPeer(chatFinal);
|
||||
}
|
||||
req.id = ids;
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
|
||||
|
||||
});
|
||||
}
|
||||
if (checks[2]) {
|
||||
MessagesController.getInstance(currentAccount).deleteUserChannelHistory(chat, userFinal, 0);
|
||||
MessagesController.getInstance(currentAccount).deleteUserChannelHistory(chat, userFinal, chatFinal, 0);
|
||||
}
|
||||
}
|
||||
if (onDelete != null) {
|
||||
|
|
|
@ -4659,7 +4659,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
|||
messageEditText.setAlpha(1f);
|
||||
messageEditText.setTranslationX(0);
|
||||
messageEditText.requestFocus();
|
||||
updateSendAsButton();
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -6816,7 +6815,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
|||
}
|
||||
}
|
||||
boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE;
|
||||
boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo() && (recordedAudioPanel == null || recordedAudioPanel.getVisibility() == View.GONE);
|
||||
boolean isVisible = delegate.getSendAsPeers() != null && defPeer != null && delegate.getSendAsPeers().peers.size() > 1 && !isEditingMessage() && !isRecordingAudioVideo();
|
||||
int pad = AndroidUtilities.dp(2);
|
||||
MarginLayoutParams params = (MarginLayoutParams) senderSelectView.getLayoutParams();
|
||||
float sA = isVisible ? 0 : 1;
|
||||
|
@ -6832,8 +6831,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
|||
}
|
||||
|
||||
if (parentFragment.getOtherSameChatsDiff() == 0 && parentFragment.fragmentOpened) {
|
||||
ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(220);
|
||||
anim.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
||||
ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(150);
|
||||
anim.addUpdateListener(animation -> {
|
||||
float val = (float) animation.getAnimatedValue();
|
||||
|
||||
|
|
|
@ -336,13 +336,13 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa
|
|||
ListItem item = (ListItem) object;
|
||||
File file = item.file;
|
||||
boolean isExternalStorageManager = false;
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// isExternalStorageManager = Environment.isExternalStorageManager();
|
||||
// }
|
||||
if (!BuildVars.NO_SCOPED_STORAGE && (item.icon == R.drawable.files_storage || item.icon == R.drawable.files_internal)) {
|
||||
//if (SharedConfig.dontAskManageStorage) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
isExternalStorageManager = Environment.isExternalStorageManager();
|
||||
}
|
||||
if (!BuildVars.NO_SCOPED_STORAGE && (item.icon == R.drawable.files_storage || item.icon == R.drawable.files_internal) && !isExternalStorageManager) {
|
||||
if (SharedConfig.dontAskManageStorage) {
|
||||
delegate.startDocumentSelectActivity();
|
||||
/*} else {
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTopImage(R.drawable.doc_big, Theme.getColor(Theme.key_dialogTopBackground));
|
||||
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.getString("ManageAllFilesRational", R.string.ManageAllFilesRational)));
|
||||
|
@ -368,7 +368,7 @@ public class ChatAttachAlertDocumentLayout extends ChatAttachAlert.AttachAlertLa
|
|||
delegate.startDocumentSelectActivity();
|
||||
});
|
||||
builder.show();
|
||||
}*/
|
||||
}
|
||||
} else if (file == null) {
|
||||
if (item.icon == R.drawable.files_gallery) {
|
||||
HashMap<Object, Object> selectedPhotos = new HashMap<>();
|
||||
|
|
|
@ -104,7 +104,7 @@ public class MediaActivity extends BaseFragment implements SharedMediaLayout.Sha
|
|||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll() && sharedMediaLayout.getY() == 0) {
|
||||
if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll()) {
|
||||
return sharedMediaLayout.dispatchFastScrollEvent(ev);
|
||||
}
|
||||
if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) {
|
||||
|
|
|
@ -440,7 +440,6 @@ public class MotionBackgroundDrawable extends Drawable {
|
|||
legacyBitmap2 = null;
|
||||
}
|
||||
try {
|
||||
|
||||
legacyBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
||||
legacyCanvas = new Canvas(legacyBitmap);
|
||||
invalidateLegacy = true;
|
||||
|
|
|
@ -385,6 +385,7 @@ public class RecyclerListView extends RecyclerView {
|
|||
float touchSlop;
|
||||
Drawable fastScrollShadowDrawable;
|
||||
Drawable fastScrollBackgroundDrawable;
|
||||
boolean isRtl;
|
||||
|
||||
Runnable hideFloatingDateRunnable = new Runnable() {
|
||||
@Override
|
||||
|
@ -404,7 +405,9 @@ public class RecyclerListView extends RecyclerView {
|
|||
this.type = type;
|
||||
if (type == LETTER_TYPE) {
|
||||
letterPaint.setTextSize(AndroidUtilities.dp(45));
|
||||
isRtl = LocaleController.isRTL;
|
||||
} else {
|
||||
isRtl = false;
|
||||
letterPaint.setTextSize(AndroidUtilities.dp(13));
|
||||
letterPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
paint2.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||
|
@ -415,7 +418,7 @@ public class RecyclerListView extends RecyclerView {
|
|||
radii[a] = AndroidUtilities.dp(44);
|
||||
}
|
||||
|
||||
scrollX = LocaleController.isRTL ? AndroidUtilities.dp(10) : AndroidUtilities.dp((type == LETTER_TYPE ? 132 : 240) - 15);
|
||||
scrollX = isRtl ? AndroidUtilities.dp(10) : AndroidUtilities.dp((type == LETTER_TYPE ? 132 : 240) - 15);
|
||||
updateColors();
|
||||
setFocusableInTouchMode(true);
|
||||
ViewConfiguration vc = ViewConfiguration.get(context);
|
||||
|
@ -453,11 +456,11 @@ public class RecyclerListView extends RecyclerView {
|
|||
float x = event.getX();
|
||||
startY = lastY = event.getY();
|
||||
float currentY = (float) Math.ceil((getMeasuredHeight() - AndroidUtilities.dp(24 + 30)) * progress) + AndroidUtilities.dp(12);
|
||||
if (LocaleController.isRTL && x > AndroidUtilities.dp(25) || !LocaleController.isRTL && x < AndroidUtilities.dp(107) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) {
|
||||
if (isRtl && x > AndroidUtilities.dp(25) || !isRtl && x < AndroidUtilities.dp(107) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) {
|
||||
return false;
|
||||
}
|
||||
if (type == DATE_TYPE && !floatingDateVisible) {
|
||||
if (LocaleController.isRTL && x > AndroidUtilities.dp(25) || !LocaleController.isRTL && x < (getMeasuredWidth() - AndroidUtilities.dp(25)) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) {
|
||||
if (isRtl && x > AndroidUtilities.dp(25) || !isRtl && x < (getMeasuredWidth() - AndroidUtilities.dp(25)) || lastY < currentY || lastY > currentY + AndroidUtilities.dp(30)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +555,7 @@ public class RecyclerListView extends RecyclerView {
|
|||
if (letterLayout.getLineCount() > 0) {
|
||||
float lWidth = letterLayout.getLineWidth(0);
|
||||
float lleft = letterLayout.getLineLeft(0);
|
||||
if (LocaleController.isRTL) {
|
||||
if (isRtl) {
|
||||
textX = AndroidUtilities.dp(10) + (AndroidUtilities.dp(88) - letterLayout.getLineWidth(0)) / 2 - letterLayout.getLineLeft(0);
|
||||
} else {
|
||||
textX = (AndroidUtilities.dp(88) - letterLayout.getLineWidth(0)) / 2 - letterLayout.getLineLeft(0);
|
||||
|
@ -625,8 +628,8 @@ public class RecyclerListView extends RecyclerView {
|
|||
raduisBottom = AndroidUtilities.dp(44);
|
||||
raduisTop = AndroidUtilities.dp(4) + (1.0f - diff / AndroidUtilities.dp(29)) * AndroidUtilities.dp(40);
|
||||
}
|
||||
if (LocaleController.isRTL && (radii[0] != raduisTop || radii[6] != raduisBottom) || !LocaleController.isRTL && (radii[2] != raduisTop || radii[4] != raduisBottom)) {
|
||||
if (LocaleController.isRTL) {
|
||||
if (isRtl && (radii[0] != raduisTop || radii[6] != raduisBottom) || !isRtl && (radii[2] != raduisTop || radii[4] != raduisBottom)) {
|
||||
if (isRtl) {
|
||||
radii[0] = radii[1] = raduisTop;
|
||||
radii[6] = radii[7] = raduisBottom;
|
||||
} else {
|
||||
|
@ -634,7 +637,7 @@ public class RecyclerListView extends RecyclerView {
|
|||
radii[4] = radii[5] = raduisBottom;
|
||||
}
|
||||
path.reset();
|
||||
rect.set(LocaleController.isRTL ? AndroidUtilities.dp(10) : 0, 0, AndroidUtilities.dp(LocaleController.isRTL ? 98 : 88), AndroidUtilities.dp(88));
|
||||
rect.set(isRtl ? AndroidUtilities.dp(10) : 0, 0, AndroidUtilities.dp(isRtl ? 98 : 88), AndroidUtilities.dp(88));
|
||||
path.addRoundRect(rect, radii, Path.Direction.CW);
|
||||
path.close();
|
||||
}
|
||||
|
@ -1225,7 +1228,7 @@ public class RecyclerListView extends RecyclerView {
|
|||
if (fastScroll != null) {
|
||||
selfOnLayout = true;
|
||||
t += getPaddingTop();
|
||||
if (LocaleController.isRTL) {
|
||||
if (fastScroll.isRtl) {
|
||||
fastScroll.layout(0, t, fastScroll.getMeasuredWidth(), t + fastScroll.getMeasuredHeight());
|
||||
} else {
|
||||
int x = getMeasuredWidth() - fastScroll.getMeasuredWidth();
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package org.telegram.ui.Components;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.DocumentObject;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.SvgHelper;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
public class StickerImageView extends BackupImageView implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
int currentAccount;
|
||||
int stickerNum;
|
||||
String stickerPackName = AndroidUtilities.STICKERS_PLACEHOLDER_PACK_NAME;
|
||||
|
||||
public StickerImageView(Context context, int currentAccount) {
|
||||
super(context);
|
||||
this.currentAccount = currentAccount;
|
||||
}
|
||||
|
||||
public void setStickerNum(int stickerNum) {
|
||||
this.stickerNum = stickerNum;
|
||||
}
|
||||
|
||||
public void setStickerPackName(String stickerPackName) {
|
||||
this.stickerPackName = stickerPackName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
setSticker();
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.diceStickersDidLoad);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.diceStickersDidLoad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, int account, Object... args) {
|
||||
if (id == NotificationCenter.diceStickersDidLoad) {
|
||||
String name = (String) args[0];
|
||||
if (stickerPackName.equals(name)) {
|
||||
setSticker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setSticker() {
|
||||
String imageFilter = null;
|
||||
TLRPC.Document document = null;
|
||||
TLRPC.TL_messages_stickerSet set = null;
|
||||
|
||||
set = MediaDataController.getInstance(currentAccount).getStickerSetByName(stickerPackName);
|
||||
if (set == null) {
|
||||
set = MediaDataController.getInstance(currentAccount).getStickerSetByEmojiOrName(stickerPackName);
|
||||
}
|
||||
if (set != null && set.documents.size() > stickerNum) {
|
||||
document = set.documents.get(stickerNum);
|
||||
}
|
||||
imageFilter = "130_130";
|
||||
|
||||
SvgHelper.SvgDrawable svgThumb = null;
|
||||
if (document != null) {
|
||||
svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_emptyListPlaceholder, 0.2f);
|
||||
}
|
||||
if (svgThumb != null) {
|
||||
svgThumb.overrideWidthAndHeight(512, 512);
|
||||
}
|
||||
|
||||
if (document != null) {
|
||||
ImageLocation imageLocation = ImageLocation.getForDocument(document);
|
||||
setImage(imageLocation, imageFilter, "tgs", svgThumb, set);
|
||||
} else {
|
||||
MediaDataController.getInstance(currentAccount).loadStickersByEmojiOrName(stickerPackName, false, set == null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -248,7 +248,7 @@ public class DefaultThemesPreviewCell extends LinearLayout {
|
|||
|
||||
if (!Theme.isCurrentThemeDay()) {
|
||||
darkThemeDrawable.setCurrentFrame(darkThemeDrawable.getFramesCount() - 1);
|
||||
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDaytMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true);
|
||||
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToDayMode", R.string.SettingsSwitchToDayMode), darkThemeDrawable, true);
|
||||
} else {
|
||||
dayNightCell.setTextAndIcon(LocaleController.getString("SettingsSwitchToNightMode", R.string.SettingsSwitchToNightMode), darkThemeDrawable, true);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ import org.telegram.messenger.ContactsController;
|
|||
import org.telegram.messenger.DialogObject;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.FilesMigrationService;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
|
@ -3534,6 +3535,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
showSearch(false, false);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
FilesMigrationService.checkBottomSheet(this);
|
||||
}
|
||||
updateMenuButton(false);
|
||||
return fragmentView;
|
||||
}
|
||||
|
@ -6347,6 +6351,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
askingForPermissions = false;
|
||||
showFiltersHint();
|
||||
}
|
||||
} else if (requestCode == 4) {
|
||||
boolean allGranted = true;
|
||||
for (int a = 0; a < grantResults.length; a++) {
|
||||
if (grantResults[a] != PackageManager.PERMISSION_GRANTED) {
|
||||
allGranted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allGranted && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && FilesMigrationService.filesMigrationBottomSheet != null) {
|
||||
FilesMigrationService.filesMigrationBottomSheet.migrateOldFolder();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1942,12 +1942,12 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
String msgID = data.getQueryParameter("message_id");
|
||||
if (userID != null) {
|
||||
try {
|
||||
push_user_id = Integer.parseInt(userID);
|
||||
push_user_id = Long.parseLong(userID);
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
} else if (chatID != null) {
|
||||
try {
|
||||
push_chat_id = Integer.parseInt(chatID);
|
||||
push_chat_id = Long.parseLong(chatID);
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9648,7 +9648,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
isEvent = object != null && object.isEvent;
|
||||
sharedMediaType = MediaDataController.MEDIA_PHOTOVIDEO;
|
||||
allMediaItem.setText(LocaleController.getString("ShowAllMedia", R.string.ShowAllMedia));
|
||||
menuItem.setVisibility(View.VISIBLE);
|
||||
setItemVisible(sendItem, false, false);
|
||||
setItemVisible(pipItem, false, true);
|
||||
cameraItem.setVisibility(View.GONE);
|
||||
|
@ -9894,7 +9893,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
cameraItem.setVisibility(View.VISIBLE);
|
||||
cameraItem.setTag(1);
|
||||
}
|
||||
menuItem.setVisibility(View.GONE);
|
||||
imagesArrLocals.addAll(photos);
|
||||
Object obj = imagesArrLocals.get(index);
|
||||
boolean allowCaption;
|
||||
|
@ -10553,7 +10551,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif));
|
||||
} else {
|
||||
menuItem.setVisibility(View.VISIBLE);
|
||||
if (size == 1) {
|
||||
if (isVideo) {
|
||||
actionBar.setTitle(LocaleController.getString("AttachVideo", R.string.AttachVideo));
|
||||
|
@ -12350,7 +12347,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
disableShowCheck = false;
|
||||
object.imageReceiver.setVisible(false, true);
|
||||
};
|
||||
if (parentChatActivity != null) {
|
||||
if (parentChatActivity != null && parentChatActivity.getFragmentView() != null) {
|
||||
parentChatActivity.getUndoView().hide(false, 1);
|
||||
parentChatActivity.getFragmentView().invalidate();
|
||||
}
|
||||
|
|
|
@ -3886,7 +3886,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
participant.inviter_id = participant.channelParticipant.inviter_id;
|
||||
participant.user_id = MessageObject.getPeerId(participant.channelParticipant.peer);
|
||||
participant.date = participant.channelParticipant.date;
|
||||
if (participant.user_id != 0 && participantsMap.indexOfKey(participant.user_id) < 0) {
|
||||
if (participantsMap.indexOfKey(participant.user_id) < 0) {
|
||||
if (chatInfo.participants == null) {
|
||||
chatInfo.participants = new TLRPC.TL_chatParticipants();
|
||||
}
|
||||
|
|
|
@ -378,15 +378,17 @@ public class SessionBottomSheet extends BottomSheet {
|
|||
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
addView(linearLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 64, 4, 0, 4));
|
||||
addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 64, 4, 0, 4));
|
||||
|
||||
valueText = new TextView(context);
|
||||
valueText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
|
||||
valueText.setGravity(Gravity.LEFT);
|
||||
valueText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
linearLayout.addView(valueText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 0, 0));
|
||||
|
||||
descriptionText = new TextView(context);
|
||||
descriptionText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||
descriptionText.setGravity(Gravity.LEFT);
|
||||
descriptionText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText));
|
||||
linearLayout.addView(descriptionText, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 4, 0, 0));
|
||||
setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4));
|
||||
|
|
|
@ -4889,4 +4889,9 @@
|
|||
<string name="ChatWithAdminMessage">You received this message because you requested to join **%1$s** on %2$s</string>
|
||||
<string name="EventLogSendMessages">un1 sent this message:</string>
|
||||
<string name="DidNotGetTheCodePhone">Get code on this phone</string>
|
||||
<string name="MigrationNotification">Migration</string>
|
||||
<string name="MigrateOldFolderButton">Move Files Now</string>
|
||||
<string name="MigrateOldFolderTitle">Migrate Files to Scoped Storage</string>
|
||||
<string name="MigrateOldFolderDescription">Due to a change made by **Google**, we need to move the files you downloaded using **Telegram** to a new folder.\n\nThis may take a few moments. You can continue using the app while the files are moved.</string>
|
||||
<string name="MigratingFiles">Migrating files</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue