From 317a24e1bf48108d6a218e1acdd3cfb918c08739 Mon Sep 17 00:00:00 2001 From: immat0x1 Date: Sun, 26 Feb 2023 16:28:05 +0500 Subject: [PATCH] fixes --- .../recyclerview/widget/ItemTouchHelper.java | 2 +- .../recyclerview/widget/RecyclerView.java | 1 - .../exteragram/messenger/ExteraConfig.java | 7 +-- .../messenger/camera/CameraXView.java | 10 ++--- .../components/StickerSizePreviewCell.java | 5 --- .../exteragram/messenger/extras/Vibrate.java | 44 +++++++++++-------- .../messenger/icons/IconSetsController.java | 12 ++++- .../AppearancePreferencesActivity.java | 12 +---- .../preferences/ChatsPreferencesActivity.java | 1 - .../GeneralPreferencesActivity.java | 2 +- .../telegram/messenger/MediaController.java | 4 +- .../telegram/messenger/camera/CameraView.java | 19 +++----- .../ui/ActionBar/ActionBarLayout.java | 5 +-- .../telegram/ui/ActionBar/BaseFragment.java | 5 --- .../ui/Adapters/DrawerLayoutAdapter.java | 2 - .../java/org/telegram/ui/ArticleViewer.java | 6 +-- .../java/org/telegram/ui/AvatarPreviewer.java | 2 +- .../org/telegram/ui/CalendarActivity.java | 2 +- .../java/org/telegram/ui/Cells/BaseCell.java | 1 - .../telegram/ui/Cells/ChatMessageCell.java | 4 +- .../org/telegram/ui/Cells/DialogCell.java | 2 +- .../org/telegram/ui/Cells/SharedLinkCell.java | 2 +- .../telegram/ui/Cells/StickerEmojiCell.java | 7 ++- .../ui/Cells/TextSelectionHelper.java | 14 +++--- .../ui/Cells/ThemesHorizontalListCell.java | 2 +- .../telegram/ui/ChannelAdminLogActivity.java | 6 +++ .../org/telegram/ui/Charts/BaseChartView.java | 2 +- .../org/telegram/ui/Charts/PieChartView.java | 15 +++---- .../java/org/telegram/ui/ChatActivity.java | 26 ++++++----- .../telegram/ui/ChatPullingDownDrawable.java | 2 +- .../telegram/ui/Components/AlertsCreator.java | 6 +-- .../ui/Components/AudioPlayerAlert.java | 2 +- .../ui/Components/ChatActivityEnterView.java | 2 +- .../ui/Components/ChatAttachAlert.java | 11 ++--- .../ChatAttachAlertPhotoLayoutPreview.java | 4 +- .../Components/CustomPhoneKeyboardView.java | 4 +- .../org/telegram/ui/Components/EmojiView.java | 8 ++-- .../ui/Components/FragmentContextView.java | 6 +-- .../telegram/ui/Components/GroupCallPip.java | 8 ++-- .../ui/Components/InstantCameraView.java | 10 ++--- .../ui/Components/Paint/Views/EntityView.java | 2 +- .../telegram/ui/Components/PasscodeView.java | 6 +-- .../ui/Components/ProximitySheet.java | 2 +- .../ui/Components/RLottieDrawable.java | 4 +- .../Reactions/ReactionsEffectOverlay.java | 4 +- .../Components/ReactionsContainerLayout.java | 2 +- .../ui/Components/RecyclerListView.java | 8 +--- .../ui/Components/ScrollSlidingTabStrip.java | 2 +- .../telegram/ui/Components/ShareAlert.java | 2 +- .../telegram/ui/Components/StickersAlert.java | 2 +- .../Components/SwipeGestureSettingsView.java | 2 +- .../org/telegram/ui/Components/UndoView.java | 2 +- .../ui/Components/ZoomControlView.java | 4 +- .../org/telegram/ui/ContentPreviewViewer.java | 17 ++----- .../java/org/telegram/ui/DialogsActivity.java | 8 ++-- .../telegram/ui/EmojiAnimationsOverlay.java | 4 +- .../org/telegram/ui/GroupCallActivity.java | 18 ++++---- .../telegram/ui/LNavigation/LNavigation.java | 2 + .../java/org/telegram/ui/LaunchActivity.java | 7 --- .../java/org/telegram/ui/LoginActivity.java | 27 ++++++++---- .../org/telegram/ui/ManageLinksActivity.java | 2 +- .../telegram/ui/PhotoAlbumPickerActivity.java | 2 +- .../org/telegram/ui/PhotoPickerActivity.java | 3 +- .../java/org/telegram/ui/PhotoViewer.java | 2 +- .../java/org/telegram/ui/ThemeActivity.java | 32 ++++++++++---- .../ui/TwoStepVerificationSetupActivity.java | 2 +- .../drawable/msg_select_between_solar.xml | 28 ++++++++++++ .../drawable/stickers_empty_solar.xml | 28 ++++++++++++ .../src/main/res/drawable/nocover.xml | 38 ++++++++-------- 69 files changed, 289 insertions(+), 258 deletions(-) create mode 100644 TMessagesProj/src/main/res-solar/drawable/msg_select_between_solar.xml create mode 100644 TMessagesProj/src/main/res-solar/drawable/stickers_empty_solar.xml diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java index 44e029a2b8..9c686e21cd 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java @@ -694,7 +694,7 @@ public void onAnimationEnd(Animator animation) { mSelected = selected; if (actionState == ACTION_STATE_DRAG) { - if (!ExteraConfig.disableVibration) mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } } final ViewParent rvParent = mRecyclerView.getParent(); diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java index a0626c79ae..a320b16221 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java @@ -7052,7 +7052,6 @@ public final VH createViewHolder(@NonNull ViewGroup parent, int viewType) { try { TraceCompat.beginSection(TRACE_CREATE_VIEW_TAG); final VH holder = onCreateViewHolder(parent, viewType); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(holder.itemView); if (holder.itemView.getParent() != null) { throw new IllegalStateException("ViewHolder views must not be attached when" + " created. Ensure that you are not passing 'true' to the attachToRoot" diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/ExteraConfig.java b/TMessagesProj/src/main/java/com/exteragram/messenger/ExteraConfig.java index 99cbf90782..1662e1a690 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/ExteraConfig.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/ExteraConfig.java @@ -24,7 +24,6 @@ import org.telegram.messenger.BuildVars; import org.telegram.messenger.FileLog; import org.telegram.messenger.SharedConfig; -import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; import java.util.Arrays; @@ -51,7 +50,7 @@ public class ExteraConfig { public static int eventType; public static boolean forceSnow; - public static boolean changeStatus, newGroup, newSecretChat, newChannel, contacts, calls, peopleNearby, archivedChats, savedMessages, scanQr, inviteFriends, telegramFeatures, downloads; + public static boolean changeStatus, newGroup, newSecretChat, newChannel, contacts, calls, peopleNearby, archivedChats, savedMessages, scanQr, inviteFriends, telegramFeatures; // General public static int cameraType; @@ -199,7 +198,6 @@ public static void loadConfig() { calls = preferences.getBoolean("calls", false); peopleNearby = preferences.getBoolean("peopleNearby", false); archivedChats = preferences.getBoolean("archivedChats", true); - downloads = preferences.getBoolean("downloads", true); savedMessages = preferences.getBoolean("savedMessages", true); scanQr = preferences.getBoolean("scanQr", true); inviteFriends = preferences.getBoolean("inviteFriends", false); @@ -306,9 +304,6 @@ public static void toggleDrawerElements(int id) { case 12: editor.putBoolean("changeStatus", changeStatus ^= true).apply(); break; - case 13: - editor.putBoolean("downloads", downloads ^= true).apply(); - break; } } diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/camera/CameraXView.java b/TMessagesProj/src/main/java/com/exteragram/messenger/camera/CameraXView.java index b8984d4d35..1405e40898 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/camera/CameraXView.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/camera/CameraXView.java @@ -13,8 +13,6 @@ import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManager; import android.os.SystemClock; -import android.os.VibrationEffect; -import android.os.Vibrator; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.OrientationEventListener; @@ -27,6 +25,8 @@ import androidx.camera.core.ImageCapture; import androidx.camera.view.PreviewView; +import com.exteragram.messenger.extras.Vibrate; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.Utilities; @@ -490,12 +490,8 @@ public boolean isSameTakePictureOrientation() { @SuppressLint("MissingPermission") @Override public void runHaptic() { - long[] vibrationWaveFormDurationPattern = {0, 1}; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - final Vibrator vibrator = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); - VibrationEffect vibrationEffect = VibrationEffect.createWaveform(vibrationWaveFormDurationPattern, -1); - vibrator.cancel(); - vibrator.vibrate(vibrationEffect); + Vibrate.vibrate(); } else { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/components/StickerSizePreviewCell.java b/TMessagesProj/src/main/java/com/exteragram/messenger/components/StickerSizePreviewCell.java index 83249ea589..0bfd43a9b9 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/components/StickerSizePreviewCell.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/components/StickerSizePreviewCell.java @@ -13,13 +13,9 @@ import android.view.MotionEvent; import android.widget.LinearLayout; -import com.exteragram.messenger.ExteraConfig; - import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.ContactsController; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; -import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; @@ -28,7 +24,6 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.Components.BackgroundGradientDrawable; -import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.MotionBackgroundDrawable; diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/extras/Vibrate.java b/TMessagesProj/src/main/java/com/exteragram/messenger/extras/Vibrate.java index 3010818747..e17b96e652 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/extras/Vibrate.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/extras/Vibrate.java @@ -19,15 +19,19 @@ import android.view.View; import android.view.ViewGroup; -import com.exteragram.messenger.ExteraConfig; - +import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.FileLog; +import org.telegram.ui.ActionBar.BaseFragment; -public class Vibrate { +public final class Vibrate { private final static long time = 200L; + private static long[] vibrationWaveFormDurationPattern = {0, 1}; + public static void disableHapticFeedback(BaseFragment fragment) { + disableHapticFeedback(fragment.getFragmentView()); + } public static void disableHapticFeedback(View view) { if (view == null) { return; @@ -42,32 +46,34 @@ public static void disableHapticFeedback(View view) { } public static void vibrate() { - - if (ExteraConfig.disableVibration) { - return; - } - Vibrator vibrator; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { VibratorManager vibratorManager = (VibratorManager) ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_MANAGER_SERVICE); vibrator = vibratorManager.getDefaultVibrator(); } else { - vibrator = (Vibrator) ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_SERVICE); + vibrator = AndroidUtilities.getVibrator(); } if (vibrator != null && !vibrator.hasVibrator()) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - try { - vibrator.vibrate(VibrationEffect.createOneShot(time, VibrationEffect.DEFAULT_AMPLITUDE)); - } catch (Exception e) { - FileLog.e("Failed to vibrate"); - } - } else { - try { + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + VibrationEffect vibrationEffect = VibrationEffect.createWaveform(vibrationWaveFormDurationPattern, -1); + vibrator.cancel(); + vibrator.vibrate(vibrationEffect); + setDefaultPattern(); + } else { vibrator.vibrate(time); - } catch (Exception e) { - FileLog.e("Failed to vibrate"); } + } catch (Exception e) { + FileLog.e("Failed to vibrate"); } } } + + public static void setPattern(long[] pattern) { + vibrationWaveFormDurationPattern = pattern; + } + + public static void setDefaultPattern() { + Vibrate.setPattern(new long[]{0, 1}); + } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/icons/IconSetsController.java b/TMessagesProj/src/main/java/com/exteragram/messenger/icons/IconSetsController.java index ab1ef22a29..99a691a710 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/icons/IconSetsController.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/icons/IconSetsController.java @@ -19,6 +19,8 @@ public class IconSetsController { public static final SparseIntArray solar = new SparseIntArray(); static { + + solar.put(R.drawable.arrow_more, R.drawable.arrow_more_solar); solar.put(R.drawable.attach_send, R.drawable.attach_send_solar); solar.put(R.drawable.bot_file, R.drawable.msg_round_file_solar); @@ -98,6 +100,12 @@ public class IconSetsController { solar.put(R.drawable.list_pin, R.drawable.msg_pin_mini_solar); solar.put(R.drawable.list_secret, R.drawable.list_secret_solar); solar.put(R.drawable.menu_devices, R.drawable.msg_devices_solar); + solar.put(R.drawable.msg2_ask_question, R.drawable.msg_ask_question_solar); + solar.put(R.drawable.msg2_call_earpiece, R.drawable.msg_calls_solar); + solar.put(R.drawable.msg2_gif, R.drawable.msg_gif_solar); + solar.put(R.drawable.msg2_smile_status, R.drawable.input_smile_solar); + solar.put(R.drawable.msg2_sticker, R.drawable.msg_sticker_solar); + solar.put(R.drawable.msg2_videocall, R.drawable.msg_videocall_solar); solar.put(R.drawable.msg_addbio, R.drawable.msg_addbio_solar); solar.put(R.drawable.msg_addcontact, R.drawable.msg_contact_add_solar); solar.put(R.drawable.msg_addfolder, R.drawable.msg_addfolder_solar); @@ -358,7 +366,6 @@ public class IconSetsController { solar.put(R.drawable.msg_theme, R.drawable.msg_theme_solar); solar.put(R.drawable.msg_timeredit, R.drawable.msg_timeredit_solar); solar.put(R.drawable.msg_to_beginning, R.drawable.msg_to_beginning_solar); - solar.put(R.drawable.msg_tone_add, R.drawable.msg_tone_add_solar); solar.put(R.drawable.msg_tone_off, R.drawable.msg_tone_off_solar); solar.put(R.drawable.msg_tone_on, R.drawable.msg_tone_on_solar); @@ -405,7 +412,6 @@ public class IconSetsController { solar.put(R.drawable.photo_undo, R.drawable.photo_undo_solar); solar.put(R.drawable.picker, R.drawable.ic_colorpicker_solar); solar.put(R.drawable.pin, R.drawable.bot_location_solar); - solar.put(R.drawable.player_new_order, R.drawable.player_new_order_solar); solar.put(R.drawable.profile_discuss, R.drawable.profile_discuss_solar); solar.put(R.drawable.profile_newmsg_filled, R.drawable.profile_newmsg_filled_solar); solar.put(R.drawable.profile_phone, R.drawable.profile_phone_solar); @@ -417,6 +423,7 @@ public class IconSetsController { solar.put(R.drawable.reactionchatslist, R.drawable.msg_reactions_filled_solar); solar.put(R.drawable.screencast_big, R.drawable.screencast_big_solar); solar.put(R.drawable.search_files_filled, R.drawable.msg_round_file_solar); + solar.put(R.drawable.select_between, R.drawable.msg_select_between_solar); solar.put(R.drawable.share, R.drawable.msg_filled_shareout_solar); solar.put(R.drawable.share_arrow, R.drawable.share_arrow_solar); solar.put(R.drawable.smallanimationpin, R.drawable.smallanimationpin_solar); @@ -426,6 +433,7 @@ public class IconSetsController { solar.put(R.drawable.smiles_tab_settings, R.drawable.smiles_tab_settings_solar); solar.put(R.drawable.smiles_tab_smiles, R.drawable.input_smile_solar); solar.put(R.drawable.smiles_tab_stickers, R.drawable.msg_sticker_solar); + solar.put(R.drawable.stickers_empty, R.drawable.stickers_empty_solar); solar.put(R.drawable.stickers_favorites, R.drawable.stickers_favorites_solar); solar.put(R.drawable.stickers_gifs_trending, R.drawable.stickers_gifs_trending_solar); solar.put(R.drawable.stickers_recent, R.drawable.msg_emoji_recent_solar); diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/AppearancePreferencesActivity.java b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/AppearancePreferencesActivity.java index 4ca61a5093..3c6488d9b9 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/AppearancePreferencesActivity.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/AppearancePreferencesActivity.java @@ -106,7 +106,6 @@ public class AppearancePreferencesActivity extends BasePreferencesActivity { private int callsRow; private int peopleNearbyRow; private int archivedChatsRow; - private int downloadsRow; private int savedMessagesRow; private int scanQrRow; private int inviteFriendsRow; @@ -157,7 +156,6 @@ protected void updateRowsId() { callsRow = newRow(); peopleNearbyRow = ExteraUtils.hasGps() ? newRow() : -1; savedMessagesRow = newRow(); - downloadsRow = newRow(); scanQrRow = newRow(); inviteFriendsRow = newRow(); telegramFeaturesRow = newRow(); @@ -273,10 +271,6 @@ protected void onItemClick(View view, int position, float x, float y) { ExteraConfig.toggleDrawerElements(11); ((TextCell) view).setChecked(ExteraConfig.telegramFeatures); parentLayout.rebuildAllFragmentViews(false, false); - } else if (position == downloadsRow) { - ExteraConfig.toggleDrawerElements(13); - ((TextCell) view).setChecked(ExteraConfig.downloads); - parentLayout.rebuildAllFragmentViews(false, false); } else if (position == forceSnowRow) { ExteraConfig.editor.putBoolean("forceSnow", ExteraConfig.forceSnow ^= true).apply(); ((TextCheckCell) view).setChecked(ExteraConfig.forceSnow); @@ -292,7 +286,7 @@ protected void onItemClick(View view, int position, float x, float y) { ExteraConfig.editor.putInt("eventType", ExteraConfig.eventType = which).apply(); parentLayout.rebuildAllFragmentViews(false, false); listAdapter.notifyItemChanged(eventChooserRow, payload); - listAdapter.notifyItemRangeChanged(statusRow, 13); + listAdapter.notifyItemRangeChanged(statusRow, 12); }); } else if (position == hideActionBarStatusRow) { ExteraConfig.editor.putBoolean("hideActionBarStatus", ExteraConfig.hideActionBarStatus ^= true).apply(); @@ -452,8 +446,6 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi textCell.setTextAndCheckAndIcon(LocaleController.getString("SavedMessages", R.string.SavedMessages), ExteraConfig.savedMessages, icons[5], true); } else if (position == scanQrRow) { textCell.setTextAndCheckAndIcon(LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), ExteraConfig.scanQr, R.drawable.msg_qrcode, true); - } else if (position == downloadsRow) { - textCell.setTextAndCheckAndIcon(LocaleController.getString("DownloadsTabs", R.string.DownloadsTabs), ExteraConfig.downloads, R.drawable.msg_download, true); } else if (position == inviteFriendsRow) { textCell.setTextAndCheckAndIcon(LocaleController.getString("InviteFriends", R.string.InviteFriends), ExteraConfig.inviteFriends, icons[6], true); } else if (position == telegramFeaturesRow) { @@ -491,7 +483,7 @@ public int getItemViewType(int position) { return 1; } else if (position == statusRow || position == newGroupRow || position == newSecretChatRow || position == newChannelRow || position == contactsRow || position == callsRow || position == peopleNearbyRow || position == archivedChatsRow || - position == savedMessagesRow || position == scanQrRow || position == inviteFriendsRow || position == telegramFeaturesRow || position == downloadsRow) { + position == savedMessagesRow || position == scanQrRow || position == inviteFriendsRow || position == telegramFeaturesRow) { return 2; } else if (position == appearanceHeaderRow || position == drawerHeaderRow || position == drawerOptionsHeaderRow || position == mainScreenHeaderRow || position == solarIconsHeaderRow) { return 3; diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/ChatsPreferencesActivity.java b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/ChatsPreferencesActivity.java index 581cbf5e65..c72e68fb8e 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/ChatsPreferencesActivity.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/ChatsPreferencesActivity.java @@ -37,7 +37,6 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; -import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.Theme; diff --git a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/GeneralPreferencesActivity.java b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/GeneralPreferencesActivity.java index 1c85aab2a0..063e29ddc1 100644 --- a/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/GeneralPreferencesActivity.java +++ b/TMessagesProj/src/main/java/com/exteragram/messenger/preferences/GeneralPreferencesActivity.java @@ -118,7 +118,7 @@ protected void updateRowsId() { generalHeaderRow = newRow(); disableNumberRoundingRow = newRow(); formatTimeWithSecondsRow = newRow(); - disableVibrationRow = newRow(); + disableVibrationRow = -1; // need to be refactored disableProximitySensorRow = newRow(); tabletModeRow = newRow(); generalDividerRow = newRow(); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 2b289693d3..bad964b468 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -3562,7 +3562,7 @@ public void startRecording(int currentAccount, long dialogId, MessageObject repl requestAudioFocus(true); try { - if (!ExteraConfig.disableVibration) feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception e) { FileLog.e(e); } @@ -3798,7 +3798,7 @@ public void stopRecording(final int send, boolean notify, int scheduleDate) { } try { - if (!ExteraConfig.disableVibration) feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception e) { FileLog.e(e); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java index a8f68c8abe..75b246bf25 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java @@ -39,8 +39,6 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.os.VibrationEffect; -import android.os.Vibrator; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.Surface; @@ -51,6 +49,9 @@ import androidx.core.graphics.ColorUtils; +import com.exteragram.messenger.camera.BaseCameraView; +import com.exteragram.messenger.extras.Vibrate; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BuildVars; import org.telegram.messenger.DispatchQueue; @@ -80,9 +81,6 @@ import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; -import com.exteragram.messenger.ExteraConfig; -import com.exteragram.messenger.camera.BaseCameraView; - @SuppressLint("NewApi") public class CameraView extends BaseCameraView implements TextureView.SurfaceTextureListener { @@ -649,17 +647,10 @@ public void startTakePictureAnimation() { } public void runHaptic() { - long[] vibrationWaveFormDurationPattern = {0, 1}; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - - final Vibrator vibrator = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); - VibrationEffect vibrationEffect = VibrationEffect.createWaveform(vibrationWaveFormDurationPattern, -1); - - vibrator.cancel(); - vibrator.vibrate(vibrationEffect); + Vibrate.vibrate(); } else { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index 0b975d1386..f255cd9c0a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -735,7 +735,6 @@ private void prepareForMoving(MotionEvent ev) { View fragmentView = lastFragment.fragmentView; if (fragmentView == null) { fragmentView = lastFragment.createView(parentActivity); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(fragmentView); } ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { @@ -1155,6 +1154,7 @@ public boolean isInPreviewMenuMode() { @Override public boolean presentFragment(NavigationParams params) { BaseFragment fragment = params.fragment; + Vibrate.disableHapticFeedback(fragment); boolean removeLast = params.removeLast; boolean forceWithoutAnimation = params.noAnimation; boolean check = params.checkPresentFromDelegate; @@ -1191,7 +1191,6 @@ public boolean presentFragment(NavigationParams params) { View fragmentView = fragment.fragmentView; if (fragmentView == null) { fragmentView = fragment.createView(parentActivity); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(fragmentView); } else { ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { @@ -1654,7 +1653,6 @@ public void closeLastFragment(boolean animated, boolean forceNoAnimation) { View fragmentView = previousFragment.fragmentView; if (fragmentView == null) { fragmentView = previousFragment.createView(parentActivity); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(fragmentView); } if (!inPreviewMode) { @@ -1841,7 +1839,6 @@ public void bringToFront(int i) { View fragmentView = previousFragment.fragmentView; if (fragmentView == null) { fragmentView = previousFragment.createView(parentActivity); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(fragmentView); } else { ViewGroup parent = (ViewGroup) fragmentView.getParent(); if (parent != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java index a93fd3e6b0..8f928d1665 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -55,10 +55,6 @@ import java.util.ArrayList; -import com.exteragram.messenger.ExteraConfig; -import com.exteragram.messenger.extras.Vibrate; -import com.exteragram.messenger.preferences.BasePreferencesActivity; - public abstract class BaseFragment { private boolean isFinished; @@ -218,7 +214,6 @@ public void onRemoveFromParent() { public void setParentFragment(BaseFragment fragment) { setParentLayout(fragment.parentLayout); fragmentView = createView(parentLayout.getView().getContext()); - if (ExteraConfig.disableVibration) Vibrate.disableHapticFeedback(fragmentView); } public void setParentLayout(INavigationLayout layout) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java index 0af3d6affd..05d0e8e72d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java @@ -258,7 +258,6 @@ private void resetItems() { int contactsIcon; int callsIcon; int archiveIcon = R.drawable.msg_archive; - int downloadsIcon = R.drawable.msg_download; int scanQrIcon = R.drawable.msg_qrcode;; int savedIcon; int settingsIcon; @@ -330,7 +329,6 @@ private void resetItems() { if (ExteraConfig.calls) items.add(new Item(10, LocaleController.getString("Calls", R.string.Calls), callsIcon)); if (ExteraConfig.peopleNearby && hasGps) items.add(new Item(12, LocaleController.getString("PeopleNearby", R.string.PeopleNearby), peopleNearbyIcon)); if (ExteraConfig.savedMessages) items.add(new Item(11, LocaleController.getString("SavedMessages", R.string.SavedMessages), savedIcon)); - if (ExteraConfig.downloads) items.add(new Item(17, LocaleController.getString("DownloadsTabs", R.string.DownloadsTabs), downloadsIcon)); items.add(new Item(8, LocaleController.getString("Settings", R.string.Settings), settingsIcon)); if (ExteraConfig.inviteFriends || ExteraConfig.telegramFeatures || ExteraConfig.scanQr) items.add(null); if (ExteraConfig.scanQr) items.add(new Item(16, LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), scanQrIcon)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java index c270dbd39f..1c62d35340 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java @@ -1104,7 +1104,7 @@ public void run() { if (checkingForLongPress && windowView != null) { checkingForLongPress = false; if (pressedLink != null) { - if (!ExteraConfig.disableVibration) windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); showCopyPopup(pressedLink.getSpan().getUrl()); pressedLink = null; @@ -1118,10 +1118,10 @@ public void run() { } else { textSelectionHelper.trySelect(pressedLinkOwnerView); } - if (textSelectionHelper.isSelectionMode() && !ExteraConfig.disableVibration) { + if (textSelectionHelper.isSelectionMode()) { windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } - } else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null && !ExteraConfig.disableVibration) { + } else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) { windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);; int[] location = new int[2]; pressedLinkOwnerView.getLocationInWindow(location); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java index 070573567e..77e5b9f9d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java @@ -435,7 +435,7 @@ public boolean onTouchEvent(MotionEvent event) { } else { moveProgress = Math.max(-1, Math.min(0f, (event.getY() - downY) / AndroidUtilities.dp(56))); if (moveProgress == -1) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); moveAnimator = ValueAnimator.ofFloat(moveProgress, 0); moveAnimator.setDuration(200); moveAnimator.addUpdateListener(a -> { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java index 568a9eb4da..cd8fafd424 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java @@ -703,7 +703,7 @@ public void onLongPress(MotionEvent e) { PeriodDay periodDay = getDayAtCoord(e.getX(), e.getY()); if (periodDay != null) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); Bundle bundle = new Bundle(); if (dialogId > 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java index 7edb777222..b02110b2cf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java @@ -36,7 +36,6 @@ public void run() { if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) { checkingForLongPress = false; if (onLongPress()) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0); onTouchEvent(event); event.recycle(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 091e52968d..3fefadcfe4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -2358,7 +2358,7 @@ private boolean checkRoundSeekbar(MotionEvent event) { float p = a / 360f; if (Math.abs(currentMessageObject.audioProgress - p) > 0.9f) { if (roundSeekbarOutAlpha == 0) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } roundSeekbarOutAlpha = 1f; roundSeekbarOutProgress = currentMessageObject.audioProgress; @@ -5970,7 +5970,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe } int maxVote = 0; - if (!animatePollAnswer && pollVoteInProgress && vibrateOnPollVote && !ExteraConfig.disableVibration) { + if (!animatePollAnswer && pollVoteInProgress && vibrateOnPollVote) { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } animatePollAnswerAlpha = animatePollAnswer = attachedToWindow && (pollVoteInProgress || pollUnvoteInProgress); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 763fd489c0..ac273c7fcc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -2953,7 +2953,7 @@ public void setTranslationX(float value) { if (isSliding && !swipeCanceled) { boolean prevValue = drawRevealBackground; drawRevealBackground = Math.abs(translationX) >= getMeasuredWidth() * 0.45f; - if (prevValue != drawRevealBackground && archiveHidden == SharedConfig.archiveHidden && !ExteraConfig.disableVibration) { + if (prevValue != drawRevealBackground && archiveHidden == SharedConfig.archiveHidden) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java index d56cd45440..f33d84b7bb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java @@ -93,7 +93,7 @@ class CheckForLongPress implements Runnable { public void run() { if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) { checkingForLongPress = false; - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); if (pressedLinkIndex >= 0) { delegate.onLinkPress(links.get(pressedLinkIndex).toString(), true); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java index 5411ed376d..1cdfa861b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java @@ -20,6 +20,8 @@ import android.widget.FrameLayout; import android.widget.TextView; +import com.exteragram.messenger.extras.Vibrate; + import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.Emoji; @@ -315,10 +317,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { public void showRequirePremiumAnimation() { if (premiumIconView != null) { - Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); - if (v != null) { - v.vibrate(200); - } + Vibrate.vibrate(); AndroidUtilities.shakeView(premiumIconView); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java index 7f8b6b73e8..7b5c12f843 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java @@ -260,7 +260,7 @@ public void run() { textY = maybeTextY; selectedView = newView; - if (!ExteraConfig.disableVibration) textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); showActions(); invalidate(); @@ -874,7 +874,7 @@ public boolean onTouchEvent(MotionEvent event) { if (viewChanged || layoutOld != layoutNew || newSelectionLine != layoutNew.getLineForOffset(selectionStart) && newSelectionLine == nextWhitespaceLine) { jumpToLine(newSelection, nextWhitespace, viewChanged, layoutBlock.yOffset, oldYoffset, oldSelectedView); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); @@ -886,7 +886,7 @@ public boolean onTouchEvent(MotionEvent event) { selectionStart = k; movingHandleStart = false; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); @@ -937,7 +937,7 @@ public boolean onTouchEvent(MotionEvent event) { selectionStart = k; movingHandleStart = false; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); @@ -975,7 +975,7 @@ public boolean onTouchEvent(MotionEvent event) { if (viewChanged || layoutOld != layoutNew || newSelectionLine != layoutNew.getLineForOffset(selectionEnd) && newSelectionLine == nextWhitespaceLine) { jumpToLine(newSelection, nextWhitespace, viewChanged, layoutBlock.yOffset, oldYoffset, oldSelectedView); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); @@ -987,7 +987,7 @@ public boolean onTouchEvent(MotionEvent event) { selectionStart = k; movingHandleStart = true; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); @@ -1019,7 +1019,7 @@ public boolean onTouchEvent(MotionEvent event) { selectionStart = k; movingHandleStart = true; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && !ExteraConfig.disableVibration) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } TextSelectionHelper.this.invalidate(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java index 73d5e4151a..ad18df637e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java @@ -196,7 +196,7 @@ public boolean onTouchEvent(MotionEvent event) { if (action == MotionEvent.ACTION_DOWN) { pressed = true; } else { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); showOptionsForTheme(themeInfo); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java index 771385815d..07f761cade 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java @@ -66,6 +66,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.exteragram.messenger.ExteraConfig; +import com.exteragram.messenger.ExteraUtils; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import org.telegram.messenger.AndroidUtilities; @@ -292,6 +293,11 @@ public int getBottomOffset(int tag) { return true; } + @Override + public int getNavigationBarColor() { + return getThemedColor(ExteraUtils.getNavigationBarColorKey()); + } + @Override public void onFragmentDestroy() { super.onFragmentDestroy(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java b/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java index a0f08337e1..13e8bfe48b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java @@ -1488,7 +1488,7 @@ public void selectDate(long activeZoom) { legendSignatureView.setVisibility(VISIBLE); selectionA = 1f; moveLegend(chartFullWidth * (pickerDelegate.pickerStart) - HORIZONTAL_PADDING); - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } public long getStartDate() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Charts/PieChartView.java b/TMessagesProj/src/main/java/org/telegram/ui/Charts/PieChartView.java index 910384362e..cd1fff0c83 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Charts/PieChartView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Charts/PieChartView.java @@ -386,16 +386,13 @@ protected void selectXOnChart(int x, int y) { pieLegendView.setTranslationX(xl); pieLegendView.setTranslationY(yl); - if (!ExteraConfig.disableVibration) { - boolean v = false; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { - v = performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } - if (!v) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } + boolean v = false; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { + v = performHapticFeedback(HapticFeedbackConstants.TEXT_HANDLE_MOVE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } + if (!v) { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } - } moveLegend(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 78dc765411..e6c6df6f2b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -112,6 +112,7 @@ import com.exteragram.messenger.ExteraConfig; import com.exteragram.messenger.ExteraUtils; import com.exteragram.messenger.extras.PermissionUtils; +import com.exteragram.messenger.extras.Vibrate; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.zxing.common.detector.MathUtils; @@ -1350,7 +1351,7 @@ public void onSelectionChanged(int position, boolean selected, float x, float y) return; } if (messageObject.contentType == 0) { - limitReached = selected && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() >= 200; + limitReached = selected && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() >= 100; RecyclerView.ViewHolder holder = chatListView.findViewHolderForAdapterPosition(position); if (holder != null && holder.itemView instanceof ChatMessageCell) { processRowSelect(holder.itemView, false, x, y); @@ -3923,7 +3924,7 @@ private void processTouchEvent(MotionEvent e) { if (Math.abs(dx) >= AndroidUtilities.dp(50)) { if (!wasTrackingVibrate) { try { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} wasTrackingVibrate = true; } @@ -5804,7 +5805,7 @@ public void onClick(View view) { getMessagesController().markMentionsAsRead(dialog_id, getTopicId()); hasAllMentionsLocal = true; showMentionDownButton(false, true); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return true; }); @@ -6217,7 +6218,7 @@ public void getOutline(View view, Outline outline) { reactionsMentionCount = 0; updateReactionsMentionButton(true); getMessagesController().markReactionsAsRead(dialog_id, getTopicId()); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return false; }); reactionsMentiondownButton.setVisibility(View.INVISIBLE); @@ -14265,12 +14266,9 @@ private void addToSelectedMessages(MessageObject messageObject, boolean outside, } } } else { - if (selectedMessagesIds[0].size() + selectedMessagesIds[1].size() >= 200) { + if (selectedMessagesIds[0].size() + selectedMessagesIds[1].size() >= 100) { AndroidUtilities.shakeView(selectedMessagesCountTextView); - Vibrator vibrator = (Vibrator) ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_SERVICE); - if (vibrator != null) { - vibrator.vibrate(200); - } + Vibrate.vibrate(); return; } selectedMessagesIds[index].put(messageObject.getId(), messageObject); @@ -17462,7 +17460,7 @@ public void didReceivedNotification(int id, int account, final Object... args) { showPollSolution(cell.getMessageObject(), results); cell.showHintButton(false, true, 0); } - if (!ExteraConfig.disableVibration) pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); break; } } @@ -29248,7 +29246,7 @@ public void didPressReaction(ChatMessageCell cell, TLRPC.ReactionCount reaction, } if (longpress) { if (!ChatObject.isChannelAndNotMegaGroup(currentChat) || dialog_id >= 0) { - if (!ExteraConfig.disableVibration) cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); FrameLayout scrimPopupContainerLayout = new FrameLayout(getParentActivity()) { @Override public boolean dispatchKeyEvent(KeyEvent event) { @@ -31047,6 +31045,12 @@ public int getNavigationBarColor() { return getThemedColor(ExteraUtils.getNavigationBarColorKey()); } + @Override + public void setNavigationBarColor(int color) { + color = getNavigationBarColor(); + super.setNavigationBarColor(color); + } + @Override public int getThemedColor(String key) { Integer color = themeDelegate != null ? themeDelegate.getColor(key) : null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java index 81d205ed5f..69795cfeea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java @@ -216,7 +216,7 @@ public void draw(Canvas canvas, View parent, float progress, float alpha) { if ((progress >= 1f && lastProgress < 1f) || (progress < 1f && lastProgress == 1f)) { long time = System.currentTimeMillis(); if (time - lastHapticTime > 100) { - if (!ExteraConfig.disableVibration) parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); lastHapticTime = time; } lastProgress = progress; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java index c81291642b..12be54dda4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java @@ -2744,7 +2744,7 @@ public CharSequence getAccessibilityClassName() { }); final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { - if (!ExteraConfig.disableVibration) container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) { } @@ -2930,7 +2930,7 @@ public CharSequence getAccessibilityClassName() { }); final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { - if (!ExteraConfig.disableVibration) container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) { } @@ -3784,7 +3784,7 @@ public CharSequence getAccessibilityClassName() { dayPicker.setFormatter(value -> "" + value); final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { - if (!ExteraConfig.disableVibration) container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java index 9fe3026b83..c6ad492b8f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AudioPlayerAlert.java @@ -2416,7 +2416,7 @@ public CoverContainer(@NonNull Context context) { onImageUpdated(imageReceiver); } }); - imageViews[i].setRoundRadius(AndroidUtilities.dp(12)); + imageViews[i].setRoundRadius(AndroidUtilities.dp(10)); if (i == 1) { imageViews[i].setVisibility(GONE); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index f1297099f4..aba1ba41e4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -8671,7 +8671,7 @@ public void onAnimationEnd(Animator animation) { setStickersExpanded(false, false, false); } if (getParentFragment() != null) - AndroidUtilities.runOnUIThread(() -> AndroidUtilities.setNavigationBarColor(parentActivity.getWindow(), show == 1 ? getThemedColor(Theme.key_chat_emojiPanelBackground) : getParentFragment().getNavigationBarColor()), show == 1 ? 0 : 200); + AndroidUtilities.runOnUIThread(() -> AndroidUtilities.setNavigationBarColor(parentActivity.getWindow(), show == 1 ? getThemedColor(Theme.key_chat_emojiPanelBackground) : getParentFragment().getNavigationBarColor(), show != 1), show == 1 ? 0 : 200); updateFieldHint(false); checkBotMenu(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java index 2643d42e87..ee38d6e4ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java @@ -2490,7 +2490,7 @@ public boolean onTouch(View v, MotionEvent event) { view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2)); sendPopupWindow.dimBehind(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return false; }); @@ -2624,8 +2624,8 @@ public void show() { } openTransitionFinished = false; if (Build.VERSION.SDK_INT >= 30) { + navBarColor = baseFragment.getNavigationBarColor(); navBarColorKey = null; - navBarColor = ColorUtils.setAlphaComponent(getThemedColor(Theme.key_dialogBackground), 0); AndroidUtilities.setNavigationBarColor(getWindow(), navBarColor, false); AndroidUtilities.setLightNavigationBar(getWindow(), AndroidUtilities.computePerceivedBrightness(navBarColor) > 0.721); } @@ -3260,8 +3260,9 @@ public void onAnimationCancel(Animator animation) { // ChatAttachAlert.this.delegate.needEnterComment(); // } // }, 75); + AndroidUtilities.setNavigationBarColor(getWindow(), baseFragment.getNavigationBarColor(), false); + ValueAnimator navigationBarAnimator = ValueAnimator.ofFloat(0, 1); - setNavBarAlpha(0); navigationBarAnimator.addUpdateListener(a -> setNavBarAlpha((float) a.getAnimatedValue())); navigationBarAnimator.setStartDelay(25); navigationBarAnimator.setDuration(200); @@ -3272,7 +3273,7 @@ public void onAnimationCancel(Animator animation) { } private void setNavBarAlpha(float alpha) { - navBarColor = ColorUtils.setAlphaComponent(getThemedColor(Theme.key_dialogBackground), Math.min(255, Math.max(0, (int) (255 * alpha)))); + navBarColor = ColorUtils.blendARGB(baseFragment.getNavigationBarColor(), getThemedColor(Theme.key_dialogBackground), alpha); AndroidUtilities.setNavigationBarColor(getWindow(), navBarColor, false); AndroidUtilities.setLightNavigationBar(getWindow(), AndroidUtilities.computePerceivedBrightness(navBarColor) > 0.721); getContainer().invalidate(); @@ -4221,7 +4222,7 @@ public void dismiss() { layouts[a].onDismiss(); } } - AndroidUtilities.setNavigationBarColor(getWindow(), ColorUtils.setAlphaComponent(getThemedColor(Theme.key_dialogBackground), 0), true, tcolor -> { + AndroidUtilities.setNavigationBarColor(getWindow(), ColorUtils.setAlphaComponent(baseFragment.getNavigationBarColor(), 0), true, tcolor -> { navBarColorKey = null; navBarColor = tcolor; containerView.invalidate(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java index e54977b750..44cc4fe3ef 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java @@ -1685,7 +1685,7 @@ public boolean onTouchEvent(MotionEvent event) { draggingCellFromWidth = draggingCellDrawingRect.width(); draggingCellFromHeight = draggingCellDrawingRect.height(); try { - if (!ExteraConfig.disableVibration) ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} }, ViewConfiguration.getLongPressTimeout()); @@ -1747,7 +1747,7 @@ public boolean onTouchEvent(MotionEvent event) { } try { - if (!ExteraConfig.disableVibration) ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_RELEASE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_RELEASE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} updateGroups(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java index ceda5e0eef..699f41319f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java @@ -42,7 +42,7 @@ public class CustomPhoneKeyboardView extends ViewGroup { private Runnable onBackButton = () -> { if (editText == null || editText.length() == 0 && !dispatchBackWhenEmpty) return; - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); playSoundEffect(SoundEffectConstants.CLICK); editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); @@ -104,7 +104,7 @@ public CustomPhoneKeyboardView(Context context) { views[i].setOnClickListener(v -> { if (editText == null) return; - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); if (editText instanceof EditTextBoldCursor) { ((EditTextBoldCursor) editText).setTextWatchersSuppressed(true, false); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java index 4a070e0abe..19fb54d363 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java @@ -2556,8 +2556,8 @@ public boolean onTouchEvent(MotionEvent event) { } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) { backspacePressed = false; if (!backspaceOnce) { - if (delegate != null && delegate.onBackspace() && !ExteraConfig.disableVibration) { - if (!ExteraConfig.disableVibration) backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + if (delegate != null && delegate.onBackspace()) { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } } } @@ -5159,8 +5159,8 @@ private void postBackspaceRunnable(final int time) { if (!backspacePressed) { return; } - if (delegate != null && delegate.onBackspace() && !ExteraConfig.disableVibration) { - if (!ExteraConfig.disableVibration) backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + if (delegate != null && delegate.onBackspace()) { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } backspaceOnce = true; postBackspaceRunnable(Math.max(50, time - 100)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java index 5672998229..d2708a5322 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java @@ -544,7 +544,7 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) { isMuted = false; AndroidUtilities.runOnUIThread(toggleMicRunnable, 90); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); }; @@ -579,7 +579,7 @@ public boolean onTouchEvent(MotionEvent event) { muteButton.playAnimation(); if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, true, false); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } pressed = false; Theme.getFragmentContextViewWavesDrawable().updateState(true); @@ -631,7 +631,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { } muteButton.playAnimation(); Theme.getFragmentContextViewWavesDrawable().updateState(true); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); }); closeButton = new ImageView(context); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java index 92fe9cca89..b3a6b166d6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java @@ -132,7 +132,7 @@ public void run() { return; } AndroidUtilities.runOnUIThread(micRunnable, 90); - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); pressed = true; } } @@ -256,7 +256,7 @@ public boolean onTouchEvent(MotionEvent event) { if (pressed) { if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, false, false); - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } pressed = false; } else if (event.getAction() == MotionEvent.ACTION_UP && !moving) { @@ -323,7 +323,7 @@ public boolean onTouchEvent(MotionEvent event) { private void onTap() { if (VoIPService.getSharedInstance() != null) { showAlert(!showAlert); - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } }; @@ -891,7 +891,7 @@ void prepareToRemove(boolean prepare) { iconView.playAnimation(); } if (prepare) { - if (!ExteraConfig.disableVibration) button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } button.prepareToRemove(prepare); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java index 4932d8056a..4ee1b98c77 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java @@ -2411,13 +2411,9 @@ private void prepareEncoder() { if (cancelled) { return; } - if (!ExteraConfig.disableVibration) { - try { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } - } + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} AndroidUtilities.lockOrientation(baseFragment.getParentActivity()); recording = true; recordStartTime = System.currentTimeMillis(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java index 6d87bfbe1f..887bdcfdbb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java @@ -89,7 +89,7 @@ public void onLongPress(MotionEvent e) { recognizedLongPress = true; if (delegate != null) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); delegate.onEntityLongClicked(EntityView.this); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java index 264236cabc..18599a7b57 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java @@ -148,7 +148,7 @@ public void appendCharacter(String c) { return; } try { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } catch (Exception e) { FileLog.e(e); } @@ -269,7 +269,7 @@ public boolean eraseLastCharacter() { return false; } try { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } catch (Exception e) { FileLog.e(e); } @@ -1385,7 +1385,7 @@ public void onGlobalLayout() { getViewTreeObserver().removeOnGlobalLayoutListener(this); imageView.setProgress(0); imageView.playAnimation(); - if (!ExteraConfig.disableVibration) AndroidUtilities.runOnUIThread(() -> imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING), 350); + AndroidUtilities.runOnUIThread(() -> imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING), 350); AnimatorSet animatorSet = new AnimatorSet(); ArrayList animators = new ArrayList<>(); int w = AndroidUtilities.displaySize.x; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProximitySheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProximitySheet.java index e3ce3016bc..ecc6905888 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProximitySheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProximitySheet.java @@ -202,7 +202,7 @@ public CharSequence getAccessibilityClassName() { kmPicker.setTextOffset(AndroidUtilities.dp(20)); final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java index 132472e0c5..050f35a477 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java @@ -1232,8 +1232,8 @@ public void updateCurrentFrame(long time, boolean updateInBackground) { } else if (nextRenderingBitmap != null && (renderingBitmap == null || (timeDiff >= timeCheck && !skipFrameUpdate))) { if (vibrationPattern != null && currentParentView != null && allowVibration) { Integer force = vibrationPattern.get(currentFrame - 1); - if (force != null && !ExteraConfig.disableVibration) { - if (!ExteraConfig.disableVibration) currentParentView.performHapticFeedback(force == 1 ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + if (force != null) { + currentParentView.performHapticFeedback(force == 1 ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } setCurrentFrame(now, timeDiff, timeCheck, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java index 1a71c3a680..8d4f4f8474 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java @@ -699,7 +699,7 @@ public static void startAnimation() { currentOverlay.startTime = System.currentTimeMillis(); if (currentOverlay.animationType == LONG_ANIMATION && System.currentTimeMillis() - lastHapticTime > 200) { lastHapticTime = System.currentTimeMillis(); - if (!ExteraConfig.disableVibration) currentOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + currentOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } } else { startShortAnimation(); @@ -715,7 +715,7 @@ public static void startShortAnimation() { currentShortOverlay.startTime = System.currentTimeMillis(); if (currentShortOverlay.animationType == SHORT_ANIMATION && System.currentTimeMillis() - lastHapticTime > 200) { lastHapticTime = System.currentTimeMillis(); - if (!ExteraConfig.disableVibration) currentShortOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + currentShortOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java index 09e75d167f..b9531908f5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java @@ -1459,7 +1459,7 @@ public void resetAnimation() { Runnable longPressRunnable = new Runnable() { @Override public void run() { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); pressedReactionPosition = visibleReactionsList.indexOf(currentReaction); pressedReaction = currentReaction; ReactionsContainerLayout.this.invalidate(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java index 44f7ef806f..539a3c9cdb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java @@ -1090,16 +1090,12 @@ public void onLongPress(MotionEvent event) { View child = currentChildView; if (onItemLongClickListener != null) { if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) { - if (!ExteraConfig.disableVibration) { - child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } + child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); } } else { if (onItemLongClickListenerExtended.onItemClick(currentChildView, currentChildPosition, event.getX() - currentChildView.getX(), event.getY() - currentChildView.getY())) { - if (!ExteraConfig.disableVibration) { - child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } + child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); longPressCalled = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java index 78a6154c0b..0ec60ad4b0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java @@ -136,7 +136,7 @@ public void run() { return; } if (p >= 0 && p < tabsContainer.getChildCount()) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); draggindViewDxOnScreen = 0f; draggingViewOutProgress = 0f; draggingView = tabsContainer.getChildAt(p); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java index 1d1ec5bba5..3e5a9c3219 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java @@ -1961,7 +1961,7 @@ public boolean onTouch(View v, MotionEvent event) { } sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + AndroidUtilities.dp(8), y); sendPopupWindow.dimBehind(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java index d49f93fd90..3576bf5a1a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java @@ -1335,7 +1335,7 @@ public void afterTextChanged(Editable s) { state[0] = 3; if (!lastNameAvailable) { AndroidUtilities.shakeView(editText); - if (!ExteraConfig.disableVibration) editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } AndroidUtilities.hideKeyboard(editText); SendMessagesHelper.getInstance(currentAccount).prepareImportStickers(setTitle, lastCheckName, importingSoftware, importingStickersPaths, (param) -> { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java index 32b69a27bf..d0a67f9aec 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java @@ -109,7 +109,7 @@ protected void onDraw(Canvas canvas) { SharedConfig.updateChatListSwipeSetting(newVal); invalidate(); - if (!ExteraConfig.disableVibration) picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); }); picker.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); picker.setValue(SharedConfig.getChatSwipeAction(currentAccount)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java index 2753851025..840895859e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java @@ -1091,7 +1091,7 @@ public void showWithAction(ArrayList dialogIds, int action, Object infoObj leftImageView.playAnimation(); if (hapticDelay > 0) { leftImageView.postDelayed(() -> { - if (!ExteraConfig.disableVibration) leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); }, hapticDelay); } } else if (currentAction == ACTION_PROXIMITY_SET || currentAction == ACTION_PROXIMITY_REMOVED) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java index 634e575173..9c79ffa3c5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java @@ -126,14 +126,14 @@ public boolean onTouchEvent(MotionEvent event) { handled = true; } else if (x >= minusCx - AndroidUtilities.dp(16) && x <= minusCx + AndroidUtilities.dp(16) && y >= minusCy - AndroidUtilities.dp(16) && y <= minusCy + AndroidUtilities.dp(16)) { if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f - 0.25f)) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } else { pressed = true; } handled = true; } else if (x >= plusCx - AndroidUtilities.dp(16) && x <= plusCx + AndroidUtilities.dp(16) && y >= plusCy - AndroidUtilities.dp(16) && y <= plusCy + AndroidUtilities.dp(16)) { if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f + 0.25f)) { - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } else { pressed = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java index f664dcd2f3..cd663029df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java @@ -20,8 +20,6 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import android.os.VibrationEffect; -import android.os.Vibrator; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -71,7 +69,7 @@ import java.util.ArrayList; -import com.exteragram.messenger.ExteraConfig; +import com.exteragram.messenger.extras.Vibrate; public class ContentPreviewViewer { @@ -879,18 +877,9 @@ public boolean onTouch(MotionEvent event, final RecyclerListView listView, final return false; } - VibrationEffect vibrationEffect; - protected void runSmoothHaptic() { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - final Vibrator vibrator = (Vibrator) containerView.getContext().getSystemService(Context.VIBRATOR_SERVICE); - if (vibrationEffect == null) { - long[] vibrationWaveFormDurationPattern = {0, 2}; - vibrationEffect = VibrationEffect.createWaveform(vibrationWaveFormDurationPattern, -1); - } - vibrator.cancel(); - vibrator.vibrate(vibrationEffect); - } + Vibrate.setPattern(new long[]{0, 2}); + Vibrate.vibrate(); } public boolean onInterceptTouchEvent(MotionEvent event, final RecyclerListView listView, final int height, ContentPreviewViewerDelegate contentPreviewViewerDelegate, Theme.ResourcesProvider resourcesProvider) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index 469cde7ad2..8d046bbbfe 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -1852,7 +1852,7 @@ public boolean onTouchEvent(MotionEvent e) { } if (!canShowHiddenArchive) { canShowHiddenArchive = true; - if (!ExteraConfig.disableVibration) performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); if (parentPage.pullForegroundDrawable != null) { parentPage.pullForegroundDrawable.colorize(true); } @@ -3348,7 +3348,7 @@ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerVi if (canShowHiddenArchive != canShowInternal) { canShowHiddenArchive = canShowInternal; if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) { - if (!ExteraConfig.disableVibration) viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); if (viewPage.pullForegroundDrawable != null) { viewPage.pullForegroundDrawable.colorize(canShowInternal); } @@ -7222,7 +7222,7 @@ public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { } if (isOpen && afterSignup) { try { - if (!ExteraConfig.disableVibration) fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignored) { } if (getParentActivity() instanceof LaunchActivity) { @@ -9729,7 +9729,7 @@ public boolean onTouch(View v, MotionEvent event) { int y = location[1] - layout.getMeasuredHeight() - AndroidUtilities.dp(2); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + AndroidUtilities.dp(8), y); sendPopupWindow.dimBehind(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java index e30b985080..4fb3c3333e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java @@ -221,7 +221,7 @@ private void findViewAndShowAnimation(int messageId, int animation) { if (bestView != null) { chatActivity.restartSticker(bestView); if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker() && !bestView.getMessageObject().isAnimatedAnimatedEmoji()) { - if (!ExteraConfig.disableVibration) bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } showAnimationForCell(bestView, animation, false, true); } @@ -342,7 +342,7 @@ public boolean onTapItem(ChatMessageCell view, ChatActivity chatActivity, boolea boolean show = showAnimationForCell(view, -1, userTapped, false); if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker() && !view.getMessageObject().isAnimatedAnimatedEmoji()) { - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); } if (view.getMessageObject().isPremiumSticker() || (!userTapped && view.getMessageObject().isAnimatedEmojiStickerSingle())) { view.getMessageObject().forcePlayEffect = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java index 83270489a5..7bfb08fe0c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java @@ -427,7 +427,7 @@ public void run() { if (call == null || !scheduled || VoIPService.getSharedInstance() == null) { return; } - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); updateMuteButton(MUTE_BUTTON_STATE_MUTE, true); AndroidUtilities.runOnUIThread(unmuteRunnable, 80); scheduled = false; @@ -2049,7 +2049,7 @@ public void afterTextChanged(Editable s) { ignoreTextChange = true; s.delete(40, s.length()); AndroidUtilities.shakeView(editText); - if (!ExteraConfig.disableVibration) editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); ignoreTextChange = false; } } @@ -4154,7 +4154,7 @@ public boolean onTouchEvent(MotionEvent event) { updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true); if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, true, false); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } attachedRenderersTmp.clear(); attachedRenderersTmp.addAll(attachedRenderers); @@ -4235,7 +4235,7 @@ public void onClick(View v) { if (startingGroupCall) { return; } - if (!ExteraConfig.disableVibration) v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); startingGroupCall = true; TLRPC.TL_phone_startScheduledGroupCall req = new TLRPC.TL_phone_startScheduledGroupCall(); req.call = call.getInputGroupCall(); @@ -4270,7 +4270,7 @@ public void onClick(View v) { } playingHandAnimation = true; AndroidUtilities.shakeView(muteLabel[0]); - if (!ExteraConfig.disableVibration) v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); int num = Utilities.random.nextInt(100); int endFrame; int startFrame; @@ -4310,11 +4310,11 @@ public void onClick(View v) { } else if (muteButtonState == MUTE_BUTTON_STATE_UNMUTE) { updateMuteButton(MUTE_BUTTON_STATE_MUTE, true); VoIPService.getSharedInstance().setMicMute(false, false, true); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } else { updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true); VoIPService.getSharedInstance().setMicMute(true, false, true); - if (!ExteraConfig.disableVibration) muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } } @@ -4650,7 +4650,7 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { }); fullscreenUsersListView.setOnItemLongClickListener((view, position) -> { if (showMenuForCell(view)) { - if (!ExteraConfig.disableVibration) listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); } return false; }); @@ -5119,7 +5119,7 @@ public void requestLayout() { }); final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { - if (!ExteraConfig.disableVibration) container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LNavigation/LNavigation.java b/TMessagesProj/src/main/java/org/telegram/ui/LNavigation/LNavigation.java index 6adf3432af..a4173d9303 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LNavigation/LNavigation.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LNavigation/LNavigation.java @@ -42,6 +42,7 @@ import androidx.viewpager.widget.ViewPager; import com.exteragram.messenger.ExteraConfig; +import com.exteragram.messenger.extras.Vibrate; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ImageLoader; @@ -655,6 +656,7 @@ public boolean hasIntegratedBlurInPreview() { @Override public boolean presentFragment(NavigationParams params) { BaseFragment fragment = params.fragment; + Vibrate.disableHapticFeedback(fragment); if (!params.isFromDelay && (fragment == null || checkTransitionAnimation() || delegate != null && params.checkPresentFromDelegate && !delegate.needPresentFragment(this, params) || !fragment.onFragmentCreate() || delayedPresentAnimation != null)) { return false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 216872e49e..138cc3a490 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -621,13 +621,6 @@ public boolean drawChild(Canvas canvas, View child, long drawingTime) { drawerLayoutContainer.setAllowOpenDrawer(true, false); } drawerLayoutContainer.closeDrawer(false); - } else if (id == 17) { - BaseFragment fragment = actionBarLayout.getFragmentStack().get(0); - if (fragment instanceof DialogsActivity) { - ((DialogsActivity) fragment).showSearch(true, true, true); - fragment.getActionBar().openSearchField(true); - } - drawerLayoutContainer.closeDrawer(false); } } }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java index f1b9446f92..bda6bd2c0a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java @@ -436,6 +436,17 @@ private boolean isInCancelAccountDeletionMode() { return activityMode == MODE_CANCEL_ACCOUNT_DELETION; } + @Override + public int getNavigationBarColor() { + return getThemedColor(Theme.key_windowBackgroundWhite); + } + + @Override + public void setNavigationBarColor(int color) { + color = getNavigationBarColor(); + super.setNavigationBarColor(color); + } + @Override public void onFragmentDestroy() { super.onFragmentDestroy(); @@ -1034,7 +1045,7 @@ private void needShowAlert(String title, String text) { } private void onFieldError(View view, boolean allowErrorSelection) { - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); AndroidUtilities.shakeViewSpring(view, 3.5f); if (allowErrorSelection) { @@ -4522,7 +4533,7 @@ private void animateSuccess(Runnable callback) { private void shakeWrongCode() { try { - if (!ExteraConfig.disableVibration) codeFieldContainer.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + codeFieldContainer.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} for (int a = 0; a < codeFieldContainer.codeField.length; a++) { @@ -6370,12 +6381,10 @@ private void onPasscodeError(boolean clear) { if (getParentActivity() == null) { return; } - if (!ExteraConfig.disableVibration) { - try { - if (!ExteraConfig.disableVibration) codeFieldContainer.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception e) { - FileLog.e(e); - } + try { + codeFieldContainer.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception e) { + FileLog.e(e); } if (clear) { for (CodeNumberField f : codeFieldContainer.codeField) { @@ -6712,7 +6721,7 @@ private void onPasscodeError(boolean clear, int num) { return; } try { - if (!ExteraConfig.disableVibration) codeField[num].performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + codeField[num].performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignore) {} AndroidUtilities.shakeView(codeField[num]); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java index 265f8d4617..1af166b260 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java @@ -644,7 +644,7 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { if ((position >= linksStartRow && position < linksEndRow) || (position >= revokedLinksStartRow && position < revokedLinksEndRow)) { LinkCell cell = (LinkCell) view; cell.optionsView.callOnClick(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return true; } return false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java index 9a80d89fb0..b27504219b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java @@ -516,7 +516,7 @@ public boolean onTouch(View v, MotionEvent event) { view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2)); sendPopupWindow.dimBehind(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return false; }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java index d3eb7cf35e..97dac025b0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java @@ -1150,8 +1150,7 @@ public boolean onTouch(View v, MotionEvent event) { view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2)); sendPopupWindow.dimBehind(); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return false; }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 17697831dc..2e420caa6a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -5677,7 +5677,7 @@ public void setAlpha(float alpha) { int[] location = new int[2]; view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(14), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(18)); - if (!ExteraConfig.disableVibration) view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); return false; }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java index 75ae452faa..48d6af4f3c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeActivity.java @@ -1155,10 +1155,11 @@ public void onItemClick(int id) { ((TextCheckCell) view).setChecked(SharedConfig.chatBlurEnabled()); } } else if (position == lightModeRow) { - LiteMode.setAllFlags(LiteMode.getValue() == LiteMode.PRESET_LOW ? LiteMode.PRESET_HIGH : LiteMode.PRESET_LOW); - if (view instanceof TextCheckCell) { - ((TextCheckCell) view).setChecked(LiteMode.getValue() == LiteMode.PRESET_LOW); - } + presentFragment(new LiteModeSettingsActivity()); + //LiteMode.setAllFlags(LiteMode.getValue() == LiteMode.PRESET_LOW ? LiteMode.PRESET_HIGH : LiteMode.PRESET_LOW); + //if (view instanceof TextCheckCell) { + // ((TextCheckCell) view).setChecked(LiteMode.getValue() == LiteMode.PRESET_LOW); + //} } else if (position == nightThemeRow) { if (LocaleController.isRTL && x <= AndroidUtilities.dp(76) || !LocaleController.isRTL && x >= view.getMeasuredWidth() - AndroidUtilities.dp(76)) { NotificationsCheckCell checkCell = (NotificationsCheckCell) view; @@ -2156,6 +2157,23 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (position == bluetoothScoRow) { cell.setTextAndValue(LocaleController.getString(R.string.MicrophoneForVoiceMessages), LocaleController.getString(SharedConfig.recordViaSco ? R.string.MicrophoneForVoiceMessagesSco : R.string.MicrophoneForVoiceMessagesBuiltIn), updateRecordViaSco, true); updateRecordViaSco = false; + } else if (position == lightModeRow) { + String value; + switch (LiteMode.getValue()) { + case (LiteMode.PRESET_LOW): + value = LocaleController.getString("AutoDownloadLow", R.string.AutoDownloadLow); + break; + case (LiteMode.PRESET_MEDIUM): + value = LocaleController.getString("AutoDownloadMedium", R.string.AutoDownloadMedium); + break; + case (LiteMode.PRESET_HIGH): + value = LocaleController.getString("AutoDownloadHigh", R.string.AutoDownloadHigh); + break; + default: + value = LocaleController.getString("AutoDownloadCustom", R.string.AutoDownloadCustom); + break; + } + cell.setTextAndValue(LocaleController.getString("PowerUsage", R.string.PowerUsage), value, false); } break; } @@ -2247,8 +2265,6 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { textCheckCell.setTextAndValueAndCheck(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), SharedConfig.directShare, false, true); } else if (position == chatBlurRow) { textCheckCell.setTextAndCheck(LocaleController.getString("BlurInChat", R.string.BlurInChat), SharedConfig.chatBlurEnabled(), true); - } else if (position == lightModeRow) { - textCheckCell.setTextAndCheck(LocaleController.getString("LightMode", R.string.LightMode), LiteMode.getValue() == LiteMode.PRESET_LOW, true); } break; } @@ -2340,7 +2356,7 @@ public int getItemViewType(int position) { if (position == scheduleFromRow || position == distanceRow || position == scheduleToRow || position == scheduleUpdateLocationRow || position == contactsReimportRow || position == contactsSortRow || - position == bluetoothScoRow) { + position == bluetoothScoRow || position == lightModeRow) { return TYPE_TEXT_SETTING; } else if (position == automaticBrightnessInfoRow || position == scheduleLocationInfoRow || position == lightModeTopInfoRow) { return TYPE_TEXT_INFO_PRIVACY; @@ -2359,7 +2375,7 @@ public int getItemViewType(int position) { return TYPE_BRIGHTNESS; } else if (position == scheduleLocationRow || position == enableAnimationsRow || position == sendByEnterRow || position == raiseToSpeakRow || position == pauseOnRecordRow || position == customTabsRow || - position == directShareRow || position == chatBlurRow || position == lightModeRow) { + position == directShareRow || position == chatBlurRow) { return TYPE_TEXT_CHECK; } else if (position == textSizeRow) { return TYPE_TEXT_SIZE; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java index 5a4e87ff44..4854504e81 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java @@ -1443,7 +1443,7 @@ private void processNext() { if (!editTextFirstRow.getText().toString().equals(firstPassword) && currentType == TYPE_CREATE_PASSWORD_STEP_2) { AndroidUtilities.shakeViewSpring(outlineTextFirstRow, 5); try { - if (!ExteraConfig.disableVibration) outlineTextFirstRow.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + outlineTextFirstRow.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } catch (Exception ignored) {} try { Toast.makeText(getParentActivity(), LocaleController.getString("PasswordDoNotMatch", R.string.PasswordDoNotMatch), Toast.LENGTH_SHORT).show(); diff --git a/TMessagesProj/src/main/res-solar/drawable/msg_select_between_solar.xml b/TMessagesProj/src/main/res-solar/drawable/msg_select_between_solar.xml new file mode 100644 index 0000000000..3843301792 --- /dev/null +++ b/TMessagesProj/src/main/res-solar/drawable/msg_select_between_solar.xml @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res-solar/drawable/stickers_empty_solar.xml b/TMessagesProj/src/main/res-solar/drawable/stickers_empty_solar.xml new file mode 100644 index 0000000000..a7638274d9 --- /dev/null +++ b/TMessagesProj/src/main/res-solar/drawable/stickers_empty_solar.xml @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/nocover.xml b/TMessagesProj/src/main/res/drawable/nocover.xml index 22700ae6a5..5593091c57 100644 --- a/TMessagesProj/src/main/res/drawable/nocover.xml +++ b/TMessagesProj/src/main/res/drawable/nocover.xml @@ -1,21 +1,19 @@ - - - - - +android:width="96dp" +android:height="96dp" +android:viewportWidth="96" +android:viewportHeight="96"> + + + + \ No newline at end of file