diff --git a/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java index c7d6540..0afa2e6 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java +++ b/app/src/main/java/com/codigoparallevar/minicards/CanvasView.java @@ -469,8 +469,13 @@ class CanvasView extends View implements PartGrid { public void setDevMode(boolean devMode) { _devMode = devMode; if (!_devMode) { - this._viewOrigin = new Tuple2<>(0, 0); + CenterView(); } this.invalidate(); } + + public void CenterView() { + this._viewOrigin = new Tuple2<>(0, 0); + this.invalidate(); + } } diff --git a/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java b/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java index 682ad13..6018d58 100644 --- a/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java +++ b/app/src/main/java/com/codigoparallevar/minicards/MainActivity.java @@ -18,6 +18,7 @@ public class MainActivity extends AppCompatActivity { com.getbase.floatingactionbutton.AddFloatingActionButton AddPartButton; com.getbase.floatingactionbutton.FloatingActionButton SetDevModeButton; com.getbase.floatingactionbutton.FloatingActionButton SetUserModeButton; + com.getbase.floatingactionbutton.FloatingActionButton CenterViewButton; com.getbase.floatingactionbutton.FloatingActionsMenu devFabMenu; com.getbase.floatingactionbutton.FloatingActionsMenu userFabMenu; @@ -73,6 +74,15 @@ public class MainActivity extends AppCompatActivity { } }); + CenterViewButton = (com.getbase.floatingactionbutton.FloatingActionButton) + findViewById(R.id.center_view_button); + CenterViewButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + canvasView.CenterView(); + } + }); + SetDevModeButton = (com.getbase.floatingactionbutton.FloatingActionButton) findViewById(R.id.set_developer_mode_button); SetDevModeButton.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/res/drawable-hdpi/ic_center_focus_weak_black.png b/app/src/main/res/drawable-hdpi/ic_center_focus_weak_black.png new file mode 100644 index 0000000..70eee41 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_center_focus_weak_black.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_center_focus_weak_black.png b/app/src/main/res/drawable-mdpi/ic_center_focus_weak_black.png new file mode 100644 index 0000000..39d2b5e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_center_focus_weak_black.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_center_focus_weak_black.png b/app/src/main/res/drawable-xhdpi/ic_center_focus_weak_black.png new file mode 100644 index 0000000..6d434f9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_center_focus_weak_black.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_center_focus_weak_black.png b/app/src/main/res/drawable-xxhdpi/ic_center_focus_weak_black.png new file mode 100644 index 0000000..83fb13a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_center_focus_weak_black.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_center_focus_weak_black.png b/app/src/main/res/drawable-xxxhdpi/ic_center_focus_weak_black.png new file mode 100644 index 0000000..38652ba Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_center_focus_weak_black.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 389a1ef..aed2bfe 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -93,6 +93,15 @@ fab:fab_title="Add new part" fab:fab_colorPressed="@color/white_pressed"/> + +