mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 20:49:36 +01:00
Merge pull request #1632 from nextcloud/vibrateAway
Remove vibrate setting
This commit is contained in:
commit
963e3c50dc
@ -28,6 +28,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
@ -140,7 +141,14 @@ public class BrowserFileItem extends AbstractFlexibleItem<BrowserFileItem.ViewHo
|
|||||||
holder.selectFileCheckbox.setVisibility(View.VISIBLE);
|
holder.selectFileCheckbox.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.fileIconImageView.getHierarchy().setPlaceholderImage(context.getDrawable(DrawableUtils.INSTANCE.getDrawableResourceIdForMimeType(browserFile.getMimeType())));
|
if (context != null) {
|
||||||
|
holder
|
||||||
|
.fileIconImageView
|
||||||
|
.getHierarchy()
|
||||||
|
.setPlaceholderImage(
|
||||||
|
AppCompatResources.getDrawable(
|
||||||
|
context, DrawableUtils.INSTANCE.getDrawableResourceIdForMimeType(browserFile.getMimeType())));
|
||||||
|
}
|
||||||
|
|
||||||
if (browserFile.isHasPreview()) {
|
if (browserFile.isHasPreview()) {
|
||||||
String path = ApiUtils.getUrlForFilePreviewWithRemotePath(activeUser.getBaseUrl(),
|
String path = ApiUtils.getUrlForFilePreviewWithRemotePath(activeUser.getBaseUrl(),
|
||||||
|
@ -29,10 +29,8 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.media.AudioAttributes;
|
import android.media.AudioAttributes;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.VibrationEffect;
|
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.renderscript.RenderScript;
|
import android.renderscript.RenderScript;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -357,10 +355,6 @@ public class CallNotificationController extends BaseController {
|
|||||||
if (DoNotDisturbUtils.INSTANCE.shouldPlaySound()) {
|
if (DoNotDisturbUtils.INSTANCE.shouldPlaySound()) {
|
||||||
playRingtoneSound();
|
playRingtoneSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DoNotDisturbUtils.INSTANCE.shouldVibrate(appPreferences.getShouldVibrateSetting())) {
|
|
||||||
vibrate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@ -529,32 +523,4 @@ public class CallNotificationController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vibrate() {
|
|
||||||
vibrator = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
|
|
||||||
if (vibrator != null) {
|
|
||||||
long[] vibratePattern = new long[]{0, 400, 800, 600, 800, 800, 800, 1000};
|
|
||||||
int[] amplitudes = new int[]{0, 255, 0, 255, 0, 255, 0, 255};
|
|
||||||
|
|
||||||
VibrationEffect vibrationEffect;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
if (vibrator.hasAmplitudeControl()) {
|
|
||||||
vibrationEffect = VibrationEffect.createWaveform(vibratePattern, amplitudes, -1);
|
|
||||||
//vibrator.vibrate(vibrationEffect);
|
|
||||||
} else {
|
|
||||||
vibrationEffect = VibrationEffect.createWaveform(vibratePattern, -1);
|
|
||||||
//vibrator.vibrate(vibrationEffect);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//vibrator.vibrate(vibratePattern, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.postDelayed(() -> {
|
|
||||||
if (vibrator != null) {
|
|
||||||
vibrator.cancel();
|
|
||||||
}
|
|
||||||
}, 10000);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -170,8 +170,6 @@ public class SettingsController extends BaseController {
|
|||||||
MaterialPreferenceCategory messageView;
|
MaterialPreferenceCategory messageView;
|
||||||
@BindView(R.id.settings_client_cert)
|
@BindView(R.id.settings_client_cert)
|
||||||
MaterialStandardPreference certificateSetup;
|
MaterialStandardPreference certificateSetup;
|
||||||
@BindView(R.id.settings_always_vibrate)
|
|
||||||
MaterialSwitchPreference shouldVibrateSwitchPreference;
|
|
||||||
@BindView(R.id.settings_incognito_keyboard)
|
@BindView(R.id.settings_incognito_keyboard)
|
||||||
MaterialSwitchPreference incognitoKeyboardSwitchPreference;
|
MaterialSwitchPreference incognitoKeyboardSwitchPreference;
|
||||||
@BindView(R.id.settings_screen_security)
|
@BindView(R.id.settings_screen_security)
|
||||||
@ -263,10 +261,6 @@ public class SettingsController extends BaseController {
|
|||||||
licenceButton.setVisibility(View.GONE);
|
licenceButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DoNotDisturbUtils.INSTANCE.hasVibrator()) {
|
|
||||||
shouldVibrateSwitchPreference.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
incognitoKeyboardSwitchPreference.setVisibility(View.GONE);
|
incognitoKeyboardSwitchPreference.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -280,7 +274,6 @@ public class SettingsController extends BaseController {
|
|||||||
getResources().getString(R.string.nc_app_product_name)));
|
getResources().getString(R.string.nc_app_product_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(getResources().getString(R.string.nc_privacy_url))) {
|
if (!TextUtils.isEmpty(getResources().getString(R.string.nc_privacy_url))) {
|
||||||
privacyButton.addPreferenceClickListener(view12 -> {
|
privacyButton.addPreferenceClickListener(view12 -> {
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().
|
||||||
@ -353,7 +346,6 @@ public class SettingsController extends BaseController {
|
|||||||
alias = "";
|
alias = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
userUtils.createOrUpdateUser(null, null, null, null, null, null, null, currentUser.getId(),
|
userUtils.createOrUpdateUser(null, null, null, null, null, null, null, currentUser.getId(),
|
||||||
null, alias, null);
|
null, alias, null);
|
||||||
}, new String[]{"RSA", "EC"}, null, finalHost, finalPort, currentUser.getClientCertificate
|
}, new String[]{"RSA", "EC"}, null, finalHost, finalPort, currentUser.getClientCertificate
|
||||||
@ -445,10 +437,6 @@ public class SettingsController extends BaseController {
|
|||||||
certificateSetup.setTitle(R.string.nc_client_cert_setup);
|
certificateSetup.setTitle(R.string.nc_client_cert_setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldVibrateSwitchPreference.getVisibility() == View.VISIBLE) {
|
|
||||||
((Checkable) shouldVibrateSwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getShouldVibrateSetting());
|
|
||||||
}
|
|
||||||
|
|
||||||
((Checkable) screenSecuritySwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getIsScreenSecured());
|
((Checkable) screenSecuritySwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getIsScreenSecured());
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
((Checkable) incognitoKeyboardSwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getIsKeyboardIncognito());
|
((Checkable) incognitoKeyboardSwitchPreference.findViewById(R.id.mp_checkable)).setChecked(appPreferences.getIsKeyboardIncognito());
|
||||||
|
@ -32,7 +32,6 @@ import android.media.MediaPlayer;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Vibrator;
|
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
@ -536,19 +535,6 @@ public class NotificationWorker extends Worker {
|
|||||||
Log.e(TAG, "Failed to set data source");
|
Log.e(TAG, "Failed to set data source");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (DoNotDisturbUtils.INSTANCE.shouldVibrate(appPreferences.getShouldVibrateSetting()) || importantConversation) {
|
|
||||||
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
|
|
||||||
if (vibrator != null) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
//vibrator.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE));
|
|
||||||
} else {
|
|
||||||
//vibrator.vibrate(500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,17 +187,6 @@ public interface AppPreferences {
|
|||||||
@RemoveMethod
|
@RemoveMethod
|
||||||
void removeNotificationChannelUpgradeToV3();
|
void removeNotificationChannelUpgradeToV3();
|
||||||
|
|
||||||
@KeyByString("notifications_vibrate")
|
|
||||||
@DefaultValue(R.bool.value_true)
|
|
||||||
boolean getShouldVibrateSetting();
|
|
||||||
|
|
||||||
@KeyByString("notifications_vibrate")
|
|
||||||
void setVibrateSetting(boolean value);
|
|
||||||
|
|
||||||
@KeyByString("notifications_vibrate")
|
|
||||||
@RemoveMethod
|
|
||||||
void removeVibrateSetting();
|
|
||||||
|
|
||||||
@KeyByString("screen_security")
|
@KeyByString("screen_security")
|
||||||
@DefaultValue(R.bool.value_false)
|
@DefaultValue(R.bool.value_false)
|
||||||
boolean getIsScreenSecured();
|
boolean getIsScreenSecured();
|
||||||
|
@ -182,15 +182,6 @@
|
|||||||
apc:mp_key="@string/nc_settings_message_ringtone_key"
|
apc:mp_key="@string/nc_settings_message_ringtone_key"
|
||||||
apc:mp_title="@string/nc_settings_other_notifications_ringtone" />
|
apc:mp_title="@string/nc_settings_other_notifications_ringtone" />
|
||||||
|
|
||||||
<com.yarolegovich.mp.MaterialSwitchPreference
|
|
||||||
android:id="@+id/settings_always_vibrate"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
apc:mp_default_value="@bool/value_true"
|
|
||||||
apc:mp_key="@string/nc_settings_vibrate_key"
|
|
||||||
apc:mp_summary="@string/nc_settings_vibrate_desc"
|
|
||||||
apc:mp_title="@string/nc_settings_vibrate" />
|
|
||||||
|
|
||||||
</com.yarolegovich.mp.MaterialPreferenceCategory>
|
</com.yarolegovich.mp.MaterialPreferenceCategory>
|
||||||
|
|
||||||
<com.yarolegovich.mp.MaterialPreferenceCategory
|
<com.yarolegovich.mp.MaterialPreferenceCategory
|
||||||
|
@ -1 +1 @@
|
|||||||
595
|
594
|
Loading…
Reference in New Issue
Block a user