mirror of
				https://github.com/SimpleMobileTools/Simple-Camera.git
				synced 2025-06-27 09:02:59 +02:00 
			
		
		
		
	minor code style formatting changes
This commit is contained in:
		| @@ -37,11 +37,11 @@ import com.simplemobiletools.camera.views.FocusCircleView | |||||||
| import com.simplemobiletools.commons.extensions.* | import com.simplemobiletools.commons.extensions.* | ||||||
| import com.simplemobiletools.commons.helpers.* | import com.simplemobiletools.commons.helpers.* | ||||||
| import com.simplemobiletools.commons.models.Release | import com.simplemobiletools.commons.models.Release | ||||||
| import java.util.concurrent.TimeUnit |  | ||||||
| import kotlin.math.abs |  | ||||||
| import kotlinx.android.synthetic.main.activity_main.* | import kotlinx.android.synthetic.main.activity_main.* | ||||||
| import kotlinx.android.synthetic.main.layout_flash.* | import kotlinx.android.synthetic.main.layout_flash.* | ||||||
| import kotlinx.android.synthetic.main.layout_top.* | import kotlinx.android.synthetic.main.layout_top.* | ||||||
|  | import java.util.concurrent.TimeUnit | ||||||
|  | import kotlin.math.abs | ||||||
|  |  | ||||||
| class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, CameraXPreviewListener { | class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, CameraXPreviewListener { | ||||||
|     private companion object { |     private companion object { | ||||||
| @@ -68,7 +68,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|                     when (tab.position) { |                     when (tab.position) { | ||||||
|                         VIDEO_MODE_INDEX -> mPreview?.initVideoMode() |                         VIDEO_MODE_INDEX -> mPreview?.initVideoMode() | ||||||
|                         PHOTO_MODE_INDEX -> mPreview?.initPhotoMode() |                         PHOTO_MODE_INDEX -> mPreview?.initPhotoMode() | ||||||
|                         else -> throw IllegalStateException("Unsupported  tab position ${tab.position}") |                         else -> throw IllegalStateException("Unsupported tab position ${tab.position}") | ||||||
|                     } |                     } | ||||||
|                 } else { |                 } else { | ||||||
|                     toast(R.string.no_audio_permissions) |                     toast(R.string.no_audio_permissions) | ||||||
| @@ -113,6 +113,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|         if (!triggerListener) { |         if (!triggerListener) { | ||||||
|             removeTabListener() |             removeTabListener() | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         camera_mode_tab.getTabAt(PHOTO_MODE_INDEX)?.select() |         camera_mode_tab.getTabAt(PHOTO_MODE_INDEX)?.select() | ||||||
|         setTabListener() |         setTabListener() | ||||||
|     } |     } | ||||||
| @@ -142,6 +143,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|             toggleBottomButtons(enabled = true) |             toggleBottomButtons(enabled = true) | ||||||
|             mOrientationEventListener.enable() |             mOrientationEventListener.enable() | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |         window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | ||||||
|         ensureTransparentNavigationBar() |         ensureTransparentNavigationBar() | ||||||
|     } |     } | ||||||
| @@ -156,6 +158,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|         if (!hasStorageAndCameraPermissions() || isAskingPermissions) { |         if (!hasStorageAndCameraPermissions() || isAskingPermissions) { | ||||||
|             return |             return | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         mOrientationEventListener.disable() |         mOrientationEventListener.disable() | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -238,14 +241,13 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun isInPhotoMode(): Boolean { |     private fun isInPhotoMode(): Boolean { | ||||||
|         return mPreview?.isInPhotoMode() |         return mPreview?.isInPhotoMode() ?: if (isVideoCaptureIntent()) { | ||||||
|             ?: if (isVideoCaptureIntent()) { |             false | ||||||
|                 false |         } else if (isImageCaptureIntent()) { | ||||||
|             } else if (isImageCaptureIntent()) { |             true | ||||||
|                 true |         } else { | ||||||
|             } else { |             config.initPhotoMode | ||||||
|                 config.initPhotoMode |         } | ||||||
|             } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun handleStoragePermission(callback: (granted: Boolean) -> Unit) { |     private fun handleStoragePermission(callback: (granted: Boolean) -> Unit) { | ||||||
| @@ -479,7 +481,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     private fun hasStorageAndCameraPermissions(): Boolean { |     private fun hasStorageAndCameraPermissions(): Boolean { | ||||||
|         return if (isInPhotoMode()) hasPhotoModePermissions() else hasVideoModePermissions() |         return if (isInPhotoMode()) hasPhotoModePermissions() else hasVideoModePermissions() | ||||||
|     } |     } | ||||||
| @@ -677,11 +678,11 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|         isFrontCamera: Boolean, |         isFrontCamera: Boolean, | ||||||
|         onSelect: (index: Int, changed: Boolean) -> Unit |         onSelect: (index: Int, changed: Boolean) -> Unit | ||||||
|     ) { |     ) { | ||||||
|  |  | ||||||
|         top_options.removeView(mediaSizeToggleGroup) |         top_options.removeView(mediaSizeToggleGroup) | ||||||
|         val mediaSizeToggleGroup = createToggleGroup().apply { |         val mediaSizeToggleGroup = createToggleGroup().apply { | ||||||
|             mediaSizeToggleGroup = this |             mediaSizeToggleGroup = this | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         top_options.addView(mediaSizeToggleGroup) |         top_options.addView(mediaSizeToggleGroup) | ||||||
|  |  | ||||||
|         val onItemClick = { clickedViewId: Int -> |         val onItemClick = { clickedViewId: Int -> | ||||||
| @@ -709,6 +710,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera | |||||||
|         val params = LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT).apply { |         val params = LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT).apply { | ||||||
|             weight = 1f |             weight = 1f | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return (layoutInflater.inflate(R.layout.layout_button, null) as MaterialButton).apply { |         return (layoutInflater.inflate(R.layout.layout_button, null) as MaterialButton).apply { | ||||||
|             layoutParams = params |             layoutParams = params | ||||||
|             setShadowIcon(resolutionOption.imageDrawableResId) |             setShadowIcon(resolutionOption.imageDrawableResId) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user