diff --git a/app/build.gradle b/app/build.gradle
index efe4f43..7749e31 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,7 +16,7 @@ android {
buildToolsVersion "30.0.1"
defaultConfig {
- applicationId "com.tt.ttutils"
+ applicationId "com.ttstd.ttutils"
//https://github.com/flutter/flutter/issues/58758
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 26
@@ -46,9 +46,6 @@ android {
manifestPlaceholders = [
XG_ACCESS_ID : "1500026407",
XG_ACCESS_KEY: "AQ6C6W1O19LT",
- JPUSH_PKGNAME: applicationId,
- JPUSH_APPKEY : "731637f412deca8540a1f873", //JPush 上注册的包名对应的 Appkey.
- JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
]
}
@@ -157,6 +154,24 @@ android {
v2SigningEnabled true
}
+ zhanruiG10Z {
+ storeFile file("keystore/zhanruiG10Z.keystore")
+ storePassword "123456"
+ keyAlias "zhanruiG10Z"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ zhanRui12 {
+ storeFile file("keystore/zhanrui12.jks")
+ storePassword "123456"
+ keyAlias "zhanrui12"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
own {
storeFile file("keystore/tt.jks")
storePassword "fht19961207"
@@ -166,7 +181,7 @@ android {
v2SigningEnabled true
}
- G10P{
+ G10P {
storeFile file("keystore/G10PMTK11.jks")
storePassword "123456"
keyAlias "G10PMTK11"
@@ -175,7 +190,16 @@ android {
v2SigningEnabled true
}
- G10PUserDebug{
+ G11Userdebug {
+ storeFile file("keystore/G11Userdebug.keystore")
+ storePassword "123456"
+ keyAlias "G11Userdebug"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ G10PUserDebug {
storeFile file("keystore/G10PUserDebug.jks")
storePassword "123456"
keyAlias "G10PUserDebug"
@@ -184,7 +208,7 @@ android {
v2SigningEnabled true
}
- Teclast8515{
+ Teclast8515 {
storeFile file("keystore/Teclast8515.keystore")
storePassword "123456"
keyAlias "Teclast8515"
@@ -201,9 +225,101 @@ android {
v1SigningEnabled true
v2SigningEnabled true
}
+
+ U807 {
+ storeFile file("keystore/AllwinnerU807.jks")
+ storePassword "123456"
+ keyAlias "u807"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ UnisocS6688 {
+ storeFile file("keystore/UnisocS6688Userdebug.jks")
+ storePassword "123456"
+ keyAlias "unisocs6688userdebug"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ iPlay50P {
+ storeFile file("keystore/iPlay50P.jks")
+ storePassword "123456"
+ keyAlias "iplay50p"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
+
+ Huaruian8768 {
+ storeFile file("keystore/Huaruian8768.jks")
+ storePassword "123456"
+ keyAlias "Huaruian8768"
+ keyPassword "123456"
+ v1SigningEnabled true
+ v2SigningEnabled true
+ }
}
buildTypes {
+ Huaruian8768Debug.initWith(debug)
+ Huaruian8768Debug {
+ versionNameSuffix "-debug"
+ debuggable true
+ signingConfig signingConfigs.Huaruian8768
+ buildConfigField "String", "platform", '"MT8768"'
+ }
+
+ Huaruian8768Release.initWith(release)
+ Huaruian8768Release {
+ signingConfig signingConfigs.Huaruian8768
+ buildConfigField "String", "platform", '"MT8768"'
+ }
+
+ iPlay50PDebug.initWith(debug)
+ iPlay50PDebug {
+ buildConfigField "String", "platform", '"T1102"'
+ versionNameSuffix "-debug"
+ debuggable true
+ signingConfig signingConfigs.iPlay50P
+ }
+
+ iPlay50PRelease.initWith(release)
+ iPlay50PRelease {
+ buildConfigField "String", "platform", '"T1102"'
+ signingConfig signingConfigs.iPlay50P
+ }
+
+ UnisocS6688Debug.initWith(debug)
+ UnisocS6688Debug {
+ buildConfigField "String", "platform", '"S6688"'
+ versionNameSuffix "-debug"
+ debuggable true
+ signingConfig signingConfigs.UnisocS6688
+ }
+
+ UnisocS6688Release.initWith(release)
+ UnisocS6688Release {
+ buildConfigField "String", "platform", '"S6688"'
+ signingConfig signingConfigs.UnisocS6688
+ }
+
+ U807Debug.initWith(debug)
+ U807Debug {
+ buildConfigField "String", "platform", '"U807"'
+ versionNameSuffix "-debug"
+ debuggable true
+ signingConfig signingConfigs.U807
+ }
+
+ U807Release.initWith(release)
+ U807Release {
+ buildConfigField "String", "platform", '"U807"'
+ signingConfig signingConfigs.U807
+ }
+
tuiXinDebug.initWith(debug)
tuiXinDebug {
versionNameSuffix "-debug"
@@ -254,6 +370,14 @@ android {
buildConfigField "String", "platform", '"MTK11"'
}
+ G11Userdebug.initWith(debug)
+ G11Userdebug {
+ versionNameSuffix "-debug"
+ debuggable true
+ signingConfig signingConfigs.G11Userdebug
+ buildConfigField "String", "platform", '"G10P"'
+ }
+
G10PUserDebug.initWith(debug)
G10PUserDebug {
versionNameSuffix "-debug"
@@ -290,6 +414,20 @@ android {
signingConfig signingConfigs.P20S
}
+ zhanruiG10ZDebug.initWith(debug)
+ zhanruiG10ZDebug {
+ versionNameSuffix "-debug"
+ debuggable true
+ buildConfigField "String", "platform", '"ZR6016"'
+ signingConfig signingConfigs.zhanruiG10Z
+ }
+
+ zhanruiG10ZRelease.initWith(release)
+ zhanruiG10ZRelease {
+ buildConfigField "String", "platform", '"ZR6016"'
+ signingConfig signingConfigs.zhanruiG10Z
+ }
+
zhanRuiDebug.initWith(debug)
zhanRuiDebug {
versionNameSuffix "-debug"
@@ -313,6 +451,20 @@ android {
signingConfig signingConfigs.zhanRuiUserdebug
}
+ zhanRui12Debug.initWith(debug)
+ zhanRui12Debug {
+ debuggable true
+ versionNameSuffix "-debug"
+ buildConfigField "String", "platform", '"AH6016"'
+ signingConfig signingConfigs.zhanRui12
+ }
+
+ zhanRui12Release.initWith(release)
+ zhanRui12Release {
+ buildConfigField "String", "platform", '"AH6016"'
+ signingConfig signingConfigs.zhanRui12
+ }
+
debug {
buildConfigField "String", "platform", '"MTK"'
// 不显示Log
@@ -328,7 +480,7 @@ android {
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
- def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
+ def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
output.outputFileName = fileName
}
}
@@ -350,7 +502,7 @@ android {
variant.outputs.each { output ->
def outputFile = ""
if (outputFile != null) {
- def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${productFlavors[0].name}-${buildType.name}.apk"
+ def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${productFlavors[0].name}_${buildType.name}.apk"
output.outputFileName = fileName
}
}
@@ -393,24 +545,22 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
////三方
- //极光推送
- implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.7.0 版本为例。
- implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.4.2 版本为例。
//RxJava
-// implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
-// implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version)
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
+
//rxlifecycle
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
+
//okhttp
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.moshi:moshi:1.9.3'
@@ -438,6 +588,8 @@ dependencies {
//MMKV
implementation 'com.tencent:mmkv-static:1.2.13'
+ //Bugly
+ implementation 'com.tencent.bugly:crashreport:4.0.0'
//腾讯移动推送 TPNS
implementation 'com.tencent.tpns:tpns:1.2.2.0-release'
diff --git a/app/keystore/AllwinnerU807.jks b/app/keystore/AllwinnerU807.jks
new file mode 100644
index 0000000..c8d68c5
Binary files /dev/null and b/app/keystore/AllwinnerU807.jks differ
diff --git a/app/keystore/G11Userdebug.keystore b/app/keystore/G11Userdebug.keystore
new file mode 100644
index 0000000..d3be293
Binary files /dev/null and b/app/keystore/G11Userdebug.keystore differ
diff --git a/app/keystore/Huaruian8768.jks b/app/keystore/Huaruian8768.jks
new file mode 100644
index 0000000..80bf674
Binary files /dev/null and b/app/keystore/Huaruian8768.jks differ
diff --git a/app/keystore/UnisocS6688Userdebug.jks b/app/keystore/UnisocS6688Userdebug.jks
new file mode 100644
index 0000000..07f2a13
Binary files /dev/null and b/app/keystore/UnisocS6688Userdebug.jks differ
diff --git a/app/keystore/iPlay50P.jks b/app/keystore/iPlay50P.jks
new file mode 100644
index 0000000..496ef8d
Binary files /dev/null and b/app/keystore/iPlay50P.jks differ
diff --git a/app/keystore/zhanrui12.jks b/app/keystore/zhanrui12.jks
new file mode 100644
index 0000000..584d145
Binary files /dev/null and b/app/keystore/zhanrui12.jks differ
diff --git a/app/keystore/zhanruiG10Z.keystore b/app/keystore/zhanruiG10Z.keystore
new file mode 100644
index 0000000..fb9b0bb
Binary files /dev/null and b/app/keystore/zhanruiG10Z.keystore differ
diff --git a/app/src/androidTest/java/com/ttstd/ttutils/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/ttstd/ttutils/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..d6599ca
--- /dev/null
+++ b/app/src/androidTest/java/com/ttstd/ttutils/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.ttstd.ttutils
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.ttstd.ttutils", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c925a1e..a554630 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,96 +1,100 @@
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -102,7 +106,7 @@
@@ -131,69 +135,27 @@
-
+
+
+
+
+
+
-
-
-
+ android:required="false" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -201,165 +163,18 @@
-
-
+
+
-
+ android:value="1500026407" />
+
-
-
-
-
+ android:value="AQ6C6W1O19LT" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -367,5 +182,4 @@
android:name="design_height_in_dp"
android:value="1024" />
-
\ No newline at end of file
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/ExampleUtil.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/ExampleUtil.java
deleted file mode 100644
index ee65389..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/ExampleUtil.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.os.Looper;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
-import android.widget.Toast;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import cn.jpush.android.api.JPushInterface;
-
-public class ExampleUtil {
- public static final String PREFS_NAME = "JPUSH_EXAMPLE";
- public static final String PREFS_DAYS = "JPUSH_EXAMPLE_DAYS";
- public static final String PREFS_START_TIME = "PREFS_START_TIME";
- public static final String PREFS_END_TIME = "PREFS_END_TIME";
- public static final String KEY_APP_KEY = "JPUSH_APPKEY";
-
- public static boolean isEmpty(String s) {
- if (null == s)
- return true;
- if (s.length() == 0)
- return true;
- if (s.trim().length() == 0)
- return true;
- return false;
- }
- /**
- * 只能以 “+” 或者 数字开头;后面的内容只能包含 “-” 和 数字。
- * */
- private final static String MOBILE_NUMBER_CHARS = "^[+0-9][-0-9]{1,}$";
- public static boolean isValidMobileNumber(String s) {
- if(TextUtils.isEmpty(s)) return true;
- Pattern p = Pattern.compile(MOBILE_NUMBER_CHARS);
- Matcher m = p.matcher(s);
- return m.matches();
- }
- // 校验Tag Alias 只能是数字,英文字母和中文
- public static boolean isValidTagAndAlias(String s) {
- Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$");
- Matcher m = p.matcher(s);
- return m.matches();
- }
-
- // 取得AppKey
- public static String getAppKey(Context context) {
- Bundle metaData = null;
- String appKey = null;
- try {
- ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
- context.getPackageName(), PackageManager.GET_META_DATA);
- if (null != ai)
- metaData = ai.metaData;
- if (null != metaData) {
- appKey = metaData.getString(KEY_APP_KEY);
- if ((null == appKey) || appKey.length() != 24) {
- appKey = null;
- }
- }
- } catch (NameNotFoundException e) {
-
- }
- return appKey;
- }
-
- // 取得版本号
- public static String GetVersion(Context context) {
- try {
- PackageInfo manager = context.getPackageManager().getPackageInfo(
- context.getPackageName(), 0);
- return manager.versionName;
- } catch (NameNotFoundException e) {
- return "Unknown";
- }
- }
-
- public static void showToast(final String toast, final Context context)
- {
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- Looper.prepare();
- Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
- Looper.loop();
- }
- }).start();
- }
-
- public static boolean isConnected(Context context) {
- ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo info = conn.getActiveNetworkInfo();
- return (info != null && info.isConnected());
- }
-
- public static String getImei(Context context, String imei) {
- String ret = null;
- try {
- TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- ret = telephonyManager.getDeviceId();
- } catch (Exception e) {
- Logger.e(ExampleUtil.class.getSimpleName(), e.getMessage());
- }
- if (isReadableASCII(ret)){
- return ret;
- } else {
- return imei;
- }
- }
-
- private static boolean isReadableASCII(CharSequence string){
- if (TextUtils.isEmpty(string)) return false;
- try {
- Pattern p = Pattern.compile("[\\x20-\\x7E]+");
- return p.matcher(string).matches();
- } catch (Throwable e){
- return true;
- }
- }
-
- public static String getDeviceId(Context context) {
- return JPushInterface.getUdid(context);
- }
-}
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/LocalBroadcastManager.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/LocalBroadcastManager.java
deleted file mode 100644
index d67c714..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/LocalBroadcastManager.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Message;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Set;
-
-/**
- * Created by efan on 2017/4/14.
- */
-
-public final class LocalBroadcastManager {
- private static final String TAG = "JIGUANG-Example";
- private static final boolean DEBUG = false;
- private final Context mAppContext;
- private final HashMap> mReceivers = new HashMap>();
- private final HashMap> mActions = new HashMap> ();
- private final ArrayList mPendingBroadcasts = new ArrayList();
- static final int MSG_EXEC_PENDING_BROADCASTS = 1;
- private final Handler mHandler;
- private static final Object mLock = new Object();
- private static LocalBroadcastManager mInstance;
-
- public static LocalBroadcastManager getInstance(Context context) {
- Object var1 = mLock;
- synchronized (mLock) {
- if (mInstance == null) {
- mInstance = new LocalBroadcastManager(context.getApplicationContext());
- }
-
- return mInstance;
- }
- }
-
- private LocalBroadcastManager(Context context) {
- this.mAppContext = context;
- this.mHandler = new Handler(context.getMainLooper()) {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- LocalBroadcastManager.this.executePendingBroadcasts();
- break;
- default:
- super.handleMessage(msg);
- }
-
- }
- };
- }
-
- public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
- HashMap var3 = this.mReceivers;
- synchronized (this.mReceivers) {
- ReceiverRecord entry = new ReceiverRecord(filter, receiver);
- ArrayList filters = (ArrayList) this.mReceivers.get(receiver);
- if (filters == null) {
- filters = new ArrayList(1);
- this.mReceivers.put(receiver, filters);
- }
-
- filters.add(filter);
-
- for (int i = 0; i < filter.countActions(); ++i) {
- String action = filter.getAction(i);
- ArrayList entries = (ArrayList) this.mActions.get(action);
- if (entries == null) {
- entries = new ArrayList(1);
- this.mActions.put(action, entries);
- }
-
- entries.add(entry);
- }
-
- }
- }
-
- public void unregisterReceiver(BroadcastReceiver receiver) {
- HashMap var2 = this.mReceivers;
- synchronized (this.mReceivers) {
- ArrayList filters = (ArrayList) this.mReceivers.remove(receiver);
- if (filters != null) {
- for (int i = 0; i < filters.size(); ++i) {
- IntentFilter filter = (IntentFilter) filters.get(i);
-
- for (int j = 0; j < filter.countActions(); ++j) {
- String action = filter.getAction(j);
- ArrayList receivers = (ArrayList) this.mActions.get(action);
- if (receivers != null) {
- for (int k = 0; k < receivers.size(); ++k) {
- if (((ReceiverRecord) receivers.get(k)).receiver == receiver) {
- receivers.remove(k);
- --k;
- }
- }
-
- if (receivers.size() <= 0) {
- this.mActions.remove(action);
- }
- }
- }
- }
-
- }
- }
- }
-
- public boolean sendBroadcast(Intent intent) {
- HashMap var2 = this.mReceivers;
- synchronized (this.mReceivers) {
- String action = intent.getAction();
- String type = intent.resolveTypeIfNeeded(this.mAppContext.getContentResolver());
- Uri data = intent.getData();
- String scheme = intent.getScheme();
- Set categories = intent.getCategories();
- boolean debug = (intent.getFlags() & 8) != 0;
- if (debug) {
- Logger.v("LocalBroadcastManager", "Resolving type " + type + " scheme " + scheme + " of intent " + intent);
- }
-
- ArrayList entries = (ArrayList) this.mActions.get(intent.getAction());
- if (entries != null) {
- if (debug) {
- Logger.v("LocalBroadcastManager", "Action list: " + entries);
- }
-
- ArrayList receivers = null;
-
- int i;
- for (i = 0; i < entries.size(); ++i) {
- ReceiverRecord receiver = (ReceiverRecord) entries.get(i);
- if (debug) {
- Logger.v("LocalBroadcastManager", "Matching against filter " + receiver.filter);
- }
-
- if (receiver.broadcasting) {
- if (debug) {
- Logger.v("LocalBroadcastManager", " Filter\'s target already added");
- }
- } else {
- int match = receiver.filter.match(action, type, scheme, data, categories, "LocalBroadcastManager");
- if (match >= 0) {
- if (debug) {
- Logger.v("LocalBroadcastManager", " Filter matched! match=0x" + Integer.toHexString(match));
- }
-
- if (receivers == null) {
- receivers = new ArrayList();
- }
-
- receivers.add(receiver);
- receiver.broadcasting = true;
- } else if (debug) {
- String reason;
- switch (match) {
- case -4:
- reason = "category";
- break;
- case -3:
- reason = "action";
- break;
- case -2:
- reason = "data";
- break;
- case -1:
- reason = "type";
- break;
- default:
- reason = "unknown reason";
- }
-
- Logger.v("LocalBroadcastManager", " Filter did not match: " + reason);
- }
- }
- }
-
- if (receivers != null) {
- for (i = 0; i < receivers.size(); ++i) {
- ((ReceiverRecord) receivers.get(i)).broadcasting = false;
- }
-
- this.mPendingBroadcasts.add(new BroadcastRecord(intent, receivers));
- if (!this.mHandler.hasMessages(1)) {
- this.mHandler.sendEmptyMessage(1);
- }
-
- return true;
- }
- }
-
- return false;
- }
- }
-
- public void sendBroadcastSync(Intent intent) {
- if (this.sendBroadcast(intent)) {
- this.executePendingBroadcasts();
- }
-
- }
-
- private void executePendingBroadcasts() {
- while (true) {
- BroadcastRecord[] brs = null;
- HashMap i = this.mReceivers;
- synchronized (this.mReceivers) {
- int br = this.mPendingBroadcasts.size();
- if (br <= 0) {
- return;
- }
-
- brs = new BroadcastRecord[br];
- this.mPendingBroadcasts.toArray(brs);
- this.mPendingBroadcasts.clear();
- }
-
- for (int var6 = 0; var6 < brs.length; ++var6) {
- BroadcastRecord var7 = brs[var6];
-
- for (int j = 0; j < var7.receivers.size(); ++j) {
- ((ReceiverRecord) var7.receivers.get(j)).receiver.onReceive(this.mAppContext, var7.intent);
- }
- }
- }
- }
-
- private static class BroadcastRecord {
- final Intent intent;
- final ArrayList receivers;
-
- BroadcastRecord(Intent _intent, ArrayList _receivers) {
- this.intent = _intent;
- this.receivers = _receivers;
- }
- }
-
- private static class ReceiverRecord {
- final IntentFilter filter;
- final BroadcastReceiver receiver;
- boolean broadcasting;
-
- ReceiverRecord(IntentFilter _filter, BroadcastReceiver _receiver) {
- this.filter = _filter;
- this.receiver = _receiver;
- }
-
- public String toString() {
- StringBuilder builder = new StringBuilder(128);
- builder.append("Receiver{");
- builder.append(this.receiver);
- builder.append(" filter=");
- builder.append(this.filter);
- builder.append("}");
- return builder.toString();
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/Logger.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/Logger.java
deleted file mode 100644
index 8706565..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/Logger.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.util.Log;
-
-import com.tt.ttutils.BuildConfig;
-
-/**
- * Created by efan on 2017/4/13.
- */
-
-public class Logger {
-
- //设为false关闭日志
- private static final boolean LOG_ENABLE = BuildConfig.DEBUG;
-
- public static void i(String tag, String msg){
- if (LOG_ENABLE){
- Log.i(tag, msg);
- }
- }
- public static void v(String tag, String msg){
- if (LOG_ENABLE){
- Log.v(tag, msg);
- }
- }
- public static void d(String tag, String msg){
- if (LOG_ENABLE){
- Log.d(tag, msg);
- }
- }
- public static void w(String tag, String msg){
- if (LOG_ENABLE){
- Log.w(tag, msg);
- }
- }
- public static void e(String tag, String msg){
- if (LOG_ENABLE){
- Log.e(tag, msg);
- }
- }
-
-}
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/MyReceiver.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/MyReceiver.java
deleted file mode 100644
index 8947fe7..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/MyReceiver.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.text.TextUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.Iterator;
-
-import cn.jpush.android.api.JPushInterface;
-
-/**
- * 自定义接收器
- *
- * 如果不定义这个 Receiver,则:
- * 1) 默认用户会打开主界面
- * 2) 接收不到自定义消息
- */
-public class MyReceiver extends BroadcastReceiver {
- private static final String TAG = "JIGUANG-Example";
-
- @Override
- public void onReceive(Context context, Intent intent) {
- try {
- Bundle bundle = intent.getExtras();
- Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
-
- if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
- String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
- Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
- //send the Registration Id to your server...
-
- } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
- Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
-// processCustomMessage(context, bundle);
-
- } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
- Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
- int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
- Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
-
- } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
- Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
-
- //打开自定义的Activity
- Intent i = new Intent(context, TestActivity.class);
- i.putExtras(bundle);
- //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
- context.startActivity(i);
-
- } else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
- boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
- Logger.w(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
- } else {
- Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
- }
- } catch (Exception e){
-
- }
-
- }
-
- // 打印所有的 intent extra 数据
- private static String printBundle(Bundle bundle) {
- StringBuilder sb = new StringBuilder();
- for (String key : bundle.keySet()) {
- if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
- sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
- }else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
- sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
- } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
- if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
- Logger.i(TAG, "This message has no Extra data");
- continue;
- }
-
- try {
- JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
- Iterator it = json.keys();
-
- while (it.hasNext()) {
- String myKey = it.next();
- sb.append("\nkey:" + key + ", value: [" +
- myKey + " - " +json.optString(myKey) + "]");
- }
- } catch (JSONException e) {
- Logger.e(TAG, "Get message extra JSON error!");
- }
-
- } else {
- sb.append("\nkey:" + key + ", value:" + bundle.get(key));
- }
- }
- return sb.toString();
- }
-
- //send msg to MainActivity
-// private void processCustomMessage(Context context, Bundle bundle) {
-// if (MainActivity.isForeground) {
-// String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
-// String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
-// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
-// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
-// if (!ExampleUtil.isEmpty(extras)) {
-// try {
-// JSONObject extraJson = new JSONObject(extras);
-// if (extraJson.length() > 0) {
-// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
-// }
-// } catch (JSONException e) {
-//
-// }
-//
-// }
-// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
-// }
-// }
-}
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushMessageReceiver.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushMessageReceiver.java
deleted file mode 100644
index 72cbf95..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushMessageReceiver.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-import cn.jpush.android.api.CmdMessage;
-import cn.jpush.android.api.CustomMessage;
-import cn.jpush.android.api.JPushInterface;
-import cn.jpush.android.api.JPushMessage;
-import cn.jpush.android.api.NotificationMessage;
-import cn.jpush.android.service.JPushMessageReceiver;
-
-public class PushMessageReceiver extends JPushMessageReceiver{
- private static final String TAG = "PushMessageReceiver";
- @Override
- public void onMessage(Context context, CustomMessage customMessage) {
- Log.e(TAG,"[onMessage] "+customMessage);
-// processCustomMessage(context,customMessage);
- }
-
- @Override
- public void onNotifyMessageOpened(Context context, NotificationMessage message) {
- Log.e(TAG,"[onNotifyMessageOpened] "+message);
- try{
- //打开自定义的Activity
- Intent i = new Intent(context, TestActivity.class);
- Bundle bundle = new Bundle();
- bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE,message.notificationTitle);
- bundle.putString(JPushInterface.EXTRA_ALERT,message.notificationContent);
- i.putExtras(bundle);
- //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
- context.startActivity(i);
- }catch (Throwable throwable){
-
- }
- }
-
- @Override
- public void onMultiActionClicked(Context context, Intent intent) {
- Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮");
- String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA);
-
- //开发者根据不同 Action 携带的 extra 字段来分配不同的动作。
- if(nActionExtra==null){
- Log.d(TAG,"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null");
- return;
- }
- if (nActionExtra.equals("my_extra1")) {
- Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一");
- } else if (nActionExtra.equals("my_extra2")) {
- Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二");
- } else if (nActionExtra.equals("my_extra3")) {
- Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三");
- } else {
- Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义");
- }
- }
-
- @Override
- public void onNotifyMessageArrived(Context context, NotificationMessage message) {
- Log.e(TAG,"[onNotifyMessageArrived] "+message);
- }
-
- @Override
- public void onNotifyMessageDismiss(Context context, NotificationMessage message) {
- Log.e(TAG,"[onNotifyMessageDismiss] "+message);
- }
-
- @Override
- public void onRegister(Context context, String registrationId) {
- Log.e(TAG,"[onRegister] "+registrationId);
- }
-
- @Override
- public void onConnected(Context context, boolean isConnected) {
- Log.e(TAG,"[onConnected] "+isConnected);
- }
-
- @Override
- public void onCommandResult(Context context, CmdMessage cmdMessage) {
- Log.e(TAG,"[onCommandResult] "+cmdMessage);
- }
-
- @Override
- public void onTagOperatorResult(Context context,JPushMessage jPushMessage) {
- TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage);
- super.onTagOperatorResult(context, jPushMessage);
- }
- @Override
- public void onCheckTagOperatorResult(Context context,JPushMessage jPushMessage){
- TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage);
- super.onCheckTagOperatorResult(context, jPushMessage);
- }
- @Override
- public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
- TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage);
- super.onAliasOperatorResult(context, jPushMessage);
- }
-
- @Override
- public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
- TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
- super.onMobileNumberOperatorResult(context, jPushMessage);
- }
-
- //send msg to MainActivity
-// private void processCustomMessage(Context context, CustomMessage customMessage) {
-// if (MainActivity.isForeground) {
-// String message = customMessage.message;
-// String extras = customMessage.extra;
-// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
-// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
-// if (!ExampleUtil.isEmpty(extras)) {
-// try {
-// JSONObject extraJson = new JSONObject(extras);
-// if (extraJson.length() > 0) {
-// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
-// }
-// } catch (JSONException e) {
-//
-// }
-//
-// }
-// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
-// }
-// }
-
- @Override
- public void onNotificationSettingsCheck(Context context, boolean isOn, int source) {
- super.onNotificationSettingsCheck(context, isOn, source);
- Log.e(TAG,"[onNotificationSettingsCheck] isOn:"+isOn+",source:"+source);
- }
-
-}
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushService.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushService.java
deleted file mode 100644
index f43ecaa..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/PushService.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-
-import cn.jpush.android.service.JCommonService;
-
-public class PushService extends JCommonService {
-
-}
diff --git a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/TagAliasOperatorHelper.java b/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/TagAliasOperatorHelper.java
deleted file mode 100644
index 90b6911..0000000
--- a/app/src/main/java/com/tt/ttutils/sdk/jpush/jpushdemo/TagAliasOperatorHelper.java
+++ /dev/null
@@ -1,338 +0,0 @@
-package com.tt.ttutils.sdk.jpush.jpushdemo;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.util.SparseArray;
-
-import java.util.Locale;
-import java.util.Set;
-
-import cn.jpush.android.api.JPushInterface;
-import cn.jpush.android.api.JPushMessage;
-
-/**
- * 处理tagalias相关的逻辑
- * */
-public class TagAliasOperatorHelper {
- private static final String TAG = "JIGUANG-TagAliasHelper";
- public static int sequence = 1;
- /**增加*/
- public static final int ACTION_ADD = 1;
- /**覆盖*/
- public static final int ACTION_SET = 2;
- /**删除部分*/
- public static final int ACTION_DELETE = 3;
- /**删除所有*/
- public static final int ACTION_CLEAN = 4;
- /**查询*/
- public static final int ACTION_GET = 5;
-
- public static final int ACTION_CHECK = 6;
-
- public static final int DELAY_SEND_ACTION = 1;
-
- public static final int DELAY_SET_MOBILE_NUMBER_ACTION = 2;
-
- private Context context;
-
- private static TagAliasOperatorHelper mInstance;
- private TagAliasOperatorHelper(){
- }
- public static TagAliasOperatorHelper getInstance(){
- if(mInstance == null){
- synchronized (TagAliasOperatorHelper.class){
- if(mInstance == null){
- mInstance = new TagAliasOperatorHelper();
- }
- }
- }
- return mInstance;
- }
- public void init(Context context){
- if(context != null) {
- this.context = context.getApplicationContext();
- }
- }
- private SparseArray