update commons to 3.17.16 with some cosmetic code changes

This commit is contained in:
tibbi 2018-03-30 23:32:37 +02:00
parent 2515edee44
commit 4c865de301
10 changed files with 45 additions and 43 deletions

View File

@ -46,15 +46,15 @@ ext {
}
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.android.support:multidex:1.0.3'
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.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"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"

View File

@ -28,7 +28,6 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
val adapter = ManageFoldersAdapter(this, folders, true, this, manage_folders_list) {}
adapter.setupDragListener(true)
manage_folders_list.adapter = adapter
}

View File

@ -30,7 +30,6 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
val adapter = ManageHiddenFoldersAdapter(this, it, this, manage_folders_list) {}
adapter.setupDragListener(true)
manage_folders_list.adapter = adapter
}
}

View File

@ -29,7 +29,6 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
val adapter = ManageFoldersAdapter(this, folders, false, this, manage_folders_list) {}
adapter.setupDragListener(true)
manage_folders_list.adapter = adapter
}

View File

@ -71,6 +71,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private var mStoredShowMediaCount = true
private var mStoredShowInfoBubble = true
private var mStoredTextColor = 0
private var mStoredPrimaryColor = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -121,24 +122,30 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
if (mStoredAnimateGifs != config.animateGifs) {
getDirectoryAdapter()?.updateAnimateGifs(config.animateGifs)
getRecyclerAdapter()?.updateAnimateGifs(config.animateGifs)
}
if (mStoredCropThumbnails != config.cropThumbnails) {
getDirectoryAdapter()?.updateCropThumbnails(config.cropThumbnails)
getRecyclerAdapter()?.updateCropThumbnails(config.cropThumbnails)
}
if (mStoredShowMediaCount != config.showMediaCount) {
getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount)
getRecyclerAdapter()?.updateShowMediaCount(config.showMediaCount)
}
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()
}
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()
@ -224,7 +231,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
return true
}
private fun getDirectoryAdapter() = directories_grid.adapter as? DirectoryAdapter
private fun getRecyclerAdapter() = directories_grid.adapter as? DirectoryAdapter
private fun storeStateVariables() {
config.apply {
@ -235,6 +242,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mStoredShowMediaCount = showMediaCount
mStoredShowInfoBubble = showInfoBubble
mStoredTextColor = textColor
mStoredPrimaryColor = primaryColor
}
}
@ -260,7 +268,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
setupLayoutManager()
checkIfColorChanged()
} else {
toast(R.string.no_storage_permissions)
finish()
@ -353,14 +360,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
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>) {
val fileDirItems = folders.map { FileDirItem(it.absolutePath, it.name, true) } as ArrayList<FileDirItem>
deleteFolders(fileDirItems) {
@ -370,8 +369,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
}
private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter)
private fun setupLayoutManager() {
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
setupGridLayoutManager()
@ -400,14 +397,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
override fun zoomIn() {
if (layoutManager.spanCount > 1) {
reduceColumnCount()
getRecyclerAdapter().finishActMode()
getRecyclerAdapter()?.finishActMode()
}
}
override fun zoomOut() {
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
increaseColumnCount()
getRecyclerAdapter().finishActMode()
getRecyclerAdapter()?.finishActMode()
}
}
}
@ -618,7 +615,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
itemClicked((it as Directory).path)
}.apply {
setupZoomListener(mZoomListener)
setupDragListener(true)
directories_grid.adapter = this
}
} 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() {
Thread {

View File

@ -69,6 +69,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private var mStoredScrollHorizontally = true
private var mStoredShowInfoBubble = true
private var mStoredTextColor = 0
private var mStoredPrimaryColor = 0
companion object {
var mMedia = ArrayList<Medium>()
@ -131,6 +132,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
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_vertical_fastscroller.updateBubbleColors()
media_refresh_layout.isEnabled = config.enablePullToRefresh
@ -231,6 +238,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mStoredScrollHorizontally = scrollHorizontally
mStoredShowInfoBubble = showInfoBubble
mStoredTextColor = textColor
mStoredPrimaryColor = primaryColor
mShowAll = showAll
}
}
@ -287,7 +295,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
supportActionBar?.title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
getMedia()
setupLayoutManager()
checkIfColorChanged()
} else {
toast(R.string.no_storage_permissions)
finish()
@ -297,14 +304,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
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() {
if (!mShowAll && isDirEmpty()) {
return
@ -318,7 +317,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
itemClicked((it as Medium).path)
}.apply {
setupZoomListener(mZoomListener)
setupDragListener(true)
media_grid.adapter = this
}
} 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() {
if (isActivityDestroyed())
@ -388,7 +386,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun toggleFilenameVisibility() {
config.displayFileNames = !config.displayFileNames
if (media_grid.adapter != null)
getRecyclerAdapter().updateDisplayFilenames(config.displayFileNames)
getMediaAdapter()?.updateDisplayFilenames(config.displayFileNames)
}
private fun switchToFolderView() {
@ -501,8 +499,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
invalidateOptionsMenu()
}
private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter)
private fun setupLayoutManager() {
if (config.viewTypeFiles == VIEW_TYPE_GRID) {
setupGridLayoutManager()
@ -531,14 +527,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
override fun zoomIn() {
if (layoutManager.spanCount > 1) {
reduceColumnCount()
getRecyclerAdapter().finishActMode()
getMediaAdapter()?.finishActMode()
}
}
override fun zoomOut() {
if (layoutManager.spanCount < MAX_COLUMN_COUNT) {
increaseColumnCount()
getRecyclerAdapter().finishActMode()
getMediaAdapter()?.finishActMode()
}
}
}

View File

@ -41,6 +41,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
private var cropThumbnails = config.cropThumbnails
private var currentDirectoriesHash = dirs.hashCode()
init {
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab_directories
override fun prepareItemSelection(view: View) {

View File

@ -17,6 +17,10 @@ class ManageFoldersAdapter(activity: BaseSimpleActivity, var folders: ArrayList<
private val config = activity.config
init {
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab_remove_only
override fun prepareActionMode(menu: Menu) {}

View File

@ -19,6 +19,10 @@ class ManageHiddenFoldersAdapter(activity: BaseSimpleActivity, var folders: Arra
private val config = activity.config
init {
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab_hidden_folders
override fun prepareActionMode(menu: Menu) {}

View File

@ -44,6 +44,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
private var displayFilenames = config.displayFileNames
init {
setupDragListener(true)
enableInstantLoad()
}