├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── luck
│ │ └── custom
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── luck
│ │ │ └── custom
│ │ │ ├── MainActivity.java
│ │ │ ├── dialog
│ │ │ ├── Indeterminate.java
│ │ │ ├── OptAnimationLoader.java
│ │ │ ├── SpinView.java
│ │ │ ├── SuccessTickView.java
│ │ │ └── SweetAlertDialog.java
│ │ │ └── toast
│ │ │ ├── T.java
│ │ │ ├── TPrompt.java
│ │ │ ├── TPromptError.java
│ │ │ └── TPromptSuccess.java
│ └── res
│ │ ├── anim
│ │ ├── modal_in.xml
│ │ └── modal_out.xml
│ │ ├── drawable
│ │ ├── book_reading_toast_bg.xml
│ │ └── dialog_custom_bg.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── alert_dialog.xml
│ │ ├── book_reading_seekbar_toast.xml
│ │ ├── book_reading_toast.xml
│ │ └── book_reading_toast_error.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── jg_hud_error_3x.png
│ │ ├── kprogresshud_spinner.png
│ │ └── success_1x.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── luck
│ └── custom
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshot
├── image1.jpg
├── image2.jpg
├── image3.jpg
└── image4.jpg
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | CustomView
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | Android
46 |
47 |
48 | Android > Lint > Correctness
49 |
50 |
51 | Android > Lint > Performance
52 |
53 |
54 | C/C++
55 |
56 |
57 | Class structureJava
58 |
59 |
60 | Control flow issuesJava
61 |
62 |
63 | CorrectnessLintAndroid
64 |
65 |
66 | Error handlingJava
67 |
68 |
69 | General
70 |
71 |
72 | Groovy
73 |
74 |
75 | HTML
76 |
77 |
78 | ImportsJava
79 |
80 |
81 | Internationalization issues
82 |
83 |
84 | Internationalization issuesJava
85 |
86 |
87 | J2ME issuesJava
88 |
89 |
90 | JSON
91 |
92 |
93 | Java
94 |
95 |
96 | Javadoc issuesJava
97 |
98 |
99 | LintAndroid
100 |
101 |
102 | Manifest
103 |
104 |
105 | OtherGroovy
106 |
107 |
108 | Portability issuesJava
109 |
110 |
111 | Potentially confusing code constructsGroovy
112 |
113 |
114 | Probable bugsJava
115 |
116 |
117 | Properties Files
118 |
119 |
120 | Properties FilesJava
121 |
122 |
123 | RELAX NG
124 |
125 |
126 | Resource management issuesJava
127 |
128 |
129 | Threading issuesJava
130 |
131 |
132 | Unused codeC/C++
133 |
134 |
135 | Validity issuesGroovy
136 |
137 |
138 | XML
139 |
140 |
141 |
142 |
143 | Android
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 | $USER_HOME$/.subversion
167 |
168 |
169 |
170 |
171 |
172 | 1.6
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CustomView
2 | android仿ios弹框效果
3 | 
4 | 
5 | 
6 | 
7 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "com.luck.custom"
9 | minSdkVersion 16
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.4.0'
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/luck/Documents/android-sdk-macosx-2/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/luck/custom/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom;
2 |
3 | import android.os.Handler;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 | import com.luck.custom.dialog.SweetAlertDialog;
9 | import com.luck.custom.toast.T;
10 |
11 | public class MainActivity extends AppCompatActivity {
12 |
13 | private Handler handler = new Handler();
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 | findViewById(R.id.btn_ios_dialog).setOnClickListener(new View.OnClickListener() {
20 | @Override
21 | public void onClick(View view) {
22 | final SweetAlertDialog dialog = new SweetAlertDialog(MainActivity.this);
23 | dialog.setTitleText("请稍候...");
24 | dialog.show();
25 |
26 | handler.postDelayed(new Runnable() {
27 | @Override
28 | public void run() {
29 | dialog.cancel();
30 | }
31 | }, 2000);
32 | }
33 | });
34 |
35 | findViewById(R.id.btn_ios_toast).setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View view) {
38 | T.showAnimToast(MainActivity.this, "恭喜您,注册成功了!");
39 | }
40 | });
41 |
42 | findViewById(R.id.btn_ios_toast_success).setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View view) {
45 | T.showAnimSuccessToast(MainActivity.this, "保存成功");
46 | }
47 | });
48 |
49 | findViewById(R.id.btn_ios_toast_error).setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View view) {
52 | T.showAnimErrorToast(MainActivity.this, "修改失败");
53 | }
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/dialog/Indeterminate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Kaopiz Software Co., Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.luck.custom.dialog;
18 |
19 | /**
20 | * If a view implements this interface passed to the HUD as a custom view, its animation
21 | * speed can be change by calling setAnimationSpeed() on the HUD.
22 | * This interface only provides convenience, how animation speed work depends on the view implementation.
23 | */
24 | public interface Indeterminate {
25 | void setAnimationSpeed(float scale);
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/dialog/OptAnimationLoader.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.dialog;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.XmlResourceParser;
6 | import android.util.AttributeSet;
7 | import android.util.Xml;
8 | import android.view.animation.AlphaAnimation;
9 | import android.view.animation.Animation;
10 | import android.view.animation.AnimationSet;
11 | import android.view.animation.RotateAnimation;
12 | import android.view.animation.ScaleAnimation;
13 | import android.view.animation.TranslateAnimation;
14 |
15 | import org.xmlpull.v1.XmlPullParser;
16 | import org.xmlpull.v1.XmlPullParserException;
17 |
18 | import java.io.IOException;
19 |
20 | public class OptAnimationLoader {
21 |
22 | public static Animation loadAnimation(Context context, int id)
23 | throws Resources.NotFoundException {
24 |
25 | XmlResourceParser parser = null;
26 | try {
27 | parser = context.getResources().getAnimation(id);
28 | return createAnimationFromXml(context, parser);
29 | } catch (XmlPullParserException ex) {
30 | Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" +
31 | Integer.toHexString(id));
32 | rnf.initCause(ex);
33 | throw rnf;
34 | } catch (IOException ex) {
35 | Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" +
36 | Integer.toHexString(id));
37 | rnf.initCause(ex);
38 | throw rnf;
39 | } finally {
40 | if (parser != null) parser.close();
41 | }
42 | }
43 |
44 | private static Animation createAnimationFromXml(Context c, XmlPullParser parser)
45 | throws XmlPullParserException, IOException {
46 |
47 | return createAnimationFromXml(c, parser, null, Xml.asAttributeSet(parser));
48 | }
49 |
50 | private static Animation createAnimationFromXml(Context c, XmlPullParser parser,
51 | AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {
52 |
53 | Animation anim = null;
54 |
55 | // Make sure we are on a start tag.
56 | int type;
57 | int depth = parser.getDepth();
58 |
59 | while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
60 | && type != XmlPullParser.END_DOCUMENT) {
61 |
62 | if (type != XmlPullParser.START_TAG) {
63 | continue;
64 | }
65 |
66 | String name = parser.getName();
67 |
68 | if (name.equals("set")) {
69 | anim = new AnimationSet(c, attrs);
70 | createAnimationFromXml(c, parser, (AnimationSet)anim, attrs);
71 | } else if (name.equals("alpha")) {
72 | anim = new AlphaAnimation(c, attrs);
73 | } else if (name.equals("scale")) {
74 | anim = new ScaleAnimation(c, attrs);
75 | } else if (name.equals("rotate")) {
76 | anim = new RotateAnimation(c, attrs);
77 | } else if (name.equals("translate")) {
78 | anim = new TranslateAnimation(c, attrs);
79 | } else {
80 | try {
81 | anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
82 | } catch (Exception te) {
83 | throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
84 | }
85 | }
86 |
87 | if (parent != null) {
88 | parent.addAnimation(anim);
89 | }
90 | }
91 |
92 | return anim;
93 |
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/dialog/SpinView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Kaopiz Software Co., Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.luck.custom.dialog;
18 |
19 | import android.content.Context;
20 | import android.graphics.Canvas;
21 | import android.util.AttributeSet;
22 | import android.widget.ImageView;
23 |
24 | import com.luck.custom.R;
25 |
26 | class SpinView extends ImageView implements Indeterminate {
27 |
28 | private float mRotateDegrees;
29 | private int mFrameTime;
30 | private boolean mNeedToUpdateView;
31 | private Runnable mUpdateViewRunnable;
32 |
33 | public SpinView(Context context) {
34 | super(context);
35 | init();
36 | }
37 |
38 | public SpinView(Context context, AttributeSet attrs) {
39 | super(context, attrs);
40 | init();
41 | }
42 |
43 | private void init() {
44 | setImageResource(R.mipmap.kprogresshud_spinner);
45 | mFrameTime = 1000 / 12;
46 | mUpdateViewRunnable = new Runnable() {
47 | @Override
48 | public void run() {
49 | mRotateDegrees += 30;
50 | mRotateDegrees = mRotateDegrees < 360 ? mRotateDegrees : mRotateDegrees - 360;
51 | invalidate();
52 | if (mNeedToUpdateView) {
53 | postDelayed(this, mFrameTime);
54 | }
55 | }
56 | };
57 | }
58 |
59 | @Override
60 | public void setAnimationSpeed(float scale) {
61 | mFrameTime = (int) (1000 / 12 / scale);
62 | }
63 |
64 | @Override
65 | protected void onDraw(Canvas canvas) {
66 | canvas.rotate(mRotateDegrees, getWidth() / 2, getHeight() / 2);
67 | super.onDraw(canvas);
68 | }
69 |
70 | @Override
71 | protected void onAttachedToWindow() {
72 | super.onAttachedToWindow();
73 | mNeedToUpdateView = true;
74 | post(mUpdateViewRunnable);
75 | }
76 |
77 | @Override
78 | protected void onDetachedFromWindow() {
79 | mNeedToUpdateView = false;
80 | super.onDetachedFromWindow();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/dialog/SuccessTickView.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.dialog;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.RectF;
7 | import android.support.v4.content.ContextCompat;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 | import android.view.animation.Animation;
11 | import android.view.animation.Transformation;
12 |
13 | import com.luck.custom.R;
14 |
15 | public class SuccessTickView extends View {
16 | private float mDensity = -1;
17 | private Paint mPaint;
18 | private final float CONST_RADIUS = dip2px(1.2f);
19 | private final float CONST_RECT_WEIGHT = dip2px(3);
20 | private final float CONST_LEFT_RECT_W = dip2px(15);
21 | private final float CONST_RIGHT_RECT_W = dip2px(25);
22 | private final float MIN_LEFT_RECT_W = dip2px(3.3f);
23 | private final float MAX_RIGHT_RECT_W = CONST_RIGHT_RECT_W + dip2px(6.7f);
24 | private Context context;
25 | private float mMaxLeftRectWidth;
26 | private float mLeftRectWidth;
27 | private float mRightRectWidth;
28 | private boolean mLeftRectGrowMode;
29 |
30 | public SuccessTickView(Context context) {
31 | super(context);
32 | this.context = context;
33 | init();
34 | }
35 |
36 | public SuccessTickView(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | this.context = context;
39 | init();
40 | }
41 |
42 | private void init() {
43 | mPaint = new Paint();
44 | mPaint.setColor(ContextCompat.getColor(context, R.color.success_stroke_color));
45 | mLeftRectWidth = CONST_LEFT_RECT_W;
46 | mRightRectWidth = CONST_RIGHT_RECT_W;
47 | mLeftRectGrowMode = false;
48 | }
49 |
50 | @Override
51 | public void draw(Canvas canvas) {
52 | super.draw(canvas);
53 | int totalW = getWidth();
54 | int totalH = getHeight();
55 | // rotate canvas first
56 | canvas.rotate(45, totalW / 2, totalH / 2);
57 |
58 | totalW /= 1.2;
59 | totalH /= 1.4;
60 | mMaxLeftRectWidth = (totalW + CONST_LEFT_RECT_W) / 2 + CONST_RECT_WEIGHT - 1;
61 |
62 | RectF leftRect = new RectF();
63 | if (mLeftRectGrowMode) {
64 | leftRect.left = 0;
65 | leftRect.right = leftRect.left + mLeftRectWidth;
66 | leftRect.top = (totalH + CONST_RIGHT_RECT_W) / 2;
67 | leftRect.bottom = leftRect.top + CONST_RECT_WEIGHT;
68 | } else {
69 | leftRect.right = (totalW + CONST_LEFT_RECT_W) / 2 + CONST_RECT_WEIGHT - 1;
70 | leftRect.left = leftRect.right - mLeftRectWidth;
71 | leftRect.top = (totalH + CONST_RIGHT_RECT_W) / 2;
72 | leftRect.bottom = leftRect.top + CONST_RECT_WEIGHT;
73 | }
74 |
75 | canvas.drawRoundRect(leftRect, CONST_RADIUS, CONST_RADIUS, mPaint);
76 |
77 | RectF rightRect = new RectF();
78 | rightRect.bottom = (totalH + CONST_RIGHT_RECT_W) / 2 + CONST_RECT_WEIGHT - 1;
79 | rightRect.left = (totalW + CONST_LEFT_RECT_W) / 2;
80 | rightRect.right = rightRect.left + CONST_RECT_WEIGHT;
81 | rightRect.top = rightRect.bottom - mRightRectWidth;
82 | canvas.drawRoundRect(rightRect, CONST_RADIUS, CONST_RADIUS, mPaint);
83 | }
84 |
85 | public float dip2px(float dpValue) {
86 | if (mDensity == -1) {
87 | mDensity = getResources().getDisplayMetrics().density;
88 | }
89 | return dpValue * mDensity + 0.5f;
90 | }
91 |
92 | public void startTickAnim() {
93 | // hide tick
94 | mLeftRectWidth = 0;
95 | mRightRectWidth = 0;
96 | invalidate();
97 | Animation tickAnim = new Animation() {
98 | @Override
99 | protected void applyTransformation(float interpolatedTime, Transformation t) {
100 | super.applyTransformation(interpolatedTime, t);
101 | if (0.54 < interpolatedTime && 0.7 >= interpolatedTime) { // grow left and right rect to right
102 | mLeftRectGrowMode = true;
103 | mLeftRectWidth = mMaxLeftRectWidth * ((interpolatedTime - 0.54f) / 0.16f);
104 | if (0.65 < interpolatedTime) {
105 | mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
106 | }
107 | invalidate();
108 | } else if (0.7 < interpolatedTime && 0.84 >= interpolatedTime) { // shorten left rect from right, still grow right rect
109 | mLeftRectGrowMode = false;
110 | mLeftRectWidth = mMaxLeftRectWidth * (1 - ((interpolatedTime - 0.7f) / 0.14f));
111 | mLeftRectWidth = mLeftRectWidth < MIN_LEFT_RECT_W ? MIN_LEFT_RECT_W : mLeftRectWidth;
112 | mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
113 | invalidate();
114 | } else if (0.84 < interpolatedTime && 1 >= interpolatedTime) { // restore left rect width, shorten right rect to const
115 | mLeftRectGrowMode = false;
116 | mLeftRectWidth = MIN_LEFT_RECT_W + (CONST_LEFT_RECT_W - MIN_LEFT_RECT_W) * ((interpolatedTime - 0.84f) / 0.16f);
117 | mRightRectWidth = CONST_RIGHT_RECT_W + (MAX_RIGHT_RECT_W - CONST_RIGHT_RECT_W) * (1 - ((interpolatedTime - 0.84f) / 0.16f));
118 | invalidate();
119 | }
120 | }
121 | };
122 | tickAnim.setDuration(750);
123 | tickAnim.setStartOffset(100);
124 | startAnimation(tickAnim);
125 | }
126 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/dialog/SweetAlertDialog.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.dialog;
2 |
3 |
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 | import android.view.animation.Animation;
10 | import android.view.animation.AnimationSet;
11 | import android.view.animation.Transformation;
12 | import android.widget.TextView;
13 |
14 | import com.luck.custom.R;
15 |
16 | public class SweetAlertDialog extends Dialog {
17 | private View mDialogView;
18 | private AnimationSet mModalInAnim;
19 | private AnimationSet mModalOutAnim;
20 | private Animation mOverlayOutAnim;
21 | private TextView mTitleTextView;
22 | private String mTitleText;
23 | private boolean mCloseFromCancel;
24 | public Context context;
25 |
26 | public SweetAlertDialog(Context context) {
27 | super(context, R.style.alert_dialog);
28 | this.context = context;
29 | setCancelable(true);
30 | setCanceledOnTouchOutside(false);
31 | mModalInAnim = (AnimationSet) OptAnimationLoader.loadAnimation(getContext(), R.anim.modal_in);
32 | mModalOutAnim = (AnimationSet) OptAnimationLoader.loadAnimation(getContext(), R.anim.modal_out);
33 | mModalOutAnim.setAnimationListener(new Animation.AnimationListener() {
34 | @Override
35 | public void onAnimationStart(Animation animation) {
36 |
37 | }
38 |
39 | @Override
40 | public void onAnimationEnd(Animation animation) {
41 | mDialogView.setVisibility(View.INVISIBLE);
42 | mDialogView.post(new Runnable() {
43 | @Override
44 | public void run() {
45 | if (mCloseFromCancel) {
46 | SweetAlertDialog.super.cancel();
47 | } else {
48 | SweetAlertDialog.super.dismiss();
49 | }
50 | }
51 | });
52 | }
53 |
54 | @Override
55 | public void onAnimationRepeat(Animation animation) {
56 |
57 | }
58 | });
59 | // dialog overlay fade out
60 | mOverlayOutAnim = new Animation() {
61 | @Override
62 | protected void applyTransformation(float interpolatedTime, Transformation t) {
63 | WindowManager.LayoutParams wlp = getWindow().getAttributes();
64 | wlp.alpha = 1 - interpolatedTime;
65 | getWindow().setAttributes(wlp);
66 | }
67 | };
68 | mOverlayOutAnim.setDuration(120);
69 | }
70 |
71 |
72 | protected void onCreate(Bundle savedInstanceState) {
73 | super.onCreate(savedInstanceState);
74 | setContentView(R.layout.alert_dialog);
75 |
76 | mDialogView = getWindow().getDecorView().findViewById(android.R.id.content);
77 | mTitleTextView = (TextView) findViewById(R.id.title_text);
78 | setTitleText(mTitleText);
79 | }
80 |
81 | public String getTitleText() {
82 | return mTitleText;
83 | }
84 |
85 | public SweetAlertDialog setTitleText(String text) {
86 | mTitleText = text;
87 | if (mTitleTextView != null && mTitleText != null) {
88 | mTitleTextView.setText(mTitleText);
89 | }
90 | return this;
91 | }
92 |
93 |
94 | protected void onStart() {
95 | mDialogView.startAnimation(mModalInAnim);
96 | }
97 |
98 | /**
99 | * The real Dialog.cancel() will be invoked async-ly after the animation finishes.
100 | */
101 | @Override
102 | public void cancel() {
103 | dismissWithAnimation(true);
104 | }
105 |
106 | /**
107 | * The real Dialog.dismiss() will be invoked async-ly after the animation finishes.
108 | */
109 | public void dismissWithAnimation() {
110 | dismissWithAnimation(false);
111 | }
112 |
113 | private void dismissWithAnimation(boolean fromCancel) {
114 | mCloseFromCancel = fromCancel;
115 | mDialogView.startAnimation(mModalOutAnim);
116 | }
117 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/toast/T.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.toast;
2 |
3 | import android.content.Context;
4 | import android.widget.Toast;
5 |
6 | /**
7 | * @author lmw
8 | * @ClassName: T
9 | * @Description: TODO(这里用一句话描述这个类的作用)
10 | * @date 2015年3月28日 下午5:34:58
11 | */
12 | public class T {
13 | public static TPrompt tPrompt;
14 | public static TPromptSuccess tPromptSuccess;
15 | public static TPromptError tPromptError;
16 |
17 | public static void showToast(Context context, String msg) {
18 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
19 | }
20 |
21 | public static void showAnimToast(Context mContext, String msg) {
22 | if (!isFastDoubleClick()) {
23 | if (tPrompt == null) {
24 | tPrompt = new TPrompt(mContext);
25 | }
26 | tPrompt.showToast(msg);
27 | }
28 | }
29 |
30 | public static void showAnimSuccessToast(Context mContext, String msg) {
31 | if (!isFastDoubleClick()) {
32 | if (tPromptSuccess == null) {
33 | tPromptSuccess = new TPromptSuccess(mContext);
34 | }
35 | tPromptSuccess.showToast(msg);
36 | }
37 | }
38 |
39 | public static void showAnimErrorToast(Context mContext, String msg) {
40 | if (!isFastDoubleClick()) {
41 | if (tPromptError == null) {
42 | tPromptError = new TPromptError(mContext);
43 | }
44 | tPromptError.showToast(msg);
45 | }
46 | }
47 |
48 | protected static long lastClickTime;
49 |
50 | protected static boolean isFastDoubleClick() {
51 | long time = System.currentTimeMillis();
52 | if (time - lastClickTime < 500) {
53 | return true;
54 | }
55 | lastClickTime = time;
56 | return false;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/toast/TPrompt.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.toast;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.view.Gravity;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.animation.AnimationSet;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.luck.custom.R;
14 | import com.luck.custom.dialog.OptAnimationLoader;
15 |
16 | /**
17 | * author:luck
18 | * project:EasyFoodBatch
19 | * package:com.luck.easyfoodbatch.util
20 | * email:893855882@qq.com
21 | * data:16/12/16
22 | */
23 | public class TPrompt extends Toast {
24 | private Context mContext;
25 | private AnimationSet mModalInAnim;
26 | private AnimationSet mModalOutAnim;
27 | private TextView chapterNameTV;
28 | private RelativeLayout rl_root;
29 | private Handler handler = new Handler();
30 |
31 | public TPrompt(Context context) {
32 | super(context);
33 | this.mContext = context;
34 | mModalInAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_in);
35 | mModalOutAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_out);
36 | initView();
37 | }
38 |
39 | protected void initView() {
40 | LayoutInflater inflater = LayoutInflater.from(mContext);
41 | View view = inflater.inflate(R.layout.book_reading_toast, null);
42 | rl_root = (RelativeLayout) view.findViewById(R.id.rl_root);
43 | chapterNameTV = (TextView) view.findViewById(R.id.chapterName);
44 | setGravity(Gravity.CENTER, 0, 0);
45 | setDuration(Toast.LENGTH_LONG);
46 | setView(view);
47 | }
48 |
49 | /**
50 | * 文字提示
51 | *
52 | * @param msg
53 | */
54 | public void showToast(String msg) {
55 | if (chapterNameTV != null) {
56 | show();
57 | chapterNameTV.setText(msg);
58 | mModalInAnim.setDuration(250);
59 | rl_root.setVisibility(View.VISIBLE);
60 | rl_root.startAnimation(mModalInAnim);
61 | handler.postDelayed(new Runnable() {
62 | @Override
63 | public void run() {
64 | rl_root.setVisibility(View.INVISIBLE);
65 | rl_root.startAnimation(mModalOutAnim);
66 | }
67 | }, 1000);
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/toast/TPromptError.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.toast;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.view.Gravity;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.animation.AnimationSet;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.luck.custom.R;
14 | import com.luck.custom.dialog.OptAnimationLoader;
15 |
16 | /**
17 | * author:luck
18 | * project:EasyFoodBatch
19 | * package:com.luck.easyfoodbatch.util
20 | * email:893855882@qq.com
21 | * data:16/12/16
22 | */
23 | public class TPromptError extends Toast {
24 | private Context mContext;
25 | private AnimationSet mModalInAnim;
26 | private AnimationSet mModalOutAnim;
27 | private TextView chapterNameTV;
28 | private RelativeLayout rl_root;
29 | private Handler handler = new Handler();
30 |
31 | public TPromptError(Context context) {
32 | super(context);
33 | this.mContext = context;
34 | mModalInAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_in);
35 | mModalOutAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_out);
36 | initView();
37 | }
38 |
39 | protected void initView() {
40 | LayoutInflater inflater = LayoutInflater.from(mContext);
41 | View view = inflater.inflate(R.layout.book_reading_toast_error, null);
42 | rl_root = (RelativeLayout) view.findViewById(R.id.rl_root);
43 | chapterNameTV = (TextView) view.findViewById(R.id.chapterName);
44 | setGravity(Gravity.CENTER, 0, 0);
45 | setDuration(Toast.LENGTH_LONG);
46 | setView(view);
47 |
48 | }
49 |
50 |
51 | public void showToast(String msg) {
52 | if (chapterNameTV != null) {
53 | chapterNameTV.setText(msg);
54 | mModalInAnim.setDuration(250);
55 | rl_root.setVisibility(View.VISIBLE);
56 | rl_root.startAnimation(mModalInAnim);
57 | show();
58 | handler.postDelayed(new Runnable() {
59 | @Override
60 | public void run() {
61 | rl_root.setVisibility(View.INVISIBLE);
62 | rl_root.startAnimation(mModalOutAnim);
63 | }
64 | }, 1000);
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/luck/custom/toast/TPromptSuccess.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom.toast;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.view.Gravity;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.animation.AnimationSet;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.luck.custom.R;
14 | import com.luck.custom.dialog.OptAnimationLoader;
15 |
16 | /**
17 | * author:luck
18 | * project:EasyFoodBatch
19 | * package:com.luck.easyfoodbatch.util
20 | * email:893855882@qq.com
21 | * data:16/12/16
22 | */
23 | public class TPromptSuccess extends Toast {
24 | private Context mContext;
25 | private AnimationSet mModalInAnim;
26 | private AnimationSet mModalOutAnim;
27 | private TextView chapterNameTV;
28 | private RelativeLayout rl_root;
29 | private Handler handler = new Handler();
30 |
31 | public TPromptSuccess(Context context) {
32 | super(context);
33 | this.mContext = context;
34 | mModalInAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_in);
35 | mModalOutAnim = (AnimationSet) OptAnimationLoader.loadAnimation(mContext, R.anim.modal_out);
36 | initView();
37 | }
38 |
39 | protected void initView() {
40 | LayoutInflater inflater = LayoutInflater.from(mContext);
41 | View view = inflater.inflate(R.layout.book_reading_seekbar_toast, null);
42 | rl_root = (RelativeLayout) view.findViewById(R.id.rl_root);
43 | chapterNameTV = (TextView) view.findViewById(R.id.chapterName);
44 | setGravity(Gravity.CENTER, 0, 0);
45 | setDuration(Toast.LENGTH_LONG);
46 | setView(view);
47 |
48 | }
49 |
50 |
51 | public void showToast(String msg) {
52 | if (chapterNameTV != null) {
53 | chapterNameTV.setText(msg);
54 | mModalInAnim.setDuration(250);
55 | rl_root.setVisibility(View.VISIBLE);
56 | rl_root.startAnimation(mModalInAnim);
57 | show();
58 | handler.postDelayed(new Runnable() {
59 | @Override
60 | public void run() {
61 | rl_root.setVisibility(View.INVISIBLE);
62 | rl_root.startAnimation(mModalOutAnim);
63 | }
64 | }, 1000);
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/modal_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
10 |
11 |
19 |
20 |
29 |
30 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/modal_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
14 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/book_reading_toast_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dialog_custom_bg.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/alert_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
19 |
20 |
24 |
25 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/book_reading_seekbar_toast.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/book_reading_toast.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/book_reading_toast_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/jg_hud_error_3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xhdpi/jg_hud_error_3x.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/kprogresshud_spinner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xhdpi/kprogresshud_spinner.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/success_1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xhdpi/success_1x.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #00000000
8 | #A5DC86
9 | #F27474
10 | #B6B6B6
11 | #D0D0D0
12 | #AEDEF4
13 | #96BFD2
14 | #33A5DC86
15 | #F8BB86
16 | #b1000000
17 | #DD6B55
18 | #CD5B55
19 | #6086a3
20 | #00afff
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 | 3dp
7 | 34dp
8 | 86dp
9 | 100dp
10 | 120dp
11 | 150dp
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CustomDialog
3 | 请稍后...
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/test/java/com/luck/custom/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.luck.custom;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Dec 30 22:56:01 CST 2016
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-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/screenshot/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/screenshot/image1.jpg
--------------------------------------------------------------------------------
/screenshot/image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/screenshot/image2.jpg
--------------------------------------------------------------------------------
/screenshot/image3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/screenshot/image3.jpg
--------------------------------------------------------------------------------
/screenshot/image4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LuckSiege/CustomView/868a9a015e416c9e3cb385685ac02a9866a1a0ef/screenshot/image4.jpg
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------