diff --git a/CHANGELOG.md b/CHANGELOG.md index d65d24356..a4f494494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 5.1.1 *(2018-10-23)* +---------------------------- + + * Fixing the inability to delete SD card files + Version 5.1.0 *(2018-10-23)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index cfa9e8587..0fc90d3d4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 21 targetSdkVersion 28 - versionCode 204 - versionName "5.1.0" + versionCode 205 + versionName "5.1.1" multiDexEnabled true setProperty("archivesBaseName", "gallery") } @@ -48,7 +48,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.2.0' + implementation 'com.simplemobiletools:commons:5.2.8' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 444097363..56cec98fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -982,9 +982,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun refreshViewPager() { - GetMediaAsynctask(applicationContext, mDirectory, false, false, mShowAll) { - gotMedia(it) - }.execute() + if (config.getFileSorting(mDirectory) and SORT_BY_RANDOM == 0) { + GetMediaAsynctask(applicationContext, mDirectory, false, false, mShowAll) { + gotMedia(it) + }.execute() + } } private fun gotMedia(thumbnailItems: ArrayList) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt index 0c94fb848..104a250cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDatabase.kt @@ -1,9 +1,10 @@ package com.simplemobiletools.gallery.databases +import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase -import android.content.Context +import com.simplemobiletools.gallery.objects.MyExecutor import com.simplemobiletools.gallery.interfaces.DirectoryDao import com.simplemobiletools.gallery.interfaces.MediumDao import com.simplemobiletools.gallery.models.Directory @@ -25,6 +26,7 @@ abstract class GalleryDatabase : RoomDatabase() { if (db == null) { db = Room.databaseBuilder(context.applicationContext, GalleryDatabase::class.java, "gallery.db") .fallbackToDestructiveMigration() + .setQueryExecutor(MyExecutor.myExecutor) .build() db!!.openHelper.setWriteAheadLoggingEnabled(true) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt index 991d93e40..aebce7915 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt @@ -47,6 +47,7 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti currSorting and SORT_BY_SIZE != 0 -> sortingRadio.sorting_dialog_radio_size currSorting and SORT_BY_DATE_MODIFIED != 0 -> sortingRadio.sorting_dialog_radio_last_modified currSorting and SORT_BY_DATE_TAKEN != 0 -> sortingRadio.sorting_dialog_radio_date_taken + currSorting and SORT_BY_RANDOM != 0 -> sortingRadio.sorting_dialog_radio_random else -> sortingRadio.sorting_dialog_radio_name } sortBtn.isChecked = true @@ -69,6 +70,7 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti R.id.sorting_dialog_radio_path -> SORT_BY_PATH R.id.sorting_dialog_radio_size -> SORT_BY_SIZE R.id.sorting_dialog_radio_last_modified -> SORT_BY_DATE_MODIFIED + R.id.sorting_dialog_radio_random -> SORT_BY_RANDOM else -> SORT_BY_DATE_TAKEN } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ResizeDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ResizeDialog.kt index 378d8a524..e34ead6c6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ResizeDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ResizeDialog.kt @@ -1,15 +1,10 @@ package com.simplemobiletools.gallery.dialogs import android.graphics.Point -import androidx.appcompat.app.AlertDialog -import android.text.Editable -import android.text.TextWatcher import android.widget.EditText +import androidx.appcompat.app.AlertDialog import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.extensions.setupDialogStuff -import com.simplemobiletools.commons.extensions.showKeyboard -import com.simplemobiletools.commons.extensions.toast -import com.simplemobiletools.commons.extensions.value +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import kotlinx.android.synthetic.main.resize_image.view.* @@ -24,49 +19,33 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba val ratio = size.x / size.y.toFloat() - widthView.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable?) { - if (widthView.hasFocus()) { - var width = getViewValue(widthView) - if (width > size.x) { - widthView.setText(size.x.toString()) - width = size.x - } + widthView.onTextChangeListener { + if (widthView.hasFocus()) { + var width = getViewValue(widthView) + if (width > size.x) { + widthView.setText(size.x.toString()) + width = size.x + } - if (view.keep_aspect_ratio.isChecked) { - heightView.setText((width / ratio).toInt().toString()) - } + if (view.keep_aspect_ratio.isChecked) { + heightView.setText((width / ratio).toInt().toString()) } } + } - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { - } + heightView.onTextChangeListener { + if (heightView.hasFocus()) { + var height = getViewValue(heightView) + if (height > size.y) { + heightView.setText(size.y.toString()) + height = size.y + } - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - } - }) - - heightView.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable?) { - if (heightView.hasFocus()) { - var height = getViewValue(heightView) - if (height > size.y) { - heightView.setText(size.y.toString()) - height = size.y - } - - if (view.keep_aspect_ratio.isChecked) { - widthView.setText((height * ratio).toInt().toString()) - } + if (view.keep_aspect_ratio.isChecked) { + widthView.setText((height * ratio).toInt().toString()) } } - - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { - } - - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - } - }) + } AlertDialog.Builder(activity) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index 846e44b21..0a54abf6a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -139,6 +139,11 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList + if (sorting and SORT_BY_RANDOM != 0) { + dirs.shuffle() + return movePinnedDirectoriesToFront(dirs) + } + dirs.sortWith(Comparator { o1, o2 -> o1 as Directory o2 as Directory diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 7b7a08997..eaa1b7be5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -344,6 +344,11 @@ class MediaFetcher(val context: Context) { } fun sortMedia(media: ArrayList, sorting: Int) { + if (sorting and SORT_BY_RANDOM != 0) { + media.shuffle() + return + } + media.sortWith(Comparator { o1, o2 -> o1 as Medium o2 as Medium diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt new file mode 100644 index 000000000..c4ff990a9 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/objects/MyExecutor.kt @@ -0,0 +1,7 @@ +package com.simplemobiletools.gallery.objects + +import java.util.concurrent.Executors + +object MyExecutor { + val myExecutor = Executors.newSingleThreadExecutor() +} diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml index e0e642acc..4ac35ce0f 100644 --- a/app/src/main/res/layout/dialog_change_sorting.xml +++ b/app/src/main/res/layout/dialog_change_sorting.xml @@ -11,8 +11,8 @@ android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="@dimen/activity_margin" - android:paddingRight="@dimen/activity_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingTop="@dimen/activity_margin" + android:paddingRight="@dimen/activity_margin"> + + @@ -97,8 +105,8 @@ android:id="@+id/sorting_dialog_use_for_this_folder" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin" + android:paddingBottom="@dimen/activity_margin" android:text="@string/use_for_this_folder"/> diff --git a/app/src/main/res/layout/resize_image.xml b/app/src/main/res/layout/resize_image.xml index 13a3d5d1a..a6071a333 100644 --- a/app/src/main/res/layout/resize_image.xml +++ b/app/src/main/res/layout/resize_image.xml @@ -5,7 +5,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:padding="@dimen/activity_margin"> + android:paddingLeft="@dimen/activity_margin" + android:paddingTop="@dimen/activity_margin" + android:paddingRight="@dimen/activity_margin"> @@ -38,9 +40,9 @@ android:id="@+id/image_height" android:layout_width="100dp" android:layout_height="wrap_content" - android:layout_alignLeft="@+id/image_height_label" - android:layout_alignStart="@+id/image_height_label" android:layout_below="@+id/image_width_label" + android:layout_alignStart="@+id/image_height_label" + android:layout_alignLeft="@+id/image_height_label" android:inputType="number" android:maxLength="6" android:maxLines="1" @@ -54,8 +56,8 @@ android:layout_below="@+id/image_height" android:layout_marginTop="@dimen/activity_margin" android:checked="true" - android:paddingBottom="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin" + android:paddingBottom="@dimen/activity_margin" android:text="@string/keep_aspect_ratio"/> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5483a5f27..bc230b8a9 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -162,7 +162,7 @@ Immagini ingrandibili a fondo Mostra le immagini alla massima qualità possibile Mostra il cestino come ultimo elemento nella schermata principale - Allow closing the fullscreen view with a down gesture + Chiudi la visuale a schermo intero con un gesto verso il basso Miniature diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 46790ef4a..a6b0b62da 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -146,8 +146,8 @@ Horizontaal scrollen Statusbalk automatisch verbergen in volledig scherm Lege mappen verwijderen na leegmaken - Helderheid voor afbeeldingen aanpassen met verticale gebaren - Volume en helderheid voor video\'s aanpassen met verticale gebaren + Helderheid voor afbeeldingen aanpassen met verticale veeggebaren + Volume en helderheid voor video\'s aanpassen met verticale veeggebaren Aantallen in mappen tonen Menu-item Draaien vastzetten in volledig scherm (in plaats van Delen) Uitgebreide informatie tonen in volledig scherm @@ -162,7 +162,7 @@ Afbeeldingen ver inzoomen Afbeeldingen in de hoogst mogelijke kwaliteit weergeven Prullenbak als laatste item tonen - Allow closing the fullscreen view with a down gesture + Naar beneden vegen om volledig scherm af te sluiten Miniatuurvoorbeelden diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0e5981b3a..a4ddc43bf 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -142,7 +142,7 @@ 系统设置 设备方向 根据长宽比 - 全屏时使用黑色背景和状态栏​ + 全屏时使用黑色背景和状态栏 水平滚动缩略图 全屏时自动隐藏状态栏 删除没有内容的空文件夹 @@ -162,7 +162,7 @@ 深度放大图像 以最高质量显示图像 在主屏幕界面的最后一项显示回收站 - Allow closing the fullscreen view with a down gesture + 使用下滑手势关闭全屏视图 缩略图