rename resources folders, new high def icons

This commit is contained in:
Dominik Schürmann 2013-12-30 22:20:20 +01:00
parent 1be368092e
commit f143fc0eb9
35 changed files with 103 additions and 66 deletions

View File

@ -12,6 +12,9 @@
<!-- android:title="AIDL Demo (ACCESS_KEYS permission)" /> --> <!-- android:title="AIDL Demo (ACCESS_KEYS permission)" /> -->
<!-- </PreferenceCategory> --> <!-- </PreferenceCategory> -->
<PreferenceCategory android:title="OpenPGP Provider" > <PreferenceCategory android:title="OpenPGP Provider" >
<org.openintents.openpgp.OpenPgpListPreference
android:key="openpgp_provider_list"
android:title="Select OpenPGP Provider!" />
<Preference <Preference
android:key="openpgp_provider_demo" android:key="openpgp_provider_demo"
android:title="OpenPGP Provider" /> android:title="OpenPGP Provider" />

View File

@ -26,10 +26,34 @@ import org.openintents.openpgp.IOpenPgpKeyIdsCallback;
*/ */
interface IOpenPgpService { interface IOpenPgpService {
/**
* Sign
*
* After successful signing, callback's onSuccess will contain the resulting output.
*
* @param input
* OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri
* @param output
* Request output format by defining OpenPgpData object
*
* new OpenPgpData(OpenPgpData.TYPE_STRING)
* Returns as String
* (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53)
* new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY)
* Returns as byte[]
* new OpenPgpData(uri)
* Writes output to given Uri
* new OpenPgpData(fileDescriptor)
* Writes output to given ParcelFileDescriptor
* @param callback
* Callback where to return results
*/
oneway void sign(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback);
/** /**
* Encrypt * Encrypt
* *
* After successful encryption, callback's onSuccess will contain the resulting output bytes. * After successful encryption, callback's onSuccess will contain the resulting output.
* *
* @param input * @param input
* OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri
@ -52,34 +76,10 @@ interface IOpenPgpService {
*/ */
oneway void encrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback); oneway void encrypt(in OpenPgpData input, in OpenPgpData output, in long[] keyIds, in IOpenPgpCallback callback);
/**
* Sign
*
* After successful signing, callback's onSuccess will contain the resulting output bytes.
*
* @param input
* OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri
* @param output
* Request output format by defining OpenPgpData object
*
* new OpenPgpData(OpenPgpData.TYPE_STRING)
* Returns as String
* (OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53)
* new OpenPgpData(OpenPgpData.TYPE_BYTE_ARRAY)
* Returns as byte[]
* new OpenPgpData(uri)
* Writes output to given Uri
* new OpenPgpData(fileDescriptor)
* Writes output to given ParcelFileDescriptor
* @param callback
* Callback where to return results
*/
oneway void sign(in OpenPgpData input, in OpenPgpData output, in IOpenPgpCallback callback);
/** /**
* Sign then encrypt * Sign then encrypt
* *
* After successful signing and encryption, callback's onSuccess will contain the resulting output bytes. * After successful signing and encryption, callback's onSuccess will contain the resulting output.
* *
* @param input * @param input
* OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri * OpenPgpData object containing String, byte[], ParcelFileDescriptor, or Uri
@ -104,9 +104,9 @@ interface IOpenPgpService {
/** /**
* Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted,
* and also signed-only inputBytes. * and also signed-only input.
* *
* After successful decryption/verification, callback's onSuccess will contain the resulting output bytes. * After successful decryption/verification, callback's onSuccess will contain the resulting output.
* The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given. * The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given.
* *
* @param input * @param input

View File

@ -0,0 +1,10 @@
package org.openintents.openpgp;
public class OpenPgpConstants {
public static final String TAG = "OpenPgp API";
public static final int REQUIRED_API_VERSION = 1;
public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService";
}

View File

@ -40,7 +40,7 @@ public class OpenPgpHelper {
} }
public boolean isAvailable() { public boolean isAvailable() {
Intent intent = new Intent(IOpenPgpService.class.getName()); Intent intent = new Intent(OpenPgpConstants.SERVICE_INTENT);
List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0); List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0);
if (!resInfo.isEmpty()) { if (!resInfo.isEmpty()) {
return true; return true;

View File

@ -39,22 +39,19 @@ public class OpenPgpListPreference extends DialogPreference {
ArrayList<OpenPgpProviderEntry> mProviderList = new ArrayList<OpenPgpProviderEntry>(); ArrayList<OpenPgpProviderEntry> mProviderList = new ArrayList<OpenPgpProviderEntry>();
private String mSelectedPackage; private String mSelectedPackage;
public static final int REQUIRED_API_VERSION = 1;
public OpenPgpListPreference(Context context, AttributeSet attrs) { public OpenPgpListPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
List<ResolveInfo> resInfo = List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(
context.getPackageManager().queryIntentServices( new Intent(OpenPgpConstants.SERVICE_INTENT), PackageManager.GET_META_DATA);
new Intent(IOpenPgpService.class.getName()), PackageManager.GET_META_DATA);
if (!resInfo.isEmpty()) { if (!resInfo.isEmpty()) {
for (ResolveInfo resolveInfo : resInfo) { for (ResolveInfo resolveInfo : resInfo) {
if (resolveInfo.serviceInfo == null) if (resolveInfo.serviceInfo == null)
continue; continue;
String packageName = resolveInfo.serviceInfo.packageName; String packageName = resolveInfo.serviceInfo.packageName;
String simpleName = String.valueOf(resolveInfo.serviceInfo String simpleName = String.valueOf(resolveInfo.serviceInfo.loadLabel(context
.loadLabel(context.getPackageManager())); .getPackageManager()));
Drawable icon = resolveInfo.serviceInfo.loadIcon(context.getPackageManager()); Drawable icon = resolveInfo.serviceInfo.loadIcon(context.getPackageManager());
// get api version // get api version
@ -95,22 +92,20 @@ public class OpenPgpListPreference extends DialogPreference {
TextView tv = (TextView) v.findViewById(android.R.id.text1); TextView tv = (TextView) v.findViewById(android.R.id.text1);
// Put the image on the TextView // Put the image on the TextView
tv.setCompoundDrawablesWithIntrinsicBounds(mProviderList.get(position).icon, tv.setCompoundDrawablesWithIntrinsicBounds(mProviderList.get(position).icon, null,
null, null, null); null, null);
// Add margin between image and text (support various screen // Add margin between image and text (support various screen densities)
// densities)
int dp5 = (int) (5 * getContext().getResources().getDisplayMetrics().density + 0.5f); int dp5 = (int) (5 * getContext().getResources().getDisplayMetrics().density + 0.5f);
tv.setCompoundDrawablePadding(dp5); tv.setCompoundDrawablePadding(dp5);
// disable if it has the wrong api_version // disable if it has the wrong api_version
if (mProviderList.get(position).apiVersion == REQUIRED_API_VERSION) { if (mProviderList.get(position).apiVersion == OpenPgpConstants.REQUIRED_API_VERSION) {
tv.setEnabled(true); tv.setEnabled(true);
} else { } else {
tv.setEnabled(false); tv.setEnabled(false);
tv.setText(tv.getText() + " (API v" tv.setText(tv.getText() + " (API v" + mProviderList.get(position).apiVersion
+ mProviderList.get(position).apiVersion + ", needs v" + ", needs v" + OpenPgpConstants.REQUIRED_API_VERSION + ")");
+ REQUIRED_API_VERSION + ")");
} }
return v; return v;
@ -125,8 +120,8 @@ public class OpenPgpListPreference extends DialogPreference {
mSelectedPackage = mProviderList.get(which).packageName; mSelectedPackage = mProviderList.get(which).packageName;
/* /*
* Clicking on an item simulates the positive button * Clicking on an item simulates the positive button click, and dismisses
* click, and dismisses the dialog. * the dialog.
*/ */
OpenPgpListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE); OpenPgpListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
dialog.dismiss(); dialog.dismiss();
@ -134,9 +129,8 @@ public class OpenPgpListPreference extends DialogPreference {
}); });
/* /*
* The typical interaction for list-based dialogs is to have * The typical interaction for list-based dialogs is to have click-on-an-item dismiss the
* click-on-an-item dismiss the dialog instead of the user having to * dialog instead of the user having to press 'Ok'.
* press 'Ok'.
*/ */
builder.setPositiveButton(null, null); builder.setPositiveButton(null, null);
} }

View File

@ -29,14 +29,12 @@ public class OpenPgpServiceConnection {
private Context mApplicationContext; private Context mApplicationContext;
private IOpenPgpService mService; private IOpenPgpService mService;
private boolean bound; private boolean mBound;
private String cryptoProviderPackageName; private String mCryptoProviderPackageName;
private static final String TAG = "OpenPgpServiceConnection";
public OpenPgpServiceConnection(Context context, String cryptoProviderPackageName) { public OpenPgpServiceConnection(Context context, String cryptoProviderPackageName) {
mApplicationContext = context.getApplicationContext(); this.mApplicationContext = context.getApplicationContext();
this.cryptoProviderPackageName = cryptoProviderPackageName; this.mCryptoProviderPackageName = cryptoProviderPackageName;
} }
public IOpenPgpService getService() { public IOpenPgpService getService() {
@ -44,20 +42,20 @@ public class OpenPgpServiceConnection {
} }
public boolean isBound() { public boolean isBound() {
return bound; return mBound;
} }
private ServiceConnection mCryptoServiceConnection = new ServiceConnection() { private ServiceConnection mCryptoServiceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
mService = IOpenPgpService.Stub.asInterface(service); mService = IOpenPgpService.Stub.asInterface(service);
Log.d(TAG, "connected to service"); Log.d(OpenPgpConstants.TAG, "connected to service");
bound = true; mBound = true;
} }
public void onServiceDisconnected(ComponentName name) { public void onServiceDisconnected(ComponentName name) {
mService = null; mService = null;
Log.d(TAG, "disconnected from service"); Log.d(OpenPgpConstants.TAG, "disconnected from service");
bound = false; mBound = false;
} }
}; };
@ -67,23 +65,23 @@ public class OpenPgpServiceConnection {
* @return * @return
*/ */
public boolean bindToService() { public boolean bindToService() {
if (mService == null && !bound) { // if not already connected if (mService == null && !mBound) { // if not already connected
try { try {
Log.d(TAG, "not bound yet"); Log.d(OpenPgpConstants.TAG, "not bound yet");
Intent serviceIntent = new Intent(); Intent serviceIntent = new Intent();
serviceIntent.setAction(IOpenPgpService.class.getName()); serviceIntent.setAction(IOpenPgpService.class.getName());
serviceIntent.setPackage(cryptoProviderPackageName); serviceIntent.setPackage(mCryptoProviderPackageName);
mApplicationContext.bindService(serviceIntent, mCryptoServiceConnection, mApplicationContext.bindService(serviceIntent, mCryptoServiceConnection,
Context.BIND_AUTO_CREATE); Context.BIND_AUTO_CREATE);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Log.d(TAG, "Exception", e); Log.d(OpenPgpConstants.TAG, "Exception on binding", e);
return false; return false;
} }
} else { // already connected } else {
Log.d(TAG, "already bound... "); Log.d(OpenPgpConstants.TAG, "already bound");
return true; return true;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 228 KiB

View File

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 352 KiB

View File

Before

Width:  |  Height:  |  Size: 371 KiB

After

Width:  |  Height:  |  Size: 371 KiB

View File

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,32 @@
#!/bin/bash
APP_DIR=../../OpenPGP-Keychain
LDPI_DIR=$APP_DIR/res/drawable-ldpi
MDPI_DIR=$APP_DIR/res/drawable-mdpi
HDPI_DIR=$APP_DIR/res/drawable-hdpi
XDPI_DIR=$APP_DIR/res/drawable-xhdpi
XXDPI_DIR=$APP_DIR/res/drawable-xxhdpi
XXXDPI_DIR=$APP_DIR/res/drawable-xxxhdpi
PLAY_DIR=./
# Launcher Icon:
# -----------------------
# ldpi: 36x36
# mdpi: 48x48
# hdpi: 72x72
# xhdpi: 96x96
# xxhdpi: 144x144.
# xxxhdpi 192x192.
# google play: 512x512
NAME="icon"
inkscape -w 36 -h 36 -e "$LDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 48 -h 48 -e "$MDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 72 -h 72 -e "$HDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 96 -h 96 -e "$XDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 144 -h 144 -e "$XXDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 192 -h 192 -e "$XXXDPI_DIR/$NAME.png" $NAME.svg
inkscape -w 512 -h 512 -e "$PLAY_DIR/$NAME.png" $NAME.svg

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB