Compare commits
	
		
			24 Commits 
		
	
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | ad203b292d | 5 years ago | 
|  | 00fd88c259 | 5 years ago | 
|  | ed24593d5c | 5 years ago | 
|  | b77f795b3d | 5 years ago | 
|  | 2263780073 | 5 years ago | 
|  | cbb98f0ff5 | 5 years ago | 
|  | 165709991f | 5 years ago | 
|  | 6d6848ed94 | 5 years ago | 
|  | 0f335e154b | 5 years ago | 
|  | 23a99f6cd9 | 5 years ago | 
|  | dc5ff74a9e | 5 years ago | 
|  | 21d9d4215e | 6 years ago | 
|  | 46c743cb26 | 6 years ago | 
|  | 888ce12ddc | 6 years ago | 
|  | 32e71c030e | 6 years ago | 
|  | 946b6e8550 | 6 years ago | 
|  | d7a9bd8dd0 | 6 years ago | 
|  | 6dee0be157 | 6 years ago | 
|  | b68626587a | 6 years ago | 
|  | bd74ae12ce | 6 years ago | 
|  | 62210f4b88 | 6 years ago | 
|  | 76f489f8d2 | 6 years ago | 
|  | 4f4e977604 | 6 years ago | 
|  | 38d7641303 | 6 years ago | 
| @ -1,20 +0,0 @@ | ||||
| name: Android CI | ||||
| 
 | ||||
| on: | ||||
|   push: | ||||
|     branches: [ master ] | ||||
|   pull_request: | ||||
|     branches: [ master ] | ||||
| 
 | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
| 
 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - name: Set up JDK 1.8 | ||||
|         uses: actions/setup-java@v1 | ||||
|         with: | ||||
|           java-version: 1.8 | ||||
|       - name: Build with Gradle | ||||
|         run: ./gradlew build | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="100%" | ||||
|         android:toYDelta="0%" /> | ||||
| </set> | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="0%" | ||||
|         android:toYDelta="100%" /> | ||||
| </set> | ||||
| @ -1,7 +1,6 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <scale android:duration="200" | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="0.0" | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="-100%" | ||||
|         android:toXDelta="0%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0%" | ||||
|         android:toXDelta="-100%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,7 +1,6 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <scale android:duration="200" | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="1.0" | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="100%" | ||||
|         android:toXDelta="0%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0%" | ||||
|         android:toXDelta="100%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="0.0" | ||||
|         android:fromYScale="0.0" | ||||
|         android:toXScale="1.0" | ||||
|         android:toYScale="1.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="100%" | ||||
|         android:toYDelta="0%" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="1.0" | ||||
|         android:fromYScale="1.0" | ||||
|         android:toXScale="0.0" | ||||
|         android:toYScale="0.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="0%" | ||||
|         android:toYDelta="100%" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="0.0" | ||||
|         android:fromYScale="0.0" | ||||
|         android:toXScale="1.0" | ||||
|         android:toYScale="1.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="-100%" | ||||
|         android:toXDelta="0%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="1.0" | ||||
|         android:fromYScale="1.0" | ||||
|         android:toXScale="0.0" | ||||
|         android:toYScale="0.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0%" | ||||
|         android:toXDelta="-100%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="0.0" | ||||
|         android:fromYScale="0.0" | ||||
|         android:toXScale="1.0" | ||||
|         android:toYScale="1.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="100%" | ||||
|         android:toXDelta="0%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="1.0" | ||||
|         android:fromYScale="1.0" | ||||
|         android:toXScale="0.0" | ||||
|         android:toYScale="0.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0%" | ||||
|         android:toXDelta="100%" | ||||
|         android:fromYDelta="0" | ||||
|         android:toYDelta="0" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="0.0" | ||||
|         android:fromYScale="0.0" | ||||
|         android:toXScale="1.0" | ||||
|         android:toYScale="1.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="-100%" | ||||
|         android:toYDelta="0%" /> | ||||
| </set> | ||||
| @ -1,16 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <scale | ||||
|         android:pivotX="50%" | ||||
|         android:pivotY="50%" | ||||
|         android:fromXScale="1.0" | ||||
|         android:fromYScale="1.0" | ||||
|         android:toXScale="0.0" | ||||
|         android:toYScale="0.0"/> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="0%" | ||||
|         android:toYDelta="-100%" /> | ||||
| </set> | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="-100%" | ||||
|         android:toYDelta="0%" /> | ||||
| </set> | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <set xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:duration="200"> | ||||
|     <translate | ||||
|         android:fromXDelta="0" | ||||
|         android:toXDelta="0" | ||||
|         android:fromYDelta="0%" | ||||
|         android:toYDelta="-100%" /> | ||||
| </set> | ||||
| @ -1,13 +1,13 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
| 
 | ||||
|     <color name="colorAccent">#5588FF</color> | ||||
|     <color name="colorAccent">#FF4081</color> | ||||
| 
 | ||||
|     <color name="app_dialog_title_color">#333333</color> | ||||
|     <color name="app_dialog_content_color">#333333</color> | ||||
|     <color name="app_dialog_button_normal_color">#333333</color> | ||||
|     <color name="app_dialog_button_pressed_color">@color/colorAccent</color> | ||||
| 
 | ||||
|     <color name="app_dialog_line_color">#F2F2F2</color> | ||||
|     <color name="app_dialog_line_color">#f2f2f2</color> | ||||
| 
 | ||||
| </resources> | ||||
|  | ||||
| @ -1,25 +0,0 @@ | ||||
| package com.king.app.updater.notify; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| 
 | ||||
| import com.king.app.updater.UpdateConfig; | ||||
| 
 | ||||
| import java.io.File; | ||||
| 
 | ||||
| import androidx.annotation.DrawableRes; | ||||
| 
 | ||||
| /** | ||||
|  * @author <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||||
|  */ | ||||
| public interface INotification { | ||||
| 
 | ||||
|     void onStart(Context context, int notifyId, String channelId, String channelName, @DrawableRes int icon, CharSequence title, CharSequence content, boolean isVibrate, boolean isSound, boolean isCancelDownload); | ||||
| 
 | ||||
|     void onProgress(Context context, int notifyId, String channelId, @DrawableRes int icon, CharSequence title, CharSequence content, int progress, int size, boolean isCancelDownload); | ||||
| 
 | ||||
|     void onFinish(Context context, int notifyId, String channelId, @DrawableRes int icon, CharSequence title, CharSequence content, File file, String authority); | ||||
| 
 | ||||
|     void onError(Context context, int notifyId, String channelId, @DrawableRes int icon, CharSequence title, CharSequence content, boolean isReDownload, UpdateConfig config); | ||||
| 
 | ||||
|     void onCancel(Context context, int notifyId); | ||||
| } | ||||
| @ -1,38 +0,0 @@ | ||||
| package com.king.app.updater.notify; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| 
 | ||||
| import com.king.app.updater.UpdateConfig; | ||||
| import com.king.app.updater.util.NotificationUtils; | ||||
| 
 | ||||
| import java.io.File; | ||||
| 
 | ||||
| /** | ||||
|  * @author <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||||
|  */ | ||||
| public class NotificationImpl implements INotification { | ||||
|     @Override | ||||
|     public void onStart(Context context, int notifyId, String channelId, String channelName, int icon, CharSequence title, CharSequence content, boolean isVibrate, boolean isSound, boolean isCancelDownload) { | ||||
|         NotificationUtils.showStartNotification(context, notifyId, channelId, channelName, icon, title, content, isVibrate, isSound, isCancelDownload); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onProgress(Context context, int notifyId, String channelId, int icon, CharSequence title, CharSequence content, int progress, int size, boolean isCancelDownload) { | ||||
|         NotificationUtils.showProgressNotification(context, notifyId, channelId, icon, title, content, progress, size, isCancelDownload); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onFinish(Context context, int notifyId, String channelId, int icon, CharSequence title, CharSequence content, File file, String authority) { | ||||
|         NotificationUtils.showFinishNotification(context, notifyId, channelId, icon, title, content, file, authority); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onError(Context context, int notifyId, String channelId, int icon, CharSequence title, CharSequence content, boolean isReDownload, UpdateConfig config) { | ||||
|         NotificationUtils.showErrorNotification(context, notifyId, channelId, icon, title, content, isReDownload, config); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onCancel(Context context, int notifyId) { | ||||
|         NotificationUtils.cancelNotification(context, notifyId); | ||||
|     } | ||||
| } | ||||
| @ -1,316 +0,0 @@ | ||||
| /* | ||||
|  Copyright © 2015, 2016 Jenly Yu <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||||
| 
 | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
| 
 | ||||
|  	http://www.apache.org/licenses/LICENSE-2.0
 | ||||
| 
 | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
| 
 | ||||
|  */ | ||||
| package com.king.app.updater.util; | ||||
| 
 | ||||
| 
 | ||||
| import android.util.Log; | ||||
| 
 | ||||
| import java.util.Locale; | ||||
| 
 | ||||
| /** | ||||
|  * @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a> | ||||
|  */ | ||||
| public class LogUtils { | ||||
| 
 | ||||
|     public static final String TAG = "AppUpdater"; | ||||
| 
 | ||||
|     public static final String VERTICAL = "|"; | ||||
| 
 | ||||
|     /** 是否显示Log日志 */ | ||||
|     private static boolean isShowLog = true; | ||||
| 
 | ||||
|     /** Log日志优先权 */ | ||||
|     private static int priority = 1; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method;use System.out.println | ||||
|      */ | ||||
|     public static final int PRINTLN = 1; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method; use Log.v. | ||||
|      */ | ||||
|     public static final int VERBOSE = 2; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method; use Log.d. | ||||
|      */ | ||||
|     public static final int DEBUG = 3; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method; use Log.i. | ||||
|      */ | ||||
|     public static final int INFO = 4; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method; use Log.w. | ||||
|      */ | ||||
|     public static final int WARN = 5; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method; use Log.e. | ||||
|      */ | ||||
|     public static final int ERROR = 6; | ||||
| 
 | ||||
|     /** | ||||
|      * Priority constant for the println method.use Log.wtf. | ||||
|      */ | ||||
|     public static final int ASSERT = 7; | ||||
| 
 | ||||
|     public static final String TAG_FORMAT = "%s.%s(%s:%d)"; | ||||
| 
 | ||||
|     private LogUtils(){ | ||||
|         throw new AssertionError(); | ||||
|     } | ||||
| 
 | ||||
|     public static void setShowLog(boolean isShowLog) { | ||||
| 
 | ||||
|         LogUtils.isShowLog = isShowLog; | ||||
|     } | ||||
| 
 | ||||
|     public static boolean isShowLog() { | ||||
| 
 | ||||
|         return isShowLog; | ||||
|     } | ||||
| 
 | ||||
|     public static int getPriority() { | ||||
| 
 | ||||
|         return priority; | ||||
|     } | ||||
| 
 | ||||
|     public static void setPriority(int priority) { | ||||
| 
 | ||||
|         LogUtils.priority = priority; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据堆栈生成TAG | ||||
|      * @return TAG|className.methodName(fileName:lineNumber) | ||||
|      */ | ||||
|     private static String generateTag(StackTraceElement caller) { | ||||
|         String tag = TAG_FORMAT; | ||||
|         String callerClazzName = caller.getClassName(); | ||||
|         callerClazzName = callerClazzName.substring(callerClazzName.lastIndexOf(".") + 1); | ||||
|         tag = String.format(Locale.getDefault(),tag,callerClazzName, caller.getMethodName(),caller.getFileName(),caller.getLineNumber()); | ||||
|         return new StringBuilder().append(TAG).append(VERTICAL).append(tag).toString(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 获取堆栈 | ||||
|      * @param n | ||||
|      * 		n=0		VMStack | ||||
|      * 		n=1		Thread | ||||
|      * 		n=3		CurrentStack | ||||
|      * 		n=4		CallerStack | ||||
|      * 		... | ||||
|      * @return | ||||
|      */ | ||||
|     public static StackTraceElement getStackTraceElement(int n) { | ||||
|         return Thread.currentThread().getStackTrace()[n]; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 获取调用方的堆栈TAG | ||||
|      * @return | ||||
|      */ | ||||
|     private static String getCallerStackLogTag(){ | ||||
|         return generateTag(getStackTraceElement(5)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * | ||||
|      * @param t | ||||
|      * @return | ||||
|      */ | ||||
|     private static String getStackTraceString(Throwable t){ | ||||
|         return Log.getStackTraceString(t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.v
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.v | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void v(String msg) { | ||||
|         if (isShowLog && priority <= VERBOSE) | ||||
|             Log.v(getCallerStackLogTag(), String.valueOf(msg)); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public static void v(Throwable t) { | ||||
|         if (isShowLog && priority <= VERBOSE) | ||||
|             Log.v(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void v(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= VERBOSE) | ||||
|             Log.v(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.d
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.d | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void d(String msg) { | ||||
|         if (isShowLog && priority <= DEBUG) | ||||
|             Log.d(getCallerStackLogTag(), String.valueOf(msg)); | ||||
|     } | ||||
| 
 | ||||
|     public static void d(Throwable t) { | ||||
|         if (isShowLog && priority <= DEBUG) | ||||
|             Log.d(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void d(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= DEBUG) | ||||
|             Log.d(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.i
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.i | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void i(String msg) { | ||||
|         if (isShowLog && priority <= INFO) | ||||
|             Log.i(getCallerStackLogTag(), String.valueOf(msg)); | ||||
|     } | ||||
| 
 | ||||
|     public static void i(Throwable t) { | ||||
|         if (isShowLog && priority <= INFO) | ||||
|             Log.i(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void i(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= INFO) | ||||
|             Log.i(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.w
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.w | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void w(String msg) { | ||||
|         if (isShowLog && priority <= WARN) | ||||
|             Log.w(getCallerStackLogTag(), String.valueOf(msg)); | ||||
|     } | ||||
| 
 | ||||
|     public static void w(Throwable t) { | ||||
|         if (isShowLog && priority <= WARN) | ||||
|             Log.w(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void w(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= WARN) | ||||
|             Log.w(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.e
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.e | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void e(String msg) { | ||||
|         if (isShowLog && priority <= ERROR) | ||||
|             Log.e(getCallerStackLogTag(), String.valueOf(msg)); | ||||
|     } | ||||
| 
 | ||||
|     public static void e(Throwable t) { | ||||
|         if (isShowLog && priority <= ERROR) | ||||
|             Log.e(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void e(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= ERROR) | ||||
|             Log.e(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------Log.wtf
 | ||||
| 
 | ||||
|     /** | ||||
|      * Log.wtf | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void wtf(String msg) { | ||||
|         if (isShowLog && priority <= ASSERT) | ||||
|             Log.wtf(getCallerStackLogTag(), String.valueOf(msg)); | ||||
|     } | ||||
| 
 | ||||
|     public static void wtf(Throwable t) { | ||||
|         if (isShowLog && priority <= ASSERT) | ||||
|             Log.wtf(getCallerStackLogTag(), getStackTraceString(t)); | ||||
|     } | ||||
| 
 | ||||
|     public static void wtf(String msg,Throwable t) { | ||||
|         if (isShowLog && priority <= ASSERT) | ||||
|             Log.wtf(getCallerStackLogTag(), String.valueOf(msg), t); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------System.out.print
 | ||||
| 
 | ||||
|     /** | ||||
|      * System.out.print | ||||
|      * | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void print(String msg) { | ||||
|         if (isShowLog && priority <= PRINTLN) | ||||
|             System.out.print(msg); | ||||
|     } | ||||
| 
 | ||||
|     public static void print(Object obj) { | ||||
|         if (isShowLog && priority <= PRINTLN) | ||||
|             System.out.print(obj); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------System.out.printf
 | ||||
| 
 | ||||
|     /** | ||||
|      * System.out.printf | ||||
|      * | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void printf(String msg) { | ||||
|         if (isShowLog && priority <= PRINTLN) | ||||
|             System.out.printf(msg); | ||||
|     } | ||||
| 
 | ||||
|     // -----------------------------------System.out.println
 | ||||
| 
 | ||||
|     /** | ||||
|      * System.out.println | ||||
|      * | ||||
|      * @param msg | ||||
|      */ | ||||
|     public static void println(String msg) { | ||||
|         if (isShowLog && priority <= PRINTLN) | ||||
|             System.out.println(msg); | ||||
|     } | ||||
| 
 | ||||
|     public static void println(Object obj) { | ||||
|         if (isShowLog && priority <= PRINTLN) | ||||
|             System.out.println(obj); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
									
										Binary file not shown.
									
								
							
						| @ -1,18 +0,0 @@ | ||||
| { | ||||
|   "version": 2, | ||||
|   "artifactType": { | ||||
|     "type": "APK", | ||||
|     "kind": "Directory" | ||||
|   }, | ||||
|   "applicationId": "com.king.appupdater", | ||||
|   "variantName": "processReleaseResources", | ||||
|   "elements": [ | ||||
|     { | ||||
|       "type": "SINGLE", | ||||
|       "filters": [], | ||||
|       "versionCode": 22, | ||||
|       "versionName": "1.1.3", | ||||
|       "outputFile": "app-release.apk" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
| @ -0,0 +1 @@ | ||||
| [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":17,"versionName":"1.0.10","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] | ||||
| @ -1,5 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <item android:state_pressed="true" android:color="@color/text_666"/> | ||||
|     <item android:state_pressed="false" android:color="@color/text_999"/> | ||||
| </selector> | ||||
| @ -1,18 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
| 
 | ||||
|     <item android:state_pressed="false"> | ||||
|         <shape> | ||||
|             <solid android:color="@color/colorAccent"/> | ||||
|             <corners android:radius="20dp"/> | ||||
|         </shape> | ||||
|     </item> | ||||
| 
 | ||||
|     <item android:state_pressed="true"> | ||||
|         <shape> | ||||
|             <solid android:color="@color/colorPrimaryDark"/> | ||||
|             <corners android:radius="20dp"/> | ||||
|         </shape> | ||||
|     </item> | ||||
| 
 | ||||
| </selector> | ||||
| @ -1,25 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:orientation="horizontal" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:padding="16dp" | ||||
|     android:gravity="center_vertical" | ||||
|     android:background="@drawable/app_dialog_bg"> | ||||
|     <ImageView | ||||
|         android:id="@+id/ivIcon" | ||||
|         android:layout_width="30dp" | ||||
|         android:layout_height="30dp" | ||||
|         android:src="@mipmap/ic_launcher" | ||||
|         android:layout_marginRight="4dp"/> | ||||
|     <TextView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_centerVertical="true" | ||||
|         android:layout_toRightOf="@+id/ivIcon" | ||||
|         android:textSize="14sp" | ||||
|         android:textColor="@color/app_dialog_title_color" | ||||
|         android:text="@string/app_updater_start_notification_content"/> | ||||
| 
 | ||||
| </RelativeLayout> | ||||
| @ -1,43 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:orientation="horizontal" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:padding="16dp" | ||||
|     android:gravity="center_vertical" | ||||
|     android:background="@drawable/app_dialog_bg"> | ||||
|     <ImageView | ||||
|         android:id="@+id/ivIcon" | ||||
|         android:layout_width="20dp" | ||||
|         android:layout_height="20dp" | ||||
|         android:src="@mipmap/ic_launcher" | ||||
|         android:layout_marginRight="4dp"/> | ||||
|     <TextView | ||||
|         android:id="@+id/tvDialogTitle" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_toRightOf="@+id/ivIcon" | ||||
|         android:textSize="14sp" | ||||
|         android:textColor="@color/app_dialog_title_color" | ||||
|         android:text="@string/app_updater_progress_notification_title"/> | ||||
|     <TextView | ||||
|         android:id="@+id/tvProgress" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_below="@+id/tvDialogTitle" | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:text="@string/app_updater_start_notification_content" | ||||
|         android:textSize="14sp" | ||||
|         android:textColor="@color/app_dialog_content_color" | ||||
|         android:lineSpacingMultiplier="1.2" /> | ||||
|     <ProgressBar | ||||
|         android:id="@+id/progressBar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="6dp" | ||||
|         android:layout_marginTop="10dp" | ||||
|         android:layout_marginBottom="10dp" | ||||
|         android:max="100" | ||||
|         android:layout_below="@+id/tvProgress" | ||||
|         style="@style/Widget.AppCompat.ProgressBar.Horizontal"/> | ||||
| </RelativeLayout> | ||||
| @ -1,15 +1,10 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <color name="colorPrimary">#5588FF</color> | ||||
|     <color name="colorPrimaryDark">#4B7CFD</color> | ||||
|     <color name="colorAccent">#5588FF</color> | ||||
|     <color name="colorPrimary">#3F51B5</color> | ||||
|     <color name="colorPrimaryDark">#303F9F</color> | ||||
|     <color name="colorAccent">#FF4081</color> | ||||
| 
 | ||||
|     <color name="ic_launcher_background">#FFFFFF</color> | ||||
| 
 | ||||
|     <color name="white">#FFFFFF</color> | ||||
| 
 | ||||
|     <color name="text_666">#666666</color> | ||||
|     <color name="text_999">#999999</color> | ||||
| 
 | ||||
| 
 | ||||
| </resources> | ||||
|  | ||||
| @ -1,6 +1,4 @@ | ||||
| <resources> | ||||
|     <string name="app_name">AppUpdater</string> | ||||
| 
 | ||||
|     <string name="ignore">忽略</string> | ||||
| 
 | ||||
| </resources> | ||||
|  | ||||
| @ -1,34 +1,56 @@ | ||||
| //App | ||||
| def app_version = [:] | ||||
| app_version.versionCode = 22 | ||||
| app_version.versionName = "1.1.3" | ||||
| app_version.versionCode = 17 //androidx 18 | ||||
| app_version.versionName = "1.0.10" | ||||
| ext.app_version = app_version | ||||
| 
 | ||||
| //build version | ||||
| def build_versions = [:] | ||||
| build_versions.minSdk = 15 | ||||
| build_versions.targetSdk = 29 | ||||
| build_versions.compileSdk = 29 | ||||
| build_versions.buildTools = "29.0.3" | ||||
| build_versions.targetSdk = 28 | ||||
| build_versions.compileSdk = 28 | ||||
| build_versions.buildTools = "28.0.3" | ||||
| ext.build_versions = build_versions | ||||
| 
 | ||||
| // App dependencies | ||||
| def versions = [:] | ||||
| //support | ||||
| versions.supportLibrary = "28.0.0" | ||||
| versions.constraintLayout = "1.1.3" | ||||
| 
 | ||||
| versions.mavenPublish = '0.13.0' | ||||
| versions.gradle = "4.1.1" | ||||
| //test | ||||
| versions.junit = "4.12" | ||||
| versions.runner = "1.0.2" | ||||
| versions.espresso = "3.0.2" | ||||
| 
 | ||||
| versions.okhttp = "4.2.2" | ||||
| 
 | ||||
| ext.versions = versions | ||||
| 
 | ||||
| //androidx | ||||
| versions.appcompat = "1.1.0" | ||||
| versions.constraintLayout = "2.0.4" | ||||
| ext.deps = [:] | ||||
| 
 | ||||
| //support | ||||
| def support = [:] | ||||
| support.appcompat = "com.android.support:appcompat-v7:$versions.supportLibrary" | ||||
| support.constraintlayout = "com.android.support.constraint:constraint-layout:$versions.constraintLayout" | ||||
| deps.support = support | ||||
| 
 | ||||
| //test | ||||
| versions.junit = "1.2.0" | ||||
| versions.junit = "4.13.1" | ||||
| versions.androidExtJunit = "1.1.2" | ||||
| versions.espressoCore = "3.2.0" | ||||
| def test = [:] | ||||
| test.junit = "junit:junit:$versions.junit" | ||||
| test.runner = "com.android.support.test:runner:$versions.runner" | ||||
| test.espresso = "com.android.support.test.espresso:espresso-core:$versions.espresso" | ||||
| deps.test = test | ||||
| 
 | ||||
| versions.okhttp = "4.9.1" | ||||
| //okHttp | ||||
| deps.okhttp = "com.squareup.okhttp3:okhttp:$versions.okhttp" | ||||
| 
 | ||||
| ext.versions = versions | ||||
| 
 | ||||
| ext.deps = deps | ||||
| 
 | ||||
| def addRepos(RepositoryHandler handler) { | ||||
|     handler.google() | ||||
|     handler.mavenCentral() | ||||
|     handler.jcenter() | ||||
| } | ||||
| ext.addRepos = this.&addRepos | ||||
					Loading…
					
					
				
		Reference in new issue