From 53eafb30c601c8932c56392f702181cbaee8d98e Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 29 Nov 2021 19:17:48 +0100 Subject: [PATCH] updating commons, lets just make it compilable for now --- app/build.gradle | 2 +- .../gallery/pro/activities/MainActivity.kt | 34 +++++----- .../gallery/pro/activities/MediaActivity.kt | 24 +++---- .../gallery/pro/activities/SearchActivity.kt | 17 ++--- .../pro/activities/ViewPagerActivity.kt | 8 +-- .../gallery/pro/adapters/DirectoryAdapter.kt | 9 ++- .../pro/adapters/ManageFoldersAdapter.kt | 6 +- .../adapters/ManageHiddenFoldersAdapter.kt | 6 +- .../gallery/pro/adapters/MediaAdapter.kt | 5 +- .../pro/dialogs/PickDirectoryDialog.kt | 27 ++++---- .../gallery/pro/dialogs/PickMediumDialog.kt | 8 +-- app/src/main/res/layout/activity_main.xml | 45 ++++--------- app/src/main/res/layout/activity_media.xml | 41 ++++-------- app/src/main/res/layout/activity_search.xml | 40 +++-------- app/src/main/res/layout/bottom_actions.xml | 43 ++++++------ .../res/layout/dialog_directory_picker.xml | 43 ++++-------- .../main/res/layout/dialog_medium_picker.xml | 41 ++++-------- app/src/main/res/menu/cab_directories.xml | 10 +-- app/src/main/res/menu/cab_hidden_folders.xml | 4 +- app/src/main/res/menu/cab_media.xml | 54 +++++++-------- app/src/main/res/menu/menu_add_folder.xml | 4 +- app/src/main/res/menu/menu_editor.xml | 8 +-- .../main/res/menu/menu_included_folders.xml | 4 +- app/src/main/res/menu/menu_main.xml | 6 +- app/src/main/res/menu/menu_main_intent.xml | 6 +- app/src/main/res/menu/menu_media.xml | 6 +- app/src/main/res/menu/menu_search.xml | 6 +- app/src/main/res/menu/menu_set_wallpaper.xml | 4 +- app/src/main/res/menu/menu_video_player.xml | 8 +-- app/src/main/res/menu/menu_viewpager.xml | 67 ++++++++++--------- app/src/main/res/menu/photo_video_menu.xml | 16 ++--- 31 files changed, 259 insertions(+), 343 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ec5cc10bb..f9de7431a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:b205a97a9f' + implementation 'com.github.SimpleMobileTools:Simple-Commons:2394310c39' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index e2cc713c1..fbd23fc8f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -188,8 +188,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val adjustedPrimaryColor = getAdjustedPrimaryColor() if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) { getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor) - directories_vertical_fastscroller.updatePrimaryColor(adjustedPrimaryColor) - directories_horizontal_fastscroller.updatePrimaryColor(adjustedPrimaryColor) } val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}" @@ -197,8 +195,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { setupAdapter(mDirs, forceRecreate = true) } - directories_horizontal_fastscroller.updateBubbleColors() - directories_vertical_fastscroller.updateBubbleColors() + directories_fastscroller.updateColors(adjustedPrimaryColor) directories_refresh_layout.isEnabled = config.enablePullToRefresh directories_empty_placeholder.setTextColor(config.textColor) @@ -682,8 +679,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { columnCount * thumbnailWidth } - directories_horizontal_fastscroller.setContentWidth(fullWidth) - directories_horizontal_fastscroller.setScrollToX(directories_grid.computeHorizontalScrollOffset()) + /*directories_horizontal_fastscroller.setContentWidth(fullWidth) + directories_horizontal_fastscroller.setScrollToX(directories_grid.computeHorizontalScrollOffset())*/ } private fun calculateContentHeight(directories: ArrayList) { @@ -702,8 +699,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { rowCount * thumbnailHeight } - directories_vertical_fastscroller.setContentHeight(fullHeight) - directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset()) + /*directories_vertical_fastscroller.setContentHeight(fullHeight) + directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset())*/ } private fun initZoomListener() { @@ -921,8 +918,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { checkPlaceholderVisibility(dirs) val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID - directories_vertical_fastscroller.beVisibleIf(directories_grid.isVisible() && !allowHorizontalScroll) - directories_horizontal_fastscroller.beVisibleIf(directories_grid.isVisible() && allowHorizontalScroll) + /*directories_vertical_fastscroller.beVisibleIf(directories_grid.isVisible() && !allowHorizontalScroll) + directories_horizontal_fastscroller.beVisibleIf(directories_grid.isVisible() && allowHorizontalScroll)*/ setupAdapter(dirs.clone() as ArrayList) } @@ -931,13 +928,19 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mLastMediaFetcher = MediaFetcher(applicationContext) val getImagesOnly = mIsPickImageIntent || mIsGetImageContentIntent val getVideosOnly = mIsPickVideoIntent || mIsGetVideoContentIntent + val favoritePaths = getFavoritePaths() + + /*if (isRPlus()) { + mLastMediaFetcher!!.getAndroid11FolderMedia(getImagesOnly, getVideosOnly, favoritePaths) + return + }*/ + val hiddenString = getString(R.string.hidden) val albumCovers = config.parseAlbumCovers() val includedFolders = config.includedFolders val noMediaFolders = getNoMediaFoldersSync() val tempFolderPath = config.tempFolderPath val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 - val favoritePaths = getFavoritePaths() val dirPathsToRemove = ArrayList() val lastModifieds = mLastMediaFetcher!!.getLastModifieds() val dateTakens = mLastMediaFetcher!!.getDateTakens() @@ -998,6 +1001,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize, noMediaFolders) } + //mydebug("end ${System.currentTimeMillis() - time} ${directory.name}") // we are looping through the already displayed folders looking for changes, do not do anything if nothing changed if (directory.copy(subfoldersCount = 0, subfoldersMediaCount = 0) == newDir) { continue @@ -1224,15 +1228,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { if (currAdapter == null || forceRecreate) { initZoomListener() - val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller DirectoryAdapter( this, dirsToShow, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent), - directories_refresh_layout, - fastscroller + directories_refresh_layout ) { val clickedDir = it as Directory val path = clickedDir.path @@ -1278,7 +1280,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun setupScrollDirection() { val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID - directories_vertical_fastscroller.isHorizontal = false + /*directories_vertical_fastscroller.isHorizontal = false directories_vertical_fastscroller.beGoneIf(allowHorizontalScroll) directories_horizontal_fastscroller.isHorizontal = true @@ -1292,7 +1294,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it)) } - } + }*/ } private fun checkInvalidDirectories(dirs: ArrayList) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 665e1f94f..04f49d4b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -153,8 +153,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val adjustedPrimaryColor = getAdjustedPrimaryColor() if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) { getMediaAdapter()?.updatePrimaryColor(config.primaryColor) - media_horizontal_fastscroller.updatePrimaryColor(adjustedPrimaryColor) - media_vertical_fastscroller.updatePrimaryColor(adjustedPrimaryColor) } if (mStoredThumbnailSpacing != config.thumbnailSpacing) { @@ -167,8 +165,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { setupAdapter() } - media_horizontal_fastscroller.updateBubbleColors() - media_vertical_fastscroller.updateBubbleColors() + media_fastscroller.updateColors(adjustedPrimaryColor) media_refresh_layout.isEnabled = config.enablePullToRefresh media_empty_text_placeholder.setTextColor(config.textColor) media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) @@ -410,10 +407,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val currAdapter = media_grid.adapter if (currAdapter == null) { initZoomListener() - val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller MediaAdapter( this, mMedia.clone() as ArrayList, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, - mAllowPickingMultiple, mPath, media_grid, fastscroller + mAllowPickingMultiple, mPath, media_grid ) { if (it is Medium && !isFinishing) { itemClicked(it.path) @@ -445,7 +441,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private fun setupScrollDirection() { val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath) val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID - media_vertical_fastscroller.isHorizontal = false + /*media_vertical_fastscroller.isHorizontal = false media_vertical_fastscroller.beGoneIf(allowHorizontalScroll) media_horizontal_fastscroller.isHorizontal = true @@ -460,7 +456,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) { media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } - } + }*/ } private fun getBubbleTextItem(index: Int, sorting: Int): String { @@ -734,8 +730,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 val spacing = config.thumbnailSpacing val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * (thumbnailWidth + spacing) - spacing - media_horizontal_fastscroller.setContentWidth(fullWidth) - media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset()) + /*media_horizontal_fastscroller.setContentWidth(fullWidth) + media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset())*/ } private fun calculateContentHeight(media: ArrayList) { @@ -762,8 +758,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val spacing = config.thumbnailSpacing fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * (thumbnailHeight + spacing) - spacing - media_vertical_fastscroller.setContentHeight(fullHeight) - media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset()) + /*media_vertical_fastscroller.setContentHeight(fullHeight) + media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset())*/ } private fun handleGridSpacing(media: ArrayList = mMedia) { @@ -932,8 +928,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath) val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID - media_vertical_fastscroller.beVisibleIf(media_grid.isVisible() && !allowHorizontalScroll) - media_horizontal_fastscroller.beVisibleIf(media_grid.isVisible() && allowHorizontalScroll) + /*media_vertical_fastscroller.beVisibleIf(media_grid.isVisible() && !allowHorizontalScroll) + media_horizontal_fastscroller.beVisibleIf(media_grid.isVisible() && allowHorizontalScroll)*/ setupAdapter() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index 450296e20..905ad988c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -30,8 +30,6 @@ import kotlinx.android.synthetic.main.activity_media.* import kotlinx.android.synthetic.main.activity_search.* import kotlinx.android.synthetic.main.activity_search.media_empty_text_placeholder import kotlinx.android.synthetic.main.activity_search.media_grid -import kotlinx.android.synthetic.main.activity_search.media_horizontal_fastscroller -import kotlinx.android.synthetic.main.activity_search.media_vertical_fastscroller import java.io.File class SearchActivity : SimpleActivity(), MediaOperationsListener { @@ -136,8 +134,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { private fun setupAdapter() { val currAdapter = media_grid.adapter if (currAdapter == null) { - val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller - MediaAdapter(this, ArrayList(), this, false, false, "", media_grid, fastscroller) { + MediaAdapter(this, ArrayList(), this, false, false, "", media_grid) { if (it is Medium) { itemClicked(it.path) } @@ -233,7 +230,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { private fun setupScrollDirection() { val viewType = config.getFolderViewType(SHOW_ALL) val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID - media_vertical_fastscroller.isHorizontal = false + /*media_vertical_fastscroller.isHorizontal = false media_vertical_fastscroller.beGoneIf(allowHorizontalScroll) media_horizontal_fastscroller.isHorizontal = true @@ -248,7 +245,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { media_vertical_fastscroller.setViews(media_grid) { media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } - } + }*/ } private fun getBubbleTextItem(index: Int, sorting: Int): String { @@ -274,8 +271,8 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { val layoutManager = media_grid.layoutManager as MyGridLayoutManager val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * thumbnailWidth - media_horizontal_fastscroller.setContentWidth(fullWidth) - media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset()) + /*media_horizontal_fastscroller.setContentWidth(fullWidth) + media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset())*/ } private fun calculateContentHeight(media: ArrayList) { @@ -301,8 +298,8 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { } fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * thumbnailHeight - media_vertical_fastscroller.setContentHeight(fullHeight) - media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset()) + /*media_vertical_fastscroller.setContentHeight(fullHeight) + media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset())*/ } private fun getAllMedia() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 91408e621..0f35852a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -895,10 +895,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } - val favoriteIcon = if (medium.isFavorite) R.drawable.ic_star_on_vector else R.drawable.ic_star_off_vector + val favoriteIcon = if (medium.isFavorite) R.drawable.ic_star_vector else R.drawable.ic_star_outline_vector bottom_favorite.setImageResource(favoriteIcon) - val hideIcon = if (medium.isHidden()) R.drawable.ic_unhide_vector else R.drawable.ic_hide + val hideIcon = if (medium.isHidden()) R.drawable.ic_unhide_vector else R.drawable.ic_hide_vector bottom_toggle_file_visibility.setImageResource(hideIcon) bottom_rotate.beVisibleIf(config.visibleBottomActions and BOTTOM_ACTION_ROTATE != 0 && getCurrentMedium()?.isImage() == true) @@ -929,7 +929,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View printHelper.orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT try { - val resolution = path.getImageResolution() + val resolution = path.getImageResolution(this) if (resolution == null) { toast(R.string.unknown_error_occurred) return @@ -987,7 +987,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View @TargetApi(Build.VERSION_CODES.N) private fun resizeImage() { val oldPath = getCurrentPath() - val originalSize = oldPath.getImageResolution() ?: return + val originalSize = oldPath.getImageResolution(this) ?: return ResizeWithPathDialog(this, originalSize, oldPath) { newSize, newPath -> ensureBackgroundThread { try { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 1011ea2cb..1bf6f07cc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -26,7 +26,6 @@ import com.simplemobiletools.commons.interfaces.ItemMoveCallback import com.simplemobiletools.commons.interfaces.ItemTouchHelperContract import com.simplemobiletools.commons.interfaces.StartReorderDragListener import com.simplemobiletools.commons.models.FileDirItem -import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.MediaActivity @@ -56,9 +55,9 @@ import kotlin.collections.HashMap class DirectoryAdapter( activity: BaseSimpleActivity, var dirs: ArrayList, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView, - val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit + val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, itemClick: (Any) -> Unit ) : - MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick), ItemTouchHelperContract { + MyRecyclerViewAdapter(activity, recyclerView, itemClick), ItemTouchHelperContract { private val config = activity.config private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST @@ -616,9 +615,9 @@ class DirectoryAdapter( val selectedDirs = getSelectedItems() selectedDirs.forEach { val path = it.path - if (activity.needsStupidWritePermissions(path) && config.treeUri.isEmpty()) { + /*if (activity.needsStupidWritePermissions(path) && config.treeUri.isEmpty()) { SAFPath = path - } + }*/ } activity.handleSAFDialog(SAFPath) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt index 670174413..4b9339554 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt @@ -12,8 +12,10 @@ import com.simplemobiletools.gallery.pro.extensions.config import kotlinx.android.synthetic.main.item_manage_folder.view.* import java.util.* -class ManageFoldersAdapter(activity: BaseSimpleActivity, var folders: ArrayList, val isShowingExcludedFolders: Boolean, val listener: RefreshRecyclerViewListener?, - recyclerView: MyRecyclerView, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, null, itemClick) { +class ManageFoldersAdapter( + activity: BaseSimpleActivity, var folders: ArrayList, val isShowingExcludedFolders: Boolean, val listener: RefreshRecyclerViewListener?, + recyclerView: MyRecyclerView, itemClick: (Any) -> Unit +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val config = activity.config 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 972d3e7a1..79e67867e 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 @@ -14,8 +14,10 @@ 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, null, itemClick) { +class ManageHiddenFoldersAdapter( + activity: BaseSimpleActivity, var folders: ArrayList, val listener: RefreshRecyclerViewListener?, + recyclerView: MyRecyclerView, itemClick: (Any) -> Unit +) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val config = activity.config diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index f052d1d7e..9bd5e308b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -20,7 +20,6 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem -import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.ViewPagerActivity @@ -42,9 +41,9 @@ import java.util.* class MediaAdapter( activity: BaseSimpleActivity, var media: ArrayList, val listener: MediaOperationsListener?, val isAGetIntent: Boolean, - val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit + val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, itemClick: (Any) -> Unit ) : - MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { + MyRecyclerViewAdapter(activity, recyclerView, itemClick) { private val INSTANT_LOAD_DURATION = 2000L private val IMAGE_LOAD_DELAY = 100L diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt index 53ee995c2..36b1089be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt @@ -14,8 +14,10 @@ import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.models.Directory import kotlinx.android.synthetic.main.dialog_directory_picker.view.* -class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, showOtherFolderButton: Boolean, val showFavoritesBin: Boolean, - val callback: (path: String) -> Unit) { +class PickDirectoryDialog( + val activity: BaseSimpleActivity, val sourcePath: String, showOtherFolderButton: Boolean, val showFavoritesBin: Boolean, + val callback: (path: String) -> Unit +) { private var dialog: AlertDialog private var shownDirectories = ArrayList() private var allDirectories = ArrayList() @@ -32,14 +34,14 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri } val builder = AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) - .setOnKeyListener { dialogInterface, i, keyEvent -> - if (keyEvent.action == KeyEvent.ACTION_UP && i == KeyEvent.KEYCODE_BACK) { - backPressed() - } - true + .setPositiveButton(R.string.ok, null) + .setNegativeButton(R.string.cancel, null) + .setOnKeyListener { dialogInterface, i, keyEvent -> + if (keyEvent.action == KeyEvent.ACTION_UP && i == KeyEvent.KEYCODE_BACK) { + backPressed() } + true + } if (showOtherFolderButton) { builder.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() } @@ -90,7 +92,8 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri allDirectories = newDirs.clone() as ArrayList } - val distinctDirs = newDirs.filter { showFavoritesBin || (!it.isRecycleBin() && !it.areFavorites()) }.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList + val distinctDirs = newDirs.filter { showFavoritesBin || (!it.isRecycleBin() && !it.areFavorites()) }.distinctBy { it.path.getDistinctPath() } + .toMutableList() as ArrayList val sortedDirs = activity.getSortedDirectories(distinctDirs) val dirs = activity.getDirsToShow(sortedDirs, allDirectories, currentPathPrefix).clone() as ArrayList if (dirs.hashCode() == shownDirectories.hashCode()) { @@ -127,7 +130,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri view.apply { directories_grid.adapter = adapter - directories_vertical_fastscroller.isHorizontal = false + /*directories_vertical_fastscroller.isHorizontal = false directories_vertical_fastscroller.beGoneIf(scrollHorizontally) directories_horizontal_fastscroller.isHorizontal = true @@ -141,7 +144,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri directories_vertical_fastscroller.setViews(directories_grid) { directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity, dateFormat, timeFormat)) } - } + }*/ } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt index 1e3b2465e..9d16dd0fc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt @@ -3,8 +3,6 @@ package com.simplemobiletools.gallery.pro.dialogs import androidx.appcompat.app.AlertDialog import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.extensions.beGoneIf -import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getTimeFormat import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID @@ -66,7 +64,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c return shownMedia = media - val adapter = MediaAdapter(activity, shownMedia.clone() as ArrayList, null, true, false, path, view.media_grid, null) { + val adapter = MediaAdapter(activity, shownMedia.clone() as ArrayList, null, true, false, path, view.media_grid) { if (it is Medium) { callback(it.path) dialog.dismiss() @@ -80,7 +78,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c view.apply { media_grid.adapter = adapter - media_vertical_fastscroller.isHorizontal = false + /*media_vertical_fastscroller.isHorizontal = false media_vertical_fastscroller.beGoneIf(scrollHorizontally) media_horizontal_fastscroller.isHorizontal = true @@ -96,7 +94,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c val medium = (media[it] as? Medium) media_vertical_fastscroller.updateBubbleText(medium?.getBubbleText(sorting, activity, dateFormat, timeFormat) ?: "") } - } + }*/ } } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 905823c41..d06c0a5f7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -47,40 +47,23 @@ android:textSize="@dimen/bigger_text_size" android:visibility="gone" /> - - - - - - - - - + android:layout_below="@+id/directories_switch_searching" + app:supportSwipeToRefresh="true"> - + - + diff --git a/app/src/main/res/layout/activity_media.xml b/app/src/main/res/layout/activity_media.xml index c17033620..8532644ff 100644 --- a/app/src/main/res/layout/activity_media.xml +++ b/app/src/main/res/layout/activity_media.xml @@ -36,38 +36,21 @@ android:textSize="@dimen/bigger_text_size" android:visibility="gone" /> - - - - - - - - - + app:supportSwipeToRefresh="true"> - + - + diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 6ab0974b7..e16962452 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -19,36 +19,18 @@ android:textStyle="italic" android:visibility="gone" /> - + android:layout_height="wrap_content"> - + - - - - - - - - - + diff --git a/app/src/main/res/layout/bottom_actions.xml b/app/src/main/res/layout/bottom_actions.xml index e03791630..bcab016a1 100644 --- a/app/src/main/res/layout/bottom_actions.xml +++ b/app/src/main/res/layout/bottom_actions.xml @@ -1,6 +1,5 @@ - + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> + app:layout_constraintVertical_bias="0.0" /> diff --git a/app/src/main/res/layout/dialog_directory_picker.xml b/app/src/main/res/layout/dialog_directory_picker.xml index a3cc14860..cc37ccf14 100644 --- a/app/src/main/res/layout/dialog_directory_picker.xml +++ b/app/src/main/res/layout/dialog_directory_picker.xml @@ -1,6 +1,5 @@ - - + android:layout_height="wrap_content"> - + - - - - - - - - - + + android:visibility="gone" /> diff --git a/app/src/main/res/layout/dialog_medium_picker.xml b/app/src/main/res/layout/dialog_medium_picker.xml index cc06575dc..7af877f6f 100644 --- a/app/src/main/res/layout/dialog_medium_picker.xml +++ b/app/src/main/res/layout/dialog_medium_picker.xml @@ -1,39 +1,22 @@ - - + android:layout_height="wrap_content"> - + - - - - - - - - - + diff --git a/app/src/main/res/menu/cab_directories.xml b/app/src/main/res/menu/cab_directories.xml index 196107fda..04590cd9d 100644 --- a/app/src/main/res/menu/cab_directories.xml +++ b/app/src/main/res/menu/cab_directories.xml @@ -5,12 +5,12 @@ android:id="@+id/cab_move_to_top" android:icon="@drawable/ic_move_to_top_vector" android:title="@string/move_to_top" - app:showAsAction="ifRoom"/> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index cb8dda1e9..4d78fae54 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -1,21 +1,21 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + android:title="@string/rotate_right" /> + android:title="@string/rotate_left" /> + android:title="@string/rotate_one_eighty" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_add_folder.xml b/app/src/main/res/menu/menu_add_folder.xml index 3551a8a4d..1addb1988 100644 --- a/app/src/main/res/menu/menu_add_folder.xml +++ b/app/src/main/res/menu/menu_add_folder.xml @@ -1,9 +1,9 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_editor.xml b/app/src/main/res/menu/menu_editor.xml index 16a5f7806..1b8d9941b 100644 --- a/app/src/main/res/menu/menu_editor.xml +++ b/app/src/main/res/menu/menu_editor.xml @@ -1,19 +1,19 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_included_folders.xml b/app/src/main/res/menu/menu_included_folders.xml index 3551a8a4d..1addb1988 100644 --- a/app/src/main/res/menu/menu_included_folders.xml +++ b/app/src/main/res/menu/menu_included_folders.xml @@ -1,9 +1,9 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index ca197dc82..b692552fe 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -64,10 +64,12 @@ app:showAsAction="never" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_main_intent.xml b/app/src/main/res/menu/menu_main_intent.xml index 30df345bd..18ad227a6 100644 --- a/app/src/main/res/menu/menu_main_intent.xml +++ b/app/src/main/res/menu/menu_main_intent.xml @@ -1,12 +1,12 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="never" /> + app:showAsAction="never" /> diff --git a/app/src/main/res/menu/menu_media.xml b/app/src/main/res/menu/menu_media.xml index 1c4c61146..346d810c6 100644 --- a/app/src/main/res/menu/menu_media.xml +++ b/app/src/main/res/menu/menu_media.xml @@ -85,10 +85,12 @@ app:showAsAction="never" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_search.xml b/app/src/main/res/menu/menu_search.xml index c695b68da..db61d6da2 100644 --- a/app/src/main/res/menu/menu_search.xml +++ b/app/src/main/res/menu/menu_search.xml @@ -1,15 +1,15 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="collapseActionView|always" /> + app:showAsAction="always" /> diff --git a/app/src/main/res/menu/menu_set_wallpaper.xml b/app/src/main/res/menu/menu_set_wallpaper.xml index a10009346..094f0f745 100644 --- a/app/src/main/res/menu/menu_set_wallpaper.xml +++ b/app/src/main/res/menu/menu_set_wallpaper.xml @@ -1,9 +1,9 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_video_player.xml b/app/src/main/res/menu/menu_video_player.xml index 62d8c48c4..86b92e808 100644 --- a/app/src/main/res/menu/menu_video_player.xml +++ b/app/src/main/res/menu/menu_video_player.xml @@ -1,18 +1,18 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> diff --git a/app/src/main/res/menu/menu_viewpager.xml b/app/src/main/res/menu/menu_viewpager.xml index d0913803e..cdaa76c7d 100644 --- a/app/src/main/res/menu/menu_viewpager.xml +++ b/app/src/main/res/menu/menu_viewpager.xml @@ -1,22 +1,22 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + android:title="@string/rotate_right" /> + android:title="@string/rotate_left" /> + android:title="@string/rotate_one_eighty" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> + android:title="@string/force_portrait" /> + android:title="@string/force_landscape" /> + android:title="@string/use_default_orientation" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="never" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/photo_video_menu.xml b/app/src/main/res/menu/photo_video_menu.xml index eb7372b40..2cafe7c50 100644 --- a/app/src/main/res/menu/photo_video_menu.xml +++ b/app/src/main/res/menu/photo_video_menu.xml @@ -1,32 +1,32 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" /> + app:showAsAction="never" /> + app:showAsAction="never" />