mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-11 21:48:17 -05:00
Resolve crashes on Android 2.3 due to ActionBarCompat conversion
This commit is contained in:
parent
6eaf45940e
commit
ef1401fc0d
@ -55,6 +55,8 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.support.v4.view.MenuCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -127,12 +129,12 @@ public class DecryptActivity extends DrawerActivity {
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (mDecryptEnabled) {
|
||||
menu.add(1, Id.menu.option.decrypt, 0, mDecryptString).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
MenuItem item = menu.add(1, Id.menu.option.decrypt, 0, mDecryptString);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
if (mReplyEnabled) {
|
||||
menu.add(1, Id.menu.option.reply, 1, mReplyString).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
MenuItem item = menu.add(1, Id.menu.option.reply, 1, mReplyString);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -281,7 +283,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new actionbar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
|
||||
if (mReturnResult) {
|
||||
mSourcePrevious.setClickable(false);
|
||||
@ -372,7 +374,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
|
||||
mDecryptString = getString(R.string.btn_verify);
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
} else {
|
||||
Log.d(Constants.TAG, "Nothing matched!");
|
||||
}
|
||||
@ -421,7 +423,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -430,7 +432,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -723,7 +725,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
|
||||
Toast.makeText(DecryptActivity.this, R.string.decryption_successful,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
@ -744,7 +746,7 @@ public class DecryptActivity extends DrawerActivity {
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
break;
|
||||
|
||||
case Id.target.file:
|
||||
|
@ -51,6 +51,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -131,18 +132,16 @@ public class EncryptActivity extends DrawerActivity {
|
||||
|
||||
/**
|
||||
* ActionBar menu is created based on class variables to change it at runtime
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (mEncryptToClipboardEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mEncryptToClipboardString)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
MenuItem item = menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mEncryptToClipboardString);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
if (mEncryptEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt, 1, mEncryptString).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
MenuItem item = menu.add(1, Id.menu.option.encrypt, 1, mEncryptString);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -388,7 +387,7 @@ public class EncryptActivity extends DrawerActivity {
|
||||
}
|
||||
|
||||
// build new action bar based on these class variables
|
||||
invalidateOptionsMenu();
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -718,7 +717,9 @@ public class EncryptActivity extends DrawerActivity {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
// Create a new Messenger for the communication back
|
||||
|
@ -3,8 +3,8 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<fragment
|
||||
|
@ -1,20 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_api_settings_revoke"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/api_settings_revoke"/>
|
||||
android:title="@string/api_settings_revoke"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/menu_api_settings_cancel"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/api_settings_cancel"/>
|
||||
android:title="@string/api_settings_cancel"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
@ -1,17 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_edit_export_file"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_edit_delete"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_delete_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_edit_cancel"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_key_edit_cancel" />
|
||||
|
||||
</menu>
|
@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_public_import"
|
||||
android:showAsAction="always|withText"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_action_add_person"
|
||||
android:title="@string/menu_import" />
|
||||
<item
|
||||
android:id="@+id/menu_key_list_public_export"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_keys" />
|
||||
|
||||
</menu>
|
@ -1,21 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_secret_create"
|
||||
android:showAsAction="always|withText"
|
||||
app:showAsAction="always|withText"
|
||||
android:title="@string/menu_create_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_list_secret_create_expert"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_create_key_expert" />
|
||||
<item
|
||||
android:id="@+id/menu_key_list_secret_import"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_import" />
|
||||
<item
|
||||
android:id="@+id/menu_key_list_secret_export"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_keys" />
|
||||
|
||||
</menu>
|
@ -1,47 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share"
|
||||
android:icon="@drawable/ic_action_share"
|
||||
android:showAsAction="always"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/menu_share">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_fingerprint_title"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_title_fingerprint">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_default_fingerprint"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_default_fingerprint" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_qr_code_fingerprint"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_qr_code_fingerprint" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_title"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_title">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_default"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_default" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_qr_code"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_qr_code" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_nfc"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_share_nfc" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_share_clipboard"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_copy_to_clipboard" />
|
||||
</menu>
|
||||
</item>
|
||||
@ -50,30 +51,30 @@
|
||||
<item
|
||||
android:id="@+id/menu_key_keyserver"
|
||||
android:icon="@drawable/ic_action_import_export"
|
||||
android:showAsAction="always"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/menu_share">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_update"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_update_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_export_keyserver"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_key_to_server" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_key_view_sign"
|
||||
android:showAsAction="ifRoom"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/menu_sign_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_export_file"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_key" />
|
||||
<item
|
||||
android:id="@+id/menu_key_view_delete"
|
||||
android:showAsAction="never"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_delete_key" />
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user