make all top icons Buttons with same height
This commit is contained in:
parent
a324da022a
commit
c38bab6824
|
@ -402,7 +402,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
FLASH_ON -> R.drawable.ic_flash_on_vector
|
FLASH_ON -> R.drawable.ic_flash_on_vector
|
||||||
else -> R.drawable.ic_flash_auto_vector
|
else -> R.drawable.ic_flash_auto_vector
|
||||||
}
|
}
|
||||||
toggle_flash.setImageResource(flashDrawable)
|
toggle_flash.icon = AppCompatResources.getDrawable(this, flashDrawable)
|
||||||
toggle_flash.transitionName = "${getString(R.string.toggle_flash)}$state"
|
toggle_flash.transitionName = "${getString(R.string.toggle_flash)}$state"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,8 +555,20 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasStorageAndCameraPermissions(): Boolean {
|
private fun hasStorageAndCameraPermissions(): Boolean {
|
||||||
return if (mIsInPhotoMode) {
|
return if (mIsInPhotoMode) hasPhotoModePermissions() else hasVideoModePermissions()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun hasPhotoModePermissions(): Boolean {
|
||||||
|
return if (isTiramisuPlus()) {
|
||||||
|
hasPermission(PERMISSION_READ_MEDIA_IMAGES) && hasPermission(PERMISSION_CAMERA)
|
||||||
|
} else {
|
||||||
hasPermission(PERMISSION_WRITE_STORAGE) && hasPermission(PERMISSION_CAMERA)
|
hasPermission(PERMISSION_WRITE_STORAGE) && hasPermission(PERMISSION_CAMERA)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun hasVideoModePermissions(): Boolean {
|
||||||
|
return if (isTiramisuPlus()) {
|
||||||
|
hasPermission(PERMISSION_READ_MEDIA_VIDEO) && hasPermission(PERMISSION_CAMERA) && hasPermission(PERMISSION_RECORD_AUDIO)
|
||||||
} else {
|
} else {
|
||||||
hasPermission(PERMISSION_WRITE_STORAGE) && hasPermission(PERMISSION_CAMERA) && hasPermission(PERMISSION_RECORD_AUDIO)
|
hasPermission(PERMISSION_WRITE_STORAGE) && hasPermission(PERMISSION_CAMERA) && hasPermission(PERMISSION_RECORD_AUDIO)
|
||||||
}
|
}
|
||||||
|
@ -619,7 +631,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
toggle_flash.beVisible()
|
toggle_flash.beVisible()
|
||||||
} else {
|
} else {
|
||||||
toggle_flash.beInvisible()
|
toggle_flash.beInvisible()
|
||||||
toggle_flash.setImageResource(R.drawable.ic_flash_off_vector)
|
toggle_flash.icon = AppCompatResources.getDrawable(this, R.drawable.ic_flash_off_vector)
|
||||||
mPreview?.setFlashlightState(FLASH_OFF)
|
mPreview?.setFlashlightState(FLASH_OFF)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,7 +740,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||||
|
|
||||||
override fun displaySelectedResolution(resolutionOption: ResolutionOption) {
|
override fun displaySelectedResolution(resolutionOption: ResolutionOption) {
|
||||||
val imageRes = resolutionOption.imageDrawableResId
|
val imageRes = resolutionOption.imageDrawableResId
|
||||||
change_resolution.setImageResource(imageRes)
|
change_resolution.icon = AppCompatResources.getDrawable(this, imageRes)
|
||||||
change_resolution.transitionName = "${resolutionOption.buttonViewId}"
|
change_resolution.transitionName = "${resolutionOption.buttonViewId}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,22 +7,24 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/toggle_flash"
|
android:id="@+id/toggle_flash"
|
||||||
|
style="@style/Widget.App.Button.OutlineButton.IconOnly"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:contentDescription="@string/toggle_flash"
|
android:contentDescription="@string/toggle_flash"
|
||||||
android:padding="@dimen/normal_margin"
|
android:padding="@dimen/normal_margin"
|
||||||
android:src="@drawable/ic_flash_off_vector"
|
app:icon="@drawable/ic_flash_off_vector"
|
||||||
app:layout_constraintEnd_toStartOf="@id/change_resolution"
|
app:layout_constraintEnd_toStartOf="@id/change_resolution"
|
||||||
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
app:layout_constraintHorizontal_chainStyle="spread_inside"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/change_resolution"
|
android:id="@+id/change_resolution"
|
||||||
|
style="@style/Widget.App.Button.OutlineButton.IconOnly"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -32,16 +34,17 @@
|
||||||
app:layout_constraintEnd_toStartOf="@id/settings"
|
app:layout_constraintEnd_toStartOf="@id/settings"
|
||||||
app:layout_constraintStart_toEndOf="@id/toggle_flash"
|
app:layout_constraintStart_toEndOf="@id/toggle_flash"
|
||||||
app:layout_constraintTop_toTopOf="@id/toggle_flash"
|
app:layout_constraintTop_toTopOf="@id/toggle_flash"
|
||||||
tools:src="@drawable/ic_photo_4x3" />
|
tools:icon="@drawable/ic_photo_4x3" />
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/settings"
|
android:id="@+id/settings"
|
||||||
|
style="@style/Widget.App.Button.OutlineButton.IconOnly"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:contentDescription="@string/settings"
|
android:contentDescription="@string/settings"
|
||||||
android:padding="@dimen/normal_margin"
|
android:padding="@dimen/normal_margin"
|
||||||
android:src="@drawable/ic_settings_cog_vector"
|
app:icon="@drawable/ic_settings_cog_vector"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/change_resolution"
|
app:layout_constraintStart_toEndOf="@id/change_resolution"
|
||||||
app:layout_constraintTop_toTopOf="@id/toggle_flash" />
|
app:layout_constraintTop_toTopOf="@id/toggle_flash" />
|
||||||
|
|
Loading…
Reference in New Issue