mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
multi-decrypt: working recyclerview which decrypt files sequentially, ui in progress
This commit is contained in:
parent
04d6fd62c8
commit
fc9a7bfcb3
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -27,7 +29,6 @@ import android.widget.Toast;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.intents.OpenKeychainIntents;
|
import org.sufficientlysecure.keychain.intents.OpenKeychainIntents;
|
||||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
|
||||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||||
|
|
||||||
|
|
||||||
@ -104,9 +105,11 @@ public class DecryptFilesActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayListFragment(Uri inputUri, DecryptVerifyResult result) {
|
public void displayListFragment(Uri inputUri) {
|
||||||
|
|
||||||
DecryptFilesListFragment frag = DecryptFilesListFragment.newInstance(inputUri, result);
|
ArrayList<Uri> uris = new ArrayList<>();
|
||||||
|
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, frag)
|
||||||
|
@ -17,46 +17,31 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.support.v4.app.Fragment;
|
||||||
import android.os.Messenger;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
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.pgp.PgpDecryptVerifyInputParcel;
|
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
|
||||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
|
||||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationFragment;
|
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
|
||||||
|
|
||||||
public class DecryptFilesInputFragment extends CryptoOperationFragment {
|
public class DecryptFilesInputFragment extends Fragment {
|
||||||
public static final String ARG_URI = "uri";
|
public static final String ARG_URI = "uri";
|
||||||
public static final String ARG_OPEN_DIRECTLY = "open_directly";
|
public static final String ARG_OPEN_DIRECTLY = "open_directly";
|
||||||
|
|
||||||
private static final int REQUEST_CODE_INPUT = 0x00007003;
|
private static final int REQUEST_CODE_INPUT = 0x00007003;
|
||||||
|
|
||||||
// view
|
|
||||||
private TextView mFilename;
|
private TextView mFilename;
|
||||||
private View mDecryptButton;
|
private View mDecryptButton;
|
||||||
|
|
||||||
// model
|
|
||||||
private Uri mInputUri = null;
|
private Uri mInputUri = null;
|
||||||
private Uri mOutputUri = null;
|
|
||||||
|
|
||||||
public static DecryptFilesInputFragment newInstance(Uri uri, boolean openDirectly) {
|
public static DecryptFilesInputFragment newInstance(Uri uri, boolean openDirectly) {
|
||||||
DecryptFilesInputFragment frag = new DecryptFilesInputFragment();
|
DecryptFilesInputFragment frag = new DecryptFilesInputFragment();
|
||||||
@ -140,81 +125,8 @@ public class DecryptFilesInputFragment extends CryptoOperationFragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptoOperation(new CryptoInputParcel());
|
DecryptFilesActivity activity = (DecryptFilesActivity) getActivity();
|
||||||
}
|
activity.displayListFragment(mInputUri);
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressLint("HandlerLeak")
|
|
||||||
protected void cryptoOperation(CryptoInputParcel cryptoInput) {
|
|
||||||
// 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_METADATA);
|
|
||||||
|
|
||||||
// data
|
|
||||||
|
|
||||||
Log.d(Constants.TAG, "mInputUri=" + mInputUri + ", mOutputUri=" + mOutputUri);
|
|
||||||
|
|
||||||
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mInputUri, mOutputUri)
|
|
||||||
.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
|
|
||||||
ServiceProgressHandler saveHandler = new ServiceProgressHandler(
|
|
||||||
getActivity(),
|
|
||||||
getString(R.string.progress_decrypting),
|
|
||||||
ProgressDialog.STYLE_HORIZONTAL,
|
|
||||||
ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message message) {
|
|
||||||
// handle messages by standard KeychainIntentServiceHandler first
|
|
||||||
super.handleMessage(message);
|
|
||||||
|
|
||||||
// handle pending messages
|
|
||||||
if (handlePendingMessage(message)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.arg1 == MessageStatus.OKAY.ordinal()) {
|
|
||||||
// get returned data bundle
|
|
||||||
Bundle returnData = message.getData();
|
|
||||||
|
|
||||||
DecryptVerifyResult result =
|
|
||||||
returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT);
|
|
||||||
|
|
||||||
DecryptFilesActivity activity = ((DecryptFilesActivity) getActivity());
|
|
||||||
if (activity == null) {
|
|
||||||
// nothing we can do
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.success()) {
|
|
||||||
activity.displayListFragment(mInputUri, result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
result.createNotify(activity).show(DecryptFilesInputFragment.this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create a new Messenger for the communication back
|
|
||||||
Messenger messenger = new Messenger(saveHandler);
|
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
|
||||||
|
|
||||||
// show progress dialog
|
|
||||||
saveHandler.showProgressDialog(getActivity());
|
|
||||||
|
|
||||||
// start service with intent
|
|
||||||
getActivity().startService(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,55 +18,54 @@
|
|||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
import android.support.v7.widget.DefaultItemAnimator;
|
import android.support.v7.widget.DefaultItemAnimator;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.ViewAnimator;
|
||||||
|
|
||||||
import org.openintents.openpgp.OpenPgpMetadata;
|
import org.openintents.openpgp.OpenPgpMetadata;
|
||||||
|
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||||
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.PgpDecryptVerifyInputParcel;
|
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
import org.sufficientlysecure.keychain.service.ServiceProgressHandler;
|
||||||
|
import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
|
||||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
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.adapter.SpacesItemDecoration;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment;
|
import org.sufficientlysecure.keychain.ui.base.CryptoOperationFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
|
public class DecryptFilesListFragment extends CryptoOperationFragment {
|
||||||
public class DecryptFilesListFragment extends DecryptFragment {
|
public static final String ARG_URIS = "uris";
|
||||||
public static final String ARG_URI = "uri";
|
|
||||||
|
|
||||||
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
|
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
|
||||||
|
|
||||||
private Uri mInputUri = null;
|
private ArrayList<Uri> mInputUris;
|
||||||
private DecryptVerifyResult mResult;
|
private ArrayList<Uri> mPendingInputUris;
|
||||||
|
private Uri mCurrentInputUri;
|
||||||
|
|
||||||
private Uri mOutputUri = null;
|
private Uri mOutputUri = null;
|
||||||
private RecyclerView mFilesList;
|
private RecyclerView mFilesList;
|
||||||
@ -75,13 +74,11 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
/**
|
/**
|
||||||
* Creates new instance of this fragment
|
* Creates new instance of this fragment
|
||||||
*/
|
*/
|
||||||
public static DecryptFilesListFragment newInstance(Uri uri, DecryptVerifyResult result) {
|
public static DecryptFilesListFragment newInstance(ArrayList<Uri> uris) {
|
||||||
DecryptFilesListFragment frag = new DecryptFilesListFragment();
|
DecryptFilesListFragment frag = new DecryptFilesListFragment();
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(ARG_URI, uri);
|
args.putParcelableArrayList(ARG_URIS, uris);
|
||||||
args.putParcelable(ARG_DECRYPT_VERIFY_RESULT, result);
|
|
||||||
|
|
||||||
frag.setArguments(args);
|
frag.setArguments(args);
|
||||||
|
|
||||||
return frag;
|
return frag;
|
||||||
@ -98,11 +95,11 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
|
|
||||||
mFilesList.addItemDecoration(new SpacesItemDecoration(
|
mFilesList.addItemDecoration(new SpacesItemDecoration(
|
||||||
FormattingUtils.dpToPx(getActivity(), 4)));
|
FormattingUtils.dpToPx(getActivity(), 4)));
|
||||||
// mFilesList.setHasFixedSize(true);
|
mFilesList.setHasFixedSize(true);
|
||||||
mFilesList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mFilesList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
mFilesList.setItemAnimator(new DefaultItemAnimator());
|
mFilesList.setItemAnimator(new DefaultItemAnimator());
|
||||||
|
|
||||||
mAdapter = new DecryptFilesAdapter(getActivity(), new ArrayList<ViewModel>());
|
mAdapter = new DecryptFilesAdapter(getActivity());
|
||||||
mFilesList.setAdapter(mAdapter);
|
mFilesList.setAdapter(mAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
@ -112,20 +109,14 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|
||||||
outState.putParcelable(ARG_URI, mInputUri);
|
outState.putParcelableArrayList(ARG_URIS, mInputUris);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
Bundle state = getArguments();
|
displayInputUris(getArguments().<Uri>getParcelableArrayList(ARG_URIS));
|
||||||
mInputUri = state.getParcelable(ARG_URI);
|
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
|
||||||
displayMetadata(state.<DecryptVerifyResult>getParcelable(ARG_DECRYPT_VERIFY_RESULT));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String removeEncryptedAppend(String name) {
|
private String removeEncryptedAppend(String name) {
|
||||||
@ -137,34 +128,37 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askForOutputFilename(String originalFilename) {
|
private void displayInputUris(ArrayList<Uri> uris) {
|
||||||
if (TextUtils.isEmpty(originalFilename)) {
|
mInputUris = uris;
|
||||||
originalFilename = removeEncryptedAppend(FileHelper.getFilename(getActivity(), mInputUri));
|
mPendingInputUris = uris;
|
||||||
}
|
for (Uri uri : uris) {
|
||||||
|
mAdapter.add(uri);
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
|
||||||
File file = new File(mInputUri.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, "*/*", originalFilename, REQUEST_CODE_OUTPUT);
|
|
||||||
}
|
}
|
||||||
|
cryptoOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMetadata(DecryptVerifyResult result) {
|
private void displayProgress(Uri uri, int progress, int max, String msg) {
|
||||||
loadVerifyResult(result);
|
mAdapter.setProgress(uri, progress, max, msg);
|
||||||
|
}
|
||||||
OpenPgpMetadata metadata = result.getDecryptMetadata();
|
|
||||||
mAdapter.add(metadata);
|
|
||||||
mFilesList.requestFocus();
|
|
||||||
|
|
||||||
|
private void displayInputResult(Uri uri, DecryptVerifyResult result) {
|
||||||
|
mAdapter.addResult(uri, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressLint("HandlerLeak")
|
@SuppressLint("HandlerLeak")
|
||||||
protected void cryptoOperation(CryptoInputParcel cryptoInput) {
|
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
|
// Send all information needed to service to decrypt in other thread
|
||||||
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
Intent intent = new Intent(getActivity(), KeychainIntentService.class);
|
||||||
|
|
||||||
@ -175,9 +169,9 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
||||||
Log.d(Constants.TAG, "mInputUri=" + mInputUri + ", mOutputUri=" + mOutputUri);
|
Log.d(Constants.TAG, "mInputUri=" + mCurrentInputUri + ", mOutputUri=" + mOutputUri);
|
||||||
|
|
||||||
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mInputUri, mOutputUri)
|
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mCurrentInputUri, mOutputUri)
|
||||||
.setAllowSymmetricDecryption(true);
|
.setAllowSymmetricDecryption(true);
|
||||||
|
|
||||||
data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input);
|
data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input);
|
||||||
@ -186,11 +180,7 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
// Message is received after decrypting is done in KeychainIntentService
|
// Message is received after decrypting is done in KeychainIntentService
|
||||||
ServiceProgressHandler saveHandler = new ServiceProgressHandler(
|
Handler saveHandler = new Handler() {
|
||||||
getActivity(),
|
|
||||||
getString(R.string.progress_decrypting),
|
|
||||||
ProgressDialog.STYLE_HORIZONTAL,
|
|
||||||
ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) {
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
// handle messages by standard KeychainIntentServiceHandler first
|
// handle messages by standard KeychainIntentServiceHandler first
|
||||||
@ -201,27 +191,47 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.arg1 == MessageStatus.OKAY.ordinal()) {
|
MessageStatus status = MessageStatus.fromInt(message.arg1);
|
||||||
// get returned data bundle
|
Bundle data = message.getData();
|
||||||
Bundle returnData = message.getData();
|
|
||||||
|
|
||||||
DecryptVerifyResult result =
|
switch (status) {
|
||||||
returnData.getParcelable(DecryptVerifyResult.EXTRA_RESULT);
|
case UNKNOWN:
|
||||||
|
case EXCEPTION: {
|
||||||
if (result.success()) {
|
Log.e(Constants.TAG, "error: " + status);
|
||||||
// display signature result in activity
|
break;
|
||||||
loadVerifyResult(result);
|
}
|
||||||
|
|
||||||
/*
|
case UPDATE_PROGRESS: {
|
||||||
// A future open after decryption feature
|
int progress = data.getInt(ServiceProgressHandler.DATA_PROGRESS);
|
||||||
if () {
|
int max = data.getInt(ServiceProgressHandler.DATA_PROGRESS_MAX);
|
||||||
Intent viewFile = new Intent(Intent.ACTION_VIEW);
|
String msg;
|
||||||
viewFile.setInputData(mOutputUri);
|
if (data.containsKey(ServiceProgressHandler.DATA_MESSAGE_ID)) {
|
||||||
startActivity(viewFile);
|
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);
|
||||||
}
|
}
|
||||||
result.createNotify(getActivity()).show(DecryptFilesListFragment.this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -231,9 +241,6 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
Messenger messenger = new Messenger(saveHandler);
|
Messenger messenger = new Messenger(saveHandler);
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);
|
||||||
|
|
||||||
// show progress dialog
|
|
||||||
saveHandler.showProgressDialog(getActivity());
|
|
||||||
|
|
||||||
// start service with intent
|
// start service with intent
|
||||||
getActivity().startService(intent);
|
getActivity().startService(intent);
|
||||||
}
|
}
|
||||||
@ -256,23 +263,39 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static class DecryptFilesAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||||
protected void onVerifyLoaded(boolean hideErrorOverlay) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DecryptFilesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<ViewModel> mDataset;
|
private ArrayList<ViewModel> mDataset;
|
||||||
|
|
||||||
public static class ViewModel {
|
public static class ViewModel {
|
||||||
OpenPgpMetadata mMetadata;
|
Context mContext;
|
||||||
Bitmap thumbnail;
|
Uri mUri;
|
||||||
|
DecryptVerifyResult mResult;
|
||||||
|
|
||||||
ViewModel(Context context, OpenPgpMetadata metadata) {
|
int mProgress, mMax;
|
||||||
mMetadata = metadata;
|
String mProgressMsg;
|
||||||
int px = FormattingUtils.dpToPx(context, 48);
|
|
||||||
// this.thumbnail = FileHelper.getThumbnail(context, inputUri, new Point(px, px));
|
ViewModel(Context context, Uri uri) {
|
||||||
|
mContext = context;
|
||||||
|
mUri = uri;
|
||||||
|
mProgress = 0;
|
||||||
|
mMax = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addResult(DecryptVerifyResult result) {
|
||||||
|
mResult = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// Depends on inputUri only
|
||||||
@ -281,83 +304,79 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
ViewModel viewModel = (ViewModel) o;
|
ViewModel viewModel = (ViewModel) o;
|
||||||
return !(mMetadata != null ? !mMetadata.equals(viewModel.mMetadata)
|
return !(mResult != null ? !mResult.equals(viewModel.mResult)
|
||||||
: viewModel.mMetadata != null);
|
: viewModel.mResult != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depends on inputUri only
|
// Depends on inputUri only
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return mMetadata != null ? mMetadata.hashCode() : 0;
|
return mResult != null ? mResult.hashCode() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mMetadata.toString();
|
return mResult.toString();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Provide a reference to the views for each data item
|
|
||||||
// Complex data items may need more than one view per item, and
|
|
||||||
// you provide access to all the views for a data item in a view holder
|
|
||||||
class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
public TextView filename;
|
|
||||||
public TextView fileSize;
|
|
||||||
public View removeButton;
|
|
||||||
public ImageView thumbnail;
|
|
||||||
|
|
||||||
public ViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
filename = (TextView) itemView.findViewById(R.id.filename);
|
|
||||||
fileSize = (TextView) itemView.findViewById(R.id.filesize);
|
|
||||||
removeButton = itemView.findViewById(R.id.action_remove_file_from_list);
|
|
||||||
thumbnail = (ImageView) itemView.findViewById(R.id.thumbnail);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provide a suitable constructor (depends on the kind of dataset)
|
// Provide a suitable constructor (depends on the kind of dataset)
|
||||||
public DecryptFilesAdapter(Context context, List<ViewModel> myDataset) {
|
public DecryptFilesAdapter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDataset = myDataset;
|
mDataset = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new views (invoked by the layout manager)
|
// Create new views (invoked by the layout manager)
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
//inflate your layout and pass it to view holder
|
//inflate your layout and pass it to view holder
|
||||||
View v = LayoutInflater.from(parent.getContext())
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.file_list_entry, parent, false);
|
.inflate(R.layout.decrypt_list_entry, parent, false);
|
||||||
return new ViewHolder(v);
|
return new ViewHolder(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace the contents of a view (invoked by the layout manager)
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
|
public void onBindViewHolder(ViewHolder holder, final int position) {
|
||||||
ViewHolder thisHolder = (ViewHolder) holder;
|
|
||||||
// - get element from your dataset at this position
|
// - get element from your dataset at this position
|
||||||
// - replace the contents of the view with that element
|
// - replace the contents of the view with that element
|
||||||
final ViewModel model = mDataset.get(position);
|
final ViewModel model = mDataset.get(position);
|
||||||
|
|
||||||
thisHolder.filename.setText(model.mMetadata.getFilename());
|
if (model.hasResult()) {
|
||||||
|
if (holder.vAnimator.getDisplayedChild() != 1) {
|
||||||
long size = model.mMetadata.getOriginalSize();
|
holder.vAnimator.setDisplayedChild(1);
|
||||||
if (size == -1) {
|
|
||||||
thisHolder.fileSize.setText("");
|
|
||||||
} else {
|
|
||||||
thisHolder.fileSize.setText(FileHelper.readableFileSize(size));
|
|
||||||
}
|
|
||||||
thisHolder.removeButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
remove(model);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (model.thumbnail != null) {
|
OpenPgpSignatureResult signature = model.mResult.getSignatureResult();
|
||||||
thisHolder.thumbnail.setImageBitmap(model.thumbnail);
|
if (signature != null) {
|
||||||
|
KeyFormattingUtils.setStatusImage(mContext, holder.vStatusIcon, holder.vStatusText,
|
||||||
|
State.VERIFIED);
|
||||||
|
holder.vStatusText.setText("Yolo!");
|
||||||
|
holder.vSignatureName.setText(signature.getPrimaryUserId());
|
||||||
|
} else {
|
||||||
|
KeyFormattingUtils.setStatusImage(mContext,
|
||||||
|
holder.vStatusIcon, holder.vStatusText, State.UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenPgpMetadata metadata = model.mResult.getDecryptMetadata();
|
||||||
|
holder.vFilename.setText(metadata.getFilename());
|
||||||
|
|
||||||
|
long size = metadata.getOriginalSize();
|
||||||
|
if (size == -1) {
|
||||||
|
holder.vFilesize.setText("");
|
||||||
|
} else {
|
||||||
|
holder.vFilesize.setText(FileHelper.readableFileSize(size));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
thisHolder.thumbnail.setImageResource(R.drawable.ic_doc_generic_am);
|
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)
|
// Return the size of your dataset (invoked by the layout manager)
|
||||||
@ -366,31 +385,66 @@ public class DecryptFilesListFragment extends DecryptFragment {
|
|||||||
return mDataset.size();
|
return mDataset.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(OpenPgpMetadata metadata) {
|
public void add(Uri uri) {
|
||||||
ViewModel newModel = new ViewModel(mContext, metadata);
|
ViewModel newModel = new ViewModel(mContext, uri);
|
||||||
mDataset.add(newModel);
|
mDataset.add(newModel);
|
||||||
notifyItemInserted(mDataset.size());
|
notifyItemInserted(mDataset.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAll(ArrayList<OpenPgpMetadata> metadatas) {
|
public void setProgress(Uri uri, int progress, int max, String msg) {
|
||||||
if (metadatas != null) {
|
ViewModel newModel = new ViewModel(mContext, uri);
|
||||||
int startIndex = mDataset.size();
|
int pos = mDataset.indexOf(newModel);
|
||||||
for (OpenPgpMetadata metadata : metadatas) {
|
mDataset.get(pos).setProgress(progress, max, msg);
|
||||||
ViewModel newModel = new ViewModel(mContext, metadata);
|
notifyItemChanged(pos);
|
||||||
if (mDataset.contains(newModel)) {
|
|
||||||
Log.e(Constants.TAG, "Skipped duplicate " + metadata);
|
|
||||||
} else {
|
|
||||||
mDataset.add(newModel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifyItemRangeInserted(startIndex, mDataset.size() - startIndex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(ViewModel model) {
|
public void addResult(Uri uri, DecryptVerifyResult result) {
|
||||||
int position = mDataset.indexOf(model);
|
ViewModel newModel = new ViewModel(mContext, uri);
|
||||||
mDataset.remove(position);
|
int pos = mDataset.indexOf(newModel);
|
||||||
notifyItemRemoved(position);
|
mDataset.get(pos).addResult(result);
|
||||||
|
notifyItemChanged(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Provide a reference to the views for each data item
|
||||||
|
// Complex data items may need more than one view per item, and
|
||||||
|
// you provide access to all the views for a data item in a view holder
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public ViewAnimator vAnimator;
|
||||||
|
|
||||||
|
public ProgressBar vProgress;
|
||||||
|
public TextView vProgressMsg;
|
||||||
|
|
||||||
|
public TextView vFilename;
|
||||||
|
public TextView vFilesize;
|
||||||
|
public View vRemoveButton;
|
||||||
|
public ImageView vThumbnail;
|
||||||
|
|
||||||
|
public ImageView vStatusIcon;
|
||||||
|
public TextView vStatusText;
|
||||||
|
public TextView vSignatureName;
|
||||||
|
public TextView vSignatureMail;
|
||||||
|
|
||||||
|
public ViewHolder(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);
|
||||||
|
|
||||||
|
vFilename = (TextView) itemView.findViewById(R.id.filename);
|
||||||
|
vFilesize = (TextView) itemView.findViewById(R.id.filesize);
|
||||||
|
vRemoveButton = itemView.findViewById(R.id.action_remove_file_from_list);
|
||||||
|
vThumbnail = (ImageView) itemView.findViewById(R.id.thumbnail);
|
||||||
|
|
||||||
|
vStatusIcon = (ImageView) itemView.findViewById(R.id.result_signature_icon);
|
||||||
|
vStatusText = (TextView) itemView.findViewById(R.id.result_signature_text);
|
||||||
|
vSignatureName = (TextView) itemView.findViewById(R.id.result_signature_name);
|
||||||
|
vSignatureMail= (TextView) itemView.findViewById(R.id.result_signature_email);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
android:id="@+id/decrypted_files_list"
|
android:id="@+id/decrypted_files_list"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
232
OpenKeychain/src/main/res/layout/decrypt_list_entry.xml
Normal file
232
OpenKeychain/src/main/res/layout/decrypt_list_entry.xml
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/attachment_bg_holo"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<ViewAnimator
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inAnimation="@anim/fade_in"
|
||||||
|
android:outAnimation="@anim/fade_out"
|
||||||
|
android:id="@+id/view_animator">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="false"
|
||||||
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
|
android:progress="40"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progress_msg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text=""
|
||||||
|
tools:text="Progress Message"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/result_signature_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/status_signature_unverified_cutout_24dp"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/result_signature_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text=""
|
||||||
|
tools:text="Signature status text" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/result_encryption_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/status_lock_open_24dp"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/result_encryption_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text=""
|
||||||
|
tools:text="Encryption status text" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/result_signature_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/result_signature_name"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
tools:text="Alice" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/result_signature_email"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text=""
|
||||||
|
tools:text="alice@example.com" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="1dip"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/result_signature_action"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:drawableRight="@drawable/ic_vpn_key_grey_24dp"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="Show"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dip"
|
||||||
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/file"
|
||||||
|
android:clickable="true"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/thumbnail"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_width="48dip"
|
||||||
|
android:layout_height="48dip"
|
||||||
|
android:src="@drawable/ic_doc_generic_am" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/filename"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text=""
|
||||||
|
tools:text="filename.jpg" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/filesize"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorTertiary"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text=""
|
||||||
|
tools:text="14kb" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/context_menu"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_width="36dip"
|
||||||
|
android:layout_height="48dip"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@drawable/abc_ic_menu_moreoverflow_mtrl_alpha" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ViewAnimator>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user