linked id ui work dns/twitter

This commit is contained in:
Vincent Breitmoser 2015-01-16 15:59:26 +01:00
parent b6a1463161
commit 6c153b1543
5 changed files with 19 additions and 14 deletions

View File

@ -52,6 +52,10 @@ public abstract class LinkedResource {
}
public static String generatePreview () {
return "[Verifying my PGP key: pgpid+cookie:0x…]";
}
public LinkedVerifyResult verify(byte[] fingerprint, String nonce) {
OperationLog log = new OperationLog();

View File

@ -65,7 +65,7 @@ public class LinkedIdCreateDnsStep2Fragment extends Fragment {
LinkedIdWizard mLinkedIdWizard;
EditText mEditUri;
TextView mTextView;
ImageView mVerifyImage;
View mVerifyProgress;
TextView mVerifyStatus;
@ -140,8 +140,8 @@ public class LinkedIdCreateDnsStep2Fragment extends Fragment {
}
});
mEditUri = (EditText) view.findViewById(R.id.linked_create_dns_text);
mEditUri.setText(mResourceString);
mTextView = (TextView) view.findViewById(R.id.linked_create_dns_text);
mTextView.setText(mResourceString);
setVerifyProgress(false, null);
mVerifyStatus.setText(R.string.linked_verify_pending);

View File

@ -31,11 +31,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.linked.resources.TwitterResource;
public class LinkedIdCreateTwitterStep2Fragment extends Fragment {
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
public static final String HANDLE = "uri", NONCE = "nonce", TEXT = "text";
LinkedIdWizard mLinkedIdWizard;
@ -47,6 +46,7 @@ public class LinkedIdCreateTwitterStep2Fragment extends Fragment {
String mResourceHandle;
String mResourceNonce, mResourceString;
String mCookiePreview;
/**
* Creates new instance of this fragment
@ -69,6 +69,8 @@ public class LinkedIdCreateTwitterStep2Fragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.linked_create_twitter_fragment_step2, container, false);
mCookiePreview = TwitterResource.generatePreview();
mResourceHandle = getArguments().getString(HANDLE);
mResourceNonce = getArguments().getString(NONCE);
mResourceString = getArguments().getString(TEXT);
@ -98,7 +100,7 @@ public class LinkedIdCreateTwitterStep2Fragment extends Fragment {
mVerifyStatus = (TextView) view.findViewById(R.id.verify_status);
mEditTweetPreview = (EditText) view.findViewById(R.id.linked_create_twitter_preview);
mEditTweetPreview.setText(mResourceString);
mEditTweetPreview.setText(mCookiePreview);
mEditTweetCustom = (EditText) view.findViewById(R.id.linked_create_twitter_custom);
mEditTweetCustom.setFilters(new InputFilter[] {
@ -120,17 +122,18 @@ public class LinkedIdCreateTwitterStep2Fragment extends Fragment {
@Override
public void afterTextChanged(Editable editable) {
if (editable != null && editable.length() > 0) {
String str = editable + " " + mResourceString;
String str = editable + " " + mCookiePreview;
mEditTweetPreview.setText(str);
mEditTweetTextLen.setText(str.length() + "/140");
mEditTweetTextLen.setText(
(editable.length() + mResourceString.length() + 1) + "/140");
mEditTweetTextLen.setTextColor(getResources().getColor(str.length() == 140
? R.color.android_red_dark
: R.color.primary_dark_material_light));
} else {
mEditTweetPreview.setText(mResourceString);
mEditTweetPreview.setText(mCookiePreview);
mEditTweetTextLen.setText(mResourceString.length() + "/140");
}
}

View File

@ -23,15 +23,13 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/linked_create_dns_2_1" />
<EditText
<TextView
android:id="@+id/linked_create_dns_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:layout_marginTop="8dp"
android:layout_gravity="center_horizontal"
android:inputType="textUri|none"
android:enabled="false"/>
android:textIsSelectable="true" />
<TextView
android:layout_width="wrap_content"

View File

@ -1166,7 +1166,7 @@
<string name="linked_create_twitter_1_2">"A message will be generated in the next step, which you can then customize and finally publish to your timeline."</string>
<string name="linked_create_twitter_1_3">"This tweet links back to your pgp key, to make the connection verifiable in both directions."</string>
<string name="linked_create_twitter_handle">Twitter Handle</string>
<string name="linked_create_twitter_2_1">"A message for this Twitter account has been created. You can add some text in front if you like."</string>
<string name="linked_create_twitter_2_1">"A message for this Twitter account has been created. You can add some text in front if you like, or leave it as-is."</string>
<string name="linked_create_twitter_2_2">"Here's a preview of the full tweet:"</string>
<string name="linked_create_twitter_2_3">"Once you are happy with the tweet, click next to proceed."</string>
<string name="linked_create_twitter_3_1">"Alright, here's the finished text:"</string>