disable compression on OTG devices for now

This commit is contained in:
tibbi 2018-02-16 19:38:13 +01:00
parent ad2c644f29
commit f6b6d4a872
2 changed files with 12 additions and 2 deletions

View file

@ -221,14 +221,19 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
private fun compressSelection() { private fun compressSelection() {
val firstPath = fileDirItems[selectedPositions.first()].path val firstPath = fileDirItems[selectedPositions.first()].path
if (activity.isPathOnOTG(firstPath)) {
activity.toast(R.string.unknown_error_occurred)
return
}
CompressAsDialog(activity, firstPath) { CompressAsDialog(activity, firstPath) {
activity.handleSAFDialog(firstPath) { activity.handleSAFDialog(firstPath) {
activity.toast(R.string.compressing) activity.toast(R.string.compressing)
val paths = selectedPositions.map { fileDirItems[it].path } val paths = selectedPositions.map { fileDirItems[it].path }
Thread { Thread {
if (zipPaths(paths, it)) { if (zipPaths(paths, it)) {
activity.toast(R.string.compression_successful)
activity.runOnUiThread { activity.runOnUiThread {
activity.toast(R.string.compression_successful)
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()
} }
@ -242,6 +247,11 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
private fun decompressSelection() { private fun decompressSelection() {
val firstPath = fileDirItems[selectedPositions.first()].path val firstPath = fileDirItems[selectedPositions.first()].path
if (activity.isPathOnOTG(firstPath)) {
activity.toast(R.string.unknown_error_occurred)
return
}
activity.handleSAFDialog(firstPath) { activity.handleSAFDialog(firstPath) {
activity.toast(R.string.decompressing) activity.toast(R.string.decompressing)
val paths = selectedPositions.map { fileDirItems[it].path }.filter { it.isZipFile() } val paths = selectedPositions.map { fileDirItems[it].path }.filter { it.isZipFile() }

View file

@ -33,7 +33,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/file_path" android:layout_below="@+id/file_path"
android:layout_marginTop="@dimen/normal_margin" android:layout_marginTop="@dimen/small_margin"
android:text="@string/filename" android:text="@string/filename"
android:textSize="@dimen/smaller_text_size"/> android:textSize="@dimen/smaller_text_size"/>