Merge pull request #2506 from schleif/master
Add an advertisement for autocrypt thunderbird plugin to navigation drawer
This commit is contained in:
commit
591be56265
|
@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Build.VERSION_CODES;
|
import android.os.Build.VERSION_CODES;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -58,6 +59,7 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||||
static final int ID_SETTINGS = 6;
|
static final int ID_SETTINGS = 6;
|
||||||
static final int ID_HELP = 7;
|
static final int ID_HELP = 7;
|
||||||
static final int ID_SHOP = 8;
|
static final int ID_SHOP = 8;
|
||||||
|
static final int ID_AUTOCRYPT = 9;
|
||||||
|
|
||||||
// both of these are used for instrumentation testing only
|
// both of these are used for instrumentation testing only
|
||||||
public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time";
|
public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time";
|
||||||
|
@ -100,7 +102,10 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||||
.withIdentifier(ID_TRANSFER).withSelectable(false),
|
.withIdentifier(ID_TRANSFER).withSelectable(false),
|
||||||
new DividerDrawerItem(),
|
new DividerDrawerItem(),
|
||||||
new PrimaryDrawerItem().withName(R.string.menu_preferences).withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(ID_SETTINGS).withSelectable(false),
|
new PrimaryDrawerItem().withName(R.string.menu_preferences).withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(ID_SETTINGS).withSelectable(false),
|
||||||
new PrimaryDrawerItem().withName(R.string.menu_help).withIcon(CommunityMaterial.Icon.cmd_help_circle).withIdentifier(ID_HELP).withSelectable(false)
|
new PrimaryDrawerItem().withName(R.string.menu_help).withIcon(CommunityMaterial.Icon.cmd_help_circle).withIdentifier(ID_HELP).withSelectable(false),
|
||||||
|
new DividerDrawerItem(),
|
||||||
|
new PrimaryDrawerItem().withName(R.string.nav_autocrypt).withIcon(GoogleMaterial.Icon.gmd_blur_on)
|
||||||
|
.withTypeface(Typeface.DEFAULT_BOLD).withSelectable(false).withIdentifier(ID_AUTOCRYPT)
|
||||||
)
|
)
|
||||||
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,6 +138,9 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||||
case ID_SHOP:
|
case ID_SHOP:
|
||||||
onShopSelected();
|
onShopSelected();
|
||||||
break;
|
break;
|
||||||
|
case ID_AUTOCRYPT:
|
||||||
|
onAutocryptSelected();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
MainActivity.this.startActivity(intent);
|
MainActivity.this.startActivity(intent);
|
||||||
|
@ -266,6 +274,13 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
|
||||||
setFragment(frag);
|
setFragment(frag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onAutocryptSelected() {
|
||||||
|
String url = "https://addons.thunderbird.net/en-US/thunderbird/addon/autocrypt/";
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setData(Uri.parse(url));
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
// add the values which need to be saved from the drawer to the bundle
|
// add the values which need to be saved from the drawer to the bundle
|
||||||
|
|
|
@ -858,6 +858,7 @@
|
||||||
<string name="nav_backup">"Backup/Restore"</string>
|
<string name="nav_backup">"Backup/Restore"</string>
|
||||||
<string name="nav_transfer">"Secure Wifi Transfer"</string>
|
<string name="nav_transfer">"Secure Wifi Transfer"</string>
|
||||||
<string name="nav_shop">Shop</string>
|
<string name="nav_shop">Shop</string>
|
||||||
|
<string name="nav_autocrypt">Try Autocrypt Thunderbird</string>
|
||||||
|
|
||||||
<!-- hints -->
|
<!-- hints -->
|
||||||
<string name="encrypt_content_edit_text_hint">"Type text"</string>
|
<string name="encrypt_content_edit_text_hint">"Type text"</string>
|
||||||
|
|
Loading…
Reference in a new issue