mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-23 23:48:51 -05:00
keep prefernces individual per dialog (affects only compression)
This commit is contained in:
parent
cf5fadae76
commit
ecfbc743f3
@ -85,7 +85,8 @@ public final class Constants {
|
||||
public static final String USE_DEFAULT_YUBIKEY_PIN = "useDefaultYubikeyPin";
|
||||
public static final String USE_NUMKEYPAD_FOR_YUBIKEY_PIN = "useNumKeypadForYubikeyPin";
|
||||
public static final String ENCRYPT_FILENAMES = "encryptFilenames";
|
||||
public static final String USE_COMPRESSION = "useCompression";
|
||||
public static final String FILE_USE_COMPRESSION = "useFileCompression";
|
||||
public static final String TEXT_USE_COMPRESSION = "useTextCompression";
|
||||
public static final String USE_ARMOR = "useArmor";
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nispok.snackbar.Snackbar;
|
||||
import org.spongycastle.bcpg.CompressionAlgorithmTags;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@ -184,7 +183,7 @@ public class EncryptFilesFragment extends CachingCryptoOperationFragment<SignEnc
|
||||
if (args.containsKey(ARG_USE_COMPRESSION)) {
|
||||
mUseCompression = args.getBoolean(ARG_USE_COMPRESSION, true);
|
||||
} else {
|
||||
mUseCompression = prefs.getUseCompression();
|
||||
mUseCompression = prefs.getFilesUseCompression();
|
||||
}
|
||||
|
||||
if (args.containsKey(ARG_ENCRYPT_FILENAMES)) {
|
||||
@ -343,7 +342,7 @@ public class EncryptFilesFragment extends CachingCryptoOperationFragment<SignEnc
|
||||
Notify.LENGTH_LONG, Style.OK, new ActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
Preferences.getPreferences(getActivity()).setUseCompression(compress);
|
||||
Preferences.getPreferences(getActivity()).setFilesUseCompression(compress);
|
||||
Notify.create(getActivity(), compress
|
||||
? R.string.snack_compression_on
|
||||
: R.string.snack_compression_off,
|
||||
|
@ -142,7 +142,7 @@ public class EncryptTextFragment extends CachingCryptoOperationFragment<SignEncr
|
||||
if (args.containsKey(ARG_USE_COMPRESSION)) {
|
||||
mUseCompression = args.getBoolean(ARG_USE_COMPRESSION, true);
|
||||
} else {
|
||||
mUseCompression = prefs.getUseCompression();
|
||||
mUseCompression = prefs.getTextUseCompression();
|
||||
}
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
@ -194,7 +194,7 @@ public class EncryptTextFragment extends CachingCryptoOperationFragment<SignEncr
|
||||
Notify.LENGTH_LONG, Style.OK, new ActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
Preferences.getPreferences(getActivity()).setUseCompression(compress);
|
||||
Preferences.getPreferences(getActivity()).setTextUseCompression(compress);
|
||||
Notify.create(getActivity(), compress
|
||||
? R.string.snack_compression_on
|
||||
: R.string.snack_compression_off,
|
||||
|
@ -182,16 +182,28 @@ public class Preferences {
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public void setUseCompression(boolean compress) {
|
||||
public void setFilesUseCompression(boolean compress) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.USE_COMPRESSION, compress);
|
||||
editor.putBoolean(Pref.FILE_USE_COMPRESSION, compress);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean getUseCompression() {
|
||||
return mSharedPreferences.getBoolean(Pref.USE_COMPRESSION, true);
|
||||
public boolean getFilesUseCompression() {
|
||||
return mSharedPreferences.getBoolean(Pref.FILE_USE_COMPRESSION, true);
|
||||
}
|
||||
|
||||
public void setTextUseCompression(boolean compress) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.TEXT_USE_COMPRESSION, compress);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public boolean getTextUseCompression() {
|
||||
return mSharedPreferences.getBoolean(Pref.TEXT_USE_COMPRESSION, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUseArmor(boolean useArmor) {
|
||||
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||
editor.putBoolean(Pref.USE_ARMOR, useArmor);
|
||||
|
Loading…
Reference in New Issue
Block a user