mirror of
https://github.com/etesync/android
synced 2025-01-23 06:01:01 +00:00
Settings: Implement the dashboard link.
This commit is contained in:
parent
b524ae21f4
commit
008f91d715
@ -138,7 +138,7 @@ dependencies {
|
||||
implementation "org.jetbrains.anko:anko-commons:0.10.4"
|
||||
|
||||
implementation "com.etesync:journalmanager:1.1.1"
|
||||
def etebaseVersion = '0.2.2'
|
||||
def etebaseVersion = '2.0.1-SNAPSHOT'
|
||||
implementation "com.etebase:client:$etebaseVersion"
|
||||
|
||||
def acraVersion = '5.3.0'
|
||||
|
@ -17,20 +17,24 @@ import android.os.Bundle
|
||||
import android.provider.CalendarContract
|
||||
import android.text.TextUtils
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.app.NavUtils
|
||||
import androidx.core.net.toUri
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.loader.app.LoaderManager
|
||||
import androidx.loader.content.AsyncTaskLoader
|
||||
import androidx.loader.content.Loader
|
||||
import androidx.preference.*
|
||||
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
|
||||
import com.etebase.client.exceptions.EtebaseException
|
||||
import com.etesync.syncadapter.*
|
||||
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
|
||||
import com.etesync.syncadapter.R
|
||||
import com.etesync.syncadapter.log.Logger
|
||||
import com.etesync.syncadapter.ui.setup.LoginCredentials
|
||||
import com.etesync.syncadapter.ui.setup.LoginCredentialsChangeFragment
|
||||
import org.jetbrains.anko.doAsync
|
||||
import org.jetbrains.anko.uiThread
|
||||
|
||||
class AccountSettingsActivity : BaseActivity() {
|
||||
private lateinit var account: Account
|
||||
@ -92,7 +96,26 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
|
||||
// Category: dashboard
|
||||
val prefManageAccount = findPreference("manage_account")
|
||||
prefManageAccount.onPreferenceClickListener = Preference.OnPreferenceClickListener { _ ->
|
||||
Toast.makeText(requireContext(), "Not yet supported", Toast.LENGTH_LONG).show()
|
||||
doAsync {
|
||||
try {
|
||||
|
||||
val httpClient = HttpClient.Builder(requireContext()).build()
|
||||
val etebase = EtebaseLocalCache.getEtebase(requireContext(), httpClient.okHttpClient, settings)
|
||||
val url = etebase.fetchDashboardUrl()
|
||||
uiThread {
|
||||
WebViewActivity.openUrl(requireActivity(), url.toUri())
|
||||
}
|
||||
} catch (e: EtebaseException) {
|
||||
uiThread {
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setIcon(R.drawable.ic_error_dark)
|
||||
.setTitle(R.string.exception)
|
||||
.setMessage(e.localizedMessage)
|
||||
.setPositiveButton(android.R.string.yes) { _, _ -> }
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user