diff --git a/app/src/main/java/org/tasks/extensions/Context.kt b/app/src/main/java/org/tasks/extensions/Context.kt
index 54f1ea3bb..d68cadb45 100644
--- a/app/src/main/java/org/tasks/extensions/Context.kt
+++ b/app/src/main/java/org/tasks/extensions/Context.kt
@@ -6,9 +6,13 @@ import android.content.Intent
import android.content.Intent.ACTION_VIEW
import android.net.Uri
import android.widget.Toast
+import androidx.browser.customtabs.CustomTabsIntent
import org.tasks.R
object Context {
+ private const val HTTP = "http"
+ private const val HTTPS = "https"
+
fun Context.safeStartActivity(intent: Intent) {
try {
startActivity(intent)
@@ -20,7 +24,22 @@ object Context {
fun Context.openUri(resId: Int, vararg formatArgs: Any) = openUri(getString(resId, formatArgs))
fun Context.openUri(url: String?) =
- url?.let { safeStartActivity(Intent(ACTION_VIEW, Uri.parse(it))) }
+ url?.let { Uri.parse(it) }?.let {
+ when {
+ it.scheme.equals(HTTPS, true) || it.scheme.equals(HTTP, true) ->
+ try {
+ CustomTabsIntent.Builder()
+ .setUrlBarHidingEnabled(true)
+ .setShowTitle(true)
+ .setShareState(CustomTabsIntent.SHARE_STATE_ON)
+ .build()
+ .launchUrl(this, it)
+ } catch (e: ActivityNotFoundException) {
+ toast(R.string.no_app_found)
+ }
+ else -> safeStartActivity(Intent(ACTION_VIEW, it))
+ }
+ }
fun Context.toast(resId: Int, vararg formatArgs: Any, duration: Int = Toast.LENGTH_LONG) =
toast(getString(resId, formatArgs), duration)
diff --git a/app/src/main/java/org/tasks/injection/InjectingPreferenceFragment.kt b/app/src/main/java/org/tasks/injection/InjectingPreferenceFragment.kt
index 3973af768..15ddf2178 100644
--- a/app/src/main/java/org/tasks/injection/InjectingPreferenceFragment.kt
+++ b/app/src/main/java/org/tasks/injection/InjectingPreferenceFragment.kt
@@ -10,6 +10,7 @@ import androidx.preference.PreferenceScreen
import kotlinx.coroutines.launch
import org.tasks.R
import org.tasks.dialogs.DialogBuilder
+import org.tasks.extensions.Context.openUri
import org.tasks.preferences.Device
import org.tasks.themes.DrawableUtil
import javax.inject.Inject
@@ -102,4 +103,10 @@ abstract class InjectingPreferenceFragment : PreferenceFragmentCompat() {
protected fun findPreference(@StringRes prefId: Int): Preference =
findPreference(getString(prefId))!!
+
+ protected fun openUrl(prefId: Int, url: Int) =
+ findPreference(prefId).setOnPreferenceClickListener {
+ context?.openUri(url)
+ false
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/org/tasks/preferences/fragments/Backups.kt b/app/src/main/java/org/tasks/preferences/fragments/Backups.kt
index 4f6c515df..5deaa102c 100644
--- a/app/src/main/java/org/tasks/preferences/fragments/Backups.kt
+++ b/app/src/main/java/org/tasks/preferences/fragments/Backups.kt
@@ -88,6 +88,8 @@ class Backups : InjectingPreferenceFragment() {
}
}
+ openUrl(R.string.documentation, R.string.url_backups)
+
viewModel.lastBackup.observe(this, this::updateLastBackup)
viewModel.lastDriveBackup.observe(this, this::updateDriveBackup)
viewModel.lastAndroidBackup.observe(this, this::updateAndroidBackup)
diff --git a/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt b/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt
index 965ae3e55..418615659 100644
--- a/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt
+++ b/app/src/main/java/org/tasks/preferences/fragments/HelpAndFeedback.kt
@@ -60,7 +60,16 @@ class HelpAndFeedback : InjectingPreferenceFragment() {
)
} else if (!firebase.noChurn()) {
remove(R.string.rate_tasks)
+ } else {
+ openUrl(R.string.rate_tasks, R.string.market_url)
}
+
+ openUrl(R.string.documentation, R.string.url_documentation)
+ openUrl(R.string.issue_tracker, R.string.url_issue_tracker)
+ openUrl(R.string.follow_reddit, R.string.url_reddit)
+ openUrl(R.string.follow_twitter, R.string.url_twitter)
+ openUrl(R.string.source_code, R.string.url_source_code)
+ openUrl(R.string.privacy_policy, R.string.url_privacy_policy)
}
override fun getMenu() = 0
diff --git a/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt b/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt
index 727a2bf3b..63a1219bf 100644
--- a/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt
+++ b/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt
@@ -124,6 +124,8 @@ class LookAndFeel : InjectingPreferenceFragment() {
dialog.show(parentFragmentManager, FRAG_TAG_LOCALE_PICKER)
false
}
+
+ openUrl(R.string.translations, R.string.url_translations)
}
override fun onResume() {
diff --git a/app/src/main/java/org/tasks/preferences/fragments/Notifications.kt b/app/src/main/java/org/tasks/preferences/fragments/Notifications.kt
index 23031eede..c2607bdf3 100644
--- a/app/src/main/java/org/tasks/preferences/fragments/Notifications.kt
+++ b/app/src/main/java/org/tasks/preferences/fragments/Notifications.kt
@@ -131,6 +131,8 @@ class Notifications : InjectingPreferenceFragment() {
checkBatteryOptimizations()
+ openUrl(R.string.troubleshooting, R.string.url_notifications)
+
requires(AndroidUtilities.atLeastOreo(), R.string.more_settings)
requires(
AndroidUtilities.preOreo(),
diff --git a/app/src/main/java/org/tasks/preferences/fragments/TasksAccount.kt b/app/src/main/java/org/tasks/preferences/fragments/TasksAccount.kt
index c84353e85..08612e861 100644
--- a/app/src/main/java/org/tasks/preferences/fragments/TasksAccount.kt
+++ b/app/src/main/java/org/tasks/preferences/fragments/TasksAccount.kt
@@ -91,6 +91,8 @@ class TasksAccount : BaseAccountPreference() {
viewModel.requestNewPassword(caldavAccount, description as String)
false
}
+
+ openUrl(R.string.app_passwords_more_info, R.string.url_app_passwords)
}
override suspend fun removeAccount() {
diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml
index 864342413..8c81aa3ec 100644
--- a/app/src/main/res/values/keys.xml
+++ b/app/src/main/res/values/keys.xml
@@ -32,6 +32,13 @@
https://tasks.org/passwords
https://tasks.org/sharing
https://tasks.org/filters
+ https://tasks.org/
+ https://github.com/tasks/tasks/issues
+ https://tasks.org/source
+ https://tasks.org/privacy.html
+ https://tasks.org/backups
+ https://tasks.org/translations
+ https://tasks.org/notifications
date_shortcut_morning
date_shortcut_afternoon
diff --git a/app/src/main/res/xml/help_and_feedback.xml b/app/src/main/res/xml/help_and_feedback.xml
index d8373022f..30a48ca70 100644
--- a/app/src/main/res/xml/help_and_feedback.xml
+++ b/app/src/main/res/xml/help_and_feedback.xml
@@ -10,30 +10,20 @@
-
-
+ app:icon="@drawable/ic_outline_star_border_24px" />
-
-
+ app:icon="@drawable/ic_outline_help_outline_24px"/>
-
-
+ app:icon="@drawable/ic_outline_bug_report_24px" />
-
-
+ app:icon="@drawable/ic_reddit_share_silhouette" />
-
-
+ app:icon="@drawable/ic_twitter_logo_black" />
-
-
+ app:icon="@drawable/ic_octocat" />
-
-
+ app:icon="@drawable/ic_outline_perm_identity_24px" />
-
-
-
-
+ android:icon="@drawable/ic_open_in_new_24px" />
-
-
+ app:icon="@drawable/ic_open_in_new_24px" />
diff --git a/app/src/main/res/xml/preferences_notifications.xml b/app/src/main/res/xml/preferences_notifications.xml
index cfd69ad8c..5e3354f47 100644
--- a/app/src/main/res/xml/preferences_notifications.xml
+++ b/app/src/main/res/xml/preferences_notifications.xml
@@ -3,15 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
-
-
-
-
+ android:title="@string/troubleshooting" />
-
-
+ android:summary="@string/app_passwords_more_info" />