Camera close button
This commit is contained in:
parent
5c0f317a04
commit
defdd4d36f
@ -15,7 +15,7 @@ android {
|
|||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.1.5"
|
versionName "1.1.6"
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
@ -15,7 +15,6 @@ import com.otaliastudios.cameraview.controls.Facing
|
|||||||
import com.otaliastudios.cameraview.controls.Flash
|
import com.otaliastudios.cameraview.controls.Flash
|
||||||
import com.otaliastudios.cameraview.controls.Grid
|
import com.otaliastudios.cameraview.controls.Grid
|
||||||
import com.otaliastudios.cameraview.controls.Hdr
|
import com.otaliastudios.cameraview.controls.Hdr
|
||||||
import com.otaliastudios.cameraview.filter.Filters
|
|
||||||
import kotlinx.android.synthetic.main.activity_camera.*
|
import kotlinx.android.synthetic.main.activity_camera.*
|
||||||
import sushi.hardcore.droidfs.provider.RestrictedFileProvider
|
import sushi.hardcore.droidfs.provider.RestrictedFileProvider
|
||||||
import sushi.hardcore.droidfs.util.GocryptfsVolume
|
import sushi.hardcore.droidfs.util.GocryptfsVolume
|
||||||
@ -31,14 +30,12 @@ class CameraActivity : BaseActivity() {
|
|||||||
private val flashModes = listOf(Flash.AUTO, Flash.ON, Flash.OFF)
|
private val flashModes = listOf(Flash.AUTO, Flash.ON, Flash.OFF)
|
||||||
private val gridTitles = listOf(R.string.grid_none, R.string.grid_3x3, R.string.grid_4x4)
|
private val gridTitles = listOf(R.string.grid_none, R.string.grid_3x3, R.string.grid_4x4)
|
||||||
private val gridValues = listOf(Grid.OFF, Grid.DRAW_3X3, Grid.DRAW_4X4)
|
private val gridValues = listOf(Grid.OFF, Grid.DRAW_3X3, Grid.DRAW_4X4)
|
||||||
private val filterNames = Filters.values().map { it.toString().toLowerCase(Locale.ROOT).replace("_", " ").capitalize() as CharSequence }.toTypedArray()
|
|
||||||
private const val fileNameRandomMin = 100000
|
private const val fileNameRandomMin = 100000
|
||||||
private const val fileNameRandomMax = 999999
|
private const val fileNameRandomMax = 999999
|
||||||
private val dateFormat = SimpleDateFormat("yyyyMMdd_HHmmss")
|
private val dateFormat = SimpleDateFormat("yyyyMMdd_HHmmss")
|
||||||
private val random = Random()
|
private val random = Random()
|
||||||
}
|
}
|
||||||
private var currentFlashModeIndex = 0
|
private var currentFlashModeIndex = 0
|
||||||
private var currentFilterIndex = 0
|
|
||||||
private var timerDuration = 0
|
private var timerDuration = 0
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
@ -77,14 +74,6 @@ class CameraActivity : BaseActivity() {
|
|||||||
take_photo_button.onClick = ::onClickTakePhoto
|
take_photo_button.onClick = ::onClickTakePhoto
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun takePhoto() {
|
|
||||||
if (currentFilterIndex != 0){
|
|
||||||
camera.takePictureSnapshot()
|
|
||||||
} else {
|
|
||||||
camera.takePicture()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onClickTakePhoto() {
|
private fun onClickTakePhoto() {
|
||||||
val baseName = "IMG_"+dateFormat.format(Date())+"_"
|
val baseName = "IMG_"+dateFormat.format(Date())+"_"
|
||||||
do {
|
do {
|
||||||
@ -98,12 +87,12 @@ class CameraActivity : BaseActivity() {
|
|||||||
Thread.sleep(1000)
|
Thread.sleep(1000)
|
||||||
}
|
}
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
takePhoto()
|
camera.takePicture()
|
||||||
text_timer.visibility = View.GONE
|
text_timer.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
} else {
|
} else {
|
||||||
takePhoto()
|
camera.takePicture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,32 +170,9 @@ class CameraActivity : BaseActivity() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openFilterDialog(){
|
fun onClickClose(view: View) {
|
||||||
ColoredAlertDialogBuilder(this)
|
isFinishingIntentionally = true
|
||||||
.setTitle(getString(R.string.choose_filter))
|
finish()
|
||||||
.setSingleChoiceItems(filterNames, currentFilterIndex){ dialog, which ->
|
|
||||||
camera.filter = Filters.values()[which].newInstance()
|
|
||||||
currentFilterIndex = which
|
|
||||||
dialog.dismiss()
|
|
||||||
}
|
|
||||||
.setNegativeButton(R.string.cancel, null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onClickFilter(view: View) {
|
|
||||||
if (sharedPrefs.getBoolean("filtersFirstOpening", true)){
|
|
||||||
ColoredAlertDialogBuilder(this)
|
|
||||||
.setTitle(R.string.warning)
|
|
||||||
.setMessage(R.string.filters_warning)
|
|
||||||
.setPositiveButton(R.string.ok){ _, _ ->
|
|
||||||
sharedPrefs.edit().putBoolean("filtersFirstOpening", false).apply()
|
|
||||||
openFilterDialog()
|
|
||||||
}
|
|
||||||
.setNegativeButton(R.string.cancel, null)
|
|
||||||
.show()
|
|
||||||
} else {
|
|
||||||
openFilterDialog()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
<vector android:height="24dp" android:tint="#FFFFFF"
|
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M19.02,10v9L5,19L5,5h9L14,3L5.02,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-9h-2zM17,10l0.94,-2.06L20,7l-2.06,-0.94L17,4l-0.94,2.06L14,7l2.06,0.94zM13.25,10.75L12,8l-1.25,2.75L8,12l2.75,1.25L12,16l1.25,-2.75L16,12z"/>
|
|
||||||
</vector>
|
|
@ -51,16 +51,16 @@
|
|||||||
android:onClick="onClickGrid"
|
android:onClick="onClickGrid"
|
||||||
android:src="@drawable/icon_grid_off"
|
android:src="@drawable/icon_grid_off"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/image_filter"
|
app:layout_constraintEnd_toStartOf="@+id/image_close"
|
||||||
app:layout_constraintStart_toEndOf="@+id/image_timer"
|
app:layout_constraintStart_toEndOf="@+id/image_timer"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_filter"
|
android:id="@+id/image_close"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:onClick="onClickFilter"
|
android:onClick="onClickClose"
|
||||||
android:src="@drawable/icon_photo_filter"
|
android:src="@drawable/icon_close"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/image_grid"
|
app:layout_constraintStart_toEndOf="@id/image_grid"
|
||||||
|
@ -163,8 +163,6 @@
|
|||||||
<string name="grid_3x3">3x3</string>
|
<string name="grid_3x3">3x3</string>
|
||||||
<string name="grid_4x4">4x4</string>
|
<string name="grid_4x4">4x4</string>
|
||||||
<string name="choose_grid">Choose grid</string>
|
<string name="choose_grid">Choose grid</string>
|
||||||
<string name="choose_filter">Choose filter</string>
|
|
||||||
<string name="filters_warning">Filters can only be applied to reduced quality images. If you want to take high definition photos, do not apply any filters.</string>
|
|
||||||
<string name="timer_empty_error_msg">Please enter a numeric value</string>
|
<string name="timer_empty_error_msg">Please enter a numeric value</string>
|
||||||
<string name="path_from_uri_null_error_msg">Failed to retrieve the selected path.</string>
|
<string name="path_from_uri_null_error_msg">Failed to retrieve the selected path.</string>
|
||||||
<string name="create_cant_write_error_msg">DroidFS doesn\'t have write access to this path. Please try another location.</string>
|
<string name="create_cant_write_error_msg">DroidFS doesn\'t have write access to this path. Please try another location.</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user