Skip to content

Commit

Permalink
Target Android 11
Browse files Browse the repository at this point in the history
  • Loading branch information
nevenz committed Nov 22, 2021
1 parent 0eb07b7 commit c010310
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 12 deletions.
10 changes: 6 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
)
);
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
}
Expand All @@ -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<Parameter> {
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
<!-- Initially added for checking available connections (for sync). -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<!-- Required for: exporting files (Downloads), creating temporary files -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<!-- For BroadcastReceiver below -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c010310

Please sign in to comment.