├── .gitignore
├── AndroidsDemo
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-v21
│ │ ├── btn.xml
│ │ └── btn_ripple.xml
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ ├── bg.png
│ │ ├── bg2.png
│ │ ├── dl_ic_drag.png
│ │ ├── dl_ic_drag_inact.png
│ │ ├── dl_ic_move.png
│ │ ├── ic_emoij.jpg
│ │ ├── ic_launcher.png
│ │ ├── slot_01.png
│ │ ├── slot_02.png
│ │ ├── slot_03.png
│ │ ├── slot_04.png
│ │ ├── slot_05.png
│ │ ├── slot_06.png
│ │ ├── slot_07.png
│ │ ├── socially_default_portrait_female.png
│ │ ├── socially_default_portrait_male.png
│ │ ├── socially_portrait_female.png
│ │ ├── socially_portrait_male.png
│ │ ├── socially_portrait_other.png
│ │ └── world_map.png
│ ├── drawable
│ │ ├── btn_selector.xml
│ │ ├── dl_drag_selector.xml
│ │ ├── dl_item_bg_selector.xml
│ │ └── shape_slot_machine_border.xml
│ ├── layout
│ │ ├── activity_animatorutil_demo.xml
│ │ ├── activity_drag_listview.xml
│ │ ├── activity_easyadpater.xml
│ │ ├── activity_ellipise_demo.xml
│ │ ├── activity_keyboard_layout.xml
│ │ ├── activity_main.xml
│ │ ├── activity_maskimageview.xml
│ │ ├── activity_other.xml
│ │ ├── activity_ratioimageview.xml
│ │ ├── activity_scrollpickerview.xml
│ │ ├── activity_shapeimageview.xml
│ │ ├── activity_touchgesturedetector.xml
│ │ ├── dl_added_item.xml
│ │ ├── dl_added_plugin_item.xml
│ │ ├── dl_not_added_item.xml
│ │ ├── dl_not_added_plugin_item.xml
│ │ ├── item_string.xml
│ │ ├── register_portrait_female_list.xml
│ │ ├── register_portrait_male_list.xml
│ │ └── slot_machine_view.xml
│ ├── values-v21
│ │ └── styles.xml
│ ├── values-w820dp
│ │ └── dimens.xml
│ └── values
│ │ ├── color.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
└── src
│ └── com
│ └── example
│ └── androidsdemo
│ ├── AnimatorUtilDemo.java
│ ├── DragListViewDemo.java
│ ├── EasyAdapterDemo.java
│ ├── EllipsizeUtilsDemo.java
│ ├── KeyboardLayoutDemo.java
│ ├── MainActivity.java
│ ├── MaskImageViewDemo.java
│ ├── RatioImageViewDemo.java
│ ├── ScrollPickerViewDemo.java
│ ├── ShapeImageViewDemo.java
│ ├── TouchGestureDetectorDemo.java
│ ├── adapter
│ └── PluginListAdapter.java
│ └── view
│ ├── EasyPaintView.java
│ ├── EllipsizingTextView.java
│ └── SlotMachine.java
├── README.md
├── README_AnimatorUtil.md
├── README_DragListView.md
├── README_EasyAdapter.md
├── README_EllipsizeUtils.md
├── README_KeyboardLayout.md
├── README_MaskImageView.md
├── README_PaddingView.md
├── README_RatioImageView.md
├── README_STextView.md
├── README_SView.md
├── README_ScrollPickerView.md
├── README_ShapeImageView.md
├── androids
├── AndroidManifest.xml
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ ├── values-sw600dp
│ │ └── dimens.xml
│ └── values
│ │ ├── attrs.xml
│ │ └── dimens.xml
└── src
│ └── cn
│ └── forward
│ └── androids
│ ├── CompareRunnable.java
│ ├── Image
│ ├── AsyncDrawable.java
│ ├── ImageCache.java
│ ├── ImageCacheKeyGenerator.java
│ ├── ImageLoader.java
│ ├── ImageLoaderConfig.java
│ ├── ImageLoaderGroup.java
│ └── LocalImagerLoader.java
│ ├── Priority.java
│ ├── PriorityRunnable.java
│ ├── ScaleGestureDetectorApi27.java
│ ├── SimpleAsyncTask.java
│ ├── TouchGestureDetector.java
│ ├── utils
│ ├── AnimatorUtil.java
│ ├── ColorUtil.java
│ ├── DateUtil.java
│ ├── EllipsizeUtils.java
│ ├── ImageUtils.java
│ ├── LogUtil.java
│ ├── ProcessUtil.java
│ ├── ReflectUtil.java
│ ├── StatusBarUtil.java
│ ├── ThreadUtil.java
│ ├── Util.java
│ ├── ViewUtil.java
│ └── cache
│ │ ├── DiskLruCache.java
│ │ ├── DiskLruUtil.java
│ │ └── StrictLineReader.java
│ └── views
│ ├── BitmapScrollPicker.java
│ ├── DragListView.java
│ ├── EasyAdapter.java
│ ├── KeyboardLayout.java
│ ├── MaskImageView.java
│ ├── PaddingImageView.java
│ ├── PaddingTextView.java
│ ├── PaddingViewAttrs.java
│ ├── RatioImageView.java
│ ├── RoundProgressBar.java
│ ├── SFrameLayout.java
│ ├── SLinearLayout.java
│ ├── SRelativeLayout.java
│ ├── STextView.java
│ ├── ScrollPickerView.java
│ ├── SelectorAttrs.java
│ ├── ShapeImageView.java
│ └── StringScrollPicker.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle
2 | .gradle
3 | build
4 | local.properties
5 | reports
6 |
7 | # Maven
8 | target
9 | pom.xml.*
10 | bintray.properties
11 | release.properties
12 | gen-external-apklibs
13 |
14 | # Eclipse
15 | .classpath
16 | .project
17 | .settings
18 | eclipsebin
19 |
20 | # IntelliJ IDEA
21 | .idea
22 | *.iml
23 | *.ipl
24 | *.iws
25 | classes/
26 | idea-classes/
27 | coverage-error.log
28 |
29 | # Android
30 | gen
31 | bin
32 | project.properties
33 | out
34 |
35 | # Finder
36 | .DS_Store
--------------------------------------------------------------------------------
/AndroidsDemo/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/AndroidsDemo/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
29 |
32 |
35 |
38 |
42 |
46 |
47 |
48 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/AndroidsDemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 |
6 | defaultConfig {
7 | applicationId "com.example.androidsdemo"
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | debug {
19 | debuggable true
20 | }
21 | }
22 | lintOptions {
23 | abortOnError false
24 | }
25 |
26 | sourceSets {
27 | main {
28 | manifest.srcFile 'AndroidManifest.xml'
29 | java.srcDirs = ['src']
30 | resources.srcDirs = ['src']
31 | aidl.srcDirs = ['src']
32 | renderscript.srcDirs = ['src']
33 | res.srcDirs = ['res']
34 | assets.srcDirs = ['assets']
35 | }
36 | }
37 |
38 |
39 | }
40 |
41 | dependencies {
42 | implementation fileTree(include: ['*.jar'], dir: 'libs')
43 | implementation project(':androids')
44 | implementation 'com.android.support:recyclerview-v7:26.1.0'
45 | implementation 'com.android.support:appcompat-v7:26.1.0'
46 | }
47 |
--------------------------------------------------------------------------------
/AndroidsDemo/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/ic_launcher-web.png
--------------------------------------------------------------------------------
/AndroidsDemo/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/AndroidsDemo/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-23
15 | android.library.reference.1=../AndroidsLib
16 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-v21/btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-v21/btn_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/bg.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/bg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/bg2.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/dl_ic_drag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/dl_ic_drag.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/dl_ic_drag_inact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/dl_ic_drag_inact.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/dl_ic_move.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/dl_ic_move.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/ic_emoij.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/ic_emoij.jpg
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_01.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_02.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_03.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_04.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_05.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_06.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/slot_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/slot_07.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/socially_default_portrait_female.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/socially_default_portrait_female.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/socially_default_portrait_male.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/socially_default_portrait_male.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_female.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_female.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_male.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_male.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_other.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/socially_portrait_other.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable-xxhdpi/world_map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/1993hzw/Androids/d515b65c4f6f86731c58c0f0c5f4f3c7bec2a874/AndroidsDemo/res/drawable-xxhdpi/world_map.png
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable/btn_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable/dl_drag_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable/dl_item_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/drawable/shape_slot_machine_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_animatorutil_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
32 |
33 |
34 |
44 |
45 |
53 |
54 |
60 |
61 |
62 |
72 |
73 |
77 |
78 |
81 |
82 |
86 |
87 |
93 |
94 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_drag_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_easyadpater.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
17 |
18 |
23 |
24 |
30 |
31 |
36 |
37 |
43 |
44 |
51 |
52 |
57 |
58 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_ellipise_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
33 |
34 |
35 |
36 |
39 |
40 |
44 |
45 |
52 |
53 |
59 |
60 |
67 |
68 |
76 |
77 |
84 |
85 |
93 |
94 |
101 |
102 |
110 |
111 |
118 |
119 |
127 |
128 |
136 |
137 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_keyboard_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
24 |
25 |
33 |
34 |
35 |
39 |
40 |
47 |
48 |
55 |
56 |
57 |
63 |
64 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_other.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
27 |
28 |
34 |
35 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_ratioimageview.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
14 |
19 |
20 |
26 |
27 |
38 |
39 |
42 |
43 |
55 |
56 |
59 |
60 |
70 |
71 |
72 |
73 |
78 |
79 |
84 |
85 |
94 |
95 |
96 |
97 |
102 |
103 |
108 |
109 |
118 |
119 |
120 |
121 |
126 |
127 |
133 |
134 |
143 |
144 |
145 |
146 |
151 |
152 |
158 |
159 |
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_shapeimageview.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
18 |
19 |
23 |
24 |
29 |
30 |
37 |
38 |
47 |
48 |
49 |
63 |
64 |
77 |
78 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/activity_touchgesturedetector.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
21 |
22 |
30 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/dl_added_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/dl_added_plugin_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
26 |
27 |
41 |
42 |
53 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/dl_not_added_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/dl_not_added_plugin_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
20 |
21 |
26 |
27 |
40 |
41 |
42 |
51 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/item_string.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
25 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/register_portrait_female_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
16 |
20 |
21 |
29 |
30 |
33 |
34 |
42 |
43 |
46 |
47 |
55 |
56 |
57 |
58 |
59 |
64 |
65 |
73 |
74 |
77 |
78 |
86 |
87 |
90 |
91 |
99 |
100 |
101 |
102 |
103 |
108 |
109 |
117 |
118 |
121 |
122 |
130 |
131 |
134 |
135 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/register_portrait_male_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
19 |
20 |
28 |
29 |
32 |
33 |
41 |
42 |
45 |
46 |
54 |
55 |
56 |
57 |
58 |
63 |
64 |
72 |
73 |
76 |
77 |
85 |
86 |
89 |
90 |
98 |
99 |
100 |
101 |
102 |
107 |
108 |
116 |
117 |
120 |
121 |
129 |
130 |
133 |
134 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/layout/slot_machine_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
24 |
25 |
30 |
31 |
32 |
38 |
39 |
44 |
45 |
51 |
52 |
53 |
58 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #bbbbbb
5 | #444444
6 |
7 | #454545
8 | #707070
9 |
10 | #00ff00
11 |
12 | #3F51B5
13 | #303F9F
14 | #FF4081
15 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 | 24dp
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AndroidsDemo
5 | Hello world!
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AndroidsDemo/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/AndroidsDemo/src/com/example/androidsdemo/DragListViewDemo.java:
--------------------------------------------------------------------------------
1 | package com.example.androidsdemo;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Rect;
6 | import android.os.Bundle;
7 | import android.view.View;
8 |
9 | import com.example.androidsdemo.adapter.PluginListAdapter;
10 |
11 | import java.util.ArrayList;
12 |
13 | import cn.forward.androids.utils.ViewUtil;
14 | import cn.forward.androids.views.DragListView;
15 |
16 | /**
17 | * 可拖拽的ListView
18 | * Created by huangziwei on 16-6-27.
19 | */
20 | public class DragListViewDemo extends Activity {
21 |
22 | private DragListView mListView;
23 | private PluginListAdapter mAdapter;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_drag_listview);
29 | init();
30 |
31 | mListView.setDragItemListener(new DragListView.SimpleAnimationDragItemListener() {
32 |
33 | private Rect mFrame = new Rect();
34 | private boolean mIsSelected;
35 |
36 | @Override
37 | public boolean canDrag(View dragView, int x, int y) {
38 | // 获取可拖拽的图标
39 | View dragger = dragView.findViewById(R.id.dl_plugin_move);
40 | if (dragger == null || dragger.getVisibility() != View.VISIBLE) {
41 | return false;
42 | }
43 | float tx = x - ViewUtil.getX(dragView);
44 | float ty = y - ViewUtil.getY(dragView);
45 | dragger.getHitRect(mFrame);
46 | if (mFrame.contains((int) tx, (int) ty)) { // 当点击拖拽图标才可进行拖拽
47 | return true;
48 | }
49 | return false;
50 | }
51 |
52 |
53 | @Override
54 | public void beforeDrawingCache(View dragView) {
55 | mIsSelected = dragView.isSelected();
56 | View drag = dragView.findViewById(R.id.dl_plugin_move);
57 | dragView.setSelected(true);
58 | if (drag != null) {
59 | drag.setSelected(true);
60 | }
61 | }
62 |
63 | @Override
64 | public Bitmap afterDrawingCache(View dragView, Bitmap bitmap) {
65 | dragView.setSelected(mIsSelected);
66 | View drag = dragView.findViewById(R.id.dl_plugin_move);
67 | if (drag != null) {
68 | drag.setSelected(false);
69 | }
70 | return bitmap;
71 | }
72 |
73 | @Override
74 | public boolean canExchange(int srcPosition, int position) {
75 | boolean result = mAdapter.exchange(srcPosition, position);
76 | return result;
77 | }
78 | });
79 |
80 | // 模拟数据
81 | ArrayList addedItem = new ArrayList();
82 | ArrayList notAddedItem = new ArrayList();
83 |
84 | for (int i = 0; i < 20; i++) {
85 | addedItem.add(new PluginItem("item:" + i));
86 | }
87 | for (int i = 20; i < 30; i++) {
88 | notAddedItem.add(new PluginItem("item:" + i));
89 | }
90 |
91 | mAdapter = new PluginListAdapter(this, addedItem, notAddedItem, new OnStateBtnClickListener());
92 | mListView.setAdapter(mAdapter);
93 | }
94 |
95 | private void init() {
96 | mListView = (DragListView) findViewById(R.id.draglist);
97 | }
98 |
99 | public static class PluginItem {
100 |
101 | public String mName;
102 |
103 | public PluginItem() {
104 |
105 | }
106 |
107 | public PluginItem(String name) {
108 | mName = name;
109 | }
110 |
111 |
112 | }
113 |
114 | /**
115 | * 点击已添加/未添加按钮
116 | */
117 | public class OnStateBtnClickListener implements View.OnClickListener {
118 |
119 | @Override
120 | public void onClick(final View v) {
121 | PluginItem item = (PluginItem) v.getTag();
122 | if (item == null) {
123 | return;
124 | }
125 | if (mAdapter.isAdded(item)) { // 已添加
126 | mAdapter.removeItem(item);
127 | } else {
128 | mAdapter.addItem(item);
129 | }
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/AndroidsDemo/src/com/example/androidsdemo/EasyAdapterDemo.java:
--------------------------------------------------------------------------------
1 | package com.example.androidsdemo;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Rect;
5 | import android.os.Bundle;
6 | import android.support.v7.widget.GridLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.AdapterView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.Spinner;
13 | import android.widget.TextView;
14 | import android.widget.Toast;
15 |
16 | import java.util.ArrayList;
17 | import java.util.Arrays;
18 | import java.util.List;
19 | import java.util.Set;
20 |
21 | import cn.forward.androids.views.EasyAdapter;
22 | import cn.forward.androids.views.ScrollPickerView;
23 |
24 |
25 | public class EasyAdapterDemo extends Activity {
26 |
27 | private EasyAdapter easyAdapter;
28 | private RecyclerView recyclerView;
29 | private Spinner spinnerMode;
30 |
31 | @Override
32 | public void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_easyadpater);
35 |
36 |
37 | GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
38 | layoutManager.setOrientation(GridLayoutManager.HORIZONTAL);
39 | recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
40 | recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
41 | @Override
42 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
43 | outRect.set(10, 10, 10, 10);
44 | }
45 | });
46 |
47 | recyclerView.setLayoutManager(layoutManager);
48 | final List data = Arrays.asList("篮球", "足球", "羽毛球", "乒乓球", "排球", "橄榄球", "棒球");
49 |
50 | // 创建一个支持多选的适配器
51 | easyAdapter = new EasyAdapter(this, EasyAdapter.Mode.MULTI_SELECT, 0) {
52 | @Override
53 | public MySelectionHolder whenCreateViewHolder(ViewGroup parent, int viewType) {
54 | return new MySelectionHolder(View.inflate(EasyAdapterDemo.this, R.layout.item_string, null));
55 | }
56 |
57 | @Override
58 | public void whenBindViewHolder(MySelectionHolder holder, int position) {
59 | holder.textView.setText(data.get(position));
60 | }
61 |
62 | @Override
63 | public int getItemCount() {
64 | return data.size();
65 | }
66 | };
67 |
68 | // 设置点击监听器
69 | easyAdapter.setOnItemClickedListener(new EasyAdapter.OnItemClickedListener() {
70 | @Override
71 | public void onClicked(int position) {
72 | Toast.makeText(EasyAdapterDemo.this, "clicked:" + position, Toast.LENGTH_SHORT).show();
73 | }
74 | });
75 |
76 | easyAdapter.setOnItemLongClickedListener(new EasyAdapter.OnItemLongClickedListener() {
77 | @Override
78 | public boolean onLongClicked(int position) {
79 | Toast.makeText(EasyAdapterDemo.this, "long clicked:" + position, Toast.LENGTH_SHORT).show();
80 | return true;
81 | }
82 | });
83 |
84 | // 设置单选监听器
85 | easyAdapter.setOnSingleSelectListener(new EasyAdapter.OnSingleSelectListener() {
86 | @Override
87 | public void onSelected(int position) {
88 | Toast.makeText(EasyAdapterDemo.this, "selected:" + position, Toast.LENGTH_SHORT).show();
89 | }
90 | });
91 |
92 | // 设置多选监听器
93 | easyAdapter.setOnMultiSelectListener(new EasyAdapter.OnMultiSelectListener() {
94 | @Override
95 | public void onSelected(int position, boolean isSelected) {
96 | Toast.makeText(EasyAdapterDemo.this, "selected:" + position + " " + isSelected, Toast.LENGTH_SHORT).show();
97 |
98 | }
99 |
100 | @Override
101 | public void onSelected(EasyAdapter.SelectionMode selectionMode, Set selectedSet) {
102 | switch (selectionMode) {
103 | case SELECT_ALL:
104 | Toast.makeText(EasyAdapterDemo.this, "select all:" + selectedSet, Toast.LENGTH_SHORT).show();
105 | break;
106 |
107 | case UNSELECT_ALL:
108 | Toast.makeText(EasyAdapterDemo.this, "unselect all:" + selectedSet, Toast.LENGTH_SHORT).show();
109 | break;
110 |
111 | case REVERSE_SELECTED:
112 | Toast.makeText(EasyAdapterDemo.this, "reverse selected:" + selectedSet, Toast.LENGTH_SHORT).show();
113 | break;
114 | }
115 | }
116 |
117 | @Override
118 | public void onOutOfMax(int position) {
119 | Toast.makeText(EasyAdapterDemo.this,
120 | "select:" + position + " onOutOfMax:" + easyAdapter.getMaxSelectionCount(), Toast.LENGTH_SHORT).
121 | show();
122 |
123 | }
124 | });
125 |
126 | recyclerView.setAdapter(easyAdapter);
127 |
128 |
129 | ArrayList dataList = new ArrayList();
130 | dataList.add("点击模式");
131 | dataList.add("单选模式");
132 | dataList.add("多选模式");
133 |
134 | ArrayAdapter spinnerAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, dataList);
135 | spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
136 | spinnerMode = (Spinner) findViewById(R.id.spinnerMode);
137 | spinnerMode.setAdapter(spinnerAdapter);
138 | spinnerMode.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
139 | @Override
140 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
141 | findViewById(R.id.panelMultiSel).setVisibility(View.GONE);
142 | switch (position) { // 设置模式
143 | case 0:
144 | easyAdapter.setMode(EasyAdapter.Mode.CLICK);
145 | break;
146 | case 1:
147 | easyAdapter.setMode(EasyAdapter.Mode.SINGLE_SELECT);
148 | break;
149 | case 2:
150 | easyAdapter.setMode(EasyAdapter.Mode.MULTI_SELECT);
151 | findViewById(R.id.panelMultiSel).setVisibility(View.VISIBLE);
152 | break;
153 | }
154 | }
155 |
156 | @Override
157 | public void onNothingSelected(AdapterView> parent) {
158 |
159 | }
160 | });
161 |
162 | spinnerMode.setSelection(2);
163 |
164 | ScrollPickerView pickerMaxSelect = (ScrollPickerView) findViewById(R.id.pickerMaxSelect);
165 | // 设置最大可选数量
166 | pickerMaxSelect.setOnSelectedListener(new ScrollPickerView.OnSelectedListener() {
167 | @Override
168 | public void onSelected(ScrollPickerView scrollPickerView, int position) {
169 | easyAdapter.setMaxSelectionCount(position);
170 | }
171 | });
172 | pickerMaxSelect.setData(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7"));
173 | pickerMaxSelect.setSelectedPosition(0);
174 |
175 | }
176 |
177 | public void selectAll(View view) {
178 | easyAdapter.selectAll();
179 | }
180 |
181 | public void reverseSelectAll(View view) {
182 | easyAdapter.reverseSelected();
183 | }
184 | }
185 |
186 | class MySelectionHolder extends RecyclerView.ViewHolder {
187 | TextView textView;
188 |
189 | public MySelectionHolder(View itemView) {
190 | super(itemView);
191 | textView = (TextView) itemView.findViewById(R.id.textview);
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/AndroidsDemo/src/com/example/androidsdemo/EllipsizeUtilsDemo.java:
--------------------------------------------------------------------------------
1 | package com.example.androidsdemo;
2 |
3 | import android.app.Activity;
4 | import android.app.AlertDialog;
5 | import android.content.DialogInterface;
6 | import android.graphics.Color;
7 | import android.os.Bundle;
8 | import android.support.annotation.Nullable;
9 | import android.text.Editable;
10 | import android.text.TextUtils;
11 | import android.text.TextWatcher;
12 | import android.view.View;
13 | import android.widget.EditText;
14 | import android.widget.TextView;
15 |
16 | import cn.forward.androids.utils.EllipsizeUtils;
17 |
18 | /**
19 | * @author ziwei huang
20 | */
21 | public class EllipsizeUtilsDemo extends Activity {
22 |
23 | private EditText mEditText;
24 | private TextView mOrigin;
25 | private TextView mSearchResult;
26 | private TextView mSearchResult2;
27 | private TextView mSearchResult3;
28 | private TextView mMaxLineView;
29 |
30 | private TextView mEllipsizeStart, mEllipsizeMiddle, mEllipsizeEnd;
31 |
32 | private static final String TEXT = "“I want to, very much,” the little prince replied. “But I have not much time. I have friends to discover, and a great many things to understand.”" +
33 | "“我非常想,”小王子回答道,“但是我没有太多时间,我要去找我的朋友,还有很多事情要弄明白。”";
34 |
35 | @Override
36 | protected void onCreate(@Nullable Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.activity_ellipise_demo);
39 | setTitle("EllipsizeUtils");
40 |
41 | mEditText = findViewById(R.id.edit_text);
42 | mOrigin = findViewById(R.id.text);
43 | mSearchResult = findViewById(R.id.search_result);
44 | mSearchResult2 = findViewById(R.id.search_result2);
45 | mSearchResult3 = findViewById(R.id.search_result3);
46 | mMaxLineView = findViewById(R.id.max_line);
47 | mEllipsizeStart = findViewById(R.id.ellipsize_start);
48 | mEllipsizeMiddle = findViewById(R.id.ellipsize_middle);
49 | mEllipsizeEnd = findViewById(R.id.ellipsize_end);
50 | mEllipsizeStart.setEllipsize(TextUtils.TruncateAt.START);
51 | mEllipsizeMiddle.setEllipsize(TextUtils.TruncateAt.MIDDLE);
52 | mEllipsizeEnd.setEllipsize(TextUtils.TruncateAt.END);
53 |
54 | mEllipsizeStart.setText(TEXT);
55 | mEllipsizeMiddle.setText(TEXT);
56 | mEllipsizeEnd.setText(TEXT);
57 |
58 | mMaxLineView.setOnClickListener(new View.OnClickListener() {
59 | @Override
60 | public void onClick(View v) {
61 | final String[] items = new String[]{"1", "2", "3", "4", "不限"};
62 | new AlertDialog.Builder(EllipsizeUtilsDemo.this)
63 | .setTitle("Max line")
64 | .setItems(items, new DialogInterface.OnClickListener() {
65 | @Override
66 | public void onClick(DialogInterface dialog, int which) {
67 | boolean isSingleLine = (which == 0);
68 | int max = 1;
69 | if (which == items.length - 1) {
70 | max = Integer.MAX_VALUE;
71 | } else {
72 | max = which + 1;
73 | }
74 | mSearchResult.setSingleLine(isSingleLine);
75 | mSearchResult.setMaxLines(max);
76 | mSearchResult2.setSingleLine(isSingleLine);
77 | mSearchResult2.setMaxLines(max);
78 | mSearchResult3.setSingleLine(isSingleLine);
79 | mSearchResult3.setMaxLines(max);
80 |
81 | mEllipsizeStart.setSingleLine(isSingleLine);
82 | mEllipsizeStart.setMaxLines(max);
83 | mEllipsizeMiddle.setSingleLine(isSingleLine);
84 | mEllipsizeMiddle.setMaxLines(max);
85 | mEllipsizeEnd.setSingleLine(isSingleLine);
86 | mEllipsizeEnd.setMaxLines(max);
87 |
88 | mMaxLineView.setText("Max Line=" + items[which]);
89 | mEditText.setText(mEditText.getText());
90 | mEditText.setSelection(mEditText.getText().toString().length());
91 | }
92 | }).create().show();
93 | }
94 | });
95 |
96 | mOrigin.setText(TEXT);
97 |
98 | mEditText.addTextChangedListener(new TextWatcher() {
99 | @Override
100 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
101 |
102 | }
103 |
104 | @Override
105 | public void onTextChanged(CharSequence s, int start, int before, int count) {
106 | EllipsizeUtils.ellipsizeAndHighlight(mSearchResult, TEXT, s.toString(),
107 | Color.RED, true, true);
108 |
109 | EllipsizeUtils.ellipsizeAndHighlight(mSearchResult2, TEXT, s.toString(),
110 | Color.RED, false, true);
111 |
112 | EllipsizeUtils.ellipsizeAndHighlight(mSearchResult3, TEXT, s.toString(),
113 | Color.RED, false, false);
114 |
115 | EllipsizeUtils.ellipsize(mEllipsizeStart, TEXT);
116 | EllipsizeUtils.ellipsize(mEllipsizeMiddle, TEXT);
117 | EllipsizeUtils.ellipsize(mEllipsizeEnd, TEXT);
118 | }
119 |
120 | @Override
121 | public void afterTextChanged(Editable s) {
122 |
123 | }
124 | });
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/AndroidsDemo/src/com/example/androidsdemo/KeyboardLayoutDemo.java:
--------------------------------------------------------------------------------
1 | package com.example.androidsdemo;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.WindowManager;
9 | import android.view.inputmethod.InputMethodManager;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 |
13 | import cn.forward.androids.views.KeyboardLayout;
14 |
15 | /**
16 | * Created by huangziwei on 16-6-27.
17 | */
18 | public class KeyboardLayoutDemo extends Activity {
19 | private KeyboardLayout mKeyboardLayout;
20 | private View mEmojiView;
21 | private Button mEmojiBtn;
22 | private EditText mInput;
23 |
24 | int mKeyboardHeight = 400; // 输入法默认高度为400
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_keyboard_layout);
30 |
31 | // 起初的布局可自动调整大小
32 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
33 |
34 | mKeyboardLayout = (KeyboardLayout) findViewById(R.id.keyboard_layout);
35 | mEmojiView = findViewById(R.id.emoji);
36 | mEmojiBtn = (Button) findViewById(R.id.emoji_btn);
37 |
38 | mInput = (EditText) findViewById(R.id.input);
39 |
40 | // 点击输入框
41 | mInput.setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View v) {
44 | mKeyboardLayout.postDelayed(new Runnable() {
45 | @Override
46 | public void run() { // 输入法弹出之后,重新调整
47 | mEmojiBtn.setSelected(false);
48 | mEmojiView.setVisibility(View.GONE);
49 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
50 | }
51 | }, 250); // 延迟一段时间,等待输入法完全弹出
52 | }
53 | });
54 |
55 | mEmojiBtn.setOnClickListener(new View.OnClickListener() {
56 | @Override
57 | public void onClick(View v) {
58 | mEmojiBtn.setSelected(!mEmojiBtn.isSelected());
59 |
60 | if (mKeyboardLayout.isKeyboardActive()) { // 输入法打开状态下
61 | if (mEmojiBtn.isSelected()) { // 打开表情
62 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); // 不改变布局,隐藏键盘,emojiView弹出
63 | InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
64 | imm.hideSoftInputFromWindow(mInput.getApplicationWindowToken(), 0);
65 | mEmojiView.setVisibility(View.VISIBLE);
66 | } else {
67 | mEmojiView.setVisibility(View.GONE);
68 | InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
69 | imm.hideSoftInputFromWindow(mInput.getApplicationWindowToken(), 0);
70 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
71 | }
72 | } else { // 输入法关闭状态下
73 | if (mEmojiBtn.isSelected()) {
74 | // 设置为不会调整大小,以便输入弹起时布局不会改变。若不设置此属性,输入法弹起时布局会闪一下
75 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
76 | mEmojiView.setVisibility(View.VISIBLE);
77 | } else {
78 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
79 | mEmojiView.setVisibility(View.GONE);
80 | }
81 | }
82 | }
83 | });
84 |
85 | mKeyboardLayout.setKeyboardListener(new KeyboardLayout.KeyboardLayoutListener() {
86 | @Override
87 | public void onKeyboardStateChanged(boolean isActive, int keyboardHeight) {
88 |
89 | if (isActive) { // 输入法打开
90 | if (mKeyboardHeight != keyboardHeight) { // 键盘发生改变时才设置emojiView的高度,因为会触发onGlobalLayoutChanged,导致onKeyboardStateChanged再次被调用
91 | mKeyboardHeight = keyboardHeight;
92 | initEmojiView(); // 每次输入法弹起时,设置emojiView的高度为键盘的高度,以便下次emojiView弹出时刚好等于键盘高度
93 | }
94 | if (mEmojiBtn.isSelected()) { // 表情打开状态下
95 | mEmojiView.setVisibility(View.GONE);
96 | mEmojiBtn.setSelected(false);
97 | }
98 | }
99 | }
100 | });
101 | }
102 |
103 | // 设置表情栏的高度
104 | private void initEmojiView() {
105 | ViewGroup.LayoutParams layoutParams = mEmojiView.getLayoutParams();
106 | layoutParams.height = mKeyboardHeight;
107 | mEmojiView.setLayoutParams(layoutParams);
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/AndroidsDemo/src/com/example/androidsdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.androidsdemo;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import android.app.ListActivity;
9 | import android.content.Intent;
10 | import android.os.Bundle;
11 | import android.view.View;
12 | import android.widget.ListView;
13 | import android.widget.SimpleAdapter;
14 |
15 | /**
16 | * @author huangziwei
17 | */
18 | public class MainActivity extends ListActivity {
19 |
20 | public static final String TITLE = "title";
21 | public static final String SUBTITLE = "subtitle";
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 |
27 | setListAdapter(new SimpleAdapter(this, createData(),
28 | android.R.layout.simple_list_item_2, new String[]{TITLE,
29 | SUBTITLE}, new int[]{android.R.id.text1,
30 | android.R.id.text2}));
31 | }
32 |
33 | @Override
34 | protected void onListItemClick(ListView l, View v, int position, long id) {
35 | if (position == 0) {
36 | startActivity(new Intent(getApplicationContext(),
37 | ShapeImageViewDemo.class));
38 | } else if (position == 1) {
39 | startActivity(new Intent(getApplicationContext(),
40 | MaskImageViewDemo.class));
41 | } else if (position == 2) {
42 | startActivity(new Intent(getApplicationContext(),
43 | RatioImageViewDemo.class));
44 | } else if (position == 3) {
45 | startActivity(new Intent(getApplicationContext(),
46 | ScrollPickerViewDemo.class));
47 | } else if (position == 4) {
48 | startActivity(new Intent(getApplicationContext(),
49 | KeyboardLayoutDemo.class));
50 | } else if (position == 5) {
51 | startActivity(new Intent(getApplicationContext(),
52 | DragListViewDemo.class));
53 | } else if (position == 6) {
54 | startActivity(new Intent(getApplicationContext(),
55 | EasyAdapterDemo.class));
56 | } else if (position == 7) {
57 | startActivity(new Intent(getApplicationContext(),
58 | TouchGestureDetectorDemo.class));
59 | } else if (position == 8) {
60 | startActivity(new Intent(getApplicationContext(),
61 | EllipsizeUtilsDemo.class));
62 | } else {
63 | startActivity(new Intent(getApplicationContext(),
64 | AnimatorUtilDemo.class));
65 | }
66 | }
67 |
68 | private List