mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 14:08:24 -05:00
show message about saving multiple files rather than hide the button
This commit is contained in:
parent
689b2c9ab1
commit
7c6eff6d92
@ -37,6 +37,7 @@ import android.widget.TextView;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
|
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
|
||||||
|
|
||||||
@ -56,7 +57,6 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
// view
|
// view
|
||||||
private View mAddView;
|
private View mAddView;
|
||||||
private View mShareFile;
|
private View mShareFile;
|
||||||
private View mEncryptFile;
|
|
||||||
private ListView mSelectedFiles;
|
private ListView mSelectedFiles;
|
||||||
private SelectedFilesAdapter mAdapter = new SelectedFilesAdapter();
|
private SelectedFilesAdapter mAdapter = new SelectedFilesAdapter();
|
||||||
private final Map<Uri, Bitmap> thumbnailCache = new HashMap<Uri, Bitmap>();
|
private final Map<Uri, Bitmap> thumbnailCache = new HashMap<Uri, Bitmap>();
|
||||||
@ -78,8 +78,8 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.encrypt_file_fragment, container, false);
|
View view = inflater.inflate(R.layout.encrypt_file_fragment, container, false);
|
||||||
|
|
||||||
mEncryptFile = view.findViewById(R.id.action_encrypt_file);
|
View vEncryptFile = view.findViewById(R.id.action_encrypt_file);
|
||||||
mEncryptFile.setOnClickListener(new View.OnClickListener() {
|
vEncryptFile.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encryptClicked(false);
|
encryptClicked(false);
|
||||||
@ -130,31 +130,12 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
mEncryptInterface.getInputUris().add(inputUri);
|
mEncryptInterface.getInputUris().add(inputUri);
|
||||||
mEncryptInterface.notifyUpdate();
|
mEncryptInterface.notifyUpdate();
|
||||||
mSelectedFiles.requestFocus();
|
mSelectedFiles.requestFocus();
|
||||||
|
|
||||||
/**
|
|
||||||
* We hide the encrypt to file button if multiple files are selected.
|
|
||||||
*
|
|
||||||
* With Android L it will be possible to select a target directory for multiple files, so we might want to
|
|
||||||
* change this later
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (mEncryptInterface.getInputUris().size() > 1) {
|
|
||||||
mEncryptFile.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
mEncryptFile.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delInputUri(int position) {
|
private void delInputUri(int position) {
|
||||||
mEncryptInterface.getInputUris().remove(position);
|
mEncryptInterface.getInputUris().remove(position);
|
||||||
mEncryptInterface.notifyUpdate();
|
mEncryptInterface.notifyUpdate();
|
||||||
mSelectedFiles.requestFocus();
|
mSelectedFiles.requestFocus();
|
||||||
|
|
||||||
if (mEncryptInterface.getInputUris().size() > 1) {
|
|
||||||
mEncryptFile.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
mEncryptFile.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOutputFileDialog() {
|
private void showOutputFileDialog() {
|
||||||
@ -185,7 +166,11 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt
|
|||||||
mEncryptInterface.getOutputUris().add(TemporaryStorageProvider.createFile(getActivity(), targetName));
|
mEncryptInterface.getOutputUris().add(TemporaryStorageProvider.createFile(getActivity(), targetName));
|
||||||
}
|
}
|
||||||
mEncryptInterface.startEncrypt(true);
|
mEncryptInterface.startEncrypt(true);
|
||||||
} else if (mEncryptInterface.getInputUris().size() == 1) {
|
} else {
|
||||||
|
if (mEncryptInterface.getInputUris().size() > 1) {
|
||||||
|
Notify.showNotify(getActivity(), R.string.error_multi_not_supported, Notify.Style.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
showOutputFileDialog();
|
showOutputFileDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -910,6 +910,7 @@
|
|||||||
<string name="info_no_manual_account_creation">"Do not create OpenKeychain-Accounts manually.\nFor more information, see Help."</string>
|
<string name="info_no_manual_account_creation">"Do not create OpenKeychain-Accounts manually.\nFor more information, see Help."</string>
|
||||||
<string name="contact_show_key">"Show key (%s)"</string>
|
<string name="contact_show_key">"Show key (%s)"</string>
|
||||||
<string name="swipe_to_update">"Swipe down to update from keyserver"</string>
|
<string name="swipe_to_update">"Swipe down to update from keyserver"</string>
|
||||||
|
<string name="error_multi_not_supported">"Saving of multiple files not supported. This is a limitation on current Android."</string>
|
||||||
|
|
||||||
<!-- First Time -->
|
<!-- First Time -->
|
||||||
<string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string>
|
<string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user