diff --git a/build.gradle b/build.gradle
index 5c05e4f982..65506dabc5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -93,7 +93,7 @@ dependencies {
compile 'com.google.zxing:android-integration:3.1.0'
compile 'com.squareup.dagger:dagger:1.2.2'
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'
- compile 'com.code-troopers.betterpickers:library:3.1.0'
+ compile 'mobi.upod:time-duration-picker:1.1.3'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.google.zxing:core:3.2.1'
@@ -147,7 +147,7 @@ dependencyVerification {
'com.android.support:preference-v7:d9f32ddc92f8d6a0bd86a18f4fcaff805fa021245e395b6e7dd382907443ee53',
'com.pnikosis:materialish-progress:d71d80e00717a096784482aee21001a9d299fec3833e4ebd87739ed36cf77c54',
'pl.tajchert:waitingdots:2835d49e0787dbcb606c5a60021ced66578503b1e9fddcd7a5ef0cd5f095ba2c',
- 'com.code-troopers.betterpickers:library:ab5cb3f00bd9c575461300b38f31f5874d522524b10bbaf75f3f05a4b6dbf5fd',
+ 'mobi.upod:time-duration-picker:db469ce0f48dd96b892eac424ed76870e54bf00fe0a28cdcddfbe5f2a226a0e1',
'com.codewaves.stickyheadergrid:stickyheadergrid:5b4aa6a52a957cfd55f60f4220c11c0c371385a3cb9786cae03c260dcdef5794',
'com.android.support:appcompat-v7:b2825e8b47f665d3362d8481c8d147d1af9230d16f23a2b94f6ccbc53c68cec1',
'com.melnykov:floatingactionbutton:15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263',
@@ -226,7 +226,6 @@ dependencyVerification {
]
}
-
android {
flavorDimensions "none"
compileSdkVersion 27
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index cf044a6035..50c793a27a 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -111,8 +111,6 @@
-
-
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 51b4e11fd4..ac31809704 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -229,8 +229,6 @@
- @drawable/preference_divider_light
- - @style/BetterPickersDialogFragment.Light
-
- @drawable/ic_group_grey600_24dp
- @style/PreferenceThemeOverlay.Fix
@@ -354,8 +352,6 @@
- @drawable/preference_divider_dark
- - @style/BetterPickersDialogFragment
-
- @drawable/ic_group_white_24dp
- @style/PreferenceThemeOverlay.Fix
- @color/black
diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
index 45ec404a2f..95c5eeff7c 100644
--- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
@@ -1,10 +1,9 @@
package org.thoughtcrime.securesms.preferences;
-import android.app.KeyguardManager;
import android.app.Activity;
+import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
-import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
@@ -13,9 +12,6 @@ import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.Preference;
import android.widget.Toast;
-import com.codetroopers.betterpickers.hmspicker.HmsPickerBuilder;
-import com.codetroopers.betterpickers.hmspicker.HmsPickerDialogFragment;
-
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.BlockedContactsActivity;
@@ -34,6 +30,8 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
+import mobi.upod.timedurationpicker.TimeDurationPickerDialog;
+
public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment implements InjectableType {
private static final String PREFERENCE_CATEGORY_BLOCKED = "preference_category_blocked";
@@ -132,32 +130,23 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
}
}
- private class ScreenLockTimeoutListener implements Preference.OnPreferenceClickListener, HmsPickerDialogFragment.HmsPickerDialogHandlerV2 {
+ private class ScreenLockTimeoutListener implements Preference.OnPreferenceClickListener {
@Override
public boolean onPreferenceClick(Preference preference) {
- int[] attributes = {R.attr.app_protect_timeout_picker_color};
- TypedArray hmsStyle = getActivity().obtainStyledAttributes(attributes);
+ new TimeDurationPickerDialog(getContext(), (view, duration) -> {
+ if (duration == 0) {
+ TextSecurePreferences.setScreenLockTimeout(getContext(), 0);
+ } else {
+ long timeoutSeconds = Math.max(TimeUnit.MILLISECONDS.toSeconds(duration), 60);
+ TextSecurePreferences.setScreenLockTimeout(getContext(), timeoutSeconds);
+ }
- new HmsPickerBuilder().setFragmentManager(getFragmentManager())
- .setStyleResId(hmsStyle.getResourceId(0, R.style.BetterPickersDialogFragment_Light))
- .addHmsPickerDialogHandler(this)
- .show();
-
- hmsStyle.recycle();
+ initializeScreenLockTimeoutSummary();
+ }, 0).show();
return true;
}
-
- @Override
- public void onDialogHmsSet(int reference, boolean isNegative, int hours, int minutes, int seconds) {
- long timeoutSeconds = Math.max(TimeUnit.HOURS.toSeconds(hours) +
- TimeUnit.MINUTES.toSeconds(minutes) +
- TimeUnit.SECONDS.toSeconds(seconds), 60);
-
- TextSecurePreferences.setScreenLockTimeout(getContext(), timeoutSeconds);
- initializeScreenLockTimeoutSummary();
- }
}
private class AccountLockClickListener implements Preference.OnPreferenceClickListener {
@@ -231,33 +220,21 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
}
}
- private class PassphraseIntervalClickListener implements Preference.OnPreferenceClickListener, HmsPickerDialogFragment.HmsPickerDialogHandlerV2 {
+ private class PassphraseIntervalClickListener implements Preference.OnPreferenceClickListener {
@Override
public boolean onPreferenceClick(Preference preference) {
- int[] attributes = {R.attr.app_protect_timeout_picker_color};
- TypedArray hmsStyle = getActivity().obtainStyledAttributes(attributes);
+ new TimeDurationPickerDialog(getContext(), (view, duration) -> {
+ int timeoutMinutes = Math.max((int)TimeUnit.MILLISECONDS.toMinutes(duration), 1);
- new HmsPickerBuilder().setFragmentManager(getFragmentManager())
- .setStyleResId(hmsStyle.getResourceId(0, R.style.BetterPickersDialogFragment_Light))
- .addHmsPickerDialogHandler(this)
- .show();
+ TextSecurePreferences.setPassphraseTimeoutInterval(getActivity(), timeoutMinutes);
- hmsStyle.recycle();
+ initializePassphraseTimeoutSummary();
+
+ }, 0).show();
return true;
}
-
- @Override
- public void onDialogHmsSet(int reference, boolean isNegative, int hours, int minutes, int seconds) {
- int timeoutMinutes = Math.max((int)TimeUnit.HOURS.toMinutes(hours) +
- minutes +
- (int)TimeUnit.SECONDS.toMinutes(seconds), 1);
-
- TextSecurePreferences.setPassphraseTimeoutInterval(getActivity(), timeoutMinutes);
-
- initializePassphraseTimeoutSummary();
- }
}
private class DisablePassphraseClickListener implements Preference.OnPreferenceChangeListener {