mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
correctly preserve state in EncryptFilesFragment
This commit is contained in:
parent
8dc9773c1e
commit
56a75774d0
@ -72,19 +72,23 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class EncryptFilesFragment extends CryptoOperationFragment {
|
public class EncryptFilesFragment extends CryptoOperationFragment {
|
||||||
|
|
||||||
|
public static final String ARG_DELETE_AFTER_ENCRYPT = "delete_after_encrypt";
|
||||||
|
public static final String ARG_ENCRYPT_FILENAMES = "encrypt_filenames";
|
||||||
|
public static final String ARG_USE_COMPRESSION = "use_compression";
|
||||||
public static final String ARG_USE_ASCII_ARMOR = "use_ascii_armor";
|
public static final String ARG_USE_ASCII_ARMOR = "use_ascii_armor";
|
||||||
public static final String ARG_URIS = "uris";
|
public static final String ARG_URIS = "uris";
|
||||||
|
|
||||||
private static final int REQUEST_CODE_INPUT = 0x00007003;
|
private static final int REQUEST_CODE_INPUT = 0x00007003;
|
||||||
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
|
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
|
||||||
|
|
||||||
private boolean mUseArmor = false;
|
private boolean mUseArmor;
|
||||||
private boolean mUseCompression = true;
|
private boolean mUseCompression;
|
||||||
private boolean mDeleteAfterEncrypt = false;
|
private boolean mDeleteAfterEncrypt;
|
||||||
private boolean mShareAfterEncrypt = false;
|
private boolean mEncryptFilenames;
|
||||||
private boolean mEncryptFilenames = true;
|
|
||||||
private boolean mHiddenRecipients = false;
|
private boolean mHiddenRecipients = false;
|
||||||
|
|
||||||
|
private boolean mShareAfterEncrypt;
|
||||||
|
|
||||||
private ArrayList<Uri> mOutputUris = new ArrayList<>();
|
private ArrayList<Uri> mOutputUris = new ArrayList<>();
|
||||||
|
|
||||||
private RecyclerView mSelectedFiles;
|
private RecyclerView mSelectedFiles;
|
||||||
@ -136,19 +140,39 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ArrayList<Uri> inputUris = getArguments().getParcelableArrayList(ARG_URIS);
|
Bundle args = savedInstanceState == null ? getArguments() : savedInstanceState;
|
||||||
|
|
||||||
|
ArrayList<Uri> inputUris = args.getParcelableArrayList(ARG_URIS);
|
||||||
if (inputUris != null) {
|
if (inputUris != null) {
|
||||||
mFilesAdapter.addAll(inputUris);
|
mFilesAdapter.addAll(inputUris);
|
||||||
}
|
}
|
||||||
mUseArmor = getArguments().getBoolean(ARG_USE_ASCII_ARMOR);
|
|
||||||
mSelectedFiles.setAdapter(mFilesAdapter);
|
mSelectedFiles.setAdapter(mFilesAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
|
||||||
|
outState.putBoolean(ARG_DELETE_AFTER_ENCRYPT, mDeleteAfterEncrypt);
|
||||||
|
outState.putBoolean(ARG_USE_ASCII_ARMOR, mUseArmor);
|
||||||
|
outState.putBoolean(ARG_USE_COMPRESSION, mUseCompression);
|
||||||
|
outState.putBoolean(ARG_ENCRYPT_FILENAMES, mEncryptFilenames);
|
||||||
|
|
||||||
|
outState.putParcelableArrayList(ARG_URIS, mFilesAdapter.getAsArrayList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
Bundle args = savedInstanceState == null ? getArguments() : savedInstanceState;
|
||||||
|
mDeleteAfterEncrypt = args.getBoolean(ARG_DELETE_AFTER_ENCRYPT, false);
|
||||||
|
mUseArmor = args.getBoolean(ARG_USE_ASCII_ARMOR, false);
|
||||||
|
mUseCompression = args.getBoolean(ARG_USE_COMPRESSION, true);
|
||||||
|
mEncryptFilenames = args.getBoolean(ARG_ENCRYPT_FILENAMES, true);
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,6 +270,11 @@ public class EncryptFilesFragment extends CryptoOperationFragment {
|
|||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
inflater.inflate(R.menu.encrypt_file_fragment, menu);
|
inflater.inflate(R.menu.encrypt_file_fragment, menu);
|
||||||
|
|
||||||
|
menu.findItem(R.id.check_delete_after_encrypt).setChecked(mDeleteAfterEncrypt);
|
||||||
|
menu.findItem(R.id.check_use_armor).setChecked(mUseArmor);
|
||||||
|
menu.findItem(R.id.check_enable_compression).setChecked(mUseCompression);
|
||||||
|
menu.findItem(R.id.check_encrypt_filenames).setChecked(mEncryptFilenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,6 +129,8 @@ public class EncryptTextFragment extends CryptoOperationFragment {
|
|||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
inflater.inflate(R.menu.encrypt_text_fragment, menu);
|
inflater.inflate(R.menu.encrypt_text_fragment, menu);
|
||||||
|
|
||||||
|
menu.findItem(R.id.check_enable_compression).setChecked(mUseCompression);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,13 +22,11 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/check_enable_compression"
|
android:id="@+id/check_enable_compression"
|
||||||
android:title="@string/label_enable_compression"
|
android:title="@string/label_enable_compression"
|
||||||
android:checked="true"
|
|
||||||
android:checkable="true" />
|
android:checkable="true" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/check_encrypt_filenames"
|
android:id="@+id/check_encrypt_filenames"
|
||||||
android:title="@string/label_encrypt_filenames"
|
android:title="@string/label_encrypt_filenames"
|
||||||
android:checked="true"
|
|
||||||
android:checkable="true" />
|
android:checkable="true" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
Loading…
Reference in New Issue
Block a user