diff --git a/EmojidexAndroid/src/main/java/com/emojidex/emojidexandroid/PhotoEditorActivity.java b/EmojidexAndroid/src/main/java/com/emojidex/emojidexandroid/PhotoEditorActivity.java index 20c6cc00..c8b4e46f 100644 --- a/EmojidexAndroid/src/main/java/com/emojidex/emojidexandroid/PhotoEditorActivity.java +++ b/EmojidexAndroid/src/main/java/com/emojidex/emojidexandroid/PhotoEditorActivity.java @@ -70,6 +70,8 @@ public class PhotoEditorActivity extends Activity implements ColorPickerDialogLi private static final int MOVE = 0; private static final int SCALE = 1; private static final int ROLL = 2; + private static final int V_FLIP = 3; + private static final int H_FLIP = 4; private int mode = NONE; private static final int DIALOG_TEXT = 2000; @@ -94,6 +96,8 @@ public class PhotoEditorActivity extends Activity implements ColorPickerDialogLi private ImageButton moveButton; private ImageButton scaleButton; private ImageButton rollButton; + private ImageButton vFlipButton; + private ImageButton hFlipButton; private EditText editText; private TextWatcher textWatcher; @@ -137,6 +141,8 @@ private void initialize() moveButton = findViewById(R.id.photo_editor_move_button); scaleButton = findViewById(R.id.photo_editor_scale_button); rollButton = findViewById(R.id.photo_editor_roll_button); + vFlipButton = findViewById(R.id.photo_editor_v_flip_button); + hFlipButton = findViewById(R.id.photo_editor_h_flip_button); textWatcher = new TextWatcher() { @Override @@ -453,6 +459,26 @@ public void setModeToRoll(View v) setButtonBackGround(); } + /** + * Set mode - V_FLIP + * @param v button. + */ + public void setModeToVerticalFlip(View v) + { + mode = mode == V_FLIP ? NONE : V_FLIP; + setButtonBackGround(); + } + + /** + * Set mode - H_FLIP + * @param v button. + */ + public void setModeToHorizontalFlip(View v) + { + mode = mode == H_FLIP ? NONE : H_FLIP; + setButtonBackGround(); + } + /** * Set buttons background color. */ @@ -461,9 +487,13 @@ private void setButtonBackGround() moveButton.setBackgroundColor(Color.TRANSPARENT); scaleButton.setBackgroundColor(Color.TRANSPARENT); rollButton.setBackgroundColor(Color.TRANSPARENT); + vFlipButton.setBackgroundColor(Color.TRANSPARENT); + hFlipButton.setBackgroundColor(Color.TRANSPARENT); if (mode == MOVE) moveButton.setBackgroundColor(getResources().getColor(R.color.primary)); if (mode == SCALE) scaleButton.setBackgroundColor(getResources().getColor(R.color.primary)); if (mode == ROLL) rollButton.setBackgroundColor(getResources().getColor(R.color.primary)); + if (mode == V_FLIP) vFlipButton.setBackgroundColor(getResources().getColor(R.color.primary)); + if (mode == H_FLIP) hFlipButton.setBackgroundColor(getResources().getColor(R.color.primary)); } /** @@ -1016,6 +1046,22 @@ public boolean onTouchEvent(MotionEvent event) setRotation(getRotation() + (roll * 0.1f)); break; + + case V_FLIP: + if (newY - oldY < 0) + setScaleY(Math.abs(getScaleY())); + else + setScaleY(-Math.abs(getScaleY())); + + break; + + case H_FLIP: + if (newX - oldX < 0) + setScaleX(Math.abs(getScaleX())); + else + setScaleX(-Math.abs(getScaleX())); + + break; } break; diff --git a/EmojidexAndroid/src/main/res/drawable/ic_compare_black_24dp.xml b/EmojidexAndroid/src/main/res/drawable/ic_compare_black_24dp.xml new file mode 100644 index 00000000..4824f3f4 --- /dev/null +++ b/EmojidexAndroid/src/main/res/drawable/ic_compare_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/EmojidexAndroid/src/main/res/drawable/ic_compare_rotate_black_24dp.xml b/EmojidexAndroid/src/main/res/drawable/ic_compare_rotate_black_24dp.xml new file mode 100644 index 00000000..6429cb15 --- /dev/null +++ b/EmojidexAndroid/src/main/res/drawable/ic_compare_rotate_black_24dp.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/EmojidexAndroid/src/main/res/layout/activity_photo_editor.xml b/EmojidexAndroid/src/main/res/layout/activity_photo_editor.xml index db74893e..248adb10 100644 --- a/EmojidexAndroid/src/main/res/layout/activity_photo_editor.xml +++ b/EmojidexAndroid/src/main/res/layout/activity_photo_editor.xml @@ -37,32 +37,41 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_margin="5dp" - android:src="@drawable/ic_help_black_24dp" - android:background="@drawable/button_state" + android:src="@drawable/ic_photo_filter_black_24dp" + android:background="@null" android:contentDescription="@null" - android:onClick="showHelp" /> - - - - + android:onClick="addEffect" /> + android:onClick="clearImage" /> + + + + + + - + + android:onClick="setModeToHorizontalFlip" /> - + + + このボタンがアクティブの時、絵文字をドラッグで移動できます。 このボタンがアクティブの時、絵文字をドラッグで拡大縮小できます。 このボタンがアクティブの時、絵文字をドラッグで回転できます。 + このボタンがアクティブの時、絵文字を上下ドラッグで上下に反転できます。 + このボタンがアクティブの時、絵文字を左右ドラッグで左右に反転できます。 全ての絵文字をクリアします。 閉じる diff --git a/EmojidexAndroid/src/main/res/values/strings.xml b/EmojidexAndroid/src/main/res/values/strings.xml index 57d1b724..b0d9a2be 100644 --- a/EmojidexAndroid/src/main/res/values/strings.xml +++ b/EmojidexAndroid/src/main/res/values/strings.xml @@ -284,6 +284,8 @@ This tool lets you move emoji by dragging them. This tool lets you change the size of emoji. This tool lets you rotate emoji. + This tool lets you flip vertical emoji. + This tool lets you flip horizontal emoji. Clear all emoji. Close