use key_list_item layout for RequestKeyPermissionActivity
This commit is contained in:
parent
aa9132b4c6
commit
a48efc6835
|
@ -38,8 +38,10 @@ import android.widget.TextView;
|
|||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils.UserId;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
import org.sufficientlysecure.keychain.remote.ui.RequestKeyPermissionPresenter.RequestKeyPermissionMvpView;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyInfoFormatter;
|
||||
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
|
||||
|
||||
|
||||
|
@ -131,29 +133,29 @@ public class RequestKeyPermissionActivity extends FragmentActivity {
|
|||
@NonNull
|
||||
private RequestKeyPermissionMvpView createMvpView(View view) {
|
||||
final TextView titleText = view.findViewById(R.id.select_identity_key_title);
|
||||
final TextView keyUserIdView = view.findViewById(R.id.select_key_item_name);
|
||||
final TextView keyNameView = view.findViewById(R.id.key_list_item_name);
|
||||
final TextView keyEmailView = view.findViewById(R.id.key_list_item_email);
|
||||
final TextView keyCreationDateView = view.findViewById(R.id.key_list_item_creation);
|
||||
final ImageView iconClientApp = view.findViewById(R.id.icon_client_app);
|
||||
final View keyUnavailableWarning = view.findViewById(R.id.requested_key_unavailable_warning);
|
||||
final View keyInfoLayout = view.findViewById(R.id.key_info_layout);
|
||||
|
||||
return new RequestKeyPermissionMvpView() {
|
||||
@Override
|
||||
public void switchToLayoutRequestKeyChoice() {
|
||||
keyInfoLayout.setVisibility(View.VISIBLE);
|
||||
keyUnavailableWarning.setVisibility(View.GONE);
|
||||
buttonAllow.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToLayoutNoSecret() {
|
||||
keyInfoLayout.setVisibility(View.VISIBLE);
|
||||
keyUnavailableWarning.setVisibility(View.VISIBLE);
|
||||
buttonAllow.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayKeyInfo(String userIdName) {
|
||||
keyUserIdView.setText(userIdName);
|
||||
public void displayKeyInfo(KeyInfoFormatter keyInfoFormatter) {
|
||||
keyInfoFormatter.formatUserId(keyNameView, keyEmailView);
|
||||
keyInfoFormatter.formatCreationDate(keyCreationDateView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.sufficientlysecure.keychain.daos.KeyRepository;
|
|||
import org.sufficientlysecure.keychain.daos.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper;
|
||||
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper.WrongPackageCertificateException;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyInfoFormatter;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
|
@ -100,7 +101,9 @@ class RequestKeyPermissionPresenter {
|
|||
}
|
||||
|
||||
masterKeyId = secretKeyRingOrPublicFallback.master_key_id();
|
||||
view.displayKeyInfo(secretKeyRingOrPublicFallback.name());
|
||||
KeyInfoFormatter keyInfoFormatter = new KeyInfoFormatter(context);
|
||||
keyInfoFormatter.setKeyInfo(secretKeyRingOrPublicFallback);
|
||||
view.displayKeyInfo(keyInfoFormatter);
|
||||
|
||||
if (secretKeyRingOrPublicFallback.has_any_secret()) {
|
||||
view.switchToLayoutRequestKeyChoice();
|
||||
|
@ -177,7 +180,7 @@ class RequestKeyPermissionPresenter {
|
|||
void setTitleText(String text);
|
||||
void setTitleClientIcon(Drawable drawable);
|
||||
|
||||
void displayKeyInfo(String userIdName);
|
||||
void displayKeyInfo(KeyInfoFormatter keyInfoFormatter);
|
||||
|
||||
void finish();
|
||||
void finishAsCancelled();
|
||||
|
|
|
@ -80,44 +80,14 @@
|
|||
tools:text="@string/request_permission_msg"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="?selectableItemBackground"
|
||||
android:id="@+id/key_info_layout"
|
||||
>
|
||||
android:text="@string/requested_key_label"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:src="@drawable/ic_vpn_key_grey_24dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/requested_key_label"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/select_key_item_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Alice Skywalker"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/key_list_item" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:background="@drawable/list_item_ripple"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
tools:layout_marginTop="30dp">
|
||||
android:paddingRight="12dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
|
@ -67,6 +66,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="16dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:src="@drawable/status_signature_revoked_cutout_24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
Loading…
Reference in a new issue