diff --git a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt index 5e6e49442..1dcb5e50d 100644 --- a/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/IntentHelper.kt @@ -36,10 +36,10 @@ object IntentHelper { } } - fun openLinkFromHref(context: Context, fragmentManager: FragmentManager, link: String) { + fun openLinkFromHref(context: Context, fragmentManager: FragmentManager, link: String, forceDefaultOpen: Boolean = false) { val resolveInfoList = getResolveInfo(context, link) - if (resolveInfoList.isEmpty()) { + if (resolveInfoList.isEmpty() || forceDefaultOpen) { try { context.startActivity(getResolveIntent(link)) } catch (e: Exception) { diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index 4cb1edb39..80c297801 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -124,7 +124,7 @@ class AboutActivity : BaseActivity() { } companion object { - private const val DONATE_URL = "https://github.com/libre-tube/LibreTube#donate" + const val DONATE_URL = "https://github.com/libre-tube/LibreTube#donate" private const val WEBSITE_URL = "https://libretube.dev" private const val GITHUB_URL = "https://github.com/libre-tube/LibreTube" private const val PIPED_GITHUB_URL = "https://github.com/TeamPiped/Piped" diff --git a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt index 04c2e3c04..6f871ec24 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt @@ -441,6 +441,16 @@ class MainActivity : BaseActivity() { true } + R.id.action_donate -> { + IntentHelper.openLinkFromHref( + this, + supportFragmentManager, + AboutActivity.DONATE_URL, + forceDefaultOpen = true + ) + true + } + else -> super.onOptionsItemSelected(item) } } diff --git a/app/src/main/res/menu/action_bar.xml b/app/src/main/res/menu/action_bar.xml index d92659756..00b2362e2 100644 --- a/app/src/main/res/menu/action_bar.xml +++ b/app/src/main/res/menu/action_bar.xml @@ -20,6 +20,11 @@ android:title="@string/help" app:showAsAction="never" /> + +