Commit d869ecbc authored by Ricki Hirner's avatar Ricki Hirner

Minor bug fixes, move beta feedback to navigation drawer

parent d8536765
......@@ -15,7 +15,7 @@ import org.junit.Test
class DefaultsProviderTest {
private val provider: Provider = DefaultsProvider
private val provider: Provider = DefaultsProvider()
@Test
fun testHas() {
......
......@@ -231,7 +231,7 @@ class Settings: Service(), Provider.Observer {
}
}
if (!context.bindService(Intent(context, Settings::class.java), serviceConn, Context.BIND_AUTO_CREATE))
if (!context.bindService(Intent(context, Settings::class.java), serviceConn, Context.BIND_AUTO_CREATE or Context.BIND_IMPORTANT))
return null
synchronized(serviceLock) {
......@@ -242,7 +242,10 @@ class Settings: Service(), Provider.Observer {
}
if (service == null) {
context.unbindService(serviceConn)
try {
context.unbindService(serviceConn)
} catch (e: IllegalArgumentException) {
}
return null
}
}
......
......@@ -49,15 +49,12 @@ abstract class SyncAdapterService: Service() {
// load app settings
val settings = Settings.getInstance(context)
try {
if (settings == null) {
syncResult.databaseError = true
throw IllegalStateException()
}
if (settings == null) {
syncResult.databaseError = true
Logger.log.severe("Couldn't connect to Settings service, aborting sync")
return
} else settings.use { settings ->
sync(settings, account, extras, authority, provider, syncResult)
} finally {
settings?.close()
}
Logger.log.info("Sync for $authority complete")
}
......
......@@ -21,9 +21,11 @@ import android.support.design.widget.Snackbar
import android.support.v4.view.GravityCompat
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import android.view.View
import at.bitfire.davdroid.App
import at.bitfire.davdroid.BuildConfig
import at.bitfire.davdroid.R
import at.bitfire.davdroid.settings.ISettings
import at.bitfire.davdroid.ui.setup.LoginActivity
......@@ -58,6 +60,8 @@ class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSele
nav_view.setNavigationItemSelectedListener(this)
nav_view.itemIconTintList = null
if (BuildConfig.VERSION_NAME.contains("-beta") || BuildConfig.VERSION_NAME.contains("-rc"))
nav_view.menu.findItem(R.id.nav_beta_feedback).isVisible = true
/* When the DAVdroid main activity is started, start a Settings service that stays in memory
for better performance. The service stops itself when memory is trimmed. */
......@@ -133,6 +137,8 @@ class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSele
startActivity(Intent(this, AboutActivity::class.java))
R.id.nav_app_settings ->
startActivity(Intent(this, AppSettingsActivity::class.java))
R.id.nav_beta_feedback ->
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.beta_feedback_url))))
R.id.nav_twitter ->
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/davdroidapp")))
R.id.nav_website ->
......
......@@ -36,7 +36,6 @@ class StartupDialogFragment: DialogFragment(), LoaderManager.LoaderCallbacks<ISe
enum class Mode {
BATTERY_OPTIMIZATIONS,
DEVELOPMENT_VERSION,
GOOGLE_PLAY_ACCOUNTS_REMOVED,
OPENTASKS_NOT_INSTALLED,
OSE_DONATE
......@@ -55,9 +54,7 @@ class StartupDialogFragment: DialogFragment(), LoaderManager.LoaderCallbacks<ISe
fun getStartupDialogs(context: Context, settings: ISettings): List<StartupDialogFragment> {
val dialogs = LinkedList<StartupDialogFragment>()
if (BuildConfig.VERSION_NAME.contains("-alpha") || BuildConfig.VERSION_NAME.contains("-beta") || BuildConfig.VERSION_NAME.contains("-rc"))
dialogs += StartupDialogFragment.instantiate(Mode.DEVELOPMENT_VERSION)
/* else if (System.currentTimeMillis() > settings.getLong(SETTING_NEXT_DONATION_POPUP, 0))
/* if (System.currentTimeMillis() > settings.getLong(SETTING_NEXT_DONATION_POPUP, 0))
dialogs += StartupDialogFragment.instantiate(Mode.OSE_DONATE) */
// store-specific information
......@@ -136,17 +133,6 @@ class StartupDialogFragment: DialogFragment(), LoaderManager.LoaderCallbacks<ISe
})
.create()
Mode.DEVELOPMENT_VERSION ->
AlertDialog.Builder(activity)
.setIcon(R.mipmap.ic_launcher)
.setTitle(R.string.startup_development_version)
.setMessage(getString(R.string.startup_development_version_message, getString(R.string.app_name)))
.setPositiveButton(android.R.string.ok, { _: DialogInterface, _: Int -> })
.setNeutralButton(R.string.startup_development_version_give_feedback, { _: DialogInterface, _: Int ->
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.startup_development_version_feedback_url))))
})
.create()
Mode.GOOGLE_PLAY_ACCOUNTS_REMOVED -> {
var icon: Drawable? = null
try {
......
......@@ -14,6 +14,13 @@
android:id="@+id/nav_about"
android:icon="@drawable/ic_info_dark"
android:title="@string/navigation_drawer_about"/>
<item
android:id="@+id/nav_beta_feedback"
android:icon="@drawable/ic_forum_dark"
android:title="@string/navigation_drawer_beta_feedback"
android:visible="false"/>
<item
android:id="@+id/nav_app_settings"
android:icon="@drawable/ic_settings_dark"
......
......@@ -21,16 +21,13 @@
<string name="please_wait">Please wait …</string>
<string name="send">Send</string>
<string name="homepage_url">https://davdroid.bitfire.at/?pk_campaign=davdroid-app</string>
<string name="beta_feedback_url">https://forums.bitfire.at/category/9/beta-test-discussion?pk_campaign=davdroid-app</string>
<!-- startup dialogs -->
<string name="startup_battery_optimization">Battery Optimization</string>
<string name="startup_battery_optimization_message">Android may disable/reduce DAVdroid synchronization after a few days. To prevent this, turn off battery optimization.</string>
<string name="startup_battery_optimization_disable">Turn off for DAVdroid</string>
<string name="startup_dont_show_again">Don\'t show again</string>
<string name="startup_development_version">Preview Release</string>
<string name="startup_development_version_message">This is a development version of %s. Things may not work as expected. Your feedback is welcome.</string>
<string name="startup_development_version_give_feedback">Give feedback</string>
<string name="startup_development_version_feedback_url">https://forums.bitfire.at/category/9/beta-test-discussion?pk_campaign=davdroid-app</string>
<string name="startup_donate">Open-Source Information</string>
<string name="startup_donate_message">We\'re happy that you use DAVdroid, which is open-source software (GPLv3). Because developing DAVdroid is hard work and took us thousands of working hours, please consider a donation.</string>
<string name="startup_donate_now">Show donation page</string>
......@@ -58,6 +55,7 @@
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="navigation_drawer_subtitle">CalDAV/CardDAV Sync Adapter</string>
<string name="navigation_drawer_about">About / License</string>
<string name="navigation_drawer_beta_feedback">Beta feedback</string>
<string name="navigation_drawer_settings">Settings</string>
<string name="navigation_drawer_news_updates">News &amp; updates</string>
<string name="navigation_drawer_external_links">External links</string>
......
......@@ -39,7 +39,7 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style>
<color name="actionBarButton">#8f000000</color>
<color name="actionBarButton">#8a000000</color>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment