Skip to content

Commit

Permalink
Update to 8.1.1 (2431)
Browse files Browse the repository at this point in the history
  • Loading branch information
xaxtix committed Sep 21, 2021
1 parent 42feed0 commit 58aded6
Show file tree
Hide file tree
Showing 17 changed files with 1,092 additions and 1,021 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2242,33 +2242,12 @@ public void onAnimationEnd(Animator animation) {
}*/

public static void startAppCenter(Activity context) {
// if (BuildConfig.DEBUG) {
// return;
// }
// try {
// if (BuildVars.DEBUG_VERSION) {
// Distribute.setEnabledForDebuggableBuild(true);
// AppCenter.start(context.getApplication(), BuildVars.DEBUG_VERSION ? BuildVars.APPCENTER_HASH_DEBUG : BuildVars.APPCENTER_HASH, Distribute.class, Crashes.class);
// AppCenter.setUserId("uid=" + UserConfig.getInstance(UserConfig.selectedAccount).clientUserId);
// }
// } catch (Throwable e) {
// FileLog.e(e);
// }

}

private static long lastUpdateCheckTime;
public static void checkForUpdates() {
// try {
// if (BuildVars.DEBUG_VERSION) {
// if (SystemClock.elapsedRealtime() - lastUpdateCheckTime < 60 * 60 * 1000) {
// return;
// }
// lastUpdateCheckTime = SystemClock.elapsedRealtime();
// Distribute.checkForUpdate();
// }
// } catch (Throwable e) {
// FileLog.e(e);
// }

}

public static void addToClipboard(CharSequence str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2428;
public static String BUILD_VERSION_STRING = "8.0.1";
public static int BUILD_VERSION = 2431;
public static String BUILD_VERSION_STRING = "8.1.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
Expand Down
1,853 changes: 928 additions & 925 deletions TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}
try {
long chatId = intent.getLongExtra("chatId", 0);
long userId = intent.getLongExtra("userId", 0);
long chatId = intent.getLongExtra("chatId", intent.getIntExtra("chatId", 0));
long userId = intent.getLongExtra("userId", intent.getIntExtra("userId", 0));
int encId = intent.getIntExtra("encId", 0);
if (chatId == 0 && userId == 0 && encId == 0) {
return;
}
} catch (Throwable e) {
FileLog.e(e);
return;
}
Intent intent2 = new Intent(this, LaunchActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ public void loadWallpaper(boolean isDark, ResultCallback<Pair<Long, Bitmap>> cal

public void loadWallpaperThumb(boolean isDark, ResultCallback<Pair<Long, Bitmap>> callback) {
final TLRPC.WallPaper wallpaper = getWallpaper(isDark);
if (wallpaper == null && callback != null) {
callback.onComplete(null);
if (wallpaper == null) {
if (callback != null) {
callback.onComplete(null);
}
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public void setTop(int top, int backgroundWidth, int backgroundHeight, int heigh
} else {
num = currentType == TYPE_PREVIEW ? 1 : 0;
}
if (gradientColor2 != 0 && animatedGradient && motionBackground[num] != null) {
if (!isCrossfadeBackground && gradientColor2 != 0 && animatedGradient && motionBackground[num] != null) {
int[] colors = motionBackground[num].getColors();
currentColor = colors[0];
currentGradientColor1 = colors[1];
Expand All @@ -325,8 +325,10 @@ public void setTop(int top, int backgroundWidth, int backgroundHeight, int heigh
}
if (isCrossfadeBackground && gradientColor2 != 0 && animatedGradient) {
if (backgroundHeight != currentBackgroundHeight || crosfadeFromBitmapShader == null || currentColor != color || currentGradientColor1 != gradientColor1 || currentGradientColor2 != gradientColor2 || currentGradientColor3 != gradientColor3 || currentAnimateGradient != animatedGradient) {
crosfadeFromBitmap = Bitmap.createBitmap(60, 80, Bitmap.Config.ARGB_8888);
crosfadeFromBitmapShader = new BitmapShader(crosfadeFromBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
if (crosfadeFromBitmap == null) {
crosfadeFromBitmap = Bitmap.createBitmap(60, 80, Bitmap.Config.ARGB_8888);
crosfadeFromBitmapShader = new BitmapShader(crosfadeFromBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
}
if (motionBackground[num] == null) {
motionBackground[num] = new MotionBackgroundDrawable();
if (currentType != TYPE_PREVIEW) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import androidx.viewpager.widget.ViewPager;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
Expand Down Expand Up @@ -155,6 +156,9 @@ public int getItemCount() {
dialogsCount = array.size();
if (!forceShowEmptyCell && dialogsType != 7 && dialogsType != 8 && dialogsType != 11 && dialogsCount == 0 && (folderId != 0 || messagesController.isLoadingDialogs(folderId) || !MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId))) {
onlineContacts = null;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType + " isLoadingDialogs=" + messagesController.isLoadingDialogs(folderId) + " isDialogsEndReached=" + MessagesController.getInstance(currentAccount).isDialogsEndReached(folderId));
}
if (folderId == 1 && showArchiveHint) {
return (currentCount = 2);
}
Expand All @@ -176,6 +180,9 @@ public int getItemCount() {
} else if (dialogsType == 0 && messagesController.dialogs_dict.size() <= 10 && folderId == 0 && messagesController.isDialogsEndReached(folderId)) {
if (ContactsController.getInstance(currentAccount).contacts.isEmpty() && !ContactsController.getInstance(currentAccount).doneLoadingContacts) {
onlineContacts = null;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter loadingContacts=" + (ContactsController.getInstance(currentAccount).contacts.isEmpty() && !ContactsController.getInstance(currentAccount).doneLoadingContacts) + "dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType);
}
return (currentCount = 0);
}

Expand Down Expand Up @@ -224,6 +231,10 @@ public int getItemCount() {
count += 1;
}
currentCount = count;

if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType);
}
return count;
}

Expand Down
20 changes: 12 additions & 8 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8039,7 +8039,7 @@ public void onAnimationEnd(Animator animation) {
}

private void openAnotherForward() {
if (forwardingMessages == null) {
if (forwardingMessages == null || forwardingMessages.messages == null) {
return;
}
boolean fewSenders = false;
Expand All @@ -8063,7 +8063,7 @@ private void openAnotherForward() {
message = LocaleController.formatString("CancelForwardPrivate", R.string.CancelForwardPrivate, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), ContactsController.formatName(user.first_name, user.last_name));
} else {
TLRPC.Chat chat = getMessagesController().getChat(-dialogId);
message = LocaleController.formatString("CancelForwardChat", R.string.CancelForwardChat, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), chat.title);
message = LocaleController.formatString("CancelForwardChat", R.string.CancelForwardChat, LocaleController.formatPluralString("MessagesBold", forwardingMessages.messages.size()), chat == null ? "" : chat.title);
}
builder.setMessage(AndroidUtilities.replaceTags(message));
builder.setTitle(LocaleController.formatPluralString("messages", forwardingMessages.messages.size()));
Expand Down Expand Up @@ -19956,7 +19956,7 @@ public boolean onTouch(View v, MotionEvent event) {
boolean showMessageSeen = currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count < 50;
MessageSeenView messageSeenView = null;
if (showMessageSeen) {
messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message);
messageSeenView = new MessageSeenView(contentView.getContext(), currentAccount, message, currentChat);
Drawable shadowDrawable2 = ContextCompat.getDrawable(contentView.getContext(), R.drawable.popup_fixed_alert).mutate();
shadowDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY));
FrameLayout messageSeenLayout = new FrameLayout(contentView.getContext());
Expand Down Expand Up @@ -20116,7 +20116,9 @@ public void onClick(View view) {
args.putLong("user_id", user.id);
ProfileActivity fragment = new ProfileActivity(args);
presentFragment(fragment);
mesageSeenUsersPopupWindow.dismiss();
if (mesageSeenUsersPopupWindow != null) {
mesageSeenUsersPopupWindow.dismiss();
}
});
}
});
Expand Down Expand Up @@ -24648,7 +24650,7 @@ public ArrayList<ThemeDescription> getThemeDescriptions() {
themeDescriptions.add(new ThemeDescription(alertNameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelTitle));
themeDescriptions.add(new ThemeDescription(alertTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelMessage));
themeDescriptions.add(new ThemeDescription(closePinned, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(pinnedListButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelTitle));
themeDescriptions.add(new ThemeDescription(pinnedListButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(closeReportSpam, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose));
themeDescriptions.add(new ThemeDescription(topChatPanelView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground));
themeDescriptions.add(new ThemeDescription(alertView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground));
Expand Down Expand Up @@ -25041,7 +25043,7 @@ public class ThemeDelegate implements Theme.ResourcesProvider, ChatActionCell.Th
}
}
if (!setup) {
Theme.refreshThemeColors();
Theme.refreshThemeColors(true, false);
}
}

Expand Down Expand Up @@ -25223,6 +25225,9 @@ public void setProgress(float p) {
animatingMessageDrawable.crossfadeFromDrawable = parentLayout.messageDrawableOutStart;
animatingMessageMediaDrawable = (Theme.MessageDrawable) getThemedDrawable(Theme.key_drawable_msgOutMedia);
animatingMessageMediaDrawable.crossfadeFromDrawable = parentLayout.messageDrawableOutMediaStart;
animatingMessageDrawable.crossfadeProgress = 0f;
animatingMessageMediaDrawable.crossfadeProgress = 0f;
updateMessagesVisiblePart(false);
updateServiceMessageColor(0);
};
animationSettings.afterAnimationRunnable = () -> {
Expand Down Expand Up @@ -25263,7 +25268,7 @@ private void setupChatTheme(ChatTheme chatTheme, boolean withAnimation, boolean

Theme.ThemeInfo activeTheme;
if (Theme.getActiveTheme().isDark() == isDark) {
activeTheme = Theme.getCurrentTheme();
activeTheme = Theme.getActiveTheme();
} else {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", Activity.MODE_PRIVATE);
String dayThemeName = preferences.getString("lastDayTheme", "Blue");
Expand All @@ -25277,7 +25282,6 @@ private void setupChatTheme(ChatTheme chatTheme, boolean withAnimation, boolean
activeTheme = isDark ? Theme.getTheme(nightThemeName) : Theme.getTheme(dayThemeName);
}


Theme.applyTheme(activeTheme, false, isDark);
} else {
currentColors = chatTheme.getCurrentColors(currentAccount, isDark);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected int calculateTimeForScrolling(int dx) {
recyclerView.setLayoutManager(layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
recyclerView.setPadding(AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12), 0);
recyclerView.setOnItemClickListener((view, position) -> {
if (adapter.items.get(position) == selectedItem) {
if (adapter.items.get(position) == selectedItem || changeDayNightView != null) {
return;
}
selectedItem = adapter.items.get(position);
Expand Down Expand Up @@ -855,6 +855,7 @@ public void setItem(ChatThemeItem item) {
drawable.setPatternBitmap(intensity >= 0 ? 100 : -100, result.second);
drawable.setPatternColorFilter(drawable.getPatternColor());
}
invalidate();
}
});
}
Expand Down Expand Up @@ -965,7 +966,7 @@ private StaticLayout getNoThemeStaticLayout() {
noThemeTextPaint.setTextSize(AndroidUtilities.dp(14));
noThemeTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textLayout = StaticLayoutEx.createStaticLayout2(
LocaleController.getString("NoTheme", R.string.ChatNoTheme),
LocaleController.getString("ChatNoTheme", R.string.ChatNoTheme),
noThemeTextPaint,
AndroidUtilities.dp(52),
Layout.Alignment.ALIGN_CENTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,7 @@ private void switchToCurrentSelectedMode(boolean animated) {
}

private boolean onItemLongClick(MessageObject item, View view, int a) {
if (isActionModeShowed || profileActivity.getParentActivity() == null) {
if (isActionModeShowed || profileActivity.getParentActivity() == null || item == null) {
return false;
}
AndroidUtilities.hideKeyboard(profileActivity.getParentActivity().getCurrentFocus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
Expand Down Expand Up @@ -60,6 +62,11 @@ public DatabaseMigrationHint(Context context, int currentAccount) {

addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));

setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
}
}
Loading

1 comment on commit 58aded6

@AlexandrKozlovskiy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xaxtix Please,add virtual node (accessibilityNodeInfo),for user,if we get message in some channel,group from it,to blind users can quickly click on it and know info about it. Becaus for now,if we have message from some user in group/ we should go at list with members of this groupe and find user,from which we have message,so please add virtual child view in class chatMessageCell.java in subclass,which extends from accessibilityNodeProvider,to blind users can quickly can know about user,which send this message.

Please sign in to comment.