work on certification ui
This commit is contained in:
@@ -15,6 +15,8 @@ import java.util.regex.Pattern;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
|
||||
public abstract class LinkedResource {
|
||||
|
||||
@@ -102,6 +104,7 @@ public abstract class LinkedResource {
|
||||
}
|
||||
|
||||
public abstract @DrawableRes int getDisplayIcon();
|
||||
public abstract @StringRes int getVerifiedText();
|
||||
public abstract String getDisplayTitle(Context context);
|
||||
public abstract String getDisplayComment(Context context);
|
||||
public boolean isViewable() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.sufficientlysecure.keychain.pgp.linked.resources;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult.OperationLog;
|
||||
@@ -103,6 +104,12 @@ public class DnsResource extends LinkedCookieResource {
|
||||
return magicPattern.matcher(res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @StringRes
|
||||
int getVerifiedText() {
|
||||
return R.string.linked_verified_dns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @DrawableRes int getDisplayIcon() {
|
||||
return R.drawable.dns;
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import com.textuality.keybase.lib.Search;
|
||||
|
||||
@@ -81,6 +82,8 @@ public class GenericHttpsResource extends LinkedCookieResource {
|
||||
log.add(LogType.MSG_LV_FETCH_ERROR_URL, indent);
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "io error", e);
|
||||
e.printStackTrace();
|
||||
log.add(LogType.MSG_LV_FETCH_ERROR_IO, indent);
|
||||
return null;
|
||||
}
|
||||
@@ -109,6 +112,12 @@ public class GenericHttpsResource extends LinkedCookieResource {
|
||||
return R.drawable.ssl_lock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @StringRes
|
||||
int getVerifiedText() {
|
||||
return R.string.linked_verified_https;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayTitle(Context context) {
|
||||
return "Website (HTTPS)";
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.util.Log;
|
||||
|
||||
import com.textuality.keybase.lib.JWalk;
|
||||
@@ -118,6 +119,12 @@ public class TwitterResource extends LinkedCookieResource {
|
||||
return R.drawable.twitter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @StringRes
|
||||
int getVerifiedText() {
|
||||
return R.string.linked_verified_twitter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayTitle(Context context) {
|
||||
return "Twitter";
|
||||
|
||||
@@ -201,7 +201,7 @@ public class LinkedIdsAdapter extends UserAttributesAdapter {
|
||||
final public TextView vComment;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
vVerified = (ImageView) view.findViewById(R.id.user_id_item_certified);
|
||||
vVerified = (ImageView) view.findViewById(R.id.linked_id_certified_icon);
|
||||
vIcon = (ImageView) view.findViewById(R.id.linked_id_type_icon);
|
||||
vTitle = (TextView) view.findViewById(R.id.linked_id_title);
|
||||
vComment = (TextView) view.findViewById(R.id.linked_id_comment);
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@@ -23,6 +24,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
@@ -240,6 +242,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
static class ViewHolder {
|
||||
private final View vButtonView;
|
||||
private final ViewAnimator vVerifyingContainer;
|
||||
private final ViewAnimator vItemCertified;
|
||||
LinkedIdsAdapter.ViewHolder mLinkedIdHolder;
|
||||
|
||||
private ViewAnimator vButtonSwitcher;
|
||||
@@ -267,6 +270,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
vButtonView = root.findViewById(R.id.button_view);
|
||||
|
||||
vVerifyingContainer = (ViewAnimator) root.findViewById(R.id.linked_verify_container);
|
||||
vItemCertified = (ViewAnimator) root.findViewById(R.id.linked_id_certified);
|
||||
|
||||
vProgress = (ViewAnimator) root.findViewById(R.id.linked_cert_progress);
|
||||
vText = (TextView) root.findViewById(R.id.linked_cert_text);
|
||||
@@ -285,7 +289,6 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
break;
|
||||
|
||||
case VERIFY_OK:
|
||||
vText.setText("Ok");
|
||||
vProgress.setDisplayedChild(1);
|
||||
if (!isSecret) {
|
||||
showButton(2);
|
||||
@@ -315,7 +318,9 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
if (vVerifyingContainer.getDisplayedChild() == (show ? 1 : 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vVerifyingContainer.setDisplayedChild(show ? 1 : 0);
|
||||
vItemCertified.setDisplayedChild(show ? 1 : 0);
|
||||
}
|
||||
|
||||
void showButton(int which) {
|
||||
@@ -386,6 +391,15 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
mViewHolder = new ViewHolder(root);
|
||||
root.setTag(mViewHolder);
|
||||
|
||||
((ImageView) root.findViewById(R.id.status_icon_verified))
|
||||
.setColorFilter(mContext.getResources().getColor(R.color.android_green_light),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
((ImageView) root.findViewById(R.id.status_icon_invalid))
|
||||
.setColorFilter(mContext.getResources().getColor(R.color.android_red_light),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
|
||||
|
||||
|
||||
mViewHolder.vButtonBack.setClickable(true);
|
||||
mViewHolder.vButtonBack.findViewById(R.id.back_button).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -459,9 +473,11 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
return;
|
||||
}
|
||||
if (result.success()) {
|
||||
mViewHolder.vText.setText(mLinkedResource.getVerifiedText());
|
||||
mViewHolder.setVerifyingState(VerifyState.VERIFY_OK, mIsSecret);
|
||||
} else {
|
||||
mViewHolder.setVerifyingState(VerifyState.VERIFY_ERROR, mIsSecret);
|
||||
result.createNotify(getActivity()).show();
|
||||
}
|
||||
mInProgress = null;
|
||||
}
|
||||
@@ -524,7 +540,7 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
return;
|
||||
}
|
||||
|
||||
mViewHolder.setVerifyingState(VerifyState.CERTIFYING, mIsSecret);
|
||||
mViewHolder.setVerifyingState(VerifyState.CERTIFYING, false);
|
||||
|
||||
Bundle data = new Bundle();
|
||||
{
|
||||
@@ -557,19 +573,11 @@ public class LinkedIdViewFragment extends Fragment implements
|
||||
|
||||
Bundle data = message.getData();
|
||||
|
||||
if (message.arg1 == MessageStatus.UPDATE_PROGRESS.ordinal()) {
|
||||
if (data.containsKey(DATA_MESSAGE)) {
|
||||
mViewHolder.vText.setText(data.getString(DATA_MESSAGE));
|
||||
} else if (data.containsKey(DATA_MESSAGE_ID)) {
|
||||
mViewHolder.vText.setText(data.getString(DATA_MESSAGE_ID));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.arg1 == MessageStatus.OKAY.ordinal()) {
|
||||
CertifyResult result = data.getParcelable(CertifyResult.EXTRA_RESULT);
|
||||
result.createNotify(getActivity()).show();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user