1.4.0628 增加爱优读,删除推送

This commit is contained in:
2024-10-17 16:26:19 +08:00
parent d48b8126c1
commit aa14ce6a1b
27 changed files with 285 additions and 1227 deletions

View File

@@ -49,23 +49,11 @@
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
<permission
android:name="com.aoleyun.os.permission.XGPUSH_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.aoleyun.os.permission.XGPUSH_RECEIVE" />
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
@@ -234,150 +222,5 @@
android:readPermission="android.permission.WRITE_SECURE_SETTINGS"
android:writePermission="android.permission.WRITE_SECURE_SETTINGS" />
<!-- 应用的其它配置 -->
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<!-- 【必须】 移动推送 TPNS 默认通知 -->
<activity
android:name="com.tencent.android.tpush.TpnsActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<data
android:host="com.aoleyun.os"
android:scheme="tpns" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- 【必须】 移动推送 TPNS receiver广播接收 -->
<receiver
android:name="com.tencent.android.tpush.XGPushReceiver"
android:process=":xg_vip_service">
<intent-filter android:priority="0x7fffffff">
<!-- 【必须】 移动推送 TPNS SDK的内部广播 -->
<action android:name="com.tencent.android.xg.vip.action.SDK" />
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
<!-- 【可选】 系统广播:网络切换 -->
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<!-- 【可选】 系统广播:开屏 -->
<action android:name="android.intent.action.USER_PRESENT" />
<!-- 【可选】 一些常用的系统广播,增强移动推送 TPNS service的复活机会,请根据需要选择。当然,您也可以添加App自定义的一些广播让启动service -->
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
<!-- 【必须】移动推送 TPNS service -->
<service
android:name="com.tencent.android.tpush.service.XGVipPushService"
android:persistent="true"
android:process=":xg_vip_service" />
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
<service
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
android:exported="false">
<intent-filter>
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
<action android:name="com.aoleyun.os.XGVIP_PUSH_ACTION" />
</intent-filter>
</service>
<!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
<provider
android:name="com.tencent.android.tpush.XGPushProvider"
android:authorities="com.aoleyun.os.XGVIP_PUSH_AUTH"
tools:replace="android:authorities" />
<!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
<provider
android:name="com.tencent.android.tpush.SettingsContentProvider"
android:authorities="com.aoleyun.os.TPUSH_PROVIDER"
tools:replace="android:authorities" />
<!-- 【可选】用于增强保活能力 -->
<provider
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
android:authorities="com.aoleyun.os.AUTH_XGPUSH_KEEPALIVE"
android:exported="true"
tools:replace="android:exported,android:authorities" />
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
<receiver android:name="com.aoleyun.os.push.tpush.MessageReceiver">
<intent-filter>
<!-- 接收消息透传 -->
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
</intent-filter>
</receiver>
<!-- MQTT START -->
<service
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
android:exported="false"
android:process=":xg_vip_service" />
<provider
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
android:authorities="com.aoleyun.os.XG_SETTINGS_PROVIDER"
android:exported="false"
tools:replace="android:authorities" />
<!-- MQTT END-->
<!-- 消息接收监听器 (用户可自主扩展) -->
<receiver
android:name=".push.alipush.AliyunMessageReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
</intent-filter>
</receiver>
<service
android:name=".push.alipush.AliMessageIntentService"
android:exported="false">
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
</intent-filter>
<intent-filter>
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
</intent-filter>
</service>
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_ID"
android:value="1500026378" />
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
<meta-data
android:name="XG_V2_ACCESS_KEY"
android:value="AH5QD9ZMBJ6R" />
<!-- 请填写你自己的- appKey -->
<meta-data
android:name="com.alibaba.app.appkey"
android:value="333598281" />
<!-- 请填写你自己的appSecret -->
<meta-data
android:name="com.alibaba.app.appsecret"
android:value="4a3f7e105d894a239ed089f18607bc5a" />
</application>
</manifest>

View File

@@ -11,7 +11,6 @@ buildscript {
dependencies {
classpath GRADLE_CLASS_PATH
classpath PROTOBUF_CLASS_PATH
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
}
}
@@ -66,13 +65,8 @@ android {
minSdkVersion 26
targetSdkVersion 28
// //MTK
// versionCode 49
// versionName "2.3.9"
//cube
versionCode 135
versionName "1.4.0530"
versionCode 151
versionName "1.4.0628"
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
@@ -80,11 +74,6 @@ android {
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
XG_ACCESS_ID : "1500026378",
XG_ACCESS_KEY: "AH5QD9ZMBJ6R",
]
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
@@ -181,6 +170,20 @@ android {
}
buildTypes {
// AiUduDebug.initWith(debug)
// AiUduDebug {
// versionNameSuffix "-debug"
// debuggable true
// signingConfig signingConfigs.G10P
// buildConfigField "String", "platform", '"AUDG104"'
// }
//
// AiUduRelease.initWith(release)
// AiUduRelease {
// signingConfig signingConfigs.G10P
// buildConfigField "String", "platform", '"AUDG104"'
// }
Huaruian8768Debug.initWith(debug)
Huaruian8768Debug {
versionNameSuffix "-debug"
@@ -534,15 +537,17 @@ dependencies {
implementation 'com.jakewharton:disklrucache:2.0.2'
//mmkv
implementation 'com.tencent:mmkv-static:1.2.13'
//腾讯移动推送 TPNS
implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
//阿里云推送
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
// //腾讯移动推送 TPNS
// implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
// //阿里云推送
// implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
//下载
implementation 'me.laoyuyu.aria:core:3.8.16'
annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16'
//工具类
implementation 'com.blankj:utilcodex:1.31.0'
// 吐司框架:https://github.com/getActivity/Toaster
implementation 'com.github.getActivity:Toaster:12.6'
}
preBuild {

View File

@@ -13,6 +13,8 @@ android {
}
buildTypes {
AiUduDebug {}
AiUduRelease {}
Huaruian8768Debug {}
Huaruian8768Release {}
G11Debug {}

View File

@@ -329,7 +329,7 @@ public class BaseIconFactory implements AutoCloseable {
/**
* An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size.
* This allows the badging to be done based on the action bitmap size rather than
* the scaled bitmap size.
* the scaled bitmap size.c
*/
private static class FixedSizeBitmapDrawable extends BitmapDrawable {

View File

@@ -34,6 +34,7 @@
<!-- Extra bottom padding for non-tall devices. -->
<dimen name="dynamic_grid_hotseat_bottom_non_tall_padding">0dp</dimen>
<dimen name="dynamic_grid_hotseat_extra_vertical_size">34dp</dimen>
<dimen name="dynamic_grid_hotseat_extra_vertical_size_aiudu">56dp</dimen>
<dimen name="dynamic_grid_hotseat_side_padding">0dp</dimen>
<!-- Hotseat/all-apps scrim -->

View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2009 The Android Open Source Project
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.
-->
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.uiuios">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Dialer, Messaging, [Maps/Music], Browser, Camera -->
<!-- <favorite-->
<!-- launcher:container="-101"-->
<!-- launcher:className="com.aoleyun.sn.activity.SplashActivity"-->
<!-- launcher:packageName="com.aoleyun.sn"-->
<!-- launcher:screen="0"-->
<!-- launcher:x="0"-->
<!-- launcher:y="0" />-->
<favorite
launcher:container="-101"
launcher:className="com.aoleyun.appstore.activity.SplashActivity"
launcher:packageName="com.aoleyun.appstore"
launcher:screen="1"
launcher:x="1"
launcher:y="0" />
<!-- <resolve-->
<!-- launcher:container="-101"-->
<!-- launcher:screen="0"-->
<!-- launcher:x="0"-->
<!-- launcher:y="0" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" />-->
<!-- <favorite launcher:uri="tel:123" />-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" />-->
<!-- </resolve>-->
<!-- <resolve-->
<!-- launcher:container="-101"-->
<!-- launcher:screen="1"-->
<!-- launcher:x="1"-->
<!-- launcher:y="0" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" />-->
<!-- <favorite launcher:uri="sms:" />-->
<!-- <favorite launcher:uri="smsto:" />-->
<!-- <favorite launcher:uri="mms:" />-->
<!-- <favorite launcher:uri="mmsto:" />-->
<!-- </resolve>-->
<!-- <resolve-->
<!-- launcher:container="-101"-->
<!-- launcher:screen="2"-->
<!-- launcher:x="2"-->
<!-- launcher:y="0" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;end" />-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" />-->
<!-- </resolve>-->
<!-- <favorite-->
<!-- launcher:container="-101"-->
<!-- launcher:className="com.aoleyun.browser.activity.main.MainActivity"-->
<!-- launcher:packageName="com.aoleyun.browser"-->
<!-- launcher:screen="2"-->
<!-- launcher:x="2"-->
<!-- launcher:y="0" />-->
<favorite
launcher:container="-101"
launcher:className="com.aoleyun.info.activity.main.MainActivity"
launcher:packageName="com.aoleyun.info"
launcher:screen="2"
launcher:x="2"
launcher:y="0" />
<favorite
launcher:container="-101"
launcher:className="com.android.settings.Settings"
launcher:packageName="com.android.settings"
launcher:screen="3"
launcher:x="3"
launcher:y="0" />
<!-- <resolve-->
<!-- launcher:container="-101"-->
<!-- launcher:screen="4"-->
<!-- launcher:x="4"-->
<!-- launcher:y="0">-->
<!-- <favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" />-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" />-->
<!-- </resolve>-->
<!-- <resolve-->
<!-- launcher:container="-101"-->
<!-- launcher:screen="5"-->
<!-- launcher:x="5"-->
<!-- launcher:y="0">-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.deskclock/.DeskClock;end" />-->
<!-- </resolve>-->
<!-- <favorite-->
<!-- launcher:container="-101"-->
<!-- launcher:className="com.aoleyun.sn.activity.update.UpdateActivity"-->
<!-- launcher:packageName="com.aoleyun.sn"-->
<!-- launcher:screen="4"-->
<!-- launcher:x="4"-->
<!-- launcher:y="0" />-->
<favorite
launcher:container="-101"
launcher:className="com.aoleyun.sn.activity.EyeProtectionActivity"
launcher:packageName="com.aoleyun.sn"
launcher:screen="4"
launcher:x="4"
launcher:y="0" />
<!-- Bottom row -->
<!-- <resolve-->
<!-- launcher:screen="0"-->
<!-- launcher:x="0"-->
<!-- launcher:y="-1" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_EMAIL;end" />-->
<!-- <favorite launcher:uri="mailto:" />-->
<!-- </resolve>-->
<!-- <resolve-->
<!-- launcher:screen="0"-->
<!-- launcher:x="1"-->
<!-- launcher:y="-1" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_GALLERY;end" />-->
<!-- <favorite launcher:uri="#Intent;type=images/*;end" />-->
<!-- </resolve>-->
<!-- <resolve-->
<!-- launcher:screen="0"-->
<!-- launcher:x="4"-->
<!-- launcher:y="-1" >-->
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MARKET;end" />-->
<!-- <favorite launcher:uri="market://details?id=com.android.launcher" />-->
<!-- </resolve>-->
<!-- <favorite-->
<!-- launcher:className="com.info.sn.activity.MainActivity"-->
<!-- launcher:packageName="com.info.sn"-->
<!-- launcher:screen="0"-->
<!-- launcher:x="0"-->
<!-- launcher:y="0" />-->
<!-- <favorite-->
<!-- launcher:className="com.jiaoguanyi.sysc.activity.MainActivity"-->
<!-- launcher:packageName="com.jiaoguanyi.sysc"-->
<!-- launcher:screen="0"-->
<!-- launcher:x="1"-->
<!-- launcher:y="0" />-->
</favorites>

View File

@@ -149,4 +149,31 @@
</grid-option>
<grid-option
launcher:name="aiudu"
launcher:numRows="4"
launcher:numColumns="6"
launcher:numFolderRows="3"
launcher:numFolderColumns="3"
launcher:numHotseatIcons="6"
launcher:defaultLayoutId="@xml/default_workspace_aiudu" >
<display-option
launcher:name="AiUDU Phone"
launcher:minWidthDps="406"
launcher:minHeightDps="694"
launcher:iconImageSize="70"
launcher:iconTextSize="14.4"
launcher:canBeDefault="true" />
<!-- <display-option-->
<!-- launcher:name="Shorter Stubby"-->
<!-- launcher:minWidthDps="255"-->
<!-- launcher:minHeightDps="400"-->
<!-- launcher:iconImageSize="48"-->
<!-- launcher:iconTextSize="13.0"-->
<!-- launcher:canBeDefault="true" />-->
</grid-option>
</profiles>

View File

@@ -34,6 +34,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcelable;
import android.util.ArrayMap;
import android.util.AttributeSet;
@@ -578,7 +579,11 @@ public class CellLayout extends ViewGroup implements Transposable {
// Hotseat icons - remove text
if (child instanceof BubbleTextView) {
BubbleTextView bubbleChild = (BubbleTextView) child;
bubbleChild.setTextVisibility(mContainerType != HOTSEAT);
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
bubbleChild.setTextVisibility(true);
} else {
bubbleChild.setTextVisibility(mContainerType != HOTSEAT);
}
}
child.setScaleX(mChildScale);

View File

@@ -22,6 +22,7 @@ import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Surface;
import android.view.WindowManager;
@@ -206,10 +207,18 @@ public class DeviceProfile {
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
// Add a bit of space between nav bar and hotseat in vertical bar layout.
hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? verticalDragHandleSizePx : 0;
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size_aiudu)
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
} else {
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
}
// Calculate all of the remaining variables.
updateAvailableDimensions(dm, res);

View File

@@ -32,6 +32,7 @@ import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
@@ -54,6 +55,8 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -182,6 +185,9 @@ public class InvariantDeviceProfile {
display.getCurrentSizeRange(smallestSize, largestSize);
ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName);
for (DisplayOption displayOption:allOptions){
Log.e(TAG, "initGrid: "+displayOption.grid.name);
}
// This guarantees that width < height
float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm);
float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm);
@@ -191,8 +197,17 @@ public class InvariantDeviceProfile {
dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps)));
DisplayOption interpolatedDisplayOption =
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
GridOption closestProfile = allOptions.get(0).grid;
GridOption closestProfile;
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
closestProfile = allOptions.stream().filter(new Predicate<DisplayOption>() {
@Override
public boolean test(DisplayOption displayOption) {
return "aiudu".equals(displayOption.grid.name);
}
}).collect(Collectors.toList()).get(0).grid;
}else {
closestProfile = allOptions.get(0).grid;
}
numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns;
numHotseatIcons = closestProfile.numHotseatIcons;

View File

@@ -71,9 +71,6 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.os.DropTarget.DragObject;
import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
import com.aoleyun.os.allapps.AllAppsContainerView;
@@ -156,9 +153,6 @@ import com.aoleyun.os.widget.custom.CustomWidgetParser;
import com.arialyy.aria.core.Aria;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import java.io.File;
@@ -478,68 +472,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
});
JGYUtils.getInstance().wakeUpAppstore();
JGYUtils.getInstance().wakeUpDeviceInfo();
XGPushConfig.enableDebug(this, true);
XGPushManager.registerPush(this, new XGIOperateCallback() {
@Override
public void onSuccess(Object data, int flag) {
//token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功,设备token为:" + data);
NetInterfaceManager.getInstance().setPushTag(true, new NetInterfaceManager.onCompleteCallback() {
@Override
public void onComplete() {
}
});
}
@Override
public void onFail(Object data, int errCode, String msg) {
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
}
});
PushServiceFactory.init(this);
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
pushService.register(this, new CommonCallback() {
@Override
public void onSuccess(String response) {
Log.e("AliyunPush", "init cloudchannel success");
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
String sn = Utils.getSerial(Launcher.this);
if (TextUtils.isEmpty(sn)) {
return;
}
pushService.bindAccount(sn, new CommonCallback() {
@Override
public void onSuccess(String s) {
Log.e("AliyunPush", "bind account " + sn + " success\n");
}
@Override
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "bind account " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
}
});
pushService.addAlias(sn, new CommonCallback() {
@Override
public void onSuccess(String s) {
Log.e("AliyunPush", "add alias " + sn + " success\n");
}
@Override
public void onFailed(String errorCode, String errorMsg) {
Log.e("AliyunPush", "add alias " + sn + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
}
@Override
public void onFailed(String errorCode, String errorMessage) {
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
}
});
}
private void SetWallPaper() {

View File

@@ -5,11 +5,10 @@ import android.util.Log;
import com.aoleyun.os.manager.ConnectManager;
import com.aoleyun.os.network.NetInterfaceManager;
import com.aoleyun.os.push.PushManager;
import com.aoleyun.os.uiuiutils.JGYUtils;
import com.aoleyun.os.uiuiutils.TimeUtils;
import com.aoleyun.os.uiuiutils.ToastUtil;
import com.arialyy.aria.core.Aria;
import com.hjq.toast.Toaster;
import com.tencent.mmkv.MMKV;
public class BaseApplication extends Application {
@@ -21,12 +20,12 @@ public class BaseApplication extends Application {
String rootDir = MMKV.initialize(this);
Log.e(TAG, "onCreate: " + rootDir);
PushManager.init(this);
JGYUtils.init(this);
TimeUtils.init(this);
Aria.init(this);
NetInterfaceManager.init(this);
ToastUtil.init(this);
// 初始化 Toast 框架
Toaster.init(this);
ConnectManager.init(this);
}
}

View File

@@ -248,6 +248,7 @@ public class IconCache extends BaseIconCache {
this.add("com.android.gallery3d.v2.app.GalleryActivity2");//图库
this.add("com.android.gallery3d.app.GalleryActivity");//图库
this.add("com.android.messaging.ui.conversationlist.ConversationListActivity");//信息
this.add("com.android.mms.ui.BootActivity");//信息
this.add("com.android.music.MusicBrowserActivity");//音乐
this.add("com.android.providers.downloads.ui.DownloadList");//下载
this.add("com.android.quicksearchbox.SearchActivity");//搜索
@@ -284,6 +285,7 @@ public class IconCache extends BaseIconCache {
this.add("com_android_gallery3d_app");
this.add("com_android_gallery3d_app");
this.add("com_android_mms_ui");
this.add("com_android_mms_ui");
this.add("com_android_music");
this.add("com_android_providers_downloads_ui");
this.add("com_android_quicksearchbox");

View File

@@ -5,9 +5,6 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.sdk.android.push.CloudPushService;
import com.alibaba.sdk.android.push.CommonCallback;
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
import com.aoleyun.os.disklrucache.CacheHelper;
import com.aoleyun.os.manager.ConnectManager;
import com.aoleyun.os.manager.ConnectMode;
@@ -24,8 +21,6 @@ import com.aoleyun.os.network.bean.Batch;
import com.aoleyun.os.network.interceptor.RepeatRequestInterceptor;
import com.aoleyun.os.uiuiutils.JGYUtils;
import com.aoleyun.os.uiuiutils.Utils;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushManager;
import com.tencent.mmkv.MMKV;
import java.io.File;
@@ -205,8 +200,9 @@ public class NetInterfaceManager {
set.add(JGYUtils.G10PTag);
} else if (platform == JGYUtils.C2Platform) {
set.add(JGYUtils.C2Tag);
} else if (platform == JGYUtils.AUDG104Platform) {
set.add(JGYUtils.AUDG104Tag);
}
}
});
getPushTagsObservable()
@@ -248,31 +244,7 @@ public class NetInterfaceManager {
});
}
synchronized private void clearAndAppendTags(Set<String> tagSets) {
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
@Override
public void onSuccess(Object o, int i) {
Log.e("clearAndAppendTags", "onSuccess: " + o);
}
private void clearAndAppendTags(Set<String> tagSets) {
@Override
public void onFail(Object o, int i, String s) {
Log.e("clearAndAppendTags", "onFail: " + o);
}
});
String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
CloudPushService pushService = PushServiceFactory.getCloudPushService();
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
@Override
public void onSuccess(String s) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
}
@Override
public void onFailed(String errorCode, String errorMsg) {
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
}
});
}
}

View File

@@ -1,51 +0,0 @@
package com.aoleyun.os.push;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import com.aoleyun.os.comm.CommonConfig;
import com.aoleyun.os.disklrucache.CacheHelper;
import com.aoleyun.os.network.HTTPInterface;
import com.tencent.mmkv.MMKV;
public class PushManager {
private static final String TAG = PushManager.class.getSimpleName();
@SuppressLint("StaticFieldLeak")
private static PushManager sInstance;
private Context mContext;
private PushManager(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = context;
}
public static void init(Context context) {
if (sInstance == null) {
sInstance = new PushManager(context);
}
}
public static PushManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init PushManager first");
}
return sInstance;
}
/*删除应用*/
private final String UPDATEPASSWD = "39";
public void setPushContent(String title, String extras) {
switch (title) {
case UPDATEPASSWD:
HTTPInterface.getAppPasswd();
break;
default:
}
}
}

View File

@@ -1,99 +0,0 @@
package com.aoleyun.os.push.alipush;
import android.content.Context;
import android.util.Log;
import com.alibaba.sdk.android.push.AliyunMessageIntentService;
import com.alibaba.sdk.android.push.notification.CPushMessage;
import java.util.Map;
/**
* Created by liyazhou on 17/8/22.
* 为避免推送广播被系统拦截的小概率事件,我们推荐用户通过IntentService处理消息互调,接入步骤:
* 1. 创建IntentService并继承AliyunMessageIntentService
* 2. 覆写相关方法,并在Manifest的注册该Service
* 3. 调用接口CloudPushService.setPushIntentService
* 详细用户可参考:https://help.aliyun.com/document_detail/30066.html#h2-2-messagereceiver-aliyunmessageintentservice
*/
public class AliMessageIntentService extends AliyunMessageIntentService {
private static final String TAG = AliyunMessageIntentService.class.getSimpleName();
/**
* 推送通知的回调方法
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
protected void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
}
/**
* 推送消息的回调方法
*
* @param context
* @param cPushMessage
*/
@Override
protected void onMessage(Context context, CPushMessage cPushMessage) {
Log.i(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
}
/**
* 从通知栏打开通知的扩展处理
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
protected void onNotificationOpened(Context context, String title, String summary, String extraMap) {
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
}
/**
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
}
/**
* 通知删除回调
*
* @param context
* @param messageId
*/
@Override
protected void onNotificationRemoved(Context context, String messageId) {
Log.i(TAG, "onNotificationRemoved : " + messageId);
}
/**
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html#h3-3-4-basiccustompushnotification-api
*
* @param context
* @param title
* @param summary
* @param extraMap
* @param openType
* @param openActivity
* @param openUrl
*/
@Override
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
}
}

View File

@@ -1,116 +0,0 @@
package com.aoleyun.os.push.alipush;
import android.content.Context;
import android.util.Log;
import com.alibaba.sdk.android.push.MessageReceiver;
import com.alibaba.sdk.android.push.notification.CPushMessage;
import com.aoleyun.os.push.PushManager;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.Map;
/**
* @author: 正纬
* @since: 15/4/9
* @version: 1.1
* @feature: 用于接收推送的通知和消息
*/
public class AliyunMessageReceiver extends MessageReceiver {
// 消息接收部分的LOG_TAG
public static final String TAG = AliyunMessageReceiver.class.getSimpleName();
/**
* 推送通知的回调方法
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
public void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
// TODO 处理推送通知
if (null != extraMap) {
for (Map.Entry<String, String> entry : extraMap.entrySet()) {
Log.i(TAG, "@Get diy param : Key=" + entry.getKey() + " , Value=" + entry.getValue());
}
} else {
Log.i(TAG, "@收到通知 && 自定义消息为空");
}
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
}
/**
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html?spm=5176.product30047.6.620.wjcC87#h3-3-4-basiccustompushnotification-api
*
* @param context
* @param title
* @param summary
* @param extraMap
* @param openType
* @param openActivity
* @param openUrl
*/
@Override
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
}
/**
* 推送消息的回调方法
*
* @param context
* @param cPushMessage
*/
@Override
public void onMessage(Context context, CPushMessage cPushMessage) {
Log.e(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
String title = cPushMessage.getTitle();
String content = cPushMessage.getContent();
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
String extras = "";
if (extrasJson.get("extras") != null) {
extras = extrasJson.get("extras").toString();
}
PushManager.getInstance().setPushContent(title, extras);
}
/**
* 从通知栏打开通知的扩展处理
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
public void onNotificationOpened(Context context, String title, String summary, String extraMap) {
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
}
/**
* 通知删除回调
*
* @param context
* @param messageId
*/
@Override
public void onNotificationRemoved(Context context, String messageId) {
Log.i(TAG, "onNotificationRemoved : " + messageId);
}
/**
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
*
* @param context
* @param title
* @param summary
* @param extraMap
*/
@Override
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
}
}

View File

@@ -1,17 +0,0 @@
package com.aoleyun.os.push.tpush;
/**
* Created by chacewang on 2019/7/5.
*/
public class Constants {
public static final int TEST_LOCAL_NOTIFICATION = 1;
public static final int TEST_NOTIFICATION = 2;
public static final int TEST_SET_TAG = 3;
public static final int TEST_DEL_TAG = 4;
public static final int TEST_SET_ACCOUNT = 5;
public static final int TEST_DEL_ACCOUNT = 6;
public static final String LOCAL_NOTIFICATION_TITLE = "localtest";
public static final String TEST_TAG_NAME = "DiagnosisTag";
}

View File

@@ -1,299 +0,0 @@
package com.aoleyun.os.push.tpush;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.aoleyun.os.network.HTTPInterface;
import com.aoleyun.os.push.PushManager;
import com.aoleyun.os.push.tpush.common.NotificationService;
import com.aoleyun.os.push.tpush.po.XGNotification;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.tencent.android.tpush.NotificationAction;
import com.tencent.android.tpush.XGPushBaseReceiver;
import com.tencent.android.tpush.XGPushClickedResult;
import com.tencent.android.tpush.XGPushRegisterResult;
import com.tencent.android.tpush.XGPushShowedResult;
import com.tencent.android.tpush.XGPushTextMessage;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class MessageReceiver extends XGPushBaseReceiver {
private static final String TAG = MessageReceiver.class.getSimpleName();
public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW";
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
public static final String LogTag = "xg.test";
/**
* 消息透传处理
*
* @param context
* @param message 解析自定义的 JSON
*/
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
String text = "收到消息:" + message.toString();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理消息的过程...
Log.e(LogTag, text);
show(context, text);
processCustomMessage(context, message);
}
/**
* 通知展示
*
* @param context
* @param notifiShowedRlt 包含通知的内容
*/
@Override
public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) {
if (context == null || notifiShowedRlt == null) {
return;
}
XGNotification notific = new XGNotification();
notific.setMsg_id(notifiShowedRlt.getMsgId());
notific.setTitle(notifiShowedRlt.getTitle());
notific.setContent(notifiShowedRlt.getContent());
// notificationActionType==1为Activity,2为url,3为intent
notific.setNotificationActionType(notifiShowedRlt
.getNotificationActionType());
// Activity,url,intent都可以通过getActivity()获得
notific.setActivity(notifiShowedRlt.getActivity());
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(Calendar.getInstance().getTime()));
NotificationService.getInstance(context).save(notific);
Intent testIntent = new Intent(TEST_ACTION);
if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) {
testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION);
} else {
testIntent.putExtra("step", Constants.TEST_NOTIFICATION);
}
context.sendBroadcast(testIntent);
Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION);
context.sendBroadcast(viewIntent);
show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString());
Log.d(LogTag, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel());
}
/**
* 注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
// 在这里拿token
String token = message.getToken();
text = "注册成功1. token:" + token;
} else {
text = message + "注册失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 反注册回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
*/
@Override
public void onUnregisterResult(Context context, int errorCode) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "反注册成功";
} else {
text = "反注册失败" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
/**
* 设置标签回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onSetTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"设置成功";
} else {
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_TAG);
context.sendBroadcast(testIntent);
}
/**
* 删除标签的回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param tagName 设置的 TAG
*/
@Override
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"删除成功";
} else {
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_TAG);
context.sendBroadcast(testIntent);
}
/**
* 设置账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onSetAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT);
context.sendBroadcast(testIntent);
}
/**
* 删除账号回调
*
* @param context
* @param errorCode 0 为成功,其它为错误码
* @param account 设置的账号
*/
@Override
public void onDeleteAccountResult(Context context, int errorCode, String account) {
Intent testIntent = new Intent(TEST_ACTION);
testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT);
context.sendBroadcast(testIntent);
}
@Override
public void onSetAttributeResult(Context context, int i, String s) {
}
@Override
public void onDeleteAttributeResult(Context context, int i, String s) {
}
@Override
public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {
Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);
}
/**
* 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击
*
* @param context
* @param message 包含被点击通知的内容
*/
@Override
public void onNotificationClickedResult(Context context, XGPushClickedResult message) {
if (context == null || message == null) {
return;
}
String text = "";
if (message.getActionType() == NotificationAction.clicked.getType()) {
// 通知在通知栏被点击啦。。。。。
// APP自己处理点击的相关动作
// 这个动作可以在activity的onResume也能监听,请看第3点相关内容
text = "通知被打开 :" + message;
} else if (message.getActionType() == NotificationAction.delete.getType()) {
// 通知被清除啦。。。。
// APP自己处理通知被清除后的相关动作
text = "通知被清除 :" + message;
}
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
Toast.LENGTH_SHORT).show();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
// key1为前台配置的key
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
String value = obj.get("key").getAsString();
Log.d(LogTag, "get custom value:" + value);
}
// ...
}
// APP自主处理的过程。。。
Log.d(LogTag, text);
show(context, text);
}
private void show(Context context, String text) {
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
private void processCustomMessage(Context context, XGPushTextMessage message) {
if (context == null || message == null) {
return;
}
String title = message.getTitle();
String content = message.getContent();
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
String extras = "";
if (extrasJson.get("extras") != null) {
extras = extrasJson.get("extras").toString();
}
PushManager.getInstance().setPushContent(title, extras);
}
}

View File

@@ -1,23 +0,0 @@
package com.aoleyun.os.push.tpush.common;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(Context context) {
super(context, "XGExample.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE notification (id integer primary key autoincrement,msg_id varchar(64),title varchar(128),activity varchar(256),notificationActionType varchar(512),content text,update_time varchar(16))");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

View File

@@ -1,135 +0,0 @@
package com.aoleyun.os.push.tpush.common;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.aoleyun.os.push.tpush.po.XGNotification;
import java.util.ArrayList;
import java.util.List;
public class NotificationService {
private DBOpenHelper dbOpenHelper;
private static NotificationService instance = null;
public NotificationService(Context context) {
this.dbOpenHelper = new DBOpenHelper(context);
}
public synchronized static NotificationService getInstance(Context ctx) {
if (null == instance) {
instance = new NotificationService(ctx);
}
return instance;
}
public void save(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.insert("notification", null, values);
}
public void delete(Integer id) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "id=?", new String[] { id.toString() });
}
public void deleteAll() {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
db.delete("notification", "", null);
}
public void update(XGNotification notification) {
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("msg_id", notification.getMsg_id());
values.put("title", notification.getTitle());
values.put("content", notification.getContent());
values.put("activity", notification.getActivity());
values.put("notificationActionType", notification.getNotificationActionType());
values.put("update_time", notification.getUpdate_time());
db.update("notification", values, "id=?", new String[] { notification
.getId().toString() });
}
public XGNotification find(Integer id) {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"id=?", new String[] { id.toString() }, null, null,
null, "1");
try {
if (cursor.moveToFirst()) {
return new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time")));
}
return null;
} finally {
cursor.close();
}
}
public List<XGNotification> getScrollData(int currentPage, int lineSize,
String msg_id) {
String firstResult = String.valueOf((currentPage - 1) * lineSize);
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = null;
try {
if (msg_id == null || "".equals(msg_id)) {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
null, null, null, null, "update_time DESC",
firstResult + "," + lineSize);
} else {
cursor = db
.query("notification",
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
"msg_id like ?", new String[] { msg_id + "%" },
null, null, "update_time DESC", firstResult
+ "," + lineSize);
}
List<XGNotification> notifications = new ArrayList<XGNotification>();
while (cursor.moveToNext()) {
notifications.add(new XGNotification(cursor.getInt(cursor
.getColumnIndex("id")), cursor.getLong(cursor
.getColumnIndex("msg_id")), cursor.getString(cursor
.getColumnIndex("title")), cursor.getString(cursor
.getColumnIndex("content")), cursor.getString(cursor
.getColumnIndex("activity")), cursor.getInt(cursor
.getColumnIndex("notificationActionType")), cursor.getString(cursor
.getColumnIndex("update_time"))));
}
return notifications;
} finally {
cursor.close();
}
}
public int getCount() {
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
Cursor cursor = db.rawQuery("select count(*) from notification", null);
try {
cursor.moveToFirst();
return cursor.getInt(0);
} finally {
cursor.close();
}
}
}

View File

@@ -1,83 +0,0 @@
package com.aoleyun.os.push.tpush.po;
public class XGNotification {
private Integer id;
private Long msg_id;
private String title;
private String content;
private String activity;
private int notificationActionType;
private String update_time;
public XGNotification() {
}
public XGNotification(Integer id, Long msg_id, String title,
String content, String activity, int notificationActionType, String update_time) {
super();
this.id = id;
this.msg_id = msg_id;
this.title = title;
this.content = content;
this.activity = activity;
this.notificationActionType = notificationActionType;
this.update_time = update_time;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getMsg_id() {
return msg_id;
}
public void setMsg_id(Long msg_id) {
this.msg_id = msg_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUpdate_time() {
return update_time;
}
public void setUpdate_time(String update_time) {
this.update_time = update_time;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public int getNotificationActionType() {
return notificationActionType;
}
public void setNotificationActionType(int notificationActionType) {
this.notificationActionType = notificationActionType;
}
}

View File

@@ -51,7 +51,7 @@ public class InstallResultReceiver extends BroadcastReceiver {
// Log.e("fht", LEGACY_STATUS);
// Log.e("fht", STATUS_MESSAGE);
if (STATUS_MESSAGE != null && STATUS_MESSAGE.equals("INSTALL_SUCCEEDED")) {
// ToastUtil.show(PACKAGE_NAME + "安装成功");
// Toaster.show(PACKAGE_NAME + "安装成功");
}
}
}

View File

@@ -46,7 +46,7 @@ import com.aoleyun.os.LauncherAppWidgetInfo;
import com.aoleyun.os.LauncherAppWidgetProviderInfo;
import com.aoleyun.os.uiuiutils.CustomDialog;
import com.aoleyun.os.uiuiutils.JGYUtils;
import com.aoleyun.os.uiuiutils.ToastUtil;
import com.hjq.toast.Toaster;
import com.aoleyun.os.base.BaseApplication;
import com.aoleyun.os.PromiseAppInfo;
import com.aoleyun.os.R;
@@ -141,7 +141,7 @@ public class ItemClickHandler {
onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
dialog.dismiss();
} else {
ToastUtil.showCenter("密码错误");
Toaster.show("密码错误");
}
}
@@ -187,57 +187,57 @@ public class ItemClickHandler {
return false;
}
if (JGYUtils.isDisable(context, pkg)) {
ToastUtil.show("应用已被禁用");
Toaster.show("应用已被禁用");
return true;
}
switch (pkg) {
case "com.mediatek.camera":
case "com.android.camera2":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_camera", 0) == 1) {
ToastUtil.show("摄像头已禁止使用");
Toaster.show("摄像头已禁止使用");
return true;
}
break;
case "com.android.gallery3d":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_gallery", 1) == 1) {
ToastUtil.show("图库已禁止使用");
Toaster.show("图库已禁止使用");
return true;
}
break;
case "com.android.documentsui":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_filemanager", 1) == 1) {
ToastUtil.show("文件已禁止使用");
Toaster.show("文件已禁止使用");
return true;
}
break;
case "com.android.deskclock":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_deskclock", 0) == 1) {
ToastUtil.show("时钟已禁止使用");
Toaster.show("时钟已禁止使用");
return true;
}
break;
case "com.android.music":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_music", 1) == 1) {
ToastUtil.show("音乐已禁止使用");
Toaster.show("音乐已禁止使用");
return true;
}
break;
case "com.android.soundrecorder":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_soundrecorder", 1) == 1) {
ToastUtil.show("录音机已禁止使用");
Toaster.show("录音机已禁止使用");
return true;
}
break;
case "com.aoleyun.browser":
case "com.android.browser":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_browser", 1) == 1) {
ToastUtil.show("浏览器已禁止使用");
Toaster.show("浏览器已禁止使用");
return true;
}
break;
case "com.android.messaging":
if (Settings.System.getInt(context.getContentResolver(), "qch_app_sms", 1) == 1) {
ToastUtil.show("短信已禁止使用");
Toaster.show("短信已禁止使用");
return true;
}
break;

View File

@@ -17,6 +17,7 @@ import androidx.annotation.RequiresApi;
import com.aoleyun.os.BuildConfig;
import com.aoleyun.os.receiver.InstallResultReceiver;
import com.hjq.toast.Toaster;
import java.io.BufferedReader;
import java.io.File;
@@ -45,7 +46,7 @@ public class ApkUtils {
return true;
} catch (Exception e) {
Log.e(TAG, "openPackage: " + e.getMessage());
ToastUtil.show("打开失败");
Toaster.show("打开失败");
return false;
}
}

View File

@@ -40,6 +40,10 @@ public class JGYUtils {
public static final int HRAD13Platform = 11;
public static final int G10PPlatform = 12;
public static final int C2Platform = 13;
public static final int YXPD1Platform = 15;
public static final int G11Platform = 16;
public static final int MT8768Platform = 17;
public static final int AUDG104Platform = 18;
public static final String Other = "其他";
@@ -53,7 +57,10 @@ public class JGYUtils {
public static final String HRAD13Tag = "HRAD13";
public static final String G10PTag = "G10P";
public static final String C2Tag = "MTK8183";
public static final String YXPD1TAG = "YXPD1";
public static final String G11TAG = "MTKG11";
public static final String MT8768Tag = "MT8768";
public static final String AUDG104Tag = "AUDG104";
private JGYUtils(Context context) {
if (context == null) {
@@ -105,6 +112,9 @@ public class JGYUtils {
} else if (C2Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "C2");
return C2Platform;
} else if (AUDG104Tag.equalsIgnoreCase(platform)) {
Log.i(TAG, "checkAppPlatform: " + "AUDG104");
return AUDG104Platform;
} else {
Log.i(TAG, "checkAppPlatform: " + "没有数据");
return UnknowPlatform;
@@ -135,6 +145,8 @@ public class JGYUtils {
getAppPlatformCallback.AppPlatform(G10PPlatform);
} else if (C2Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(C2Platform);
} else if (AUDG104Tag.equalsIgnoreCase(platform)) {
getAppPlatformCallback.AppPlatform(AUDG104Platform);
} else {
getAppPlatformCallback.AppPlatform(UnknowPlatform);
}

View File

@@ -1,105 +0,0 @@
package com.aoleyun.os.uiuiutils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
import com.aoleyun.os.BuildConfig;
import com.aoleyun.os.R;
import com.blankj.utilcode.util.ColorUtils;
import com.blankj.utilcode.util.ToastUtils;
/**
* Created by haoge on 2017/3/2.
*/
public class ToastUtil {
private static final String TAG = ToastUtil.class.getSimpleName();
@SuppressLint("StaticFieldLeak")
private static Context mContext;
private static Handler mainHandler = new Handler(Looper.getMainLooper());
private static Toast debugToast;
private static Toast toast;
@SuppressLint("ShowToast")
public static void init(Context context) {
mContext = context;
toast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
debugToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
}
private static long time1 = 0L;
private static long time2 = 0L;
public static void show(final String msg) {
ToastUtils.make()
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.DKGRAY)
// .setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.show(msg);
}
public static void betaShow(final String msg) {
if (JGYUtils.isBetaVersion() || BuildConfig.DEBUG) {
ToastUtils.make()
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.RED)
// .setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.setDurationIsLong(true)
.show(msg);
} else {
Log.e(TAG, "debugShow: " + msg);
}
}
public static void showCenter(final String msg) {
ToastUtils.make()
.setBgColor(ColorUtils.getColor(R.color.toast_color))
.setTextColor(Color.WHITE)
.setGravity(Gravity.CENTER, 0, 0)
.setNotUseSystemToast()
.show(msg);
}
private static Toast mToast = null;
//android 8.0以后限制
//https://www.jianshu.com/p/d9813ad03d59
//https://www.jianshu.com/p/050ce052b873
public static void showToast(Context context, String text, int duration) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
Toast.makeText(context, text, duration).show();
} else {
if (mToast == null) {
mToast = Toast.makeText(context, text, duration);
} else {
mToast.setText(text);
mToast.setDuration(duration);
}
mToast.show();
}
}
// public static void showInCenter(String msg) {
// mainHandler.post(() -> {
// if (toast != null) {
// toast.setGravity(Gravity.CENTER, 0, 0);
// toast.setText(msg);
// toast.show();
// }
// });
// }
}