From c9eb50944d78c5bc38ed4c75c968e6dd374f4277 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Dec 2016 16:59:21 +0100 Subject: [PATCH] small code style update --- .../gallery/activities/ViewPagerActivity.kt | 9 ++++----- .../gallery/fragments/VideoFragment.kt | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index af612dd29..0d4e6263a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -4,7 +4,6 @@ import android.app.Activity import android.content.Intent import android.content.res.Configuration import android.database.Cursor -import android.net.Uri import android.os.Bundle import android.provider.MediaStore import android.support.v4.view.ViewPager @@ -16,15 +15,15 @@ import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask import com.simplemobiletools.filepicker.dialogs.ConfirmationDialog import com.simplemobiletools.filepicker.extensions.* import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog -import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.R -import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER import com.simplemobiletools.gallery.adapters.MyPagerAdapter import com.simplemobiletools.gallery.dialogs.CopyDialog import com.simplemobiletools.gallery.dialogs.RenameFileDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.ViewPagerFragment +import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.activity_medium.* import java.io.File @@ -310,7 +309,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI } - val where = "${MediaStore.Images.Media.DATA} like ? " + val where = "${MediaStore.Images.Media.DATA} LIKE ? " val args = arrayOf("$mDirectory%") val columns = arrayOf(MediaStore.Images.Media.DATA, MediaStore.Images.Media.DATE_MODIFIED, MediaStore.Images.Media.SIZE) val cursor = contentResolver.query(uri, columns, where, args, null) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 83d54b46f..9aef76d50 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -225,7 +225,7 @@ class VideoFragment : ViewPagerFragment(), View.OnClickListener, SurfaceHolder.C prepareAsync() } } catch (e: IOException) { - Log.e(TAG, "init media player failed " + e) + Log.e(TAG, "init media player failed $e") } } @@ -306,15 +306,16 @@ class VideoFragment : ViewPagerFragment(), View.OnClickListener, SurfaceHolder.C val screenProportion = screenWidth.toFloat() / screenHeight.toFloat() - val lp = mSurfaceView!!.layoutParams - if (videoProportion > screenProportion) { - lp.width = screenWidth - lp.height = (screenWidth.toFloat() / videoProportion).toInt() - } else { - lp.width = (videoProportion * screenHeight.toFloat()).toInt() - lp.height = screenHeight + mSurfaceView!!.layoutParams.apply { + if (videoProportion > screenProportion) { + width = screenWidth + height = (screenWidth.toFloat() / videoProportion).toInt() + } else { + width = (videoProportion * screenHeight.toFloat()).toInt() + height = screenHeight + } + mSurfaceView!!.layoutParams = this } - mSurfaceView!!.layoutParams = lp } private fun getTimeString(duration: Int): String {