From 4040fe8c0a9a4c6f0c66259c5590030064096725 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 21 Apr 2020 22:10:49 +0200 Subject: [PATCH] use some helper extensions from Commons --- .../camera/activities/MainActivity.kt | 3 +-- .../camera/extensions/Context.kt | 20 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index 4dda5a96..d8d0b143 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/camera/extensions/Context.kt index fd5b027e..f8b35bca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/extensions/Context.kt @@ -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