mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 17:08:59 -04:00
Changes after review
This commit is contained in:
parent
62202448f9
commit
2ed2843540
@ -292,7 +292,11 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
||||
getPathFromUri(requireActivity(), data)?.let(sharedPreferenceUtil::putPrefStorage)
|
||||
sharedPreferenceUtil.putStoragePosition(EXTERNAL_SELECT_POSITION)
|
||||
} ?: run {
|
||||
activity.toast(resources.getString(R.string.error_occurred), Toast.LENGTH_SHORT)
|
||||
activity.toast(
|
||||
resources
|
||||
.getString(R.string.system_unable_to_grant_permission_message),
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,5 +6,4 @@
|
||||
<string name="cannot_open_file">Failed to open file\nPlease try looking for this file in the Device Tab of your Library</string>
|
||||
<string name="send_files_title">Send Files</string>
|
||||
<string name="receive_files_title">Receive Files</string>
|
||||
<string name="error_occurred" translatable="false">System unable to grant permission!</string>
|
||||
</resources>
|
||||
|
@ -45,7 +45,6 @@ dependencies {
|
||||
// SquiDB
|
||||
implementation(Libs.squidb)
|
||||
implementation(Libs.squidb_annotations)
|
||||
implementation("androidx.documentfile:documentfile:1.0.1")
|
||||
add("kapt", Libs.squidb_processor)
|
||||
|
||||
// Document File
|
||||
|
@ -242,25 +242,35 @@ object FileUtils {
|
||||
or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||
uri?.let {
|
||||
activity.grantUriPermission(
|
||||
activity.packageName, uri,
|
||||
activity.packageName, it,
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
)
|
||||
activity.contentResolver.takePersistableUriPermission(uri, takeFlags)
|
||||
activity.contentResolver.takePersistableUriPermission(it, takeFlags)
|
||||
|
||||
val dFile = DocumentFile.fromTreeUri(activity, uri)
|
||||
val dFile = DocumentFile.fromTreeUri(activity, it)
|
||||
if (dFile != null) {
|
||||
val originalPath = dFile.uri.path!!.substring(
|
||||
dFile.uri.path!!.lastIndexOf(":") + 1
|
||||
)
|
||||
val path = "${activity.getExternalFilesDirs("")[1]}"
|
||||
return@getPathFromUri path.substringBefore(
|
||||
activity.getString(R.string.android_directory_seperator)
|
||||
)
|
||||
.plus(File.separator).plus(originalPath)
|
||||
dFile.uri.path?.let { file ->
|
||||
val originalPath = file.substring(
|
||||
file.lastIndexOf(":") + 1
|
||||
)
|
||||
val path = "${activity.getExternalFilesDirs("")[1]}"
|
||||
return@getPathFromUri path.substringBefore(
|
||||
activity.getString(R.string.android_directory_seperator)
|
||||
)
|
||||
.plus(File.separator).plus(originalPath)
|
||||
}
|
||||
}
|
||||
activity.toast(activity.resources.getString(R.string.error_occurred), Toast.LENGTH_SHORT)
|
||||
activity.toast(
|
||||
activity.resources
|
||||
.getString(R.string.system_unable_to_grant_permission_message),
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
} ?: run {
|
||||
activity.toast(activity.resources.getString(R.string.error_occurred), Toast.LENGTH_SHORT)
|
||||
activity.toast(
|
||||
activity.resources
|
||||
.getString(R.string.system_unable_to_grant_permission_message),
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -297,7 +297,7 @@
|
||||
<string name="not_allowed">Not allowed</string>
|
||||
<string name="android_directory_seperator" translatable="false">/Android</string>
|
||||
<string name="select_folder" translatable="false">Please select a folder for external storage.</string>
|
||||
<string name="error_occurred" translatable="false">System unable to grant permission!</string>
|
||||
<string name="system_unable_to_grant_permission_message" translatable="false">System unable to grant permission!</string>
|
||||
<string-array name="pref_night_modes_entries">
|
||||
<item>@string/on</item>
|
||||
<item>@string/off</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user