small code style update

This commit is contained in:
tibbi 2016-12-04 16:59:21 +01:00
parent d046cbc1ec
commit c9eb50944d
2 changed files with 14 additions and 14 deletions

View file

@ -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)

View file

@ -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 {