Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新下SDK和Gradle #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:exported="true"
android:configChanges="orientation|screenSize|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
12 changes: 5 additions & 7 deletions app/src/main/java/com/huxq17/example/floatball/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -225,6 +225,6 @@ public boolean isApplicationInForeground() {
protected void onDestroy() {
super.onDestroy();
//注册ActivityLifeCyclelistener以后要记得注销,以防内存泄漏。
getApplication().unregisterActivityLifecycleCallbacks(mActivityLifeCycleListener);
// getApplication().unregisterActivityLifecycleCallbacks(mActivityLifeCycleListener);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions appnopermission/build.gradle
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
3 changes: 2 additions & 1 deletion appnopermission/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 2 additions & 4 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
}
Expand Down