├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── xinlan
│ │ └── dragindicatorview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── xinlan
│ │ │ └── dragindicatorview
│ │ │ ├── Bean.java
│ │ │ ├── CircleTransform.java
│ │ │ ├── ListAdapter.java
│ │ │ ├── MainActivity.java
│ │ │ └── SecondActivity.java
│ └── res
│ │ ├── drawable-hdpi
│ │ └── ic_android_black_24dp.png
│ │ ├── drawable-mdpi
│ │ └── ic_android_black_24dp.png
│ │ ├── drawable-xhdpi
│ │ └── ic_android_black_24dp.png
│ │ ├── drawable-xxhdpi
│ │ └── ic_android_black_24dp.png
│ │ ├── drawable-xxxhdpi
│ │ └── ic_android_black_24dp.png
│ │ ├── layout
│ │ ├── activity_list.xml
│ │ ├── activity_main.xml
│ │ └── list_item.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── xinlan
│ └── dragindicatorview
│ └── ExampleUnitTest.java
├── build.gradle
├── dragindicator
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── xinlan
│ │ └── dragindicator
│ │ ├── DragIndicatorView.java
│ │ ├── Point.java
│ │ └── PointEvaluator.java
│ └── res
│ ├── drawable-xhdpi
│ ├── clean_1.png
│ ├── clean_2.png
│ ├── clean_3.png
│ ├── clean_4.png
│ └── clean_5.png
│ ├── drawable
│ └── clean_anim.xml
│ └── values
│ └── strings.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── images
├── demo1.gif
└── demo2.gif
└── 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 | DragIndicatorView
--------------------------------------------------------------------------------
/.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 |
26 |
27 |
--------------------------------------------------------------------------------
/.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 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
带拖拽效果的红点提示控件 DragIndicatorView
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 可以通过拖拽消失的小红点提示
10 |
11 | DragIndicatorView扩展自TextView 可当成普通TextView使用
12 |
13 | 手动触发红点消失:
14 |
15 |
16 | mDragIndicatorView.dismissView();
17 |
18 |
19 |
20 | 当需要监听红点消失事件时 可设置监听如下:
21 |
22 |
23 | mDragIndicatorView.setOnDismissAction(new DragIndicatorView.OnIndicatorDismiss() {
24 | @Override
25 | public void OnDismiss(DragIndicatorView view) {
26 | //TODO 当红点因拖拽或调用dismissView消失时
27 | }
28 | });
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.xinlan.dragindicatorview"
9 | minSdkVersion 14
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.2.0'
26 | compile 'com.android.support:design:23.2.0'
27 | compile 'com.squareup.picasso:picasso:2.5.2'
28 | compile project(path: ':dragindicator')
29 | }
30 |
--------------------------------------------------------------------------------
/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 E:\sdk/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/xinlan/dragindicatorview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
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 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/dragindicatorview/Bean.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
2 |
3 | /**
4 | * Created by panyi on 2016/4/6.
5 | */
6 | public class Bean {
7 | public String name;
8 | public int num;
9 | public String url;
10 | public boolean isIndicatorShow = true;
11 |
12 | public Bean(String name, String url, int num) {
13 | this.name = name;
14 | this.url = url;
15 | this.num = num;
16 | }
17 | }//end class
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/dragindicatorview/CircleTransform.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapShader;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 |
8 | import com.squareup.picasso.Transformation;
9 |
10 | /**
11 | * Created by panyi on 2016/4/6.
12 | */
13 | public class CircleTransform implements Transformation {
14 | @Override
15 | public Bitmap transform(Bitmap source) {
16 | int size = Math.min(source.getWidth(), source.getHeight());
17 |
18 | int x = (source.getWidth() - size) / 2;
19 | int y = (source.getHeight() - size) / 2;
20 |
21 | Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
22 | if (squaredBitmap != source) {
23 | source.recycle();
24 | }
25 |
26 | Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
27 | Canvas canvas = new Canvas(bitmap);
28 | Paint paint = new Paint();
29 | BitmapShader shader = new BitmapShader(squaredBitmap,
30 | BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
31 | paint.setShader(shader);
32 | paint.setAntiAlias(true);
33 | float r = size / 2f;
34 | canvas.drawCircle(r, r, r, paint);
35 | squaredBitmap.recycle();
36 | return bitmap;
37 | }
38 |
39 | @Override
40 | public String key() {
41 | return "circle";
42 | }
43 | }//end class
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/dragindicatorview/ListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.squareup.picasso.Picasso;
12 | import com.xinlan.dragindicator.DragIndicatorView;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * Created by panyi on 2016/4/6.
18 | */
19 | public class ListAdapter extends RecyclerView.Adapter {
20 | private List mDataList;
21 | private Context mContext;
22 |
23 | public ListAdapter(Context context, List data) {
24 | this.mContext = context;
25 | this.mDataList = data;
26 | }
27 |
28 | @Override
29 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
30 | final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
31 | ViewHolder holder = new ViewHolder(view);
32 | return holder;
33 | }
34 |
35 | @Override
36 | public void onBindViewHolder(ViewHolder holder, int position) {
37 | if (mDataList == null)
38 | return;
39 | final Bean bean = mDataList.get(position);
40 | holder.mText.setText(bean.name);
41 | Picasso.with(mContext).load(bean.url).transform(new CircleTransform()).
42 | placeholder(R.drawable.ic_android_black_24dp).into(holder.mImage);
43 | if (bean.isIndicatorShow) {
44 | holder.mDragView.setText(String.valueOf(bean.num));
45 | holder.mDragView.setVisibility(View.VISIBLE);
46 | } else {
47 | holder.mDragView.setVisibility(View.GONE);
48 | }//end if
49 | holder.mDragView.setOnDismissAction(new DragIndicatorView.OnIndicatorDismiss() {
50 | @Override
51 | public void OnDismiss(DragIndicatorView view) {
52 | bean.isIndicatorShow = false;
53 | }
54 | });
55 | }
56 |
57 | @Override
58 | public int getItemCount() {
59 | return mDataList.size();
60 | }
61 |
62 | public static class ViewHolder extends RecyclerView.ViewHolder {
63 | public ImageView mImage;
64 | public TextView mText;
65 | public DragIndicatorView mDragView;
66 |
67 | public ViewHolder(View v) {
68 | super(v);
69 | mImage = (ImageView) v.findViewById(R.id.image);
70 | mText = (TextView) v.findViewById(R.id.text);
71 | mDragView = (DragIndicatorView) v.findViewById(R.id.indicator);
72 | }
73 | }//end inner class
74 | }//end class
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/dragindicatorview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | import com.xinlan.dragindicator.DragIndicatorView;
8 |
9 | public class MainActivity extends AppCompatActivity {
10 | private DragIndicatorView mIndiactorView;
11 | private DragIndicatorView mOtherView;
12 | private View mDismssBtn;
13 | private View mSecondBtn;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_main);
19 |
20 | mIndiactorView = (DragIndicatorView) findViewById(R.id.indiactor_view);
21 | mOtherView = (DragIndicatorView) findViewById(R.id.indicator);
22 |
23 | mDismssBtn = findViewById(R.id.close_btn);
24 | mDismssBtn.setOnClickListener(new View.OnClickListener() {
25 | @Override
26 | public void onClick(View v) {
27 | mIndiactorView.dismissView();
28 | mOtherView.dismissView();
29 | }
30 | });
31 |
32 | mSecondBtn = findViewById(R.id.second_btn);
33 | mSecondBtn.setOnClickListener(new View.OnClickListener() {
34 | @Override
35 | public void onClick(View v) {
36 | //to list activity
37 | SecondActivity.start(MainActivity.this);
38 | }
39 | });
40 | }
41 |
42 | }//end class
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xinlan/dragindicatorview/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.RecyclerView;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * List Activity
14 | */
15 | public class SecondActivity extends AppCompatActivity {
16 | private List mList = new ArrayList();
17 |
18 | private RecyclerView mListView;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_list);
24 | initData();
25 | findViews();
26 | initListView();
27 | }
28 |
29 | private void findViews() {
30 | mListView = (RecyclerView) findViewById(R.id.list);
31 | mListView.setHasFixedSize(true);
32 | }
33 |
34 | private void initListView() {
35 | mListView.setAdapter(new ListAdapter(this, mList));
36 | }
37 |
38 | public static void start(Activity context) {
39 | context.startActivity(new Intent(context, SecondActivity.class));
40 | }
41 |
42 | private void initData() {
43 | mList.add(new Bean("海边的卡夫卡", "http://img10.360buyimg.com/n0/g14/M06/06/00/rBEhV1Hog7kIAAAAAAJBoy0J-0YAABLLAO-AUoAAkG7180.jpg", 1));
44 | mList.add(new Bean("挪威的森林", "http://img22.mtime.cn/up/2011/11/13/212010.80062662_500.jpg", 2));
45 | mList.add(new Bean("没有女人的男人们", "http://img1.cache.netease.com/catchpic/B/B2/B221247352A242589DB2251244D9EE58.jpg", 3));
46 | mList.add(new Bean("且听风吟", "http://images.bookuu.com/book_t/11/49/27/1149277.jpg", 3));
47 | mList.add(new Bean("神的孩子全跳舞", "http://images.zxhsd.com/photo/book_b/C/00843/97875327484951591635-fm-b.jpg", 3));
48 | mList.add(new Bean("海边的卡夫卡", "http://img10.360buyimg.com/n0/g14/M06/06/00/rBEhV1Hog7kIAAAAAAJBoy0J-0YAABLLAO-AUoAAkG7180.jpg", 1));
49 | mList.add(new Bean("挪威的森林", "http://img22.mtime.cn/up/2011/11/13/212010.80062662_500.jpg", 2));
50 | mList.add(new Bean("没有女人的男人们", "http://img1.cache.netease.com/catchpic/B/B2/B221247352A242589DB2251244D9EE58.jpg", 3));
51 | mList.add(new Bean("且听风吟", "http://images.bookuu.com/book_t/11/49/27/1149277.jpg", 3));
52 | mList.add(new Bean("神的孩子全跳舞", "http://images.zxhsd.com/photo/book_b/C/00843/97875327484951591635-fm-b.jpg", 3));
53 | mList.add(new Bean("海边的卡夫卡", "http://img10.360buyimg.com/n0/g14/M06/06/00/rBEhV1Hog7kIAAAAAAJBoy0J-0YAABLLAO-AUoAAkG7180.jpg", 1));
54 | mList.add(new Bean("挪威的森林", "http://img22.mtime.cn/up/2011/11/13/212010.80062662_500.jpg", 2));
55 | mList.add(new Bean("没有女人的男人们", "http://img1.cache.netease.com/catchpic/B/B2/B221247352A242589DB2251244D9EE58.jpg", 3));
56 | mList.add(new Bean("且听风吟", "http://images.bookuu.com/book_t/11/49/27/1149277.jpg", 3));
57 | mList.add(new Bean("神的孩子全跳舞", "http://images.zxhsd.com/photo/book_b/C/00843/97875327484951591635-fm-b.jpg", 3));
58 | }
59 | }//end class
60 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_android_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/drawable-hdpi/ic_android_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_android_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/drawable-mdpi/ic_android_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_android_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/drawable-xhdpi/ic_android_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_android_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/drawable-xxhdpi/ic_android_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_android_black_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/drawable-xxxhdpi/ic_android_black_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
18 |
24 |
34 |
35 |
36 |
42 |
47 |
53 |
64 |
65 |
66 |
67 |
68 |
74 |
75 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
34 |
35 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/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/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DragIndicatorView
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/xinlan/dragindicatorview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicatorview;
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.0-alpha5'
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 |
--------------------------------------------------------------------------------
/dragindicator/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/dragindicator/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 23
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 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | testCompile 'junit:junit:4.12'
24 | compile 'com.android.support:appcompat-v7:23.2.0'
25 | }
26 |
--------------------------------------------------------------------------------
/dragindicator/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 E:\sdk/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 |
--------------------------------------------------------------------------------
/dragindicator/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/dragindicator/src/main/java/com/xinlan/dragindicator/DragIndicatorView.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicator;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.ValueAnimator;
6 | import android.annotation.TargetApi;
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import android.graphics.Canvas;
10 | import android.graphics.Color;
11 | import android.graphics.Paint;
12 | import android.graphics.Path;
13 | import android.graphics.drawable.AnimationDrawable;
14 | import android.graphics.drawable.Drawable;
15 | import android.os.Build;
16 | import android.util.AttributeSet;
17 | import android.util.Log;
18 | import android.util.TypedValue;
19 | import android.view.Gravity;
20 | import android.view.MotionEvent;
21 | import android.view.View;
22 | import android.view.ViewGroup;
23 | import android.view.ViewParent;
24 | import android.view.animation.OvershootInterpolator;
25 | import android.widget.ImageView;
26 | import android.widget.TextView;
27 |
28 | import com.xinlan.dragindeocatorview.R;
29 |
30 | /**
31 | * 可拖拽的红点提示
32 | *
33 | * Created by panyi on 2016/3/31.
34 | */
35 | public class DragIndicatorView extends TextView {
36 | private static int DRAW_COLOR = Color.RED;
37 | //private static int DEFAULT_DISTANCE = 200;
38 | private static float DEFAULT_VISCOUS_VALUE = 0.15f;//粘滞系数
39 |
40 | private Paint mPaint;
41 | private int mRadius = 0;
42 | private float mViscous = DEFAULT_VISCOUS_VALUE;
43 | private float mOriginX = 0;
44 | private float mOriginY = 0;
45 | private int mCenterX = 0;
46 | private int mCenterY = 0;
47 |
48 | private float mDx = 0;
49 | private float mDy = 0;
50 |
51 | //private int mDismissDetectDistance = DEFAULT_DISTANCE;//超过此距离 判定为让提示View消失
52 |
53 | private ViewGroup mRootView;//根布局视图 作为画板使用
54 | private DragIndicatorView mCloneView;
55 | private ViewParent mParentView;
56 | private SpringView mSpringView;
57 | private OnIndicatorDismiss mOnDismissAction;
58 |
59 | public DragIndicatorView(Context context) {
60 | super(context);
61 | initView(context);
62 | }
63 |
64 | public DragIndicatorView(Context context, AttributeSet attrs) {
65 | super(context, attrs);
66 | initView(context);
67 | }
68 |
69 | public DragIndicatorView(Context context, AttributeSet attrs, int defStyleAttr) {
70 | super(context, attrs, defStyleAttr);
71 | initView(context);
72 | }
73 |
74 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
75 | public DragIndicatorView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
76 | super(context, attrs, defStyleAttr, defStyleRes);
77 | initView(context);
78 | }
79 |
80 | private void initView(Context context) {
81 | setGravity(Gravity.CENTER);//内容居中
82 |
83 | mPaint = new Paint();
84 | mPaint.setColor(DRAW_COLOR);
85 | mPaint.setAntiAlias(true);
86 |
87 | if (context instanceof Activity) {
88 | mRootView = (ViewGroup) ((Activity) context).getWindow().getDecorView();
89 | }
90 | //System.out.println("init View");
91 |
92 | }
93 |
94 | @Override
95 | public void setBackgroundResource(int resid) {
96 | showCannotSetBgErrorLog();
97 | }
98 |
99 | @Override
100 | public void setBackground(Drawable background) {
101 | showCannotSetBgErrorLog();
102 | }
103 |
104 | @Override
105 | public void setBackgroundColor(int color) {
106 | showCannotSetBgErrorLog();
107 | }
108 |
109 | private void showCannotSetBgErrorLog() {
110 | Log.e("error", "This drag indicator view can not set custom background");
111 | }
112 |
113 | @Override
114 | protected void onDraw(Canvas canvas) {
115 | drawBackground(canvas);
116 | super.onDraw(canvas);
117 | }
118 |
119 | /**
120 | * draw circle background
121 | *
122 | * @param canvas
123 | */
124 | private void drawBackground(Canvas canvas) {
125 | mRadius = Math.min(getMeasuredWidth(), getMeasuredHeight()) >> 1;
126 | canvas.drawCircle(getWidth() >> 1, getHeight() >> 1, mRadius, mPaint);
127 | }
128 |
129 | @Override
130 | public boolean onTouchEvent(MotionEvent event) {
131 | switch (event.getAction()) {
132 | case MotionEvent.ACTION_DOWN:
133 | //System.out.println("down");
134 | if (mParentView == null) {
135 | mParentView = getScrollableParent();
136 | }
137 | if (mParentView != null) {//屏蔽父控件的事件响应
138 | mParentView.requestDisallowInterceptTouchEvent(true);
139 | }
140 |
141 | mDx = event.getX();
142 | mDy = event.getY();
143 | mOriginX = event.getRawX() - mDx + (getWidth() >> 1);
144 | mOriginY = event.getRawY() - mDy + (getHeight() >> 1);
145 | break;
146 | case MotionEvent.ACTION_MOVE:
147 | //System.out.println("move");
148 | if (getVisibility() == View.VISIBLE) {
149 | setVisibility(View.INVISIBLE);
150 |
151 | mSpringView = new SpringView(this.getContext());
152 | mSpringView.initSpring(mOriginX, mOriginY, mRadius, getWidth(), getHeight());
153 | mRootView.addView(mSpringView);
154 |
155 | mCloneView = cloneSelfView();
156 | mRootView.addView(mCloneView, getLayoutParams());
157 | }//end if
158 |
159 |
160 | if (mCloneView != null) {
161 | mCloneView.setX(event.getRawX() - mDx);
162 | mCloneView.setY(event.getRawY() - mDy);
163 | mCloneView.invalidate();
164 | }
165 | //拉伸水滴效果
166 | if (mSpringView != null) {
167 | //更新弹性控件
168 | mSpringView.update(event.getRawX() - mDx, event.getRawY() - mDy);
169 | }
170 |
171 | break;
172 | case MotionEvent.ACTION_CANCEL:
173 | case MotionEvent.ACTION_UP:
174 | //System.out.println("up");
175 | //判断是否dismiss View
176 | if (mSpringView != null && mSpringView.radius <= 0) {
177 | killView(event.getRawX(), event.getRawY());
178 | mRootView.removeView(mSpringView);
179 | mSpringView = null;
180 |
181 | if (mCloneView != null) {
182 | mRootView.removeView(mCloneView);
183 | mCloneView = null;
184 | }
185 | } else {//不取消
186 | // TODO: 2016/3/31 显示回弹效果动画 恢复View可见
187 | //setVisibility(View.VISIBLE);
188 | if (mSpringView != null && mSpringView.spring_len > 1f) {//存在弹性势能 显示弹性动画效果
189 | mSpringView.startSpringAction();
190 | } else {
191 | resetView();
192 | }
193 | }
194 |
195 | if (mParentView != null) {//恢复父控件对事件的处理
196 | mParentView.requestDisallowInterceptTouchEvent(false);
197 | }
198 | break;
199 | }//end switch
200 | return true;
201 | }
202 |
203 | private void resetView() {
204 | if (mCloneView != null) {
205 | mRootView.removeView(mCloneView);
206 | }
207 | if (mSpringView != null) {
208 | mRootView.removeView(mSpringView);
209 | }
210 | setVisibility(View.VISIBLE);
211 | }
212 |
213 | /**
214 | * 获得父控件
215 | *
216 | * @return
217 | */
218 | private ViewGroup getScrollableParent() {
219 | View target = this;
220 | while (true) {
221 | View parent;
222 | try {
223 | parent = (View) target.getParent();
224 | } catch (Exception e) {
225 | return null;
226 | }
227 | if (parent == null)
228 | return null;
229 | if (parent instanceof ViewGroup) {
230 | return (ViewGroup) parent;
231 | }
232 | target = parent;
233 | }//end while
234 | }
235 |
236 | /**
237 | * 手动控制 提示按钮按钮不可见
238 | */
239 | public void dismissView() {
240 | if (getVisibility() == View.VISIBLE) {
241 | int[] screens = new int[2];
242 | getLocationOnScreen(screens);
243 | killView(screens[0] + (getWidth() >> 1), screens[1] + (getHeight() >> 1));
244 | }//end if
245 | }
246 |
247 | protected void killView(final float x, final float y) {
248 | final ImageView imageView = new ImageView(getContext());
249 | imageView.setImageResource(R.drawable.clean_anim);
250 | mRootView.addView(imageView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
251 | ViewGroup.LayoutParams.WRAP_CONTENT));
252 | imageView.post(new Runnable() {
253 | @Override
254 | public void run() {
255 | imageView.setX(x - (imageView.getMeasuredWidth() >> 1));
256 | imageView.setY(y - (imageView.getMeasuredHeight() >> 1));
257 | }
258 | });
259 |
260 | AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable();
261 | int totalDuring = 0;
262 | for (int i = 0, len = animationDrawable.getNumberOfFrames(); i < len; i++) {
263 | totalDuring += animationDrawable.getDuration(i);
264 | }
265 | animationDrawable.start();
266 |
267 | //动画播放结束后 移除ImageView
268 | postDelayed(new Runnable() {
269 | @Override
270 | public void run() {
271 | mRootView.removeView(imageView);
272 | }
273 | }, totalDuring + 20);
274 |
275 | if (mOnDismissAction != null) {
276 | mOnDismissAction.OnDismiss(this);
277 | }
278 |
279 | setVisibility(View.GONE);
280 | }
281 |
282 | /**
283 | * 产生一个自己的备份
284 | *
285 | * @return
286 | */
287 | protected DragIndicatorView cloneSelfView() {
288 | DragIndicatorView textView = new DragIndicatorView(getContext());
289 | textView.setText(getText());
290 | textView.setTextColor(getTextColors());
291 | textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize());
292 | textView.setGravity(getGravity());
293 | textView.setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
294 | textView.setEnabled(false);
295 | return textView;
296 | }
297 |
298 | /**
299 | * 获取粘滞系数
300 | *
301 | * @return
302 | */
303 | public float getViscous() {
304 | return mViscous;
305 | }
306 |
307 | /**
308 | * 设置粘滞系数
309 | *
310 | * @param mViscous
311 | */
312 | public void setViscous(float mViscous) {
313 | this.mViscous = mViscous;
314 | }
315 |
316 | public interface OnIndicatorDismiss {
317 | void OnDismiss(DragIndicatorView view);
318 | }
319 |
320 | public void setOnDismissAction(OnIndicatorDismiss mOnDismissAction) {
321 | this.mOnDismissAction = mOnDismissAction;
322 | }
323 |
324 | /**
325 | *
326 | */
327 | private final class SpringView extends View {
328 | public float from_x;
329 | public float from_y;
330 | public float radius;
331 | public float to_x;
332 | public float to_y;
333 |
334 | public float toWidth;
335 | public float toHeight;
336 |
337 | private Path mPath = new Path();
338 | boolean isSpringAction = false;
339 | float cur_x;
340 | float cur_y;
341 | float spring_len = 0;
342 | float origin_len = 0;
343 |
344 | ValueAnimator mSpringAnimation;
345 |
346 | public SpringView(Context context) {
347 | super(context);
348 | isSpringAction = false;
349 | }
350 |
351 | public void initSpring(float init_x, float init_y, float r, float w, float h) {
352 | this.from_x = init_x;
353 | this.from_y = init_y;
354 | this.to_x = init_x;
355 | this.to_y = init_y;
356 | this.radius = r;
357 |
358 | this.toWidth = w;
359 | this.toHeight = h;
360 | }
361 |
362 | @Override
363 | protected void onDraw(Canvas canvas) {
364 | if (radius > 0) {
365 | canvas.drawPath(mPath, mPaint);//draw path
366 | canvas.drawCircle(from_x, from_y, radius, mPaint);
367 | }//end if
368 | }
369 |
370 |
371 | public void update(float x, float y) {
372 | this.to_x = x;
373 | this.to_y = y;
374 |
375 | //目的圆 球心坐标
376 | float dest_x = to_x + toWidth / 2;
377 | float dest_y = to_y + toHeight / 2;
378 | updatePosition(dest_x, dest_y);
379 | }
380 |
381 | private void updatePosition(final float dest_x, final float dest_y) {
382 | this.cur_x = dest_x;
383 | this.cur_y = dest_y;
384 |
385 | float deltaX = 0;
386 | float deltaY = 0;
387 | if (dest_y >= from_y) {
388 | deltaX = dest_x - from_x;
389 | deltaY = dest_y - from_y;
390 | } else {
391 | deltaX = from_x - dest_x;
392 | deltaY = from_y - dest_y;
393 | }//end if
394 |
395 | float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
396 | //radius = (float)mRadius/(distance + 1);
397 | // r = R - R * (1 -1/d));
398 | radius = mRadius - mViscous * distance;
399 | if (radius < 0.2f * mRadius) {
400 | radius = 0;
401 | }
402 |
403 | if (radius > 0) {
404 | // (1 , 0) (x,y)
405 | double cos_delta = deltaX / distance;
406 | double angle = Math.acos(cos_delta);
407 | double circle_from_thela1 = angle + Math.PI / 2;
408 | double circle_from_thela2 = circle_from_thela1 + Math.PI;
409 |
410 | float circle_from_circle_x1 = (float) (from_x + radius * Math.cos(circle_from_thela1));
411 | float circle_from_circle_y1 = (float) (from_y + radius * Math.sin(circle_from_thela1));
412 |
413 | float circle_from_circle_x2 = (float) (from_x + radius * Math.cos(circle_from_thela2));
414 | float circle_from_circle_y2 = (float) (from_y + radius * Math.sin(circle_from_thela2));
415 |
416 | float circle_to_circle_x1 = (float) (dest_x + mRadius * Math.cos(circle_from_thela1));
417 | float circle_to_circle_y1 = (float) (dest_y + mRadius * Math.sin(circle_from_thela1));
418 |
419 | float circle_to_circle_x2 = (float) (dest_x + mRadius * Math.cos(circle_from_thela2));
420 | float circle_to_circle_y2 = (float) (dest_y + mRadius * Math.sin(circle_from_thela2));
421 |
422 | mPath.reset();
423 | mPath.moveTo(circle_from_circle_x1, circle_from_circle_y1);
424 | mPath.lineTo(circle_from_circle_x2, circle_from_circle_y2);
425 | mPath.quadTo((from_x + dest_x) / 2, (from_y + dest_y) / 2,
426 | circle_to_circle_x2, circle_to_circle_y2);
427 | //mPath.lineTo(dest_x,dest_y);
428 | //mPath.lineTo(circle_to_circle_x2, circle_to_circle_y2);
429 | mPath.lineTo(circle_to_circle_x1, circle_to_circle_y1);
430 | mPath.quadTo((from_x + dest_x) / 2, (from_y + dest_y) / 2,
431 | circle_from_circle_x1, circle_from_circle_y1);
432 | mPath.close();
433 |
434 | if (mCloneView != null) {
435 | mCloneView.setX(cur_x - toWidth / 2);
436 | mCloneView.setY(cur_y - toHeight / 2);
437 | }
438 |
439 | spring_len = distance;
440 | } else {
441 | spring_len = 0;
442 | }
443 |
444 | invalidate();
445 | }
446 |
447 | /**
448 | * 做回弹操作
449 | */
450 | public void startSpringAction() {
451 | isSpringAction = true;
452 | origin_len = spring_len;
453 |
454 | if (mSpringAnimation != null) {
455 | mSpringAnimation.cancel();
456 | }
457 | mSpringAnimation = ValueAnimator.ofObject(new PointEvaluator(),
458 | new Point(cur_x, cur_y), new Point(from_x, from_y));
459 | mSpringAnimation.setDuration(120);
460 | mSpringAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
461 | @Override
462 | public void onAnimationUpdate(ValueAnimator animation) {
463 | Point p = (Point) animation.getAnimatedValue();
464 | updatePosition(p.getX(), p.getY());
465 | //invalidate();
466 | }
467 | });
468 |
469 | mSpringAnimation.addListener(new AnimatorListenerAdapter() {
470 | @Override
471 | public void onAnimationEnd(Animator animation) {
472 | resetView();
473 | }
474 | });
475 |
476 | mSpringAnimation.setInterpolator(new OvershootInterpolator(5));
477 | mSpringAnimation.start();
478 | postInvalidate();
479 | }
480 | }//end inner class
481 |
482 | }//end class
483 |
--------------------------------------------------------------------------------
/dragindicator/src/main/java/com/xinlan/dragindicator/Point.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicator;
2 |
3 | /**
4 | * Created by panyi on 16/4/5.
5 | */
6 | public class Point {
7 | private float x;
8 |
9 | private float y;
10 |
11 | public Point(float x, float y) {
12 | this.x = x;
13 | this.y = y;
14 | }
15 |
16 | public float getX() {
17 | return x;
18 | }
19 |
20 | public float getY() {
21 | return y;
22 | }
23 | }//end class
24 |
--------------------------------------------------------------------------------
/dragindicator/src/main/java/com/xinlan/dragindicator/PointEvaluator.java:
--------------------------------------------------------------------------------
1 | package com.xinlan.dragindicator;
2 |
3 | import android.animation.TypeEvaluator;
4 |
5 | /**
6 | * Created by panyi on 16/4/5.
7 | *
8 | */
9 | public class PointEvaluator implements TypeEvaluator {
10 |
11 | @Override
12 | public Point evaluate(float fraction, Point startValue, Point endValue) {
13 | float x = startValue.getX() + fraction * (endValue.getX() - startValue.getX());
14 | float y = startValue.getY() + fraction * (endValue.getY() - startValue.getY());
15 | Point point = new Point(x, y);
16 | return point;
17 | }
18 | }//end class
19 |
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable-xhdpi/clean_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/dragindicator/src/main/res/drawable-xhdpi/clean_1.png
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable-xhdpi/clean_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/dragindicator/src/main/res/drawable-xhdpi/clean_2.png
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable-xhdpi/clean_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/dragindicator/src/main/res/drawable-xhdpi/clean_3.png
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable-xhdpi/clean_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/dragindicator/src/main/res/drawable-xhdpi/clean_4.png
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable-xhdpi/clean_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/dragindicator/src/main/res/drawable-xhdpi/clean_5.png
--------------------------------------------------------------------------------
/dragindicator/src/main/res/drawable/clean_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
10 |
13 |
16 |
19 |
22 |
--------------------------------------------------------------------------------
/dragindicator/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DragIndeocatorView
3 |
4 |
--------------------------------------------------------------------------------
/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/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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.10-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 |
--------------------------------------------------------------------------------
/images/demo1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/images/demo1.gif
--------------------------------------------------------------------------------
/images/demo2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/siwangqishiq/DragIndicatorView/bf937c72878bfed67f872a0fad84f680908033a4/images/demo2.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':dragindicator'
2 |
--------------------------------------------------------------------------------