couple code style updates

This commit is contained in:
tibbi 2017-12-06 16:10:21 +01:00
parent 562114537d
commit fbcee2c7a0
7 changed files with 16 additions and 18 deletions

View file

@ -598,7 +598,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.removeCallbacksAndMessages(null)
mLastMediaHandler.postDelayed({ mLastMediaHandler.postDelayed({
Thread({ Thread {
val mediaId = getLatestMediaId() val mediaId = getLatestMediaId()
if (mLatestMediaId != mediaId) { if (mLatestMediaId != mediaId) {
mLatestMediaId = mediaId mLatestMediaId = mediaId
@ -608,7 +608,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} else { } else {
checkLastMediaChanged() checkLastMediaChanged()
} }
}).start() }.start()
}, LAST_MEDIA_CHECK_PERIOD) }, LAST_MEDIA_CHECK_PERIOD)
} }

View file

@ -75,7 +75,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mAllowPickingMultiple = getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false) mAllowPickingMultiple = getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
} }
media_refresh_layout.setOnRefreshListener({ getMedia() }) media_refresh_layout.setOnRefreshListener { getMedia() }
mPath = intent.getStringExtra(DIRECTORY) mPath = intent.getStringExtra(DIRECTORY)
storeStateVariables() storeStateVariables()
if (mShowAll) if (mShowAll)
@ -218,7 +218,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.removeCallbacksAndMessages(null)
mLastMediaHandler.postDelayed({ mLastMediaHandler.postDelayed({
Thread({ Thread {
val mediaId = getLatestMediaId() val mediaId = getLatestMediaId()
if (mLatestMediaId != mediaId) { if (mLatestMediaId != mediaId) {
mLatestMediaId = mediaId mLatestMediaId = mediaId
@ -228,7 +228,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
} else { } else {
checkLastMediaChanged() checkLastMediaChanged()
} }
}).start() }.start()
}, LAST_MEDIA_CHECK_PERIOD) }, LAST_MEDIA_CHECK_PERIOD)
} }

View file

@ -114,7 +114,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
if (result.error == null) { if (result.error == null) {
toast(R.string.setting_wallpaper) toast(R.string.setting_wallpaper)
Thread({ Thread {
val bitmap = result.bitmap val bitmap = result.bitmap
val wantedHeight = wallpaperManager.desiredMinimumHeight val wantedHeight = wallpaperManager.desiredMinimumHeight
val ratio = wantedHeight / bitmap.height.toFloat() val ratio = wantedHeight / bitmap.height.toFloat()
@ -132,7 +132,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
setResult(Activity.RESULT_CANCELED) setResult(Activity.RESULT_CANCELED)
} }
finish() finish()
}).start() }.start()
} else { } else {
toast("${getString(R.string.image_editing_failed)}: ${result.error.message}") toast("${getString(R.string.image_editing_failed)}: ${result.error.message}")
} }

View file

@ -499,9 +499,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
SaveAsDialog(this, currPath, false) { SaveAsDialog(this, currPath, false) {
val selectedFile = File(it) val selectedFile = File(it)
handleSAFDialog(selectedFile) { handleSAFDialog(selectedFile) {
Thread({ Thread {
saveImageToFile(currPath, it) saveImageToFile(currPath, it)
}).start() }.start()
} }
} }
} }

View file

@ -1,6 +1,5 @@
package com.simplemobiletools.gallery.adapters package com.simplemobiletools.gallery.adapters
import android.graphics.PorterDuff
import android.view.Menu import android.view.Menu
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -342,8 +341,8 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
dir_name.setTextColor(textColor) dir_name.setTextColor(textColor)
dir_path.setTextColor(textColor) dir_path.setTextColor(textColor)
photo_cnt.setTextColor(textColor) photo_cnt.setTextColor(textColor)
dir_pin.setColorFilter(textColor, PorterDuff.Mode.SRC_IN) dir_pin.applyColorFilter(textColor)
dir_sd_card.setColorFilter(textColor, PorterDuff.Mode.SRC_IN) dir_sd_card.applyColorFilter(textColor)
} }
} }
} }

View file

@ -1,6 +1,5 @@
package com.simplemobiletools.gallery.adapters package com.simplemobiletools.gallery.adapters
import android.graphics.PorterDuff
import android.net.Uri import android.net.Uri
import android.view.Menu import android.view.Menu
import android.view.View import android.view.View
@ -19,7 +18,7 @@ import com.simplemobiletools.gallery.dialogs.DeleteWithRememberDialog
import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.extensions.*
import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
import kotlinx.android.synthetic.main.photo_video_item_grid.view.* import kotlinx.android.synthetic.main.photo_video_item_list.view.*
import java.io.File import java.io.File
import java.util.* import java.util.*
@ -142,7 +141,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
} }
private fun toggleFileVisibility(hide: Boolean) { private fun toggleFileVisibility(hide: Boolean) {
Thread({ Thread {
getSelectedMedia().forEach { getSelectedMedia().forEach {
val oldFile = File(it.path) val oldFile = File(it.path)
activity.toggleFileVisibility(oldFile, hide) activity.toggleFileVisibility(oldFile, hide)
@ -151,7 +150,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
listener?.refreshItems() listener?.refreshItems()
finishActMode() finishActMode()
} }
}).start() }.start()
} }
private fun shareMedia() { private fun shareMedia() {
@ -264,7 +263,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
if (isListViewType) { if (isListViewType) {
photo_name.setTextColor(textColor) photo_name.setTextColor(textColor)
play_outline.setColorFilter(textColor, PorterDuff.Mode.SRC_IN) play_outline.applyColorFilter(textColor)
} }
} }
} }

View file

@ -4,9 +4,9 @@
android:id="@+id/dir_holder" android:id="@+id/dir_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="@dimen/small_margin"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:paddingLeft="@dimen/small_margin"
android:paddingTop="@dimen/small_margin"> android:paddingTop="@dimen/small_margin">
<com.simplemobiletools.gallery.views.MySquareImageView <com.simplemobiletools.gallery.views.MySquareImageView