aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain
diff options
context:
space:
mode:
Diffstat (limited to 'OpenPGP-Keychain')
-rw-r--r--OpenPGP-Keychain/AndroidManifest.xml3
-rw-r--r--OpenPGP-Keychain/res/layout/api_app_settings_list_activity.xml (renamed from OpenPGP-Keychain/res/layout/crypto_consumer_list_activity.xml)2
-rw-r--r--OpenPGP-Keychain/res/layout/api_register_activity.xml (renamed from OpenPGP-Keychain/res/layout/crypto_consumer_register_activity.xml)0
-rw-r--r--OpenPGP-Keychain/res/values/strings.xml10
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsAdapter.java72
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsFragment.java (renamed from OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersFragment.java)14
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsListActivity.java (renamed from OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersActivity.java)4
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/ServiceActivity.java2
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/.SelectSecretKeyFragment.java.kate-swpbin0 -> 64 bytes
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java6
10 files changed, 94 insertions, 19 deletions
diff --git a/OpenPGP-Keychain/AndroidManifest.xml b/OpenPGP-Keychain/AndroidManifest.xml
index f011e6929..69abb39d9 100644
--- a/OpenPGP-Keychain/AndroidManifest.xml
+++ b/OpenPGP-Keychain/AndroidManifest.xml
@@ -253,6 +253,7 @@
<data android:scheme="file" />
<data android:scheme="content" />
<data android:mimeType="*/*" />
+ <!-- Workaround to match files in pathes with dots in them, like /cdcard/my.folder/test.gpg -->
<data android:pathPattern=".*\\.gpg" />
<data android:pathPattern=".*\\..*\\.gpg" />
<data android:pathPattern=".*\\..*\\..*\\.gpg" />
@@ -467,7 +468,7 @@
<!-- Don't publish intents, they are only used internally! -->
</activity>
<activity
- android:name="org.sufficientlysecure.keychain.remote_api.CryptoConsumersActivity"
+ android:name="org.sufficientlysecure.keychain.remote_api.RegisteredAppsListActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/title_crypto_consumers" />
diff --git a/OpenPGP-Keychain/res/layout/crypto_consumer_list_activity.xml b/OpenPGP-Keychain/res/layout/api_app_settings_list_activity.xml
index b314173eb..a926ad1a8 100644
--- a/OpenPGP-Keychain/res/layout/crypto_consumer_list_activity.xml
+++ b/OpenPGP-Keychain/res/layout/api_app_settings_list_activity.xml
@@ -5,7 +5,7 @@
<fragment
android:id="@+id/crypto_consumers_list_fragment"
- android:name="org.sufficientlysecure.keychain.remote_api.CryptoConsumersFragment"
+ android:name="org.sufficientlysecure.keychain.remote_api.RegisteredAppsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/OpenPGP-Keychain/res/layout/crypto_consumer_register_activity.xml b/OpenPGP-Keychain/res/layout/api_register_activity.xml
index 3af373956..3af373956 100644
--- a/OpenPGP-Keychain/res/layout/crypto_consumer_register_activity.xml
+++ b/OpenPGP-Keychain/res/layout/api_register_activity.xml
diff --git a/OpenPGP-Keychain/res/values/strings.xml b/OpenPGP-Keychain/res/values/strings.xml
index 835198af5..5dfd0d312 100644
--- a/OpenPGP-Keychain/res/values/strings.xml
+++ b/OpenPGP-Keychain/res/values/strings.xml
@@ -31,7 +31,7 @@
<string name="title_editKey">Edit Keyring</string>
<string name="title_createKey">Create Keyring</string>
<string name="title_preferences">Preferences</string>
- <string name="title_crypto_consumers">Crypto Consumers</string>
+ <string name="title_crypto_consumers">Registered Applications</string>
<string name="title_keyServerPreference">Key Server Preference</string>
<string name="title_changePassPhrase">Change Passphrase</string>
<string name="title_setPassPhrase">Set Passphrase</string>
@@ -90,7 +90,7 @@
<string name="menu_managePublicKeys">Manage Public Keyrings</string>
<string name="menu_manageSecretKeys">Manage Secret Keyrings</string>
<string name="menu_preferences">Settings</string>
- <string name="menu_crypto_consumers">Crypto Consumers</string>
+ <string name="menu_apiAppSettings">Registered Apps</string>
<string name="menu_importFromFile">Import from file</string>
<string name="menu_importFromQrCode">Import from QR Code</string>
<string name="menu_importFromNfc">Import from NFC</string>
@@ -359,5 +359,9 @@
<string name="intent_import_key">OpenPGP: Import Keyring</string>
<string name="intent_send_encrypt">OpenPGP: Encrypt</string>
<string name="intent_send_decrypt">OpenPGP: Decrypt</string>
-
+
+ <!-- Remote API -->
+ <string name="api_no_apps">No registered applications!</string>
+ <string name="api_unknown_app">Unknown app</string>
+
</resources> \ No newline at end of file
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsAdapter.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsAdapter.java
new file mode 100644
index 000000000..61888ad5a
--- /dev/null
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsAdapter.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013 Dominik Schürmann <dominik@dominikschuermann.de>
+ *
+ * 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.
+ */
+
+package org.sufficientlysecure.keychain.remote_api;
+
+import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.provider.KeychainContract.CryptoConsumers;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.database.Cursor;
+import android.support.v4.widget.CursorAdapter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class RegisteredAppsAdapter extends CursorAdapter {
+
+ private LayoutInflater mInflater;
+ private PackageManager pm;
+
+ @SuppressWarnings("deprecation")
+ public RegisteredAppsAdapter(Context context, Cursor c) {
+ super(context, c);
+
+ mInflater = LayoutInflater.from(context);
+ pm = context.getApplicationContext().getPackageManager();
+ }
+
+ @Override
+ public void bindView(View view, Context context, Cursor cursor) {
+ TextView text1 = (TextView) view.findViewById(android.R.id.text1);
+ TextView text2 = (TextView) view.findViewById(android.R.id.text2);
+
+ String packageName = cursor.getString(cursor.getColumnIndex(CryptoConsumers.PACKAGE_NAME));
+ if (packageName != null) {
+ text2.setText(packageName);
+
+ // get application name
+ try {
+ ApplicationInfo ai = pm.getApplicationInfo(packageName, 0);
+
+ text1.setText(pm.getApplicationLabel(ai));
+ } catch (final NameNotFoundException e) {
+ text1.setText(R.string.api_unknown_app);
+ }
+ }
+
+ }
+
+ @Override
+ public View newView(Context context, Cursor cursor, ViewGroup parent) {
+ return mInflater.inflate(android.R.layout.simple_list_item_2, null);
+ }
+
+}
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersFragment.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsFragment.java
index 935d64560..b8fd649b4 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersFragment.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsFragment.java
@@ -1,25 +1,25 @@
package org.sufficientlysecure.keychain.remote_api;
+import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.provider.KeychainContract.CryptoConsumers;
import org.sufficientlysecure.keychain.util.Log;
import com.actionbarsherlock.app.SherlockListFragment;
+
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
-import android.support.v4.widget.SimpleCursorAdapter;
-
import android.view.View;
import android.widget.ListView;
-public class CryptoConsumersFragment extends SherlockListFragment implements
+public class RegisteredAppsFragment extends SherlockListFragment implements
LoaderManager.LoaderCallbacks<Cursor> {
// This is the Adapter being used to display the list's data.
- SimpleCursorAdapter mAdapter;
+ RegisteredAppsAdapter mAdapter;
// If non-null, this is the current filter the user has provided.
String mCurFilter;
@@ -30,15 +30,13 @@ public class CryptoConsumersFragment extends SherlockListFragment implements
// Give some text to display if there is no data. In a real
// application this would come from a resource.
- setEmptyText("TODO no crypto consumers");
+ setEmptyText(getString(R.string.api_no_apps));
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
- mAdapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_list_item_2,
- null, new String[] { CryptoConsumers.PACKAGE_NAME, CryptoConsumers.PACKAGE_NAME },
- new int[] { android.R.id.text1, android.R.id.text2 }, 0);
+ mAdapter = new RegisteredAppsAdapter(getActivity(), null);
setListAdapter(mAdapter);
// Prepare the loader. Either re-connect with an existing one,
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsListActivity.java
index 3f12a5e8b..bf34e14f4 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/CryptoConsumersActivity.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/RegisteredAppsListActivity.java
@@ -10,7 +10,7 @@ import com.actionbarsherlock.view.MenuItem;
import android.content.Intent;
import android.os.Bundle;
-public class CryptoConsumersActivity extends SherlockFragmentActivity {
+public class RegisteredAppsListActivity extends SherlockFragmentActivity {
private ActionBar mActionBar;
@Override
@@ -19,7 +19,7 @@ public class CryptoConsumersActivity extends SherlockFragmentActivity {
mActionBar = getSupportActionBar();
- setContentView(R.layout.crypto_consumer_list_activity);
+ setContentView(R.layout.api_app_settings_list_activity);
mActionBar.setDisplayShowTitleEnabled(true);
mActionBar.setDisplayHomeAsUpEnabled(true);
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/ServiceActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/ServiceActivity.java
index 981568944..ba09c9f56 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/ServiceActivity.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/remote_api/ServiceActivity.java
@@ -133,7 +133,7 @@ public class ServiceActivity extends SherlockFragmentActivity {
if (ACTION_REGISTER.equals(action)) {
final String packageName = extras.getString(EXTRA_PACKAGE_NAME);
- setContentView(R.layout.crypto_consumer_register_activity);
+ setContentView(R.layout.api_register_activity);
LinearLayout layoutRegister = (LinearLayout) findViewById(R.id.register_crypto_consumer_register_layout);
LinearLayout layoutEdit = (LinearLayout) findViewById(R.id.register_crypto_consumer_edit_layout);
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/.SelectSecretKeyFragment.java.kate-swp b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/.SelectSecretKeyFragment.java.kate-swp
new file mode 100644
index 000000000..c72aa8947
--- /dev/null
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/.SelectSecretKeyFragment.java.kate-swp
Binary files differ
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java
index 434db7a29..3f5ca536f 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/MainActivity.java
@@ -19,7 +19,7 @@ package org.sufficientlysecure.keychain.ui;
import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R;
-import org.sufficientlysecure.keychain.remote_api.CryptoConsumersActivity;
+import org.sufficientlysecure.keychain.remote_api.RegisteredAppsListActivity;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
@@ -81,7 +81,7 @@ public class MainActivity extends SherlockActivity {
menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences)
.setIcon(R.drawable.ic_menu_settings)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
- menu.add(0, Id.menu.option.crypto_consumers, 0, R.string.menu_crypto_consumers)
+ menu.add(0, Id.menu.option.crypto_consumers, 0, R.string.menu_apiAppSettings)
.setIcon(R.drawable.ic_menu_settings)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
@@ -96,7 +96,7 @@ public class MainActivity extends SherlockActivity {
return true;
case Id.menu.option.crypto_consumers:
- startActivity(new Intent(this, CryptoConsumersActivity.class));
+ startActivity(new Intent(this, RegisteredAppsListActivity.class));
return true;
default: