use some helper extensions from Commons
This commit is contained in:
parent
cb8d1e8c21
commit
4040fe8c0a
|
@ -16,7 +16,6 @@ import com.bumptech.glide.request.RequestOptions
|
||||||
import com.simplemobiletools.camera.BuildConfig
|
import com.simplemobiletools.camera.BuildConfig
|
||||||
import com.simplemobiletools.camera.R
|
import com.simplemobiletools.camera.R
|
||||||
import com.simplemobiletools.camera.extensions.config
|
import com.simplemobiletools.camera.extensions.config
|
||||||
import com.simplemobiletools.camera.extensions.navBarHeight
|
|
||||||
import com.simplemobiletools.camera.helpers.*
|
import com.simplemobiletools.camera.helpers.*
|
||||||
import com.simplemobiletools.camera.implementations.MyCameraImpl
|
import com.simplemobiletools.camera.implementations.MyCameraImpl
|
||||||
import com.simplemobiletools.camera.interfaces.MyPreview
|
import com.simplemobiletools.camera.interfaces.MyPreview
|
||||||
|
@ -192,7 +191,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
initButtons()
|
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()
|
checkVideoCaptureIntent()
|
||||||
mPreview = CameraPreview(this, camera_texture_view, mIsInPhotoMode)
|
mPreview = CameraPreview(this, camera_texture_view, mIsInPhotoMode)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.simplemobiletools.camera.extensions
|
package com.simplemobiletools.camera.extensions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Point
|
|
||||||
import android.view.WindowManager
|
|
||||||
import com.simplemobiletools.camera.helpers.Config
|
import com.simplemobiletools.camera.helpers.Config
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -10,8 +8,6 @@ import java.util.*
|
||||||
|
|
||||||
val Context.config: Config get() = Config.newInstance(applicationContext)
|
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 {
|
fun Context.getOutputMediaFile(isPhoto: Boolean): String {
|
||||||
val mediaStorageDir = File(config.savePhotosFolder)
|
val mediaStorageDir = File(config.savePhotosFolder)
|
||||||
|
|
||||||
|
@ -28,19 +24,3 @@ fun Context.getOutputMediaFile(isPhoto: Boolean): String {
|
||||||
"${mediaStorageDir.path}/VID_$timestamp.mp4"
|
"${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
|
|
||||||
|
|
Loading…
Reference in New Issue