mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 14:28:00 +01:00
update commons to 3.17.16 with some cosmetic code changes
This commit is contained in:
parent
2515edee44
commit
4c865de301
10 changed files with 45 additions and 43 deletions
|
@ -46,15 +46,15 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:3.17.14'
|
implementation 'com.simplemobiletools:commons:3.17.16'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
|
||||||
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
||||||
|
|
||||||
//implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
|
//implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
|
||||||
implementation 'com.github.tibbi:subsampling-scale-image-view:v3.9.0.6-fork'
|
implementation 'com.github.tibbi:subsampling-scale-image-view:v3.10.0-fork'
|
||||||
|
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
||||||
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
|
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
|
||||||
|
|
|
@ -28,7 +28,6 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
val adapter = ManageFoldersAdapter(this, folders, true, this, manage_folders_list) {}
|
val adapter = ManageFoldersAdapter(this, folders, true, this, manage_folders_list) {}
|
||||||
adapter.setupDragListener(true)
|
|
||||||
manage_folders_list.adapter = adapter
|
manage_folders_list.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
val adapter = ManageHiddenFoldersAdapter(this, it, this, manage_folders_list) {}
|
val adapter = ManageHiddenFoldersAdapter(this, it, this, manage_folders_list) {}
|
||||||
adapter.setupDragListener(true)
|
|
||||||
manage_folders_list.adapter = adapter
|
manage_folders_list.adapter = adapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
val adapter = ManageFoldersAdapter(this, folders, false, this, manage_folders_list) {}
|
val adapter = ManageFoldersAdapter(this, folders, false, this, manage_folders_list) {}
|
||||||
adapter.setupDragListener(true)
|
|
||||||
manage_folders_list.adapter = adapter
|
manage_folders_list.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
private var mStoredShowMediaCount = true
|
private var mStoredShowMediaCount = true
|
||||||
private var mStoredShowInfoBubble = true
|
private var mStoredShowInfoBubble = true
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
|
private var mStoredPrimaryColor = 0
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -121,24 +122,30 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredAnimateGifs != config.animateGifs) {
|
if (mStoredAnimateGifs != config.animateGifs) {
|
||||||
getDirectoryAdapter()?.updateAnimateGifs(config.animateGifs)
|
getRecyclerAdapter()?.updateAnimateGifs(config.animateGifs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredCropThumbnails != config.cropThumbnails) {
|
if (mStoredCropThumbnails != config.cropThumbnails) {
|
||||||
getDirectoryAdapter()?.updateCropThumbnails(config.cropThumbnails)
|
getRecyclerAdapter()?.updateCropThumbnails(config.cropThumbnails)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredShowMediaCount != config.showMediaCount) {
|
if (mStoredShowMediaCount != config.showMediaCount) {
|
||||||
getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount)
|
getRecyclerAdapter()?.updateShowMediaCount(config.showMediaCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) {
|
if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) {
|
||||||
getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally)
|
getRecyclerAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally)
|
||||||
setupScrollDirection()
|
setupScrollDirection()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredTextColor != config.textColor) {
|
if (mStoredTextColor != config.textColor) {
|
||||||
getDirectoryAdapter()?.updateTextColor(config.textColor)
|
getRecyclerAdapter()?.updateTextColor(config.textColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mStoredPrimaryColor != config.primaryColor) {
|
||||||
|
getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor)
|
||||||
|
directories_vertical_fastscroller.updatePrimaryColor()
|
||||||
|
directories_horizontal_fastscroller.updatePrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
directories_horizontal_fastscroller.updateBubbleColors()
|
directories_horizontal_fastscroller.updateBubbleColors()
|
||||||
|
@ -224,7 +231,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getDirectoryAdapter() = directories_grid.adapter as? DirectoryAdapter
|
private fun getRecyclerAdapter() = directories_grid.adapter as? DirectoryAdapter
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
config.apply {
|
config.apply {
|
||||||
|
@ -235,6 +242,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
mStoredShowMediaCount = showMediaCount
|
mStoredShowMediaCount = showMediaCount
|
||||||
mStoredShowInfoBubble = showInfoBubble
|
mStoredShowInfoBubble = showInfoBubble
|
||||||
mStoredTextColor = textColor
|
mStoredTextColor = textColor
|
||||||
|
mStoredPrimaryColor = primaryColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +268,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupLayoutManager()
|
setupLayoutManager()
|
||||||
checkIfColorChanged()
|
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.no_storage_permissions)
|
toast(R.string.no_storage_permissions)
|
||||||
finish()
|
finish()
|
||||||
|
@ -353,14 +360,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkIfColorChanged() {
|
|
||||||
if (directories_grid.adapter != null && getRecyclerAdapter().primaryColor != config.primaryColor) {
|
|
||||||
getRecyclerAdapter().primaryColor = config.primaryColor
|
|
||||||
directories_vertical_fastscroller.updatePrimaryColor()
|
|
||||||
directories_horizontal_fastscroller.updatePrimaryColor()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun deleteFolders(folders: ArrayList<File>) {
|
override fun deleteFolders(folders: ArrayList<File>) {
|
||||||
val fileDirItems = folders.map { FileDirItem(it.absolutePath, it.name, true) } as ArrayList<FileDirItem>
|
val fileDirItems = folders.map { FileDirItem(it.absolutePath, it.name, true) } as ArrayList<FileDirItem>
|
||||||
deleteFolders(fileDirItems) {
|
deleteFolders(fileDirItems) {
|
||||||
|
@ -370,8 +369,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter)
|
|
||||||
|
|
||||||
private fun setupLayoutManager() {
|
private fun setupLayoutManager() {
|
||||||
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
|
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
|
||||||
setupGridLayoutManager()
|
setupGridLayoutManager()
|
||||||
|
@ -400,14 +397,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
override fun zoomIn() {
|
override fun zoomIn() {
|
||||||
if (layoutManager.spanCount > 1) {
|
if (layoutManager.spanCount > 1) {
|
||||||
reduceColumnCount()
|
reduceColumnCount()
|
||||||
getRecyclerAdapter().finishActMode()
|
getRecyclerAdapter()?.finishActMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun zoomOut() {
|
override fun zoomOut() {
|
||||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||||
increaseColumnCount()
|
increaseColumnCount()
|
||||||
getRecyclerAdapter().finishActMode()
|
getRecyclerAdapter()?.finishActMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +615,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
itemClicked((it as Directory).path)
|
itemClicked((it as Directory).path)
|
||||||
}.apply {
|
}.apply {
|
||||||
setupZoomListener(mZoomListener)
|
setupZoomListener(mZoomListener)
|
||||||
setupDragListener(true)
|
|
||||||
directories_grid.adapter = this
|
directories_grid.adapter = this
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -650,7 +646,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().dirs.getOrNull(index)?.getBubbleText() ?: ""
|
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText() ?: ""
|
||||||
|
|
||||||
private fun setupLatestMediaId() {
|
private fun setupLatestMediaId() {
|
||||||
Thread {
|
Thread {
|
||||||
|
|
|
@ -69,6 +69,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private var mStoredScrollHorizontally = true
|
private var mStoredScrollHorizontally = true
|
||||||
private var mStoredShowInfoBubble = true
|
private var mStoredShowInfoBubble = true
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
|
private var mStoredPrimaryColor = 0
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
var mMedia = ArrayList<Medium>()
|
var mMedia = ArrayList<Medium>()
|
||||||
|
@ -131,6 +132,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
getMediaAdapter()?.updateTextColor(config.textColor)
|
getMediaAdapter()?.updateTextColor(config.textColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mStoredPrimaryColor != config.primaryColor) {
|
||||||
|
getMediaAdapter()?.updatePrimaryColor(config.primaryColor)
|
||||||
|
media_horizontal_fastscroller.updatePrimaryColor()
|
||||||
|
media_vertical_fastscroller.updatePrimaryColor()
|
||||||
|
}
|
||||||
|
|
||||||
media_horizontal_fastscroller.updateBubbleColors()
|
media_horizontal_fastscroller.updateBubbleColors()
|
||||||
media_vertical_fastscroller.updateBubbleColors()
|
media_vertical_fastscroller.updateBubbleColors()
|
||||||
media_refresh_layout.isEnabled = config.enablePullToRefresh
|
media_refresh_layout.isEnabled = config.enablePullToRefresh
|
||||||
|
@ -231,6 +238,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
mStoredScrollHorizontally = scrollHorizontally
|
mStoredScrollHorizontally = scrollHorizontally
|
||||||
mStoredShowInfoBubble = showInfoBubble
|
mStoredShowInfoBubble = showInfoBubble
|
||||||
mStoredTextColor = textColor
|
mStoredTextColor = textColor
|
||||||
|
mStoredPrimaryColor = primaryColor
|
||||||
mShowAll = showAll
|
mShowAll = showAll
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +295,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
|
supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
|
||||||
getMedia()
|
getMedia()
|
||||||
setupLayoutManager()
|
setupLayoutManager()
|
||||||
checkIfColorChanged()
|
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.no_storage_permissions)
|
toast(R.string.no_storage_permissions)
|
||||||
finish()
|
finish()
|
||||||
|
@ -297,14 +304,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
|
|
||||||
private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter
|
private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter
|
||||||
|
|
||||||
private fun checkIfColorChanged() {
|
|
||||||
if (media_grid.adapter != null && getRecyclerAdapter().primaryColor != config.primaryColor) {
|
|
||||||
getRecyclerAdapter().primaryColor = config.primaryColor
|
|
||||||
media_horizontal_fastscroller.updatePrimaryColor()
|
|
||||||
media_vertical_fastscroller.updatePrimaryColor()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupAdapter() {
|
private fun setupAdapter() {
|
||||||
if (!mShowAll && isDirEmpty()) {
|
if (!mShowAll && isDirEmpty()) {
|
||||||
return
|
return
|
||||||
|
@ -318,7 +317,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
itemClicked((it as Medium).path)
|
itemClicked((it as Medium).path)
|
||||||
}.apply {
|
}.apply {
|
||||||
setupZoomListener(mZoomListener)
|
setupZoomListener(mZoomListener)
|
||||||
setupDragListener(true)
|
|
||||||
media_grid.adapter = this
|
media_grid.adapter = this
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,7 +346,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().media.getOrNull(index)?.getBubbleText() ?: ""
|
private fun getBubbleTextItem(index: Int) = getMediaAdapter()?.media?.getOrNull(index)?.getBubbleText() ?: ""
|
||||||
|
|
||||||
private fun checkLastMediaChanged() {
|
private fun checkLastMediaChanged() {
|
||||||
if (isActivityDestroyed())
|
if (isActivityDestroyed())
|
||||||
|
@ -388,7 +386,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private fun toggleFilenameVisibility() {
|
private fun toggleFilenameVisibility() {
|
||||||
config.displayFileNames = !config.displayFileNames
|
config.displayFileNames = !config.displayFileNames
|
||||||
if (media_grid.adapter != null)
|
if (media_grid.adapter != null)
|
||||||
getRecyclerAdapter().updateDisplayFilenames(config.displayFileNames)
|
getMediaAdapter()?.updateDisplayFilenames(config.displayFileNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun switchToFolderView() {
|
private fun switchToFolderView() {
|
||||||
|
@ -501,8 +499,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter)
|
|
||||||
|
|
||||||
private fun setupLayoutManager() {
|
private fun setupLayoutManager() {
|
||||||
if (config.viewTypeFiles == VIEW_TYPE_GRID) {
|
if (config.viewTypeFiles == VIEW_TYPE_GRID) {
|
||||||
setupGridLayoutManager()
|
setupGridLayoutManager()
|
||||||
|
@ -531,14 +527,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
override fun zoomIn() {
|
override fun zoomIn() {
|
||||||
if (layoutManager.spanCount > 1) {
|
if (layoutManager.spanCount > 1) {
|
||||||
reduceColumnCount()
|
reduceColumnCount()
|
||||||
getRecyclerAdapter().finishActMode()
|
getMediaAdapter()?.finishActMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun zoomOut() {
|
override fun zoomOut() {
|
||||||
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
|
||||||
increaseColumnCount()
|
increaseColumnCount()
|
||||||
getRecyclerAdapter().finishActMode()
|
getMediaAdapter()?.finishActMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
||||||
private var cropThumbnails = config.cropThumbnails
|
private var cropThumbnails = config.cropThumbnails
|
||||||
private var currentDirectoriesHash = dirs.hashCode()
|
private var currentDirectoriesHash = dirs.hashCode()
|
||||||
|
|
||||||
|
init {
|
||||||
|
setupDragListener(true)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_directories
|
override fun getActionMenuId() = R.menu.cab_directories
|
||||||
|
|
||||||
override fun prepareItemSelection(view: View) {
|
override fun prepareItemSelection(view: View) {
|
||||||
|
|
|
@ -17,6 +17,10 @@ class ManageFoldersAdapter(activity: BaseSimpleActivity, var folders: ArrayList<
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
|
|
||||||
|
init {
|
||||||
|
setupDragListener(true)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_remove_only
|
override fun getActionMenuId() = R.menu.cab_remove_only
|
||||||
|
|
||||||
override fun prepareActionMode(menu: Menu) {}
|
override fun prepareActionMode(menu: Menu) {}
|
||||||
|
|
|
@ -19,6 +19,10 @@ class ManageHiddenFoldersAdapter(activity: BaseSimpleActivity, var folders: Arra
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
|
|
||||||
|
init {
|
||||||
|
setupDragListener(true)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_hidden_folders
|
override fun getActionMenuId() = R.menu.cab_hidden_folders
|
||||||
|
|
||||||
override fun prepareActionMode(menu: Menu) {}
|
override fun prepareActionMode(menu: Menu) {}
|
||||||
|
|
|
@ -44,6 +44,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
private var displayFilenames = config.displayFileNames
|
private var displayFilenames = config.displayFileNames
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
setupDragListener(true)
|
||||||
enableInstantLoad()
|
enableInstantLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue