From abdcfc28d892e0c0d70bbc0231b2778ebf20bbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 8 Feb 2021 13:07:15 +0800 Subject: [PATCH] Fixes --- TMessagesProj/build.gradle | 4 +-- .../java/org/telegram/ui/ChatActivity.java | 10 +++---- .../org/telegram/ui/SessionsActivity.java | 28 ++++++++++++++++++- .../java/org/telegram/ui/ThemeActivity.java | 21 +++++++------- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 0c96a6a41..40a21beb8 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -def verName = "7.4.2-rc03" -def verCode = 180 +def verName = "7.4.2-rc04" +def verCode = 182 def officialVer = "7.4.2" def officialCode = 2227 diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index a8b1dd48f..3420dfd94 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -17498,12 +17498,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } - if (currentChat != null && ChatObject.canSendMessages(currentChat) && shareKeyItem != null) { - if (StrUtil.isBlank(NekoConfig.openPGPApp)) { - shareKeyItem.setVisibility(View.GONE); - } else { - shareKeyItem.setVisibility(View.VISIBLE); - } + if (currentChat != null && ChatObject.canSendMessages(currentChat) && StrUtil.isNotBlank(NekoConfig.openPGPApp) && shareKeyItem != null) { + shareKeyItem.setVisibility(View.VISIBLE); + } else { + shareKeyItem.setVisibility(View.GONE); } if (userBlocked || addToContactsButton.getVisibility() == View.GONE && reportSpamButton.getVisibility() == View.GONE) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java index 79f9ae79e..cd432c36c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java @@ -432,7 +432,33 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter } - if (newAuthorizationToOpen != null) { + if (currentType == 0) { + undoView = new UndoView(context) { + @Override + public void hide(boolean apply, int animated) { + if (!apply) { + TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) getCurrentInfoObject(); + TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + req.hash = authorization.hash; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + if (error == null) { + sessions.remove(authorization); + passwordSessions.remove(authorization); + updateRows(); + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + loadSessions(true); + } + })); + } + super.hide(apply, animated); + } + }; + frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8)); + } + + if (newAuthorizationToOpen != null && undoView != null) { AndroidUtilities.runOnUIThread(() -> undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, newAuthorizationToOpen), 3000L); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java index f9a99eaab..9e588b988 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java @@ -28,13 +28,6 @@ import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; - -import androidx.annotation.Keep; -import androidx.core.content.FileProvider; -import androidx.recyclerview.widget.DefaultItemAnimator; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import android.text.TextPaint; import android.text.TextUtils; import android.view.Gravity; @@ -46,13 +39,19 @@ import android.widget.Button; import android.widget.FrameLayout; import android.widget.TextView; +import androidx.annotation.Keep; +import androidx.core.content.FileProvider; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BuildConfig; -import org.telegram.messenger.MediaDataController; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -95,8 +94,6 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; -import tw.nekomimi.nekogram.NekoConfig; - public class ThemeActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { public final static int THEME_TYPE_BASIC = 0; @@ -509,7 +506,9 @@ public class ThemeActivity extends BaseFragment implements NotificationCenter.No if (currentType == THEME_TYPE_BASIC) { textSizeHeaderRow = rowCount++; textSizeRow = rowCount++; - backgroundRow = rowCount++; + if (!"indigo.attheme".equals(Theme.getCurrentTheme().assetName)) { + backgroundRow = rowCount++; + } newThemeInfoRow = rowCount++; themeHeaderRow = rowCount++; themeListRow = rowCount++;