diff --git a/app/src/main/java/at/bitfire/davdroid/ui/OseAccountsDrawerHandler.kt b/app/src/main/java/at/bitfire/davdroid/ui/OseAccountsDrawerHandler.kt index 368908788b720e6cd4cbdf2b8f210cb68aee979b..c0038233ae7d7ec78dca214683575801ba8418ce 100644 --- a/app/src/main/java/at/bitfire/davdroid/ui/OseAccountsDrawerHandler.kt +++ b/app/src/main/java/at/bitfire/davdroid/ui/OseAccountsDrawerHandler.kt @@ -5,10 +5,13 @@ package at.bitfire.davdroid.ui import android.app.Activity +import android.content.ComponentName import android.content.Intent import android.view.MenuItem import at.bitfire.davdroid.R +import at.bitfire.davdroid.log.Logger import at.bitfire.davdroid.ui.webdav.WebdavMountsActivity +import java.util.logging.Level import javax.inject.Inject /** @@ -16,13 +19,31 @@ import javax.inject.Inject */ class OseAccountsDrawerHandler @Inject constructor(): BaseAccountsDrawerHandler() { + companion object { + private const val WEB_CAL_MANAGER_PACKAGE = "foundation.e.webcalendarmanager" + private const val WEB_CAL_MANAGER_MAIN_ACTIVITY = "at.bitfire.icsdroid.ui.CalendarListActivity" + } + override fun onNavigationItemSelected(activity: Activity, item: MenuItem) { when (item.itemId) { R.id.nav_webdav_mounts -> activity.startActivity(Intent(activity, WebdavMountsActivity::class.java)) + R.id.nav_open_webcalmanager -> + openWebCalManager(activity) else -> super.onNavigationItemSelected(activity, item) } } + private fun openWebCalManager(activity: Activity) { + try { + val intent = Intent(Intent.ACTION_MAIN) + intent.component = + ComponentName(WEB_CAL_MANAGER_PACKAGE, WEB_CAL_MANAGER_MAIN_ACTIVITY) + activity.startActivity(intent) + } catch (e: Exception) { + Logger.log.log(Level.SEVERE, "Failed to open WebCalendarManager", e) + } + } + } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_calendar.xml b/app/src/main/res/drawable/ic_calendar.xml new file mode 100644 index 0000000000000000000000000000000000000000..0c97102c16e90c0df98df8ca6d8820410ef5570e --- /dev/null +++ b/app/src/main/res/drawable/ic_calendar.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/menu/activity_accounts_drawer.xml b/app/src/main/res/menu/activity_accounts_drawer.xml index 45d324f443ec2e4301ed56b9ff5ee274e7f7b309..fc8482e35f10c6de94a5b8cc050467cdad82cb5d 100644 --- a/app/src/main/res/menu/activity_accounts_drawer.xml +++ b/app/src/main/res/menu/activity_accounts_drawer.xml @@ -18,6 +18,11 @@ android:id="@+id/nav_webdav_mounts" android:icon="@drawable/ic_storage" android:title="@string/webdav_mounts_title" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 18ff3c13420387c668e7590b21faca1ee11e0b0c..758ab12a98702ddce4f330d5a0d18d52f17b7f3a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -144,6 +144,7 @@ Please install an email client Please install a Web browser Settings + Web Calendar Manager News & updates Tools External links