create a dialog for changing resolutions

This commit is contained in:
tibbi 2017-03-20 21:02:20 +01:00
parent 74863e3149
commit 0afb2d57a8
13 changed files with 117 additions and 20 deletions

View File

@ -21,6 +21,7 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.simplemobiletools.camera.*
import com.simplemobiletools.camera.Preview.PreviewListener
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
import com.simplemobiletools.camera.extensions.config
import com.simplemobiletools.camera.views.FocusRectView
import com.simplemobiletools.commons.extensions.*
@ -304,7 +305,9 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
}
private fun handleChangeResolution() {
ChangeResolutionDialog(this, true) {
}
}
private fun togglePhotoVideo() {

View File

@ -0,0 +1,28 @@
package com.simplemobiletools.camera.dialogs
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import com.simplemobiletools.camera.R
import com.simplemobiletools.camera.activities.SimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_change_resolution.view.*
class ChangeResolutionDialog(val activity: SimpleActivity, val backCamera: Boolean, val callback: () -> Unit) {
init {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_resolution, null).apply {
change_resolution_photo_holder.setOnClickListener {
}
change_resolution_video_holder.setOnClickListener {
}
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.create().apply {
activity.setupDialogStuff(view, this, if (backCamera) R.string.back_camera else R.string.front_camera)
}
}
}

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/change_resolution_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
<RelativeLayout
android:id="@+id/change_resolution_photo_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/change_resolution_photo_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/change_resolution_photo"
android:layout_toStartOf="@+id/change_resolution_photo"
android:text="@string/photo"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/change_resolution_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@null"
android:clickable="false"
android:text="qwe"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/change_resolution_video_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/change_resolution_video_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/change_resolution_video"
android:layout_toStartOf="@+id/change_resolution_video"
android:text="@string/video"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/change_resolution_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@null"
android:clickable="false"
android:text="qwe"/>
</RelativeLayout>
</LinearLayout>

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Auslösegeräusch</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Sonido del obturador</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Son de l\'obturateur</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Suono otturatore</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">シャッター音</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Užrakto garsas</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Som do obturador</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Звук затвора</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Slutarljud</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -19,8 +19,8 @@
<string name="shutter_sound">Shutter sound</string>
<string name="back_camera">Back camera resolutions</string>
<string name="front_camera">Front camera resolutions</string>
<string name="photo_resolution">Photo</string>
<string name="video_resolution">Video</string>
<string name="photo">Photo</string>
<string name="video">Video</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->