Skip to content

Commit c010310

Browse files
committed
Target Android 11
1 parent 0eb07b7 commit c010310

File tree

6 files changed

+50
-12
lines changed

6 files changed

+50
-12
lines changed

app/build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ apply plugin: 'kotlin-kapt'
44

55

66
android {
7-
compileSdkVersion 29
7+
compileSdkVersion 30
88

99
defaultConfig {
1010
minSdkVersion 16 // Jelly Bean (4.1)
11-
targetSdkVersion 29 // Android 10
11+
targetSdkVersion 30 // Android 11
1212
applicationId "com.orgzly"
1313
versionCode 158
1414
versionName "1.8.5"
@@ -92,11 +92,13 @@ android {
9292
* javax.servlet.http. Referenced from com.dropbox.core.DbxStandardSessionStore.
9393
*/
9494
disable 'InvalidPackage'
95+
96+
checkDependencies true
9597
}
9698

9799
compileOptions {
98-
sourceCompatibility JavaVersion.VERSION_1_8
99-
targetCompatibility JavaVersion.VERSION_1_8
100+
sourceCompatibility JavaVersion.VERSION_11
101+
targetCompatibility JavaVersion.VERSION_11
100102
}
101103

102104
packagingOptions {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.orgzly.android.misc
2+
3+
import android.os.Environment
4+
import android.util.Log
5+
import com.orgzly.android.OrgzlyTest
6+
import org.junit.Test
7+
8+
class LogSomethingNotTest : OrgzlyTest() {
9+
@Test
10+
fun testLink() {
11+
Log.i(
12+
"XXX", String.format(
13+
"""
14+
Environment.getExternalStorageDirectory: %s
15+
context.filesDir: %s
16+
context.getExternalFilesDir(null): %s
17+
context.getExternalFilesDir(DOWNLOADS): %s""".trimIndent(),
18+
Environment.getExternalStorageDirectory(),
19+
context.filesDir,
20+
context.getExternalFilesDir(null),
21+
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
22+
)
23+
);
24+
}
25+
}

app/src/androidTest/java/com/orgzly/android/util/OrgFormatterLinkTest.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.orgzly.android.util
22

3-
import android.os.Environment
43
import android.text.style.URLSpan
54
import com.orgzly.android.ui.views.style.FileLinkSpan
65
import com.orgzly.android.ui.views.style.IdLinkSpan
76
import org.hamcrest.CoreMatchers.equalTo
7+
import org.junit.After
88
import org.junit.Assert.assertThat
99
import org.junit.Before
1010
import org.junit.Test
@@ -28,7 +28,7 @@ class OrgFormatterLinkTest(private val param: Parameter) : OrgFormatterTest() {
2828
override fun setUp() {
2929
super.setUp()
3030

31-
File(Environment.getExternalStorageDirectory(), "orgzly-tests").let { dir ->
31+
File(context.cacheDir, "orgzly-tests").let { dir ->
3232
if (!dir.exists() && !dir.mkdirs()) {
3333
throw IOException("Failed to create $dir")
3434
}
@@ -44,6 +44,15 @@ class OrgFormatterLinkTest(private val param: Parameter) : OrgFormatterTest() {
4444
}
4545
}
4646

47+
@After
48+
override fun tearDown() {
49+
super.tearDown()
50+
51+
File(context.cacheDir, "orgzly-tests").let { dir ->
52+
dir.deleteRecursively()
53+
}
54+
}
55+
4756
companion object {
4857
@JvmStatic @Parameterized.Parameters(name = "{index}: {0}")
4958
fun data(): Collection<Parameter> {

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
<!-- Initially added for checking available connections (for sync). -->
1313
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
1414

15-
<!-- Required for: exporting files (Downloads), creating temporary files -->
16-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
15+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
16+
17+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
18+
android:maxSdkVersion="28" />
1719

1820
<!-- For BroadcastReceiver below -->
1921
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

app/src/main/java/com/orgzly/android/ui/settings/SettingsFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
187187
* Called when a shared preference is modified in any way.
188188
* Used to update AppPreferences' static values and do any required post-settings-change work.
189189
*/
190-
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
190+
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) {
191191
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, sharedPreferences, key)
192192

193193
val activity = activity as? CommonActivity ?: return

app/src/main/java/com/orgzly/android/widgets/ListWidgetService.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class ListWidgetService : RemoteViewsService() {
3838
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
3939
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG)
4040

41-
return ListWidgetViewsFactory(
42-
applicationContext,
43-
intent.getStringExtra(AppIntent.EXTRA_QUERY_STRING))
41+
val queryString = intent.getStringExtra(AppIntent.EXTRA_QUERY_STRING) ?: ""
42+
43+
return ListWidgetViewsFactory(applicationContext, queryString)
4444
}
4545

4646
private sealed class WidgetEntry(open val id: Long) {

0 commit comments

Comments
 (0)