fix: add missed disableVibration
This commit is contained in:
parent
0df766e454
commit
1191332f75
@ -81,6 +81,9 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
import javax.microedition.khronos.opengles.GL;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class CameraView extends FrameLayout implements TextureView.SurfaceTextureListener {
|
||||
|
||||
@ -644,14 +647,12 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
|
||||
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);
|
||||
VibrateUtil.vibrate(200L, vibrationEffect);
|
||||
} else {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ import java.util.Set;
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class VoIPService extends Service implements SensorEventListener, AudioManager.OnAudioFocusChangeListener, VoIPController.ConnectionStateListener, NotificationCenter.NotificationCenterDelegate {
|
||||
@ -2952,14 +2953,13 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||
vibrate = prefs.getInt("vibrate_calls", 0);
|
||||
}
|
||||
if ((vibrate != 2 && vibrate != 4 && (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL)) || (vibrate == 4 && am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE)) {
|
||||
vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
long duration = 700;
|
||||
if (vibrate == 1) {
|
||||
duration /= 2;
|
||||
} else if (vibrate == 3) {
|
||||
duration *= 2;
|
||||
}
|
||||
vibrator.vibrate(new long[]{0, duration, 500}, 0);
|
||||
VibrateUtil.vibrate(new long[]{0, duration, 500}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4125,10 +4125,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
||||
if (groupCall == null && !wasEstablished) {
|
||||
wasEstablished = true;
|
||||
if (!isProximityNear && !privateCall.video) {
|
||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||
if (vibrator.hasVibrator()) {
|
||||
vibrator.vibrate(100);
|
||||
}
|
||||
VibrateUtil.vibrate(100);
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -64,6 +64,8 @@ import java.time.YearMonth;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class CalendarActivity extends BaseFragment {
|
||||
|
||||
public final static int TYPE_CHAT_ACTIVITY = 0;
|
||||
@ -691,7 +693,9 @@ public class CalendarActivity extends BaseFragment {
|
||||
PeriodDay periodDay = getDayAtCoord(e.getX(), e.getY());
|
||||
|
||||
if (periodDay != null) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
}
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
if (dialogId > 0) {
|
||||
|
@ -62,6 +62,7 @@ import org.telegram.ui.Components.URLSpanNoUnderline;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
||||
|
||||
public class AboutLinkCell extends FrameLayout {
|
||||
@ -397,9 +398,11 @@ public class AboutLinkCell extends FrameLayout {
|
||||
url = pressedLink.getSpan().toString();
|
||||
}
|
||||
|
||||
try {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
|
||||
ClickableSpan pressedLinkFinal = (ClickableSpan) pressedLink.getSpan();
|
||||
BottomBuilder builder = new BottomBuilder(parentFragment.getParentActivity());
|
||||
|
@ -67,6 +67,8 @@ import org.telegram.ui.Components.URLSpanNoUnderline;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -235,9 +237,11 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD
|
||||
if (messageObject != null && messageObject.wasUnread || forceWasUnread) {
|
||||
forceWasUnread = messageObject.wasUnread = false;
|
||||
|
||||
try {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (getContext() instanceof LaunchActivity) {
|
||||
|
@ -2142,7 +2142,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
float p = a / 360f;
|
||||
if (Math.abs(currentMessageObject.audioProgress - p) > 0.9f) {
|
||||
if (roundSeekbarOutAlpha == 0) {
|
||||
if (roundSeekbarOutAlpha == 0 && !NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
roundSeekbarOutAlpha = 1f;
|
||||
|
@ -42,6 +42,8 @@ import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.ListView.RecyclerListViewWithOverlayDraw;
|
||||
import org.telegram.ui.Components.Premium.PremiumLockIconView;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class StickerEmojiCell extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, RecyclerListViewWithOverlayDraw.OverlayView {
|
||||
|
||||
private ImageReceiver imageView;
|
||||
@ -312,10 +314,7 @@ public class StickerEmojiCell extends FrameLayout implements NotificationCenter.
|
||||
|
||||
public void showRequirePremiumAnimation() {
|
||||
if (premiumIconView != null) {
|
||||
Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (v != null) {
|
||||
v.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
AndroidUtilities.shakeView(premiumIconView, 2, 0);
|
||||
}
|
||||
}
|
||||
|
@ -316,6 +316,7 @@ import tw.nekomimi.nekogram.utils.EnvUtil;
|
||||
import tw.nekomimi.nekogram.utils.PGPUtil;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
import tw.nekomimi.nekogram.utils.TelegramUtil;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
import xyz.nextalone.nagram.helper.DoubleTap;
|
||||
import xyz.nextalone.nagram.helper.MessageHelper;
|
||||
@ -7031,7 +7032,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
chatActivityEnterView.getEditField().setAllowDrawCursor(true);
|
||||
}
|
||||
});
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -7428,7 +7431,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
chatActivityEnterView.getEditField().setAllowDrawCursor(true);
|
||||
}
|
||||
});
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
reactionsMentiondownButton.setVisibility(View.INVISIBLE);
|
||||
@ -10831,10 +10836,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaBanTooltip == null) {
|
||||
@ -13873,10 +13880,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
} else {
|
||||
if (selectedMessagesIds[0].size() + selectedMessagesIds[1].size() >= 1024) {
|
||||
AndroidUtilities.shakeView(selectedMessagesCountTextView, 2, 0);
|
||||
Vibrator vibrator = (Vibrator) ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
selectedMessagesIds[index].put(messageObject.getId(), messageObject);
|
||||
@ -24667,7 +24671,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
bulletin.show();
|
||||
View view = bulletin.getLayout();
|
||||
view.postDelayed(() -> {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}, 550);
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
|
@ -39,6 +39,8 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class ChatPullingDownDrawable implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
public int dialogFolderId;
|
||||
@ -214,7 +216,9 @@ public class ChatPullingDownDrawable implements NotificationCenter.NotificationC
|
||||
if ((progress >= 1f && lastProgress < 1f) || (progress < 1f && lastProgress == 1f)) {
|
||||
long time = System.currentTimeMillis();
|
||||
if (time - lastHapticTime > 100) {
|
||||
parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
lastHapticTime = time;
|
||||
}
|
||||
lastProgress = progress;
|
||||
|
@ -1816,10 +1816,7 @@ public class AlertsCreator {
|
||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
||||
CharSequence result = super.filter(source, start, end, dest, dstart, dend);
|
||||
if (result != null && source != null && result.length() != source.length()) {
|
||||
Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (v != null) {
|
||||
v.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
AndroidUtilities.shakeView(checkTextView, 2, 0);
|
||||
}
|
||||
return result;
|
||||
@ -2944,10 +2941,10 @@ public class AlertsCreator {
|
||||
}
|
||||
});
|
||||
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
checkScheduleDate(null, null, 0, dayPicker, hourPicker, minutePicker);
|
||||
};
|
||||
@ -3139,10 +3136,10 @@ public class AlertsCreator {
|
||||
container.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 15, 16, 16));
|
||||
|
||||
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
};
|
||||
numberPicker.setOnValueChangedListener(onValueChangeListener);
|
||||
@ -3278,10 +3275,10 @@ public class AlertsCreator {
|
||||
container.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 15, 16, 16));
|
||||
|
||||
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
};
|
||||
times.setOnValueChangedListener(onValueChangeListener);
|
||||
@ -3430,10 +3427,10 @@ public class AlertsCreator {
|
||||
|
||||
linearLayout.addView(numberPicker, LayoutHelper.createLinear(0, 54 * 5, 1f));
|
||||
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
};
|
||||
numberPicker.setOnValueChangedListener(onValueChangeListener);
|
||||
|
@ -40,6 +40,8 @@ import org.telegram.ui.PremiumPreviewFragment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public final class BulletinFactory {
|
||||
|
||||
public static BulletinFactory of(BaseFragment fragment) {
|
||||
@ -508,7 +510,9 @@ public final class BulletinFactory {
|
||||
layout.textView.setText(text);
|
||||
if (hapticDelay > 0) {
|
||||
layout.postDelayed(() -> {
|
||||
layout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
layout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}, hapticDelay);
|
||||
}
|
||||
return Bulletin.make(containerLayout, layout, Bulletin.DURATION_SHORT);
|
||||
@ -558,7 +562,9 @@ public final class BulletinFactory {
|
||||
layout.textView.setText(text);
|
||||
if (hapticDelay > 0) {
|
||||
layout.postDelayed(() -> {
|
||||
layout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
layout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}, hapticDelay);
|
||||
}
|
||||
return Bulletin.make(containerLayout, layout, Bulletin.DURATION_SHORT);
|
||||
|
@ -109,6 +109,7 @@ import androidx.dynamicanimation.animation.SpringForce;
|
||||
import androidx.recyclerview.widget.ChatListItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
import xyz.nextalone.nagram.helper.Dialogs;
|
||||
import xyz.nextalone.nagram.ui.syntaxhighlight.SyntaxHighlight;
|
||||
@ -5672,10 +5673,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
||||
}
|
||||
if (currentLimit - codePointCount < 0) {
|
||||
AndroidUtilities.shakeView(captionLimitView, 2, 0);
|
||||
Vibrator v = (Vibrator) captionLimitView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (v != null) {
|
||||
v.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
if (searchingType != 0) {
|
||||
|
@ -118,6 +118,8 @@ import tw.nekomimi.nekogram.transtale.TranslateDb;
|
||||
import tw.nekomimi.nekogram.transtale.Translator;
|
||||
import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ChatAttachAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate, BottomSheet.BottomSheetDelegateInterface {
|
||||
@ -2289,10 +2291,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||
writeButton.setOnClickListener(v -> {
|
||||
if (currentLimit - codepointCount < 0) {
|
||||
AndroidUtilities.shakeView(captionLimitView, 2, 0);
|
||||
Vibrator vibrator = (Vibrator) captionLimitView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
if (editingMessageObject == null && baseFragment instanceof ChatActivity && ((ChatActivity) baseFragment).isInScheduleMode()) {
|
||||
|
@ -61,6 +61,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class ChatAttachAlertPhotoLayoutPreview extends ChatAttachAlert.AttachAlertLayout {
|
||||
|
||||
private final long durationMultiplier = 1;
|
||||
@ -1652,9 +1654,12 @@ public class ChatAttachAlertPhotoLayoutPreview extends ChatAttachAlert.AttachAle
|
||||
draggingCellTop = (draggingCellTouchY - draggingCellRect.top) / (float) draggingCellRect.height();
|
||||
draggingCellFromWidth = draggingCellDrawingRect.width();
|
||||
draggingCellFromHeight = draggingCellDrawingRect.height();
|
||||
try {
|
||||
ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
}, ViewConfiguration.getLongPressTimeout());
|
||||
|
||||
invalidate();
|
||||
@ -1714,9 +1719,12 @@ public class ChatAttachAlertPhotoLayoutPreview extends ChatAttachAlert.AttachAle
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_RELEASE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
ChatAttachAlertPhotoLayoutPreview.this.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_RELEASE, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
updateGroups();
|
||||
toPhotoLayout(photoLayout, false);
|
||||
|
@ -26,6 +26,8 @@ import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class CustomPhoneKeyboardView extends ViewGroup {
|
||||
public final static int KEYBOARD_HEIGHT_DP = 230;
|
||||
|
||||
@ -40,7 +42,9 @@ public class CustomPhoneKeyboardView extends ViewGroup {
|
||||
private Runnable onBackButton = () -> {
|
||||
if (editText == null || editText.length() == 0 && !dispatchBackWhenEmpty) return;
|
||||
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
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));
|
||||
@ -102,7 +106,9 @@ public class CustomPhoneKeyboardView extends ViewGroup {
|
||||
views[i].setOnClickListener(v -> {
|
||||
if (editText == null) return;
|
||||
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
if (editText instanceof EditTextBoldCursor) {
|
||||
((EditTextBoldCursor) editText).setTextWatchersSuppressed(true, false);
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private LongSparseArray<AnimatedEmojiDrawable> animatedEmojiDrawables;
|
||||
@ -493,9 +495,12 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
|
||||
onCloseByLink();
|
||||
dismiss();
|
||||
} catch (Exception ignore) {}
|
||||
try {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
} catch (Exception e) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -573,9 +578,12 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
|
||||
view.getLocationInWindow(loc);
|
||||
popupWindow.showAtLocation(view, Gravity.TOP | Gravity.LEFT, loc[0] - AndroidUtilities.dp(49) + view.getMeasuredWidth() / 2, loc[1] - AndroidUtilities.dp(52));
|
||||
|
||||
try {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
} catch (Exception e) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1842,7 +1842,9 @@ public class FilterTabsView extends FrameLayout {
|
||||
TabView tabView = (TabView) listView.getChildAt(i);
|
||||
if (tabView.currentTab.id == id) {
|
||||
tabView.shakeLockIcon(1, 0);
|
||||
tabView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
tabView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +540,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
||||
muteButton.playAnimation();
|
||||
if (VoIPService.getSharedInstance() != null) {
|
||||
VoIPService.getSharedInstance().setMicMute(true, true, false);
|
||||
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}
|
||||
pressed = false;
|
||||
Theme.getFragmentContextViewWavesDrawable().updateState(true);
|
||||
|
@ -35,6 +35,8 @@ import org.telegram.ui.Components.voip.VoIPToggleButton;
|
||||
import org.telegram.ui.GroupCallActivity;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class GroupCallPipAlertView extends LinearLayout implements VoIPService.StateListener, NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
public static final int POSITION_LEFT = 0;
|
||||
@ -138,10 +140,7 @@ public class GroupCallPipAlertView extends LinearLayout implements VoIPService.S
|
||||
if (VoIPService.getSharedInstance().mutedByAdmin()) {
|
||||
muteButton.shakeView();
|
||||
try {
|
||||
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
@ -1425,7 +1425,9 @@ public class PasscodeView extends FrameLayout implements NotificationCenter.Noti
|
||||
getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
imageView.setProgress(0);
|
||||
imageView.playAnimation();
|
||||
AndroidUtilities.runOnUIThread(() -> imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING), 350);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
AndroidUtilities.runOnUIThread(() -> imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING), 350);
|
||||
}
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
ArrayList<Animator> animators = new ArrayList<>();
|
||||
int w = AndroidUtilities.displaySize.x;
|
||||
|
@ -63,6 +63,8 @@ import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
import org.telegram.ui.PremiumPreviewFragment;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class PhotoViewerCaptionEnterView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayoutPhoto.SizeNotifierFrameLayoutPhotoDelegate {
|
||||
|
||||
private final ImageView doneButton;
|
||||
@ -377,10 +379,7 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica
|
||||
doneButton.setOnClickListener(view -> {
|
||||
if (MessagesController.getInstance(currentAccount).getCaptionMaxLengthLimit() - codePointCount < 0) {
|
||||
AndroidUtilities.shakeView(captionLimitView, 2, 0);
|
||||
Vibrator v = (Vibrator) captionLimitView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (v != null) {
|
||||
v.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
delegate.onCaptionEnter();
|
||||
|
@ -60,6 +60,8 @@ import org.telegram.ui.PremiumPreviewFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class PremiumPreviewBottomSheet extends BottomSheetWithRecyclerListView implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
ArrayList<PremiumPreviewFragment.PremiumFeatureData> premiumFeatures = new ArrayList<>();
|
||||
@ -555,10 +557,13 @@ public class PremiumPreviewBottomSheet extends BottomSheetWithRecyclerListView i
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 4);
|
||||
if (animateConfetti) {
|
||||
AndroidUtilities.runOnUIThread(()->{
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
fireworksOverlay.start();
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
fireworksOverlay.start();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class ReactionsContainerLayout extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") {
|
||||
@ -206,7 +208,9 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||
boolean b1 = oldProgress > 1f;
|
||||
boolean b2 = newProgress > 1f;
|
||||
if (b1 != b2) {
|
||||
recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
}
|
||||
if (pullingLeftOffset < 0) {
|
||||
dx = (int) pullingLeftOffset;
|
||||
@ -237,7 +241,9 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||
boolean b1 = oldProgress > 1f;
|
||||
boolean b2 = newProgress > 1f;
|
||||
if (b1 != b2) {
|
||||
recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
}
|
||||
if (customReactionsContainer != null) {
|
||||
customReactionsContainer.invalidate();
|
||||
@ -1367,7 +1373,9 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||
Runnable longPressRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
}
|
||||
pressedReactionPosition = visibleReactionsList.indexOf(currentReaction);
|
||||
pressedReaction = currentReaction;
|
||||
ReactionsContainerLayout.this.invalidate();
|
||||
|
@ -53,6 +53,8 @@ import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class ScrollSlidingTabStrip extends HorizontalScrollView {
|
||||
|
||||
public interface ScrollSlidingTabStripDelegate {
|
||||
@ -132,7 +134,9 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
|
||||
return;
|
||||
}
|
||||
if (p >= 0 && p < tabsContainer.getChildCount()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
}
|
||||
draggindViewDxOnScreen = 0f;
|
||||
draggingViewOutProgress = 0f;
|
||||
draggingView = tabsContainer.getChildAt(p);
|
||||
|
@ -1604,7 +1604,9 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
|
||||
}
|
||||
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + AndroidUtilities.dp(8), y);
|
||||
sendPopupWindow.dimBehind();
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
|
||||
public class StickersAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate {
|
||||
@ -1389,7 +1390,9 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
|
||||
state[0] = 3;
|
||||
if (!lastNameAvailable) {
|
||||
AndroidUtilities.shakeView(editText, 2, 0);
|
||||
editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}
|
||||
AndroidUtilities.hideKeyboard(editText);
|
||||
SendMessagesHelper.getInstance(currentAccount).prepareImportStickers(setTitle, lastCheckName, importingSoftware, importingStickersPaths, (param) -> {
|
||||
|
@ -24,6 +24,8 @@ import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class SwipeGestureSettingsView extends FrameLayout {
|
||||
|
||||
public static final int SWIPE_GESTURE_PIN = 0;
|
||||
@ -106,7 +108,9 @@ public class SwipeGestureSettingsView extends FrameLayout {
|
||||
|
||||
SharedConfig.updateChatListSwipeSetting(newVal);
|
||||
invalidate();
|
||||
picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
});
|
||||
picker.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
picker.setValue(SharedConfig.getChatSwipeAction(currentAccount));
|
||||
|
@ -37,6 +37,8 @@ import androidx.annotation.Keep;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class Switch extends View {
|
||||
|
||||
private RectF rectF;
|
||||
@ -544,10 +546,8 @@ public class Switch extends View {
|
||||
private void vibrateChecked(boolean toCheck) {
|
||||
try {
|
||||
if (isHapticFeedbackEnabled() && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||
Vibrator vibrator = AndroidUtilities.getVibrator();
|
||||
VibrationEffect vibrationEffect = VibrationEffect.createWaveform(new long[]{75,10,5,10}, new int[] {5,20,110,20}, -1);
|
||||
vibrator.cancel();
|
||||
vibrator.vibrate(vibrationEffect);
|
||||
VibrateUtil.vibrate(200L, vibrationEffect);
|
||||
semHaptics = true;
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
|
@ -1122,7 +1122,9 @@ public class UndoView extends FrameLayout {
|
||||
leftImageView.playAnimation();
|
||||
if (hapticDelay > 0) {
|
||||
leftImageView.postDelayed(() -> {
|
||||
leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}, hapticDelay);
|
||||
}
|
||||
} else if (currentAction == ACTION_PROXIMITY_SET || currentAction == ACTION_PROXIMITY_REMOVED) {
|
||||
|
@ -74,6 +74,7 @@ import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.ui.MessageHelper;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class ContentPreviewViewer {
|
||||
|
||||
@ -714,13 +715,11 @@ public class ContentPreviewViewer {
|
||||
|
||||
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);
|
||||
VibrateUtil.vibrate(200L, vibrationEffect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6084,9 +6084,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
blurredView.setBackground(null);
|
||||
}
|
||||
if (isOpen && afterSignup) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
if (getParentActivity() instanceof LaunchActivity) {
|
||||
((LaunchActivity) getParentActivity()).getFireworksOverlay().start();
|
||||
}
|
||||
@ -8385,7 +8387,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||
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();
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
||||
|
||||
if (bestView != null) {
|
||||
chatActivity.restartSticker(bestView);
|
||||
if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker() && !bestView.getMessageObject().isAnimatedAnimatedEmoji()) {
|
||||
if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker() && !bestView.getMessageObject().isAnimatedAnimatedEmoji() && !NekoConfig.disableVibration.Bool()) {
|
||||
bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
showAnimationForCell(bestView, animation, false, true);
|
||||
@ -345,7 +345,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
||||
}
|
||||
boolean show = showAnimationForCell(view, -1, userTapped, false);
|
||||
|
||||
if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker() && !view.getMessageObject().isAnimatedAnimatedEmoji()) {
|
||||
if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker() && !view.getMessageObject().isAnimatedAnimatedEmoji() && !NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
if (view.getMessageObject().isPremiumSticker() || (!userTapped && view.getMessageObject().isAnimatedEmojiStickerSingle())) {
|
||||
@ -619,7 +619,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
||||
public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, boolean memCache) {}
|
||||
@Override
|
||||
public void onAnimationReady(ImageReceiver imageReceiver) {
|
||||
if (sendTap && messageObject.isAnimatedAnimatedEmoji() && imageReceiver.getLottieAnimation() != null && !imageReceiver.getLottieAnimation().hasVibrationPattern()) {
|
||||
if (sendTap && messageObject.isAnimatedAnimatedEmoji() && imageReceiver.getLottieAnimation() != null && !imageReceiver.getLottieAnimation().hasVibrationPattern() && !NekoConfig.disableVibration.Bool()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
}
|
||||
|
@ -2051,7 +2051,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
||||
ignoreTextChange = true;
|
||||
s.delete(40, s.length());
|
||||
AndroidUtilities.shakeView(editText, 2, 0);
|
||||
editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
ignoreTextChange = false;
|
||||
}
|
||||
}
|
||||
@ -4240,7 +4242,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
||||
if (startingGroupCall) {
|
||||
return;
|
||||
}
|
||||
v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
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();
|
||||
@ -4275,7 +4279,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
||||
}
|
||||
playingHandAnimation = true;
|
||||
AndroidUtilities.shakeView(muteLabel[0], 2, 0);
|
||||
v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
int num = Utilities.random.nextInt(100);
|
||||
int endFrame;
|
||||
int startFrame;
|
||||
@ -5129,10 +5135,10 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
|
||||
}
|
||||
});
|
||||
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
AlertsCreator.checkScheduleDate(scheduleButtonTextView, scheduleInfoTextView, 7 * 24 * 60 * 60, 2, dayPicker, hourPicker, minutePicker);
|
||||
};
|
||||
|
@ -44,6 +44,8 @@ import org.telegram.ui.Components.SlideChooseView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
public class LinkEditActivity extends BaseFragment {
|
||||
|
||||
public final static int CREATE_TYPE = 0;
|
||||
@ -518,10 +520,7 @@ public class LinkEditActivity extends BaseFragment {
|
||||
int timeIndex = timeChooseView.getSelectedIndex();
|
||||
if (timeIndex < dispalyedDates.size() && dispalyedDates.get(timeIndex) < 0) {
|
||||
AndroidUtilities.shakeView(timeEditText, 2, 0);
|
||||
Vibrator vibrator = (Vibrator) timeEditText.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -264,6 +264,7 @@ import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
||||
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
import xyz.nextalone.nagram.NaConfig;
|
||||
import xyz.nextalone.nagram.helper.MessageHelper;
|
||||
|
||||
@ -742,9 +743,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
BottomSheet bottomSheet = builder.create();
|
||||
bottomSheet.scrollNavBar = true;
|
||||
bottomSheet.show();
|
||||
try {
|
||||
containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
bottomSheet.setItemColor(0,0xffffffff, 0xffffffff);
|
||||
bottomSheet.setItemColor(1,0xffffffff, 0xffffffff);
|
||||
bottomSheet.setBackgroundColor(0xff1C2229);
|
||||
@ -5422,10 +5425,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||
pickerViewSendButton.setOnClickListener(v -> {
|
||||
if (captionEditText.getCaptionLimitOffset() < 0) {
|
||||
AndroidUtilities.shakeView(captionLimitView, 2, 0);
|
||||
Vibrator vibrator = (Vibrator) captionLimitView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (vibrator != null) {
|
||||
vibrator.vibrate(200);
|
||||
}
|
||||
VibrateUtil.vibrate();
|
||||
return;
|
||||
}
|
||||
if (parentChatActivity != null && parentChatActivity.isInScheduleMode() && !parentChatActivity.isEditingMessageMedia()) {
|
||||
|
@ -58,6 +58,8 @@ import org.telegram.ui.Components.TextStyleSpan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
|
||||
public class PrivacySettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private ListAdapter listAdapter;
|
||||
@ -309,10 +311,12 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_FORWARDS));
|
||||
} else if (position == voicesRow) {
|
||||
if (!getUserConfig().isPremium()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
BulletinFactory.of(this).createRestrictVoiceMessagesPremiumBulletin().show();
|
||||
return;
|
||||
@ -344,11 +348,11 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
||||
layout.textView.setText(LocaleController.getString(R.string.YourLoginEmailChangedSuccess));
|
||||
int duration = Bulletin.DURATION_SHORT;
|
||||
Bulletin.make(PrivacySettingsActivity.this, layout, duration).show();
|
||||
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
loadPasswordSettings();
|
||||
})))
|
||||
.setNegativeButton(LocaleController.getString(R.string.Cancel), null)
|
||||
|
@ -8895,10 +8895,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
new SearchResult(107, LocaleController.getString("GroupsAndChannels", R.string.GroupsAndChannels), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.msg_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_INVITE, true))),
|
||||
new SearchResult(123, LocaleController.getString("PrivacyVoiceMessages", R.string.PrivacyVoiceMessages), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.msg_secret, () -> {
|
||||
if (!getUserConfig().isPremium()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
BulletinFactory.of(ProfileActivity.this).createRestrictVoiceMessagesPremiumBulletin().show();
|
||||
return;
|
||||
|
@ -90,6 +90,7 @@ import org.telegram.ui.Components.spoilers.SpoilersTextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.ui.EditTextAutoFill;
|
||||
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
||||
|
||||
@ -1447,9 +1448,11 @@ public class TwoStepVerificationSetupActivity extends BaseFragment {
|
||||
}
|
||||
if (!editTextFirstRow.getText().toString().equals(firstPassword) && currentType == TYPE_CREATE_PASSWORD_STEP_2) {
|
||||
AndroidUtilities.shakeViewSpring(outlineTextFirstRow, 5);
|
||||
try {
|
||||
outlineTextFirstRow.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
} catch (Exception ignored) {}
|
||||
if (!NekoConfig.disableVibration.Bool()) {
|
||||
try {
|
||||
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();
|
||||
} catch (Exception e) {
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.VibrationEffect
|
||||
import android.os.Vibrator
|
||||
import android.os.VibratorManager
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.children
|
||||
@ -14,49 +15,69 @@ object VibrateUtil {
|
||||
|
||||
lateinit var vibrator: Vibrator
|
||||
|
||||
fun initVibrator() {
|
||||
if (!::vibrator.isInitialized) {
|
||||
vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val vibratorManager =
|
||||
ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
|
||||
vibratorManager.defaultVibrator;
|
||||
} else {
|
||||
ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun vibrate(time: Long = 200L) {
|
||||
|
||||
fun vibrate(time: Long = 200L, effect: VibrationEffect? = null) {
|
||||
if (NekoConfig.disableVibration.Bool()) return
|
||||
|
||||
if (!::vibrator.isInitialized) {
|
||||
|
||||
vibrator = ApplicationLoader.applicationContext.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||
|
||||
}
|
||||
initVibrator()
|
||||
|
||||
if (!vibrator.hasVibrator()) return
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
||||
runCatching {
|
||||
|
||||
val effect = VibrationEffect.createOneShot(time, VibrationEffect.DEFAULT_AMPLITUDE)
|
||||
|
||||
vibrator.vibrate(effect, null)
|
||||
|
||||
var vibe = effect
|
||||
if (vibe == null) {
|
||||
vibe = VibrationEffect.createOneShot(time, VibrationEffect.DEFAULT_AMPLITUDE)
|
||||
}
|
||||
vibrator.cancel()
|
||||
vibrator.vibrate(vibe, null)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
runCatching {
|
||||
|
||||
vibrator.cancel()
|
||||
vibrator.vibrate(time)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun disableHapticFeedback(view: View) {
|
||||
|
||||
view.isHapticFeedbackEnabled = false
|
||||
|
||||
(view as? ViewGroup)?.children?.forEach(::disableHapticFeedback)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@JvmStatic
|
||||
fun vibrate(longs: LongArray, repeat: Int) {
|
||||
if (NekoConfig.disableVibration.Bool()) return
|
||||
|
||||
initVibrator()
|
||||
|
||||
if (!vibrator.hasVibrator()) return
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
runCatching {
|
||||
val vibe = VibrationEffect.createWaveform(longs, repeat)
|
||||
vibrator.cancel()
|
||||
vibrator.vibrate(vibe, null)
|
||||
}
|
||||
} else {
|
||||
runCatching {
|
||||
vibrator.cancel()
|
||||
vibrator.vibrate(longs, repeat)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user