Skip to content

Commit

Permalink
Make obfuscation slider value sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
SamouraiDev committed Jun 2, 2016
1 parent 72dd814 commit a0a84b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/com/samourai/wallet/SendFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,14 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
tvSpendTypeDesc = (TextView)rootView.findViewById(R.id.spendTypeDesc);
spendType = (SeekBar)rootView.findViewById(R.id.seekBar);
spendType.setMax(2);
spendType.setProgress(1);
spendType.setProgress(PrefsUtil.getInstance(getActivity()).getValue(PrefsUtil.SPEND_TYPE, 1));
spendType.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

int progressChanged = 0;

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
progressChanged = progress;
PrefsUtil.getInstance(getActivity()).setValue(PrefsUtil.SPEND_TYPE, spendType.getProgress());
}

public void onStartTrackingTouch(SeekBar seekBar) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/samourai/wallet/hd/HD_Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public JSONObject toJSON(Context ctx) {
JSONObject meta = new JSONObject();
meta.put("prev_balance", APIFactory.getInstance(ctx).getXpubBalance());
meta.put("sent_tos", SendAddressUtil.getInstance().toJSON());
meta.put("spend_type", PrefsUtil.getInstance(ctx).getValue(PrefsUtil.SPEND_TYPE, 1));
meta.put("bip47", BIP47Meta.getInstance().toJSON());
meta.put("pin", AccessFactory.getInstance().getPIN());
meta.put("pin2", AccessFactory.getInstance().getPIN2());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ public HD_Wallet restoreWalletfromJSON(JSONObject obj) throws DecoderException,
if(meta.has("prev_balance")) {
APIFactory.getInstance(context).setXpubBalance(meta.getLong("prev_balance"));
}
if(meta.has("spend_type")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.SPEND_TYPE, meta.getInt("spend_type"));
}
if(meta.has("sent_tos")) {
SendAddressUtil.getInstance().fromJSON((JSONArray) meta.get("sent_tos"));
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/samourai/wallet/util/PrefsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class PrefsUtil {
public static final String TRUSTED_LOCK = "trustedMobileOnly";
public static final String SCRAMBLE_PIN = "scramblePin";
public static final String AUTO_BACKUP = "autoBackup";
public static final String SPEND_TYPE = "spendType";

private static Context context = null;
private static PrefsUtil instance = null;
Expand Down

0 comments on commit a0a84b5

Please sign in to comment.