mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-19 20:31:52 -05:00
better isolation
This commit is contained in:
parent
b01dd39bd7
commit
8f4b013a8d
@ -109,10 +109,9 @@ public class DecryptFilesActivity extends BaseActivity {
|
|||||||
|
|
||||||
ArrayList<Uri> uris = new ArrayList<>();
|
ArrayList<Uri> uris = new ArrayList<>();
|
||||||
uris.add(inputUri);
|
uris.add(inputUri);
|
||||||
DecryptFilesListFragment frag = DecryptFilesListFragment.newInstance(uris);
|
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.replace(R.id.decrypt_files_fragment_container, frag)
|
.replace(R.id.decrypt_files_fragment_container, null)
|
||||||
.addToBackStack("list")
|
.addToBackStack("list")
|
||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
|
@ -1,708 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Build.VERSION_CODES;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.os.Messenger;
|
|
||||||
import android.support.v7.widget.DefaultItemAnimator;
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.ContextMenu;
|
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.PopupMenu;
|
|
||||||
import android.widget.PopupMenu.OnDismissListener;
|
|
||||||
import android.widget.PopupMenu.OnMenuItemClickListener;
|
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.ViewAnimator;
|
|
||||||
|
|
||||||
import org.openintents.openpgp.OpenPgpMetadata;
|
|
||||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
|
||||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel;
|
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
|
||||||
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
|
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
|
||||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
|
||||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
|
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
|
||||||
import org.sufficientlysecure.keychain.ui.DecryptFilesListFragment.DecryptFilesAdapter.ViewModel;
|
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.SpacesItemDecoration;
|
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationFragment;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.StatusHolder;
|
|
||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
|
||||||
|
|
||||||
public class DecryptFilesListFragment extends CryptoOperationFragment implements OnMenuItemClickListener {
|
|
||||||
public static final String ARG_URIS = "uris";
|
|
||||||
|
|
||||||
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
|
|
||||||
|
|
||||||
private ArrayList<Uri> mInputUris;
|
|
||||||
private HashMap<Uri, Uri> mOutputUris;
|
|
||||||
private ArrayList<Uri> mPendingInputUris;
|
|
||||||
|
|
||||||
private Uri mCurrentInputUri;
|
|
||||||
|
|
||||||
private DecryptFilesAdapter mAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new instance of this fragment
|
|
||||||
*/
|
|
||||||
public static DecryptFilesListFragment newInstance(ArrayList<Uri> uris) {
|
|
||||||
DecryptFilesListFragment frag = new DecryptFilesListFragment();
|
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putParcelableArrayList(ARG_URIS, uris);
|
|
||||||
frag.setArguments(args);
|
|
||||||
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inflate the layout for this fragment
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View view = inflater.inflate(R.layout.decrypt_files_list_fragment, container, false);
|
|
||||||
|
|
||||||
RecyclerView vFilesList = (RecyclerView) view.findViewById(R.id.decrypted_files_list);
|
|
||||||
|
|
||||||
vFilesList.addItemDecoration(new SpacesItemDecoration(
|
|
||||||
FormattingUtils.dpToPx(getActivity(), 4)));
|
|
||||||
vFilesList.setHasFixedSize(true);
|
|
||||||
vFilesList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
|
||||||
vFilesList.setItemAnimator(new DefaultItemAnimator());
|
|
||||||
|
|
||||||
mAdapter = new DecryptFilesAdapter(getActivity(), this);
|
|
||||||
vFilesList.setAdapter(mAdapter);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
|
|
||||||
outState.putParcelableArrayList(ARG_URIS, mInputUris);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
|
|
||||||
displayInputUris(getArguments().<Uri>getParcelableArrayList(ARG_URIS));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String removeEncryptedAppend(String name) {
|
|
||||||
if (name.endsWith(Constants.FILE_EXTENSION_ASC)
|
|
||||||
|| name.endsWith(Constants.FILE_EXTENSION_PGP_MAIN)
|
|
||||||
|| name.endsWith(Constants.FILE_EXTENSION_PGP_ALTERNATE)) {
|
|
||||||
return name.substring(0, name.length() - 4);
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void askForOutputFilename(Uri inputUri, String originalFilename, String mimeType) {
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
|
||||||
File file = new File(inputUri.getPath());
|
|
||||||
File parentDir = file.exists() ? file.getParentFile() : Constants.Path.APP_DIR;
|
|
||||||
File targetFile = new File(parentDir, originalFilename);
|
|
||||||
FileHelper.saveFile(this, getString(R.string.title_decrypt_to_file),
|
|
||||||
getString(R.string.specify_file_to_decrypt_to), targetFile, REQUEST_CODE_OUTPUT);
|
|
||||||
} else {
|
|
||||||
FileHelper.saveDocument(this, mimeType, originalFilename, REQUEST_CODE_OUTPUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
switch (requestCode) {
|
|
||||||
case REQUEST_CODE_OUTPUT: {
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity == null) {
|
|
||||||
mCurrentInputUri = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// This happens after output file was selected, so start our operation
|
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
|
||||||
Uri saveUri = data.getData();
|
|
||||||
Uri decryptedDataUri = mOutputUris.get(mCurrentInputUri);
|
|
||||||
try {
|
|
||||||
FileHelper.copyUri(getActivity(), decryptedDataUri, saveUri);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Notify.create(activity, "Error saving file!", Style.ERROR).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
mCurrentInputUri = null;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayInputUris(ArrayList<Uri> uris) {
|
|
||||||
mInputUris = uris;
|
|
||||||
mOutputUris = new HashMap<>(uris.size());
|
|
||||||
for (Uri uri : uris) {
|
|
||||||
mAdapter.add(uri);
|
|
||||||
mOutputUris.put(uri, TemporaryStorageProvider.createFile(getActivity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
mPendingInputUris = uris;
|
|
||||||
|
|
||||||
cryptoOperation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayProgress(Uri uri, int progress, int max, String msg) {
|
|
||||||
mAdapter.setProgress(uri, progress, max, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayInputResult(final Uri uri, DecryptVerifyResult result) {
|
|
||||||
Drawable icon = null;
|
|
||||||
OnClickListener onFileClick = null, onKeyClick = null;
|
|
||||||
|
|
||||||
if (result.success()) {
|
|
||||||
|
|
||||||
if (result.getDecryptMetadata() != null && result.getDecryptMetadata().getMimeType() != null) {
|
|
||||||
icon = loadIcon(result.getDecryptMetadata().getMimeType());
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenPgpSignatureResult sigResult = result.getSignatureResult();
|
|
||||||
if (sigResult != null) {
|
|
||||||
final long keyId = sigResult.getKeyId();
|
|
||||||
if (sigResult.getStatus() != OpenPgpSignatureResult.SIGNATURE_KEY_MISSING) {
|
|
||||||
onKeyClick = new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Intent intent = new Intent(activity, ViewKeyActivity.class);
|
|
||||||
intent.setData(KeyRings.buildUnifiedKeyRingUri(keyId));
|
|
||||||
activity.startActivity(intent);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.success() && result.getDecryptMetadata() != null) {
|
|
||||||
final OpenPgpMetadata metadata = result.getDecryptMetadata();
|
|
||||||
onFileClick = new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity == null || mCurrentInputUri != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uri outputUri = mOutputUris.get(uri);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
||||||
intent.setType(metadata.getMimeType());
|
|
||||||
intent.putExtra(Intent.EXTRA_STREAM, outputUri);
|
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
||||||
if (Build.VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
||||||
} else {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
|
||||||
}
|
|
||||||
// activity.startActivity(Intent.createChooser(intent, null));
|
|
||||||
activity.startActivity(intent);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mAdapter.addResult(uri, result, icon, onFileClick, onKeyClick);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressLint("HandlerLeak")
|
|
||||||
protected void cryptoOperation(CryptoInputParcel cryptoInput) {
|
|
||||||
|
|
||||||
if (mCurrentInputUri == null) {
|
|
||||||
|
|
||||||
if (mPendingInputUris.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mCurrentInputUri = mPendingInputUris.remove(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send all information needed to service to decrypt in other thread
|
|
||||||
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
|
||||||
|
|
||||||
// fill values for this action
|
|
||||||
Bundle data = new Bundle();
|
|
||||||
// use current operation, either decrypt metadata or decrypt payload
|
|
||||||
intent.setAction(KeychainIntentService.ACTION_DECRYPT_VERIFY);
|
|
||||||
|
|
||||||
// data
|
|
||||||
|
|
||||||
Uri currentOutputUri = mOutputUris.get(mCurrentInputUri);
|
|
||||||
Log.d(Constants.TAG, "mInputUri=" + mCurrentInputUri + ", mOutputUri=" + currentOutputUri);
|
|
||||||
|
|
||||||
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mCurrentInputUri, currentOutputUri)
|
|
||||||
.setAllowSymmetricDecryption(true);
|
|
||||||
|
|
||||||
data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input);
|
|
||||||
data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput);
|
|
||||||
|
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
|
||||||
|
|
||||||
// Message is received after decrypting is done in KeychainIntentService
|
|
||||||
Handler saveHandler = new Handler() {
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
// handle messages by standard KeychainIntentServiceHandler first
|
|
||||||
super.handleMessage(message);
|
|
||||||
|
|
||||||
// handle pending messages
|
|
||||||
if (handlePendingMessage(message)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageStatus status = MessageStatus.fromInt(message.arg1);
|
|
||||||
Bundle data = message.getData();
|
|
||||||
|
|
||||||
switch (status) {
|
|
||||||
case UNKNOWN:
|
|
||||||
case EXCEPTION: {
|
|
||||||
Log.e(Constants.TAG, "error: " + status);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UPDATE_PROGRESS: {
|
|
||||||
int progress = data.getInt(ServiceProgressHandler.DATA_PROGRESS);
|
|
||||||
int max = data.getInt(ServiceProgressHandler.DATA_PROGRESS_MAX);
|
|
||||||
String msg;
|
|
||||||
if (data.containsKey(ServiceProgressHandler.DATA_MESSAGE_ID)) {
|
|
||||||
msg = getString(data.getInt(ServiceProgressHandler.DATA_MESSAGE_ID));
|
|
||||||
} else if (data.containsKey(ServiceProgressHandler.DATA_MESSAGE)) {
|
|
||||||
msg = data.getString(ServiceProgressHandler.DATA_MESSAGE);
|
|
||||||
} else {
|
|
||||||
msg = null;
|
|
||||||
}
|
|
||||||
displayProgress(mCurrentInputUri, progress, max, msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OKAY: {
|
|
||||||
// get returned data bundle
|
|
||||||
Bundle returnData = message.getData();
|
|
||||||
|
|
||||||
DecryptVerifyResult result =
|
|
||||||
returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT);
|
|
||||||
|
|
||||||
if (result.success()) {
|
|
||||||
// display signature result in activity
|
|
||||||
displayInputResult(mCurrentInputUri, result);
|
|
||||||
mCurrentInputUri = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.createNotify(getActivity()).show(DecryptFilesListFragment.this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
|
||||||
Messenger messenger = new Messenger(saveHandler);
|
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
|
||||||
|
|
||||||
// start service with intent
|
|
||||||
getActivity().startService(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
||||||
if (mAdapter.mMenuClickedModel == null || !mAdapter.mMenuClickedModel.hasResult()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Activity activity = getActivity();
|
|
||||||
if (activity == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewModel model = mAdapter.mMenuClickedModel;
|
|
||||||
DecryptVerifyResult result = model.mResult;
|
|
||||||
switch (menuItem.getItemId()) {
|
|
||||||
case R.id.view_log:
|
|
||||||
Intent intent = new Intent(activity, LogDisplayActivity.class);
|
|
||||||
intent.putExtra(LogDisplayFragment.EXTRA_RESULT, result);
|
|
||||||
activity.startActivity(intent);
|
|
||||||
return true;
|
|
||||||
case R.id.decrypt_save:
|
|
||||||
OpenPgpMetadata metadata = result.getDecryptMetadata();
|
|
||||||
if (metadata == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
mCurrentInputUri = model.mInputUri;
|
|
||||||
askForOutputFilename(model.mInputUri, metadata.getFilename(), metadata.getMimeType());
|
|
||||||
return true;
|
|
||||||
case R.id.decrypt_delete:
|
|
||||||
Notify.create(activity, "decrypt/delete not yet implemented", Style.ERROR).show(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DecryptFilesAdapter extends RecyclerView.Adapter<DecryptItemViewHolder> {
|
|
||||||
private Context mContext;
|
|
||||||
private ArrayList<ViewModel> mDataset;
|
|
||||||
private OnMenuItemClickListener mMenuItemClickListener;
|
|
||||||
private ViewModel mMenuClickedModel;
|
|
||||||
|
|
||||||
public class ViewModel {
|
|
||||||
Context mContext;
|
|
||||||
Uri mInputUri;
|
|
||||||
DecryptVerifyResult mResult;
|
|
||||||
Drawable mIcon;
|
|
||||||
|
|
||||||
OnClickListener mOnFileClickListener;
|
|
||||||
OnClickListener mOnKeyClickListener;
|
|
||||||
|
|
||||||
int mProgress, mMax;
|
|
||||||
String mProgressMsg;
|
|
||||||
|
|
||||||
ViewModel(Context context, Uri uri) {
|
|
||||||
mContext = context;
|
|
||||||
mInputUri = uri;
|
|
||||||
mProgress = 0;
|
|
||||||
mMax = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addResult(DecryptVerifyResult result) {
|
|
||||||
mResult = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addIcon(Drawable icon) {
|
|
||||||
mIcon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setOnClickListeners(OnClickListener onFileClick, OnClickListener onKeyClick) {
|
|
||||||
mOnFileClickListener = onFileClick;
|
|
||||||
mOnKeyClickListener = onKeyClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasResult() {
|
|
||||||
return mResult != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setProgress(int progress, int max, String msg) {
|
|
||||||
if (msg != null) {
|
|
||||||
mProgressMsg = msg;
|
|
||||||
}
|
|
||||||
mProgress = progress;
|
|
||||||
mMax = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Depends on inputUri only
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
ViewModel viewModel = (ViewModel) o;
|
|
||||||
return !(mResult != null ? !mResult.equals(viewModel.mResult)
|
|
||||||
: viewModel.mResult != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Depends on inputUri only
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return mResult != null ? mResult.hashCode() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return mResult.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Provide a suitable constructor (depends on the kind of dataset)
|
|
||||||
public DecryptFilesAdapter(Context context, OnMenuItemClickListener menuItemClickListener) {
|
|
||||||
mContext = context;
|
|
||||||
mMenuItemClickListener = menuItemClickListener;
|
|
||||||
mDataset = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new views (invoked by the layout manager)
|
|
||||||
@Override
|
|
||||||
public DecryptItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
//inflate your layout and pass it to view holder
|
|
||||||
View v = LayoutInflater.from(parent.getContext())
|
|
||||||
.inflate(R.layout.decrypt_list_entry, parent, false);
|
|
||||||
return new DecryptItemViewHolder(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace the contents of a view (invoked by the layout manager)
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(DecryptItemViewHolder holder, final int position) {
|
|
||||||
// - get element from your dataset at this position
|
|
||||||
// - replace the contents of the view with that element
|
|
||||||
final ViewModel model = mDataset.get(position);
|
|
||||||
|
|
||||||
if (model.hasResult()) {
|
|
||||||
if (holder.vAnimator.getDisplayedChild() != 1) {
|
|
||||||
holder.vAnimator.setDisplayedChild(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyFormattingUtils.setStatus(mContext, holder, model.mResult);
|
|
||||||
|
|
||||||
OpenPgpMetadata metadata = model.mResult.getDecryptMetadata();
|
|
||||||
holder.vFilename.setText(metadata.getFilename());
|
|
||||||
|
|
||||||
long size = metadata.getOriginalSize();
|
|
||||||
if (size == -1 || size == 0) {
|
|
||||||
holder.vFilesize.setText("");
|
|
||||||
} else {
|
|
||||||
holder.vFilesize.setText(FileHelper.readableFileSize(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO thumbnail from OpenPgpMetadata
|
|
||||||
if (model.mIcon != null) {
|
|
||||||
holder.vThumbnail.setImageDrawable(model.mIcon);
|
|
||||||
} else {
|
|
||||||
holder.vThumbnail.setImageResource(R.drawable.ic_doc_generic_am);
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.vFile.setOnClickListener(model.mOnFileClickListener);
|
|
||||||
holder.vSignatureLayout.setOnClickListener(model.mOnKeyClickListener);
|
|
||||||
|
|
||||||
holder.vContextMenu.setTag(model);
|
|
||||||
holder.vContextMenu.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
mMenuClickedModel = model;
|
|
||||||
PopupMenu menu = new PopupMenu(mContext, view);
|
|
||||||
menu.inflate(R.menu.decrypt_item_context_menu);
|
|
||||||
menu.setOnMenuItemClickListener(mMenuItemClickListener);
|
|
||||||
menu.setOnDismissListener(new OnDismissListener() {
|
|
||||||
@Override
|
|
||||||
public void onDismiss(PopupMenu popupMenu) {
|
|
||||||
mMenuClickedModel = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
menu.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (holder.vAnimator.getDisplayedChild() != 0) {
|
|
||||||
holder.vAnimator.setDisplayedChild(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
holder.vProgress.setProgress(model.mProgress);
|
|
||||||
holder.vProgress.setMax(model.mMax);
|
|
||||||
holder.vProgressMsg.setText(model.mProgressMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the size of your dataset (invoked by the layout manager)
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return mDataset.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(Uri uri) {
|
|
||||||
ViewModel newModel = new ViewModel(mContext, uri);
|
|
||||||
mDataset.add(newModel);
|
|
||||||
notifyItemInserted(mDataset.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProgress(Uri uri, int progress, int max, String msg) {
|
|
||||||
ViewModel newModel = new ViewModel(mContext, uri);
|
|
||||||
int pos = mDataset.indexOf(newModel);
|
|
||||||
mDataset.get(pos).setProgress(progress, max, msg);
|
|
||||||
notifyItemChanged(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addResult(Uri uri, DecryptVerifyResult result, Drawable icon,
|
|
||||||
OnClickListener onFileClick, OnClickListener onKeyClick) {
|
|
||||||
|
|
||||||
ViewModel model = new ViewModel(mContext, uri);
|
|
||||||
int pos = mDataset.indexOf(model);
|
|
||||||
model = mDataset.get(pos);
|
|
||||||
|
|
||||||
model.addResult(result);
|
|
||||||
if (icon != null) {
|
|
||||||
model.addIcon(icon);
|
|
||||||
}
|
|
||||||
model.setOnClickListeners(onFileClick, onKeyClick);
|
|
||||||
|
|
||||||
notifyItemChanged(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Drawable loadIcon(String mimeType) {
|
|
||||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setType(mimeType);
|
|
||||||
|
|
||||||
final List<ResolveInfo> matches = getActivity()
|
|
||||||
.getPackageManager().queryIntentActivities(intent, 0);
|
|
||||||
//noinspection LoopStatementThatDoesntLoop
|
|
||||||
for (ResolveInfo match : matches) {
|
|
||||||
return match.loadIcon(getActivity().getPackageManager());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DecryptItemViewHolder extends RecyclerView.ViewHolder implements StatusHolder {
|
|
||||||
public ViewAnimator vAnimator;
|
|
||||||
|
|
||||||
public ProgressBar vProgress;
|
|
||||||
public TextView vProgressMsg;
|
|
||||||
|
|
||||||
public View vFile;
|
|
||||||
public TextView vFilename;
|
|
||||||
public TextView vFilesize;
|
|
||||||
public ImageView vThumbnail;
|
|
||||||
|
|
||||||
public ImageView vEncStatusIcon;
|
|
||||||
public TextView vEncStatusText;
|
|
||||||
|
|
||||||
public ImageView vSigStatusIcon;
|
|
||||||
public TextView vSigStatusText;
|
|
||||||
public View vSignatureLayout;
|
|
||||||
public TextView vSignatureName;
|
|
||||||
public TextView vSignatureMail;
|
|
||||||
public TextView vSignatureAction;
|
|
||||||
|
|
||||||
public View vContextMenu;
|
|
||||||
|
|
||||||
public DecryptItemViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
vAnimator = (ViewAnimator) itemView.findViewById(R.id.view_animator);
|
|
||||||
|
|
||||||
vProgress = (ProgressBar) itemView.findViewById(R.id.progress);
|
|
||||||
vProgressMsg = (TextView) itemView.findViewById(R.id.progress_msg);
|
|
||||||
|
|
||||||
vFile = itemView.findViewById(R.id.file);
|
|
||||||
vFilename = (TextView) itemView.findViewById(R.id.filename);
|
|
||||||
vFilesize = (TextView) itemView.findViewById(R.id.filesize);
|
|
||||||
vThumbnail = (ImageView) itemView.findViewById(R.id.thumbnail);
|
|
||||||
|
|
||||||
vEncStatusIcon = (ImageView) itemView.findViewById(R.id.result_encryption_icon);
|
|
||||||
vEncStatusText = (TextView) itemView.findViewById(R.id.result_encryption_text);
|
|
||||||
|
|
||||||
vSigStatusIcon = (ImageView) itemView.findViewById(R.id.result_signature_icon);
|
|
||||||
vSigStatusText = (TextView) itemView.findViewById(R.id.result_signature_text);
|
|
||||||
vSignatureLayout = itemView.findViewById(R.id.result_signature_layout);
|
|
||||||
vSignatureName = (TextView) itemView.findViewById(R.id.result_signature_name);
|
|
||||||
vSignatureMail = (TextView) itemView.findViewById(R.id.result_signature_email);
|
|
||||||
vSignatureAction = (TextView) itemView.findViewById(R.id.result_signature_action);
|
|
||||||
|
|
||||||
vContextMenu = itemView.findViewById(R.id.context_menu);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageView getEncryptionStatusIcon() {
|
|
||||||
return vEncStatusIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextView getEncryptionStatusText() {
|
|
||||||
return vEncStatusText;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageView getSignatureStatusIcon() {
|
|
||||||
return vSigStatusIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextView getSignatureStatusText() {
|
|
||||||
return vSigStatusText;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getSignatureLayout() {
|
|
||||||
return vSignatureLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextView getSignatureAction() {
|
|
||||||
return vSignatureAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextView getSignatureUserName() {
|
|
||||||
return vSignatureName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextView getSignatureUserEmail() {
|
|
||||||
return vSignatureMail;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasEncrypt() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,51 @@
|
|||||||
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.SomeInterface;
|
||||||
|
import org.sufficientlysecure.keychain.ui.OuterClass.InnerStaticClass.ViewModel;
|
||||||
|
|
||||||
|
public class OuterClass {
|
||||||
|
|
||||||
|
public static class InnerStaticClass extends RecyclerView.Adapter<OtherInnerStaticClass> {
|
||||||
|
|
||||||
|
public class ViewModel {
|
||||||
|
ViewModel() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provide a suitable constructor (depends on the kind of dataset)
|
||||||
|
public InnerStaticClass() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new views (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public OtherInnerStaticClass onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(OtherInnerStaticClass holder, final int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the size of your dataset (invoked by the layout manager)
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class OtherInnerStaticClass extends RecyclerView.ViewHolder implements SomeInterface {
|
||||||
|
|
||||||
|
public OtherInnerStaticClass() {
|
||||||
|
super(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
public class SuperClass {
|
||||||
|
|
||||||
|
public static abstract class Adapter<VH extends ViewHolder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,11 +24,9 @@ import android.graphics.PorterDuff;
|
|||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
|
||||||
import org.spongycastle.asn1.ASN1ObjectIdentifier;
|
import org.spongycastle.asn1.ASN1ObjectIdentifier;
|
||||||
import org.spongycastle.asn1.nist.NISTNamedCurves;
|
import org.spongycastle.asn1.nist.NISTNamedCurves;
|
||||||
import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
@ -37,7 +35,6 @@ import org.spongycastle.util.encoders.Hex;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
||||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
|
||||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Curve;
|
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Curve;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@ -424,141 +421,7 @@ public class KeyFormattingUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // context.getDrawable is api lvl 21, need to use deprecated
|
@SuppressWarnings("deprecation") // context.getDrawable is api lvl 21, need to use deprecated
|
||||||
public static void setStatus(Context context, StatusHolder holder, DecryptVerifyResult result) {
|
public static void setStatus(Context context, SomeInterface holder, DecryptVerifyResult result) {
|
||||||
|
|
||||||
OpenPgpSignatureResult signatureResult = result.getSignatureResult();
|
|
||||||
|
|
||||||
if (holder.hasEncrypt()) {
|
|
||||||
int encText, encIcon, encColor;
|
|
||||||
if (signatureResult != null && signatureResult.isSignatureOnly()) {
|
|
||||||
encIcon = R.drawable.status_lock_open_24dp;
|
|
||||||
encText = R.string.decrypt_result_not_encrypted;
|
|
||||||
encColor = R.color.android_red_light;
|
|
||||||
} else {
|
|
||||||
encIcon = R.drawable.status_lock_closed_24dp;
|
|
||||||
encText = R.string.decrypt_result_encrypted;
|
|
||||||
encColor = R.color.android_green_light;
|
|
||||||
}
|
|
||||||
|
|
||||||
int encColorRes = context.getResources().getColor(encColor);
|
|
||||||
holder.getEncryptionStatusIcon().setImageDrawable(context.getResources().getDrawable(encIcon));
|
|
||||||
holder.getEncryptionStatusIcon().setColorFilter(encColorRes, PorterDuff.Mode.SRC_IN);
|
|
||||||
holder.getEncryptionStatusText().setText(encText);
|
|
||||||
holder.getEncryptionStatusText().setTextColor(encColorRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
int sigText, sigIcon, sigColor;
|
|
||||||
int sigActionText, sigActionIcon;
|
|
||||||
|
|
||||||
if (signatureResult == null) {
|
|
||||||
|
|
||||||
sigText = R.string.decrypt_result_no_signature;
|
|
||||||
sigIcon = R.drawable.status_signature_invalid_cutout_24dp;
|
|
||||||
sigColor = R.color.bg_gray;
|
|
||||||
|
|
||||||
// won't be used, but makes compiler happy
|
|
||||||
sigActionText = 0;
|
|
||||||
sigActionIcon = 0;
|
|
||||||
|
|
||||||
} else switch (signatureResult.getStatus()) {
|
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: {
|
|
||||||
sigText = R.string.decrypt_result_signature_certified;
|
|
||||||
sigIcon = R.drawable.status_signature_verified_cutout_24dp;
|
|
||||||
sigColor = R.color.android_green_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_show;
|
|
||||||
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: {
|
|
||||||
sigText = R.string.decrypt_result_signature_uncertified;
|
|
||||||
sigIcon = R.drawable.status_signature_unverified_cutout_24dp;
|
|
||||||
sigColor = R.color.android_orange_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_show;
|
|
||||||
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: {
|
|
||||||
sigText = R.string.decrypt_result_signature_revoked_key;
|
|
||||||
sigIcon = R.drawable.status_signature_revoked_cutout_24dp;
|
|
||||||
sigColor = R.color.android_red_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_show;
|
|
||||||
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: {
|
|
||||||
sigText = R.string.decrypt_result_signature_expired_key;
|
|
||||||
sigIcon = R.drawable.status_signature_expired_cutout_24dp;
|
|
||||||
sigColor = R.color.android_red_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_show;
|
|
||||||
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
|
|
||||||
sigText = R.string.decrypt_result_signature_missing_key;
|
|
||||||
sigIcon = R.drawable.status_signature_unknown_cutout_24dp;
|
|
||||||
sigColor = R.color.android_red_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_Lookup;
|
|
||||||
sigActionIcon = R.drawable.ic_file_download_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
case OpenPgpSignatureResult.SIGNATURE_ERROR: {
|
|
||||||
sigText = R.string.decrypt_result_invalid_signature;
|
|
||||||
sigIcon = R.drawable.status_signature_invalid_cutout_24dp;
|
|
||||||
sigColor = R.color.android_red_light;
|
|
||||||
|
|
||||||
sigActionText = R.string.decrypt_result_action_show;
|
|
||||||
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int sigColorRes = context.getResources().getColor(sigColor);
|
|
||||||
holder.getSignatureStatusIcon().setImageDrawable(context.getResources().getDrawable(sigIcon));
|
|
||||||
holder.getSignatureStatusIcon().setColorFilter(sigColorRes, PorterDuff.Mode.SRC_IN);
|
|
||||||
holder.getSignatureStatusText().setText(sigText);
|
|
||||||
holder.getSignatureStatusText().setTextColor(sigColorRes);
|
|
||||||
|
|
||||||
if (signatureResult != null) {
|
|
||||||
|
|
||||||
holder.getSignatureLayout().setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
holder.getSignatureAction().setText(sigActionText);
|
|
||||||
holder.getSignatureAction().setCompoundDrawablesWithIntrinsicBounds(
|
|
||||||
0, 0, sigActionIcon, 0);
|
|
||||||
|
|
||||||
String userId = signatureResult.getPrimaryUserId();
|
|
||||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
|
||||||
if (userIdSplit.name != null) {
|
|
||||||
holder.getSignatureUserName().setText(userIdSplit.name);
|
|
||||||
} else {
|
|
||||||
holder.getSignatureUserName().setText(R.string.user_id_no_name);
|
|
||||||
}
|
|
||||||
if (userIdSplit.email != null) {
|
|
||||||
holder.getSignatureUserEmail().setVisibility(View.VISIBLE);
|
|
||||||
holder.getSignatureUserEmail().setText(userIdSplit.email);
|
|
||||||
} else {
|
|
||||||
holder.getSignatureUserEmail().setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
holder.getSignatureLayout().setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package org.sufficientlysecure.keychain.ui.util;
|
||||||
|
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
public interface SomeInterface {
|
||||||
|
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
package org.sufficientlysecure.keychain.ui.util;
|
|
||||||
|
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
public interface StatusHolder {
|
|
||||||
|
|
||||||
ImageView getEncryptionStatusIcon();
|
|
||||||
|
|
||||||
TextView getEncryptionStatusText();
|
|
||||||
|
|
||||||
ImageView getSignatureStatusIcon();
|
|
||||||
|
|
||||||
TextView getSignatureStatusText();
|
|
||||||
|
|
||||||
View getSignatureLayout();
|
|
||||||
|
|
||||||
TextView getSignatureUserName();
|
|
||||||
|
|
||||||
TextView getSignatureUserEmail();
|
|
||||||
|
|
||||||
TextView getSignatureAction();
|
|
||||||
|
|
||||||
boolean hasEncrypt();
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user