Add new message animation

It's buggy
This commit is contained in:
NekoInverter 2020-04-17 10:13:43 +08:00
parent ffc67eeeb0
commit d5838df847
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
4 changed files with 29 additions and 5 deletions

View File

@ -3291,8 +3291,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatListView.setAdapter(chatAdapter = new ChatActivityAdapter(context));
chatListView.setClipToPadding(false);
chatListView.setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(3));
chatListView.setItemAnimator(null);
chatListView.setLayoutAnimation(null);
if (!NekoConfig.chatMessageAnimation) {
chatListView.setItemAnimator(null);
chatListView.setLayoutAnimation(null);
}
chatLayoutManager = new GridLayoutManagerFixed(context, 1000, LinearLayoutManager.VERTICAL, true) {
@Override

View File

@ -25,6 +25,7 @@ public class NekoConfig {
public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
public static boolean disablePhotoSideAction = true;
public static boolean hideKeyboardOnChatScroll = false;
public static boolean chatMessageAnimation = false;
public static int mapPreviewProvider = 0;
public static float stickerSize = 14.0f;
public static int translationProvider = 1;
@ -95,6 +96,7 @@ public class NekoConfig {
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
editor.putBoolean("useSystemEmoji", useSystemEmoji);
editor.putBoolean("showTabsOnForward", showTabsOnForward);
editor.putBoolean("chatMessageAnimation", chatMessageAnimation);
editor.putFloat("stickerSize", stickerSize);
editor.putInt("typeface", typeface);
editor.putInt("nameOrder", nameOrder);
@ -150,7 +152,8 @@ public class NekoConfig {
hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false);
avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false);
useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji);
showTabsOnForward = preferences.getBoolean("showTabsOnForward", showTabsOnForward);
showTabsOnForward = preferences.getBoolean("showTabsOnForward", false);
chatMessageAnimation = preferences.getBoolean("chatMessageAnimation", false);
configLoaded = true;
}
}
@ -437,4 +440,12 @@ public class NekoConfig {
editor.putBoolean("showTabsOnForward", showTabsOnForward);
editor.commit();
}
public static void toggleChatMessageAnimation() {
chatMessageAnimation = !chatMessageAnimation;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("chatMessageAnimation", chatMessageAnimation);
editor.commit();
}
}

View File

@ -101,6 +101,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int experimentRow;
private int smoothKeyboardRow;
private int chatMessageAnimationRow;
private int disableFilteringRow;
private int unlimitedFavedStickersRow;
private int unlimitedPinnedDialogsRow;
@ -518,6 +519,11 @@ public class NekoSettingsActivity extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.showTabsOnForward);
}
} else if (position == chatMessageAnimationRow) {
NekoConfig.toggleChatMessageAnimation();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.chatMessageAnimation);
}
}
});
@ -568,6 +574,7 @@ public class NekoSettingsActivity extends BaseFragment {
needRestartRow = rowCount++;
experimentRow = rowCount++;
smoothKeyboardRow = !AndroidUtilities.isTablet() ? rowCount++ : -1;
chatMessageAnimationRow = rowCount++;
disableFilteringRow = rowCount++;
unlimitedFavedStickersRow = rowCount++;
unlimitedPinnedDialogsRow = rowCount++;
@ -1054,6 +1061,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("UseAvatarAsDrawerBackground", R.string.UseAvatarAsDrawerBackground), NekoConfig.avatarAsDrawerBackground, true);
} else if (position == showTabsOnForwardRow) {
textCell.setTextAndCheck(LocaleController.getString("ShowTabsOnForward", R.string.ShowTabsOnForward), NekoConfig.showTabsOnForward, true);
} else if (position == chatMessageAnimationRow) {
textCell.setTextAndCheck(LocaleController.getString("ChatMessageAnimation", R.string.ChatMessageAnimation), NekoConfig.chatMessageAnimation, true);
}
break;
}
@ -1093,7 +1102,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
position == experimentRow || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow ||
position == showTabsOnForwardRow;
position == showTabsOnForwardRow || position == chatMessageAnimationRow;
}
@Override
@ -1147,7 +1156,8 @@ public class NekoSettingsActivity extends BaseFragment {
position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow ||
position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || position == showTabsOnForwardRow) {
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || position == showTabsOnForwardRow ||
position == chatMessageAnimationRow) {
return 3;
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) {
return 4;

View File

@ -88,4 +88,5 @@
<string name="ShowTabsOnForward">Show tabs on forward</string>
<string name="CheckAllAdministrated">Add administrated</string>
<string name="ProviderDeepLWeb">DeepL Translator (Web)</string>
<string name="ChatMessageAnimation">Animate new messages</string>
</resources>