summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorJanak Amarasena <janakamarasena@gmail.com>2018-05-31 02:36:50 +0530
committerJanak Amarasena <janakamarasena@gmail.com>2018-05-31 02:36:50 +0530
commit78155c90b53ea88a2c47c7f2d7915d4682d259e1 (patch)
tree351e90ad94032b134f09d4a9e61c1ed004c6cd04 /app/src/main/java
parent4d744883a032e6f1669ac9527797d8d9cad9f5fe (diff)
Added donation button to navigation drawer
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Constants.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java1
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java9
3 files changed, 16 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java
index d719e8d3..bcce1549 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java
@@ -87,4 +87,10 @@ public interface Constants {
// ICS-OPENVPN CONSTANTS
/////////////////////////////////////////////
String DEFAULT_SHARED_PREFS_BATTERY_SAVER = "screenoff";
+
+ //////////////////////////////////////////////
+ // CUSTOM CONSTANTS
+ /////////////////////////////////////////////
+ String DONATION_URL = BuildConfig.donation_url;
+
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java
index 8238df55..01b10575 100644
--- a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java
+++ b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java
@@ -40,6 +40,7 @@ public class DrawerSettingsAdapter extends BaseAdapter {
public static final int ABOUT = 2;
public static final int BATTERY_SAVER = 3;
public static final int ALWAYS_ON = 4;
+ public static final int DONATE = 5;
//view types
public final static int VIEW_SIMPLE_TEXT = 0;
diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
index e7a5e460..371e65fc 100644
--- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
@@ -22,6 +22,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
@@ -67,9 +68,11 @@ import static se.leap.bitmaskclient.ConfigHelper.getShowAlwaysOnDialog;
import static se.leap.bitmaskclient.Constants.PROVIDER_KEY;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.Constants.DONATION_URL;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.ABOUT;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.ALWAYS_ON;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.BATTERY_SAVER;
+import static se.leap.bitmaskclient.DrawerSettingsAdapter.DONATE;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSimpleTextInstance;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSwitchInstance;
import static se.leap.bitmaskclient.DrawerSettingsAdapter.LOG;
@@ -77,6 +80,7 @@ import static se.leap.bitmaskclient.DrawerSettingsAdapter.SWITCH_PROVIDER;
import static se.leap.bitmaskclient.R.string.about_fragment_title;
import static se.leap.bitmaskclient.R.string.log_fragment_title;
import static se.leap.bitmaskclient.R.string.switch_provider_menu_option;
+import static se.leap.bitmaskclient.R.string.navigation_drawer_donation_button;
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
@@ -184,6 +188,7 @@ public class NavigationDrawerFragment extends Fragment {
settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER));
settingsListAdapter.addItem(getSimpleTextInstance(getString(log_fragment_title), LOG));
settingsListAdapter.addItem(getSimpleTextInstance(getString(about_fragment_title), ABOUT));
+ settingsListAdapter.addItem(getSimpleTextInstance(getString(navigation_drawer_donation_button), DONATE));
mDrawerSettingsListView.setAdapter(settingsListAdapter);
@@ -452,6 +457,10 @@ public class NavigationDrawerFragment extends Fragment {
startActivity(intent);
}
break;
+ case DONATE:
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(DONATION_URL));
+ startActivity(browserIntent);
+ break;
default:
break;
}