Add edit action to user id card, left align card actions per material design guidelines
This commit is contained in:
parent
621f8c2c70
commit
3f70511708
|
@ -391,11 +391,11 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.menu_key_view_certify_fingerprint: {
|
case R.id.menu_key_view_certify_fingerprint: {
|
||||||
certifyFingeprint(mDataUri, false);
|
certifyFingerprint(mDataUri, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.menu_key_view_certify_fingerprint_word: {
|
case R.id.menu_key_view_certify_fingerprint_word: {
|
||||||
certifyFingeprint(mDataUri, true);
|
certifyFingerprint(mDataUri, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,14 +423,13 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void scanQrCode() {
|
private void scanQrCode() {
|
||||||
Intent scanQrCode = new Intent(this, ImportKeysProxyActivity.class);
|
Intent scanQrCode = new Intent(this, ImportKeysProxyActivity.class);
|
||||||
scanQrCode.setAction(ImportKeysProxyActivity.ACTION_SCAN_WITH_RESULT);
|
scanQrCode.setAction(ImportKeysProxyActivity.ACTION_SCAN_WITH_RESULT);
|
||||||
startActivityForResult(scanQrCode, REQUEST_QR_FINGERPRINT);
|
startActivityForResult(scanQrCode, REQUEST_QR_FINGERPRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void certifyFingeprint(Uri dataUri, boolean enableWordConfirm) {
|
private void certifyFingerprint(Uri dataUri, boolean enableWordConfirm) {
|
||||||
Intent intent = new Intent(this, CertifyFingerprintActivity.class);
|
Intent intent = new Intent(this, CertifyFingerprintActivity.class);
|
||||||
intent.setData(dataUri);
|
intent.setData(dataUri);
|
||||||
intent.putExtra(CertifyFingerprintActivity.EXTRA_ENABLE_WORD_CONFIRM, enableWordConfirm);
|
intent.putExtra(CertifyFingerprintActivity.EXTRA_ENABLE_WORD_CONFIRM, enableWordConfirm);
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class ViewKeyAdvSubkeysFragment extends LoaderFragment implements
|
||||||
switch (loader.getId()) {
|
switch (loader.getId()) {
|
||||||
case LOADER_ID_UNIFIED: {
|
case LOADER_ID_UNIFIED: {
|
||||||
data.moveToFirst();
|
data.moveToFirst();
|
||||||
|
|
||||||
mMasterKeyId = data.getLong(INDEX_MASTER_KEY_ID);
|
mMasterKeyId = data.getLong(INDEX_MASTER_KEY_ID);
|
||||||
mHasSecret = data.getInt(INDEX_HAS_ANY_SECRET) != 0;
|
mHasSecret = data.getInt(INDEX_HAS_ANY_SECRET) != 0;
|
||||||
mFingerprint = data.getBlob(INDEX_FINGERPRINT);
|
mFingerprint = data.getBlob(INDEX_FINGERPRINT);
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||||
try {
|
try {
|
||||||
frag = mLinkedIdsAdapter.getLinkedIdFragment(mDataUri, position, mFingerprint);
|
frag = mLinkedIdsAdapter.getLinkedIdFragment(mDataUri, position, mFingerprint);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.e(Constants.TAG, "IOException", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,8 +429,17 @@ public class ViewKeyFragment extends LoaderFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOADER_ID_USER_IDS: {
|
case LOADER_ID_USER_IDS: {
|
||||||
|
LinearLayout editButtonsLayout =
|
||||||
|
(LinearLayout) getActivity().findViewById(R.id.view_key_card_user_ids_buttons);
|
||||||
|
if (mIsSecret) {
|
||||||
|
editButtonsLayout.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
editButtonsLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
setContentShown(true, false);
|
setContentShown(true, false);
|
||||||
mUserIdsAdapter.swapCursor(data);
|
mUserIdsAdapter.swapCursor(data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
package org.sufficientlysecure.keychain.ui.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by rohan on 20/9/15.
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2012 Google Inc.
|
* Copyright 2012 Google Inc.
|
||||||
*
|
*
|
||||||
|
@ -19,14 +14,18 @@ package org.sufficientlysecure.keychain.ui.util;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package org.sufficientlysecure.keychain.ui.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class ContentDescriptionHint {
|
public class ContentDescriptionHint {
|
||||||
private static final int ESTIMATED_TOAST_HEIGHT_DIPS = 48;
|
private static final int ESTIMATED_TOAST_HEIGHT_DIPS = 48;
|
||||||
|
|
||||||
public static void setup(View view) {
|
public static void setup(View view) {
|
||||||
view.setOnLongClickListener(new View.OnLongClickListener() {
|
view.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -144,14 +144,14 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="right|end">
|
android:gravity="left|start">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_view"
|
android:id="@+id/button_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/linked_button_view"
|
android:text="@string/linked_button_view"
|
||||||
android:textColor="@color/link_text_material_light"
|
android:textColor="@color/card_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -166,21 +166,21 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/linked_button_verify"
|
android:text="@string/linked_button_verify"
|
||||||
android:textColor="@color/link_text_material_light"
|
android:textColor="@color/card_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle" />
|
style="?android:attr/borderlessButtonStyle" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_retry"
|
android:id="@+id/button_retry"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/linked_button_retry"
|
android:text="@string/linked_button_retry"
|
||||||
android:textColor="@color/link_text_material_light"
|
android:textColor="@color/card_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle" />
|
style="?android:attr/borderlessButtonStyle" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_confirm"
|
android:id="@+id/button_confirm"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/linked_button_confirm"
|
android:text="@string/linked_button_confirm"
|
||||||
android:textColor="@color/link_text_material_light"
|
android:textColor="@color/card_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle" />
|
style="?android:attr/borderlessButtonStyle" />
|
||||||
</ViewAnimator>
|
</ViewAnimator>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
|
@ -11,16 +11,16 @@
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/card_linked_ids"
|
android:id="@+id/card_linked_ids"
|
||||||
android:transitionName="card_linked_ids"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:transitionName="card_linked_ids"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
|
||||||
card_view:cardBackgroundColor="?attr/colorCardViewBackground"
|
card_view:cardBackgroundColor="?attr/colorCardViewBackground"
|
||||||
|
card_view:cardCornerRadius="4dp"
|
||||||
card_view:cardElevation="2dp"
|
card_view:cardElevation="2dp"
|
||||||
card_view:cardUseCompatPadding="true"
|
card_view:cardUseCompatPadding="true"
|
||||||
card_view:cardCornerRadius="4dp">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -43,28 +43,27 @@
|
||||||
android:id="@+id/view_key_linked_ids_expander"
|
android:id="@+id/view_key_linked_ids_expander"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:gravity="center_vertical"
|
android:layout_marginTop="4dp"
|
||||||
android:drawableTop="@drawable/divider"
|
android:background="?android:selectableItemBackground"
|
||||||
android:drawableRight="@drawable/ic_expand_more_black_24dp"
|
android:clickable="true"
|
||||||
android:drawableEnd="@drawable/ic_expand_more_black_24dp"
|
android:drawableEnd="@drawable/ic_expand_more_black_24dp"
|
||||||
android:drawablePadding="3dp"
|
android:drawablePadding="3dp"
|
||||||
android:clickable="true"
|
android:drawableRight="@drawable/ic_expand_more_black_24dp"
|
||||||
android:text="@string/linked_ids_more_unknown"
|
android:drawableTop="@drawable/divider"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:background="?android:selectableItemBackground"
|
android:text="@string/linked_ids_more_unknown"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible" />
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/card_view"
|
android:id="@+id/view_key_card_user_ids"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
@ -78,17 +77,46 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
style="@style/CardViewHeader"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/section_user_ids" />
|
|
||||||
|
|
||||||
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
|
||||||
android:id="@+id/view_key_user_ids"
|
|
||||||
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:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/CardViewHeader"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/section_user_ids" />
|
||||||
|
|
||||||
|
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
||||||
|
android:id="@+id/view_key_user_ids"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="4dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/view_key_card_user_ids_buttons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="left|start"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dip"
|
||||||
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/view_key_card_user_ids_edit"
|
||||||
|
style="?android:attr/borderlessButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/key_view_action_edit"
|
||||||
|
android:textColor="@color/card_view_button" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="right|end"
|
android:layout_gravity="right|end"
|
||||||
android:text="@string/button_bind_key"
|
android:text="@string/button_bind_key"
|
||||||
android:textColor="@color/link_text_material_light"
|
android:textColor="@color/card_view_button"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -34,6 +34,6 @@
|
||||||
<color name="translucent_scrim_bottom_center">#2A000000</color>
|
<color name="translucent_scrim_bottom_center">#2A000000</color>
|
||||||
|
|
||||||
<!-- linked ID view -->
|
<!-- linked ID view -->
|
||||||
<color name="link_text_material_light">#ff009688</color>
|
<color name="card_view_button">#7bad45</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue