Skip to content

Commit

Permalink
fix build, remove old kitkat filepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
az4521 committed Dec 17, 2024
1 parent 4ce1551 commit bf6a617
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 129 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ dependencies {
implementation "info.android15.nucleus:nucleus-support-v7:$nucleus_version"

// Dependency injection
implementation "com.github.inorichi.injekt:injekt-core:65b0440"
implementation "com.github.mihonapp:injekt:91edab2317"

// Image library
final glide_version = '4.16.0'
Expand All @@ -284,9 +284,8 @@ dependencies {
// UI
implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
implementation 'eu.davidea:flexible-adapter:5.1.0'
implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
implementation 'com.nononsenseapps:filepicker:2.5.2'
implementation 'com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533'
implementation 'com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533'
implementation 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0'
implementation 'com.github.mthli:Slice:v1.3'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
Expand Down Expand Up @@ -408,6 +407,7 @@ buildscript {

repositories {
mavenCentral()
jcenter()
}

// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/eu/kanade/tachiyomi/AppInfo.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package eu.kanade.tachiyomi

import eu.kanade.tachiyomi.util.system.ImageUtil

/**
* Used by extensions.
*
Expand All @@ -9,4 +11,6 @@ object AppInfo {
fun getVersionCode() = BuildConfig.VERSION_CODE

fun getVersionName() = BuildConfig.VERSION_NAME

fun getSupportedImageMimeTypes() = ImageUtil.ImageType.entries.map { it.mime }
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class BackupNotifier(private val context: Context) {
val uri = destFile.getUriCompat(context)

addAction(
R.drawable.nnf_ic_file_folder,
R.drawable.ic_folder_24dp,
context.getString(R.string.action_open_log),
NotificationReceiver.openErrorLogPendingActivity(context, uri)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LibraryUpdateNotifier(private val context: Context) {
)
setSmallIcon(R.drawable.ic_tachi)
addAction(
R.drawable.nnf_ic_file_folder,
R.drawable.ic_folder_24dp,
context.getString(R.string.action_open_log),
NotificationReceiver.openErrorLogPendingActivity(context, uri)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.setting
import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
import android.app.Activity
import android.app.Dialog
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
Expand Down Expand Up @@ -38,7 +37,6 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.system.getFilePicker
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -130,13 +128,8 @@ class SettingsBackupController : SettingsController() {

onClick {
val currentDir = preferences.backupsDirectory().get()
try {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(intent, CODE_BACKUP_DIR)
} catch (e: ActivityNotFoundException) {
// Fall back to custom picker on error
startActivityForResult(preferences.context.getFilePicker(currentDir), CODE_BACKUP_DIR)
}
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(intent, CODE_BACKUP_DIR)
}

preferences.backupInterval().asImmediateFlow { isVisible = it > 0 }
Expand Down Expand Up @@ -287,19 +280,14 @@ class SettingsBackupController : SettingsController() {
else -> Backup.getDefaultFilename()
}

try {
// Use Android's built-in file creator
val intent =
Intent(Intent.ACTION_CREATE_DOCUMENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType("application/*")
.putExtra(Intent.EXTRA_TITLE, fileName)

startActivityForResult(intent, code)
} catch (e: ActivityNotFoundException) {
// Handle errors where the Android ROM doesn't support the built in picker
startActivityForResult(preferences.context.getFilePicker(currentDir), code)
}
// Use Android's built-in file creator
val intent =
Intent(Intent.ACTION_CREATE_DOCUMENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType("application/*")
.putExtra(Intent.EXTRA_TITLE, fileName)

startActivityForResult(intent, code)
}

class CreateBackupDialog(bundle: Bundle? = null) : DialogController(bundle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.setting

import android.app.Activity
import android.app.Dialog
import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
Expand All @@ -27,7 +26,6 @@ import eu.kanade.tachiyomi.util.preference.preference
import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes
import eu.kanade.tachiyomi.util.system.getFilePicker
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import uy.kohesive.injekt.Injekt
Expand Down Expand Up @@ -161,11 +159,7 @@ class SettingsDownloadController : SettingsController() {

fun customDirectorySelected(currentDir: String) {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
try {
startActivityForResult(intent, DOWNLOAD_DIR)
} catch (e: ActivityNotFoundException) {
startActivityForResult(preferences.context.getFilePicker(currentDir), DOWNLOAD_DIR)
}
startActivityForResult(intent, DOWNLOAD_DIR)
}

class DownloadDirectoriesDialog : DialogController() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.hippo.unifile.UniFile
import com.nononsenseapps.filepicker.FilePickerActivity
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.lang.truncateCenter
import eu.kanade.tachiyomi.widget.CustomLayoutPickerActivity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -123,19 +121,6 @@ fun Context.notification(
return builder.build()
}

/**
* Helper method to construct an Intent to use a custom file picker.
* @param currentDir the path the file picker will open with.
* @return an Intent to start the file picker activity.
*/
fun Context.getFilePicker(currentDir: String): Intent {
return Intent(this, CustomLayoutPickerActivity::class.java)
.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true)
.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR)
.putExtra(FilePickerActivity.EXTRA_START_PATH, currentDir)
}

/**
* Checks if the give permission is granted.
*
Expand Down
38 changes: 0 additions & 38 deletions app/src/main/java/eu/kanade/tachiyomi/widget/CustomLayoutPicker.kt

This file was deleted.

38 changes: 0 additions & 38 deletions app/src/main/res/layout/common_listitem_dir.xml

This file was deleted.

4 changes: 1 addition & 3 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,14 @@
<!--===-->
<!--OLD-->
<!--===-->
<style name="FilePickerTheme" parent="NNF_BaseTheme.Light">
<style name="FilePickerTheme">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorAccent">@color/colorAccentLight</item>
<item name="colorButtonNormal">@color/colorPrimary</item>
<item name="android:textSize">14sp</item>

<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>

<item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>

<style name="FilePickerAlertDialogTheme" parent="Theme.MaterialComponents.Light.Dialog.Alert" />
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ allprojects {
repositories {
mavenCentral()
google()
jcenter()
maven { setUrl("https://www.jitpack.io") }
maven { setUrl("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { setUrl("https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo") }
Expand Down

0 comments on commit bf6a617

Please sign in to comment.