mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-17 03:40:38 +01:00
add a button for setting the photo/video resolution
This commit is contained in:
parent
f043d6df65
commit
1ea95c709b
@ -153,6 +153,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
shutter.setOnClickListener { shutterPressed() }
|
shutter.setOnClickListener { shutterPressed() }
|
||||||
settings.setOnClickListener { launchSettings() }
|
settings.setOnClickListener { launchSettings() }
|
||||||
toggle_photo_video.setOnClickListener { handleTogglePhotoVideo() }
|
toggle_photo_video.setOnClickListener { handleTogglePhotoVideo() }
|
||||||
|
change_resolution.setOnClickListener { handleChangeResolution() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasCameraAndStoragePermission() = hasCameraPermission() && hasWriteStoragePermission()
|
private fun hasCameraAndStoragePermission() = hasCameraPermission() && hasWriteStoragePermission()
|
||||||
@ -180,7 +181,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleCamera() {
|
private fun toggleCamera() {
|
||||||
if (!checkCameraAvailable()) {
|
if (!checkCameraAvailable()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -206,7 +207,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showLastMediaPreview() {
|
private fun showLastMediaPreview() {
|
||||||
if (mPreviewUri == null)
|
if (mPreviewUri == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -224,7 +225,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toggleFlash() {
|
private fun toggleFlash() {
|
||||||
if (!checkCameraAvailable()) {
|
if (!checkCameraAvailable()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -288,7 +289,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
toggle_flash.animate().alpha(alpha).start()
|
toggle_flash.animate().alpha(alpha).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun launchSettings() {
|
private fun launchSettings() {
|
||||||
if (settings.alpha == 1f) {
|
if (settings.alpha == 1f) {
|
||||||
val intent = Intent(applicationContext, SettingsActivity::class.java)
|
val intent = Intent(applicationContext, SettingsActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
@ -297,11 +298,15 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleTogglePhotoVideo() {
|
private fun handleTogglePhotoVideo() {
|
||||||
togglePhotoVideo()
|
togglePhotoVideo()
|
||||||
checkButtons()
|
checkButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleChangeResolution() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private fun togglePhotoVideo() {
|
private fun togglePhotoVideo() {
|
||||||
if (!checkCameraAvailable()) {
|
if (!checkCameraAvailable()) {
|
||||||
return
|
return
|
||||||
@ -389,12 +394,14 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
private fun fadeOutButtons() {
|
private fun fadeOutButtons() {
|
||||||
fadeAnim(settings, .5f)
|
fadeAnim(settings, .5f)
|
||||||
fadeAnim(toggle_photo_video, .0f)
|
fadeAnim(toggle_photo_video, .0f)
|
||||||
|
fadeAnim(change_resolution, .0f)
|
||||||
fadeAnim(last_photo_video_preview, .0f)
|
fadeAnim(last_photo_video_preview, .0f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fadeInButtons() {
|
private fun fadeInButtons() {
|
||||||
fadeAnim(settings, 1f)
|
fadeAnim(settings, 1f)
|
||||||
fadeAnim(toggle_photo_video, 1f)
|
fadeAnim(toggle_photo_video, 1f)
|
||||||
|
fadeAnim(change_resolution, 1f)
|
||||||
fadeAnim(last_photo_video_preview, 1f)
|
fadeAnim(last_photo_video_preview, 1f)
|
||||||
scheduleFadeOut()
|
scheduleFadeOut()
|
||||||
}
|
}
|
||||||
@ -502,7 +509,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun animateViews(degrees: Int) {
|
private fun animateViews(degrees: Int) {
|
||||||
val views = arrayOf<View>(toggle_camera, toggle_flash, toggle_photo_video, shutter, settings, last_photo_video_preview)
|
val views = arrayOf<View>(toggle_camera, toggle_flash, toggle_photo_video, change_resolution, shutter, settings, last_photo_video_preview)
|
||||||
for (view in views) {
|
for (view in views) {
|
||||||
rotate(view, degrees)
|
rotate(view, degrees)
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable-hdpi/ic_resolution.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_resolution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 295 B |
BIN
app/src/main/res/drawable-mdpi/ic_resolution.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_resolution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 184 B |
BIN
app/src/main/res/drawable-xhdpi/ic_resolution.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_resolution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 304 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_resolution.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_resolution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 420 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_resolution.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_resolution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 542 B |
@ -37,12 +37,22 @@
|
|||||||
android:src="@drawable/ic_video"/>
|
android:src="@drawable/ic_video"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/last_photo_video_preview"
|
android:id="@+id/change_resolution"
|
||||||
android:layout_width="@dimen/icon_size"
|
android:layout_width="@dimen/icon_size"
|
||||||
android:layout_height="@dimen/icon_size"
|
android:layout_height="@dimen/icon_size"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_below="@+id/toggle_photo_video"
|
android:layout_below="@+id/toggle_photo_video"
|
||||||
android:layout_marginRight="@dimen/normal_margin"
|
android:layout_marginRight="@dimen/normal_margin"
|
||||||
|
android:padding="@dimen/normal_margin"
|
||||||
|
android:src="@drawable/ic_resolution"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/last_photo_video_preview"
|
||||||
|
android:layout_width="@dimen/icon_size"
|
||||||
|
android:layout_height="@dimen/icon_size"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_below="@+id/change_resolution"
|
||||||
|
android:layout_marginRight="@dimen/normal_margin"
|
||||||
android:padding="@dimen/medium_margin"/>
|
android:padding="@dimen/medium_margin"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user