work on second step of identity creation
This commit is contained in:
@@ -30,6 +30,7 @@ import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||
import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource;
|
||||
import org.sufficientlysecure.keychain.pgp.linked.resources.DnsResource;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
@@ -92,7 +93,7 @@ public class LinkedIdCreateDnsStep2Fragment extends LinkedIdCreateFinalFragment
|
||||
view.findViewById(R.id.button_save).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
proofSave();
|
||||
proofToClipboard();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,22 +116,9 @@ public class LinkedIdCreateDnsStep2Fragment extends LinkedIdCreateFinalFragment
|
||||
startActivity(sendIntent);
|
||||
}
|
||||
|
||||
private void proofSave () {
|
||||
String state = Environment.getExternalStorageState();
|
||||
if (!Environment.MEDIA_MOUNTED.equals(state)) {
|
||||
Notify.showNotify(getActivity(), "External storage not available!", Style.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
String targetName = "pgpkey.txt";
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
File targetFile = new File(Constants.Path.APP_DIR, targetName);
|
||||
FileHelper.saveFile(this, getString(R.string.title_decrypt_to_file),
|
||||
getString(R.string.specify_file_to_decrypt_to), targetFile, REQUEST_CODE_OUTPUT);
|
||||
} else {
|
||||
FileHelper.saveDocument(this, "text/plain", targetName, REQUEST_CODE_OUTPUT);
|
||||
}
|
||||
private void proofToClipboard() {
|
||||
ClipboardReflection.copyToClipboard(getActivity(), mResourceString);
|
||||
Notify.showNotify(getActivity(), R.string.linked_text_clipboard, Notify.Style.OK);
|
||||
}
|
||||
|
||||
private void saveFile(Uri uri) {
|
||||
|
||||
@@ -41,6 +41,7 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
|
||||
|
||||
// This is a resource, set AFTER it has been verified
|
||||
LinkedCookieResource mVerifiedResource = null;
|
||||
private ViewAnimator mVerifyButtonAnimator;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -69,9 +70,10 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
mVerifyImage = (ImageView) view.findViewById(R.id.verify_image);
|
||||
mVerifyAnimator = (ViewAnimator) view.findViewById(R.id.verify_progress);
|
||||
mVerifyImage = (ImageView) view.findViewById(R.id.verify_image);
|
||||
mVerifyStatus = (TextView) view.findViewById(R.id.verify_status);
|
||||
mVerifyButtonAnimator = (ViewAnimator) view.findViewById(R.id.verify_buttons);
|
||||
|
||||
view.findViewById(R.id.button_verify).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -80,6 +82,13 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
view.findViewById(R.id.button_retry).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
proofVerify();
|
||||
}
|
||||
});
|
||||
|
||||
setVerifyProgress(false, null);
|
||||
mVerifyStatus.setText(R.string.linked_verify_pending);
|
||||
|
||||
@@ -91,20 +100,30 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
|
||||
private void setVerifyProgress(boolean on, Boolean success) {
|
||||
if (success == null) {
|
||||
mVerifyStatus.setText(R.string.linked_verifying);
|
||||
displayButton(on ? 2 : 0);
|
||||
} else if (success) {
|
||||
mVerifyStatus.setText(R.string.linked_verify_success);
|
||||
mVerifyImage.setImageResource(R.drawable.status_signature_verified_cutout_24dp);
|
||||
mVerifyImage.setColorFilter(getResources().getColor(R.color.android_green_dark),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
displayButton(2);
|
||||
} else {
|
||||
mVerifyStatus.setText(R.string.linked_verify_error);
|
||||
mVerifyImage.setImageResource(R.drawable.status_signature_unknown_cutout_24dp);
|
||||
mVerifyImage.setColorFilter(getResources().getColor(R.color.android_red_dark),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
displayButton(1);
|
||||
}
|
||||
mVerifyAnimator.setDisplayedChild(on ? 1 : 0);
|
||||
}
|
||||
|
||||
public void displayButton(int button) {
|
||||
if (mVerifyButtonAnimator.getDisplayedChild() == button) {
|
||||
return;
|
||||
}
|
||||
mVerifyButtonAnimator.setDisplayedChild(button);
|
||||
}
|
||||
|
||||
protected void proofVerify() {
|
||||
setVerifyProgress(true, null);
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
|
||||
|
||||
public static final String ARG_HANDLE = "handle";
|
||||
|
||||
EditText mEditTweetPreview;
|
||||
|
||||
String mResourceHandle;
|
||||
String mResourceString;
|
||||
|
||||
@@ -66,9 +64,6 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
mEditTweetPreview = (EditText) view.findViewById(R.id.linked_create_twitter_preview);
|
||||
mEditTweetPreview.setText(mResourceString);
|
||||
|
||||
view.findViewById(R.id.button_send).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Reference in New Issue
Block a user