ImportKeys: Make the design more usable
- Make card clickable - Move import button in expanded part of the card
This commit is contained in:
@@ -35,8 +35,8 @@ import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.databinding.ImportKeysListBasicItemBinding;
|
||||
import org.sufficientlysecure.keychain.databinding.ImportKeysListFragmentBinding;
|
||||
import org.sufficientlysecure.keychain.databinding.ImportKeysListItemBasicBinding;
|
||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||
import org.sufficientlysecure.keychain.keyimport.processing.AsyncTaskResultWrapper;
|
||||
import org.sufficientlysecure.keychain.keyimport.processing.BytesLoaderState;
|
||||
@@ -69,7 +69,7 @@ public class ImportKeysListFragment extends Fragment implements
|
||||
private ImportKeysListener mListener;
|
||||
|
||||
private ImportKeysListFragmentBinding mBinding;
|
||||
private ImportKeysListItemBasicBinding mBindingBasic;
|
||||
private ImportKeysListBasicItemBinding mBindingBasic;
|
||||
private ParcelableProxy mParcelableProxy;
|
||||
|
||||
private ImportKeysAdapter mAdapter;
|
||||
|
||||
@@ -126,14 +126,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
final boolean downloaded = keyState.mDownloaded;
|
||||
final boolean showed = keyState.mShowed;
|
||||
|
||||
b.importKey.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getKey(entry, false);
|
||||
}
|
||||
});
|
||||
|
||||
b.expand.setOnClickListener(new View.OnClickListener() {
|
||||
b.card.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mCurrent = position;
|
||||
@@ -145,15 +138,12 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
}
|
||||
});
|
||||
|
||||
float rotation = showed ? 180 : 0;
|
||||
if (!keyState.mAnimated) {
|
||||
keyState.mAnimated = true;
|
||||
float oldRotation = !showed ? 180 : 0;
|
||||
b.expand.setRotation(oldRotation);
|
||||
b.expand.animate().rotation(rotation).start();
|
||||
} else {
|
||||
b.expand.setRotation(rotation);
|
||||
}
|
||||
b.extra.importKey.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getKey(entry, false);
|
||||
}
|
||||
});
|
||||
|
||||
b.extraContainer.setVisibility(showed ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
@@ -234,13 +224,11 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
private class KeyState {
|
||||
public boolean mDownloaded = false;
|
||||
public boolean mShowed = false;
|
||||
public boolean mAnimated = true;
|
||||
}
|
||||
|
||||
private void changeState(int position, boolean showed) {
|
||||
KeyState keyState = mKeyStates[position];
|
||||
keyState.mShowed = showed;
|
||||
keyState.mAnimated = true;
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user