Compare commits
41 Commits
Author | SHA1 | Date |
---|---|---|
Jenly | 3dfb90809a | 3 years ago |
Jenly | 7f23dfb4ef | 3 years ago |
Jenly | 08e5c8fbb6 | 3 years ago |
Jenly | ac88d07c1b | 3 years ago |
Jenly | 4ee839fe2c | 3 years ago |
Jenly | 1bf77be43a | 3 years ago |
Jenly | 5c848ee830 | 3 years ago |
Jenly | 5183b3b9fe | 3 years ago |
Jenly | 9a426841c9 | 3 years ago |
Jenly | 09972ded00 | 3 years ago |
Jenly | 5139dfbfff | 3 years ago |
Jenly | 41a1f88d33 | 3 years ago |
Jenly | ff6eca1ab2 | 3 years ago |
Jenly | e93a677d1b | 4 years ago |
Jenly | 3ee62c3b32 | 4 years ago |
Jenly | 727cd08b98 | 4 years ago |
Jenly | 898b3912b6 | 4 years ago |
Jenly | 3a685c958f | 4 years ago |
Jenly | 2677d67d70 | 4 years ago |
Jenly | b5832c92da | 4 years ago |
Jenly | 6d04cf4575 | 4 years ago |
Jenly | 372b1ad30f | 4 years ago |
Jenly | d2874564d7 | 4 years ago |
Jenly | dbfbac55de | 4 years ago |
Jenly | d3a759374c | 4 years ago |
Jenly | 5c1c0c1ad6 | 4 years ago |
Jenly | 2d56132692 | 4 years ago |
jenly1314 | 8e657d1ecb | 5 years ago |
jenly1314 | 636e202e2f | 5 years ago |
jenly1314 | e38db4de11 | 5 years ago |
Jenly | 69a93148a2 | 5 years ago |
jenly1314 | 3838ad6685 | 5 years ago |
jenly1314 | d29c1348ad | 5 years ago |
jenly1314 | 82a9b36a7d | 5 years ago |
jenly1314 | a10687ad07 | 5 years ago |
jenly1314 | 0a7e40dfce | 5 years ago |
jenly1314 | ea8f2603a8 | 5 years ago |
jenly1314 | 0a8de018b8 | 5 years ago |
jenly1314 | 4eee3649c9 | 5 years ago |
jenly1314 | ef8b918f1f | 5 years ago |
jenly1314 | 55e92e5f17 | 5 years ago |
@ -0,0 +1,20 @@ |
||||
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 |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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,6 +1,7 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<scale android:duration="200" |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:duration="200"> |
||||
<scale |
||||
android:pivotX="50%" |
||||
android:pivotY="50%" |
||||
android:fromXScale="0.0" |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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,6 +1,7 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<scale android:duration="200" |
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:duration="200"> |
||||
<scale |
||||
android:pivotX="50%" |
||||
android:pivotY="50%" |
||||
android:fromXScale="1.0" |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,16 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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> |
@ -0,0 +1,9 @@ |
||||
<?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">#FF4081</color> |
||||
<color name="colorAccent">#5588FF</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> |
||||
|
@ -0,0 +1,25 @@ |
||||
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); |
||||
} |
@ -0,0 +1,38 @@ |
||||
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); |
||||
} |
||||
} |
@ -0,0 +1,316 @@ |
||||
/* |
||||
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.
@ -0,0 +1,18 @@ |
||||
{ |
||||
"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" |
||||
} |
||||
] |
||||
} |
@ -1 +0,0 @@ |
||||
[{"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":{}}] |
@ -0,0 +1,5 @@ |
||||
<?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> |
@ -0,0 +1,18 @@ |
||||
<?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> |
@ -0,0 +1,25 @@ |
||||
<?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> |
@ -0,0 +1,43 @@ |
||||
<?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,10 +1,15 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<color name="colorPrimary">#3F51B5</color> |
||||
<color name="colorPrimaryDark">#303F9F</color> |
||||
<color name="colorAccent">#FF4081</color> |
||||
<color name="colorPrimary">#5588FF</color> |
||||
<color name="colorPrimaryDark">#4B7CFD</color> |
||||
<color name="colorAccent">#5588FF</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,4 +1,6 @@ |
||||
<resources> |
||||
<string name="app_name">AppUpdater</string> |
||||
|
||||
<string name="ignore">忽略</string> |
||||
|
||||
</resources> |
||||
|
@ -1,56 +1,34 @@ |
||||
//App |
||||
def app_version = [:] |
||||
app_version.versionCode = 17 //androidx 18 |
||||
app_version.versionName = "1.0.10" |
||||
app_version.versionCode = 22 |
||||
app_version.versionName = "1.1.3" |
||||
ext.app_version = app_version |
||||
|
||||
//build version |
||||
def build_versions = [:] |
||||
build_versions.minSdk = 15 |
||||
build_versions.targetSdk = 28 |
||||
build_versions.compileSdk = 28 |
||||
build_versions.buildTools = "28.0.3" |
||||
build_versions.targetSdk = 29 |
||||
build_versions.compileSdk = 29 |
||||
build_versions.buildTools = "29.0.3" |
||||
ext.build_versions = build_versions |
||||
|
||||
// App dependencies |
||||
def versions = [:] |
||||
//support |
||||
versions.supportLibrary = "28.0.0" |
||||
versions.constraintLayout = "1.1.3" |
||||
|
||||
//test |
||||
versions.junit = "4.12" |
||||
versions.runner = "1.0.2" |
||||
versions.espresso = "3.0.2" |
||||
|
||||
versions.okhttp = "4.2.2" |
||||
|
||||
ext.versions = versions |
||||
versions.mavenPublish = '0.13.0' |
||||
versions.gradle = "4.1.1" |
||||
|
||||
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 |
||||
//androidx |
||||
versions.appcompat = "1.1.0" |
||||
versions.constraintLayout = "2.0.4" |
||||
|
||||
//test |
||||
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 |
||||
|
||||
//okHttp |
||||
deps.okhttp = "com.squareup.okhttp3:okhttp:$versions.okhttp" |
||||
versions.junit = "1.2.0" |
||||
versions.junit = "4.13.1" |
||||
versions.androidExtJunit = "1.1.2" |
||||
versions.espressoCore = "3.2.0" |
||||
|
||||
versions.okhttp = "4.9.1" |
||||
|
||||
ext.deps = deps |
||||
ext.versions = versions |
||||
|
||||
def addRepos(RepositoryHandler handler) { |
||||
handler.google() |
||||
handler.mavenCentral() |
||||
handler.jcenter() |
||||
} |
||||
ext.addRepos = this.&addRepos |
Loading…
Reference in new issue