From 5fc598124021f3ef82cfaf077419f169eb868c5b Mon Sep 17 00:00:00 2001 From: "yuwei.wang" Date: Wed, 27 Feb 2019 17:45:11 +0800 Subject: [PATCH] add scalpel --- uetool/build.gradle | 1 + .../src/main/java/me/ele/uetool/UETMenu.java | 32 ++++++++++++++---- .../main/res/drawable-xxhdpi/uet_scalpel.png | Bin 0 -> 1265 bytes uetool/src/main/res/values-en/strings.xml | 1 + uetool/src/main/res/values-zh/strings.xml | 1 + uetool/src/main/res/values/strings.xml | 1 + 6 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 uetool/src/main/res/drawable-xxhdpi/uet_scalpel.png diff --git a/uetool/build.gradle b/uetool/build.gradle index 9ed3397..8f427be 100644 --- a/uetool/build.gradle +++ b/uetool/build.gradle @@ -18,6 +18,7 @@ dependencies { api project(':uetool-base') // api "me.ele:uetool-base:${versions.release}" implementation "com.android.support:recyclerview-v7:${versions.supportLibrary}" + implementation 'com.jakewharton.scalpel:scalpel:1.1.2' } publish { diff --git a/uetool/src/main/java/me/ele/uetool/UETMenu.java b/uetool/src/main/java/me/ele/uetool/UETMenu.java index fcb6c01..595a124 100644 --- a/uetool/src/main/java/me/ele/uetool/UETMenu.java +++ b/uetool/src/main/java/me/ele/uetool/UETMenu.java @@ -10,16 +10,12 @@ import android.content.res.Resources; import android.graphics.PixelFormat; import android.os.Build; -import android.view.Gravity; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.view.WindowManager; +import android.view.*; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.FrameLayout; import android.widget.LinearLayout; +import com.jakewharton.scalpel.ScalpelFrameLayout; import java.lang.reflect.Field; import java.util.ArrayList; @@ -73,6 +69,30 @@ public void onClick(View v) { } })); + subMenus.add(new UETSubMenu.SubMenu(resources.getString(R.string.uet_scalpel), R.drawable.uet_scalpel, new OnClickListener() { + @Override + public void onClick(View view) { + ViewGroup decorView = (ViewGroup) Util.getCurrentActivity().getWindow().getDecorView(); + ViewGroup content = decorView.findViewById(android.R.id.content); + View contentChild = content.getChildAt(0); + if (contentChild != null) { + if (contentChild instanceof ScalpelFrameLayout) { + content.removeAllViews(); + View originContent = ((ScalpelFrameLayout) contentChild).getChildAt(0); + ((ScalpelFrameLayout) contentChild).removeAllViews(); + content.addView(originContent); + } else { + content.removeAllViews(); + ScalpelFrameLayout frameLayout = new ScalpelFrameLayout(getContext()); + frameLayout.setLayerInteractionEnabled(true); + frameLayout.setDrawIds(true); + frameLayout.addView(contentChild); + content.addView(frameLayout); + } + } + } + })); + for (UETSubMenu.SubMenu subMenu : subMenus) { UETSubMenu uetSubMenu = new UETSubMenu(getContext()); uetSubMenu.update(subMenu); diff --git a/uetool/src/main/res/drawable-xxhdpi/uet_scalpel.png b/uetool/src/main/res/drawable-xxhdpi/uet_scalpel.png new file mode 100644 index 0000000000000000000000000000000000000000..5f1ff196ddfe8263ba6d298860e500a76bf9427a GIT binary patch literal 1265 zcmVA~qyj<(Km{ZfTy&qjk)PM!{l`+2 zNb#`GC8*>5Rb=QCMpd=-t+Q}j96M(mRaMPe9Pt5Flg7B}IeRcnnI6qDFdja6< zW~k`$bFGBiBe#S;KBIKAeclMxDGUu+dr zIw{@sn|4x=I!cl)A?}|x2bwWHIx-}h#YR#){=n;axhYVmXVS~C-CEBgrJ0eG`1;0a zJD^U#en*VYB>-99>PAwFdm1(f8unZ1il{8{M3)>>O{R|PEZ z>8)?b76;Af(is3*-&xwCpc&)y4L~TylL9XWnu$oNjE{5H+52$Nl7Xc-ybjF9sq_UHBQlRHzXX<+ZGHO+AcF;^ZBpZ>q41q&X9FeKWPA$x zsJS);-;3;MYeZ6^kMeS=(kLm*H2IEZ(jn1^WDb3d!A=UAi%0a4v~eFW3aDoEuoLIfo38Se@uBtIv!#fh3?pCJ|C;xqA8A-Ohi&U2lX3#KGqI0 z$`}=DB=TzRRZL{m`B?G(eV4JI$#jTw-xOW=rGao>)n$fSpvlkCOgiK?B5^w|*jVkd zDa=|0G!v2ZLZ^fS(VWg)95hp)jiy5qvFNBI*bwL@9W5B2ef~6@L`=j1G>tn1Y?M>q z8j&~$p_kg+G-zu?(yeIBW7;g}m;!C2D0>5-<-X7ql3PAUho(ck9aXK;2Wu|uPC;5U z3X$ru#;q#QCd9oddp8AS(K8xbpd}d#+nS5JQ@|#7bg1$1L{=q+uwMBWKv*W6f}{A3 zDCpP%ZN{ls%(pF`qhkxSZjrQ;y#jA6ol@M2i8}Oll;q$7trK^Z5Msy2D!SRN(*fwv z0&U};c0cq+vBCSKuc0_rP7uHD-~{a){ag*Po$!T zOhlqFx_jx;xzb&Be@@B)z49+zkksyn@3;c+Ee7K(x1RC!UD1)k!PGU@*cj@6CD7EZ zts#r40+Ij^F76k`=mp`4Yi|C0j>3?Tq)Hb0dLq`&1j->q!86(wUDl6Qph>F47hV?b zUU3cJ$bVnOJ^G&BlMH?80|^soc(=8dTW|u?w|*Z bG0y)3d&X>ar0`YZ00000NkvXXu0mjf%B)_6 literal 0 HcmV?d00001 diff --git a/uetool/src/main/res/values-en/strings.xml b/uetool/src/main/res/values-en/strings.xml index 0420bb8..6386c38 100644 --- a/uetool/src/main/res/values-en/strings.xml +++ b/uetool/src/main/res/values-en/strings.xml @@ -3,4 +3,5 @@ catch location gridding + scalpel \ No newline at end of file diff --git a/uetool/src/main/res/values-zh/strings.xml b/uetool/src/main/res/values-zh/strings.xml index ee4ac07..8230558 100644 --- a/uetool/src/main/res/values-zh/strings.xml +++ b/uetool/src/main/res/values-zh/strings.xml @@ -3,4 +3,5 @@ 捕捉控件 相对位置 网格栅栏 + 手术刀 \ No newline at end of file diff --git a/uetool/src/main/res/values/strings.xml b/uetool/src/main/res/values/strings.xml index d67ac3f..c32becd 100644 --- a/uetool/src/main/res/values/strings.xml +++ b/uetool/src/main/res/values/strings.xml @@ -7,4 +7,5 @@ catch location gridding + scalpel \ No newline at end of file