version:1.5.1
fix: update:优化耗电,取消腾讯推送
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: "com.tencent.android.tpns"
|
||||
|
||||
def appName() {
|
||||
return "CubeZYLauncher"
|
||||
@@ -17,8 +16,8 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 35
|
||||
versionName "1.4.3"
|
||||
versionCode 43
|
||||
versionName "1.5.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -27,11 +26,6 @@ android {
|
||||
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
|
||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500030457",
|
||||
XG_ACCESS_KEY: "AZZXANJF4HBD",
|
||||
]
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
@@ -195,8 +189,6 @@ dependencies {
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.14'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.3.7.0-release'
|
||||
//阿里云推送
|
||||
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
||||
//状态栏透明
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||
<uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
@@ -17,35 +17,28 @@
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> <!-- 允许访问网络,必选权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- 允许获取精确位置,精准定位必选 -->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> -->
|
||||
<!-- 允许获取粗略位置,粗略定位必选 -->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> -->
|
||||
<!-- 允许获取设备和运营商信息,用于问题排查和网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 允许获取网络状态,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 允许获取wifi网络信息,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许获取wifi状态改变,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 后台获取位置信息,若需后台定位则必选 -->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> -->
|
||||
<!-- 用于申请调用A-GPS模块,卫星定位加速 -->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> -->
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<!-- 允许获取wifi状态改变,用于网络定位(无gps情况下的定位),若需网络定位功能则必选 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<!-- 允许写设备缓存,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> <!-- 允许写入扩展存储,用于写入缓存定位数据 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读设备等信息,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<!-- 允许写入扩展存储,用于写入缓存定位数据 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- 允许读设备等信息,用于问题排查 -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" /> <!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<permission
|
||||
android:name="${applicationId}.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="${applicationId}.permission.XGPUSH_RECEIVE" /> <!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="${applicationId}.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.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" />
|
||||
@@ -131,11 +124,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".service.DownloadService"
|
||||
android:enabled="false"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.InstallResultReceiver"
|
||||
android:enabled="true"
|
||||
@@ -145,25 +133,27 @@
|
||||
android:name=".alarm.AlarmService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<service
|
||||
android:name=".service.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.intent.action.SCREEN_ON" />
|
||||
<action android:name="android.intent.action.SCREEN_OFF" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service
|
||||
android:name=".service.NotificationService"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<!-- <service-->
|
||||
<!-- android:name=".service.main.MainService"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- <intent-filter android:priority="1000">-->
|
||||
<!-- <action android:name="android.intent.action.USER_PRESENT" />-->
|
||||
<!-- <action android:name="android.intent.action.SCREEN_ON" />-->
|
||||
<!-- <action android:name="android.intent.action.SCREEN_OFF" />-->
|
||||
|
||||
<!-- <data android:scheme="package" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
|
||||
<!-- <service-->
|
||||
<!-- android:name=".service.NotificationService"-->
|
||||
<!-- android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.service.notification.NotificationListenerService" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </service>-->
|
||||
|
||||
<receiver
|
||||
android:name=".receiver.APKinstallReceiver"
|
||||
@@ -177,118 +167,8 @@
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver> <!-- <!– 声明service组件 –> -->
|
||||
<!-- <service -->
|
||||
<!-- android:name="com.baidu.location.f" -->
|
||||
<!-- android:enabled="true" -->
|
||||
<!-- android:process=":remote" /> -->
|
||||
<!-- <!– 应用的其它配置 –> -->
|
||||
<!-- <uses-library -->
|
||||
<!-- android:name="org.apache.http.legacy" -->
|
||||
<!-- android:required="false" /> -->
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY" />
|
||||
</receiver>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="com.uiui.zyos"
|
||||
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>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.InnerTpnsActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY_V2" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="com.uiui.zyos"
|
||||
android:scheme="stpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity> <!-- 【必须】 信鸽receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
<!-- 【必须】 信鸽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" />
|
||||
</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="${applicationId}.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service> <!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="${applicationId}.XGVIP_PUSH_AUTH" /> <!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="${applicationId}.TPUSH_PROVIDER" /> <!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="${applicationId}.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true"
|
||||
tools:replace="android:exported" /> <!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name=".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="${applicationId}.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" /> <!-- MQTT END -->
|
||||
<!-- 消息接收监听器 (用户可自主扩展) -->
|
||||
<receiver
|
||||
android:name=".push.alipush.AliyunMessageReceiver"
|
||||
@@ -304,28 +184,11 @@
|
||||
</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="1500030457" /> <!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="AZZXANJF4HBD" /> <!-- 请填写你自己的- appKey -->
|
||||
<!-- 请填写你自己的- appKey -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appkey"
|
||||
android:value="333816243" /> <!-- 请填写你自己的appSecret -->
|
||||
android:value="333816243" />
|
||||
<!-- 请填写你自己的appSecret -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appsecret"
|
||||
android:value="ab5ffe213b1d449fb624d4a6e8ea7275" />
|
||||
|
||||
@@ -96,7 +96,6 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
Log.e(TAG, "onCreate: " + alarmClockData);
|
||||
showData(alarmClockData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showData(AlarmClockData alarmClockData) {
|
||||
|
||||
@@ -43,9 +43,7 @@ import com.uiui.zyos.fragment.subject.SubjectFragment;
|
||||
import com.uiui.zyos.fragment.user.UserFragment;
|
||||
import com.uiui.zyos.jxw.JxwPackageConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.service.NotificationService;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.HomeWatcher;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.ToastUtil;
|
||||
import com.uiui.zyos.utils.Utils;
|
||||
@@ -86,6 +84,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
ConstraintLayout cl_6;
|
||||
@BindView(R.id.cl_7)
|
||||
ConstraintLayout cl_7;
|
||||
@BindView(R.id.cl_8)
|
||||
ConstraintLayout cl_8;
|
||||
|
||||
@BindView(R.id.iv_robot)
|
||||
ImageView iv_robot;
|
||||
@@ -145,9 +145,13 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
mFragmentManager = getSupportFragmentManager();
|
||||
mFragments = new ArrayList<>();
|
||||
mUserFragment = new UserFragment();
|
||||
if (!mUserFragment.isAdded()) {
|
||||
mFragments.add(mUserFragment);
|
||||
}
|
||||
mSubjectFragment = new SubjectFragment();
|
||||
mFragments.add(mUserFragment);
|
||||
mFragments.add(mSubjectFragment);
|
||||
if (!mSubjectFragment.isAdded()) {
|
||||
mFragments.add(mSubjectFragment);
|
||||
}
|
||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||
|
||||
mViewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||
@@ -272,6 +276,12 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_DICTIONARY_PACKAGE_NAME, JxwPackageConfig.JXW_DICTIONARY_CLASS_NAME);
|
||||
}
|
||||
});
|
||||
cl_8.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_UPDATE_CLASS_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,16 +300,15 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggleNotificationListenerService(Context context) {
|
||||
Log.e(TAG, "toggleNotificationListenerService");
|
||||
PackageManager pm = context.getPackageManager();
|
||||
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
|
||||
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
|
||||
// public static void toggleNotificationListenerService(Context context) {
|
||||
// Log.e(TAG, "toggleNotificationListenerService");
|
||||
// PackageManager pm = context.getPackageManager();
|
||||
// pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||
// PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
//
|
||||
// pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||
// PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -65,6 +66,8 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppHolder> {
|
||||
} else {
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
} else if (AppManager.UPDATE_NAME.equals(pkg)) {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
} else {
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon()));
|
||||
}
|
||||
@@ -74,6 +77,11 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppHolder> {
|
||||
public void onClick(View view) {
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
mContext.startActivity(new Intent(mContext, PasswordActivity.class));
|
||||
} else if (AppManager.UPDATE_NAME.equals(pkg)) {
|
||||
Intent intent = new Intent();
|
||||
ComponentName componentName = new ComponentName("com.uiui.zy", "com.uiui.zy.activity.update.UpdateActivity");
|
||||
intent.setComponent(componentName);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
int setting_other_appInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (setting_other_appInstaller == 0
|
||||
|
||||
@@ -11,9 +11,6 @@ import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushConfig;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.alarm.AlarmUtils;
|
||||
@@ -23,14 +20,9 @@ import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
import com.uiui.zyos.push.PushManager;
|
||||
import com.uiui.zyos.receiver.APKinstallReceiver;
|
||||
import com.uiui.zyos.service.main.MainService;
|
||||
import com.uiui.zyos.utils.AppUsedTimeUtils;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.SystemUtils;
|
||||
import com.uiui.zyos.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = BaseApplication.class.getSimpleName();
|
||||
@@ -39,7 +31,7 @@ public class BaseApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if (!BuildConfig.DEBUG) {
|
||||
catchException();
|
||||
// catchException();
|
||||
}
|
||||
init();
|
||||
}
|
||||
@@ -55,14 +47,12 @@ public class BaseApplication extends Application {
|
||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||
Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||
PushManager.init(this);
|
||||
tpushInit();
|
||||
aliyunPushInit();
|
||||
RemoteManager.init(this);
|
||||
RemoteManager.setListener(new RemoteManager.ConnectedListener() {
|
||||
@Override
|
||||
public void onConnected() {
|
||||
RemoteManager.getInstance().aliyunPushInit();
|
||||
RemoteManager.getInstance().tpushInit();
|
||||
}
|
||||
});
|
||||
AlarmUtils.init(this);
|
||||
@@ -90,22 +80,6 @@ public class BaseApplication extends Application {
|
||||
registerReceiver(apKinstallReceiver, filter);
|
||||
}
|
||||
|
||||
private void tpushInit() {
|
||||
XGPushConfig.enableDebug(this, true);
|
||||
XGPushManager.registerPush(this, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
//token在设备卸载重装的时候有可能会变
|
||||
Log.e("TPush", "注册成功,设备token为:" + data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object data, int errCode, String msg) {
|
||||
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void aliyunPushInit() {
|
||||
PushServiceFactory.init(this);
|
||||
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
|
||||
@@ -107,11 +107,18 @@ public class UserPresenter implements UserContact.Presenter {
|
||||
@Override
|
||||
public void getInstalledApp() {
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getFilterAppList();
|
||||
DesktopIcon updateDesktopIcon = new DesktopIcon();
|
||||
updateDesktopIcon.setLable("应用更新");
|
||||
updateDesktopIcon.setPackageName(AppManager.UPDATE_NAME);
|
||||
updateDesktopIcon.setIcon(mContext.getDrawable(R.drawable.icon_update));
|
||||
desktopIcons.add(desktopIcons.size(), updateDesktopIcon);
|
||||
|
||||
DesktopIcon desktopIcon = new DesktopIcon();
|
||||
desktopIcon.setLable("添加应用");
|
||||
desktopIcon.setPackageName("com.zyos.add");
|
||||
desktopIcon.setPackageName(AppManager.ADD_NAME);
|
||||
desktopIcon.setIcon(mContext.getDrawable(R.drawable.icon_add));
|
||||
desktopIcons.add(desktopIcons.size(), desktopIcon);
|
||||
|
||||
mView.setInstalledApp(desktopIcons);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class JxwPackageConfig {
|
||||
public static final String JXW_PINYIN_CLASS_NAME = "com.jxw.learnchinesepinyin.activity.MainActivity";
|
||||
/*笔画名称*/
|
||||
public static final String JXW_BIHUA_PACKAGE_NAME = "com.jxw.bihuamingcheng";
|
||||
public static final String JXW_BIHUA_CLASS_NAME = "com.jxw.online_study.activity.InterestingLanguageActivity";
|
||||
public static final String JXW_BIHUA_CLASS_NAME = "com.example.viewpageindicator.MainActivity";
|
||||
/*偏旁部首*/
|
||||
public static final String JXW_PIANPANG_PACKAGE_NAME = "com.example.pianpangbushou";
|
||||
public static final String JXW_PIANPANG_CLASS_NAME = "com.example.viewpageindicator.MainActivity";
|
||||
|
||||
@@ -30,6 +30,7 @@ public class AppManager {
|
||||
private static final String TAG = AppManager.class.getSimpleName();
|
||||
|
||||
public static final String ADD_NAME = "com.zyos.add";
|
||||
public static final String UPDATE_NAME = "com.zyos.update";
|
||||
private static final String SHOW_PACKAGE_KEY = "SHOW_PACKAGE_KEY";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
||||
@@ -16,8 +16,6 @@ import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.bean.MapBean;
|
||||
@@ -170,29 +168,10 @@ public class RemoteManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void tpushInit() {
|
||||
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
|
||||
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), RemoteManager.getInstance().getSerial()));
|
||||
XGPushManager.upsertAccounts(mContext, accountInfoList, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
Log.e("TPush", "onSuccess, data:" + data + ", flag:" + flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object data, int errCode, String msg) {
|
||||
Log.e("TPush", "onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 获取sn
|
||||
*/
|
||||
public String getSerial() {
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// return "1234567890ab";
|
||||
// }
|
||||
if (mGetInfoInterface != null) {
|
||||
try {
|
||||
return mGetInfoInterface.getSerial();
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.uiui.zyos.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";
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
package com.uiui.zyos.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.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 com.uiui.zyos.push.PushManager;
|
||||
import com.uiui.zyos.push.tpush.common.NotificationService;
|
||||
import com.uiui.zyos.push.tpush.po.XGNotification;
|
||||
import com.uiui.zyos.utils.ToastUtil;
|
||||
|
||||
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";
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
/**
|
||||
* 消息透传处理
|
||||
*
|
||||
* @param context
|
||||
* @param message 解析自定义的 JSON
|
||||
*/
|
||||
@Override
|
||||
public void onTextMessage(Context context, XGPushTextMessage message) {
|
||||
this.mContext = context;
|
||||
this.mResolver = context.getContentResolver();
|
||||
this.mPackageManager = context.getPackageManager();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.uiui.zyos.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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.uiui.zyos.push.tpush.common;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
|
||||
import com.uiui.zyos.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.uiui.zyos.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;
|
||||
}
|
||||
}
|
||||
@@ -71,17 +71,18 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
// context.sendBroadcast(alarmIntent);
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
break;
|
||||
case Intent.ACTION_BATTERY_CHANGED:
|
||||
case Intent.ACTION_BATTERY_LOW:
|
||||
case Intent.ACTION_BATTERY_OKAY:
|
||||
case Intent.ACTION_POWER_CONNECTED:
|
||||
case Intent.ACTION_POWER_DISCONNECTED:
|
||||
case Intent.ACTION_DATE_CHANGED:
|
||||
case Intent.ACTION_TIME_TICK:
|
||||
case Intent.ACTION_USER_PRESENT:
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
break;
|
||||
// TODO: 2023/6/17 频繁唤醒耗电
|
||||
// case Intent.ACTION_BATTERY_CHANGED:
|
||||
// case Intent.ACTION_BATTERY_LOW:
|
||||
// case Intent.ACTION_BATTERY_OKAY:
|
||||
// case Intent.ACTION_POWER_CONNECTED:
|
||||
// case Intent.ACTION_POWER_DISCONNECTED:
|
||||
// case Intent.ACTION_DATE_CHANGED:
|
||||
// case Intent.ACTION_TIME_TICK:
|
||||
// case Intent.ACTION_USER_PRESENT:
|
||||
// case Intent.ACTION_SCREEN_OFF:
|
||||
// case Intent.ACTION_SCREEN_ON:
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
public class MainService extends BaseService implements MainSContact.MainSView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = MainService.class.getSimpleName();
|
||||
|
||||
|
||||
public MainSPresenter mPresenter;
|
||||
|
||||
public MainService() {
|
||||
@@ -59,7 +58,7 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
mPresenter.getCloudLessonSettings();
|
||||
registerAlarmReceiver();
|
||||
// registerAlarmReceiver();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
startJxwLauncher();
|
||||
}
|
||||
@@ -90,9 +89,9 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
}
|
||||
|
||||
private void unregisterReceiver() {
|
||||
if (alarmReceiver != null) {
|
||||
unregisterReceiver(alarmReceiver);
|
||||
}
|
||||
// if (alarmReceiver != null) {
|
||||
// unregisterReceiver(alarmReceiver);
|
||||
// }
|
||||
}
|
||||
|
||||
public static final String ALARMWAKEUP = "ALARM_WAKEUP";
|
||||
@@ -158,7 +157,7 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
|
||||
@Override
|
||||
public void setCloudLessonSettings() {
|
||||
mPresenter.getAlarmClock();
|
||||
// mPresenter.getAlarmClock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_update.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_update.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/drawable-hdpi/jxw_update.png
Normal file
BIN
app/src/main/res/drawable-hdpi/jxw_update.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
@@ -12,7 +12,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="语文基础"
|
||||
android:text="阅读写作"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_20"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -307,6 +307,37 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_icon7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_icon7" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon8"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/jxw_update"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_appname8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="学习资源"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_7"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_icon8"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_icon8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_icon8" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -12,7 +12,6 @@ buildscript {
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
||||
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Reference in New Issue
Block a user