├── .github
└── ISSUE_TEMPLATE.md
├── .gitignore
├── LICENSE
├── README.md
├── README_zh.md
├── UETool_Introduction.pdf
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── debug
│ ├── java
│ │ └── me
│ │ │ └── ele
│ │ │ └── uetool
│ │ │ └── sample
│ │ │ ├── CustomAttribution.java
│ │ │ └── XmlLancet.java
│ └── res
│ │ └── values
│ │ └── ids.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── me
│ │ │ └── ele
│ │ │ └── uetool
│ │ │ └── sample
│ │ │ ├── AppContext.java
│ │ │ ├── CustomDialog.java
│ │ │ ├── CustomLayout.java
│ │ │ ├── CustomView.java
│ │ │ ├── FilterOutView.java
│ │ │ ├── FragmentSampleActivity.kt
│ │ │ ├── MainActivity.java
│ │ │ ├── SecondActivity.java
│ │ │ ├── VerticalImageSpan.java
│ │ │ └── ui
│ │ │ ├── fragmentsample
│ │ │ ├── FragmentSampleFragment.kt
│ │ │ ├── FragmentSampleFragment2.kt
│ │ │ └── FragmentSampleViewModel.kt
│ │ │ └── recyclerviewsample
│ │ │ └── RecyclerViewActivity.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable-xxhdpi
│ │ ├── ic_down_vote.png
│ │ ├── ic_food_new.png
│ │ ├── ic_placeholder.png
│ │ ├── ic_tip.9.png
│ │ └── ic_up_vote.png
│ │ ├── drawable
│ │ ├── gradient_background.xml
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_recycler_view.xml
│ │ ├── activity_second.xml
│ │ ├── custom_layout.xml
│ │ ├── dialog_layout.xml
│ │ ├── fragment_sample_activity.xml
│ │ ├── fragment_sample_fragment.xml
│ │ └── layout_simple_textview.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── release
│ └── java
│ └── me.ele.uetool.sample
│ └── CustomAttribution.java
├── art
├── move_view.gif
├── relative_position.gif
├── show_gridding.png
├── show_image_uri.gif
└── uet_banner.jpeg
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
├── uetool-base
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── me
│ └── ele
│ └── uetool
│ └── base
│ ├── Application.java
│ ├── DimenUtil.java
│ ├── Element.java
│ ├── IAttrs.java
│ ├── ItemArrayList.java
│ ├── ItemViewBinder.java
│ ├── ReflectionP.java
│ └── item
│ ├── AddMinusEditItem.java
│ ├── BitmapItem.java
│ ├── BriefDescItem.java
│ ├── EditTextItem.java
│ ├── ElementItem.java
│ ├── Item.java
│ ├── SwitchItem.java
│ ├── TextItem.java
│ └── TitleItem.java
├── uetool-fresco
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── me
│ └── ele
│ └── uetool
│ └── fresco
│ └── UETFresco.java
├── uetool-no-op
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── me
│ └── ele
│ └── uetool
│ ├── UETool.java
│ └── base
│ ├── ItemViewBinder.java
│ └── item
│ └── Item.java
├── uetool.jks
└── uetool
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
└── main
├── AndroidManifest.xml
├── java
└── me
│ └── ele
│ └── uetool
│ ├── AttrsDialog.java
│ ├── BoardTextView.java
│ ├── CollectViewsLayout.java
│ ├── EditAttrLayout.java
│ ├── FragmentListTreeDialog.java
│ ├── GriddingLayout.java
│ ├── Provider.java
│ ├── RegionView.java
│ ├── RelativePositionLayout.java
│ ├── TransparentActivity.java
│ ├── UETCore.java
│ ├── UETMenu.java
│ ├── UETSubMenu.java
│ ├── UETool.java
│ ├── Util.java
│ └── attrdialog
│ ├── AttrsDialogItemViewBinder.java
│ ├── AttrsDialogMultiTypePool.java
│ └── binder
│ ├── AddMinusEditTextItemBinder.java
│ ├── BitmapItemBinder.java
│ ├── BriefDescItemBinder.java
│ ├── EditTextItemBinder.java
│ ├── SwitchItemBinder.java
│ ├── TextItemBinder.java
│ └── TitleItemBinder.java
└── res
├── drawable-xxhdpi
├── uet_add.png
├── uet_add_pressed.png
├── uet_close.png
├── uet_edit_attr.png
├── uet_menu.png
├── uet_minus.png
├── uet_minus_pressed.png
├── uet_relative_position.png
├── uet_scalpel.png
├── uet_show_gridding.png
├── uet_sub_menu_bg.9.png
└── uet_tree_arrow.png
├── drawable
├── uet_selector_add.xml
├── uet_selector_brief_desc.xml
└── uet_selector_minus.xml
├── layout
├── uet_activity_transparent.xml
├── uet_cell_add_minus_edit.xml
├── uet_cell_bitmap_info.xml
├── uet_cell_brief_view_desc.xml
├── uet_cell_edit_text.xml
├── uet_cell_switch.xml
├── uet_cell_text.xml
├── uet_cell_title.xml
├── uet_cell_tree.xml
├── uet_dialog_attrs.xml
├── uet_dialog_fragment_list_tree.xml
├── uet_menu_layout.xml
└── uet_sub_menu_layout.xml
├── values-en
└── strings.xml
├── values-zh
└── strings.xml
└── values
├── dimens.xml
├── strings.xml
└── values.xml
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Issue Description
2 |
3 | #### Description
4 |
5 | [Tell us about the issue]
6 |
7 | #### Reproduce
8 |
9 | [The steps to reproduce this issue. What are the parameters, where did you put your code, etc.]
10 |
11 | #### Other Comment
12 |
13 | [Add anything else here]
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 UETool.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UETool [](https://github.com/eleme/UETool/releases) [](https://developer.android.com/index.html) [](https://github.com/eleme/UETool/blob/master/LICENSE)
2 | ======
3 |
4 | 
5 |
6 | ## INTRODUCTION
7 |
8 | [中文版](https://github.com/eleme/UETool/blob/master/README_zh.md)
9 |
10 | UETool is a debug tool for anyone who needs to show and edit the attributes of user interface views on mobile devices. It works on Activity/Fragment/Dialog/PopupWindow or any other view.
11 |
12 | Presently, UETool provides the following functionalities:
13 |
14 | - Move any view on the screen (selecting view repeatedly will select its parent's view)
15 | - Show/edit normal view's attributes such as TextView's text, textSize, textColor etc.
16 | - Show two view's relative positions
17 | - Show grid for checking view alignment
18 | - Support Android P
19 | - Show view's current Fragment
20 | - Show activity's Fragment tree
21 | - Show view's view holder name if it exist
22 | - Easily customize any view's attributes you want simply, such as business parameters
23 |
24 | - If you are using Fresco's DraweeView, UETool shows more properties like ImageURI, PlaceHolderImage, CornerRadius etc.
25 | - If the view selected by UETool isn’t what you want, you can check ValidViews to choose which target view you want
26 |
27 | ## UETool's Effects:
28 |
29 |
30 |

31 |
32 |

33 |
34 |
35 |
36 |

37 |
38 |

39 |
40 |
41 |
42 | ## ATTRIBUTE LIST
43 |
44 | | Attribute | Value Sample | Editable |
45 | | --- | --- | --- |
46 | | Move | if you checked it, you can move view easily | |
47 | | ValidViews | sometimes target view which UETool offered isn’t you want, you can check it and choose which you want | |
48 | | Class | android.widget.LinearLayout | |
49 | | Id | 0x7f0d009c | |
50 | | ResName | btn | |
51 | | Clickble | TRUE | |
52 | | Focoused | FALSE | |
53 | | Width(dp) | 107 | YES |
54 | | Height(dp) | 19 | YES |
55 | | Alpha | 1.0 | |
56 | | PaddingLeft(dp) | 10 | YES |
57 | | PaddingRight(dp) | 10 | YES |
58 | | PaddingTop(dp) | 10 | YES |
59 | | PaddingBottom(dp) | 10 | YES |
60 | | Background | #90000000
#FF8F8F8F -> #FF688FDB
[PICTURE] 300px*300px | |
61 | | **TextView** | | |
62 | | Text | Hello World | YES |
63 | | TextSize(sp) | 14 | YES |
64 | | TextColor | #DE000000 | YES |
65 | | IsBold | TRUE | YES |
66 | | SpanBitmap | [PICTURE] 72px*39px | |
67 | | DrawableLeft | [PICTURE] 51px*51px | |
68 | | DrawableRight | [PICTURE] 36px*36px | |
69 | | DrawableTop | [PICTURE] 36px*36px | |
70 | | DrawableBottom | [PICTURE] 36px*36px | |
71 | | **ImageView** | | |
72 | | Bitmap | [PICTURE] 144px*144px | |
73 | | ScaleType | CENTER_CROP | |
74 | | **DraweeView** | | |
75 | | CornerRadius | 2dp | |
76 | | ImageURI | https://avatars2.githubusercontent.com/u/1201438?s=200&v=4 | |
77 | | ActualScaleType | CENTER_CROP | |
78 | | IsSupportAnimation | TRUE | |
79 | | PlaceHolderImage | [PICTURE] 300px*300px | |
80 | | | | |
81 |
82 |
83 | ## HOW TO USE
84 |
85 | ### Installation
86 |
87 | ```gradle
88 | allprojects {
89 | repositories {
90 | ...
91 | maven { url 'https://jitpack.io' }
92 | }
93 | }
94 |
95 | dependencies {
96 | debugImplementation 'com.github.eleme.UETool:uetool:1.3.4'
97 | debugImplementation 'com.github.eleme.UETool:uetool-base:1.3.4'
98 | releaseImplementation 'com.github.eleme.UETool:uetool-no-op:1.3.4'
99 |
100 | // if you want to show more attrs about Fresco's DraweeView
101 | debugImplementation 'com.github.eleme.UETool:uetool-fresco:1.3.4'
102 | }
103 | ```
104 |
105 | ### Usage
106 |
107 | #### Show floating window
108 |
109 | ```java
110 | UETool.showUETMenu();
111 |
112 | UETool.showUETMenu(int y);
113 | ```
114 |
115 | #### Dismiss floating window
116 |
117 | ```java
118 | UETool.dismissUETMenu();
119 | ```
120 |
121 | #### Filter out unwanted views from selection
122 |
123 | ```java
124 | UETool.putFilterClass(Class viewClazz);
125 |
126 | UETool.putFilterClass(String viewClassName);
127 | ```
128 |
129 | #### Customize your view
130 |
131 | ```java
132 |
133 | // step 1, implement IAttrs
134 |
135 | public class UETFresco implements IAttrs {
136 | @Override public List- getAttrs(Element element) {
137 |
138 | }
139 | }
140 |
141 | // step 2, put in UETool
142 |
143 | UETool.putAttrsProviderClass(Class customizeClazz);
144 |
145 | UETool.putAttrsProviderClass(String customizeClassName);
146 |
147 | ```
148 |
149 | ## License
150 |
151 | [MIT](http://opensource.org/licenses/MIT)
152 |
153 |
--------------------------------------------------------------------------------
/README_zh.md:
--------------------------------------------------------------------------------
1 | UETool [](https://github.com/eleme/UETool/releases) [](https://developer.android.com/index.html) [](https://github.com/eleme/UETool/blob/master/LICENSE)
2 | ======
3 |
4 | 
5 |
6 | ## 介绍
7 |
8 | UETool 是一个各方人员(设计师、程序员、测试)都可以使用的调试工具。它可以作用于任何显示在屏幕上的 view,比如 Activity/Fragment/Dialog/PopupWindow 等等。
9 |
10 | 目前 UETool 提供以下功能:
11 |
12 | - 移动屏幕上的任意 view,如果重复选中一个 view,将会选中其父 view
13 | - 查看/修改常用控件的属性,比如修改 TextView 的文本内容、文本大小、文本颜色等等
14 | - 如果你的项目里正在使用 Fresco 的 DraweeView 来呈现图片,那么 UETool 将会提供更多的属性比如图片 URI、默认占位图、圆角大小等等
15 | - 你可以很轻松的定制任何 view 的属性,比如你想查看一些额外的业务参数
16 | - 有的时候 UETool 为你选中的 view 并不是你想要的,你可以选择打开 ValidView,然后选中你需要的 View
17 | - 显示两个 view 的相对位置关系
18 | - 显示网格栅栏,方便查看控件是否对齐
19 | - 支持 Android P
20 | - 支持显示当前控件所在的 Fragment
21 | - 显示 Activity 的 Fragment 树
22 | - 如果 view 在 RecyclerView 中,显示这个 view 所在的 ViewHolder 类名
23 |
24 | ## 效果
25 |
26 |
27 |

28 |
29 |

30 |
31 |
32 |
33 |

34 |
35 |

36 |
37 |
38 | ## 属性列表
39 |
40 | | Attribute | Value Sample | Editable |
41 | | --- | --- | --- |
42 | | Move | if you checked it, you can move view easily | |
43 | | ValidViews | sometimes target view which UETool offered isn’t you want, you can check it and choose which you want | |
44 | | Class | android.widget.LinearLayout | |
45 | | Id | 0x7f0d009c | |
46 | | ResName | btn | |
47 | | Clickble | TRUE | |
48 | | Focoused | FALSE | |
49 | | Width(dp) | 107 | YES |
50 | | Height(dp) | 19 | YES |
51 | | Alpha | 1.0 | |
52 | | PaddingLeft(dp) | 10 | YES |
53 | | PaddingRight(dp) | 10 | YES |
54 | | PaddingTop(dp) | 10 | YES |
55 | | PaddingBottom(dp) | 10 | YES |
56 | | Background | #90000000
#FF8F8F8F -> #FF688FDB
[PICTURE] 300px*300px | |
57 | | **TextView** | | |
58 | | Text | Hello World | YES |
59 | | TextSize(sp) | 14 | YES |
60 | | TextColor | #DE000000 | YES |
61 | | IsBold | TRUE | YES |
62 | | SpanBitmap | [PICTURE] 72px*39px | |
63 | | DrawableLeft | [PICTURE] 51px*51px | |
64 | | DrawableRight | [PICTURE] 36px*36px | |
65 | | DrawableTop | [PICTURE] 36px*36px | |
66 | | DrawableBottom | [PICTURE] 36px*36px | |
67 | | **ImageView** | | |
68 | | Bitmap | [PICTURE] 144px*144px | |
69 | | ScaleType | CENTER_CROP | |
70 | | **DraweeView** | | |
71 | | CornerRadius | 2dp | |
72 | | ImageURI | https://avatars2.githubusercontent.com/u/1201438?s=200&v=4 | |
73 | | ActualScaleType | CENTER_CROP | |
74 | | IsSupportAnimation | TRUE | |
75 | | PlaceHolderImage | [PICTURE] 300px*300px | |
76 | | | | |
77 |
78 |
79 | ## 如何使用
80 |
81 | ### 安装依赖
82 |
83 | ```gradle
84 | allprojects {
85 | repositories {
86 | ...
87 | maven { url 'https://jitpack.io' }
88 | }
89 | }
90 |
91 | dependencies {
92 | debugImplementation 'com.github.eleme.UETool:uetool:1.3.4'
93 | debugImplementation 'com.github.eleme.UETool:uetool-base:1.3.4'
94 | releaseImplementation 'com.github.eleme.UETool:uetool-no-op:1.3.4'
95 |
96 | // if you want to show more attrs about Fresco's DraweeView
97 | debugImplementation 'com.github.eleme.UETool:uetool-fresco:1.3.4'
98 | }
99 | ```
100 |
101 | ### 使用
102 |
103 | #### 打开悬浮窗
104 |
105 | ```java
106 | UETool.showUETMenu();
107 |
108 | UETool.showUETMenu(int y);
109 | ```
110 |
111 | #### 关掉悬浮窗
112 |
113 | ```java
114 | UETool.dismissUETMenu();
115 | ```
116 |
117 | #### 过滤掉你不需要选中的 View
118 |
119 | ```java
120 | UETool.putFilterClass(Class viewClazz);
121 |
122 | UETool.putFilterClass(String viewClassName);
123 | ```
124 |
125 | #### 自定义实现你的 View 的属性
126 |
127 | ```java
128 |
129 | // step 1, implements IAttrs
130 |
131 | public class UETFresco implements IAttrs {
132 | @Override public List- getAttrs(Element element) {
133 |
134 | }
135 | }
136 |
137 | // step 2, put in UETool
138 |
139 | UETool.putAttrsProviderClass(Class customizeClazz);
140 |
141 | UETool.putAttrsProviderClass(String customizeClassName);
142 |
143 | ```
144 |
145 | ## License
146 |
147 | [MIT](http://opensource.org/licenses/MIT)
148 |
149 |
--------------------------------------------------------------------------------
/UETool_Introduction.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/UETool_Introduction.pdf
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'me.ele.lancet'
5 |
6 | android {
7 | compileSdkVersion versions.compileSdk
8 |
9 | signingConfigs {
10 | release {
11 | storeFile file("../uetool.jks")
12 | keyAlias 'uetool'
13 | keyPassword 'uetool'
14 | storePassword 'uetool'
15 | }
16 | }
17 |
18 | defaultConfig {
19 | applicationId "me.ele.uetool.sample"
20 | minSdkVersion versions.minSdk
21 | targetSdkVersion versions.targetSdk
22 | versionCode 1
23 | versionName "1.0"
24 | }
25 | buildTypes {
26 | release {
27 | signingConfig signingConfigs.release
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 | }
33 |
34 | dependencies {
35 | implementation "com.android.support:appcompat-v7:27.1.1"
36 | implementation "com.android.support:design:27.1.1"
37 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
38 | implementation "com.facebook.fresco:fresco:${versions.fresco}"
39 | implementation "com.facebook.fresco:animated-gif:${versions.fresco}"
40 | implementation 'com.android.support:appcompat-v7:28.0.0'
41 | implementation 'android.arch.lifecycle:extensions:1.1.1'
42 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
43 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
44 | releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
45 |
46 | debugImplementation project(':uetool')
47 | debugImplementation project(':uetool-fresco')
48 | debugImplementation project(':uetool-base')
49 | releaseImplementation project(':uetool-no-op')
50 | // debugImplementation "me.ele:uetool:${versions.release}"
51 | // debugImplementation "me.ele:uetool-fresco:${versions.release}"
52 | // releaseImplementation "me.ele:uetool-no-op:${versions.release}"
53 |
54 | compileOnly 'me.ele:lancet-base:1.0.6'
55 |
56 | configurations.all {
57 | resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/debug/java/me/ele/uetool/sample/CustomAttribution.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import me.ele.uetool.base.Element;
7 | import me.ele.uetool.base.IAttrs;
8 | import me.ele.uetool.base.item.Item;
9 | import me.ele.uetool.base.item.TextItem;
10 |
11 | public class CustomAttribution implements IAttrs {
12 |
13 | @Override
14 | public List
- getAttrs(Element element) {
15 | List
- items = new ArrayList<>();
16 | if (element.getView() instanceof CustomView) {
17 | CustomView view = (CustomView) element.getView();
18 | items.add(new TextItem("More", view.getMoreAttribution()));
19 | }
20 | if (element.getView().getTag(R.id.uetool_xml) != null) {
21 | items.add(new TextItem("XML", element.getView().getTag(R.id.uetool_xml).toString()));
22 | }
23 | return items;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/debug/java/me/ele/uetool/sample/XmlLancet.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.lancet.base.Origin;
9 | import me.ele.lancet.base.annotations.Proxy;
10 | import me.ele.lancet.base.annotations.TargetClass;
11 |
12 | public class XmlLancet {
13 |
14 | @Proxy("inflate")
15 | @TargetClass(value = "android.view.LayoutInflater")
16 | public View inflate(int resourceId, ViewGroup root) {
17 | View view = (View) Origin.call();
18 | traverse(view, getResourceName(view, resourceId));
19 | return view;
20 | }
21 |
22 | @Proxy("inflate")
23 | @TargetClass(value = "android.view.LayoutInflater")
24 | public View inflate(int resourceId, ViewGroup root, boolean attachToRoot) {
25 | View view = (View) Origin.call();
26 | traverse(view, getResourceName(view, resourceId));
27 | return view;
28 | }
29 |
30 | @Proxy("inflate")
31 | @TargetClass(value = "android.view.View")
32 | public static View inflate(Context context, int resourceId, ViewGroup root) {
33 | View view = (View) Origin.call();
34 | traverse(view, getResourceName(view, resourceId));
35 | return view;
36 | }
37 |
38 | private static void traverse(View view, String name) {
39 | if (view.getTag(R.id.uetool_xml) == null) {
40 | view.setTag(R.id.uetool_xml, name);
41 | }
42 | if (view instanceof ViewGroup) {
43 | ViewGroup parent = (ViewGroup) view;
44 | for (int i = 0; i < parent.getChildCount(); i++) {
45 | traverse(parent.getChildAt(i), name);
46 | }
47 | }
48 | }
49 |
50 | private static String getResourceName(View view, int resourceId) {
51 | String resourceName = view.getResources().getResourceName(resourceId) + ".xml";
52 | String[] splits = resourceName.split("/");
53 | if (splits.length == 2) {
54 | return splits[1];
55 | }
56 | return resourceName;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/debug/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/AppContext.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.os.Bundle;
6 |
7 | import com.facebook.drawee.backends.pipeline.Fresco;
8 | import com.squareup.leakcanary.LeakCanary;
9 |
10 | import me.ele.uetool.UETool;
11 |
12 | public class AppContext extends Application {
13 |
14 | @Override
15 | public void onCreate() {
16 | super.onCreate();
17 | LeakCanary.install(this);
18 | Fresco.initialize(this);
19 |
20 | UETool.putFilterClass(FilterOutView.class);
21 | UETool.putAttrsProviderClass(CustomAttribution.class);
22 |
23 | registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
24 |
25 | private int visibleActivityCount;
26 | private int uetoolDismissY = -1;
27 |
28 | @Override
29 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
30 |
31 | }
32 |
33 | @Override
34 | public void onActivityStarted(Activity activity) {
35 | visibleActivityCount++;
36 | if (visibleActivityCount == 1 && uetoolDismissY >= 0) {
37 | UETool.showUETMenu(uetoolDismissY);
38 | }
39 | }
40 |
41 | @Override
42 | public void onActivityResumed(Activity activity) {
43 |
44 | }
45 |
46 | @Override
47 | public void onActivityPaused(Activity activity) {
48 |
49 | }
50 |
51 | @Override
52 | public void onActivityStopped(Activity activity) {
53 | visibleActivityCount--;
54 | if (visibleActivityCount == 0) {
55 | uetoolDismissY = UETool.dismissUETMenu();
56 | }
57 | }
58 |
59 | @Override
60 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
61 |
62 | }
63 |
64 | @Override
65 | public void onActivityDestroyed(Activity activity) {
66 |
67 | }
68 | });
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/CustomDialog.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.support.annotation.NonNull;
7 | import android.view.WindowManager;
8 |
9 | public class CustomDialog extends Dialog {
10 |
11 | public CustomDialog(@NonNull Context context) {
12 | super(context);
13 | }
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.dialog_layout);
19 | }
20 |
21 | @Override
22 | public void show() {
23 | super.show();
24 | WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
25 | layoutParams.setTitle("???");
26 | layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
27 | layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
28 | getWindow().setAttributes(layoutParams);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/CustomLayout.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.Nullable;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.FrameLayout;
9 |
10 | public class CustomLayout extends FrameLayout {
11 | public CustomLayout(@NonNull Context context) {
12 | this(context, null);
13 | }
14 |
15 | public CustomLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
16 | this(context, attrs, 0);
17 | }
18 |
19 | public CustomLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
20 | super(context, attrs, defStyleAttr);
21 | View.inflate(context, R.layout.custom_layout, this);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/CustomView.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.AppCompatTextView;
6 | import android.util.AttributeSet;
7 |
8 | public class CustomView extends AppCompatTextView {
9 |
10 | private String moreAttribution;
11 |
12 | public CustomView(Context context) {
13 | super(context);
14 | }
15 |
16 | public CustomView(Context context, @Nullable AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public CustomView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | public String getMoreAttribution() {
25 | return moreAttribution;
26 | }
27 |
28 | public void setMoreAttribution(String moreAttribution) {
29 | this.moreAttribution = moreAttribution;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/FilterOutView.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.AppCompatTextView;
6 | import android.util.AttributeSet;
7 |
8 | public class FilterOutView extends AppCompatTextView {
9 | public FilterOutView(Context context) {
10 | super(context);
11 | }
12 |
13 | public FilterOutView(Context context, @Nullable AttributeSet attrs) {
14 | super(context, attrs);
15 | }
16 |
17 | public FilterOutView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
18 | super(context, attrs, defStyleAttr);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/FragmentSampleActivity.kt:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample
2 |
3 | import android.support.v7.app.AppCompatActivity
4 | import android.os.Bundle
5 | import me.ele.uetool.sample.ui.fragmentsample.FragmentSampleFragment
6 |
7 | class FragmentSampleActivity : AppCompatActivity() {
8 |
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | setContentView(R.layout.fragment_sample_activity)
12 | if (savedInstanceState == null) {
13 | supportFragmentManager.beginTransaction()
14 | .replace(R.id.container, FragmentSampleFragment.newInstance())
15 | .commitNow()
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Typeface;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.Bundle;
7 | import android.support.v4.content.ContextCompat;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.support.v7.widget.SwitchCompat;
10 | import android.text.Spannable;
11 | import android.text.SpannableString;
12 | import android.view.View;
13 | import android.widget.CompoundButton;
14 | import android.widget.TextView;
15 |
16 | import com.facebook.drawee.backends.pipeline.Fresco;
17 | import com.facebook.drawee.interfaces.DraweeController;
18 | import com.facebook.drawee.view.SimpleDraweeView;
19 |
20 | import me.ele.uetool.UETool;
21 | import me.ele.uetool.sample.ui.recyclerviewsample.RecyclerViewActivity;
22 |
23 | public class MainActivity extends AppCompatActivity {
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_main);
29 |
30 | final SwitchCompat control = findViewById(R.id.control);
31 | control.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
32 | @Override
33 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
34 | if (isChecked) {
35 | if (!UETool.showUETMenu()) {
36 | control.setChecked(false);
37 | }
38 | } else {
39 | UETool.dismissUETMenu();
40 | }
41 | }
42 | });
43 | control.setChecked(true);
44 |
45 | updateDraweeView();
46 | updateSpanTextView();
47 | updateCustomView();
48 | updateFontView();
49 | }
50 |
51 | public void onClick(View view) {
52 | switch (view.getId()) {
53 | case R.id.btn1:
54 | startActivity(new Intent(this, SecondActivity.class));
55 | break;
56 | case R.id.btn2:
57 | new CustomDialog(this).show();
58 | break;
59 | case R.id.btn3:
60 | startActivity(new Intent(this, FragmentSampleActivity.class));
61 | break;
62 | case R.id.btn4:
63 | startActivity(new Intent(this, RecyclerViewActivity.class));
64 | }
65 | }
66 |
67 | private void updateDraweeView() {
68 | SimpleDraweeView draweeView = findViewById(R.id.drawee_view);
69 | DraweeController draweeController = Fresco.newDraweeControllerBuilder()
70 | .setUri("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1561443230828&di=066c39a584cfe5cdcb244cc3af74afff&imgtype=0&src=http%3A%2F%2Fzkres1.myzaker.com%2F201905%2F5cda353b77ac6420a360a53f_320.jpg")
71 | .setAutoPlayAnimations(true)
72 | .build();
73 | draweeView.setController(draweeController);
74 | }
75 |
76 | private void updateSpanTextView() {
77 | TextView spanTextView = findViewById(R.id.span);
78 | SpannableString spannableString = new SpannableString(" 海底捞火锅");
79 | Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_food_new);
80 | drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
81 | VerticalImageSpan imageSpan = new VerticalImageSpan(drawable);
82 | spannableString.setSpan(imageSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
83 | spanTextView.setText(spannableString);
84 | }
85 |
86 | private void updateCustomView() {
87 | final CustomView customView = findViewById(R.id.custom);
88 | customView.setMoreAttribution("more attribution");
89 | Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_up_vote);
90 | drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
91 | customView.setCompoundDrawables(null, drawable, null, null);
92 | }
93 |
94 | private void updateFontView() {
95 | final TextView fontView = findViewById(R.id.font_test);
96 | fontView.setTypeface(Typeface.create("casual", Typeface.BOLD));
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 | public class SecondActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_second);
15 |
16 | FloatingActionButton fab = findViewById(R.id.fab);
17 | fab.setOnClickListener(new View.OnClickListener() {
18 | @Override
19 | public void onClick(View view) {
20 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
21 | }
22 | });
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/VerticalImageSpan.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.graphics.Rect;
6 | import android.graphics.drawable.Drawable;
7 | import android.text.style.ImageSpan;
8 |
9 | public class VerticalImageSpan extends ImageSpan {
10 |
11 | public VerticalImageSpan(Drawable drawable) {
12 | super(drawable);
13 | }
14 |
15 | @Override
16 | public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fontMetricsInt) {
17 | Drawable drawable = getDrawable();
18 | Rect rect = drawable.getBounds();
19 | if (fontMetricsInt != null) {
20 | Paint.FontMetricsInt fmPaint = paint.getFontMetricsInt();
21 | int fontHeight = fmPaint.descent - fmPaint.ascent;
22 | int drHeight = rect.bottom - rect.top;
23 | int centerY = fmPaint.ascent + fontHeight / 2;
24 |
25 | fontMetricsInt.ascent = centerY - drHeight / 2;
26 | fontMetricsInt.top = fontMetricsInt.ascent;
27 | fontMetricsInt.bottom = centerY + drHeight / 2;
28 | fontMetricsInt.descent = fontMetricsInt.bottom;
29 | }
30 | return rect.right;
31 | }
32 |
33 | @Override
34 | public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
35 | Drawable drawable = getDrawable();
36 | canvas.save();
37 | Paint.FontMetricsInt fmPaint = paint.getFontMetricsInt();
38 | int fontHeight = fmPaint.descent - fmPaint.ascent;
39 | int centerY = y + fmPaint.descent - fontHeight / 2;
40 | int transY = centerY - (drawable.getBounds().bottom - drawable.getBounds().top) / 2;
41 | canvas.translate(x, transY);
42 | drawable.draw(canvas);
43 | canvas.restore();
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/ui/fragmentsample/FragmentSampleFragment.kt:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample.ui.fragmentsample
2 |
3 | import android.arch.lifecycle.ViewModelProviders
4 | import android.os.Bundle
5 | import android.support.v4.app.Fragment
6 | import android.view.LayoutInflater
7 | import android.view.View
8 | import android.view.ViewGroup
9 | import me.ele.uetool.sample.R
10 |
11 | class FragmentSampleFragment : Fragment() {
12 |
13 | companion object {
14 | fun newInstance() = FragmentSampleFragment()
15 | }
16 |
17 | private lateinit var viewModel: FragmentSampleViewModel
18 |
19 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
20 | savedInstanceState: Bundle?): View {
21 | return inflater.inflate(R.layout.fragment_sample_fragment, container, false)
22 | }
23 |
24 | override fun onActivityCreated(savedInstanceState: Bundle?) {
25 | super.onActivityCreated(savedInstanceState)
26 | viewModel = ViewModelProviders.of(this).get(FragmentSampleViewModel::class.java)
27 | // TODO: Use the ViewModel
28 |
29 | childFragmentManager.beginTransaction()
30 | .replace(R.id.container, FragmentSampleFragment2.newInstance())
31 | .commitNow()
32 |
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/ui/fragmentsample/FragmentSampleFragment2.kt:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample.ui.fragmentsample
2 |
3 | import android.os.Bundle
4 | import android.support.v4.app.Fragment
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import me.ele.uetool.sample.R
9 |
10 | class FragmentSampleFragment2 : Fragment() {
11 |
12 | companion object {
13 | fun newInstance() = FragmentSampleFragment2()
14 | }
15 |
16 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
17 | savedInstanceState: Bundle?): View {
18 | return inflater.inflate(R.layout.fragment_sample_fragment, container, false)
19 | }
20 |
21 | override fun onActivityCreated(savedInstanceState: Bundle?) {
22 | super.onActivityCreated(savedInstanceState)
23 |
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/ui/fragmentsample/FragmentSampleViewModel.kt:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample.ui.fragmentsample
2 |
3 | import android.arch.lifecycle.ViewModel
4 |
5 | class FragmentSampleViewModel : ViewModel() {
6 | // TODO: Implement the ViewModel
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/java/me/ele/uetool/sample/ui/recyclerviewsample/RecyclerViewActivity.kt:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample.ui.recyclerviewsample
2 |
3 | import android.os.Bundle
4 | import android.support.v7.app.AppCompatActivity
5 | import android.support.v7.widget.LinearLayoutManager
6 | import android.support.v7.widget.RecyclerView
7 | import android.view.LayoutInflater
8 | import android.view.View
9 | import android.view.ViewGroup
10 | import android.widget.TextView
11 | import me.ele.uetool.sample.R
12 |
13 | class RecyclerViewActivity : AppCompatActivity() {
14 | var recyclerView: RecyclerView? = null
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | setContentView(R.layout.activity_recycler_view)
19 | val list: ArrayList- = ArrayList()
20 | for (i in 0..999) {
21 | val item = when (i % 3) {
22 | 0 -> Item1()
23 | 1 -> Item2()
24 | else -> Item3()
25 | }
26 | list.add(item)
27 | }
28 | recyclerView = findViewById(R.id.recycler)
29 | recyclerView?.layoutManager = LinearLayoutManager(this)
30 | recyclerView?.adapter = SimpleAdapter(list)
31 | }
32 | }
33 |
34 |
35 | class SimpleAdapter(private val items: List
- ) : RecyclerView.Adapter() {
36 | companion object {
37 | const val TYPE1: Int = 1
38 | const val TYPE2: Int = 2
39 | const val TYPE3: Int = 3
40 | }
41 |
42 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
43 | val view = LayoutInflater.from(parent.context).inflate(R.layout.layout_simple_textview, parent, false)
44 | return when (viewType) {
45 | TYPE2 -> ViewHolder2(view)
46 | TYPE3 -> ViewHolder3(view)
47 | else -> ViewHolder1(view)
48 | }
49 | }
50 |
51 | override fun getItemCount(): Int {
52 | return items.size
53 | }
54 |
55 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
56 | val view: TextView = holder.itemView as TextView
57 | view.text = position.toString()
58 | }
59 |
60 | override fun getItemViewType(position: Int): Int {
61 | return when (items[position]) {
62 | is Item1 -> TYPE1
63 | is Item2 -> TYPE2
64 | is Item3 -> TYPE3
65 | else -> 0
66 | }
67 | }
68 | }
69 |
70 | interface Item
71 |
72 | class Item1 : Item
73 | class Item2 : Item
74 | class Item3 : Item
75 |
76 | class ViewHolder1(itemView: View) : RecyclerView.ViewHolder(itemView)
77 | class ViewHolder2(itemView: View) : RecyclerView.ViewHolder(itemView)
78 | class ViewHolder3(itemView: View) : RecyclerView.ViewHolder(itemView)
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_down_vote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/drawable-xxhdpi/ic_down_vote.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_food_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/drawable-xxhdpi/ic_food_new.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/drawable-xxhdpi/ic_placeholder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_tip.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/drawable-xxhdpi/ic_tip.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_up_vote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/drawable-xxhdpi/ic_up_vote.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/gradient_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
16 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
172 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
23 |
24 |
30 |
31 |
41 |
42 |
43 |
44 |
48 |
49 |
59 |
60 |
64 |
65 |
66 |
67 |
68 |
69 |
72 |
73 |
77 |
78 |
84 |
85 |
88 |
89 |
95 |
96 |
99 |
100 |
106 |
107 |
108 |
109 |
115 |
116 |
120 |
121 |
126 |
127 |
134 |
135 |
145 |
146 |
150 |
151 |
152 |
159 |
160 |
167 |
168 |
172 |
173 |
178 |
179 |
187 |
188 |
192 |
193 |
211 |
212 |
215 |
216 |
217 |
218 |
219 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_recycler_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_sample_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_sample_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_simple_textview.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | UETool
3 | SecondActivity
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/release/java/me.ele.uetool.sample/CustomAttribution.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.sample;
2 |
3 | public class CustomAttribution {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/art/move_view.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/art/move_view.gif
--------------------------------------------------------------------------------
/art/relative_position.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/art/relative_position.gif
--------------------------------------------------------------------------------
/art/show_gridding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/art/show_gridding.png
--------------------------------------------------------------------------------
/art/show_image_uri.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/art/show_image_uri.gif
--------------------------------------------------------------------------------
/art/uet_banner.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/art/uet_banner.jpeg
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.31'
5 |
6 | ext.versions = ['minSdk' : 14,
7 | 'targetSdk' : 28,
8 | 'compileSdk' : 28,
9 | 'buildTool' : '28.0.1',
10 |
11 | 'supportLibrary': '27.1.1',
12 | 'fresco' : '1.0.1',
13 |
14 | 'release' : '1.3.0',]
15 | repositories {
16 | jcenter()
17 | mavenCentral()
18 | google()
19 | }
20 | dependencies {
21 | classpath 'com.android.tools.build:gradle:3.3.2'
22 | classpath 'me.ele:lancet-plugin:1.0.6'
23 | // NOTE: Do not place your application dependencies here; they belong
24 | // in the individual module build.gradle files
25 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
26 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
27 | }
28 | }
29 |
30 | allprojects {
31 | repositories {
32 | jcenter()
33 | mavenCentral()
34 | google()
35 | maven { url 'https://jitpack.io' }
36 | }
37 | }
38 |
39 | task clean(type: Delete) {
40 | delete rootProject.buildDir
41 | }
42 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jul 09 01:02:39 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':uetool', ':uetool-no-op', ':uetool-fresco', ':uetool-base'
2 |
--------------------------------------------------------------------------------
/uetool-base/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/uetool-base/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | android {
5 | compileSdkVersion versions.compileSdk
6 |
7 | defaultConfig {
8 | minSdkVersion versions.minSdk
9 | }
10 |
11 | dependencies {
12 | api "com.android.support:appcompat-v7:27.1.1"
13 | api "com.android.support:recyclerview-v7:27.1.1"
14 | api "com.android.support:support-v4:27.1.1"
15 | implementation "com.github.tiann:FreeReflection:3.1.0"
16 | }
17 |
18 | lintOptions {
19 | abortOnError false
20 | }
21 | }
--------------------------------------------------------------------------------
/uetool-base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/uetool-base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/Application.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import android.content.Context;
4 |
5 | import java.lang.reflect.Method;
6 |
7 | public class Application {
8 |
9 | private static Context CONTEXT;
10 |
11 | private Application() {
12 | }
13 |
14 | public static Context getApplicationContext() {
15 | if (CONTEXT != null) {
16 | return CONTEXT;
17 | } else {
18 | try {
19 | Class activityThreadClass = Class.forName("android.app.ActivityThread");
20 | Method method = activityThreadClass.getMethod("currentApplication");
21 | CONTEXT = (Context) method.invoke(null);
22 | return CONTEXT;
23 | } catch (Exception e) {
24 | return null;
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/DimenUtil.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.util.TypedValue;
6 |
7 | public class DimenUtil {
8 |
9 | private static final Context CONTEXT = Application.getApplicationContext();
10 |
11 | private DimenUtil() {
12 |
13 | }
14 |
15 | public static String px2dip(float pxValue) {
16 | return px2dip(pxValue, false);
17 | }
18 |
19 | public static String px2dip(float pxValue, boolean withUnit) {
20 | float scale = CONTEXT.getResources().getDisplayMetrics().density;
21 | return (int) (pxValue / scale + 0.5F) + (withUnit ? "dp" : "");
22 | }
23 |
24 | public static int dip2px(float dpValue) {
25 | float scale = CONTEXT.getResources().getDisplayMetrics().density;
26 | return (int) (dpValue * scale + 0.5F);
27 | }
28 |
29 | public static int sp2px(float sp) {
30 | return (int) TypedValue.applyDimension(2, sp, CONTEXT.getResources().getDisplayMetrics());
31 | }
32 |
33 | public static String px2sp(float pxValue) {
34 | final float fontScale = CONTEXT.getResources().getDisplayMetrics().scaledDensity;
35 | return String.valueOf((int) (pxValue / fontScale + 0.5f));
36 | }
37 |
38 | public static int getScreenWidth() {
39 | return CONTEXT.getResources().getDisplayMetrics().widthPixels;
40 | }
41 |
42 | public static int getScreenHeight() {
43 | return CONTEXT.getResources().getDisplayMetrics().heightPixels;
44 | }
45 |
46 | public static int getStatusBarHeight() {
47 | Resources resources = CONTEXT.getResources();
48 | int resId = resources.getIdentifier("status_bar_height", "dimen", "android");
49 | return resId > 0 ? resources.getDimensionPixelSize(resId) : 0;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/Element.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import android.graphics.Rect;
4 | import android.os.Build;
5 | import android.view.View;
6 |
7 | public class Element {
8 |
9 | private View view;
10 | private Rect originRect = new Rect();
11 | private Rect rect = new Rect();
12 | private int[] location = new int[2];
13 | private Element parentElement;
14 |
15 | public Element(View view) {
16 | this.view = view;
17 | reset();
18 | originRect.set(rect.left, rect.top, rect.right, rect.bottom);
19 | }
20 |
21 | public View getView() {
22 | return view;
23 | }
24 |
25 | public Rect getRect() {
26 | return rect;
27 | }
28 |
29 | public Rect getOriginRect() {
30 | return originRect;
31 | }
32 |
33 | public void reset() {
34 | view.getLocationOnScreen(location);
35 | int width = view.getWidth();
36 | int height = view.getHeight();
37 |
38 | int left = location[0];
39 | int right = left + width;
40 | int top = location[1];
41 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
42 | top -= DimenUtil.getStatusBarHeight();
43 | }
44 | int bottom = top + height;
45 |
46 | rect.set(left, top, right, bottom);
47 | }
48 |
49 | public Element getParentElement() {
50 | if (parentElement == null) {
51 | Object parentView = view.getParent();
52 | if (parentView instanceof View) {
53 | parentElement = new Element((View) parentView);
54 | }
55 | }
56 | return parentElement;
57 | }
58 |
59 | // view 的面积
60 | public int getArea() {
61 | return view.getWidth() * view.getHeight();
62 | }
63 |
64 | @Override
65 | public boolean equals(Object o) {
66 | if (this == o) return true;
67 | if (o == null || getClass() != o.getClass()) return false;
68 |
69 | Element element = (Element) o;
70 |
71 | return view != null ? view.equals(element.view) : element.view == null;
72 |
73 | }
74 |
75 | @Override
76 | public int hashCode() {
77 | return view != null ? view.hashCode() : 0;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/IAttrs.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import java.util.List;
4 |
5 | import me.ele.uetool.base.item.Item;
6 |
7 | public interface IAttrs {
8 |
9 | List- getAttrs(Element element);
10 | }
11 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/ItemArrayList.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.Iterator;
6 |
7 | import me.ele.uetool.base.item.Item;
8 |
9 | public class ItemArrayList extends ArrayList {
10 |
11 | @Override
12 | public boolean add(T t) {
13 | if (!t.isValid()) {
14 | return false;
15 | }
16 | return super.add(t);
17 | }
18 |
19 | @Override
20 | public boolean addAll(Collection extends T> c) {
21 | removeInvalidItem(c);
22 | return super.addAll(c);
23 | }
24 |
25 | @Override
26 | public boolean addAll(int index, Collection extends T> c) {
27 | removeInvalidItem(c);
28 | return super.addAll(index, c);
29 | }
30 |
31 | private void removeInvalidItem(Collection extends T> c) {
32 | Iterator iterator = (Iterator) c.iterator();
33 | while (iterator.hasNext()) {
34 | T t = iterator.next();
35 | if (!t.isValid()) {
36 | iterator.remove();
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/ItemViewBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | /**
9 | * @author: weishenhong contact me.
10 | * @date: 2019-07-08 22:51
11 | */
12 | public interface ItemViewBinder {
13 |
14 | @NonNull
15 | VH onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter);
16 |
17 | void onBindViewHolder(@NonNull VH holder, @NonNull T item);
18 |
19 | }
20 |
21 |
22 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/ReflectionP.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | import android.os.Build;
4 | import android.util.Log;
5 |
6 | import me.weishu.reflection.Reflection;
7 |
8 | /**
9 | * 来自 weishu FreeReflection
10 | * https://github.com/tiann/FreeReflection
11 | */
12 | public class ReflectionP {
13 |
14 | private static final String TAG = "Reflection";
15 |
16 | public static T breakAndroidP(Func func) {
17 | T result;
18 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
19 | try {
20 | Reflection.unseal(Application.getApplicationContext());
21 | } catch (Exception e) {
22 | e.printStackTrace();
23 | }
24 | }
25 | result = func.call();
26 | return result;
27 | }
28 |
29 | public interface Func {
30 | T call();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/AddMinusEditItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import me.ele.uetool.base.Element;
4 |
5 | public class AddMinusEditItem extends EditTextItem {
6 |
7 | public AddMinusEditItem(String name, Element element, int type, String detail) {
8 | super(name, element, type, detail);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/BitmapItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | public class BitmapItem extends Item {
6 |
7 | private String name;
8 | private Bitmap bitmap;
9 |
10 | public BitmapItem(String name, Bitmap bitmap) {
11 | this.name = name;
12 | this.bitmap = bitmap;
13 | }
14 |
15 | public String getName() {
16 | return name;
17 | }
18 |
19 | public Bitmap getBitmap() {
20 | return bitmap;
21 | }
22 |
23 | @Override
24 | public boolean isValid() {
25 | if (bitmap == null) {
26 | return false;
27 | }
28 | return true;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/BriefDescItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import me.ele.uetool.base.Element;
4 |
5 | public class BriefDescItem extends ElementItem {
6 |
7 | private boolean isSelected;
8 |
9 | public BriefDescItem(Element element) {
10 | this(element, false);
11 | }
12 |
13 | public BriefDescItem(Element element, boolean isSelected) {
14 | super("", element);
15 | this.isSelected = isSelected;
16 | }
17 |
18 | public boolean isSelected() {
19 | return isSelected;
20 | }
21 |
22 | @Override
23 | public boolean isValid() {
24 | return true;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/EditTextItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import android.support.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import me.ele.uetool.base.Element;
9 |
10 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_HEIGHT;
11 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_PADDING_BOTTOM;
12 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_PADDING_LEFT;
13 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_PADDING_RIGHT;
14 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_PADDING_TOP;
15 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_TEXT;
16 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_TEXT_COLOR;
17 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_TEXT_SIZE;
18 | import static me.ele.uetool.base.item.EditTextItem.Type.TYPE_WIDTH;
19 |
20 | public class EditTextItem extends ElementItem {
21 |
22 | private @Type
23 | int type;
24 | private String detail;
25 |
26 | public EditTextItem(String name, Element element, @Type int type, String detail) {
27 | super(name, element);
28 | this.type = type;
29 | this.detail = detail;
30 | }
31 |
32 | public String getDetail() {
33 | return detail;
34 | }
35 |
36 | public int getType() {
37 | return type;
38 | }
39 |
40 | @IntDef({
41 | TYPE_TEXT,
42 | TYPE_TEXT_SIZE,
43 | TYPE_TEXT_COLOR,
44 | TYPE_WIDTH,
45 | TYPE_HEIGHT,
46 | TYPE_PADDING_LEFT,
47 | TYPE_PADDING_RIGHT,
48 | TYPE_PADDING_TOP,
49 | TYPE_PADDING_BOTTOM,
50 | })
51 | @Retention(RetentionPolicy.SOURCE)
52 | public @interface Type {
53 | int TYPE_TEXT = 1;
54 | int TYPE_TEXT_SIZE = 2;
55 | int TYPE_TEXT_COLOR = 3;
56 | int TYPE_WIDTH = 4;
57 | int TYPE_HEIGHT = 5;
58 | int TYPE_PADDING_LEFT = 6;
59 | int TYPE_PADDING_RIGHT = 7;
60 | int TYPE_PADDING_TOP = 8;
61 | int TYPE_PADDING_BOTTOM = 9;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/ElementItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import me.ele.uetool.base.Element;
4 |
5 | public class ElementItem extends TitleItem {
6 |
7 | private Element element;
8 |
9 | public ElementItem(String name, Element element) {
10 | super(name);
11 | this.element = element;
12 | }
13 |
14 | public Element getElement() {
15 | return element;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/Item.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | public class Item {
4 |
5 | public boolean isValid() {
6 | return true;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/SwitchItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import android.support.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import me.ele.uetool.base.Element;
9 |
10 | import static me.ele.uetool.base.item.SwitchItem.Type.TYPE_IS_BOLD;
11 | import static me.ele.uetool.base.item.SwitchItem.Type.TYPE_MOVE;
12 | import static me.ele.uetool.base.item.SwitchItem.Type.TYPE_SHOW_VALID_VIEWS;
13 |
14 | public class SwitchItem extends ElementItem {
15 |
16 | @Type
17 | private int type;
18 | private boolean isChecked;
19 |
20 | public SwitchItem(String name, Element element, @Type int type) {
21 | super(name, element);
22 | this.type = type;
23 | }
24 |
25 | public SwitchItem(String name, Element element, @Type int type, boolean isChecked) {
26 | super(name, element);
27 | this.type = type;
28 | this.isChecked = isChecked;
29 | }
30 |
31 | public void setChecked(boolean checked) {
32 | isChecked = checked;
33 | }
34 |
35 | public boolean isChecked() {
36 | return isChecked;
37 | }
38 |
39 | public int getType() {
40 | return type;
41 | }
42 |
43 | @IntDef({
44 | TYPE_IS_BOLD,
45 | TYPE_MOVE,
46 | TYPE_SHOW_VALID_VIEWS,
47 | })
48 | @Retention(RetentionPolicy.SOURCE)
49 | public @interface Type {
50 | int TYPE_IS_BOLD = 1;
51 | int TYPE_MOVE = 2;
52 | int TYPE_SHOW_VALID_VIEWS = 3;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/TextItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.text.TextUtils;
5 | import android.view.View;
6 |
7 | public class TextItem extends TitleItem {
8 |
9 | private String detail;
10 | private boolean enableCopy;
11 | private View.OnClickListener onClickListener;
12 |
13 | public TextItem(String name, String detail) {
14 | this(name, detail, false, null);
15 | }
16 |
17 | public TextItem(String name, String detail, boolean enableCopy) {
18 | this(name, detail, enableCopy, null);
19 | }
20 |
21 | public TextItem(String name, String detail, View.OnClickListener onClickListener) {
22 | this(name, detail, false, onClickListener);
23 | }
24 |
25 | public TextItem(String name, String detail, boolean enableCopy, View.OnClickListener onClickListener) {
26 | super(name);
27 | this.detail = detail;
28 | this.enableCopy = enableCopy;
29 | this.onClickListener = onClickListener;
30 | }
31 |
32 | public String getDetail() {
33 | return detail;
34 | }
35 |
36 | // 是否可复制文案
37 | public boolean isEnableCopy() {
38 | return enableCopy;
39 | }
40 |
41 | @Nullable
42 | public View.OnClickListener getOnClickListener() {
43 | return onClickListener;
44 | }
45 |
46 | @Override
47 | public boolean isValid() {
48 | if (TextUtils.isEmpty(detail)) {
49 | return false;
50 | }
51 | return true;
52 | }
53 | }
--------------------------------------------------------------------------------
/uetool-base/src/main/java/me/ele/uetool/base/item/TitleItem.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | public class TitleItem extends Item {
4 |
5 | private String name;
6 |
7 | public TitleItem(String name) {
8 | this.name = name;
9 | }
10 |
11 | public String getName() {
12 | return name;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/uetool-fresco/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/uetool-fresco/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | android {
5 | compileSdkVersion versions.compileSdk
6 |
7 | defaultConfig {
8 | minSdkVersion versions.minSdk
9 | }
10 |
11 | lintOptions {
12 | abortOnError false
13 | }
14 | }
15 |
16 | dependencies {
17 | compileOnly project(':uetool-base')
18 | // implementation "me.ele:uetool-base:${versions.release}"
19 | compileOnly "com.facebook.fresco:fresco:${versions.fresco}"
20 | }
--------------------------------------------------------------------------------
/uetool-fresco/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/uetool-fresco/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/uetool-fresco/src/main/java/me/ele/uetool/fresco/UETFresco.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.fresco;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.drawable.BitmapDrawable;
5 | import android.graphics.drawable.Drawable;
6 | import android.view.View;
7 | import com.facebook.common.internal.Supplier;
8 | import com.facebook.drawee.backends.pipeline.PipelineDraweeController;
9 | import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder;
10 | import com.facebook.drawee.drawable.FadeDrawable;
11 | import com.facebook.drawee.drawable.ScaleTypeDrawable;
12 | import com.facebook.drawee.generic.GenericDraweeHierarchy;
13 | import com.facebook.drawee.generic.RoundingParams;
14 | import com.facebook.drawee.view.DraweeView;
15 | import com.facebook.drawee.view.GenericDraweeView;
16 | import me.ele.uetool.base.Element;
17 | import me.ele.uetool.base.IAttrs;
18 | import me.ele.uetool.base.item.BitmapItem;
19 | import me.ele.uetool.base.item.Item;
20 | import me.ele.uetool.base.item.TextItem;
21 | import me.ele.uetool.base.item.TitleItem;
22 |
23 | import java.lang.reflect.Field;
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | import static me.ele.uetool.base.DimenUtil.px2dip;
28 |
29 | public class UETFresco implements IAttrs {
30 |
31 | @Override
32 | public List
- getAttrs(Element element) {
33 | List
- items = new ArrayList<>();
34 |
35 | View view = element.getView();
36 |
37 | if (view instanceof DraweeView) {
38 | items.add(new TitleItem("DraweeView"));
39 | items.add(new TextItem("CornerRadius", getCornerRadius((DraweeView) view)));
40 | items.add(new TextItem("ImageURI", getImageURI((DraweeView) view), true));
41 | items.add(new TextItem("ActualScaleType", getScaleType((DraweeView) view), true));
42 | items.add(new TextItem("IsSupportAnimation", isSupportAnimation((DraweeView) view)));
43 | items.add(new BitmapItem("PlaceHolderImage", getPlaceHolderBitmap((DraweeView) view)));
44 | items.add(new TextItem("FadeDuration", getFadeDuration((DraweeView) view)));
45 | }
46 | return items;
47 | }
48 |
49 | private String getCornerRadius(DraweeView draweeView) {
50 | GenericDraweeHierarchy hierarchy = getGenericDraweeHierarchy(draweeView);
51 | if (hierarchy != null) {
52 | RoundingParams params = hierarchy.getRoundingParams();
53 | if (params != null) {
54 | float[] cornersRadii = params.getCornersRadii();
55 | if (cornersRadii != null) {
56 | float firstRadii = cornersRadii[0];
57 | for (int i = 1; i < 8; i++) {
58 | if (firstRadii != cornersRadii[i]) {
59 | return null;
60 | }
61 | }
62 | return px2dip(firstRadii, true);
63 | }
64 | }
65 | }
66 | return null;
67 | }
68 |
69 | private String getScaleType(DraweeView draweeView) {
70 | GenericDraweeHierarchy hierarchy = getGenericDraweeHierarchy(draweeView);
71 | if (hierarchy != null) {
72 | return hierarchy.getActualImageScaleType().toString().toUpperCase();
73 | }
74 | return null;
75 | }
76 |
77 | private String getImageURI(DraweeView draweeView) {
78 | PipelineDraweeControllerBuilder builder = getFrescoControllerBuilder(draweeView);
79 | if (builder != null) {
80 | return builder.getImageRequest().getSourceUri().toString();
81 | }
82 | return "";
83 | }
84 |
85 | private String isSupportAnimation(DraweeView draweeView) {
86 | PipelineDraweeControllerBuilder builder = getFrescoControllerBuilder(draweeView);
87 | if (builder != null) {
88 | return String.valueOf(builder.getAutoPlayAnimations()).toUpperCase();
89 | }
90 | return "";
91 | }
92 |
93 | private Bitmap getPlaceHolderBitmap(DraweeView draweeView) {
94 | GenericDraweeHierarchy hierarchy = getGenericDraweeHierarchy(draweeView);
95 | if (hierarchy != null && hierarchy.hasPlaceholderImage()) {
96 | try {
97 | Field mFadeDrawableField = hierarchy.getClass().getDeclaredField("mFadeDrawable");
98 | mFadeDrawableField.setAccessible(true);
99 | FadeDrawable fadeDrawable = (FadeDrawable) mFadeDrawableField.get(hierarchy);
100 | Field mLayersField = fadeDrawable.getClass().getDeclaredField("mLayers");
101 | mLayersField.setAccessible(true);
102 | Drawable[] layers = (Drawable[]) mLayersField.get(fadeDrawable);
103 | // PLACEHOLDER_IMAGE_INDEX == 1
104 | Drawable drawable = layers[1];
105 | return getFrescoDrawableBitmap(drawable);
106 | } catch (Exception e) {
107 | e.printStackTrace();
108 | }
109 | }
110 | return null;
111 | }
112 |
113 | private String getFadeDuration(DraweeView draweeView) {
114 | int duration = 0;
115 | GenericDraweeHierarchy hierarchy = getGenericDraweeHierarchy(draweeView);
116 | if (hierarchy != null) {
117 | duration = hierarchy.getFadeDuration();
118 | }
119 | return duration + "ms";
120 | }
121 |
122 | private GenericDraweeHierarchy getGenericDraweeHierarchy(DraweeView draweeView) {
123 | if (draweeView instanceof GenericDraweeView) {
124 | return ((GenericDraweeView) draweeView).getHierarchy();
125 | }
126 | return null;
127 | }
128 |
129 | private PipelineDraweeControllerBuilder getFrescoControllerBuilder(DraweeView draweeView) {
130 | try {
131 | PipelineDraweeController controller = (PipelineDraweeController) draweeView.getController();
132 | Field mDataSourceSupplierFiled = PipelineDraweeController.class.getDeclaredField("mDataSourceSupplier");
133 | mDataSourceSupplierFiled.setAccessible(true);
134 | Supplier supplier = (Supplier) mDataSourceSupplierFiled.get(controller);
135 | Field mAutoField = Class.forName("com.facebook.drawee.controller.AbstractDraweeControllerBuilder$2").getDeclaredField("this$0");
136 | mAutoField.setAccessible(true);
137 | PipelineDraweeControllerBuilder builder = (PipelineDraweeControllerBuilder) mAutoField.get(supplier);
138 | return builder;
139 | } catch (Exception e) {
140 | e.printStackTrace();
141 | }
142 | return null;
143 | }
144 |
145 | private Bitmap getFrescoDrawableBitmap(Drawable drawable) {
146 | try {
147 | if (drawable instanceof ScaleTypeDrawable) {
148 | return ((BitmapDrawable) drawable.getCurrent()).getBitmap();
149 | } else if (drawable instanceof BitmapDrawable) {
150 | return ((BitmapDrawable) drawable).getBitmap();
151 | }
152 | } catch (Exception e) {
153 | e.printStackTrace();
154 | }
155 | return null;
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/uetool-no-op/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/uetool-no-op/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | android {
5 | compileSdkVersion versions.compileSdk
6 |
7 | defaultConfig {
8 | minSdkVersion versions.minSdk
9 | }
10 | }
--------------------------------------------------------------------------------
/uetool-no-op/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/uetool-no-op/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/uetool-no-op/src/main/java/me/ele/uetool/UETool.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import me.ele.uetool.base.ItemViewBinder;
4 | import me.ele.uetool.base.item.Item;
5 |
6 | public class UETool {
7 |
8 | public static void putFilterClass(Class clazz) {
9 | }
10 |
11 | public static void putFilterClass(String className) {
12 | }
13 |
14 | public static void putAttrsProviderClass(Class clazz) {
15 | }
16 |
17 | public static void putAttrsProviderClass(String className) {
18 | }
19 |
20 | public static boolean showUETMenu() {
21 | return false;
22 | }
23 |
24 | public static boolean showUETMenu(int y) {
25 | return false;
26 | }
27 |
28 | public static int dismissUETMenu() {
29 | return -1;
30 | }
31 |
32 | public static void registerAttrDialogItemViewBinder(Class clazz, ItemViewBinder binder) {
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/uetool-no-op/src/main/java/me/ele/uetool/base/ItemViewBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base;
2 |
3 | public interface ItemViewBinder {
4 | }
5 |
--------------------------------------------------------------------------------
/uetool-no-op/src/main/java/me/ele/uetool/base/item/Item.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.base.item;
2 |
3 | public class Item {
4 | }
5 |
--------------------------------------------------------------------------------
/uetool.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool.jks
--------------------------------------------------------------------------------
/uetool/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/uetool/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | android {
5 | compileSdkVersion versions.compileSdk
6 |
7 | defaultConfig {
8 | minSdkVersion versions.minSdk
9 | }
10 |
11 | lintOptions {
12 | abortOnError false
13 | }
14 | }
15 |
16 | dependencies {
17 | compileOnly project(':uetool-base')
18 | // api "me.ele:uetool-base:${versions.release}"
19 | implementation 'com.jakewharton.scalpel:scalpel:1.1.2'
20 | implementation ('com.github.bmelnychuk:atv:1.2.9') {
21 | exclude group: 'com.android.support', module: 'appcompat-v7'
22 | }
23 | }
--------------------------------------------------------------------------------
/uetool/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/uetool/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/BoardTextView.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.content.ContextCompat;
6 | import android.support.v4.graphics.drawable.DrawableCompat;
7 | import android.support.v7.widget.AppCompatTextView;
8 | import android.util.AttributeSet;
9 |
10 | import me.ele.uetool.base.DimenUtil;
11 |
12 | public class BoardTextView extends AppCompatTextView {
13 |
14 | private final String defaultInfo = getResources().getString(R.string.uet_name) + " / " + UETool.getInstance().getTargetActivity().getClass().getName();
15 | private final int padding = DimenUtil.dip2px(3);
16 |
17 | public BoardTextView(Context context) {
18 | this(context, null);
19 | }
20 |
21 | public BoardTextView(Context context, @Nullable AttributeSet attrs) {
22 | this(context, attrs, 0);
23 | }
24 |
25 | public BoardTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | initView();
28 | }
29 |
30 | private void initView() {
31 | setBackgroundColor(0x902395ff);
32 | setPadding(padding, padding, padding, padding);
33 | setTextColor(0xffffffff);
34 | setTextSize(9);
35 | setText(defaultInfo);
36 | setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, ContextCompat.getDrawable(getContext(), R.drawable.uet_close), null);
37 | setCompoundDrawablePadding(DimenUtil.dip2px(2));
38 | }
39 |
40 | public void updateInfo(String info) {
41 | setText(info + "\n" + defaultInfo);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/EditAttrLayout.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.graphics.Rect;
8 | import android.support.annotation.Nullable;
9 | import android.util.AttributeSet;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 |
13 | import me.ele.uetool.base.Element;
14 |
15 | import static me.ele.uetool.base.DimenUtil.dip2px;
16 | import static me.ele.uetool.base.DimenUtil.px2dip;
17 |
18 | public class EditAttrLayout extends CollectViewsLayout {
19 |
20 | private final int moveUnit = dip2px(1);
21 | private final int lineBorderDistance = dip2px(5);
22 |
23 | private Paint areaPaint = new Paint() {
24 | {
25 | setAntiAlias(true);
26 | setColor(0x30000000);
27 | }
28 | };
29 |
30 | private Element targetElement;
31 | private AttrsDialog dialog;
32 | private IMode mode = new ShowMode();
33 | private float lastX, lastY;
34 | private OnDragListener onDragListener;
35 |
36 | public EditAttrLayout(Context context) {
37 | super(context);
38 | }
39 |
40 | public EditAttrLayout(Context context, @Nullable AttributeSet attrs) {
41 | super(context, attrs);
42 | }
43 |
44 | public EditAttrLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
45 | super(context, attrs, defStyleAttr);
46 | }
47 |
48 | @Override
49 | protected void onDraw(Canvas canvas) {
50 | super.onDraw(canvas);
51 | if (targetElement != null) {
52 | canvas.drawRect(targetElement.getRect(), areaPaint);
53 | mode.onDraw(canvas);
54 | }
55 | }
56 |
57 | @Override
58 | public boolean onTouchEvent(MotionEvent event) {
59 | switch (event.getAction()) {
60 | case MotionEvent.ACTION_DOWN:
61 | lastX = event.getX();
62 | lastY = event.getY();
63 | break;
64 | case MotionEvent.ACTION_UP:
65 | mode.triggerActionUp(event);
66 | break;
67 | case MotionEvent.ACTION_MOVE:
68 | mode.triggerActionMove(event);
69 | break;
70 | }
71 | return true;
72 | }
73 |
74 | @Override
75 | protected void onDetachedFromWindow() {
76 | super.onDetachedFromWindow();
77 | targetElement = null;
78 | dismissAttrsDialog();
79 | }
80 |
81 | public void setOnDragListener(OnDragListener onDragListener) {
82 | this.onDragListener = onDragListener;
83 | }
84 |
85 | public void dismissAttrsDialog() {
86 | if (dialog != null) {
87 | dialog.dismiss();
88 | }
89 | }
90 |
91 | class MoveMode implements IMode {
92 |
93 | @Override
94 | public void onDraw(Canvas canvas) {
95 | Rect rect = targetElement.getRect();
96 | Rect originRect = targetElement.getOriginRect();
97 | canvas.drawRect(originRect, dashLinePaint);
98 | Element parentElement = targetElement.getParentElement();
99 | if (parentElement != null) {
100 | Rect parentRect = parentElement.getRect();
101 | int x = rect.left + rect.width() / 2;
102 | int y = rect.top + rect.height() / 2;
103 | drawLineWithText(canvas, rect.left, y, parentRect.left, y, dip2px(2));
104 | drawLineWithText(canvas, x, rect.top, x, parentRect.top, dip2px(2));
105 | drawLineWithText(canvas, rect.right, y, parentRect.right, y, dip2px(2));
106 | drawLineWithText(canvas, x, rect.bottom, x, parentRect.bottom, dip2px(2));
107 | }
108 | if (onDragListener != null) {
109 | onDragListener.showOffset("Offset:\n" + "x -> " + px2dip(rect.left - originRect.left, true) + " y -> " + px2dip(rect.top - originRect.top, true));
110 | }
111 | }
112 |
113 | @Override
114 | public void triggerActionMove(MotionEvent event) {
115 | if (targetElement != null) {
116 | boolean changed = false;
117 | View view = targetElement.getView();
118 | float diffX = event.getX() - lastX;
119 | if (Math.abs(diffX) >= moveUnit) {
120 | view.setTranslationX(view.getTranslationX() + diffX);
121 | lastX = event.getX();
122 | changed = true;
123 | }
124 | float diffY = event.getY() - lastY;
125 | if (Math.abs(diffY) >= moveUnit) {
126 | view.setTranslationY(view.getTranslationY() + diffY);
127 | lastY = event.getY();
128 | changed = true;
129 | }
130 | if (changed) {
131 | targetElement.reset();
132 | invalidate();
133 | }
134 | }
135 | }
136 |
137 | @Override
138 | public void triggerActionUp(MotionEvent event) {
139 |
140 | }
141 | }
142 |
143 | class ShowMode implements IMode {
144 |
145 | @Override
146 | public void onDraw(Canvas canvas) {
147 | Rect rect = targetElement.getRect();
148 | drawLineWithText(canvas, rect.left, rect.top - lineBorderDistance, rect.right, rect.top - lineBorderDistance);
149 | drawLineWithText(canvas, rect.right + lineBorderDistance, rect.top, rect.right + lineBorderDistance, rect.bottom);
150 | }
151 |
152 | @Override
153 | public void triggerActionMove(MotionEvent event) {
154 |
155 | }
156 |
157 | @Override
158 | public void triggerActionUp(final MotionEvent event) {
159 | final Element element = getTargetElement(event.getX(), event.getY());
160 | if (element != null) {
161 | targetElement = element;
162 | invalidate();
163 | if (dialog == null) {
164 | dialog = new AttrsDialog(getContext());
165 | dialog.setAttrDialogCallback(new AttrsDialog.AttrDialogCallback() {
166 | @Override
167 | public void enableMove() {
168 | mode = new MoveMode();
169 | dismissAttrsDialog();
170 | }
171 |
172 | @Override
173 | public void showValidViews(int position, boolean isChecked) {
174 | int positionStart = position + 1;
175 | if (isChecked) {
176 | dialog.notifyValidViewItemInserted(positionStart, getTargetElements(lastX, lastY), targetElement);
177 | } else {
178 | dialog.notifyItemRangeRemoved(positionStart);
179 | }
180 | }
181 |
182 | @Override
183 | public void selectView(Element element) {
184 | targetElement = element;
185 | dismissAttrsDialog();
186 | dialog.show(targetElement);
187 | }
188 | });
189 | dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
190 | @Override
191 | public void onDismiss(DialogInterface dialog) {
192 | if (targetElement != null) {
193 | targetElement.reset();
194 | invalidate();
195 | }
196 | }
197 | });
198 | }
199 | dialog.show(targetElement);
200 | }
201 | }
202 | }
203 |
204 | public interface IMode {
205 | void onDraw(Canvas canvas);
206 |
207 | void triggerActionMove(MotionEvent event);
208 |
209 | void triggerActionUp(MotionEvent event);
210 | }
211 |
212 | public interface OnDragListener {
213 | void showOffset(String offsetContent);
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/FragmentListTreeDialog.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.app.Activity;
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.graphics.Color;
7 | import android.graphics.RectF;
8 | import android.graphics.drawable.ColorDrawable;
9 | import android.os.Bundle;
10 | import android.support.v4.app.Fragment;
11 | import android.support.v4.app.FragmentActivity;
12 | import android.support.v4.app.FragmentManager;
13 | import android.text.Html;
14 | import android.view.*;
15 | import android.widget.CheckBox;
16 | import android.widget.CompoundButton;
17 | import android.widget.ImageView;
18 | import android.widget.TextView;
19 | import com.unnamed.b.atv.model.TreeNode;
20 | import com.unnamed.b.atv.view.AndroidTreeView;
21 |
22 | public class FragmentListTreeDialog extends Dialog implements Provider {
23 |
24 | private ViewGroup containerView;
25 | private RegionView regionView;
26 |
27 | public FragmentListTreeDialog(Context context) {
28 | super(context);
29 | requestWindowFeature(Window.FEATURE_NO_TITLE);
30 | }
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
35 |
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.uet_dialog_fragment_list_tree);
38 |
39 | containerView = findViewById(R.id.container);
40 | regionView = findViewById(R.id.region);
41 | CheckBox checkBox = findViewById(R.id.checkbox);
42 |
43 | createTree(checkBox.isChecked());
44 |
45 | checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
46 | @Override
47 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
48 | createTree(isChecked);
49 | }
50 | });
51 |
52 | }
53 |
54 | // 创建 fragment tree
55 | private void createTree(boolean showPackageName) {
56 | TreeNode root = TreeNode.root();
57 |
58 | Activity activity = UETool.getInstance().getTargetActivity();
59 | if (activity instanceof FragmentActivity) {
60 | FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
61 | createTreeNode(root, fragmentManager, showPackageName);
62 | }
63 |
64 | containerView.removeAllViews();
65 |
66 | AndroidTreeView tView = new AndroidTreeView(getContext(), root);
67 | tView.setDefaultAnimation(true);
68 | tView.setUse2dScroll(true);
69 | tView.setDefaultContainerStyle(R.style.uet_TreeNodeStyleCustom);
70 | containerView.addView(tView.getView());
71 |
72 | tView.expandAll();
73 | }
74 |
75 | // 递归创建 fragment tree node
76 | private TreeNode createTreeNode(TreeNode rootNode, FragmentManager fragmentManager, boolean showPackageName) {
77 | for (Fragment fragment : fragmentManager.getFragments()) {
78 | TreeNode node = new TreeNode(new TreeItem(fragment, showPackageName)).setViewHolder(new TreeItemVH(getContext(), this));
79 | FragmentManager childManager = fragment.getChildFragmentManager();
80 | rootNode.addChild(createTreeNode(node, childManager, showPackageName));
81 | }
82 | return rootNode;
83 | }
84 |
85 | @Override
86 | protected void onStart() {
87 | super.onStart();
88 | getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
89 | getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
90 | }
91 |
92 | @Override
93 | public void onClickTreeItem(RectF rectF) {
94 | regionView.drawRegion(rectF);
95 | }
96 |
97 | public static class TreeItemVH extends TreeNode.BaseNodeViewHolder {
98 |
99 | private TextView nameView;
100 | private ImageView arrowView;
101 |
102 | private Provider provider;
103 |
104 | public TreeItemVH(Context context, Provider provider) {
105 | super(context);
106 | this.provider = provider;
107 | }
108 |
109 | @Override
110 | public View createNodeView(TreeNode node, final TreeItem value) {
111 | final View view = LayoutInflater.from(context).inflate(R.layout.uet_cell_tree, null, false);
112 |
113 | nameView = view.findViewById(R.id.name);
114 | arrowView = view.findViewById(R.id.arrow);
115 |
116 | nameView.setText(Html.fromHtml(value.name));
117 |
118 | if (value.rectF != null) {
119 | nameView.setOnClickListener(new View.OnClickListener() {
120 | @Override
121 | public void onClick(View v) {
122 | if (provider != null) {
123 | provider.onClickTreeItem(value.rectF);
124 | }
125 | }
126 | });
127 | }
128 |
129 | return view;
130 | }
131 |
132 | @Override
133 | public void toggle(boolean active) {
134 | super.toggle(active);
135 |
136 | arrowView.animate().setDuration(200).rotation(active ? 90 : 0).start();
137 | }
138 | }
139 |
140 | public static class TreeItem {
141 |
142 | public String name;
143 | public RectF rectF;
144 |
145 | public TreeItem(Fragment fragment, boolean showPackageName) {
146 | initName(fragment, showPackageName);
147 | initRect(fragment);
148 | }
149 |
150 | private void initName(Fragment fragment, boolean showPackageName) {
151 | StringBuilder sb = new StringBuilder();
152 | sb.append(showPackageName ? fragment.getClass().getName() : fragment.getClass().getSimpleName());
153 | sb.append("[visible=").append(fragment.isVisible()).append(", hashCode=").append(fragment.hashCode()).append("]");
154 | name = sb.toString();
155 | if (fragment.isVisible()) {
156 | name = "" + name + "";
157 | }
158 | }
159 |
160 | private void initRect(Fragment fragment) {
161 | if (fragment.isVisible()) {
162 | View view = fragment.getView();
163 | int[] location = new int[2];
164 | view.getLocationOnScreen(location);
165 | rectF = new RectF(location[0], location[1], location[0] + view.getWidth(), location[1] + view.getHeight());
166 | }
167 | }
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/GriddingLayout.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.support.annotation.Nullable;
8 | import android.util.AttributeSet;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 |
12 | import static me.ele.uetool.base.DimenUtil.dip2px;
13 | import static me.ele.uetool.base.DimenUtil.getScreenHeight;
14 | import static me.ele.uetool.base.DimenUtil.getScreenWidth;
15 |
16 | public class GriddingLayout extends View {
17 |
18 | public static final int LINE_INTERVAL = dip2px(5);
19 | private final int screenWidth = getScreenWidth();
20 | private final int screenHeight = getScreenHeight();
21 |
22 | private Paint paint = new Paint() {
23 | {
24 | setAntiAlias(true);
25 | setColor(0x30000000);
26 | setStrokeWidth(1);
27 | }
28 | };
29 |
30 | private Activity bindActivity = UETool.getInstance().getTargetActivity();
31 |
32 | public GriddingLayout(Context context) {
33 | super(context);
34 | }
35 |
36 | public GriddingLayout(Context context, @Nullable AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public GriddingLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | protected void onDraw(Canvas canvas) {
46 | super.onDraw(canvas);
47 | int startX = 0;
48 | while (startX < screenWidth) {
49 | canvas.drawLine(startX, 0, startX, screenHeight, paint);
50 | startX = startX + LINE_INTERVAL;
51 | }
52 |
53 | int startY = 0;
54 | while (startY < screenHeight) {
55 | canvas.drawLine(0, startY, screenWidth, startY, paint);
56 | startY = startY + LINE_INTERVAL;
57 | }
58 | }
59 |
60 | @Override
61 | public boolean dispatchTouchEvent(MotionEvent event) {
62 | bindActivity.dispatchTouchEvent(event);
63 | return super.dispatchTouchEvent(event);
64 | }
65 |
66 | @Override
67 | public boolean onTouchEvent(MotionEvent event) {
68 | return true;
69 | }
70 |
71 | @Override
72 | protected void onDetachedFromWindow() {
73 | super.onDetachedFromWindow();
74 | bindActivity = null;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/Provider.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.graphics.RectF;
4 |
5 | public interface Provider {
6 |
7 | void onClickTreeItem(RectF rectF);
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/RegionView.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.RectF;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 | import me.ele.uetool.base.DimenUtil;
11 |
12 | public class RegionView extends View {
13 |
14 | private RectF rectF;
15 | private Paint paint = new Paint() {
16 | {
17 | setAntiAlias(true);
18 | setColor(Color.YELLOW);
19 | setStrokeWidth(DimenUtil.dip2px(2));
20 | setStyle(Style.STROKE);
21 | }
22 | };
23 |
24 | public RegionView(Context context) {
25 | this(context, null);
26 | }
27 |
28 | public RegionView(Context context, AttributeSet attrs) {
29 | this(context, attrs, 0);
30 | }
31 |
32 | public RegionView(Context context, AttributeSet attrs, int defStyleAttr) {
33 | super(context, attrs, defStyleAttr);
34 | }
35 |
36 | public void drawRegion(RectF rectF) {
37 | this.rectF = rectF;
38 | invalidate();
39 | }
40 |
41 | @Override
42 | protected void onDraw(Canvas canvas) {
43 | super.onDraw(canvas);
44 | if (rectF != null) {
45 | canvas.drawRect(rectF, paint);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/RelativePositionLayout.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.Rect;
8 | import android.support.annotation.Nullable;
9 | import android.util.AttributeSet;
10 | import android.view.MotionEvent;
11 |
12 | import me.ele.uetool.base.Element;
13 |
14 | import static me.ele.uetool.base.DimenUtil.dip2px;
15 |
16 | public class RelativePositionLayout extends CollectViewsLayout {
17 |
18 | private final int elementsNum = 2;
19 | private Paint areaPaint = new Paint() {
20 | {
21 | setAntiAlias(true);
22 | setColor(Color.RED);
23 | setStyle(Style.STROKE);
24 | setStrokeWidth(dip2px(1));
25 | }
26 | };
27 |
28 | private Element[] relativeElements = new Element[elementsNum];
29 | private int searchCount = 0;
30 |
31 | public RelativePositionLayout(Context context) {
32 | this(context, null);
33 | }
34 |
35 | public RelativePositionLayout(Context context, @Nullable AttributeSet attrs) {
36 | this(context, attrs, 0);
37 | }
38 |
39 | public RelativePositionLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
40 | super(context, attrs, defStyleAttr);
41 | setLayerType(LAYER_TYPE_SOFTWARE, null);
42 | }
43 |
44 | @Override
45 | public boolean onTouchEvent(MotionEvent event) {
46 | switch (event.getAction()) {
47 | case MotionEvent.ACTION_DOWN:
48 | break;
49 | case MotionEvent.ACTION_UP:
50 |
51 | final Element element = getTargetElement(event.getX(), event.getY());
52 | if (element != null) {
53 | relativeElements[searchCount % elementsNum] = element;
54 | searchCount++;
55 | invalidate();
56 | }
57 | break;
58 | }
59 | return true;
60 | }
61 |
62 | @Override
63 | protected void onDraw(Canvas canvas) {
64 | super.onDraw(canvas);
65 |
66 | if (relativeElements == null) {
67 | return;
68 | }
69 |
70 | boolean doubleNotNull = true;
71 | for (Element element : relativeElements) {
72 | if (element != null) {
73 | Rect rect = element.getRect();
74 | canvas.drawLine(0, rect.top, screenWidth, rect.top, dashLinePaint);
75 | canvas.drawLine(0, rect.bottom, screenWidth, rect.bottom, dashLinePaint);
76 | canvas.drawLine(rect.left, 0, rect.left, screenHeight, dashLinePaint);
77 | canvas.drawLine(rect.right, 0, rect.right, screenHeight, dashLinePaint);
78 | canvas.drawRect(rect, areaPaint);
79 | } else {
80 | doubleNotNull = false;
81 | }
82 | }
83 |
84 | if (doubleNotNull) {
85 | Rect firstRect = relativeElements[searchCount % elementsNum].getRect();
86 | Rect secondRect = relativeElements[(searchCount - 1) % elementsNum].getRect();
87 |
88 | if (secondRect.top > firstRect.bottom) {
89 | int x = secondRect.left + secondRect.width() / 2;
90 | drawLineWithText(canvas, x, firstRect.bottom, x, secondRect.top);
91 | }
92 |
93 | if (firstRect.top > secondRect.bottom) {
94 | int x = secondRect.left + secondRect.width() / 2;
95 | drawLineWithText(canvas, x, secondRect.bottom, x, firstRect.top);
96 | }
97 |
98 | if (secondRect.left > firstRect.right) {
99 | int y = secondRect.top + secondRect.height() / 2;
100 | drawLineWithText(canvas, secondRect.left, y, firstRect.right, y);
101 | }
102 |
103 | if (firstRect.left > secondRect.right) {
104 | int y = secondRect.top + secondRect.height() / 2;
105 | drawLineWithText(canvas, secondRect.right, y, firstRect.left, y);
106 | }
107 |
108 | drawNestedAreaLine(canvas, firstRect, secondRect);
109 | drawNestedAreaLine(canvas, secondRect, firstRect);
110 | }
111 | }
112 |
113 | private void drawNestedAreaLine(Canvas canvas, Rect firstRect, Rect secondRect) {
114 | if (secondRect.left >= firstRect.left && secondRect.right <= firstRect.right && secondRect.top >= firstRect.top && secondRect.bottom <= firstRect.bottom) {
115 |
116 | drawLineWithText(canvas, secondRect.left, secondRect.top + secondRect.height() / 2,
117 | firstRect.left, secondRect.top + secondRect.height() / 2);
118 |
119 | drawLineWithText(canvas, secondRect.right, secondRect.top + secondRect.height() / 2,
120 | firstRect.right, secondRect.top + secondRect.height() / 2);
121 |
122 | drawLineWithText(canvas, secondRect.left + secondRect.width() / 2, secondRect.top,
123 | secondRect.left + secondRect.width() / 2, firstRect.top);
124 |
125 | drawLineWithText(canvas, secondRect.left + secondRect.width() / 2, secondRect.bottom,
126 | secondRect.left + secondRect.width() / 2, firstRect.bottom);
127 | }
128 | }
129 |
130 | @Override
131 | protected void onDetachedFromWindow() {
132 | super.onDetachedFromWindow();
133 | relativeElements = null;
134 | }
135 |
136 | @Override
137 | protected void drawLineWithText(Canvas canvas, int startX, int startY, int endX, int endY) {
138 | drawLineWithText(canvas, startX, startY, endX, endY, dip2px(2));
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/TransparentActivity.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.annotation.IntDef;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.FrameLayout;
10 | import android.widget.Toast;
11 | import me.ele.uetool.base.DimenUtil;
12 |
13 | import java.lang.annotation.Retention;
14 | import java.lang.annotation.RetentionPolicy;
15 |
16 | import static android.view.Gravity.BOTTOM;
17 | import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
18 | import static me.ele.uetool.TransparentActivity.Type.*;
19 |
20 | public class TransparentActivity extends AppCompatActivity {
21 |
22 | public static final String EXTRA_TYPE = "extra_type";
23 |
24 | private ViewGroup vContainer;
25 | private int type;
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | if (savedInstanceState != null) {
31 | finish();
32 | return;
33 | }
34 | Util.setStatusBarColor(getWindow(), Color.TRANSPARENT);
35 | Util.enableFullscreen(getWindow());
36 | setContentView(R.layout.uet_activity_transparent);
37 |
38 | vContainer = findViewById(R.id.container);
39 |
40 | final BoardTextView board = new BoardTextView(this);
41 | board.setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View v) {
44 | UETool.getInstance().getTargetActivity().finish();
45 | finish();
46 | }
47 | });
48 |
49 | type = getIntent().getIntExtra(EXTRA_TYPE, TYPE_UNKNOWN);
50 |
51 | switch (type) {
52 | case TYPE_EDIT_ATTR:
53 | EditAttrLayout editAttrLayout = new EditAttrLayout(this);
54 | editAttrLayout.setOnDragListener(new EditAttrLayout.OnDragListener() {
55 | @Override
56 | public void showOffset(String offsetContent) {
57 | board.updateInfo(offsetContent);
58 | }
59 | });
60 | vContainer.addView(editAttrLayout);
61 | break;
62 | case TYPE_RELATIVE_POSITION:
63 | vContainer.addView(new RelativePositionLayout(this));
64 | break;
65 | case TYPE_SHOW_GRIDDING:
66 | vContainer.addView(new GriddingLayout(this));
67 | board.updateInfo("LINE_INTERVAL: " + DimenUtil.px2dip(GriddingLayout.LINE_INTERVAL, true));
68 | break;
69 | default:
70 | Toast.makeText(this, getString(R.string.uet_coming_soon), Toast.LENGTH_SHORT).show();
71 | finish();
72 | break;
73 | }
74 |
75 | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
76 | params.gravity = BOTTOM;
77 | vContainer.addView(board, params);
78 | }
79 |
80 | @Override
81 | public void finish() {
82 | super.finish();
83 | overridePendingTransition(0, 0);
84 | }
85 |
86 | @Override
87 | protected void onDestroy() {
88 | super.onDestroy();
89 | UETool.getInstance().release();
90 | }
91 |
92 | @Override
93 | protected void onStop() {
94 | super.onStop();
95 | finish();
96 | }
97 |
98 | public void dismissAttrsDialog() {
99 | for (int i = 0; i < vContainer.getChildCount(); i++) {
100 | View child = vContainer.getChildAt(i);
101 | if (child instanceof EditAttrLayout) {
102 | ((EditAttrLayout) child).dismissAttrsDialog();
103 | }
104 | }
105 | }
106 |
107 | @IntDef({
108 | TYPE_UNKNOWN,
109 | TYPE_EDIT_ATTR,
110 | TYPE_SHOW_GRIDDING,
111 | TYPE_RELATIVE_POSITION,
112 | })
113 | @Retention(RetentionPolicy.SOURCE)
114 | public @interface Type {
115 | int TYPE_UNKNOWN = -1;
116 | int TYPE_EDIT_ATTR = 1;
117 | int TYPE_SHOW_GRIDDING = 2;
118 | int TYPE_RELATIVE_POSITION = 3;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/UETCore.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.graphics.Bitmap;
6 | import android.util.Pair;
7 | import android.view.View;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 | import me.ele.uetool.base.Element;
11 | import me.ele.uetool.base.IAttrs;
12 | import me.ele.uetool.base.item.*;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import static me.ele.uetool.base.DimenUtil.px2dip;
18 | import static me.ele.uetool.base.DimenUtil.px2sp;
19 |
20 | public class UETCore implements IAttrs {
21 |
22 | @Override
23 | public List
- getAttrs(Element element) {
24 | List
- items = new ArrayList<>();
25 |
26 | View view = element.getView();
27 |
28 | items.add(new TextItem("Fragment", Util.getCurrentFragmentName(element.getView()), new View.OnClickListener() {
29 | @Override
30 | public void onClick(View v) {
31 | Activity activity = Util.getCurrentActivity();
32 | if (activity instanceof TransparentActivity) {
33 | ((TransparentActivity) activity).dismissAttrsDialog();
34 | }
35 | new FragmentListTreeDialog(v.getContext()).show();
36 | }
37 | }));
38 | items.add(new TextItem("ViewHolder", Util.getViewHolderName(element.getView())));
39 | items.add(new SwitchItem("Move", element, SwitchItem.Type.TYPE_MOVE));
40 | items.add(new SwitchItem("ValidViews", element, SwitchItem.Type.TYPE_SHOW_VALID_VIEWS));
41 |
42 | IAttrs iAttrs = AttrsManager.createAttrs(view);
43 | if (iAttrs != null) {
44 | items.addAll(iAttrs.getAttrs(element));
45 | }
46 |
47 | items.add(new TitleItem("COMMON"));
48 | items.add(new TextItem("Class", view.getClass().getName()));
49 | items.add(new TextItem("Id", Util.getResId(view)));
50 | items.add(new TextItem("ResName", Util.getResourceName(view.getId())));
51 | items.add(new TextItem("Tag", Util.getViewTag(view)));
52 | items.add(new TextItem("Clickable", Boolean.toString(view.isClickable()).toUpperCase()));
53 | items.add(new TextItem("OnClickListener", Util.getViewClickListener(view)));
54 | items.add(new TextItem("Focused", Boolean.toString(view.isFocused()).toUpperCase()));
55 | items.add(new AddMinusEditItem("Width(dp)", element, EditTextItem.Type.TYPE_WIDTH, px2dip(view.getWidth())));
56 | items.add(new AddMinusEditItem("Height(dp)", element, EditTextItem.Type.TYPE_HEIGHT, px2dip(view.getHeight())));
57 | items.add(new TextItem("Alpha", String.valueOf(view.getAlpha())));
58 | Object background = Util.getBackground(view);
59 | if (background instanceof String) {
60 | items.add(new TextItem("Background", (String) background));
61 | } else if (background instanceof Bitmap) {
62 | items.add(new BitmapItem("Background", (Bitmap) background));
63 | }
64 | items.add(new AddMinusEditItem("PaddingLeft(dp)", element, EditTextItem.Type.TYPE_PADDING_LEFT, px2dip(view.getPaddingLeft())));
65 | items.add(new AddMinusEditItem("PaddingRight(dp)", element, EditTextItem.Type.TYPE_PADDING_RIGHT, px2dip(view.getPaddingRight())));
66 | items.add(new AddMinusEditItem("PaddingTop(dp)", element, EditTextItem.Type.TYPE_PADDING_TOP, px2dip(view.getPaddingTop())));
67 | items.add(new AddMinusEditItem("PaddingBottom(dp)", element, EditTextItem.Type.TYPE_PADDING_BOTTOM, px2dip(view.getPaddingBottom())));
68 |
69 | return items;
70 | }
71 |
72 | static class AttrsManager {
73 |
74 | public static IAttrs createAttrs(View view) {
75 | if (view instanceof TextView) {
76 | return new UETTextView();
77 | } else if (view instanceof ImageView) {
78 | return new UETImageView();
79 | }
80 | return null;
81 | }
82 | }
83 |
84 | static class UETTextView implements IAttrs {
85 |
86 | @Override
87 | public List
- getAttrs(Element element) {
88 | List
- items = new ArrayList<>();
89 | TextView textView = ((TextView) element.getView());
90 | items.add(new TitleItem("TextView"));
91 | items.add(new EditTextItem("Text", element, EditTextItem.Type.TYPE_TEXT, textView.getText().toString()));
92 | items.add(new AddMinusEditItem("TextSize(sp)", element, EditTextItem.Type.TYPE_TEXT_SIZE, px2sp(textView.getTextSize())));
93 | items.add(new EditTextItem("TextColor", element, EditTextItem.Type.TYPE_TEXT_COLOR, Util.intToHexColor(textView.getCurrentTextColor())));
94 | List> pairs = Util.getTextViewBitmap(textView);
95 | for (Pair pair : pairs) {
96 | items.add(new BitmapItem(pair.first, pair.second));
97 | }
98 | items.add(new SwitchItem("IsBold", element, SwitchItem.Type.TYPE_IS_BOLD, textView.getTypeface() != null ? textView.getTypeface().isBold() : false));
99 | return items;
100 | }
101 | }
102 |
103 | static class UETImageView implements IAttrs {
104 |
105 | @Override
106 | public List
- getAttrs(Element element) {
107 | List
- items = new ArrayList<>();
108 | ImageView imageView = ((ImageView) element.getView());
109 | items.add(new TitleItem("ImageView"));
110 | items.add(new BitmapItem("Bitmap", Util.getImageViewBitmap(imageView)));
111 | items.add(new TextItem("ScaleType", Util.getImageViewScaleType(imageView)));
112 | return items;
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/UETMenu.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.TimeInterpolator;
6 | import android.animation.ValueAnimator;
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.content.res.Resources;
11 | import android.graphics.PixelFormat;
12 | import android.os.Build;
13 | import android.view.*;
14 | import android.view.ViewTreeObserver.OnPreDrawListener;
15 | import android.view.animation.AccelerateDecelerateInterpolator;
16 | import android.view.animation.Interpolator;
17 | import android.widget.FrameLayout;
18 | import android.widget.LinearLayout;
19 | import com.jakewharton.scalpel.ScalpelFrameLayout;
20 |
21 | import java.lang.reflect.Field;
22 | import java.util.ArrayList;
23 | import java.util.List;
24 |
25 | import static me.ele.uetool.TransparentActivity.Type.TYPE_UNKNOWN;
26 |
27 | public class UETMenu extends LinearLayout {
28 |
29 | private View vMenu;
30 | private ViewGroup vSubMenuContainer;
31 | private ValueAnimator animator;
32 | private Interpolator defaultInterpolator = new AccelerateDecelerateInterpolator();
33 | private List subMenus = new ArrayList<>();
34 |
35 | private WindowManager windowManager;
36 | private WindowManager.LayoutParams params = new WindowManager.LayoutParams();
37 | private int touchSlop;
38 | private int y;
39 | /**
40 | * 容器刚出来的时候的宽度,用于播放动画
41 | */
42 | private int vSubMenuContainerWidth = 0;
43 | public UETMenu(final Context context, int y) {
44 | super(context);
45 | inflate(context, R.layout.uet_menu_layout, this);
46 | setGravity(Gravity.CENTER_VERTICAL);
47 |
48 | this.y = y;
49 | touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
50 | windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
51 |
52 | vMenu = findViewById(R.id.menu);
53 | vSubMenuContainer = findViewById(R.id.sub_menu_container);
54 | Resources resources = context.getResources();
55 | subMenus.add(new UETSubMenu.SubMenu(resources.getString(R.string.uet_catch_view), R.drawable.uet_edit_attr, new OnClickListener() {
56 | @Override
57 | public void onClick(View v) {
58 | open(TransparentActivity.Type.TYPE_EDIT_ATTR);
59 | }
60 | }));
61 | subMenus.add(new UETSubMenu.SubMenu(resources.getString(R.string.uet_relative_location), R.drawable.uet_relative_position,
62 | new OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | open(TransparentActivity.Type.TYPE_RELATIVE_POSITION);
66 | }
67 | }));
68 | subMenus.add(new UETSubMenu.SubMenu(resources.getString(R.string.uet_grid), R.drawable.uet_show_gridding,
69 | new OnClickListener() {
70 | @Override
71 | public void onClick(View v) {
72 | open(TransparentActivity.Type.TYPE_SHOW_GRIDDING);
73 | }
74 | }));
75 |
76 | subMenus.add(new UETSubMenu.SubMenu(resources.getString(R.string.uet_scalpel), R.drawable.uet_scalpel, new OnClickListener() {
77 | @Override
78 | public void onClick(View view) {
79 | ViewGroup decorView = (ViewGroup) Util.getCurrentActivity().getWindow().getDecorView();
80 | ViewGroup content = decorView.findViewById(android.R.id.content);
81 | View contentChild = content.getChildAt(0);
82 | if (contentChild != null) {
83 | if (contentChild instanceof ScalpelFrameLayout) {
84 | content.removeAllViews();
85 | View originContent = ((ScalpelFrameLayout) contentChild).getChildAt(0);
86 | ((ScalpelFrameLayout) contentChild).removeAllViews();
87 | content.addView(originContent);
88 | } else {
89 | content.removeAllViews();
90 | ScalpelFrameLayout frameLayout = new ScalpelFrameLayout(getContext());
91 | frameLayout.setLayerInteractionEnabled(true);
92 | frameLayout.setDrawIds(true);
93 | frameLayout.addView(contentChild);
94 | content.addView(frameLayout);
95 | }
96 | }
97 | }
98 | }));
99 |
100 | for (UETSubMenu.SubMenu subMenu : subMenus) {
101 | UETSubMenu uetSubMenu = new UETSubMenu(getContext());
102 | uetSubMenu.update(subMenu);
103 | vSubMenuContainer.addView(uetSubMenu);
104 | }
105 |
106 | vMenu.setOnClickListener(new OnClickListener() {
107 | @Override
108 | public void onClick(View v) {
109 | startAnim();
110 | }
111 | });
112 |
113 | vMenu.setOnTouchListener(new View.OnTouchListener() {
114 | private float downX, downY;
115 | private float lastY;
116 |
117 | @Override
118 | public boolean onTouch(View v, MotionEvent event) {
119 | switch (event.getAction()) {
120 | case MotionEvent.ACTION_DOWN:
121 | downX = event.getRawX();
122 | downY = event.getRawY();
123 | lastY = downY;
124 | break;
125 | case MotionEvent.ACTION_MOVE:
126 | params.y += event.getRawY() - lastY;
127 | params.y = Math.max(0, params.y);
128 | windowManager.updateViewLayout(UETMenu.this, params);
129 | lastY = event.getRawY();
130 | break;
131 | case MotionEvent.ACTION_UP:
132 | if (Math.abs(event.getRawX() - downX) < touchSlop && Math.abs(event.getRawY() - downY) < touchSlop) {
133 | try {
134 | Field field = View.class.getDeclaredField("mListenerInfo");
135 | field.setAccessible(true);
136 | Object object = field.get(vMenu);
137 | field = object.getClass().getDeclaredField("mOnClickListener");
138 | field.setAccessible(true);
139 | object = field.get(object);
140 | if (object != null && object instanceof View.OnClickListener) {
141 | ((View.OnClickListener) object).onClick(vMenu);
142 | }
143 | } catch (Exception e) {
144 | e.printStackTrace();
145 | }
146 | }
147 | break;
148 | }
149 | return true;
150 | }
151 | });
152 |
153 | // 获取容器宽度,同时初始化设置
154 | vSubMenuContainer.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
155 | @Override
156 | public boolean onPreDraw() {
157 | vSubMenuContainerWidth = vSubMenuContainer.getMeasuredWidth();
158 | vSubMenuContainer.setTranslationX(-vSubMenuContainerWidth); // 隐藏
159 | vSubMenuContainer.setVisibility(View.GONE); // 设置为不可见,移除父容器占位
160 | vSubMenuContainer.getViewTreeObserver().removeOnPreDrawListener(this);
161 | // 这次不需要绘制,避免闪烁
162 | return false;
163 | }
164 | });
165 | }
166 |
167 | private void startAnim() {
168 | ensureAnim();
169 | final boolean isOpen = vSubMenuContainer.getTranslationX() <= -vSubMenuContainerWidth;
170 | animator.setInterpolator(isOpen ? defaultInterpolator : new ReverseInterpolator(defaultInterpolator));
171 | animator.removeAllListeners();
172 | animator.addListener(new AnimatorListenerAdapter() {
173 | @Override
174 | public void onAnimationStart(Animator animation) {
175 | vSubMenuContainer.setVisibility(VISIBLE);
176 | }
177 |
178 | @Override
179 | public void onAnimationEnd(Animator animation) {
180 | if (!isOpen) {
181 | vSubMenuContainer.setVisibility(GONE);
182 | }
183 | }
184 | });
185 | animator.start();
186 | }
187 |
188 | private void ensureAnim() {
189 | if (animator == null) {
190 | animator = ValueAnimator.ofInt(-vSubMenuContainerWidth, 0);
191 | animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
192 | @Override
193 | public void onAnimationUpdate(ValueAnimator animation) {
194 | vSubMenuContainer.setTranslationX((int) animation.getAnimatedValue());
195 | }
196 | });
197 | animator.setDuration(400);
198 | }
199 | }
200 |
201 | private void open() {
202 | open(TYPE_UNKNOWN);
203 | }
204 |
205 | private void open(@TransparentActivity.Type int type) {
206 | Activity currentTopActivity = Util.getCurrentActivity();
207 | if (currentTopActivity == null) {
208 | return;
209 | } else if (currentTopActivity.getClass() == TransparentActivity.class) {
210 | currentTopActivity.finish();
211 | return;
212 | }
213 | Intent intent = new Intent(currentTopActivity, TransparentActivity.class);
214 | intent.putExtra(TransparentActivity.EXTRA_TYPE, type);
215 | currentTopActivity.startActivity(intent);
216 | currentTopActivity.overridePendingTransition(0, 0);
217 | UETool.getInstance().setTargetActivity(currentTopActivity);
218 | }
219 |
220 | public void show() {
221 | try {
222 | windowManager.addView(this, getWindowLayoutParams());
223 | } catch (Exception e) {
224 | e.printStackTrace();
225 | }
226 | }
227 |
228 | public int dismiss() {
229 | try {
230 | windowManager.removeView(this);
231 | } catch (Exception e) {
232 | e.printStackTrace();
233 | }
234 | return params.y;
235 | }
236 |
237 | private WindowManager.LayoutParams getWindowLayoutParams() {
238 | params.width = FrameLayout.LayoutParams.WRAP_CONTENT;
239 | params.height = FrameLayout.LayoutParams.WRAP_CONTENT;
240 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
241 | params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
242 | } else {
243 | params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
244 | }
245 | params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
246 | params.format = PixelFormat.TRANSLUCENT;
247 | params.gravity = Gravity.TOP | Gravity.LEFT;
248 | params.x = 10;
249 | params.y = y;
250 | return params;
251 | }
252 |
253 | private static class ReverseInterpolator implements TimeInterpolator {
254 |
255 | private TimeInterpolator mWrappedInterpolator;
256 |
257 | ReverseInterpolator(TimeInterpolator interpolator) {
258 | mWrappedInterpolator = interpolator;
259 | }
260 |
261 | @Override
262 | public float getInterpolation(float input) {
263 | return mWrappedInterpolator.getInterpolation(Math.abs(input - 1f));
264 | }
265 | }
266 | }
267 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/UETSubMenu.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.util.AttributeSet;
6 | import android.view.Gravity;
7 | import android.widget.ImageView;
8 | import android.widget.LinearLayout;
9 | import android.widget.TextView;
10 |
11 | import static me.ele.uetool.base.DimenUtil.dip2px;
12 |
13 | public class UETSubMenu extends LinearLayout {
14 |
15 | private final int padding = dip2px(5);
16 |
17 | private ImageView vImage;
18 | private TextView vTitle;
19 |
20 | public UETSubMenu(Context context) {
21 | this(context, null);
22 | }
23 |
24 | public UETSubMenu(Context context, @Nullable AttributeSet attrs) {
25 | this(context, attrs, 0);
26 | }
27 |
28 | public UETSubMenu(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
29 | super(context, attrs, defStyleAttr);
30 | inflate(context, R.layout.uet_sub_menu_layout, this);
31 | setGravity(Gravity.CENTER);
32 | setOrientation(VERTICAL);
33 | setPadding(padding, 0, padding, 0);
34 | setTranslationY(dip2px(2));
35 | vImage = findViewById(R.id.image);
36 | vTitle = findViewById(R.id.title);
37 | }
38 |
39 | public void update(SubMenu subMenu) {
40 | vImage.setImageResource(subMenu.getImageRes());
41 | vTitle.setText(subMenu.getTitle());
42 | setOnClickListener(subMenu.getOnClickListener());
43 | }
44 |
45 | public static class SubMenu {
46 | private String title;
47 | private int imageRes;
48 | private OnClickListener onClickListener;
49 |
50 | public SubMenu(String title, int imageRes, OnClickListener onClickListener) {
51 | this.title = title;
52 | this.imageRes = imageRes;
53 | this.onClickListener = onClickListener;
54 | }
55 |
56 | public String getTitle() {
57 | return title;
58 | }
59 |
60 | public int getImageRes() {
61 | return imageRes;
62 | }
63 |
64 | public OnClickListener getOnClickListener() {
65 | return onClickListener;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/UETool.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.os.Build;
9 | import android.provider.Settings;
10 | import android.widget.Toast;
11 |
12 | import java.util.ArrayList;
13 | import java.util.HashSet;
14 | import java.util.List;
15 | import java.util.Set;
16 |
17 | import me.ele.uetool.attrdialog.AttrsDialogMultiTypePool;
18 | import me.ele.uetool.attrdialog.binder.AddMinusEditTextItemBinder;
19 | import me.ele.uetool.attrdialog.binder.BitmapItemBinder;
20 | import me.ele.uetool.attrdialog.binder.BriefDescItemBinder;
21 | import me.ele.uetool.attrdialog.binder.EditTextItemBinder;
22 | import me.ele.uetool.attrdialog.binder.SwitchItemBinder;
23 | import me.ele.uetool.attrdialog.binder.TextItemBinder;
24 | import me.ele.uetool.attrdialog.binder.TitleItemBinder;
25 | import me.ele.uetool.base.Application;
26 | import me.ele.uetool.base.ItemViewBinder;
27 | import me.ele.uetool.base.item.AddMinusEditItem;
28 | import me.ele.uetool.base.item.BitmapItem;
29 | import me.ele.uetool.base.item.BriefDescItem;
30 | import me.ele.uetool.base.item.EditTextItem;
31 | import me.ele.uetool.base.item.Item;
32 | import me.ele.uetool.base.item.SwitchItem;
33 | import me.ele.uetool.base.item.TextItem;
34 | import me.ele.uetool.base.item.TitleItem;
35 |
36 | public class UETool {
37 |
38 | private static volatile UETool instance;
39 | private Set filterClassesSet = new HashSet<>();
40 | private List attrsProviderSet = new ArrayList() {
41 | {
42 | add(UETCore.class.getName());
43 | add("me.ele.uetool.fresco.UETFresco");
44 | }
45 | };
46 | private Activity targetActivity;
47 | private UETMenu uetMenu;
48 | private AttrsDialogMultiTypePool attrsDialogMultiTypePool = new AttrsDialogMultiTypePool();
49 |
50 | private UETool() {
51 | initAttrsDialogMultiTypePool();
52 | }
53 |
54 | static UETool getInstance() {
55 | if (instance == null) {
56 | synchronized (UETool.class) {
57 | if (instance == null) {
58 | instance = new UETool();
59 | }
60 | }
61 | }
62 | return instance;
63 | }
64 |
65 | public static void putFilterClass(Class clazz) {
66 | putFilterClass(clazz.getName());
67 | }
68 |
69 | public static void putFilterClass(String className) {
70 | getInstance().putFilterClassName(className);
71 | }
72 |
73 | public static void registerAttrDialogItemViewBinder(Class clazz, ItemViewBinder binder) {
74 | getInstance().attrsDialogMultiTypePool.register(clazz, binder);
75 | }
76 |
77 | public static void putAttrsProviderClass(Class clazz) {
78 | putAttrsProviderClass(clazz.getName());
79 | }
80 |
81 | public static void putAttrsProviderClass(String className) {
82 | getInstance().putAttrsProviderClassName(className);
83 | }
84 |
85 | public static boolean showUETMenu() {
86 | return getInstance().showMenu();
87 | }
88 |
89 | public static boolean showUETMenu(int y) {
90 | return getInstance().showMenu(y);
91 | }
92 |
93 | public static int dismissUETMenu() {
94 | return getInstance().dismissMenu();
95 | }
96 |
97 | private void putFilterClassName(String className) {
98 | filterClassesSet.add(className);
99 | }
100 |
101 | private void putAttrsProviderClassName(String className) {
102 | attrsProviderSet.add(0, className);
103 | }
104 |
105 | private boolean showMenu() {
106 | return showMenu(10);
107 | }
108 |
109 | private boolean showMenu(int y) {
110 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
111 | if (!Settings.canDrawOverlays(Application.getApplicationContext())) {
112 | requestPermission(Application.getApplicationContext());
113 | Toast.makeText(Application.getApplicationContext(), "After grant this permission, re-enable UETool", Toast.LENGTH_LONG).show();
114 | return false;
115 | }
116 | }
117 | if (uetMenu == null) {
118 | uetMenu = new UETMenu(Application.getApplicationContext(), y);
119 | }
120 | if (!uetMenu.isShown()) {
121 | uetMenu.show();
122 | return true;
123 | }
124 | return false;
125 | }
126 |
127 | private int dismissMenu() {
128 | if (uetMenu != null) {
129 | int y = uetMenu.dismiss();
130 | uetMenu = null;
131 | return y;
132 | }
133 | return -1;
134 | }
135 |
136 | public Set getFilterClasses() {
137 | return filterClassesSet;
138 | }
139 |
140 | public Activity getTargetActivity() {
141 | return targetActivity;
142 | }
143 |
144 |
145 | public void setTargetActivity(Activity targetActivity) {
146 | this.targetActivity = targetActivity;
147 | }
148 |
149 | public AttrsDialogMultiTypePool getAttrsDialogMultiTypePool() {
150 | return attrsDialogMultiTypePool;
151 | }
152 |
153 | public List getAttrsProvider() {
154 | return attrsProviderSet;
155 | }
156 |
157 | void release() {
158 | targetActivity = null;
159 | }
160 |
161 | private void initAttrsDialogMultiTypePool() {
162 | attrsDialogMultiTypePool.register(AddMinusEditItem.class, new AddMinusEditTextItemBinder());
163 | attrsDialogMultiTypePool.register(BitmapItem.class, new BitmapItemBinder());
164 | attrsDialogMultiTypePool.register(BriefDescItem.class, new BriefDescItemBinder());
165 | attrsDialogMultiTypePool.register(EditTextItem.class, new EditTextItemBinder());
166 | attrsDialogMultiTypePool.register(SwitchItem.class, new SwitchItemBinder());
167 | attrsDialogMultiTypePool.register(TextItem.class, new TextItemBinder());
168 | attrsDialogMultiTypePool.register(TitleItem.class, new TitleItemBinder());
169 | }
170 |
171 | @TargetApi(Build.VERSION_CODES.M)
172 | private void requestPermission(Context context) {
173 | Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
174 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
175 | context.startActivity(intent);
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/AttrsDialogItemViewBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 |
5 | import me.ele.uetool.AttrsDialog;
6 | import me.ele.uetool.base.ItemViewBinder;
7 | import me.ele.uetool.base.item.Item;
8 |
9 | /**
10 | * @author: weishenhong contact me.
11 | * @date: 2019-07-08 23:37
12 | */
13 | public abstract class AttrsDialogItemViewBinder> implements ItemViewBinder {
14 |
15 | protected AttrsDialog.AttrDialogCallback getAttrDialogCallback(RecyclerView.Adapter adapter) {
16 | AttrsDialog.AttrDialogCallback callback = null;
17 | if (adapter instanceof AttrsDialog.Adapter) {
18 | callback = ((AttrsDialog.Adapter) adapter).getAttrDialogCallback();
19 | }
20 | return callback;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/AttrsDialogMultiTypePool.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import me.ele.uetool.base.ItemViewBinder;
7 | import me.ele.uetool.base.item.Item;
8 |
9 | /**
10 | * @author: weishenhong contact me.
11 | * @date: 2019-07-08 22:50
12 | */
13 | public class AttrsDialogMultiTypePool {
14 |
15 | private List classes = new ArrayList<>();
16 | private List binders = new ArrayList<>();
17 |
18 | public void register(
19 | Class clazz,
20 | ItemViewBinder binder) {
21 | if (classes.contains(clazz)) {
22 | return;
23 | }
24 | classes.add(clazz);
25 | binders.add(binder);
26 | }
27 |
28 |
29 | public ItemViewBinder, ?> getItemViewBinder(int index) {
30 | if (index < 0 || index > binders.size()) {
31 | throw new RuntimeException("un support view holder type:" + index);
32 | }
33 | return binders.get(index);
34 | }
35 |
36 | public int getItemType(Object item) {
37 | int index = classes.indexOf(item.getClass());
38 | if (index == -1) {
39 | throw new RuntimeException("un support class type:" + item.getClass().getName());
40 | }
41 | return index;
42 | }
43 | }
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/AddMinusEditTextItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.AddMinusEditItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class AddMinusEditTextItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.AddMinusEditViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.AddMinusEditViewHolder.newInstance(parent);
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.AddMinusEditViewHolder holder, @NonNull AddMinusEditItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/BitmapItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.BitmapItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class BitmapItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.BitmapInfoViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.BitmapInfoViewHolder.newInstance(parent);
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.BitmapInfoViewHolder holder, @NonNull BitmapItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/BriefDescItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.BriefDescItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class BriefDescItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.BriefDescViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 |
21 | return AttrsDialog.Adapter.BriefDescViewHolder.newInstance(parent, getAttrDialogCallback(adapter));
22 | }
23 |
24 | @Override
25 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.BriefDescViewHolder holder, @NonNull BriefDescItem item) {
26 | holder.bindView(item);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/EditTextItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.EditTextItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class EditTextItemBinder extends AttrsDialogItemViewBinder> {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.EditTextViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.EditTextViewHolder.newInstance(parent);
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.EditTextViewHolder holder, @NonNull EditTextItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/SwitchItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.SwitchItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class SwitchItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.SwitchViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.SwitchViewHolder.newInstance(parent, getAttrDialogCallback(adapter));
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.SwitchViewHolder holder, @NonNull SwitchItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/TextItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.TextItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class TextItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.TextViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.TextViewHolder.newInstance(parent);
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.TextViewHolder holder, @NonNull TextItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/java/me/ele/uetool/attrdialog/binder/TitleItemBinder.java:
--------------------------------------------------------------------------------
1 | package me.ele.uetool.attrdialog.binder;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.ViewGroup;
7 |
8 | import me.ele.uetool.AttrsDialog;
9 | import me.ele.uetool.attrdialog.AttrsDialogItemViewBinder;
10 | import me.ele.uetool.base.item.TitleItem;
11 |
12 | /**
13 | * @author: weishenhong contact me.
14 | * @date: 2019-07-08 23:46
15 | */
16 | public class TitleItemBinder extends AttrsDialogItemViewBinder {
17 | @NonNull
18 | @Override
19 | public AttrsDialog.Adapter.TitleViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent, RecyclerView.Adapter adapter) {
20 | return AttrsDialog.Adapter.TitleViewHolder.newInstance(parent);
21 | }
22 |
23 | @Override
24 | public void onBindViewHolder(@NonNull AttrsDialog.Adapter.TitleViewHolder holder, @NonNull TitleItem item) {
25 | holder.bindView(item);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_add.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_add_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_add_pressed.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_close.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_edit_attr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_edit_attr.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_menu.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_minus.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_minus_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_minus_pressed.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_relative_position.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_relative_position.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_scalpel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_scalpel.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_show_gridding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_show_gridding.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_sub_menu_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_sub_menu_bg.9.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable-xxhdpi/uet_tree_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eleme/UETool/e4967a5fae89f94561917ab95ca40c6e414a25ec/uetool/src/main/res/drawable-xxhdpi/uet_tree_arrow.png
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable/uet_selector_add.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable/uet_selector_brief_desc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/uetool/src/main/res/drawable/uet_selector_minus.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_activity_transparent.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_add_minus_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
21 |
22 |
28 |
29 |
35 |
36 |
50 |
51 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_bitmap_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
22 |
28 |
29 |
35 |
36 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_brief_view_desc.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_edit_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
21 |
22 |
28 |
29 |
35 |
36 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_switch.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
22 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
22 |
33 |
34 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_cell_tree.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_dialog_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_dialog_fragment_list_tree.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
30 |
31 |
38 |
39 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_menu_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
21 |
22 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/uetool/src/main/res/layout/uet_sub_menu_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
23 |
24 |
32 |
33 |
--------------------------------------------------------------------------------
/uetool/src/main/res/values-en/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | catch
4 | location
5 | gridding
6 | scalpel
7 |
--------------------------------------------------------------------------------
/uetool/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 捕捉控件
4 | 相对位置
5 | 网格栅栏
6 | 手术刀
7 |
--------------------------------------------------------------------------------
/uetool/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 12sp
4 |
--------------------------------------------------------------------------------
/uetool/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | UETool
4 | could not found view in (%1$.0f , %2$.0f), please select view again
5 | coming soon
6 | DESABLE_UETOOL
7 | catch
8 | location
9 | gridding
10 | scalpel
11 |
--------------------------------------------------------------------------------
/uetool/src/main/res/values/values.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
20 |
21 |
24 |
25 |
--------------------------------------------------------------------------------