Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 12802f86 authored by Sunik Kupfer's avatar Sunik Kupfer Committed by Ricki Hirner
Browse files

Mirror changes in AccountsDrawerHandler



Co-authored-by: default avatarRicki Hirner <hirner@bitfire.at>
parent 3c0a26bb
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="navigation_drawer_support_project">Support the project</string>
    <string name="nav_earn_badges">Support us with badges</string>
    <string name="nav_rate_us">Review in Google Play</string>
    <plurals name="you_earned_badges">
        <item quantity="one">You\'ve earned a badge, thank you!</item>
        <item quantity="other">You have earned %d badges, thank you!</item>
    </plurals>
    <string name="available_badges">Available badges</string>
    <string name="available_badges_empty">Sorry, there are no badges available for purchase at the moment!</string>
    <string name="what_are_badges">What are badges?</string>
    <string name="what_are_badges_title">What are badges?</string>
    <string name="what_are_badges_body">Badges are simple in-app one-time-payments. You will earn a nice little badge and with it you can support us over time.</string>
    <string name="why_badges_title">Why does DAVx5 offer feature-free badges?</string>
    <string name="why_badges_body">DAVx5 has really grown over the years! We are still actively developing new features, providing support and we always update the app for upcoming Android versions. These badges are one-time payments where you can simply show your support by buying us a coffee, or two&#8230; or 10 :-) We want to be as open as possible, so there will never-ever be any new stuff locked to in-app payment.</string>
    <string name="button_buy_badge_free">FREE</string>
    <string name="button_buy_badge_bought">Thank you!</string>
    <string name="earn_badges">Earn badges to support us!</string>
</resources>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -3,10 +3,15 @@
 **************************************************************************************************/
package at.bitfire.davdroid

import java.io.File

object Constants {

    const val DAVDROID_GREEN_RGBA = 0xFF8bc34a.toInt()

    // gplay billing
    const val BILLINGCLIENT_CONNECTION_MAX_RETRIES = 4

    /**
     * Context label for [org.apache.commons.lang3.exception.ContextedException].
     * Context value is the [at.bitfire.davdroid.resource.LocalResource]
+3 −1
Original line number Diff line number Diff line
@@ -182,7 +182,9 @@ class AboutActivity: AppCompatActivity() {

            private lateinit var binding: AboutTranslationBinding

            class ViewHolder(val context: Context, val binding: AboutTranslationBinding): RecyclerView.ViewHolder(binding.root)
            class ViewHolder(
                val context: Context, val binding: AboutTranslationBinding
                ): RecyclerView.ViewHolder(binding.root)

            override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
                binding = AboutTranslationBinding.inflate(LayoutInflater.from(parent.context), parent, false)
+3 −4
Original line number Diff line number Diff line
@@ -32,12 +32,11 @@ import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.*

class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {

    companion object {
        val accountsDrawerHandler = DefaultAccountsDrawerHandler()
        val accountsDrawerHandler = OseAccountsDrawerHandler()

        const val REQUEST_INTRO = 0
    }
@@ -122,9 +121,9 @@ class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSele
    }

    override fun onNavigationItemSelected(item: MenuItem): Boolean {
        val processed = accountsDrawerHandler.onNavigationItemSelected(this, item)
        accountsDrawerHandler.onNavigationItemSelected(this, item)
        binding.drawerLayout.closeDrawer(GravityCompat.START)
        return processed
        return true
    }


+57 −0
Original line number Diff line number Diff line
@@ -8,71 +8,50 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.annotation.CallSuper
import at.bitfire.davdroid.App
import at.bitfire.davdroid.BuildConfig
import at.bitfire.davdroid.R
import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.ui.webdav.WebdavMountsActivity

class DefaultAccountsDrawerHandler: IAccountsDrawerHandler {
/**
 * Default menu items control
 */
abstract class BaseAccountsDrawerHandler: IAccountsDrawerHandler {

    companion object {
        private const val BETA_FEEDBACK_URI = "mailto:play@bitfire.at?subject=${BuildConfig.APPLICATION_ID}/${BuildConfig.VERSION_NAME} feedback (${BuildConfig.VERSION_CODE})"

        const val COMMUNITY_URL = "https://github.com/bitfireAT/davx5-ose/discussions"
    }


    @CallSuper
    override fun initMenu(context: Context, menu: Menu) {
        if (BuildConfig.VERSION_NAME.contains("-alpha") || BuildConfig.VERSION_NAME.contains("-beta") || BuildConfig.VERSION_NAME.contains("-rc"))
            menu.findItem(R.id.nav_beta_feedback).isVisible = true
        if (/* ose */ true)
            menu.findItem(R.id.nav_donate).isVisible = true
    }

    override fun onNavigationItemSelected(activity: Activity, item: MenuItem): Boolean {
    @CallSuper
    override fun onNavigationItemSelected(activity: Activity, item: MenuItem) {
        when (item.itemId) {
            R.id.nav_about ->
                activity.startActivity(Intent(activity, AboutActivity::class.java))
            R.id.nav_beta_feedback ->
                if (!UiUtils.launchUri(activity, Uri.parse(BETA_FEEDBACK_URI), Intent.ACTION_SENDTO, false))
                if (!UiUtils.launchUri(
                        activity,
                        Uri.parse(BETA_FEEDBACK_URI),
                        Intent.ACTION_SENDTO,
                        false
                    )
                )
                    Toast.makeText(activity, R.string.install_email_client, Toast.LENGTH_LONG).show()
            R.id.nav_app_settings ->
                activity.startActivity(Intent(activity, AppSettingsActivity::class.java))

            R.id.nav_twitter ->
                UiUtils.launchUri(activity,
                        Uri.parse("https://twitter.com/" + activity.getString(R.string.twitter_handle)))
            R.id.nav_website ->
                UiUtils.launchUri(activity,
                        App.homepageUrl(activity))

            R.id.nav_webdav_mounts ->
                activity.startActivity(Intent(activity, WebdavMountsActivity::class.java))

            R.id.nav_manual ->
                UiUtils.launchUri(activity,
                        App.homepageUrl(activity).buildUpon().appendPath("manual").build())
            R.id.nav_faq ->
                UiUtils.launchUri(activity,
                        App.homepageUrl(activity).buildUpon().appendPath("faq").build())
            R.id.nav_community ->
                UiUtils.launchUri(activity, Uri.parse(COMMUNITY_URL))
            R.id.nav_donate ->
                //if (BuildConfig.FLAVOR != App.FLAVOR_GOOGLE_PLAY)
                    UiUtils.launchUri(activity,
                            App.homepageUrl(activity).buildUpon().appendPath("donate").build())
            R.id.nav_privacy ->
                UiUtils.launchUri(activity,
                        App.homepageUrl(activity).buildUpon().appendPath("privacy").build())

            else ->
                return false
        }

        return true
    }

}
 No newline at end of file
Loading