From d6d678dae3ed5d794a9aa5e289197d264f6a7ff9 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 25 Apr 2015 03:40:38 +0200 Subject: update uris and cookie patterns, plus some stylings --- .../ui/linked/LinkedIdCreateTwitterStep1Fragment.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep1Fragment.java') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep1Fragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep1Fragment.java index d7c7a6f2e..0d6d36ca4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep1Fragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateTwitterStep1Fragment.java @@ -66,11 +66,17 @@ public class LinkedIdCreateTwitterStep1Fragment extends Fragment { final String handle = mEditHandle.getText().toString(); + if ("".equals(handle)) { + mEditHandle.setError("Please input a Twitter handle!"); + return; + } + new AsyncTask() { @Override protected Boolean doInBackground(Void... params) { - return true; // return checkHandle(handle); + return true; + // return checkHandle(handle); } @Override @@ -79,13 +85,15 @@ public class LinkedIdCreateTwitterStep1Fragment extends Fragment { if (result == null) { Notify.create(getActivity(), - "Connection error while checking username!", Notify.Style.ERROR); + "Connection error while checking username!", + Notify.Style.ERROR).show(LinkedIdCreateTwitterStep1Fragment.this); return; } if (!result) { Notify.create(getActivity(), - "This handle does not exist on Twitter!", Notify.Style.ERROR); + "This handle does not exist on Twitter!", + Notify.Style.ERROR).show(LinkedIdCreateTwitterStep1Fragment.this); return; } @@ -107,7 +115,6 @@ public class LinkedIdCreateTwitterStep1Fragment extends Fragment { }); mEditHandle = (EditText) view.findViewById(R.id.linked_create_twitter_handle); - mEditHandle.setText(""); return view; } @@ -117,9 +124,9 @@ public class LinkedIdCreateTwitterStep1Fragment extends Fragment { HttpURLConnection nection = (HttpURLConnection) new URL("https://twitter.com/" + handle).openConnection(); nection.setRequestMethod("HEAD"); + nection.setRequestProperty("User-Agent", "OpenKeychain"); return nection.getResponseCode() == 200; } catch (IOException e) { - e.printStackTrace(); return null; } } -- cgit v1.2.3