aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-08-29 13:28:56 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-08-29 13:28:56 +0200
commita6e25e6448ab162b351288ee0c241512e05c3611 (patch)
treed7eec4fcd2d98bc9d00e880ab3c103c86a8edbe2 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java
parent765ec094c9415fcaddd65b7b743179b2ea7dc098 (diff)
parent5b75b542e8d2d467ce9e34bd9df2038d6c88885e (diff)
downloadopen-keychain-a6e25e6448ab162b351288ee0c241512e05c3611.tar.gz
open-keychain-a6e25e6448ab162b351288ee0c241512e05c3611.tar.bz2
open-keychain-a6e25e6448ab162b351288ee0c241512e05c3611.zip
Merge branch 'linked-identities' (and fix OperationHelper ids)
Merge Linked Identities. Also includes an important fix for OperationHelper ids, which had an error in the bit mask logic. Conflicts: Graphics/update-drawables.sh OpenKeychain/build.gradle OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/CertifyActionsParcel.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateYubiKeyImportFragment.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/CertifyKeySpinner.java OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeySpinner.java OpenKeychain/src/main/res/anim/fade_in.xml OpenKeychain/src/main/res/anim/fade_out.xml OpenKeychain/src/main/res/layout/decrypt_text_fragment.xml OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml OpenKeychain/src/main/res/layout/view_key_fragment.xml OpenKeychain/src/main/res/menu/key_view.xml OpenKeychain/src/main/res/values/strings.xml OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java README.md
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java125
1 files changed, 125 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java
new file mode 100644
index 000000000..b166b3e4f
--- /dev/null
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/linked/LinkedIdCreateGithubStep1Fragment.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.sufficientlysecure.keychain.ui.linked;
+
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.EditText;
+
+import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.ui.util.Notify;
+
+
+public class LinkedIdCreateGithubStep1Fragment extends Fragment {
+
+ LinkedIdWizard mLinkedIdWizard;
+
+ EditText mEditHandle;
+
+ public static LinkedIdCreateGithubStep1Fragment newInstance() {
+ LinkedIdCreateGithubStep1Fragment frag = new LinkedIdCreateGithubStep1Fragment();
+
+ Bundle args = new Bundle();
+ frag.setArguments(args);
+
+ return frag;
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ mLinkedIdWizard = (LinkedIdWizard) getActivity();
+
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ final View view = inflater.inflate(R.layout.linked_create_github_fragment_step1, container, false);
+
+ view.findViewById(R.id.next_button).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ final String handle = mEditHandle.getText().toString();
+
+ new AsyncTask<Void,Void,Boolean>() {
+
+ @Override
+ protected Boolean doInBackground(Void... params) {
+ return true; // return checkHandle(handle);
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ super.onPostExecute(result);
+
+ if (result == null) {
+ Notify.create(getActivity(),
+ "Connection error while checking username!", Notify.Style.ERROR).show();
+ return;
+ }
+
+ if (!result) {
+ Notify.create(getActivity(),
+ "This handle does not exist on Github!", Notify.Style.ERROR).show();
+ return;
+ }
+
+ LinkedIdCreateGithubStep2Fragment frag =
+ LinkedIdCreateGithubStep2Fragment.newInstance(handle);
+
+ mLinkedIdWizard.loadFragment(null, frag, LinkedIdWizard.FRAG_ACTION_TO_RIGHT);
+ }
+ }.execute();
+
+ }
+ });
+
+ view.findViewById(R.id.back_button).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mLinkedIdWizard.loadFragment(null, null, LinkedIdWizard.FRAG_ACTION_TO_LEFT);
+ }
+ });
+
+ mEditHandle = (EditText) view.findViewById(R.id.linked_create_github_handle);
+
+ return view;
+ }
+
+ /* not used at this point, too much hassle
+ private static Boolean checkHandle(String handle) {
+ try {
+ HttpURLConnection nection =
+ (HttpURLConnection) new URL("https://api.github.com/" + handle).openConnection();
+ nection.setRequestMethod("HEAD");
+ return nection.getResponseCode() == 200;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ */
+
+}