Skip to content

Commit

Permalink
优化包的导入
Browse files Browse the repository at this point in the history
  • Loading branch information
xuexiangjys committed Mar 20, 2024
1 parent bb1958e commit 64caecc
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.xuexiang.xupdatedemo;

import static org.junit.Assert.assertEquals;

import android.content.Context;

import androidx.test.InstrumentationRegistry;
Expand All @@ -8,8 +10,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertEquals;

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/xuexiang/xupdatedemo/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.xuexiang.xupdatedemo;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NO_NEW_VERSION;

import android.app.Application;

import com.xuexiang.xaop.XAOP;
Expand All @@ -38,8 +40,6 @@

import okhttp3.OkHttpClient;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NO_NEW_VERSION;

/**
* @author xuexiang
* @since 2018/7/9 下午2:15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.xuexiang.xupdatedemo.fragment;

import static android.app.Activity.RESULT_OK;

import android.content.Intent;
import android.graphics.Color;

Expand Down Expand Up @@ -48,8 +50,6 @@
import java.io.File;
import java.util.List;

import static android.app.Activity.RESULT_OK;

/**
* @author xuexiang
* @since 2021/11/25 11:09 PM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.xuexiang.xupdatedemo.fragment;

import static android.app.Activity.RESULT_OK;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
Expand All @@ -22,8 +24,6 @@
import butterknife.BindView;
import butterknife.OnClick;

import static android.app.Activity.RESULT_OK;

/**
* @author xuexiang
* @since 2019-09-03 23:45
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

package com.xuexiang.xupdatedemo.utils;

import static android.os.Build.VERSION_CODES.HONEYCOMB;
import static android.os.Build.VERSION_CODES.KITKAT;

import android.app.Activity;
import android.os.Build;
import android.view.View;
Expand All @@ -25,9 +28,6 @@

import androidx.annotation.ColorInt;

import static android.os.Build.VERSION_CODES.HONEYCOMB;
import static android.os.Build.VERSION_CODES.KITKAT;

/**
* 状态栏工具
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.xuexiang.xupdatedemo;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
* Example local unit test, which will execute on the development machine (host).
*
Expand Down
4 changes: 2 additions & 2 deletions xupdate-lib/src/main/java/com/xuexiang/xupdate/_XUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.xuexiang.xupdate;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
Expand Down Expand Up @@ -46,8 +48,6 @@
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

/**
* 内部版本更新参数的获取
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import android.text.TextUtils;

import com.xuexiang.xupdate.proxy.IUpdateHttpService;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.xuexiang.xupdate.listener.impl;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

import android.content.Context;

import androidx.annotation.NonNull;
Expand All @@ -28,8 +30,6 @@
import java.io.File;
import java.io.IOException;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

/**
* 默认的apk安装监听【自定义安装监听可继承该类,并重写相应的方法】
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package com.xuexiang.xupdate.logs;

import androidx.annotation.NonNull;
import android.util.Log;

import androidx.annotation.NonNull;

import java.io.PrintWriter;
import java.io.StringWriter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package com.xuexiang.xupdate.logs;

import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;

/**
* 版本更新日志打印
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

package com.xuexiang.xupdate.proxy.impl;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_JSON_EMPTY;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NET_REQUEST;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NO_NEW_VERSION;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_PARSE;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_UPDATING;

import android.text.TextUtils;

import androidx.annotation.NonNull;
Expand All @@ -26,17 +32,10 @@
import com.xuexiang.xupdate.proxy.IUpdateChecker;
import com.xuexiang.xupdate.proxy.IUpdateHttpService;
import com.xuexiang.xupdate.proxy.IUpdateProxy;
import com.xuexiang.xupdate.service.DownloadService;
import com.xuexiang.xupdate.utils.UpdateUtils;

import java.util.Map;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_JSON_EMPTY;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NET_REQUEST;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_NO_NEW_VERSION;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_PARSE;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_UPDATING;

/**
* 默认版本更新检查者
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package com.xuexiang.xupdate.utils;

import static android.Manifest.permission.INSTALL_PACKAGES;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
Expand All @@ -32,9 +35,6 @@
import java.io.File;
import java.io.IOException;

import static android.Manifest.permission.INSTALL_PACKAGES;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.INSTALL_FAILED;

/**
* APK安装工具类
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;

import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

package com.xuexiang.xupdate.utils;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_APK_CACHE_DIR_EMPTY;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_IGNORED_VERSION;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_PARSE;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.ActivityNotFoundException;
Expand Down Expand Up @@ -48,10 +52,6 @@
import java.io.File;
import java.util.List;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_APK_CACHE_DIR_EMPTY;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_IGNORED_VERSION;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.CHECK_PARSE;

/**
* 更新工具类
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.xuexiang.xupdate.widget;

import static com.xuexiang.xupdate.widget.UpdateDialogFragment.REQUEST_CODE_REQUEST_PERMISSIONS;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
Expand Down Expand Up @@ -47,8 +49,6 @@

import java.io.File;

import static com.xuexiang.xupdate.widget.UpdateDialogFragment.REQUEST_CODE_REQUEST_PERMISSIONS;

/**
* 版本更新弹窗
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.xuexiang.xupdate.widget;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.DOWNLOAD_PERMISSION_DENIED;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.KEY_UPDATE_ENTITY;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.KEY_UPDATE_PROMPT_ENTITY;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.REQUEST_CODE_REQUEST_PERMISSIONS;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
Expand Down Expand Up @@ -37,11 +42,6 @@

import java.io.File;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.DOWNLOAD_PERMISSION_DENIED;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.KEY_UPDATE_ENTITY;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.KEY_UPDATE_PROMPT_ENTITY;
import static com.xuexiang.xupdate.widget.UpdateDialogFragment.REQUEST_CODE_REQUEST_PERMISSIONS;

/**
* 版本更新提示器【AppCompatActivity实现】
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package com.xuexiang.xupdate.widget;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.DOWNLOAD_PERMISSION_DENIED;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.PROMPT_UNKNOWN;

import android.Manifest;
import android.app.Dialog;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -56,9 +59,6 @@

import java.io.File;

import static com.xuexiang.xupdate.entity.UpdateError.ERROR.DOWNLOAD_PERMISSION_DENIED;
import static com.xuexiang.xupdate.entity.UpdateError.ERROR.PROMPT_UNKNOWN;

/**
* 版本更新提示器【DialogFragment实现】
*
Expand Down

0 comments on commit 64caecc

Please sign in to comment.