mirror of
https://github.com/FossifyOrg/Camera.git
synced 2025-12-23 23:59:51 -05:00
fix: buttons rotation (#41)
* fix: buttons rotation * fix: add back shutter rotation --------- Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com> Co-authored-by: Naveen Singh <snaveen935@gmail.com>
This commit is contained in:
@@ -646,15 +646,27 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||
private fun animateViews(degrees: Int) = binding.apply {
|
||||
val views = arrayOf(
|
||||
toggleCamera,
|
||||
layoutTop.toggleTimer,
|
||||
layoutTop.toggleFlash,
|
||||
layoutTop.changeResolution,
|
||||
shutter,
|
||||
layoutTop.settings,
|
||||
lastPhotoVideoPreview
|
||||
lastPhotoVideoPreview,
|
||||
layoutTimer.timerOff,
|
||||
layoutTimer.timer3s,
|
||||
layoutTimer.timer5s,
|
||||
layoutTimer.timer10S,
|
||||
layoutFlash.flashOff,
|
||||
layoutFlash.flashAuto,
|
||||
layoutFlash.flashOn,
|
||||
layoutFlash.flashAlwaysOn
|
||||
)
|
||||
for (view in views) {
|
||||
rotate(view, degrees)
|
||||
}
|
||||
mediaSizeToggleGroup?.children?.forEach { child ->
|
||||
rotate(child, degrees)
|
||||
}
|
||||
}
|
||||
|
||||
private fun rotate(view: View, degrees: Int) =
|
||||
@@ -834,8 +846,15 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener, Camera
|
||||
onSelect.invoke(index, selectedResolution.buttonViewId != clickedViewId)
|
||||
}
|
||||
|
||||
val currentDegrees = when (mLastHandledOrientation) {
|
||||
ORIENT_LANDSCAPE_LEFT -> 90
|
||||
ORIENT_LANDSCAPE_RIGHT -> -90
|
||||
else -> 0
|
||||
}
|
||||
|
||||
resolutions.forEach {
|
||||
val button = createButton(it, onItemClick)
|
||||
button.rotation = currentDegrees.toFloat()
|
||||
mediaSizeToggleGroup.addView(button)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user