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);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<include
|
||||
android:id="@+id/basic"
|
||||
layout="@layout/import_keys_list_item_basic" />
|
||||
layout="@layout/import_keys_list_basic_item" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
|
||||
<variable name="nonInteractive" type="boolean" />
|
||||
<variable name="entry" type="ImportKeysListEntry" />
|
||||
<variable name="expanded" type="boolean" />
|
||||
</data>
|
||||
|
||||
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
@@ -20,102 +22,82 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="24dp">
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
android:paddingTop="24dp">
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/status"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/status"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
app:keyRevokedOrExpired="@{entry.revokedOrExpired}"
|
||||
app:keySecret="@{entry.secretKey}"
|
||||
app:keyUserId="@{entry.primaryUserId.name}"
|
||||
app:query="@{entry.query}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
app:keyRevokedOrExpired="@{entry.revokedOrExpired}"
|
||||
app:keyUserEmail="@{entry.primaryUserId.email}"
|
||||
app:query="@{entry.query}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
app:keyRevokedOrExpired="@{entry.revokedOrExpired}"
|
||||
app:keySecret="@{entry.secretKey}"
|
||||
app:keyUserId="@{entry.primaryUserId.name}"
|
||||
app:query="@{entry.query}" />
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="@{entry.revokedOrExpired ? V.VISIBLE : V.GONE}"
|
||||
app:keyExpired="@{entry.expired}"
|
||||
app:keyRevoked="@{entry.revoked}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
app:keyRevokedOrExpired="@{entry.revokedOrExpired}"
|
||||
app:keyUserEmail="@{entry.primaryUserId.email}"
|
||||
app:query="@{entry.query}" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="@{entry.revokedOrExpired ? V.VISIBLE : V.GONE}"
|
||||
app:keyExpired="@{entry.expired}"
|
||||
app:keyRevoked="@{entry.revoked}" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/extra_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:visibility="@{nonInteractive ? V.GONE : V.VISIBLE}">
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/import_key"
|
||||
style="@style/CardViewActionButton"
|
||||
android:text="@string/btn_import" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/expand"
|
||||
style="@style/CardViewActionButton"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/ic_expand_more_black_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/extra_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<include
|
||||
layout="@layout/import_keys_list_item_extra"
|
||||
app:entry="@{entry}" />
|
||||
|
||||
</LinearLayout>
|
||||
<include
|
||||
android:id="@+id/extra"
|
||||
layout="@layout/import_keys_list_item_extra"
|
||||
app:entry="@{entry}" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -10,78 +10,95 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_key_id_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText"
|
||||
app:keyId="@{entry.keyIdHex}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_algorithm_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@{entry.algorithm ?? @string/unknown}"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_creation_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText"
|
||||
app:keyCreation="@{entry.date}" />
|
||||
|
||||
</LinearLayout>
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
app:keyUserIds="@{entry.sortedUserIds}"
|
||||
app:query="@{entry.query}" />
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_key_id_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText"
|
||||
app:keyId="@{entry.keyIdHex}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_algorithm_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="@{entry.algorithm ?? @string/unknown}"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_creation_colon"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?attr/colorText"
|
||||
app:keyCreation="@{entry.date}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
app:keyUserIds="@{entry.sortedUserIds}"
|
||||
app:query="@{entry.query}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/import_key"
|
||||
style="@style/CardViewActionButton"
|
||||
android:text="@string/btn_import" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user