deactive search until it is reimplemented, syntax improvements in Compatibility class

This commit is contained in:
Dominik 2012-11-21 16:58:55 +01:00
parent b56326aec8
commit 8abfb5a6f4
4 changed files with 32 additions and 22 deletions

View File

@ -157,8 +157,9 @@ public class KeyListActivity extends SherlockFragmentActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(3, Id.menu.option.search, 0, R.string.menu_search)
.setIcon(R.drawable.ic_menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
// TODO: reimplement!
// menu.add(3, Id.menu.option.search, 0, R.string.menu_search)
// .setIcon(R.drawable.ic_menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(0, Id.menu.option.import_keys, 2, R.string.menu_importKeys).setShowAsAction(
MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(0, Id.menu.option.export_keys, 3, R.string.menu_exportKeys).setShowAsAction(
@ -322,8 +323,8 @@ public class KeyListActivity extends SherlockFragmentActivity {
intent.putExtra(ApgIntentService.EXTRA_DATA, data);
// Message is received after importing is done in ApgService
ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this, R.string.progress_importing,
ProgressDialog.STYLE_HORIZONTAL) {
ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this,
R.string.progress_importing, ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) {
// handle messages by standard ApgHandler first
super.handleMessage(message);
@ -414,8 +415,8 @@ public class KeyListActivity extends SherlockFragmentActivity {
intent.putExtra(ApgIntentService.EXTRA_DATA, data);
// Message is received after exporting is done in ApgService
ApgIntentServiceHandler exportHandler = new ApgIntentServiceHandler(this, R.string.progress_exporting,
ProgressDialog.STYLE_HORIZONTAL) {
ApgIntentServiceHandler exportHandler = new ApgIntentServiceHandler(this,
R.string.progress_exporting, ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) {
// handle messages by standard ApgHandler first
super.handleMessage(message);

View File

@ -60,7 +60,7 @@ public class SelectPublicKeyActivity extends SherlockFragmentActivity {
mSelectFragment = (SelectPublicKeyFragment) getSupportFragmentManager().findFragmentById(
R.id.select_public_key_fragment);
//
// TODO: reimplement!
// mFilterLayout = findViewById(R.id.layout_filter);
// mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
// mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
@ -81,6 +81,8 @@ public class SelectPublicKeyActivity extends SherlockFragmentActivity {
}
private void handleIntent(Intent intent) {
// TODO: reimplement!
// String searchString = null;
// if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
// searchString = intent.getStringExtra(SearchManager.QUERY);
@ -124,8 +126,9 @@ public class SelectPublicKeyActivity extends SherlockFragmentActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
android.R.drawable.ic_menu_search);
// TODO: reimplement!
// menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
// android.R.drawable.ic_menu_search);
menu.add(1, Id.menu.option.cancel, 0, R.string.btn_doNotSave).setShowAsAction(
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(1, Id.menu.option.okay, 1, R.string.btn_okay).setShowAsAction(

View File

@ -51,6 +51,7 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity {
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
// TODO: reimplement!
// mFilterLayout = findViewById(R.id.layout_filter);
// mFilterInfo = (TextView) mFilterLayout.findViewById(R.id.filterInfo);
// mClearFilterButton = (Button) mFilterLayout.findViewById(R.id.btn_clear);
@ -85,6 +86,8 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity {
}
private void handleIntent(Intent intent) {
// TODO: reimplement!
// String searchString = null;
// if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
// searchString = intent.getStringExtra(SearchManager.QUERY);
@ -103,8 +106,9 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
android.R.drawable.ic_menu_search);
// TODO: reimplement!
// menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
// android.R.drawable.ic_menu_search);
return true;
}

View File

@ -35,15 +35,17 @@ public class Compatibility {
Object clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE);
try {
if ("android.text.ClipboardManager".equals(clipboard.getClass().getName())) {
Method method = clipboard.getClass().getMethod("setText", CharSequence.class);
method.invoke(clipboard, text);
Method methodSetText = clipboard.getClass()
.getMethod("setText", CharSequence.class);
methodSetText.invoke(clipboard, text);
} else if ("android.content.ClipboardManager".equals(clipboard.getClass().getName())) {
Class<?> clazz = Class.forName("android.content.ClipData");
Method method = clazz.getMethod("newPlainText", CharSequence.class,
CharSequence.class);
Object clip = method.invoke(null, clipboardLabel, text);
method = clipboard.getClass().getMethod("setPrimaryClip", clazz);
method.invoke(clipboard, clip);
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: "
@ -62,8 +64,8 @@ public class Compatibility {
try {
if ("android.text.ClipboardManager".equals(clipboard.getClass().getName())) {
// CharSequence text = clipboard.getText();
Method method = clipboard.getClass().getMethod("getText");
Object text = method.invoke(clipboard);
Method methodGetText = clipboard.getClass().getMethod("getText");
Object text = methodGetText.invoke(clipboard);
return (CharSequence) text;
} else if ("android.content.ClipboardManager".equals(clipboard.getClass().getName())) {
@ -72,7 +74,7 @@ public class Compatibility {
Object clipData = methodGetPrimaryClip.invoke(clipboard);
// ClipData.Item clipDataItem = clipData.getItemAt(0);
Method methodGetItemAt = clipData.getClass().getMethod("getItemAt", Integer.TYPE);
Method methodGetItemAt = clipData.getClass().getMethod("getItemAt", int.class);
Object clipDataItem = methodGetItemAt.invoke(clipData, 0);
// CharSequence text = clipDataItem.coerceToText(context);