Inserted the Registration activity into initial setup flow.

1) Added push messaging toggle to preferences.

2) Added push messaging registration screen to setup flow.

3) Migrated rest of SharedPreferences accessors to
   TextSecurePreferences.
This commit is contained in:
Moxie Marlinspike
2013-07-11 14:58:40 -07:00
parent 52e5274a2f
commit d7070e7ecf
22 changed files with 427 additions and 141 deletions

View File

@@ -33,6 +33,7 @@ import android.widget.Toast;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
/**
* List preference for LED blink pattern notification.
@@ -66,13 +67,13 @@ public class LedBlinkPatternListPreference extends ListPreference implements OnS
super.onDialogClosed(positiveResult);
if (positiveResult) {
String blinkPattern = PreferenceManager.getDefaultSharedPreferences(context).getString(ApplicationPreferencesActivity.LED_BLINK_PREF, "500,2000");
String blinkPattern = TextSecurePreferences.getNotificationLedPattern(context);
if (blinkPattern.equals("custom")) showDialog();
}
}
private void initializeSeekBarValues() {
String patternString = PreferenceManager.getDefaultSharedPreferences(context).getString(ApplicationPreferencesActivity.LED_BLINK_PREF_CUSTOM, "500,2000");
String patternString = TextSecurePreferences.getNotificationLedPatternCustom(context);
String[] patternArray = patternString.split(",");
seekBarOn.setProgress(Integer.parseInt(patternArray[0]));
seekBarOff.setProgress(Integer.parseInt(patternArray[1]));
@@ -152,8 +153,7 @@ public class LedBlinkPatternListPreference extends ListPreference implements OnS
String pattern = seekBarOnLabel.getText() + "," + seekBarOffLabel.getText();
dialogInProgress = false;
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
preferences.edit().putString(ApplicationPreferencesActivity.LED_BLINK_PREF_CUSTOM, pattern).commit();
TextSecurePreferences.setNotificationLedPatternCustom(context, pattern);
Toast.makeText(context, "Custom LED blink pattern set!", Toast.LENGTH_LONG).show();
}

View File

@@ -30,6 +30,7 @@ import android.widget.TextView;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
/**
* Dialog preference for encryption passphrase timeout.
@@ -79,14 +80,14 @@ public class PassphraseTimeoutPreference extends DialogPreference {
interval = Math.max(seekBar.getProgress(), 1) * 60;
}
this.getSharedPreferences().edit().putInt(ApplicationPreferencesActivity.PASSPHRASE_TIMEOUT_INTERVAL_PREF, interval).commit();
TextSecurePreferences.setPassphraseTimeoutInterval(getContext(), interval);
}
super.onClick(dialog, which);
}
private void initializeDefaults() {
int timeout = this.getSharedPreferences().getInt(ApplicationPreferencesActivity.PASSPHRASE_TIMEOUT_INTERVAL_PREF, 60 * 5);
int timeout = TextSecurePreferences.getPassphraseTimeoutInterval(getContext());
if (timeout > 60) {
scaleSpinner.setSelection(1);