Fix missing vibration condition

This commit is contained in:
世界 2021-02-25 18:37:11 +08:00
parent bca990b9e7
commit 535f946239
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
11 changed files with 67 additions and 21 deletions

View File

@ -3,7 +3,6 @@ name: Debug build
on:
push:
branches:
- main
- dev
paths-ignore:
- '**.md'
@ -119,6 +118,7 @@ jobs:
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Fix BoringSSL
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd TMessagesProj/jni
./patch_boringssl.sh

View File

@ -3,8 +3,8 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
def verName = "7.5.0-rc01"
def verCode = 202
def verName = "7.5.0-rc02"
def verCode = 204
if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1)")

View File

@ -45,6 +45,7 @@ import org.telegram.ui.Components.RadialProgress2;
import kotlin.Unit;
import tw.nekomimi.nekogram.BottomBuilder;
import tw.nekomimi.nekogram.NekoConfig;
public class AvatarPreviewer {
@ -435,7 +436,9 @@ public class AvatarPreviewer {
} else {
moveProgress = Math.max(-1, Math.min(0f, (event.getY() - downY) / AndroidUtilities.dp(56)));
if (moveProgress == -1) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (!NekoConfig.disableVibration) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
moveAnimator = ValueAnimator.ofFloat(moveProgress, 0);
moveAnimator.setDuration(200);
moveAnimator.addUpdateListener(a -> {

View File

@ -38,6 +38,8 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import java.util.ArrayList;
import java.util.Arrays;
import tw.nekomimi.nekogram.NekoConfig;
public abstract class BaseChartView<T extends ChartData, L extends LineViewData> extends View implements ChartPickerDelegate.Listener {
public SharedUiComponents sharedUiComponents;
@ -1466,7 +1468,9 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
legendSignatureView.setVisibility(VISIBLE);
selectionA = 1f;
moveLegend(chartFullWidth * (pickerDelegate.pickerStart) - HORIZONTAL_PADDING);
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
public long getStartDate() {

View File

@ -1900,7 +1900,9 @@ public class AlertsCreator {
});
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
}
@ -2086,7 +2088,9 @@ public class AlertsCreator {
});
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
}
@ -2290,7 +2294,9 @@ public class AlertsCreator {
dayPicker.setFormatter(value -> "" + value);
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
}

View File

@ -70,6 +70,8 @@ import org.telegram.ui.LocationActivity;
import java.util.ArrayList;
import tw.nekomimi.nekogram.NekoConfig;
public class FragmentContextView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, VoIPBaseService.StateListener {
private ImageView playButton;
@ -326,7 +328,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
isMuted = false;
AndroidUtilities.runOnUIThread(toggleMicRunnable, 90);
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
};
@ -418,7 +422,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
}
muteButton.playAnimation();
Theme.getFragmentContextViewWavesDrawable().updateState(true);
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
});
closeButton = new ImageView(context);

View File

@ -13,7 +13,6 @@ import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.SystemClock;
import android.provider.Settings;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
@ -38,6 +37,8 @@ import org.telegram.messenger.voip.VoIPService;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.GroupCallActivity;
import tw.nekomimi.nekogram.NekoConfig;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
public class GroupCallPip implements NotificationCenter.NotificationCenterDelegate {
@ -129,7 +130,9 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
return;
}
AndroidUtilities.runOnUIThread(micRunnable, 90);
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
pressed = true;
}
}
@ -253,7 +256,9 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
if (pressed) {
if (VoIPService.getSharedInstance() != null) {
VoIPService.getSharedInstance().setMicMute(true, false, false);
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
pressed = false;
} else if (event.getAction() == MotionEvent.ACTION_UP && !moving) {
@ -883,7 +888,9 @@ public class GroupCallPip implements NotificationCenter.NotificationCenterDelega
iconView.playAnimation();
}
if (prepare) {
button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
}
button.prepareToRemove(prepare);

View File

@ -37,6 +37,8 @@ import org.telegram.ui.ActionBar.Theme;
import java.util.Locale;
import tw.nekomimi.nekogram.NekoConfig;
public class ProximitySheet extends FrameLayout {
private VelocityTracker velocityTracker = null;
@ -200,7 +202,9 @@ public class ProximitySheet extends FrameLayout {
kmPicker.setTextOffset(AndroidUtilities.dp(20));
final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> {
try {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} catch (Exception ignore) {
}

View File

@ -4661,7 +4661,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
updateSelectedCount();
} else {
if (dialog instanceof TLRPC.TL_dialogFolder) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
BottomBuilder builder = new BottomBuilder(getParentActivity());
final boolean hasUnread = getMessagesStorage().getArchiveUnreadCount() != 0;

View File

@ -107,6 +107,8 @@ import org.telegram.ui.Components.voip.VoIPToggleButton;
import java.util.ArrayList;
import java.util.Locale;
import tw.nekomimi.nekogram.NekoConfig;
public class GroupCallActivity extends BottomSheet implements NotificationCenter.NotificationCenterDelegate, VoIPBaseService.StateListener {
private static final int eveyone_can_speak_item = 1;
@ -226,7 +228,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
if (!scheduled || VoIPService.getSharedInstance() == null) {
return;
}
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
updateMuteButton(MUTE_BUTTON_STATE_MUTE, true);
AndroidUtilities.runOnUIThread(unmuteRunnable, 80);
scheduled = false;
@ -1700,7 +1704,9 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true);
if (VoIPService.getSharedInstance() != null) {
VoIPService.getSharedInstance().setMicMute(true, true, false);
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
pressed = false;
MotionEvent cancel = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0);
@ -1747,11 +1753,15 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
if (muteButtonState == MUTE_BUTTON_STATE_UNMUTE) {
updateMuteButton(MUTE_BUTTON_STATE_MUTE, true);
VoIPService.getSharedInstance().setMicMute(false, false, true);
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
} else {
updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true);
VoIPService.getSharedInstance().setMicMute(true, false, true);
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
}
});

View File

@ -75,6 +75,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import tw.nekomimi.nekogram.NekoConfig;
public class ManageLinksActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
private ListAdapter listViewAdapter;
@ -651,7 +653,9 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen
if ((position >= linksStartRow && position < linksEndRow) || (position >= revokedLinksStartRow && position < revokedLinksEndRow)) {
LinkCell cell = (LinkCell) view;
cell.optionsView.callOnClick();
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (!NekoConfig.disableVibration) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
return true;
}
return false;