From f821f49b9414dfb7130d2e2f39aefd39970c48cf Mon Sep 17 00:00:00 2001 From: kenkeiras Date: Sat, 20 Jan 2018 22:08:08 +0100 Subject: [PATCH] Add center view button. --- .../codigoparallevar/minicards/CanvasView.java | 7 ++++++- .../codigoparallevar/minicards/MainActivity.java | 10 ++++++++++ .../drawable-hdpi/ic_center_focus_weak_black.png | Bin 0 -> 504 bytes .../drawable-mdpi/ic_center_focus_weak_black.png | Bin 0 -> 341 bytes .../ic_center_focus_weak_black.png | Bin 0 -> 659 bytes .../ic_center_focus_weak_black.png | Bin 0 -> 995 bytes .../ic_center_focus_weak_black.png | Bin 0 -> 1366 bytes app/src/main/res/layout/activity_main.xml | 9 +++++++++ 8 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_center_focus_weak_black.png create mode 100644 app/src/main/res/drawable-mdpi/ic_center_focus_weak_black.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_center_focus_weak_black.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_center_focus_weak_black.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_center_focus_weak_black.png 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 0000000000000000000000000000000000000000..70eee416f1627dcaadc670daa072a337e05f51cb GIT binary patch literal 504 zcmVKWY6iDp+C;q-rTDQHL2(H|ON&AGAc}hsvE6`@75D*Gm(ZvS=x90-dAU{lcMf(l6w3rUZfYqlw|qro>s?@tA(-O<3P&^g(H zgj)(s+K5Y#u!YHmThJ9Im0M6B6H&`S)FLQ?A}E6Xxu7}r=<>+Ra1V6ZWoB|gvwY$up83Pi%O9Bs$2LeZtWuV%R!PW_dORRWxz&1yTFSK1-CtEptGPsGZ4%v0p<@QNAR42~K?onNCiIf#}qDOWw>T)G1 zQ|iRvKMZP)DsE8z)xn9W*BBq8&Uyksd?`v=Ozx7ogWC zqFVgxe@99QNbk64LK`s=ARH7s`(h@bPe^W&p#Wi@+-^(-T#;LBDxk;EA26H}KEI>@ z5AXmF@Bk0+01xnh36^Qm;huzqJ36#jV&Z)SG&tf3(c_Ue)3yUf+2IArSi&|{s{wT` zkO6i^&Eh>c$1h~SbqO)1p8fT80yPZzzy*?XXH+p`2Pv>EjA-zJsQsWxosmClu*xZ- zmQcflBjnYdSRt)KlV^2Z3j;p#q`v+aG?-Tj4~$c~W#rXXc+0A~c9GJx)Y*SqMcoS# zrRyN6HOaDuq;^8-?vd2$WSLPv&`Osesf~~&KvIi6U}$$pY7Mf?T027eCSE1WhQ5id zJw{Kd@Rkba_8y~4$iNTMb#?6mrJLXpN$r_=K>JEh{VFkr0c}JjG^xBgJnQt-b%&TR zO@gSMvc?Pn0kdpyj;O^@A);SuK%YGV th7z*R6}^8R(BqQbth4W&bIv*Eegi@i9C-pn2mt^9002ovPDHLkV1l~19q<4E literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..83fb13a3ba39807d184265549be5e78dc3d3b7a2 GIT binary patch literal 995 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q1xWh(YZ)^zFt74-aSW+oe0w+EJET(P_($_# zsV~pfv}I;q{TE;>xN^6~t*b`6xKp-kh;3JS&z>3wMdlhxNWNF@! z?yEB$KK_VZ-~8Tc@_y#(ea}Dtx+8Cuf6P+(kJ`zp9WZdB&~3&;e%ZvGNm*9!Wx!O-sBo1?loVYJwxudI#X6h!ZB2bP~mpau8obNp1ZQFnS&XUD*8nb*pux2Om%3Tay z=kT`YLdM4nrwnpaIZI}JzhVAHcKIoR7fP$GEhZN#{tEt~Zj{4*T0&)m{6-e;*)NnN zrzJ=}=X_zZI%3hx8#TH?=E^z{kFFB;^|tuyx$i$ zdPxY+u>bd{TB~NQllN1Dip*{e?B&GdBO*;lF`DBqQu-?Y!RLip%HL z-d!xZ_+02RjXjpnuT^Cpm3*$XS>)cP;_T3z)#QpZ|LOhtSTV6A@c6&t&pkzLQq|kS9_#Q&-1xS{UA>VfxzpT5BX`eXp?Cge z!e>^tw2S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yL7L#R)QrK9p1H^`Yyb@S2@B=)R@DTx|3e zNWMjNcvIe#f3$9B*+E9_d4bsu8l<#V4>nDWE{ z(X{j29TL!9yvEA8W;?3N>d8ujQJ*?Y1PJT5U#;lM`e_R=i=XRgu{L2H$LKWi#~#q_ z<-3_i8LNk4!8A;yaMH*uW{0b{={{1R4uxoD&X=i%;y^N;oCGgmi?%W3Z>OKJ4+F(fCe4GUHOXm@Rjx(i zelznKll>qSj5-;&@2=Wr&@?i6_P(R{m8+GKDj#(Su<3u)#1to>R3*-(P$~xq+6v1$iAn{ZnP@K#wLF5Z5Va`n?3`-hs3x&luic*R?wC literal 0 HcmV?d00001 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"/> + +