From 7e10f6fcb93cb19e92ed25af4d1189c557e8f720 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Thu, 2 Jan 2025 13:34:05 +0100 Subject: [PATCH] add donation link to app drawer --- .../java/org/schabi/newpipe/MainActivity.java | 17 ++++++++++++++++- .../res/drawable-mdpi/volunteer_activism_ic.xml | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable-mdpi/volunteer_activism_ic.xml diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 175694125..1687bacf3 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -28,6 +28,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -120,7 +121,8 @@ public class MainActivity extends AppCompatActivity { private static final int ITEM_ID_DOWNLOADS = -4; private static final int ITEM_ID_HISTORY = -5; private static final int ITEM_ID_SETTINGS = 0; - private static final int ITEM_ID_ABOUT = 1; + private static final int ITEM_ID_DONATION = 1; + private static final int ITEM_ID_ABOUT = 2; private static final int ORDER = 0; @@ -262,6 +264,10 @@ public class MainActivity extends AppCompatActivity { drawerLayoutBinding.navigation.getMenu() .add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings) .setIcon(R.drawable.ic_settings); + drawerLayoutBinding.navigation.getMenu() + .add(R.id.menu_options_about_group, ITEM_ID_DONATION, ORDER, + R.string.donation_title) + .setIcon(R.drawable.volunteer_activism_ic); drawerLayoutBinding.navigation.getMenu() .add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about) .setIcon(R.drawable.ic_info_outline); @@ -337,6 +343,9 @@ public class MainActivity extends AppCompatActivity { case ITEM_ID_SETTINGS: NavigationHelper.openSettings(this); break; + case ITEM_ID_DONATION: + openDonationPage(); + break; case ITEM_ID_ABOUT: NavigationHelper.openAbout(this); break; @@ -924,4 +933,10 @@ public class MainActivity extends AppCompatActivity { return sheetState == BottomSheetBehavior.STATE_HIDDEN || sheetState == BottomSheetBehavior.STATE_COLLAPSED; } + + private void openDonationPage() { + final Intent intent = new Intent(Intent.ACTION_VIEW, + Uri.parse(getString(R.string.donation_url))); + startActivity(intent); + } } diff --git a/app/src/main/res/drawable-mdpi/volunteer_activism_ic.xml b/app/src/main/res/drawable-mdpi/volunteer_activism_ic.xml new file mode 100644 index 000000000..de6985c53 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/volunteer_activism_ic.xml @@ -0,0 +1,9 @@ + + +