diff options
Diffstat (limited to 'OpenKeychain/src')
6 files changed, 255 insertions, 169 deletions
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/TestHelpers.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/TestHelpers.java index 958c589cb..c651d3a8c 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/TestHelpers.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/TestHelpers.java @@ -91,6 +91,10 @@ public class TestHelpers { } + public static void checkAndDismissSnackbar(Style style, @StringRes Integer text) { + checkSnackbar(style, text); + dismissSnackbar(); + } public static void importKeysFromResource(Context context, String name) throws Exception { IteratorWithIOThrow<UncachedKeyRing> stream = UncachedKeyRing.fromStream( diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareTest.java new file mode 100644 index 000000000..1e6a3f69e --- /dev/null +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2015 Vincent Breitmoser <look@my.amazin.horse> + * + * 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; + + +import android.app.Activity; +import android.app.Instrumentation.ActivityResult; +import android.content.Intent; +import android.support.test.espresso.intent.rule.IntentsTestRule; +import android.support.test.runner.AndroidJUnit4; +import android.test.suitebuilder.annotation.LargeTest; + +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; +import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; +import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider; +import org.sufficientlysecure.keychain.ui.util.Notify.Style; + +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.intent.Intents.intending; +import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction; +import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra; +import static android.support.test.espresso.intent.matcher.IntentMatchers.hasType; +import static android.support.test.espresso.intent.matcher.UriMatchers.hasHost; +import static android.support.test.espresso.intent.matcher.UriMatchers.hasScheme; +import static android.support.test.espresso.matcher.ViewMatchers.assertThat; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.sufficientlysecure.keychain.TestHelpers.checkAndDismissSnackbar; +import static org.sufficientlysecure.keychain.TestHelpers.cleanupForTests; + + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@RunWith(AndroidJUnit4.class) +@LargeTest +public class ViewKeyAdvShareTest { + + @Rule + public final IntentsTestRule<ViewKeyAdvActivity> mActivityRule + = new IntentsTestRule<ViewKeyAdvActivity>(ViewKeyAdvActivity.class) { + @Override + protected Intent getActivityIntent() { + Intent intent = super.getActivityIntent(); + intent.setData(KeyRings.buildGenericKeyRingUri(0x9D604D2F310716A3L)); + intent.putExtra(ViewKeyAdvActivity.EXTRA_SELECTED_TAB, ViewKeyAdvActivity.TAB_SHARE); + return intent; + } + }; + private Activity mActivity; + + @Before + public void setUp() throws Exception { + mActivity = mActivityRule.getActivity(); + + cleanupForTests(mActivity); + } + + @Test + public void testShareOperations() throws Exception { + + // no-op should yield snackbar + onView(withId(R.id.view_key_action_fingerprint_clipboard)).perform(click()); + checkAndDismissSnackbar(Style.OK, R.string.fingerprint_copied_to_clipboard); + assertThat("clipboard data is fingerprint", ClipboardReflection.getClipboardText(mActivity), + is("c619d53f7a5f96f391a84ca79d604d2f310716a3")); + + intending(allOf( + hasAction("android.intent.action.CHOOSER"), + hasExtra(equalTo(Intent.EXTRA_INTENT), allOf( + hasAction(Intent.ACTION_SEND), + hasType("text/plain"), + hasExtra(is(Intent.EXTRA_TEXT), is("openpgp4fpr:c619d53f7a5f96f391a84ca79d604d2f310716a3")), + hasExtra(is(Intent.EXTRA_STREAM), + allOf(hasScheme("content"), hasHost(TemporaryStorageProvider.CONTENT_AUTHORITY))) + )) + )).respondWith(new ActivityResult(Activity.RESULT_OK, null)); + onView(withId(R.id.view_key_action_fingerprint_share)).perform(click()); + + onView(withId(R.id.view_key_action_key_clipboard)).perform(click()); + checkAndDismissSnackbar(Style.OK, R.string.key_copied_to_clipboard); + assertThat("clipboard data is key", + ClipboardReflection.getClipboardText(mActivity), startsWith("----")); + + intending(allOf( + hasAction("android.intent.action.CHOOSER"), + hasExtra(equalTo(Intent.EXTRA_INTENT), allOf( + hasAction(Intent.ACTION_SEND), + hasType("text/plain"), + hasExtra(is(Intent.EXTRA_TEXT), startsWith("----")), + hasExtra(is(Intent.EXTRA_STREAM), + allOf(hasScheme("content"), hasHost(TemporaryStorageProvider.CONTENT_AUTHORITY))) + )) + )).respondWith(new ActivityResult(Activity.RESULT_OK, null)); + onView(withId(R.id.view_key_action_key_share)).perform(click()); + + } + + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java index 0ac27833c..403e654e4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java @@ -38,7 +38,7 @@ public class ClipboardReflection { } - public static CharSequence getClipboardText(Context context) { + public static String getClipboardText(Context context) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); @@ -48,6 +48,10 @@ public class ClipboardReflection { } ClipData.Item item = clip.getItemAt(0); - return item.coerceToText(context); + CharSequence seq = item.coerceToText(context); + if (seq != null) { + return seq.toString(); + } + return null; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java index 9e8a12c8a..6669f2654 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java @@ -53,13 +53,15 @@ public class ViewKeyAdvActivity extends BaseActivity implements protected Uri mDataUri; public static final String EXTRA_SELECTED_TAB = "selected_tab"; - public static final int TAB_MAIN = 0; - public static final int TAB_SHARE = 1; + public static final int TAB_SHARE = 0; + public static final int TAB_IDENTITIES = 1; + public static final int TAB_SUBKEYS = 2; + public static final int TAB_CERTS = 3; + public static final int TAB_KEYBASE = 4; // view private ViewPager mViewPager; private PagerSlidingTabStrip mSlidingTabLayout; - private PagerTabStripAdapter mTabsAdapter; private static final int LOADER_ID_UNIFIED = 0; @@ -80,11 +82,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements mViewPager = (ViewPager) findViewById(R.id.pager); mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tab_layout); - int switchToTab = TAB_MAIN; Intent intent = getIntent(); - if (intent.getExtras() != null && intent.getExtras().containsKey(EXTRA_SELECTED_TAB)) { - switchToTab = intent.getExtras().getInt(EXTRA_SELECTED_TAB); - } + int switchToTab = intent.getIntExtra(EXTRA_SELECTED_TAB, TAB_SHARE); mDataUri = getIntent().getData(); if (mDataUri == null) { @@ -102,8 +101,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements } } - Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString()); - // Prepare the loaders. Either re-connect with an existing ones, // or start new ones. getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this); @@ -120,32 +117,32 @@ public class ViewKeyAdvActivity extends BaseActivity implements } private void initTabs(Uri dataUri) { - mTabsAdapter = new PagerTabStripAdapter(this); - mViewPager.setAdapter(mTabsAdapter); + PagerTabStripAdapter adapter = new PagerTabStripAdapter(this); + mViewPager.setAdapter(adapter); Bundle shareBundle = new Bundle(); shareBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyAdvShareFragment.class, + adapter.addTab(ViewKeyAdvShareFragment.class, shareBundle, getString(R.string.key_view_tab_share)); Bundle userIdsBundle = new Bundle(); userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyAdvUserIdsFragment.class, + adapter.addTab(ViewKeyAdvUserIdsFragment.class, userIdsBundle, getString(R.string.section_user_ids)); Bundle keysBundle = new Bundle(); keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyAdvSubkeysFragment.class, + adapter.addTab(ViewKeyAdvSubkeysFragment.class, keysBundle, getString(R.string.key_view_tab_keys)); Bundle certsBundle = new Bundle(); certsBundle.putParcelable(ViewKeyAdvCertsFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyAdvCertsFragment.class, + adapter.addTab(ViewKeyAdvCertsFragment.class, certsBundle, getString(R.string.key_view_tab_certs)); Bundle trustBundle = new Bundle(); trustBundle.putParcelable(ViewKeyTrustFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ViewKeyTrustFragment.class, + adapter.addTab(ViewKeyTrustFragment.class, trustBundle, getString(R.string.key_view_tab_keybase)); // update layout after operations @@ -185,11 +182,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { - /* TODO better error handling? May cause problems when a key is deleted, - * because the notification triggers faster than the activity closes. - */ // Avoid NullPointerExceptions... - if (data.getCount() == 0) { + if (data == null || data.getCount() == 0) { return; } // Swap the new cursor in. (The framework will take care of closing the diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java index 42abf35eb..b44e6dc78 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java @@ -17,6 +17,13 @@ package org.sufficientlysecure.keychain.ui; + +import java.io.BufferedWriter; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStreamWriter; + +import android.app.Activity; import android.app.ActivityOptions; import android.content.Intent; import android.database.Cursor; @@ -43,12 +50,10 @@ 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.UncachedKeyRing; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; -import org.sufficientlysecure.keychain.provider.KeychainContract.Keys; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; @@ -57,57 +62,35 @@ import org.sufficientlysecure.keychain.ui.util.QrCodeUtils; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.NfcHelper; -import java.io.BufferedWriter; -import java.io.OutputStreamWriter; -import java.io.IOException; -import java.io.FileNotFoundException; - public class ViewKeyAdvShareFragment extends LoaderFragment implements LoaderManager.LoaderCallbacks<Cursor> { public static final String ARG_DATA_URI = "uri"; - private TextView mFingerprint; private ImageView mQrCode; private CardView mQrCodeLayout; - private View mFingerprintShareButton; - private View mFingerprintClipboardButton; - private View mKeyShareButton; - private View mKeyClipboardButton; - private View mKeyNfcButton; - private ImageButton mKeySafeSlingerButton; - private View mKeyUploadButton; - - ProviderHelper mProviderHelper; + private TextView mFingerprintView; + NfcHelper mNfcHelper; private static final int LOADER_ID_UNIFIED = 0; private Uri mDataUri; + private byte[] mFingerprint; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) { View root = super.onCreateView(inflater, superContainer, savedInstanceState); View view = inflater.inflate(R.layout.view_key_adv_share_fragment, getContainer()); - mProviderHelper = new ProviderHelper(ViewKeyAdvShareFragment.this.getActivity()); - mNfcHelper = new NfcHelper(getActivity(), mProviderHelper); + ProviderHelper providerHelper = new ProviderHelper(ViewKeyAdvShareFragment.this.getActivity()); + mNfcHelper = new NfcHelper(getActivity(), providerHelper); - mFingerprint = (TextView) view.findViewById(R.id.view_key_fingerprint); + mFingerprintView = (TextView) view.findViewById(R.id.view_key_fingerprint); mQrCode = (ImageView) view.findViewById(R.id.view_key_qr_code); mQrCodeLayout = (CardView) view.findViewById(R.id.view_key_qr_code_layout); - mFingerprintShareButton = view.findViewById(R.id.view_key_action_fingerprint_share); - mFingerprintClipboardButton = view.findViewById(R.id.view_key_action_fingerprint_clipboard); - mKeyShareButton = view.findViewById(R.id.view_key_action_key_share); - mKeyNfcButton = view.findViewById(R.id.view_key_action_key_nfc); - mKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard); - mKeySafeSlingerButton = (ImageButton) view.findViewById(R.id.view_key_action_key_safeslinger); - mKeyUploadButton = view.findViewById(R.id.view_key_action_upload); - - mKeySafeSlingerButton.setColorFilter(getResources().getColor(R.color.tertiary_text_light), - PorterDuff.Mode.SRC_IN); - mQrCodeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -115,50 +98,60 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements } }); - mFingerprintShareButton.setOnClickListener(new View.OnClickListener() { + View vFingerprintShareButton = view.findViewById(R.id.view_key_action_fingerprint_share); + View vFingerprintClipboardButton = view.findViewById(R.id.view_key_action_fingerprint_clipboard); + View vKeyShareButton = view.findViewById(R.id.view_key_act -- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
-- vim: tabstop=2:shiftwidth=2:noexpandtab
-- kate: tab-width 2; replace-tabs off; indent-width 2;
--
-- ============================================================================
-- Package: Common functions and types
--
-- Authors: Thomas B. Preusser
-- Martin Zabel
-- Patrick Lehmann
--
-- Description:
-- ------------------------------------
-- For detailed documentation see below.
--
-- License:
-- ============================================================================
-- Copyright 2007-2014 Technische Universitaet Dresden - Germany
-- Chair for VLSI-Design, Diagnostics and Architecture
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- ============================================================================
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library PoC;
use PoC.utils.all;
use PoC.strings.all;
package vectors is
-- ==========================================================================
-- Type declarations
-- ==========================================================================
-- STD_LOGIC_VECTORs
subtype T_SLV_2 is STD_LOGIC_VECTOR(1 downto 0);
subtype T_SLV_3 is STD_LOGIC_VECTOR(2 downto 0);
subtype T_SLV_4 is STD_LOGIC_VECTOR(3 downto 0);
subtype T_SLV_8 is STD_LOGIC_VECTOR(7 downto 0);
subtype T_SLV_12 is STD_LOGIC_VECTOR(11 downto 0);
subtype T_SLV_16 is STD_LOGIC_VECTOR(15 downto 0);
subtype T_SLV_24 is STD_LOGIC_VECTOR(23 downto 0);
subtype T_SLV_32 is STD_LOGIC_VECTOR(31 downto 0);
subtype T_SLV_48 is STD_LOGIC_VECTOR(47 downto 0);
subtype T_SLV_64 is STD_LOGIC_VECTOR(63 downto 0);
subtype T_SLV_96 is STD_LOGIC_VECTOR(95 downto 0);
subtype T_SLV_128 is STD_LOGIC_VECTOR(127 downto 0);
subtype T_SLV_256 is STD_LOGIC_VECTOR(255 downto 0);
subtype T_SLV_512 is STD_LOGIC_VECTOR(511 downto 0);
-- STD_LOGIC_VECTOR_VECTORs
-- type T_SLVV is array(NATURAL range <>) of STD_LOGIC_VECTOR; -- VHDL 2008 syntax - not yet supported by Xilinx
type T_SLVV_2 is array(NATURAL range <>) of T_SLV_2;
type T_SLVV_3 is array(NATURAL range <>) of T_SLV_3;
type T_SLVV_4 is array(NATURAL range <>) of T_SLV_4;
type T_SLVV_8 is array(NATURAL range <>) of T_SLV_8;
type T_SLVV_12 is array(NATURAL range <>) of T_SLV_12;
type T_SLVV_16 is array(NATURAL range <>) of T_SLV_16;
type T_SLVV_24 is array(NATURAL range <>) of T_SLV_24;
type T_SLVV_32 is array(NATURAL range <>) of T_SLV_32;
type T_SLVV_48 is array(NATURAL range <>) of T_SLV_48;
type T_SLVV_64 is array(NATURAL range <>) of T_SLV_64;
type T_SLVV_128 is array(NATURAL range <>) of T_SLV_128;
type T_SLVV_256 is array(NATURAL range <>) of T_SLV_256;
eated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); Uri dataUri = getArguments().getParcelable(ARG_DATA_URI); if (dataUri == null) { @@ -309,8 +284,6 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements private void loadData(Uri dataUri) { mDataUri = dataUri; - Log.i(Constants.TAG, "mDataUri: " + mDataUri.toString()); - // Prepare the loaders. Either re-connect with an existing ones, // or start new ones. getLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this); @@ -320,19 +293,10 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements } static final String[] UNIFIED_PROJECTION = new String[] { - KeyRings._ID, KeyRings.MASTER_KEY_ID, KeyRings.HAS_ANY_SECRET, - KeyRings.USER_ID, KeyRings.FINGERPRINT, - KeyRings.ALGORITHM, KeyRings.KEY_SIZE, KeyRings.CREATION, KeyRings.IS_EXPIRED, - + KeyRings._ID, KeyRings.FINGERPRINT }; - static final int INDEX_UNIFIED_MASTER_KEY_ID = 1; - static final int INDEX_UNIFIED_HAS_ANY_SECRET = 2; - static final int INDEX_UNIFIED_USER_ID = 3; - static final int INDEX_UNIFIED_FINGERPRINT = 4; - static final int INDEX_UNIFIED_ALGORITHM = 5; - static final int INDEX_UNIFIED_KEY_SIZE = 6; - static final int INDEX_UNIFIED_CREATION = 7; - static final int INDEX_UNIFIED_ID_EXPIRED = 8; + + static final int INDEX_UNIFIED_FINGERPRINT = 1; public Loader<Cursor> onCreateLoader(int id, Bundle args) { setContentShown(false); @@ -348,11 +312,8 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements } public void onLoadFinished(Loader<Cursor> loader, Cursor data) { - /* TODO better error handling? May cause problems when a key is deleted, - * because the notification triggers faster than the activity closes. - */ // Avoid NullPointerExceptions... - if (data.getCount() == 0) { + if (data == null || data.getCount() == 0) { return; } // Swap the new cursor in. (The framework will take care of closing the @@ -362,10 +323,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements if (data.moveToFirst()) { byte[] fingerprintBlob = data.getBlob(INDEX_UNIFIED_FINGERPRINT); - String fingerprint = KeyFormattingUtils.convertFingerprintToHex(fingerprintBlob); - mFingerprint.setText(KeyFormattingUtils.colorizeFingerprint(fingerprint)); - - loadQrCode(fingerprint); + setFingerprint(fingerprintBlob); break; } @@ -380,14 +338,16 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements * We need to make sure we are no longer using it. */ public void onLoaderReset(Loader<Cursor> loader) { + mFingerprint = null; } - /** - * Load QR Code asynchronously and with a fade in animation - * - * @param fingerprint - */ - private void loadQrCode(final String fingerprint) { + /** Load QR Code asynchronously and with a fade in animation */ + private void setFingerprint(byte[] fingerprintBlob) { + mFingerprint = fingerprintBlob; + + final String fingerprint = KeyFormattingUtils.convertFingerprintToHex(fingerprintBlob); + mFingerprintView.setText(KeyFormattingUtils.colorizeFingerprint(fingerprint)); + AsyncTask<Void, Void, Bitmap> loadTask = new AsyncTask<Void, Void, Bitmap>() { protected Bitmap doInBackground(Void... unused) { diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index bbea9f6ad..6b6e3f5bf 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1327,7 +1327,7 @@ <string name="error_nfc_chaining_error">"NFC: Card expected last command in a chain"</string> <string name="error_nfc_header">"NFC: Card reported invalid %s byte"</string> <string name="error_pin_nodefault">Default PIN was rejected!</string> - <string name="error_bluetooth_file">Error creating temporary file. Bluetooth sharing will fail.</string> + <string name="error_temp_file">Error creating temporary file.</string> <string name="btn_delete_original">Delete original file</string> <string name="snack_encrypt_filenames_on">"Filenames <b>are</b> encrypted."</string> |