├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── dk
│ │ └── en
│ │ └── floatingview
│ │ ├── App.java
│ │ ├── Test1Activity.java
│ │ ├── Test1_1Activity.java
│ │ ├── Test2Activity.java
│ │ ├── Test2_1Activity.java
│ │ └── TestActivity.java
│ └── res
│ ├── drawable
│ ├── btn_round_player_bg.xml
│ └── ic_launcher_background.xml
│ ├── layout
│ ├── float_music.xml
│ └── main.xml
│ ├── mipmap-xhdpi
│ ├── close_white.png
│ ├── ic_launcher.png
│ ├── ic_launcher_round.png
│ ├── player_status_pause_white.png
│ └── player_status_start_white.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── floatingview
├── .gitignore
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── dk
│ └── floatingview
│ ├── DkFloatingView.java
│ ├── FloatLifecycle.java
│ ├── FloatWindow.java
│ ├── FloatingMagnetView.java
│ ├── FloatingView.java
│ ├── IFloatingView.java
│ └── MagnetViewListener.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── preview
└── 1.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 应用内悬浮窗[](https://jitpack.io/#Doonkey/DkFloatingView)
2 |
3 | 应用内悬浮窗,基本无侵入性,无权限申请,简单配置,全局可用,支持滑动,点击事件
4 |
5 | > 基于开源项目修改,感谢作者;[https://github.com/leotyndale/EnFloatingView](https://github.com/leotyndale/EnFloatingView)
6 |
7 |
8 | ### 预览图
9 |
10 | 
11 |
12 | ### 使用说明
13 |
14 | #### 导入依赖
15 | Step 1. 添加JitPack仓库到根目录build.gradle文件
16 |
17 | allprojects {
18 | repositories {
19 | ...
20 | maven { url 'https://jitpack.io' }
21 | }
22 | }
23 | Step 2. 在module添加依赖,${version}版本[](https://jitpack.io/#Doonkey/DkFloatingView)
24 |
25 | dependencies {
26 | implementation 'com.github.Doonkey:DkFloatingView:${version}'
27 | }
28 |
29 | #### 初始化
30 |
31 | ```Java
32 | FloatWindow.with(this)//application上下文
33 | .setLayoutId(R.layout.float_music)//悬浮布局
34 | //.setFilter(Test1_1Activity.class)//过滤activity
35 | //.setLayoutParam()//设置悬浮布局layoutParam
36 | .build();
37 | ```
38 |
39 |
40 | #### 点击监听
41 |
42 | ```Java
43 | FloatWindow.get()//悬浮窗实例
44 | .setOnClickListener(new DkFloatingView.ViewClickListener() {
45 | @Override
46 | public void onClick(int viewId) {//viewId
47 | switch (viewId){
48 | ...
49 | }
50 | }
51 | });
52 | ```
53 |
54 |
55 | #### 显示/隐藏
56 |
57 | ```Java
58 | FloatWindow.get().show();//显示
59 | FloatWindow.get().hide();//隐藏
60 | ```
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.dk.floatingview"
7 | minSdkVersion 19
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:28.0.0'
24 | testImplementation 'junit:junit:4.12'
25 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
26 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
27 | implementation project(path: ':floatingview')
28 | implementation 'com.android.support.constraint:constraint-layout:2.0.4'
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/App.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.app.Application;
4 | import android.widget.Toast;
5 |
6 | import com.dk.floatingview.FloatWindow;
7 | import com.dk.floatingview.DkFloatingView;
8 |
9 | public class App extends Application {
10 | @Override
11 | public void onCreate() {
12 | super.onCreate();
13 | FloatWindow.with(this)//application上下文
14 | .setLayoutId(R.layout.float_music)//悬浮布局
15 | //.setFilter(Test1_1Activity.class)//过滤activity
16 | //.setLayoutParam()//设置悬浮布局layoutParam
17 | .build();
18 | FloatWindow.get().setOnClickListener(new DkFloatingView.ViewClickListener() {
19 | @Override
20 | public void onClick(int viewId) {
21 | switch (viewId){
22 | case R.id.iv_player_status:
23 | Toast.makeText(App.this, "状态",Toast.LENGTH_SHORT).show();
24 | break;
25 | case R.id.iv_player_close:
26 | Toast.makeText(App.this, "关闭",Toast.LENGTH_SHORT).show();
27 | break;
28 | case R.id.iv_player_cover:
29 | Toast.makeText(App.this, "封面",Toast.LENGTH_SHORT).show();
30 | break;
31 | }
32 | }
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/Test1Activity.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.dk.floatingview.FloatWindow;
11 |
12 | /**
13 | * @ClassName TestActivity
14 | * @Description
15 | * @Author Yunpeng Li
16 | * @Creation 2018/3/15 下午5:01
17 | * @Mender Yunpeng Li
18 | * @Modification 2018/3/15 下午5:01
19 | */
20 | public class Test1Activity extends AppCompatActivity {
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.main);
26 | ((TextView) findViewById(R.id.page_num)).setText("页面Test1Activity");
27 | }
28 | @Override
29 | protected void onResume() {
30 | super.onResume();
31 | FloatWindow.get().hide();
32 | }
33 |
34 | public void createActivity(View view) {
35 | Intent intent = new Intent();
36 | intent.setClass(this, Test1_1Activity.class);
37 | startActivity(intent);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/Test1_1Activity.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | /**
11 | * @ClassName TestActivity
12 | * @Description
13 | * @Author Yunpeng Li
14 | * @Creation 2018/3/15 下午5:01
15 | * @Mender Yunpeng Li
16 | * @Modification 2018/3/15 下午5:01
17 | */
18 | public class Test1_1Activity extends AppCompatActivity {
19 |
20 | @Override
21 | protected void onCreate(@Nullable Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.main);
24 | ((TextView) findViewById(R.id.page_num)).setText("页面Test1_1Activity");
25 | }
26 |
27 | public void createActivity(View view) {
28 | Intent intent = new Intent();
29 | intent.setClass(this, Test2Activity.class);
30 | startActivity(intent);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/Test2Activity.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.dk.floatingview.FloatWindow;
11 |
12 | /**
13 | * @ClassName TestActivity
14 | * @Description
15 | * @Author Yunpeng Li
16 | * @Creation 2018/3/15 下午5:01
17 | * @Mender Yunpeng Li
18 | * @Modification 2018/3/15 下午5:01
19 | */
20 | public class Test2Activity extends AppCompatActivity {
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.main);
26 | ((TextView) findViewById(R.id.page_num)).setText("页面Test2Activity");
27 | }
28 | @Override
29 | protected void onResume() {
30 | super.onResume();
31 | FloatWindow.get().show();
32 | }
33 |
34 | public void createActivity(View view) {
35 | Intent intent = new Intent();
36 | intent.setClass(this, Test2_1Activity.class);
37 | startActivity(intent);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/Test2_1Activity.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | /**
11 | * @ClassName TestActivity
12 | * @Description
13 | * @Author Yunpeng Li
14 | * @Creation 2018/3/15 下午5:01
15 | * @Mender Yunpeng Li
16 | * @Modification 2018/3/15 下午5:01
17 | */
18 | public class Test2_1Activity extends AppCompatActivity {
19 |
20 | @Override
21 | protected void onCreate(@Nullable Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.main);
24 | ((TextView) findViewById(R.id.page_num)).setText("页面Test2_1Activity");
25 | }
26 |
27 | public void createActivity(View view) {
28 | Intent intent = new Intent();
29 | intent.setClass(this, TestActivity.class);
30 | startActivity(intent);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dk/en/floatingview/TestActivity.java:
--------------------------------------------------------------------------------
1 | package com.dk.en.floatingview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.dk.floatingview.FloatWindow;
11 |
12 | /**
13 | * @ClassName TestActivity
14 | * @Description
15 | * @Author Yunpeng Li
16 | * @Creation 2018/3/15 下午5:01
17 | * @Mender Yunpeng Li
18 | * @Modification 2018/3/15 下午5:01
19 | */
20 | public class TestActivity extends AppCompatActivity {
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.main);
26 | ((TextView) findViewById(R.id.page_num)).setText("页面TestActivity");
27 | }
28 |
29 | @Override
30 | protected void onResume() {
31 | super.onResume();
32 | FloatWindow.get().show();
33 | }
34 |
35 | public void createActivity(View view) {
36 | Intent intent = new Intent();
37 | intent.setClass(this, Test1Activity.class);
38 | startActivity(intent);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_round_player_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/float_music.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
15 |
21 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/close_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/app/src/main/res/mipmap-xhdpi/close_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/player_status_pause_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/app/src/main/res/mipmap-xhdpi/player_status_pause_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/player_status_start_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/app/src/main/res/mipmap-xhdpi/player_status_start_white.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DkFloatingView
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:3.1.3'
12 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | jcenter()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/floatingview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/floatingview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven' //this way we can find the android-maven in jcenter
3 | group='com.github.dk' //this is your github name
4 |
5 | android {
6 | compileSdkVersion 26
7 |
8 | defaultConfig {
9 | minSdkVersion 14
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | compileOptions {
22 | sourceCompatibility JavaVersion.VERSION_1_8
23 | targetCompatibility JavaVersion.VERSION_1_8
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 | compileOnly 'com.android.support:appcompat-v7:26.1.0'
30 | }
--------------------------------------------------------------------------------
/floatingview/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=EnFloatingView
--------------------------------------------------------------------------------
/floatingview/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/floatingview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/DkFloatingView.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.support.annotation.LayoutRes;
6 | import android.support.annotation.NonNull;
7 | import android.view.Gravity;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.FrameLayout;
11 | import android.widget.RelativeLayout;
12 |
13 | @SuppressLint("ViewConstructor")
14 | public class DkFloatingView extends FloatingMagnetView implements View.OnClickListener {
15 |
16 | private final View mInflate;
17 | public DkFloatingView(@NonNull Context context, @LayoutRes int resource, ViewGroup.LayoutParams layoutParam) {
18 | super(context, null);
19 | mInflate = inflate(context, resource, this);
20 | setLayoutParams(layoutParam == null ? getParams(): layoutParam);
21 | }
22 |
23 | private FrameLayout.LayoutParams getParams() {
24 | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
25 | RelativeLayout.LayoutParams.WRAP_CONTENT,
26 | RelativeLayout.LayoutParams.WRAP_CONTENT);
27 | params.gravity = Gravity.BOTTOM | Gravity.START;
28 | params.setMargins(100, params.topMargin, params.rightMargin, 100);
29 | return params;
30 | }
31 |
32 | public View getView(){
33 | return mInflate;
34 | }
35 |
36 | private ViewClickListener mListener;
37 | public void setOnClickListener(ViewClickListener listener) {
38 | this.mListener = listener;
39 | mInflate.post(() -> clickView2(mInflate));
40 | }
41 |
42 | private void clickView2(View view){
43 | if (view == null) return;
44 | view.setOnClickListener(DkFloatingView.this);
45 | if (view instanceof ViewGroup){
46 | int childCount = ((ViewGroup) view).getChildCount();
47 | for (int i = 0; i < childCount; i++) {
48 | View childAt = ((ViewGroup) view).getChildAt(i);
49 | clickView2(childAt);
50 | }
51 | }
52 | }
53 |
54 | @Override
55 | public void onClick(View view) {
56 | if (mListener != null){
57 | mListener.onClick(view);
58 | }
59 | }
60 |
61 | public interface ViewClickListener {
62 | void onClick(View view);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/FloatLifecycle.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.os.Bundle;
6 |
7 | public class FloatLifecycle implements Application.ActivityLifecycleCallbacks {
8 |
9 | private Callback mCallback;
10 |
11 | public FloatLifecycle bind(Application context) {
12 | context.registerActivityLifecycleCallbacks(this);
13 | return this;
14 | }
15 |
16 | public void listener(Callback callback) {
17 | mCallback = callback;
18 | }
19 |
20 | @Override
21 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
22 |
23 | }
24 |
25 | @Override
26 | public void onActivityStarted(Activity activity) {
27 | }
28 |
29 | @Override
30 | public void onActivityResumed(Activity activity) {
31 | if (mCallback != null){
32 | mCallback.activityAttach(activity);
33 | }
34 | }
35 |
36 | @Override
37 | public void onActivityPaused(Activity activity) {
38 | if (mCallback != null){
39 | mCallback.activityDetach(activity);
40 | }
41 | }
42 |
43 | @Override
44 | public void onActivityStopped(Activity activity) {
45 | }
46 |
47 | @Override
48 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
49 |
50 | }
51 |
52 | @Override
53 | public void onActivityDestroyed(Activity activity) {
54 |
55 | }
56 |
57 | public interface Callback{
58 | void activityAttach(Activity activity);
59 | void activityDetach(Activity activity);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/FloatWindow.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.support.annotation.NonNull;
6 | import android.view.ViewGroup;
7 |
8 | public class FloatWindow {
9 |
10 | private static Builder builder;
11 |
12 | private FloatWindow() {
13 | }
14 |
15 | public static IFloatingView get(){
16 | if (builder == null){
17 | throw new IllegalArgumentException("can not invoke before with()!");
18 | }
19 | return builder.floatingView;
20 | }
21 |
22 | public static Builder with(@NonNull Application context) {
23 | builder = new Builder(context);
24 | return builder;
25 | }
26 |
27 | public static class Builder {
28 |
29 | Application mContext;
30 | FloatLifecycle mFloatLifecycle;
31 | int mLayoutId;
32 | ViewGroup.LayoutParams mLayoutParam;
33 | Class extends Activity>[] mFilterActivities;
34 | IFloatingView floatingView;
35 |
36 | private Builder(Application context) {
37 | this.mContext = context;
38 | this.mFloatLifecycle = new FloatLifecycle().bind(mContext);
39 | }
40 | public Builder setLayoutId(int layoutId){
41 | this.mLayoutId = layoutId;
42 | return this;
43 | }
44 | public Builder setLayoutParam(ViewGroup.LayoutParams layoutParam){
45 | this.mLayoutParam = layoutParam;
46 | return this;
47 | }
48 | public Builder setFilter(@NonNull Class extends Activity>... activities) {
49 | mFilterActivities = activities;
50 | return this;
51 | }
52 | public void build() {
53 | floatingView = new FloatingView(this);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/FloatingMagnetView.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.content.Context;
4 | import android.content.res.Configuration;
5 | import android.os.Handler;
6 | import android.os.Looper;
7 | import android.util.AttributeSet;
8 | import android.view.MotionEvent;
9 | import android.view.ViewConfiguration;
10 | import android.view.ViewGroup;
11 | import android.widget.FrameLayout;
12 |
13 | /**
14 | * @ClassName FloatingMagnetView
15 | * @Description 磁力吸附悬浮窗
16 | * @Author Yunpeng Li
17 | * @Creation 2018/3/15 下午5:02
18 | * @Mender Yunpeng Li
19 | * @Modification 2018/3/15 下午5:02
20 | */
21 | public class FloatingMagnetView extends FrameLayout {
22 |
23 | public static final int MARGIN_EDGE = 13;
24 | private float mOriginalRawX;
25 | private float mOriginalRawY;
26 | private float mOriginalX;
27 | private float mOriginalY;
28 | protected MoveAnimator mMoveAnimator;
29 | protected int mScreenWidth;
30 | private int mScreenHeight;
31 | private boolean isNearestLeft = true;
32 | private float mPortraitY;
33 | private int scaledTouchSlop;
34 |
35 | public FloatingMagnetView(Context context) {
36 | this(context, null);
37 | }
38 |
39 | public FloatingMagnetView(Context context, AttributeSet attrs) {
40 | this(context, attrs, 0);
41 | }
42 |
43 | public FloatingMagnetView(Context context, AttributeSet attrs, int defStyleAttr) {
44 | super(context, attrs, defStyleAttr);
45 | init();
46 | }
47 |
48 | private void init() {
49 | scaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
50 | mMoveAnimator = new MoveAnimator();
51 | setClickable(true);
52 | // updateSize();
53 | }
54 |
55 | private float rawX;
56 | private float rawY;
57 | private boolean intercept;
58 |
59 | @Override
60 | public boolean onInterceptTouchEvent(MotionEvent event) {
61 | switch (event.getAction()) {
62 | case MotionEvent.ACTION_DOWN:
63 | intercept = false;
64 | rawX = event.getRawX();
65 | rawY = event.getRawY();
66 | changeOriginalTouchParams(event);
67 | updateSize();
68 | mMoveAnimator.stop();
69 | break;
70 | case MotionEvent.ACTION_MOVE:
71 | if (Math.abs(event.getRawX() - rawX) >= scaledTouchSlop ||
72 | Math.abs(event.getRawY() - rawY) >= scaledTouchSlop) {
73 | intercept = true;
74 | }
75 | updateViewPosition(event);
76 | break;
77 | case MotionEvent.ACTION_UP:
78 | clearPortraitY();
79 | moveToEdge();
80 | return super.onInterceptTouchEvent(event) || intercept;
81 | }
82 | return super.onInterceptTouchEvent(event);
83 | }
84 |
85 | private void updateViewPosition(MotionEvent event) {
86 | setX(mOriginalX + event.getRawX() - mOriginalRawX);
87 | // 限制不可超出屏幕高度
88 | float desY = mOriginalY + event.getRawY() - mOriginalRawY;
89 | if (desY < 0) {
90 | desY = 0;
91 | }
92 | if (desY > mScreenHeight - getHeight()) {
93 | desY = mScreenHeight - getHeight();
94 | }
95 | setY(desY);
96 | }
97 |
98 | private void changeOriginalTouchParams(MotionEvent event) {
99 | mOriginalX = getX();
100 | mOriginalY = getY();
101 | mOriginalRawX = event.getRawX();
102 | mOriginalRawY = event.getRawY();
103 | }
104 |
105 | protected void updateSize() {
106 | ViewGroup viewGroup = (ViewGroup) getParent();
107 | if (viewGroup != null) {
108 | mScreenWidth = viewGroup.getWidth() - getWidth();
109 | mScreenHeight = viewGroup.getHeight();
110 | }
111 | // mScreenWidth = (SystemUtils.getScreenWidth(getContext()) - this.getWidth());
112 | // mScreenHeight = SystemUtils.getScreenHeight(getContext());
113 | }
114 |
115 | public void moveToEdge() {
116 | moveToEdge(isNearestLeft(), false);
117 | }
118 |
119 | public void moveToEdge(boolean isLeft, boolean isLandscape) {
120 | float moveDistance = isLeft ? MARGIN_EDGE : mScreenWidth - MARGIN_EDGE;
121 | float y = getY();
122 | if (!isLandscape && mPortraitY != 0) {
123 | y = mPortraitY;
124 | clearPortraitY();
125 | }
126 | mMoveAnimator.start(moveDistance, Math.min(Math.max(0, y), mScreenHeight - getHeight()));
127 | }
128 |
129 | private void clearPortraitY() {
130 | mPortraitY = 0;
131 | }
132 |
133 | protected boolean isNearestLeft() {
134 | int middle = mScreenWidth / 2;
135 | isNearestLeft = getX() < middle;
136 | return isNearestLeft;
137 | }
138 |
139 | protected class MoveAnimator implements Runnable {
140 |
141 | private final Handler handler = new Handler(Looper.getMainLooper());
142 | private float destinationX;
143 | private float destinationY;
144 | private long startingTime;
145 |
146 | void start(float x, float y) {
147 | this.destinationX = x;
148 | this.destinationY = y;
149 | startingTime = System.currentTimeMillis();
150 | handler.post(this);
151 | }
152 |
153 | @Override
154 | public void run() {
155 | if (getRootView() == null || getRootView().getParent() == null) {
156 | return;
157 | }
158 | float progress = Math.min(1, (System.currentTimeMillis() - startingTime) / 400f);
159 | float deltaX = (destinationX - getX()) * progress;
160 | float deltaY = (destinationY - getY()) * progress;
161 | move(deltaX, deltaY);
162 | if (progress < 1) {
163 | handler.post(this);
164 | }
165 | }
166 |
167 | private void stop() {
168 | handler.removeCallbacks(this);
169 | }
170 | }
171 |
172 | private void move(float deltaX, float deltaY) {
173 | setX(getX() + deltaX);
174 | setY(getY() + deltaY);
175 | }
176 |
177 | @Override
178 | protected void onConfigurationChanged(Configuration newConfig) {
179 | super.onConfigurationChanged(newConfig);
180 | if (getParent() != null) {
181 | final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
182 | markPortraitY(isLandscape);
183 | ((ViewGroup) getParent()).post(() -> {
184 | updateSize();
185 | moveToEdge(isNearestLeft, isLandscape);
186 | });
187 | }
188 | }
189 |
190 | private void markPortraitY(boolean isLandscape) {
191 | if (isLandscape) {
192 | mPortraitY = getY();
193 | }
194 | }
195 | }
196 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/FloatingView.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.support.v4.view.ViewCompat;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.FrameLayout;
9 |
10 | import java.lang.ref.WeakReference;
11 |
12 | public class FloatingView implements IFloatingView, FloatLifecycle.Callback {
13 |
14 | private Application mApplication;
15 | private final DkFloatingView dkFloatingView;
16 | private final Class extends Activity>[] mFilterActivities;
17 |
18 | private WeakReference mContainer;
19 | private boolean isShow = false;
20 |
21 | FloatingView(FloatWindow.Builder builder) {
22 | mApplication = builder.mContext;
23 | mFilterActivities = builder.mFilterActivities;
24 | dkFloatingView = new DkFloatingView(mApplication, builder.mLayoutId, builder.mLayoutParam);
25 | builder.mFloatLifecycle.listener(this);
26 | }
27 |
28 | @Override
29 | public void show(){
30 | isShow = true;
31 | addViewToWindow();
32 | }
33 |
34 | @Override
35 | public void hide(){
36 | isShow = false;
37 | detach(getContainer());
38 | }
39 |
40 | @Override
41 | public View getView() {
42 | return dkFloatingView.getView();
43 | }
44 |
45 | @Override
46 | public void setOnClickListener(DkFloatingView.ViewClickListener listener) {
47 | dkFloatingView.setOnClickListener(listener);
48 | }
49 |
50 | @Override
51 | public void activityAttach(Activity activity) {
52 | if (!isFilterActivity(activity)){
53 | attach(getActivityRoot(activity));
54 | }
55 | }
56 |
57 | @Override
58 | public void activityDetach(Activity activity) {
59 | if (!isFilterActivity(activity)) {
60 | detach(getActivityRoot(activity));
61 | }
62 | }
63 |
64 | private boolean isFilterActivity(Activity activity){
65 | if(mFilterActivities == null){
66 | return false;
67 | }
68 | for (Class extends Activity> mFilterActivity : mFilterActivities) {
69 | if (mFilterActivity.getName().equals(activity.getClass().getName())){
70 | return true;
71 | }
72 | }
73 | return false;
74 | }
75 |
76 | private void addViewToWindow() {
77 | if (getContainer() == null) {
78 | return;
79 | }
80 | if (dkFloatingView.getParent() != null) {
81 | ((ViewGroup) dkFloatingView.getParent()).removeView(dkFloatingView);
82 | }
83 | if (isShow && !ViewCompat.isAttachedToWindow(dkFloatingView)) {
84 | getContainer().addView(dkFloatingView);
85 | }
86 | }
87 |
88 | private FrameLayout getContainer() {
89 | if (mContainer == null) {
90 | return null;
91 | }
92 | return mContainer.get();
93 | }
94 |
95 | private FrameLayout getActivityRoot(Activity activity) {
96 | if (activity == null) {
97 | return null;
98 | }
99 | try {
100 | return (FrameLayout) activity.getWindow().getDecorView().findViewById(android.R.id.content);
101 | } catch (Exception e) {
102 | e.printStackTrace();
103 | }
104 | return null;
105 | }
106 |
107 | private void attach(FrameLayout container) {
108 | if (getContainer() != null) {
109 | mContainer.clear();
110 | }
111 | mContainer = new WeakReference<>(container);
112 | addViewToWindow();
113 | }
114 | private void detach(FrameLayout container) {
115 | if (container != null && dkFloatingView.getParent() == container){
116 | container.removeView(dkFloatingView);
117 | }
118 | if (getContainer() != null && getContainer() == container) {
119 | mContainer.clear();
120 | mContainer = null;
121 | }
122 | }
123 |
124 | }
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/IFloatingView.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.view.View;
4 |
5 | public interface IFloatingView {
6 |
7 | void show();
8 | void hide();
9 |
10 | View getView();
11 |
12 | void setOnClickListener(DkFloatingView.ViewClickListener listener);
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/floatingview/src/main/java/com/dk/floatingview/MagnetViewListener.java:
--------------------------------------------------------------------------------
1 | package com.dk.floatingview;
2 |
3 | import android.view.MotionEvent;
4 |
5 | public interface MagnetViewListener {
6 |
7 | void onRemove(FloatingMagnetView magnetView);
8 |
9 | void onClick(MotionEvent event);
10 | }
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Mar 15 15:13:07 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-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 |
--------------------------------------------------------------------------------
/preview/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Doonkey/DkFloatingView/c13c3c477a1b4ebba4d016978a32f03ce3014361/preview/1.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':floatingview'
2 |
--------------------------------------------------------------------------------