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 android.view.ViewGroup;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.databinding.ImportKeysListBasicItemBinding;
|
||||||
import org.sufficientlysecure.keychain.databinding.ImportKeysListFragmentBinding;
|
import org.sufficientlysecure.keychain.databinding.ImportKeysListFragmentBinding;
|
||||||
import org.sufficientlysecure.keychain.databinding.ImportKeysListItemBasicBinding;
|
|
||||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||||
import org.sufficientlysecure.keychain.keyimport.processing.AsyncTaskResultWrapper;
|
import org.sufficientlysecure.keychain.keyimport.processing.AsyncTaskResultWrapper;
|
||||||
import org.sufficientlysecure.keychain.keyimport.processing.BytesLoaderState;
|
import org.sufficientlysecure.keychain.keyimport.processing.BytesLoaderState;
|
||||||
@@ -69,7 +69,7 @@ public class ImportKeysListFragment extends Fragment implements
|
|||||||
private ImportKeysListener mListener;
|
private ImportKeysListener mListener;
|
||||||
|
|
||||||
private ImportKeysListFragmentBinding mBinding;
|
private ImportKeysListFragmentBinding mBinding;
|
||||||
private ImportKeysListItemBasicBinding mBindingBasic;
|
private ImportKeysListBasicItemBinding mBindingBasic;
|
||||||
private ParcelableProxy mParcelableProxy;
|
private ParcelableProxy mParcelableProxy;
|
||||||
|
|
||||||
private ImportKeysAdapter mAdapter;
|
private ImportKeysAdapter mAdapter;
|
||||||
|
|||||||
@@ -126,14 +126,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
final boolean downloaded = keyState.mDownloaded;
|
final boolean downloaded = keyState.mDownloaded;
|
||||||
final boolean showed = keyState.mShowed;
|
final boolean showed = keyState.mShowed;
|
||||||
|
|
||||||
b.importKey.setOnClickListener(new View.OnClickListener() {
|
b.card.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
getKey(entry, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
b.expand.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mCurrent = position;
|
mCurrent = position;
|
||||||
@@ -145,15 +138,12 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
float rotation = showed ? 180 : 0;
|
b.extra.importKey.setOnClickListener(new View.OnClickListener() {
|
||||||
if (!keyState.mAnimated) {
|
@Override
|
||||||
keyState.mAnimated = true;
|
public void onClick(View v) {
|
||||||
float oldRotation = !showed ? 180 : 0;
|
getKey(entry, false);
|
||||||
b.expand.setRotation(oldRotation);
|
|
||||||
b.expand.animate().rotation(rotation).start();
|
|
||||||
} else {
|
|
||||||
b.expand.setRotation(rotation);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
b.extraContainer.setVisibility(showed ? View.VISIBLE : View.GONE);
|
b.extraContainer.setVisibility(showed ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
@@ -234,13 +224,11 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
private class KeyState {
|
private class KeyState {
|
||||||
public boolean mDownloaded = false;
|
public boolean mDownloaded = false;
|
||||||
public boolean mShowed = false;
|
public boolean mShowed = false;
|
||||||
public boolean mAnimated = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeState(int position, boolean showed) {
|
private void changeState(int position, boolean showed) {
|
||||||
KeyState keyState = mKeyStates[position];
|
KeyState keyState = mKeyStates[position];
|
||||||
keyState.mShowed = showed;
|
keyState.mShowed = showed;
|
||||||
keyState.mAnimated = true;
|
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/basic"
|
android:id="@+id/basic"
|
||||||
layout="@layout/import_keys_list_item_basic" />
|
layout="@layout/import_keys_list_basic_item" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
|
|
||||||
<variable name="nonInteractive" type="boolean" />
|
<variable name="nonInteractive" type="boolean" />
|
||||||
<variable name="entry" type="ImportKeysListEntry" />
|
<variable name="entry" type="ImportKeysListEntry" />
|
||||||
|
<variable name="expanded" type="boolean" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
<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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
@@ -20,13 +22,19 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="24dp">
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
|
android:paddingTop="24dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
@@ -76,47 +84,21 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:visibility="@{nonInteractive ? V.GONE : V.VISIBLE}">
|
|
||||||
|
|
||||||
<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
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/extra_container"
|
android:id="@+id/extra_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="24dp"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
android:id="@+id/extra"
|
||||||
layout="@layout/import_keys_list_item_extra"
|
layout="@layout/import_keys_list_item_extra"
|
||||||
app:entry="@{entry}" />
|
app:entry="@{entry}" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -10,7 +10,17 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -85,4 +95,11 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/import_key"
|
||||||
|
style="@style/CardViewActionButton"
|
||||||
|
android:text="@string/btn_import" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
Reference in New Issue
Block a user