autoformating some files, no real change

This commit is contained in:
tibbi 2020-05-29 22:28:51 +02:00
parent 150aace3ca
commit 318275590c
2 changed files with 44 additions and 44 deletions

View file

@ -393,7 +393,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
initZoomListener() initZoomListener()
val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller
MediaAdapter(this, mMedia.clone() as ArrayList<ThumbnailItem>, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, MediaAdapter(this, mMedia.clone() as ArrayList<ThumbnailItem>, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent,
mAllowPickingMultiple, mPath, media_grid, fastscroller) { mAllowPickingMultiple, mPath, media_grid, fastscroller) {
if (it is Medium && !isFinishing) { if (it is Medium && !isFinishing) {
itemClicked(it.path) itemClicked(it.path)
} }
@ -799,24 +799,24 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
val ratio = wantedWidth.toFloat() / wantedHeight val ratio = wantedWidth.toFloat() / wantedHeight
val options = RequestOptions() val options = RequestOptions()
.override((wantedWidth * ratio).toInt(), wantedHeight) .override((wantedWidth * ratio).toInt(), wantedHeight)
.fitCenter() .fitCenter()
Glide.with(this) Glide.with(this)
.asBitmap() .asBitmap()
.load(File(path)) .load(File(path))
.apply(options) .apply(options)
.into(object : SimpleTarget<Bitmap>() { .into(object : SimpleTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) { override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
try { try {
WallpaperManager.getInstance(applicationContext).setBitmap(resource) WallpaperManager.getInstance(applicationContext).setBitmap(resource)
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
} catch (ignored: IOException) { } catch (ignored: IOException) {
}
finish()
} }
})
finish()
}
})
} else if (mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent) { } else if (mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent) {
Intent().apply { Intent().apply {
data = Uri.parse(path) data = Uri.parse(path)

View file

@ -187,11 +187,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
findItem(R.id.menu_change_orientation).isVisible = rotationDegrees == 0 && visibleBottomActions and BOTTOM_ACTION_CHANGE_ORIENTATION == 0 findItem(R.id.menu_change_orientation).isVisible = rotationDegrees == 0 && visibleBottomActions and BOTTOM_ACTION_CHANGE_ORIENTATION == 0
findItem(R.id.menu_change_orientation).icon = resources.getDrawable(getChangeOrientationIcon()) findItem(R.id.menu_change_orientation).icon = resources.getDrawable(getChangeOrientationIcon())
findItem(R.id.menu_rotate).setShowAsAction( findItem(R.id.menu_rotate).setShowAsAction(
if (rotationDegrees != 0) { if (rotationDegrees != 0) {
MenuItem.SHOW_AS_ACTION_ALWAYS MenuItem.SHOW_AS_ACTION_ALWAYS
} else { } else {
MenuItem.SHOW_AS_ACTION_IF_ROOM MenuItem.SHOW_AS_ACTION_IF_ROOM
}) })
} }
if (visibleBottomActions != 0) { if (visibleBottomActions != 0) {
@ -718,10 +718,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
val shortcut = ShortcutInfo.Builder(this, path) val shortcut = ShortcutInfo.Builder(this, path)
.setShortLabel(medium.name) .setShortLabel(medium.name)
.setIcon(Icon.createWithBitmap(drawable.convertToBitmap())) .setIcon(Icon.createWithBitmap(drawable.convertToBitmap()))
.setIntent(intent) .setIntent(intent)
.build() .build()
manager.requestPinShortcut(shortcut, null) manager.requestPinShortcut(shortcut, null)
} }
@ -915,27 +915,27 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
val options = RequestOptions() val options = RequestOptions()
.skipMemoryCache(true) .skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
Glide.with(this) Glide.with(this)
.asBitmap() .asBitmap()
.load(path) .load(path)
.apply(options) .apply(options)
.listener(object : RequestListener<Bitmap> { .listener(object : RequestListener<Bitmap> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
showErrorToast(e?.localizedMessage ?: "") showErrorToast(e?.localizedMessage ?: "")
return false return false
}
override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
if (bitmap != null) {
printHelper.printBitmap(path.getFilenameFromPath(), bitmap)
} }
override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { return false
if (bitmap != null) { }
printHelper.printBitmap(path.getFilenameFromPath(), bitmap) }).submit(requestedWidth, requestedHeight)
}
return false
}
}).submit(requestedWidth, requestedHeight)
} catch (e: Exception) { } catch (e: Exception) {
} }
} }
@ -1261,8 +1261,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (bottom_actions.isVisible()) { if (bottom_actions.isVisible()) {
bottom_actions.animate().alpha(newAlpha).start() bottom_actions.animate().alpha(newAlpha).start()
arrayOf(bottom_favorite, bottom_edit, bottom_share, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, arrayOf(bottom_favorite, bottom_edit, bottom_share, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation,
bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename, bottom_set_as, bottom_copy, bottom_move, bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename, bottom_set_as, bottom_copy, bottom_move,
bottom_resize).forEach { bottom_resize).forEach {
it.isClickable = !mIsFullScreen it.isClickable = !mIsFullScreen
} }
} }