From 0f5fef8509637d46f793212f330dc4b60f30cf22 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 4 Feb 2023 15:45:47 +0100 Subject: [PATCH] misc code style fixes --- .../gallery/pro/adapters/FiltersAdapter.kt | 4 ++-- .../gallery/pro/adapters/ManageHiddenFoldersAdapter.kt | 4 ---- .../simplemobiletools/gallery/pro/extensions/Activity.kt | 3 +-- .../gallery/pro/extensions/ExifInterface.kt | 7 ++++--- .../simplemobiletools/gallery/pro/helpers/Constants.kt | 7 ------- .../gallery/pro/helpers/GridSpacingItemDecoration.kt | 8 +++++--- .../com/simplemobiletools/gallery/pro/models/Favorite.kt | 9 +++++---- .../com/simplemobiletools/gallery/pro/models/Widget.kt | 7 ++++--- 8 files changed, 21 insertions(+), 28 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/FiltersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/FiltersAdapter.kt index b614787b8..550900a22 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/FiltersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/FiltersAdapter.kt @@ -8,9 +8,9 @@ import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.models.FilterItem import kotlinx.android.synthetic.main.editor_filter_item.view.* -import java.util.* -class FiltersAdapter(val context: Context, val filterItems: ArrayList, val itemClick: (Int) -> Unit) : RecyclerView.Adapter() { +class FiltersAdapter(val context: Context, val filterItems: ArrayList, val itemClick: (Int) -> Unit) : + RecyclerView.Adapter() { private var currentSelection = filterItems.first() private var strokeBackground = context.resources.getDrawable(R.drawable.stroke_background) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt index 6fd74500d..25b764a6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt @@ -10,18 +10,14 @@ import com.simplemobiletools.commons.extensions.isPathOnSD import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.pro.R -import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.extensions.removeNoMedia import kotlinx.android.synthetic.main.item_manage_folder.view.* -import java.util.* class ManageHiddenFoldersAdapter( activity: BaseSimpleActivity, var folders: ArrayList, val listener: RefreshRecyclerViewListener?, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit ) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { - private val config = activity.config - init { setupDragListener(true) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 5d80aad58..450cc43a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -88,8 +88,7 @@ fun SimpleActivity.launchSettings() { fun SimpleActivity.launchAbout() { val licenses = LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_RTL or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE or - LICENSE_PICASSO or LICENSE_EXOPLAYER or LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS or LICENSE_GESTURE_VIEWS or - LICENSE_APNG + LICENSE_PICASSO or LICENSE_EXOPLAYER or LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS or LICENSE_GESTURE_VIEWS or LICENSE_APNG val faqItems = arrayListOf( FAQItem(R.string.faq_3_title, R.string.faq_3_text), diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ExifInterface.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ExifInterface.kt index 26d923fc0..6522c828b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ExifInterface.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/ExifInterface.kt @@ -34,7 +34,8 @@ private class ExifInterfaceAttributes { ExifInterface.TAG_PIXEL_Y_DIMENSION, ExifInterface.TAG_THUMBNAIL_IMAGE_LENGTH, ExifInterface.TAG_THUMBNAIL_IMAGE_WIDTH, - ExifInterface.TAG_ORIENTATION) + ExifInterface.TAG_ORIENTATION + ) return tagFields .map { tagField -> tagField.get(null) as String } @@ -44,8 +45,8 @@ private class ExifInterfaceAttributes { private fun isExif(field: Field): Boolean { return field.type == String::class.java && - isPublicStaticFinal(field.modifiers) && - field.name.startsWith("TAG_") + isPublicStaticFinal(field.modifiers) && + field.name.startsWith("TAG_") } private const val publicStaticFinal = Modifier.PUBLIC or Modifier.STATIC or Modifier.FINAL diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 79dae19eb..767c0cad1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -226,13 +226,6 @@ const val ASPECT_RATIO_FOUR_THREE = 2 const val ASPECT_RATIO_SIXTEEN_NINE = 3 const val ASPECT_RATIO_OTHER = 4 -// some constants related to zooming videos -const val MIN_VIDEO_ZOOM_SCALE = 1f -const val MAX_VIDEO_ZOOM_SCALE = 5f -const val ZOOM_MODE_NONE = 0 -const val ZOOM_MODE_DRAG = 1 -const val ZOOM_MODE_ZOOM = 2 - // constants related to image quality const val LOW_TILE_DPI = 160 const val NORMAL_TILE_DPI = 220 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/GridSpacingItemDecoration.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/GridSpacingItemDecoration.kt index 7b082fe78..227833039 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/GridSpacingItemDecoration.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/GridSpacingItemDecoration.kt @@ -6,11 +6,13 @@ import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.models.ThumbnailItem -class GridSpacingItemDecoration(val spanCount: Int, val spacing: Int, val isScrollingHorizontally: Boolean, val addSideSpacing: Boolean, - var items: ArrayList, val useGridPosition: Boolean) : RecyclerView.ItemDecoration() { +class GridSpacingItemDecoration( + val spanCount: Int, val spacing: Int, val isScrollingHorizontally: Boolean, val addSideSpacing: Boolean, + var items: ArrayList, val useGridPosition: Boolean +) : RecyclerView.ItemDecoration() { override fun toString() = "spanCount: $spanCount, spacing: $spacing, isScrollingHorizontally: $isScrollingHorizontally, addSideSpacing: $addSideSpacing, " + - "items: ${items.hashCode()}, useGridPosition: $useGridPosition" + "items: ${items.hashCode()}, useGridPosition: $useGridPosition" override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { if (spacing <= 1) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Favorite.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Favorite.kt index 8f37a9b41..a1bd56ac3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Favorite.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Favorite.kt @@ -7,7 +7,8 @@ import androidx.room.PrimaryKey @Entity(tableName = "favorites", indices = [Index(value = ["full_path"], unique = true)]) data class Favorite( - @PrimaryKey(autoGenerate = true) var id: Int?, - @ColumnInfo(name = "full_path") var fullPath: String, - @ColumnInfo(name = "filename") var filename: String, - @ColumnInfo(name = "parent_path") var parentPath: String) + @PrimaryKey(autoGenerate = true) var id: Int?, + @ColumnInfo(name = "full_path") var fullPath: String, + @ColumnInfo(name = "filename") var filename: String, + @ColumnInfo(name = "parent_path") var parentPath: String +) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Widget.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Widget.kt index 2ef525334..2efa88f34 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Widget.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Widget.kt @@ -7,6 +7,7 @@ import androidx.room.PrimaryKey @Entity(tableName = "widgets", indices = [(Index(value = ["widget_id"], unique = true))]) data class Widget( - @PrimaryKey(autoGenerate = true) var id: Int?, - @ColumnInfo(name = "widget_id") var widgetId: Int, - @ColumnInfo(name = "folder_path") var folderPath: String) + @PrimaryKey(autoGenerate = true) var id: Int?, + @ColumnInfo(name = "widget_id") var widgetId: Int, + @ColumnInfo(name = "folder_path") var folderPath: String +)