aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-06-19 00:54:52 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-06-19 00:54:52 +0200
commit47edcacf6135184d687e0f3c106a696fbee88938 (patch)
tree533dcb4b665aca009e5c6e7f8cdffbb961c2aad6 /OpenKeychain
parentf0487b0ca7106367b69e3b38a67f9accf07d8f51 (diff)
downloadopen-keychain-47edcacf6135184d687e0f3c106a696fbee88938.tar.gz
open-keychain-47edcacf6135184d687e0f3c106a696fbee88938.tar.bz2
open-keychain-47edcacf6135184d687e0f3c106a696fbee88938.zip
Remove unused code to import splitted qr codes
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java78
-rw-r--r--OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml19
2 files changed, 1 insertions, 96 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java
index b7ffef0ed..5766fc189 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java
@@ -25,8 +25,6 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ProgressBar;
-import android.widget.TextView;
import com.google.zxing.integration.android.IntentResult;
@@ -36,18 +34,13 @@ import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Notify;
-import java.util.ArrayList;
import java.util.Locale;
public class ImportKeysQrCodeFragment extends Fragment {
private ImportKeysActivity mImportActivity;
- private View mNfcButton;
+ private View mNfcButton;
private View mQrCodeButton;
- private TextView mQrCodeText;
- private ProgressBar mQrCodeProgress;
-
- private String[] mQrCodeContent;
/**
* Creates new instance of this fragment
@@ -81,8 +74,6 @@ public class ImportKeysQrCodeFragment extends Fragment {
});
mQrCodeButton = view.findViewById(R.id.import_qrcode_button);
- mQrCodeText = (TextView) view.findViewById(R.id.import_qrcode_text);
- mQrCodeProgress = (ProgressBar) view.findViewById(R.id.import_qrcode_progress);
mQrCodeButton.setOnClickListener(new View.OnClickListener() {
@@ -120,13 +111,6 @@ public class ImportKeysQrCodeFragment extends Fragment {
return;
}
- // look if it is the whole key
- String[] parts = scannedContent.split(",");
- if (parts.length == 3) {
- importParts(parts);
- return;
- }
-
// is this a full key encoded as qr code?
if (scannedContent.startsWith("-----BEGIN PGP")) {
mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(scannedContent.getBytes(), null));
@@ -147,68 +131,8 @@ public class ImportKeysQrCodeFragment extends Fragment {
}
}
-
public void importFingerprint(Uri dataUri) {
mImportActivity.loadFromFingerprintUri(null, dataUri);
}
- private void importParts(String[] parts) {
- int counter = Integer.valueOf(parts[0]);
- int size = Integer.valueOf(parts[1]);
- String content = parts[2];
-
- Log.d(Constants.TAG, "" + counter);
- Log.d(Constants.TAG, "" + size);
- Log.d(Constants.TAG, "" + content);
-
- // first qr code -> setup
- if (counter == 0) {
- mQrCodeContent = new String[size];
- mQrCodeProgress.setMax(size);
- mQrCodeProgress.setVisibility(View.VISIBLE);
- mQrCodeText.setVisibility(View.VISIBLE);
- }
-
- if (mQrCodeContent == null || counter > mQrCodeContent.length) {
- Notify.showNotify(getActivity(), R.string.import_qr_code_start_with_one, Notify.Style.ERROR);
- return;
- }
-
- // save scanned content
- mQrCodeContent[counter] = content;
-
- // get missing numbers
- ArrayList<Integer> missing = new ArrayList<Integer>();
- for (int i = 0; i < mQrCodeContent.length; i++) {
- if (mQrCodeContent[i] == null) {
- missing.add(i);
- }
- }
-
- // update progress and text
- int alreadyScanned = mQrCodeContent.length - missing.size();
- mQrCodeProgress.setProgress(alreadyScanned);
-
- String missingString = "";
- for (int m : missing) {
- if (!missingString.equals("")) {
- missingString += ", ";
- }
- missingString += String.valueOf(m + 1);
- }
-
- String missingText = getResources().getQuantityString(R.plurals.import_qr_code_missing,
- missing.size(), missingString);
- mQrCodeText.setText(missingText);
-
- // finished!
- if (missing.size() == 0) {
- mQrCodeText.setText(R.string.import_qr_code_finished);
- String result = "";
- for (String in : mQrCodeContent) {
- result += in;
- }
- mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(result.getBytes(), null));
- }
- }
}
diff --git a/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml b/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml
index 3f131b9ce..1cc414dab 100644
--- a/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml
@@ -44,23 +44,4 @@
</LinearLayout>
- <TextView
- android:id="@+id/import_qrcode_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- android:paddingTop="8dp"
- android:visibility="gone" />
-
- <ProgressBar
- android:id="@+id/import_qrcode_progress"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- android:progress="0"
- android:visibility="gone" />
-
</LinearLayout> \ No newline at end of file