diff --git a/app/build.gradle b/app/build.gradle index d5c3f36..efa5f78 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' -apply plugin: 'service_agency' +// apply plugin: 'service_agency' android { - compileSdkVersion 26 + compileSdkVersion 33 defaultConfig { applicationId "com.huxq17.example.floatball" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 33 versionCode 1 versionName "1.0" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 68f3d85..b56a34e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ tools:ignore="GoogleAppIndexingWarning"> diff --git a/app/src/main/java/com/huxq17/example/floatball/App.java b/app/src/main/java/com/huxq17/example/floatball/App.java index 3f4c8a9..829bd6f 100644 --- a/app/src/main/java/com/huxq17/example/floatball/App.java +++ b/app/src/main/java/com/huxq17/example/floatball/App.java @@ -2,8 +2,6 @@ import android.app.Application; -import com.buyi.huxq17.serviceagency.ServiceAgency; -import com.buyi.huxq17.serviceagency.exception.AgencyException; import com.huxq17.floatball.libarary.LocationService; public class App extends Application { @@ -13,10 +11,10 @@ public void onCreate() { //需要记录并在再次打开app的时候恢复位置 //在LocationService的实现类里用的是SharedPreferences来记录位置,需要Context //如果你的实现方式不需要Context,则可以不需要这个步骤,可以去掉这行代码 - try { - ServiceAgency.getService(LocationService.class).start(this); - }catch (AgencyException e){ - //ignore - } + // try { + // ServiceAgency.getService(LocationService.class).start(this); + // }catch (AgencyException e){ + // //ignore + // } } } diff --git a/app/src/main/java/com/huxq17/example/floatball/MainActivity.java b/app/src/main/java/com/huxq17/example/floatball/MainActivity.java index 8237210..4117a7e 100644 --- a/app/src/main/java/com/huxq17/example/floatball/MainActivity.java +++ b/app/src/main/java/com/huxq17/example/floatball/MainActivity.java @@ -45,14 +45,14 @@ public void onFloatBallClick() { }); } //6 如果想做成应用内悬浮球,可以添加以下代码。 - getApplication().registerActivityLifecycleCallbacks(mActivityLifeCycleListener); + // getApplication().registerActivityLifecycleCallbacks(mActivityLifeCycleListener); } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); - mFloatballManager.show(); - mFloatballManager.onFloatBallClick(); + // mFloatballManager.show(); + // mFloatballManager.onFloatBallClick(); } @Override @@ -225,6 +225,6 @@ public boolean isApplicationInForeground() { protected void onDestroy() { super.onDestroy(); //注册ActivityLifeCyclelistener以后要记得注销,以防内存泄漏。 - getApplication().unregisterActivityLifecycleCallbacks(mActivityLifeCycleListener); + // getApplication().unregisterActivityLifecycleCallbacks(mActivityLifeCycleListener); } } diff --git a/app/src/main/java/com/huxq17/example/floatball/SimpleLocationService.java b/app/src/main/java/com/huxq17/example/floatball/SimpleLocationService.java index d38570d..081c317 100644 --- a/app/src/main/java/com/huxq17/example/floatball/SimpleLocationService.java +++ b/app/src/main/java/com/huxq17/example/floatball/SimpleLocationService.java @@ -3,10 +3,10 @@ import android.content.Context; import android.content.SharedPreferences; -import com.buyi.huxq17.serviceagency.annotation.ServiceAgent; +// import com.buyi.huxq17.serviceagency.annotation.ServiceAgent; import com.huxq17.floatball.libarary.LocationService; -@ServiceAgent +// @ServiceAgent public class SimpleLocationService implements LocationService { private SharedPreferences sharedPreferences; diff --git a/appnopermission/build.gradle b/appnopermission/build.gradle index da45be9..6489c55 100644 --- a/appnopermission/build.gradle +++ b/appnopermission/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 + compileSdkVersion 33 defaultConfig { applicationId "com.huxq17.example.floatball.nopermissionapp" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 33 versionCode 1 versionName "1.0" diff --git a/appnopermission/src/main/AndroidManifest.xml b/appnopermission/src/main/AndroidManifest.xml index cf64d1b..7f2bf6a 100644 --- a/appnopermission/src/main/AndroidManifest.xml +++ b/appnopermission/src/main/AndroidManifest.xml @@ -9,7 +9,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/build.gradle b/build.gradle index e7138ce..ab8d12f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' - classpath 'com.buyi.huxq17:agencyplugin:1.1.2' + // classpath 'com.buyi.huxq17:agencyplugin:1.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4a731fd..dc9af90 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,4 @@ -#Thu Jan 18 10:26:04 CST 2018 +#Thu Nov 07 11:46:12 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip diff --git a/library/build.gradle b/library/build.gradle index e68696a..173007f 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -25,5 +25,5 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.buyi.huxq17:serviceagency:1.1.0' + // implementation 'com.buyi.huxq17:serviceagency:1.1.0' } diff --git a/library/src/main/java/com/huxq17/floatball/libarary/floatball/FloatBall.java b/library/src/main/java/com/huxq17/floatball/libarary/floatball/FloatBall.java index cf1d7a6..a8bef39 100644 --- a/library/src/main/java/com/huxq17/floatball/libarary/floatball/FloatBall.java +++ b/library/src/main/java/com/huxq17/floatball/libarary/floatball/FloatBall.java @@ -12,8 +12,6 @@ import android.widget.FrameLayout; import android.widget.ImageView; -import com.buyi.huxq17.serviceagency.ServiceAgency; -import com.buyi.huxq17.serviceagency.exception.AgencyException; import com.huxq17.floatball.libarary.FloatBallManager; import com.huxq17.floatball.libarary.FloatBallUtil; import com.huxq17.floatball.libarary.LocationService; @@ -48,6 +46,7 @@ public class FloatBall extends FrameLayout implements ICarrier { private boolean mLayoutChanged = false; private int mSleepX = -1; private boolean isLocationServiceEnable; + private LocationService locationService; private OnceRunnable mSleepRunnable = new OnceRunnable() { @Override public void onRun() { @@ -63,12 +62,12 @@ public FloatBall(Context context, FloatBallManager floatBallManager, FloatBallCf super(context); this.floatBallManager = floatBallManager; mConfig = config; - try { - ServiceAgency.getService(LocationService.class); - isLocationServiceEnable = true; - } catch (AgencyException e) { - isLocationServiceEnable = false; - } + // try { + // ServiceAgency.getService(LocationService.class); + // isLocationServiceEnable = true; + // } catch (AgencyException e) { + // isLocationServiceEnable = false; + // } init(context); } @@ -175,8 +174,8 @@ private void location(int width, int height) { if (y < 0) y = topLimit; if (y > bottomLimit) y = topLimit; - if (isLocationServiceEnable) { - LocationService locationService = ServiceAgency.getService(LocationService.class); + if (isLocationServiceEnable && locationService != null) { + // LocationService locationService = ServiceAgency.getService(LocationService.class); int[] location = locationService.onRestoreLocation(); if (location.length == 2) { int locationX = location[0]; @@ -345,8 +344,8 @@ public void onMove(int lastX, int lastY, int curX, int curY) { @Override public void onDone() { postSleepRunnable(); - if (isLocationServiceEnable) { - LocationService locationService = ServiceAgency.getService(LocationService.class); + if (isLocationServiceEnable && locationService != null) { + // LocationService locationService = ServiceAgency.getService(LocationService.class); locationService.onLocationChanged(mLayoutParams.x, mLayoutParams.y); } }