mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-13 09:26:52 -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)
|
getPathFromUri(requireActivity(), data)?.let(sharedPreferenceUtil::putPrefStorage)
|
||||||
sharedPreferenceUtil.putStoragePosition(EXTERNAL_SELECT_POSITION)
|
sharedPreferenceUtil.putStoragePosition(EXTERNAL_SELECT_POSITION)
|
||||||
} ?: run {
|
} ?: 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="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="send_files_title">Send Files</string>
|
||||||
<string name="receive_files_title">Receive Files</string>
|
<string name="receive_files_title">Receive Files</string>
|
||||||
<string name="error_occurred" translatable="false">System unable to grant permission!</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -45,7 +45,6 @@ dependencies {
|
|||||||
// SquiDB
|
// SquiDB
|
||||||
implementation(Libs.squidb)
|
implementation(Libs.squidb)
|
||||||
implementation(Libs.squidb_annotations)
|
implementation(Libs.squidb_annotations)
|
||||||
implementation("androidx.documentfile:documentfile:1.0.1")
|
|
||||||
add("kapt", Libs.squidb_processor)
|
add("kapt", Libs.squidb_processor)
|
||||||
|
|
||||||
// Document File
|
// Document File
|
||||||
|
@ -242,15 +242,16 @@ object FileUtils {
|
|||||||
or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
|
||||||
uri?.let {
|
uri?.let {
|
||||||
activity.grantUriPermission(
|
activity.grantUriPermission(
|
||||||
activity.packageName, uri,
|
activity.packageName, it,
|
||||||
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
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) {
|
if (dFile != null) {
|
||||||
val originalPath = dFile.uri.path!!.substring(
|
dFile.uri.path?.let { file ->
|
||||||
dFile.uri.path!!.lastIndexOf(":") + 1
|
val originalPath = file.substring(
|
||||||
|
file.lastIndexOf(":") + 1
|
||||||
)
|
)
|
||||||
val path = "${activity.getExternalFilesDirs("")[1]}"
|
val path = "${activity.getExternalFilesDirs("")[1]}"
|
||||||
return@getPathFromUri path.substringBefore(
|
return@getPathFromUri path.substringBefore(
|
||||||
@ -258,9 +259,18 @@ object FileUtils {
|
|||||||
)
|
)
|
||||||
.plus(File.separator).plus(originalPath)
|
.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 {
|
} ?: 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
|
return null
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@
|
|||||||
<string name="not_allowed">Not allowed</string>
|
<string name="not_allowed">Not allowed</string>
|
||||||
<string name="android_directory_seperator" translatable="false">/Android</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="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">
|
<string-array name="pref_night_modes_entries">
|
||||||
<item>@string/on</item>
|
<item>@string/on</item>
|
||||||
<item>@string/off</item>
|
<item>@string/off</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user