diff --git a/app/build.gradle b/app/build.gradle index 74e04f154..87984796b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,11 +4,11 @@ apply plugin: 'kotlin-kapt' android { - compileSdkVersion 29 + compileSdkVersion 30 defaultConfig { minSdkVersion 16 // Jelly Bean (4.1) - targetSdkVersion 29 // Android 10 + targetSdkVersion 30 // Android 11 applicationId "com.orgzly" versionCode 158 versionName "1.8.5" @@ -92,11 +92,13 @@ android { * javax.servlet.http. Referenced from com.dropbox.core.DbxStandardSessionStore. */ disable 'InvalidPackage' + + checkDependencies true } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } packagingOptions { diff --git a/app/src/androidTest/java/com/orgzly/android/misc/LogSomethingNotTest.kt b/app/src/androidTest/java/com/orgzly/android/misc/LogSomethingNotTest.kt new file mode 100644 index 000000000..9f7b739a4 --- /dev/null +++ b/app/src/androidTest/java/com/orgzly/android/misc/LogSomethingNotTest.kt @@ -0,0 +1,25 @@ +package com.orgzly.android.misc + +import android.os.Environment +import android.util.Log +import com.orgzly.android.OrgzlyTest +import org.junit.Test + +class LogSomethingNotTest : OrgzlyTest() { + @Test + fun testLink() { + Log.i( + "XXX", String.format( + """ + Environment.getExternalStorageDirectory: %s + context.filesDir: %s + context.getExternalFilesDir(null): %s + context.getExternalFilesDir(DOWNLOADS): %s""".trimIndent(), + Environment.getExternalStorageDirectory(), + context.filesDir, + context.getExternalFilesDir(null), + context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) + ) + ); + } +} diff --git a/app/src/androidTest/java/com/orgzly/android/util/OrgFormatterLinkTest.kt b/app/src/androidTest/java/com/orgzly/android/util/OrgFormatterLinkTest.kt index 05f5b6d29..9bd9229ac 100644 --- a/app/src/androidTest/java/com/orgzly/android/util/OrgFormatterLinkTest.kt +++ b/app/src/androidTest/java/com/orgzly/android/util/OrgFormatterLinkTest.kt @@ -1,10 +1,10 @@ package com.orgzly.android.util -import android.os.Environment import android.text.style.URLSpan import com.orgzly.android.ui.views.style.FileLinkSpan import com.orgzly.android.ui.views.style.IdLinkSpan import org.hamcrest.CoreMatchers.equalTo +import org.junit.After import org.junit.Assert.assertThat import org.junit.Before import org.junit.Test @@ -28,7 +28,7 @@ class OrgFormatterLinkTest(private val param: Parameter) : OrgFormatterTest() { override fun setUp() { super.setUp() - File(Environment.getExternalStorageDirectory(), "orgzly-tests").let { dir -> + File(context.cacheDir, "orgzly-tests").let { dir -> if (!dir.exists() && !dir.mkdirs()) { throw IOException("Failed to create $dir") } @@ -44,6 +44,15 @@ class OrgFormatterLinkTest(private val param: Parameter) : OrgFormatterTest() { } } + @After + override fun tearDown() { + super.tearDown() + + File(context.cacheDir, "orgzly-tests").let { dir -> + dir.deleteRecursively() + } + } + companion object { @JvmStatic @Parameterized.Parameters(name = "{index}: {0}") fun data(): Collection { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f463ae55f..52f7fa18b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,8 +12,10 @@ - - + + + diff --git a/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt b/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt index c6de95623..89419540f 100644 --- a/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt @@ -187,7 +187,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP * Called when a shared preference is modified in any way. * Used to update AppPreferences' static values and do any required post-settings-change work. */ - override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) { + override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) { if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, sharedPreferences, key) val activity = activity as? CommonActivity ?: return diff --git a/app/src/main/java/com/orgzly/android/widgets/ListWidgetService.kt b/app/src/main/java/com/orgzly/android/widgets/ListWidgetService.kt index 62bc1b3a8..47fb51a0d 100644 --- a/app/src/main/java/com/orgzly/android/widgets/ListWidgetService.kt +++ b/app/src/main/java/com/orgzly/android/widgets/ListWidgetService.kt @@ -38,9 +38,9 @@ class ListWidgetService : RemoteViewsService() { override fun onGetViewFactory(intent: Intent): RemoteViewsFactory { if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG) - return ListWidgetViewsFactory( - applicationContext, - intent.getStringExtra(AppIntent.EXTRA_QUERY_STRING)) + val queryString = intent.getStringExtra(AppIntent.EXTRA_QUERY_STRING) ?: "" + + return ListWidgetViewsFactory(applicationContext, queryString) } private sealed class WidgetEntry(open val id: Long) {