replace the editors Flip menu items with bottom actions
|
@ -115,8 +115,6 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.save_as -> crop_image_view.getCroppedImageAsync()
|
||||
R.id.flip_horizontally -> flipImage(true)
|
||||
R.id.flip_vertically -> flipImage(false)
|
||||
R.id.edit -> editWith()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
@ -132,6 +130,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
bottom_resize.setOnClickListener {
|
||||
resizeImage()
|
||||
}
|
||||
|
||||
bottom_flip_horizontally.setOnClickListener {
|
||||
crop_image_view.flipImageHorizontally()
|
||||
}
|
||||
|
||||
bottom_flip_vertically.setOnClickListener {
|
||||
crop_image_view.flipImageVertically()
|
||||
}
|
||||
}
|
||||
|
||||
private fun resizeImage() {
|
||||
|
@ -258,14 +264,6 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
out.close()
|
||||
}
|
||||
|
||||
private fun flipImage(horizontally: Boolean) {
|
||||
if (horizontally) {
|
||||
crop_image_view.flipImageHorizontally()
|
||||
} else {
|
||||
crop_image_view.flipImageVertically()
|
||||
}
|
||||
}
|
||||
|
||||
private fun editWith() {
|
||||
openEditor(uri.toString())
|
||||
isEditingWithThirdParty = true
|
||||
|
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
BIN
app/src/main/res/drawable-hdpi/ic_flip_vertically.png
Normal file
After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
BIN
app/src/main/res/drawable-xhdpi/ic_flip_vertically.png
Normal file
After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_flip_vertically.png
Normal file
After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_flip_vertically.png
Normal file
After Width: | Height: | Size: 684 B |
|
@ -27,19 +27,30 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_minimize"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_flip"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_flip_horizontally"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_rotate"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_flip"
|
||||
android:id="@+id/bottom_flip_horizontally"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_flip"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/ic_flip_horizontally"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bottom_flip_vertically"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_resize"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_flip_vertically"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_flip_vertically"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_flip_horizontally"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
|
@ -5,23 +5,10 @@
|
|||
android:id="@+id/save_as"
|
||||
android:icon="@drawable/ic_check"
|
||||
android:title="@string/save_as"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/flip"
|
||||
android:icon="@drawable/ic_flip"
|
||||
android:title="@string/flip"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/flip_horizontally"
|
||||
android:title="@string/flip_horizontally"/>
|
||||
<item
|
||||
android:id="@+id/flip_vertically"
|
||||
android:title="@string/flip_vertically"/>
|
||||
</menu>
|
||||
</item>
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/edit"
|
||||
android:icon="@drawable/ic_edit"
|
||||
android:title="@string/edit_with"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
||||
|
|