diff --git a/APG/AndroidManifest.xml b/APG/AndroidManifest.xml
index 491de65a9..408e48364 100644
--- a/APG/AndroidManifest.xml
+++ b/APG/AndroidManifest.xml
@@ -47,7 +47,7 @@
+ android:targetSdkVersion="17" />
{
private SelectPublicKeyActivity mActivity;
@@ -81,15 +79,6 @@ public class SelectPublicKeyFragment extends SherlockListFragment implements
getLoaderManager().initLoader(0, null, this);
}
- /**
- * Workaround for Android 4.1. Items are not checked in layout. See
- * http://code.google.com/p/android/issues/detail?id=35885
- */
- @Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- l.setItemChecked(position, l.isItemChecked(position));
- }
-
/**
* Selects items based on master key ids in list view
*
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteFileDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteFileDialogFragment.java
index 311066389..342cd41d0 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteFileDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteFileDialogFragment.java
@@ -33,7 +33,6 @@ import android.support.v4.app.FragmentActivity;
import android.widget.Toast;
public class DeleteFileDialogFragment extends DialogFragment {
-
private static final String ARG_DELETE_FILE = "delete_file";
/**
@@ -66,6 +65,8 @@ public class DeleteFileDialogFragment extends DialogFragment {
alert.setMessage(this.getString(R.string.fileDeleteConfirmation, deleteFile));
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteKeyDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteKeyDialogFragment.java
index bb5271ce7..97477ee17 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteKeyDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/DeleteKeyDialogFragment.java
@@ -36,15 +36,14 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
public class DeleteKeyDialogFragment extends DialogFragment {
-
- private Messenger mMessenger;
-
private static final String ARG_MESSENGER = "messenger";
private static final String ARG_DELETE_KEY_RING_ROW_ID = "delete_file";
private static final String ARG_KEY_TYPE = "key_type";
public static final int MESSAGE_OKAY = 1;
+ private Messenger mMessenger;
+
/**
* Creates new instance of this delete file dialog fragment
*/
@@ -68,6 +67,7 @@ public class DeleteKeyDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity activity = getActivity();
+ mMessenger = getArguments().getParcelable(ARG_MESSENGER);
final long deleteKeyRingRowId = getArguments().getLong(ARG_DELETE_KEY_RING_ROW_ID);
final int keyType = getArguments().getInt(ARG_KEY_TYPE);
@@ -92,6 +92,8 @@ public class DeleteKeyDialogFragment extends DialogFragment {
: R.string.secretKeyDeletionConfirmation, userId));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setPositiveButton(R.string.btn_delete, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
if (keyType == Id.type.public_key) {
ProviderHelper.deletePublicKeyRing(activity, deleteKeyRingRowId);
@@ -105,6 +107,8 @@ public class DeleteKeyDialogFragment extends DialogFragment {
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
}
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java
index 7786d9228..513bb058e 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java
@@ -38,9 +38,6 @@ import android.widget.EditText;
import android.widget.ImageButton;
public class FileDialogFragment extends DialogFragment {
-
- private Messenger mMessenger;
-
private static final String ARG_MESSENGER = "messenger";
private static final String ARG_TITLE = "title";
private static final String ARG_MESSAGE = "message";
@@ -53,6 +50,8 @@ public class FileDialogFragment extends DialogFragment {
public static final String MESSAGE_DATA_FILENAME = "filename";
public static final String MESSAGE_DATA_CHECKED = "checked";
+ private Messenger mMessenger;
+
/**
* Creates new instance of this file dialog fragment
*/
@@ -107,7 +106,8 @@ public class FileDialogFragment extends DialogFragment {
mBrowse.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// only .asc or .gpg files
- FileHelper.openFile(activity, mFilename.getText().toString(), "text/plain", requestCode);
+ FileHelper.openFile(activity, mFilename.getText().toString(), "text/plain",
+ requestCode);
}
});
@@ -127,6 +127,10 @@ public class FileDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int id) {
+ Log.d(Constants.TAG, "onclock");
+
+ dismiss();
+
boolean checked = false;
if (mCheckBox.isEnabled()) {
checked = mCheckBox.isChecked();
@@ -138,12 +142,11 @@ public class FileDialogFragment extends DialogFragment {
data.putBoolean(MESSAGE_DATA_CHECKED, checked);
sendMessageToHandler(MESSAGE_OKAY, data);
-
- dismiss();
}
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+
@Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/LookupUnknownKeyDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/LookupUnknownKeyDialogFragment.java
index 9797abc2a..359c94ee9 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/LookupUnknownKeyDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/LookupUnknownKeyDialogFragment.java
@@ -37,15 +37,14 @@ import org.thialfihar.android.apg.ui.KeyServerQueryActivity;
import org.thialfihar.android.apg.util.Log;
public class LookupUnknownKeyDialogFragment extends DialogFragment {
-
- private Messenger mMessenger;
-
private static final String ARG_MESSENGER = "messenger";
private static final String ARG_UNKNOWN_KEY_ID = "unknown_key_id";
public static final int MESSAGE_OKAY = 1;
public static final int MESSAGE_CANCEL = 2;
+ private Messenger mMessenger;
+
/**
* Creates new instance of this dialog fragment
*
@@ -82,6 +81,8 @@ public class LookupUnknownKeyDialogFragment extends DialogFragment {
PGPHelper.getSmallFingerPrint(unknownKeyId)));
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
@@ -94,6 +95,8 @@ public class LookupUnknownKeyDialogFragment extends DialogFragment {
}
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java
index fb8f4b6d1..236386efe 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java
@@ -56,14 +56,12 @@ import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
public class PassphraseDialogFragment extends DialogFragment implements OnEditorActionListener {
-
- private Messenger mMessenger;
-
private static final String ARG_MESSENGER = "messenger";
private static final String ARG_SECRET_KEY_ID = "secret_key_id";
public static final int MESSAGE_OKAY = 1;
+ private Messenger mMessenger;
private EditText mPassphraseEditText;
/**
@@ -182,6 +180,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
mPassphraseEditText = (EditText) view.findViewById(R.id.passphrase_passphrase);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
@@ -217,6 +217,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
}
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/ProgressDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/ProgressDialogFragment.java
index 2fb3b3256..2c007e8e3 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/ProgressDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/ProgressDialogFragment.java
@@ -26,7 +26,6 @@ import android.support.v4.app.DialogFragment;
import android.view.KeyEvent;
public class ProgressDialogFragment extends DialogFragment {
-
private static final String ARG_MESSAGE_ID = "message_id";
private static final String ARG_STYLE = "style";
diff --git a/APG/src/org/thialfihar/android/apg/ui/dialog/SetPassphraseDialogFragment.java b/APG/src/org/thialfihar/android/apg/ui/dialog/SetPassphraseDialogFragment.java
index b23101a0a..c1bbd886a 100644
--- a/APG/src/org/thialfihar/android/apg/ui/dialog/SetPassphraseDialogFragment.java
+++ b/APG/src/org/thialfihar/android/apg/ui/dialog/SetPassphraseDialogFragment.java
@@ -42,8 +42,6 @@ import android.widget.Toast;
import android.widget.TextView.OnEditorActionListener;
public class SetPassphraseDialogFragment extends DialogFragment implements OnEditorActionListener {
- private Messenger mMessenger;
-
private static final String ARG_MESSENGER = "messenger";
private static final String ARG_TITLE = "title";
@@ -51,6 +49,7 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi
public static final String MESSAGE_NEW_PASSPHRASE = "new_passphrase";
+ private Messenger mMessenger;
private EditText mPassphraseEditText;
private EditText mPassphraseAgainEditText;
@@ -97,6 +96,8 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi
mPassphraseAgainEditText = (EditText) view.findViewById(R.id.passphrase_passphrase_again);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
@@ -129,6 +130,8 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+
+ @Override
public void onClick(DialogInterface dialog, int id) {
dismiss();
}
diff --git a/APG/src/org/thialfihar/android/apg/util/Compatibility.java b/APG/src/org/thialfihar/android/apg/util/Compatibility.java
deleted file mode 100644
index e0e6b2202..000000000
--- a/APG/src/org/thialfihar/android/apg/util/Compatibility.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2012 Dominik Schürmann
- *
- * 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.thialfihar.android.apg.util;
-
-import java.lang.reflect.Method;
-
-import android.content.Context;
-import org.thialfihar.android.apg.util.Log;
-
-public class Compatibility {
-
- private static final String clipboardLabel = "APG";
-
- /**
- * Wrapper around ClipboardManager based on Android version using Reflection API
- *
- * @param context
- * @param text
- */
- public static void copyToClipboard(Context context, String text) {
- Object clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE);
- try {
- if ("android.text.ClipboardManager".equals(clipboard.getClass().getName())) {
- Method methodSetText = clipboard.getClass()
- .getMethod("setText", CharSequence.class);
- methodSetText.invoke(clipboard, text);
- } else if ("android.content.ClipboardManager".equals(clipboard.getClass().getName())) {
- Class> classClipData = Class.forName("android.content.ClipData");
- Method methodNewPlainText = classClipData.getMethod("newPlainText",
- CharSequence.class, CharSequence.class);
- Object clip = methodNewPlainText.invoke(null, clipboardLabel, text);
- methodNewPlainText = clipboard.getClass()
- .getMethod("setPrimaryClip", classClipData);
- methodNewPlainText.invoke(clipboard, clip);
- }
- } catch (Exception e) {
- Log.e("ProjectsException", "There was and error copying the text to the clipboard: "
- + e.getMessage());
- }
- }
-
- /**
- * Wrapper around ClipboardManager based on Android version using Reflection API
- *
- * @param context
- * @param text
- */
- public static CharSequence getClipboardText(Context context) {
- Object clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE);
- try {
- if ("android.text.ClipboardManager".equals(clipboard.getClass().getName())) {
- // CharSequence text = clipboard.getText();
- Method methodGetText = clipboard.getClass().getMethod("getText");
- Object text = methodGetText.invoke(clipboard);
-
- return (CharSequence) text;
- } else if ("android.content.ClipboardManager".equals(clipboard.getClass().getName())) {
- // ClipData clipData = clipboard.getPrimaryClip();
- Method methodGetPrimaryClip = clipboard.getClass().getMethod("getPrimaryClip");
- Object clipData = methodGetPrimaryClip.invoke(clipboard);
-
- // ClipData.Item clipDataItem = clipData.getItemAt(0);
- Method methodGetItemAt = clipData.getClass().getMethod("getItemAt", int.class);
- Object clipDataItem = methodGetItemAt.invoke(clipData, 0);
-
- // CharSequence text = clipDataItem.coerceToText(context);
- Method methodGetString = clipDataItem.getClass().getMethod("coerceToText",
- Context.class);
- Object text = methodGetString.invoke(clipDataItem, context);
-
- return (CharSequence) text;
- } else {
- return null;
- }
- } catch (Exception e) {
- Log.e("ProjectsException", "There was and error getting the text from the clipboard: "
- + e.getMessage());
-
- return null;
- }
- }
-}