From b31e60e83cdb4d5d5aa96b77d21a972fef7329e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=8E=E6=BA=A2?= Date: Fri, 17 Jul 2020 17:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D26=E5=8F=8A=E4=BB=A5=E5=90=8E?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BC=80=E5=90=AF=E6=82=AC=E6=B5=AE=E5=B4=A9?= =?UTF-8?q?=E6=BA=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .idea/.name | 1 - .idea/compiler.xml | 22 ------- .idea/copyright/profiles_settings.xml | 3 - .idea/encodings.xml | 6 -- .idea/gradle.xml | 23 ------- .idea/misc.xml | 62 ------------------- .idea/modules.xml | 9 --- .idea/runConfigurations.xml | 12 ---- .idea/vcs.xml | 6 -- app/build.gradle | 16 ++--- .../activitytracker/TrackerWindowManager.java | 17 +++-- build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 14 files changed, 26 insertions(+), 160 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 39fb081..f6eea60 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /build /captures .externalNativeBuild +/.idea/ \ No newline at end of file diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 0625abd..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -ActivityTracker \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 508b3d9..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7158618..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.8 - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8e047a7..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index ea6ba26..cca5ec2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion "24.0.0" + compileSdkVersion 28 + buildToolsVersion "28.0.0" defaultConfig { applicationId "com.fashare.activitytracker" - minSdkVersion 15 - targetSdkVersion 24 + minSdkVersion 16 + targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -20,12 +20,12 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:24.2.0' - testCompile 'junit:junit:4.12' + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'junit:junit:4.12' - compile 'de.greenrobot:eventbus:2.4.0' + implementation 'de.greenrobot:eventbus:2.4.0' } diff --git a/app/src/main/java/com/fashare/activitytracker/TrackerWindowManager.java b/app/src/main/java/com/fashare/activitytracker/TrackerWindowManager.java index 9fbcd62..897aa6f 100644 --- a/app/src/main/java/com/fashare/activitytracker/TrackerWindowManager.java +++ b/app/src/main/java/com/fashare/activitytracker/TrackerWindowManager.java @@ -2,6 +2,7 @@ import android.content.Context; import android.graphics.PixelFormat; +import android.os.Build; import android.view.Gravity; import android.view.View; import android.view.WindowManager; @@ -15,7 +16,7 @@ public class TrackerWindowManager { public TrackerWindowManager(Context context) { mContext = context; - mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); } private View mFloatingView; @@ -28,8 +29,14 @@ public TrackerWindowManager(Context context) { params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.gravity = Gravity.LEFT | Gravity.TOP; - params.type = WindowManager.LayoutParams.TYPE_PHONE; +// params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; params.format = PixelFormat.RGBA_8888; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; + } else { + params.type = WindowManager.LayoutParams.TYPE_PHONE; + } + params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; @@ -37,7 +44,7 @@ public TrackerWindowManager(Context context) { } public void addView() { - if(mFloatingView == null){ + if (mFloatingView == null) { mFloatingView = new FloatingView(mContext); mFloatingView.setLayoutParams(LAYOUT_PARAMS); @@ -45,8 +52,8 @@ public void addView() { } } - public void removeView(){ - if(mFloatingView != null){ + public void removeView() { + if (mFloatingView != null) { mWindowManager.removeView(mFloatingView); mFloatingView = null; } diff --git a/build.gradle b/build.gradle index a3330d4..7d34715 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:4.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,6 +16,7 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 04e285f..84c0fb2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Fri Jul 17 15:31:07 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip