• R/O
  • HTTP
  • SSH
  • HTTPS

mangle: Commit

A01e : multi-wifi camera control


Commit MetaInfo

Revisão2a23639304b6498c3f76613525b70ddab6c060b9 (tree)
Hora2020-09-06 12:56:48
AutorMRSa <mrsa@myad...>
CommiterMRSa

Mensagem de Log

いったんここで。共通フォルダに保存できるようにしたが、ファイル名等の調整が必要。

Mudança Sumário

Diff

--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
33 apply plugin: 'kotlin-android-extensions'
44
55 android {
6- compileSdkVersion 29
6+ compileSdkVersion 30
77
88 defaultConfig {
99 applicationId "jp.osdn.gokigen.mangle"
1010 minSdkVersion 21
11- targetSdkVersion 29
11+ targetSdkVersion 30
1212 versionCode 1000000
1313 versionName "1.0.0"
1414
@@ -35,7 +35,7 @@ dependencies {
3535 implementation 'androidx.appcompat:appcompat:1.2.0'
3636 implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
3737 implementation 'androidx.preference:preference:1.1.1'
38- implementation 'com.google.android.material:material:1.2.0'
38+ implementation 'com.google.android.material:material:1.2.1'
3939
4040 testImplementation 'junit:junit:4.12'
4141 androidTestImplementation 'androidx.test.ext:junit:1.1.2'
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -5,6 +5,7 @@
55 <uses-feature android:name="android.hardware.camera.any" />
66 <uses-permission android:name="android.permission.CAMERA" />
77 <uses-permission android:name="android.permission.VIBRATE" />
8+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
89
910 <application
1011 android:allowBackup="true"
--- a/app/src/main/java/jp/osdn/gokigen/mangle/MainActivity.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/MainActivity.kt
@@ -1,7 +1,9 @@
11 package jp.osdn.gokigen.mangle
22
33 import android.Manifest
4+import android.content.Intent
45 import android.content.pm.PackageManager
6+import android.os.Build
57 import android.os.Bundle
68 import android.util.Log
79 import android.view.WindowManager
@@ -10,18 +12,15 @@ import androidx.appcompat.app.AppCompatActivity
1012 import androidx.core.app.ActivityCompat
1113 import androidx.core.content.ContextCompat
1214 import jp.osdn.gokigen.mangle.scene.MainButtonHandler
13-import jp.osdn.gokigen.mangle.scene.ShowMessage
1415 import jp.osdn.gokigen.mangle.scene.SceneChanger
16+import jp.osdn.gokigen.mangle.scene.ShowMessage
1517
1618 class MainActivity : AppCompatActivity()
1719 {
1820 private val TAG = toString()
1921 private val mainButtonHandler : MainButtonHandler = MainButtonHandler(this)
2022 private val showMessage : ShowMessage = ShowMessage(this)
21-
22- //private var cameraControl: CameraControl? = null
2323 private val sceneChanger : SceneChanger = SceneChanger(this, showMessage)
24- //private var sceneChanger : SceneChanger? = null // = SceneChanger(this, this)
2524
2625 override fun onCreate(savedInstanceState: Bundle?)
2726 {
@@ -34,11 +33,9 @@ class MainActivity : AppCompatActivity()
3433 supportActionBar?.hide()
3534 window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
3635
37- //sceneChanger = SceneChanger(this, this)
38- //cameraControl = CameraControl(this)
3936 if (allPermissionsGranted())
4037 {
41- //cameraControl?.startCamera()
38+ checkMediaWritePermission()
4239 sceneChanger.initializeFragment()
4340 mainButtonHandler.initialize()
4441 }
@@ -46,29 +43,33 @@ class MainActivity : AppCompatActivity()
4643 {
4744 ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS)
4845 }
49- //cameraControl?.initialize()
5046 }
5147
5248 override fun onDestroy()
5349 {
5450 super.onDestroy()
5551 sceneChanger.finish()
56- //cameraControl?.finish()
57-
58- //sceneChanger = null
5952 }
6053
6154 private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
6255 ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED
6356 }
6457
58+ private fun checkMediaWritePermission()
59+ {
60+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
61+ {
62+ StorageOperationWithPermission(this).requestAndroidRMediaPermission()
63+ }
64+ }
65+
6566 override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray)
6667 {
6768 if (requestCode == REQUEST_CODE_PERMISSIONS)
6869 {
6970 if (allPermissionsGranted())
7071 {
71- //cameraControl?.startCamera()
72+ checkMediaWritePermission()
7273 sceneChanger.initializeFragment()
7374 mainButtonHandler.initialize()
7475 }
@@ -81,9 +82,22 @@ class MainActivity : AppCompatActivity()
8182 }
8283 }
8384
85+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?)
86+ {
87+ super.onActivityResult(requestCode, resultCode, data)
88+ if ((requestCode == REQUEST_CODE_MEDIA_EDIT)&&(resultCode == RESULT_OK))
89+ {
90+ //
91+ Log.v(TAG, " WRITE PERMISSION GRANTED")
92+ }
93+ }
94+
8495 companion object
8596 {
8697 private const val REQUEST_CODE_PERMISSIONS = 10
87- private val REQUIRED_PERMISSIONS = arrayOf(Manifest.permission.CAMERA)
98+ const val REQUEST_CODE_MEDIA_EDIT = 12
99+ private val REQUIRED_PERMISSIONS = arrayOf(Manifest.permission.CAMERA,
100+ Manifest.permission.VIBRATE,
101+ Manifest.permission.WRITE_EXTERNAL_STORAGE)
88102 }
89103 }
--- /dev/null
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/StorageOperationWithPermission.kt
@@ -0,0 +1,28 @@
1+package jp.osdn.gokigen.mangle
2+
3+import android.content.ContentResolver
4+import android.net.Uri
5+import android.os.Build
6+import android.provider.MediaStore
7+import androidx.annotation.RequiresApi
8+import androidx.appcompat.app.AppCompatActivity
9+
10+/**
11+ *
12+ *
13+ */
14+@RequiresApi(api = Build.VERSION_CODES.R)
15+class StorageOperationWithPermission(val activity: AppCompatActivity)
16+{
17+ fun requestAndroidRMediaPermission()
18+ {
19+ val urisToModify: List<Uri> = listOf(
20+ MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
21+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI
22+ )
23+ val contentResolver : ContentResolver = activity.contentResolver
24+ val editPendingIntent = MediaStore.createWriteRequest(contentResolver, urisToModify)
25+
26+ activity.startIntentSenderForResult(editPendingIntent.intentSender, MainActivity.REQUEST_CODE_MEDIA_EDIT,null, 0, 0, 0)
27+ }
28+}
--- a/app/src/main/java/jp/osdn/gokigen/mangle/operation/CameraControl.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/operation/CameraControl.kt
@@ -1,6 +1,7 @@
11 package jp.osdn.gokigen.mangle.operation
22
33 import android.util.Log
4+import android.util.Size
45 import androidx.camera.core.CameraSelector
56 import androidx.camera.core.ImageAnalysis
67 import androidx.camera.core.Preview
@@ -26,7 +27,6 @@ class CameraControl(val activity : FragmentActivity)
2627 fun initialize()
2728 {
2829 Log.v(TAG, " initialize()")
29- fileControl.initialize()
3030 cameraExecutor = Executors.newSingleThreadExecutor()
3131 }
3232
@@ -54,6 +54,8 @@ class CameraControl(val activity : FragmentActivity)
5454 try
5555 {
5656 val imageAnalyzer = ImageAnalysis.Builder()
57+ .setTargetResolution(Size(800, 600))
58+ .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
5759 .build()
5860 .also {
5961 it.setAnalyzer(cameraExecutor, MyImageAnalyzer { luma ->
@@ -69,6 +71,7 @@ class CameraControl(val activity : FragmentActivity)
6971 e.printStackTrace()
7072 }
7173 }, ContextCompat.getMainExecutor(activity))
74+
7275 }
7376
7477 fun finish()
--- a/app/src/main/java/jp/osdn/gokigen/mangle/operation/FileControl.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/operation/FileControl.kt
@@ -1,6 +1,10 @@
11 package jp.osdn.gokigen.mangle.operation
22
3+import android.content.ContentValues
34 import android.net.Uri
5+import android.os.Build
6+import android.os.Environment
7+import android.provider.MediaStore
48 import android.util.Log
59 import android.view.View
610 import android.widget.Button
@@ -8,10 +12,11 @@ import androidx.camera.core.ImageCapture
812 import androidx.camera.core.ImageCaptureException
913 import androidx.core.content.ContextCompat
1014 import androidx.fragment.app.FragmentActivity
15+import androidx.preference.PreferenceManager
1116 import com.google.android.material.snackbar.Snackbar
1217 import jp.osdn.gokigen.mangle.R
18+import jp.osdn.gokigen.mangle.preference.IPreferencePropertyAccessor
1319 import java.io.File
14-import java.lang.Exception
1520 import java.text.SimpleDateFormat
1621 import java.util.*
1722
@@ -19,28 +24,24 @@ class FileControl(private val context: FragmentActivity) : View.OnClickListener
1924 {
2025 private val TAG = toString()
2126 private val FILENAME_FORMAT = "yyyy-MM-dd-HH-mm-ss-SSS"
22-
23- private lateinit var outputDirectory: File
2427 private var imageCapture: ImageCapture? = null
2528
29+ //private lateinit var outputDirectory: File
30+ //private var isLocalLocation : Boolean = false
31+
2632 init
2733 {
2834
2935 }
3036
31- fun initialize()
32- {
33- outputDirectory = getOutputDirectory()
34- context.findViewById<Button>(R.id.camera_capture_button)?.setOnClickListener( this )
35- }
36-
3737 fun prepare() : ImageCapture?
3838 {
3939 try
4040 {
41+ context.findViewById<Button>(R.id.camera_capture_button)?.setOnClickListener(this)
4142 imageCapture = ImageCapture.Builder().build()
4243 }
43- catch (e : Exception)
44+ catch (e: Exception)
4445 {
4546 e.printStackTrace()
4647 }
@@ -52,46 +53,195 @@ class FileControl(private val context: FragmentActivity) : View.OnClickListener
5253
5354 }
5455
55- private fun getOutputDirectory(): File
56+ /**
57+ * 保存用ディレクトリを準備する(ダメな場合はアプリ領域のディレクトリを確保する)
58+ *
59+ */
60+ private fun prepareLocalOutputDirectory(): File
5661 {
57- val mediaDir = context.externalMediaDirs.firstOrNull()?.let {
58- File(it, context.resources.getString(R.string.app_name)).apply { mkdirs() }
59- }
62+ val mediaDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
63+ mediaDir?.mkdirs()
6064 return (if (mediaDir != null && mediaDir.exists()) mediaDir else context.filesDir)
6165 }
6266
63- private fun takePhoto()
67+ private fun takePhotoLocal()
6468 {
65- Log.v(TAG, " takePhoto()")
66-
6769 val imageCapture = imageCapture ?: return
68- val photoFile = File(outputDirectory, SimpleDateFormat(FILENAME_FORMAT, Locale.US).format(System.currentTimeMillis()) + ".jpg")
70+
71+ Log.v(TAG, " takePhotoLocal()")
72+ val photoFile = File(prepareLocalOutputDirectory(), SimpleDateFormat(FILENAME_FORMAT, Locale.US).format(System.currentTimeMillis()) + ".jpg")
6973 val outputOptions = ImageCapture.OutputFileOptions.Builder(photoFile).build()
7074
7175 imageCapture.takePicture(
72- outputOptions, ContextCompat.getMainExecutor(context), object : ImageCapture.OnImageSavedCallback {
73- override fun onError(exc: ImageCaptureException) {
76+ outputOptions,
77+ ContextCompat.getMainExecutor(context),
78+ object : ImageCapture.OnImageSavedCallback
79+ {
80+ override fun onError(exc: ImageCaptureException)
81+ {
7482 Log.e(TAG, "Photo capture failed: ${exc.message}", exc)
7583 }
7684
77- override fun onImageSaved(output: ImageCapture.OutputFileResults) {
85+ override fun onImageSaved(output: ImageCapture.OutputFileResults)
86+ {
7887 val savedUri = Uri.fromFile(photoFile)
7988 val msg = context.getString(R.string.capture_success) + " $savedUri"
8089 //Toast.makeText(context.baseContext, msg, Toast.LENGTH_SHORT).show()
81- Snackbar.make(context.findViewById<androidx.constraintlayout.widget.ConstraintLayout>(
82- R.id.main_layout
83- ), msg, Snackbar.LENGTH_SHORT).show()
90+ Snackbar.make(
91+ context.findViewById<androidx.constraintlayout.widget.ConstraintLayout>(
92+ R.id.main_layout
93+ ), msg, Snackbar.LENGTH_SHORT
94+ ).show()
8495 Log.v(TAG, msg)
8596 }
86- })
97+ }
98+ )
99+ }
100+
101+ private fun getExternalOutputDirectory(): File
102+ {
103+ val directoryPath = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).path + "/" + context.getString(R.string.app_location) + "/").toLowerCase(Locale.US)
104+ val target = File(directoryPath)
105+ try
106+ {
107+ target.mkdirs()
108+ }
109+ catch (e: Exception)
110+ {
111+ e.printStackTrace()
112+ }
113+ Log.v(TAG, " ----- RECORD Directory PATH : $directoryPath -----")
114+ return (target)
115+ }
116+
117+ private fun takePhotoExternal()
118+ {
119+ val imageCapture = imageCapture ?: return
120+ if (!isExternalStorageWritable())
121+ {
122+ takePhotoLocal()
123+ return
124+ }
125+ Log.v(TAG, " takePhotoExternal()")
126+
127+ val outputDir = getExternalOutputDirectory()
128+ val resolver = context.contentResolver
129+
130+ val mimeType = "image/jpeg"
131+ val now = System.currentTimeMillis()
132+ val path = "DCIM/aira01a"
133+ val photoFile = SimpleDateFormat(FILENAME_FORMAT, Locale.US).format(now) + ".jpg"
134+
135+ val extStorageUri : Uri
136+ val values = ContentValues()
137+ values.put(MediaStore.Images.Media.DISPLAY_NAME,photoFile)
138+ values.put(MediaStore.Images.Media.MIME_TYPE, mimeType)
139+ values.put(MediaStore.Images.Media.DATE_ADDED, now)
140+ values.put(MediaStore.Images.Media.DATE_MODIFIED, now)
141+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
142+ {
143+ values.put(MediaStore.Images.Media.DATA, photoFile)
144+ values.put(MediaStore.Images.Media.DATE_TAKEN, now)
145+ values.put(MediaStore.Images.Media.RELATIVE_PATH, path)
146+ values.put(MediaStore.Images.Media.IS_PENDING, true)
147+ extStorageUri = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY + "/" + photoFile)
148+ }
149+ else
150+ {
151+ extStorageUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
152+ }
153+
154+ val imageUri = resolver.insert(extStorageUri, values)
155+ if (imageUri != null)
156+ {
157+ val openStream = resolver.openOutputStream(imageUri)
158+ if (openStream != null)
159+ {
160+ val outputOptions = ImageCapture.OutputFileOptions.Builder(openStream).build()
161+ imageCapture.takePicture(
162+ outputOptions,
163+ ContextCompat.getMainExecutor(context),
164+ object : ImageCapture.OnImageSavedCallback
165+ {
166+ override fun onError(exc: ImageCaptureException)
167+ {
168+ Log.e(TAG, "Photo capture failed: ${exc.message}", exc)
169+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
170+ {
171+ values.clear()
172+ values.put(MediaStore.Images.Media.IS_PENDING, false)
173+ resolver.update(imageUri, values, null, null)
174+ }
175+ }
176+
177+ override fun onImageSaved(output: ImageCapture.OutputFileResults)
178+ {
179+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
180+ {
181+ //values.clear()
182+ values.put(MediaStore.Images.Media.IS_PENDING, false)
183+ resolver.update(imageUri, values, null, null)
184+ }
185+ val msg = context.getString(R.string.capture_success) + " $extStorageUri $path $photoFile"
186+ //Toast.makeText(context.baseContext, msg, Toast.LENGTH_SHORT).show()
187+ Snackbar.make(
188+ context.findViewById<androidx.constraintlayout.widget.ConstraintLayout>(
189+ R.id.main_layout
190+ ), msg, Snackbar.LENGTH_SHORT
191+ ).show()
192+ Log.v(TAG, msg)
193+ }
194+ })
195+ }
196+ }
197+ }
198+
199+ private fun takePhoto()
200+ {
201+ Log.v(TAG, " takePhoto()")
202+ try
203+ {
204+ val isLocalLocation = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
205+ IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION,
206+ IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION_DEFAULT_VALUE
207+ )
208+ if (isLocalLocation)
209+ {
210+ takePhotoLocal()
211+ }
212+ else
213+ {
214+ takePhotoExternal()
215+ }
216+ }
217+ catch (e: Exception)
218+ {
219+ e.printStackTrace()
220+ }
221+ }
222+
223+ private fun isExternalStorageWritable(): Boolean
224+ {
225+ return (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED)
226+ }
227+
228+/*
229+ private fun isExternalStorageReadable(): Boolean
230+ {
231+ return (Environment.getExternalStorageState() in setOf(
232+ Environment.MEDIA_MOUNTED,
233+ Environment.MEDIA_MOUNTED_READ_ONLY
234+ ))
87235 }
236+*/
88237
89238 override fun onClick(v: View?)
90239 {
240+ Log.v(TAG, " onClick : $v?.id ")
91241 when (v?.id)
92242 {
93243 R.id.camera_capture_button -> takePhoto()
94244 else -> Log.v(TAG, " Unknown ID : " + v?.id)
95245 }
96246 }
97-}
\ No newline at end of file
247+}
--- a/app/src/main/java/jp/osdn/gokigen/mangle/preference/IPreferencePropertyAccessor.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/preference/IPreferencePropertyAccessor.kt
@@ -5,15 +5,18 @@ interface IPreferencePropertyAccessor
55
66 companion object
77 {
8- val PREFERENCE_NOTIFICATIONS = "show_notifications"
9- val PREFERENCE_NOTIFICATIONS_DEFAULT_VALUE : Boolean = false
8+ // --- PREFERENCE KEY AND DEFAULT VALUE ---
9+ const val PREFERENCE_NOTIFICATIONS = "show_notifications"
10+ const val PREFERENCE_NOTIFICATIONS_DEFAULT_VALUE = false
11+ const val PREFERENCE_SAVE_LOCAL_LOCATION = "save_local_location"
12+ const val PREFERENCE_SAVE_LOCAL_LOCATION_DEFAULT_VALUE = false
1013
1114 // --- SCREEN TRANSACTION LABEL ---
12- val LABEL_EXIT_APPLICATION = "exit_application"
13- val LABEL_WIFI_SETTINGS = "wifi_settings"
14- val LABEL_INSTRUCTION_LINK = "instruction_link"
15- val LABEL_PRIVACY_POLICY = "privacy_policy"
16- val LABEL_DEBUG_INFO = "debug_info"
15+ const val LABEL_EXIT_APPLICATION = "exit_application"
16+ const val LABEL_WIFI_SETTINGS = "wifi_settings"
17+ const val LABEL_INSTRUCTION_LINK = "instruction_link"
18+ const val LABEL_PRIVACY_POLICY = "privacy_policy"
19+ const val LABEL_DEBUG_INFO = "debug_info"
1720 }
1821
1922 }
--- a/app/src/main/java/jp/osdn/gokigen/mangle/preference/MainPreferenceFragment.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/preference/MainPreferenceFragment.kt
@@ -50,28 +50,17 @@ class MainPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceCha
5050 Log.v(TAG, " onAttach() : ")
5151
5252 preferences = PreferenceManager.getDefaultSharedPreferences(context)
53- PreferenceInitializer().initializePreferences(preferences)
53+ PreferenceValueInitializer().initializePreferences(preferences)
5454 preferences.registerOnSharedPreferenceChangeListener(this)
5555 }
5656
57- override fun onResume()
58- {
59- super.onResume()
60- Log.v(TAG, " onResume() : ")
61- }
62-
63- override fun onPause()
64- {
65- super.onPause()
66- Log.v(TAG, " onPause() : ")
67- }
68-
6957 override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?)
7058 {
7159 var value = false
7260 when (key)
7361 {
7462 IPreferencePropertyAccessor.PREFERENCE_NOTIFICATIONS -> value = preferences.getBoolean(key, IPreferencePropertyAccessor.PREFERENCE_NOTIFICATIONS_DEFAULT_VALUE)
63+ IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION -> value = preferences.getBoolean(key, IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION_DEFAULT_VALUE)
7564 // else -> Log.v(TAG, " onSharedPreferenceChanged() : + $key ")
7665 }
7766 Log.v(TAG, " onSharedPreferenceChanged() : + $key, $value")
--- a/app/src/main/java/jp/osdn/gokigen/mangle/preference/PreferenceInitializer.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/preference/PreferenceValueInitializer.kt
@@ -2,7 +2,7 @@ package jp.osdn.gokigen.mangle.preference
22
33 import android.content.SharedPreferences
44
5-class PreferenceInitializer
5+class PreferenceValueInitializer
66 {
77 fun initializePreferences(preferences : SharedPreferences)
88 {
@@ -13,6 +13,10 @@ class PreferenceInitializer
1313 {
1414 editor.putBoolean(IPreferencePropertyAccessor.PREFERENCE_NOTIFICATIONS, IPreferencePropertyAccessor.PREFERENCE_NOTIFICATIONS_DEFAULT_VALUE)
1515 }
16+ if (!items.containsKey(IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION))
17+ {
18+ editor.putBoolean(IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION, IPreferencePropertyAccessor.PREFERENCE_SAVE_LOCAL_LOCATION_DEFAULT_VALUE)
19+ }
1620 editor.apply()
1721 }
1822
--- a/app/src/main/java/jp/osdn/gokigen/mangle/preview/PreviewFragment.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/preview/PreviewFragment.kt
@@ -33,7 +33,6 @@ class PreviewFragment(contentLayoutId: Int = R.layout.camera_capture) : Fragment
3333 return (previewView)
3434 }
3535 previewView = inflater.inflate(R.layout.camera_capture, null, false)
36- //cameraControl?.initialize()
3736 return (previewView)
3837 }
3938
--- a/app/src/main/java/jp/osdn/gokigen/mangle/scene/SceneChanger.kt
+++ b/app/src/main/java/jp/osdn/gokigen/mangle/scene/SceneChanger.kt
@@ -17,7 +17,7 @@ class SceneChanger(val activity: FragmentActivity, val informationNotify: IInfor
1717 {
1818 private val TAG = toString()
1919 private val cameraControl: CameraControl = CameraControl(activity)
20- private var count : Int = 0
20+
2121 private lateinit var previewFragment : PreviewFragment
2222 private lateinit var logCatFragment : LogCatFragment
2323 private lateinit var mainPreferenceFragment : MainPreferenceFragment
@@ -34,11 +34,8 @@ class SceneChanger(val activity: FragmentActivity, val informationNotify: IInfor
3434 previewFragment = PreviewFragment.newInstance()
3535 previewFragment.setCameraControl(cameraControl)
3636 }
37- cameraControl.startCamera()
3837 setDefaultFragment(previewFragment)
39-
40- count++
41- informationNotify.updateMessage(" changeToPreview " + count, false, true, Color.BLUE)
38+ cameraControl.startCamera()
4239 }
4340
4441 override fun changeToPreview()
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -1,6 +1,7 @@
11 <resources>
22 <string name="blank"> </string>
3- <string name="app_name">mangle</string>
3+ <string name="app_name">A01e</string>
4+ <string name="app_location">AirA01a</string>
45 <string name="action_refresh">更新</string>
56 <string name="finish_refresh">更新終了</string>
67 <string name="dialog_positive_execute">OK</string>
@@ -25,6 +26,9 @@
2526 <string name="pref_wifi_settings">WiFi設定</string>
2627 <string name="pref_summary_wifi_settings"> </string>
2728
29+ <string name="pref_cat_application_settings">アプリ設定</string>
30+ <string name="save_local_location">アプリ固有領域に保存</string>
31+
2832 <string name="dialog_title_exit_application">アプリケーション終了</string>
2933 <string name="dialog_message_exit_application">アプリケーションを終了します。</string>
3034
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,7 @@
11 <resources>
22 <string name="blank"> </string>
3- <string name="app_name">mangle</string>
3+ <string name="app_name">A01e</string>
4+ <string name="app_location">AirA01a</string>
45 <string name="action_refresh">Refresh</string>
56 <string name="finish_refresh">Finish refresh.</string>
67 <string name="dialog_positive_execute">OK</string>
@@ -25,6 +26,9 @@
2526 <string name="pref_wifi_settings">WIFI Settings</string>
2627 <string name="pref_summary_wifi_settings"> </string>
2728
29+ <string name="pref_cat_application_settings">App. Settings</string>
30+ <string name="save_local_location">Save local location</string>
31+
2832 <string name="dialog_title_exit_application">Exit Application</string>
2933 <string name="dialog_message_exit_application">Exit Application</string>
3034
--- a/app/src/main/res/xml/preference_main.xml
+++ b/app/src/main/res/xml/preference_main.xml
@@ -14,9 +14,18 @@
1414 android:key="wifi_settings"
1515 android:title="@string/pref_wifi_settings"
1616 android:summary="@string/pref_summary_wifi_settings" />
17+ </PreferenceCategory>
18+
19+ <PreferenceCategory
20+ app:title="@string/pref_cat_application_settings">
21+<!--
1722 <SwitchPreferenceCompat
1823 android:key="show_notifications"
1924 android:title="@string/notification_title"/>
25+-->
26+ <SwitchPreferenceCompat
27+ android:key="save_local_location"
28+ android:title="@string/save_local_location"/>
2029 </PreferenceCategory>
2130
2231 <PreferenceCategory
Show on old repository browser