use some helper extensions from Commons

This commit is contained in:
tibbi 2020-04-21 22:10:49 +02:00
parent cb8d1e8c21
commit 4040fe8c0a
2 changed files with 1 additions and 22 deletions

View File

@ -16,7 +16,6 @@ import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.camera.BuildConfig
import com.simplemobiletools.camera.R
import com.simplemobiletools.camera.extensions.config
import com.simplemobiletools.camera.extensions.navBarHeight
import com.simplemobiletools.camera.helpers.*
import com.simplemobiletools.camera.implementations.MyCameraImpl
import com.simplemobiletools.camera.interfaces.MyPreview
@ -192,7 +191,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
setContentView(R.layout.activity_main)
initButtons()
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(0, 0, 0, (navBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt())
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(0, 0, 0, (navigationBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt())
checkVideoCaptureIntent()
mPreview = CameraPreview(this, camera_texture_view, mIsInPhotoMode)

View File

@ -1,8 +1,6 @@
package com.simplemobiletools.camera.extensions
import android.content.Context
import android.graphics.Point
import android.view.WindowManager
import com.simplemobiletools.camera.helpers.Config
import java.io.File
import java.text.SimpleDateFormat
@ -10,8 +8,6 @@ import java.util.*
val Context.config: Config get() = Config.newInstance(applicationContext)
internal val Context.windowManager: WindowManager get() = getSystemService(Context.WINDOW_SERVICE) as WindowManager
fun Context.getOutputMediaFile(isPhoto: Boolean): String {
val mediaStorageDir = File(config.savePhotosFolder)
@ -28,19 +24,3 @@ fun Context.getOutputMediaFile(isPhoto: Boolean): String {
"${mediaStorageDir.path}/VID_$timestamp.mp4"
}
}
val Context.usableScreenSize: Point
get() {
val size = Point()
windowManager.defaultDisplay.getSize(size)
return size
}
val Context.realScreenSize: Point
get() {
val size = Point()
windowManager.defaultDisplay.getRealSize(size)
return size
}
val Context.navBarHeight: Int get() = realScreenSize.y - usableScreenSize.y