Compare commits
2 Commits
e3fdac7bb0
...
cde179becc
| Author | SHA1 | Date | |
|---|---|---|---|
| cde179becc | |||
| 759a262658 |
8
.idea/deploymentTargetSelector.xml
generated
8
.idea/deploymentTargetSelector.xml
generated
@@ -446,6 +446,14 @@
|
|||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DialogSelection />
|
<DialogSelection />
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="titanplayz">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DialogSelection />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="amazy">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DialogSelection />
|
||||||
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@@ -30,6 +30,7 @@
|
|||||||
<option value="$PROJECT_DIR$/aa7au" />
|
<option value="$PROJECT_DIR$/aa7au" />
|
||||||
<option value="$PROJECT_DIR$/afb77au" />
|
<option value="$PROJECT_DIR$/afb77au" />
|
||||||
<option value="$PROJECT_DIR$/aipokies" />
|
<option value="$PROJECT_DIR$/aipokies" />
|
||||||
|
<option value="$PROJECT_DIR$/amazy" />
|
||||||
<option value="$PROJECT_DIR$/aud2u26" />
|
<option value="$PROJECT_DIR$/aud2u26" />
|
||||||
<option value="$PROJECT_DIR$/auplayx" />
|
<option value="$PROJECT_DIR$/auplayx" />
|
||||||
<option value="$PROJECT_DIR$/b88" />
|
<option value="$PROJECT_DIR$/b88" />
|
||||||
@@ -80,6 +81,7 @@
|
|||||||
<option value="$PROJECT_DIR$/slotkaki33" />
|
<option value="$PROJECT_DIR$/slotkaki33" />
|
||||||
<option value="$PROJECT_DIR$/telur33" />
|
<option value="$PROJECT_DIR$/telur33" />
|
||||||
<option value="$PROJECT_DIR$/test" />
|
<option value="$PROJECT_DIR$/test" />
|
||||||
|
<option value="$PROJECT_DIR$/titanplayz" />
|
||||||
<option value="$PROJECT_DIR$/toke66a" />
|
<option value="$PROJECT_DIR$/toke66a" />
|
||||||
<option value="$PROJECT_DIR$/u8888aud" />
|
<option value="$PROJECT_DIR$/u8888aud" />
|
||||||
<option value="$PROJECT_DIR$/uu3au" />
|
<option value="$PROJECT_DIR$/uu3au" />
|
||||||
|
|||||||
2
amazy/.gitignore
vendored
Normal file
2
amazy/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/release
|
||||||
93
amazy/build.gradle
Normal file
93
amazy/build.gradle
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
id 'com.google.gms.google-services'
|
||||||
|
}
|
||||||
|
|
||||||
|
def appOutPutName = "amazy"
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace rootProject.ext.namespace
|
||||||
|
compileSdk 36
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 24
|
||||||
|
targetSdk 36
|
||||||
|
versionCode rootProject.ext.versionCode
|
||||||
|
versionName rootProject.ext.versionName
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
applicationId "com.company.amazy"
|
||||||
|
|
||||||
|
//app大背景色
|
||||||
|
resValue('color', 'windows_color', '#000000')
|
||||||
|
//底部导航栏颜色 大背景颜色为 windows_color——style_color的上下渐变色
|
||||||
|
resValue('color', 'style_color', '#FFFFFF')
|
||||||
|
//app 名字
|
||||||
|
resValue('string', 'app_name', 'Amazy')
|
||||||
|
|
||||||
|
|
||||||
|
buildConfigField "String", "BASE_URL", "\"https://live22x.com/\""
|
||||||
|
buildConfigField "int", "USERID", "311"
|
||||||
|
buildConfigField "boolean", "IS_WHITE", "false"
|
||||||
|
buildConfigField "boolean", "IS_ROUND", "true"
|
||||||
|
buildConfigField "int", "ROUND_RADIUS", "10"
|
||||||
|
buildConfigField "boolean", "HAS_CONTACT", "true"
|
||||||
|
buildConfigField "boolean", "HAS_HOOK", "false"
|
||||||
|
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file('telur33.jks')
|
||||||
|
storePassword "android2014"
|
||||||
|
keyAlias 'key0'
|
||||||
|
keyPassword "android2014"
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
storeFile file('telur33.jks')
|
||||||
|
storePassword "android2014"
|
||||||
|
keyAlias 'key0'
|
||||||
|
keyPassword "android2014"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility rootProject.ext.JAVA_VERSION
|
||||||
|
targetCompatibility rootProject.ext.JAVA_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.all {
|
||||||
|
def outputDir = new File(rootProject.ext.outputPath)
|
||||||
|
outputDir.mkdirs()
|
||||||
|
def outputFileName = "${appOutPutName}.apk"
|
||||||
|
setOutputFileName(outputFileName)
|
||||||
|
def newOutputFile = new File(outputDir, outputFileName)
|
||||||
|
newOutputFile.parentFile.mkdirs()
|
||||||
|
variant.assemble.doLast {
|
||||||
|
try {
|
||||||
|
java.nio.file.Files.copy(
|
||||||
|
outputFile.toPath(),
|
||||||
|
newOutputFile.toPath(),
|
||||||
|
java.nio.file.StandardCopyOption.REPLACE_EXISTING
|
||||||
|
)
|
||||||
|
} catch (java.io.IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(path: ':base')
|
||||||
|
}
|
||||||
29
amazy/google-services.json
Normal file
29
amazy/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "905601979176",
|
||||||
|
"project_id": "amazy-e3d7c",
|
||||||
|
"storage_bucket": "amazy-e3d7c.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:905601979176:android:f96e644d9e158dcd48f61d",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.company.amazy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAsN-ObGVj3vhyNNgiVJKQF_S81puA4ij0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
BIN
amazy/justlet.jks
Normal file
BIN
amazy/justlet.jks
Normal file
Binary file not shown.
32
amazy/proguard-rules.pro
vendored
Normal file
32
amazy/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-dontwarn dalvik.**
|
||||||
|
-dontwarn com.tencent.smtt.**
|
||||||
|
|
||||||
|
-keep class com.tencent.smtt.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class com.tencent.tbs.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
67
amazy/src/main/AndroidManifest.xml
Normal file
67
amazy/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- <uses-permission android:name="android.permission.READ_CONTACTS" />-->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<!-- 8.0+系统需要-->
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
|
<!--推送权限-->
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".WebApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:icon="@mipmap/app_logo"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:roundIcon="@mipmap/app_logo"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.AppTheme"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".IndexActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
android:exported="true"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:theme="@style/AppThemeStart">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".MyFirebaseMessageingService"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||||
|
android:resource="@mipmap/app_logo" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_color"
|
||||||
|
android:resource="@color/notify_color" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||||
|
android:value="@string/app_name" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
79
amazy/src/main/java/com/webclip/base/IndexActivity.java
Normal file
79
amazy/src/main/java/com/webclip/base/IndexActivity.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
|
public class IndexActivity extends MainActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
initConfig();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initWinwdowLogoConfig();
|
||||||
|
// registerFCM();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void regFcm() {
|
||||||
|
super.regFcm();
|
||||||
|
registerFCM();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册FCM
|
||||||
|
*/
|
||||||
|
private void registerFCM() {
|
||||||
|
//订阅主题
|
||||||
|
LogUtils.i("支持FCM 去注册");
|
||||||
|
try {
|
||||||
|
FirebaseMessaging.getInstance().subscribeToTopic("demo")
|
||||||
|
.addOnCompleteListener(task -> {
|
||||||
|
String msg = "Subscribed";
|
||||||
|
if (!task.isSuccessful()) {
|
||||||
|
msg = "Subscribe failed";
|
||||||
|
}else{
|
||||||
|
checkNotify();
|
||||||
|
}
|
||||||
|
LogUtils.i("支持FCM 结果:"+msg);
|
||||||
|
});
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
LogUtils.i("支持FCM Exception");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于修改大背景渐变色 不设置
|
||||||
|
*/
|
||||||
|
private void initWinwdowLogoConfig() {
|
||||||
|
//全局大背景 一个上下渐变 不要动
|
||||||
|
setBackDrawables(R.drawable.big_bg);
|
||||||
|
setImageView(BuildConfig.IS_ROUND,BuildConfig.ROUND_RADIUS);
|
||||||
|
getWindow().getDecorView().setBackgroundResource(R.drawable.big_bg);
|
||||||
|
|
||||||
|
//需要修改启动页logo在这里弄 一般启动页logo就是app_logo 没特殊要求 不要动
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础配置都在这里
|
||||||
|
* 不要动
|
||||||
|
*/
|
||||||
|
private void initConfig() {
|
||||||
|
|
||||||
|
//===========================以下是APP的配置信息 都写在 app_config.xml中==================================
|
||||||
|
userId = BuildConfig.USERID;
|
||||||
|
saveInt(IndexActivity.this,"user_code",userId);
|
||||||
|
|
||||||
|
saveString(this, "base_url",BuildConfig.BASE_URL);
|
||||||
|
styleColor = getColor(R.color.style_color);
|
||||||
|
windowsColor = getColor(R.color.windows_color);
|
||||||
|
isWhite = BuildConfig.IS_WHITE;
|
||||||
|
hasContact = BuildConfig.HAS_CONTACT;
|
||||||
|
hasHook = BuildConfig.HAS_HOOK;
|
||||||
|
|
||||||
|
//===========================以上是APP的配置信息 都写在 app_config.xml中==================================
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||||
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.webclip.base.GsonUtils;
|
||||||
|
import com.webclip.base.MessageInfo;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||||
|
|
||||||
|
public MyFirebaseMessageingService() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
|
||||||
|
super.onMessageReceived(remoteMessage);
|
||||||
|
Map<String, String> serviceData = remoteMessage.getData(); //后台推送数据
|
||||||
|
if (serviceData != null && serviceData.containsKey("message")) {
|
||||||
|
String value = serviceData.get("message");
|
||||||
|
Gson gson = new Gson();
|
||||||
|
MessageInfo messageInfo = gson.fromJson(value, MessageInfo.class);
|
||||||
|
showNotification(messageInfo);
|
||||||
|
} else {
|
||||||
|
//收到通知 创建notify
|
||||||
|
if (remoteMessage.getNotification() != null) {
|
||||||
|
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNotification(MessageInfo messageInfo) {
|
||||||
|
Intent notifyIntent = new Intent(this, IndexActivity.class);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
ComponentName launchComponent = null;
|
||||||
|
launchComponent = getApplication()
|
||||||
|
.getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||||
|
.getComponent();
|
||||||
|
notifyIntent.setComponent(launchComponent);
|
||||||
|
}
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
|
notifyIntent.putExtra("message", messageInfo);
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationChannel channelwinway = null;
|
||||||
|
NotificationCompat.Builder notificationBuilder = null;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
channelwinway = new NotificationChannel(getString(R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
|
channelwinway.enableLights(true);
|
||||||
|
channelwinway.enableVibration(true);
|
||||||
|
notificationManager.createNotificationChannel(channelwinway);
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(messageInfo.getTitle())
|
||||||
|
.setContentText(messageInfo.getContent())
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
} else {
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, getString(R.string.app_name))
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(messageInfo.getTitle())
|
||||||
|
.setContentText(messageInfo.getContent())
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
}
|
||||||
|
notificationManager.notify(0, notificationBuilder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNotification(String title, String body) {
|
||||||
|
Intent notifyIntent = new Intent(this, IndexActivity.class);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
ComponentName launchComponent = null;
|
||||||
|
launchComponent = getApplication()
|
||||||
|
.getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||||
|
.getComponent();
|
||||||
|
notifyIntent.setComponent(launchComponent);
|
||||||
|
}
|
||||||
|
notifyIntent.putExtra("message", body);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationChannel channelwinway = null;
|
||||||
|
NotificationCompat.Builder notificationBuilder = null;
|
||||||
|
MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
||||||
|
if (messageInfo != null) {
|
||||||
|
body = messageInfo.getContent();
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
channelwinway = new NotificationChannel(getString(R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
|
channelwinway.enableLights(true);
|
||||||
|
channelwinway.enableVibration(true);
|
||||||
|
notificationManager.createNotificationChannel(channelwinway);
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(title)
|
||||||
|
.setContentText(body)
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
} else {
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, getString(R.string.app_name))
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(title)
|
||||||
|
.setContentText(body)
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
}
|
||||||
|
notificationManager.notify(0, notificationBuilder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
19
amazy/src/main/java/com/webclip/base/WebApplication.java
Normal file
19
amazy/src/main/java/com/webclip/base/WebApplication.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.webclip.base.LogUtils;
|
||||||
|
|
||||||
|
public class WebApplication extends Application {
|
||||||
|
|
||||||
|
|
||||||
|
public static Context application;
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
// 设置开启优化方案
|
||||||
|
application = this;
|
||||||
|
LogUtils.isDebug = BuildConfig.BUILD_TYPE.equals("debug");
|
||||||
|
}
|
||||||
|
}
|
||||||
9
amazy/src/main/res/drawable/big_bg.xml
Normal file
9
amazy/src/main/res/drawable/big_bg.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:startColor="@color/windows_color"
|
||||||
|
android:centerColor="@color/windows_color"
|
||||||
|
android:endColor="@color/style_color"/>
|
||||||
|
</shape>
|
||||||
BIN
amazy/src/main/res/mipmap-xxhdpi/app_logo.jpg
Normal file
BIN
amazy/src/main/res/mipmap-xxhdpi/app_logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
91
amazy/src/main/res/values/themes.xml
Normal file
91
amazy/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="android:windowBackground">#000000</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Calculcator1" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<item name="android:windowFullscreen">true</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<declare-styleable name="CircleImageView">
|
||||||
|
<attr name="ease_border_color" format="color" />
|
||||||
|
<attr name="ease_border_width" format="dimension" />
|
||||||
|
<attr name="ease_press_alpha" format="integer" />
|
||||||
|
<attr name="ease_press_color" format="color" />
|
||||||
|
<attr name="ease_radius" format="dimension" />
|
||||||
|
<attr name="es_shape_type" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="round" value="1" />
|
||||||
|
<enum name="rectangle" value="2" />
|
||||||
|
</attr>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 注意:当前AppTheme主题,在values-v23中单独重复维护。原因是Android 6以下系统不支持设置
|
||||||
|
系统状态栏颜色,如果按照设计,状态栏使用素色则在android6以下手机上就看不清系统状态栏文字了(
|
||||||
|
因为系统文字是白色)。在values-v23表示当Android 23(即android 6)及以上版本将自动使用该目录
|
||||||
|
下的主题(即 colorPrimaryDark 使用素色,从而跟标题栏颜色保持一致,实现沉浸式ui效果)。-->
|
||||||
|
<style name="AppThemeStart" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">false</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="colorPrimary">@color/windows_color</item>
|
||||||
|
<item name="colorPrimaryDark">@color/windows_color</item>
|
||||||
|
<item name="colorAccent">@color/windows_color</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<!-- 隐藏Activity窗口的Title标题栏 -->
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<!-- <item name="android:windowFullscreen">true</item>-->
|
||||||
|
<!-- <item name="android:windowBackground">@drawable/splah_bg</item>-->
|
||||||
|
|
||||||
|
<item name="android:navigationBarColor">@color/style_color</item>
|
||||||
|
<!-- <item name="android:windowBackground">@mipmap/big_bg</item>-->
|
||||||
|
<item name="android:forceDarkAllowed" tools:ignore="NewApi">false</item>
|
||||||
|
<item name="android:windowBackground">@drawable/big_bg</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="MaterialDesignDialog" parent="@style/Theme.AppCompat.Dialog">
|
||||||
|
<!-- 背景透明 -->
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<!-- 浮于Activity之上 -->
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<!-- 边框 -->
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<!-- Dialog以外的区域模糊效果 -->
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
<!-- 无标题 -->
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<!-- 半透明 -->
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowCloseOnTouchOutside">true</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
10
amazy/src/main/res/xml/app_updater_paths.xml
Normal file
10
amazy/src/main/res/xml/app_updater_paths.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<root-path name="app_root_path" path="/"/>
|
||||||
|
<external-path name="app_external_path" path="/"/>
|
||||||
|
<external-cache-path name="app_external_cache_path" path="/"/>
|
||||||
|
<external-files-path name="app_external_files_path" path="/"/>
|
||||||
|
<files-path name="app_files_path" path="/"/>
|
||||||
|
<cache-path name="app_cache_path" path="/"/>
|
||||||
|
|
||||||
|
</paths>
|
||||||
4
amazy/src/main/res/xml/network_security_config.xml
Normal file
4
amazy/src/main/res/xml/network_security_config.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config>
|
||||||
|
<base-config cleartextTrafficPermitted="true" />
|
||||||
|
</network-security-config>
|
||||||
13
amazy/src/main/res/xml/provider_paths.xml
Normal file
13
amazy/src/main/res/xml/provider_paths.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding= "utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<paths >
|
||||||
|
<external-path name="external_files" path="."/>
|
||||||
|
<root-path name="root" path="." />
|
||||||
|
<files-path name="files" path="." />
|
||||||
|
<cache-path name="cache" path="." />
|
||||||
|
<external-files-path name="external_files_f" path="." />
|
||||||
|
<external-cache-path name="external_cache" path="." />
|
||||||
|
</paths >
|
||||||
|
</resources>
|
||||||
|
<!-- 适配7.0及其以上,配合com.eva.android.OpenFileUtil,用于解决调用系统Intent查看大文件内
|
||||||
|
容、拍照保存图片的功能时出现"android.os.FileUriExposedException"异常的问题 -->
|
||||||
BIN
amazy/telur33.jks
Normal file
BIN
amazy/telur33.jks
Normal file
Binary file not shown.
@@ -38,12 +38,6 @@ public interface ApiService {
|
|||||||
@PUT("api/statistics/use")
|
@PUT("api/statistics/use")
|
||||||
Observable<Result> totalTongJi(@Body Map<String, Object> map);
|
Observable<Result> totalTongJi(@Body Map<String, Object> map);
|
||||||
|
|
||||||
/**
|
|
||||||
* 统计通知
|
|
||||||
*/
|
|
||||||
@POST("api/push/statistics")
|
|
||||||
Observable<Result> totalNotify(@Body Map<String, Object> map);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传通讯录
|
* 上传通讯录
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +54,28 @@ public interface ApiService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("api/push/pushRecords")
|
@GET("api/push/pushRecords")
|
||||||
Observable<Result<ResultDataInfo<MessageInfo>>> getNotifyList(@Query("userId") int userid, @Query("page") int page, @Query("size") int size);
|
Observable<Result<ResultDataInfo<MessageInfo>>> getNotifyList(
|
||||||
|
@Query("userId") int userid,
|
||||||
|
@Query("page") int page,
|
||||||
|
@Query("size") int size,
|
||||||
|
@Query("isScheduler") int isScheduler
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通知详情。查询成功后,后端会异步将该通知的阅读次数加一。
|
||||||
|
*/
|
||||||
|
@GET("api/push/client/pushRecord/{id}")
|
||||||
|
Observable<Result<MessageInfo>> getNotifyDetail(@Path("id") int pushId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报站点用户信息(从网页 localStorage 抓取并净化后的登录用户)
|
||||||
|
* body 至少包含 userId(本系统内的网站ID)、domain(站点域名)、userInfo(净化后的用户信息JSON)
|
||||||
|
* 后端需按手机号再做一次去重(手机号字段名不一定是 mobile)
|
||||||
|
* TODO 接口路径待后端确认后替换(当前为占位地址)
|
||||||
|
*/
|
||||||
|
@POST("api/statistics/user")
|
||||||
|
Observable<Result> reportSiteUser(@Body Map<String, Object> map);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void getNotifyList() {
|
public void getNotifyList() {
|
||||||
|
|
||||||
Api.getInstance().getNotifyList(userId, 1, 1)
|
Api.getInstance().getNotifyList(userId, 1, 1, 0)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<>() {
|
||||||
@@ -956,14 +956,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void recordNotify(int pushId) {
|
public void recordNotify(int pushId) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
if (pushId <= 0) {
|
||||||
map.put("pushId", pushId);
|
return;
|
||||||
Api.getInstance().totalNotify(map)
|
}
|
||||||
|
Api.getInstance().getNotifyDetail(pushId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<Result<MessageInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Result o) {
|
public void onSuccess(Result<MessageInfo> o) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,7 +973,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError2(Result o) {
|
public void onError2(Result<MessageInfo> o) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -983,6 +984,50 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
boolean hasSignIn = false;
|
boolean hasSignIn = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要在网页 localStorage 中探测的用户信息字段(按优先级从前往后取第一个命中的)
|
||||||
|
*/
|
||||||
|
private static final String[] SITE_USER_STORAGE_KEYS = {
|
||||||
|
"USER", "user", "userInfo", "user_info", "userinfo", "userData", "user_data",
|
||||||
|
"userDetail", "userDetails", "currentUser", "current_user", "currentUserInfo",
|
||||||
|
"member", "memberInfo", "member_info", "memberData", "member_data",
|
||||||
|
"loginUser", "login_user", "loginInfo", "login_info", "loginData",
|
||||||
|
"authUser", "auth_user", "auth", "authInfo", "auth_info", "authData",
|
||||||
|
"account", "accountInfo", "account_info", "accountData",
|
||||||
|
"player", "playerInfo", "player_info", "playerData", "player_data",
|
||||||
|
"profile", "userProfile", "user_profile", "customer", "customerInfo",
|
||||||
|
"me", "sessionUser", "session_user"
|
||||||
|
};
|
||||||
|
|
||||||
|
// 抓到用户信息之前的轮询间隔:30 秒
|
||||||
|
private static final long SITE_USER_POLL_INTERVAL_SHORT = 30 * 1000L;
|
||||||
|
// 抓到用户信息之后的复查间隔:1 天
|
||||||
|
private static final long SITE_USER_POLL_INTERVAL_LONG = 24 * 60 * 60 * 1000L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端去重用的手机号候选字段:手机号不一定都在 mobile 字段里,按顺序取第一个命中的。
|
||||||
|
*/
|
||||||
|
private static final String[] SITE_USER_PHONE_KEYS = {
|
||||||
|
"mobile", "mobileNo", "mobileNum", "mobileNumber", "mobile_number", "mobile_no",
|
||||||
|
"phone", "phoneNo", "phoneNum", "phoneNumber", "phone_number", "phone_no",
|
||||||
|
"tel", "telephone", "cellphone", "cell", "contact", "contactNo", "contactNumber",
|
||||||
|
"msisdn"
|
||||||
|
};
|
||||||
|
// 本地保存的去重标识(优先手机号,取不到则用整份用户信息),用于判断是否已上报过
|
||||||
|
private static final String SP_KEY_SITE_USER_DEDUP = "site_user_dedup";
|
||||||
|
|
||||||
|
private boolean siteUserPollingStarted = false;
|
||||||
|
private long siteUserPollInterval = SITE_USER_POLL_INTERVAL_SHORT;
|
||||||
|
|
||||||
|
private final Runnable siteUserPollRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
pollSiteUserOnce();
|
||||||
|
// 探测一次后按当前间隔继续排下一次
|
||||||
|
handler.postDelayed(this, siteUserPollInterval);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private boolean isMainPageUrl(String targetUrl) {
|
private boolean isMainPageUrl(String targetUrl) {
|
||||||
return !TextUtils.isEmpty(targetUrl) && !TextUtils.isEmpty(url) && targetUrl.startsWith(url);
|
return !TextUtils.isEmpty(targetUrl) && !TextUtils.isEmpty(url) && targetUrl.startsWith(url);
|
||||||
}
|
}
|
||||||
@@ -997,6 +1042,155 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
LogUtils.i("WebViewURL[" + stage + "]: " + rawUrl + " | host=" + host + " | scheme=" + uri.getScheme());
|
LogUtils.i("WebViewURL[" + stage + "]: " + rawUrl + " | host=" + host + " | scheme=" + uri.getScheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动 localStorage 用户信息轮询(全局只启动一次)。
|
||||||
|
* 若本地已有去重记录说明之前已命中,直接按长间隔复查是否变化。
|
||||||
|
*/
|
||||||
|
private void startSiteUserPolling() {
|
||||||
|
if (siteUserPollingStarted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
siteUserPollingStarted = true;
|
||||||
|
String stored = getString(MainActivity.this, SP_KEY_SITE_USER_DEDUP, "");
|
||||||
|
siteUserPollInterval = TextUtils.isEmpty(stored)
|
||||||
|
? SITE_USER_POLL_INTERVAL_SHORT : SITE_USER_POLL_INTERVAL_LONG;
|
||||||
|
handler.postDelayed(siteUserPollRunnable, siteUserPollInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行一次 localStorage 探测:注入 JS 按优先级读取命中的用户信息并做净化,
|
||||||
|
* 返回净化后的 JSON 字符串(非登录/无有效用户时返回 null)。
|
||||||
|
*/
|
||||||
|
private void pollSiteUserOnce() {
|
||||||
|
if (activityMain2Binding == null || activityMain2Binding.webview == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String keysJson = new Gson().toJson(SITE_USER_STORAGE_KEYS);
|
||||||
|
String js = "(function(){try{"
|
||||||
|
+ "var KS=" + keysJson + ";"
|
||||||
|
+ "function readRaw(){for(var i=0;i<KS.length;i++){var r=localStorage.getItem(KS[i]);"
|
||||||
|
+ "if(r!=null&&String(r).trim())return r;}return null;}"
|
||||||
|
+ "function sani(raw){if(raw==null)return null;var t=String(raw).trim();if(!t)return null;"
|
||||||
|
+ "var d;try{d=JSON.parse(t);}catch(e){return null;}"
|
||||||
|
+ "if(d===null||typeof d!=='object'||Array.isArray(d))return null;"
|
||||||
|
+ "['bonus','gameAccess','time','timebonus','rollover','banks'].forEach(function(k){if(k in d)delete d[k];});"
|
||||||
|
+ "if(Object.keys(d).length===0)return null;return JSON.stringify(d);}"
|
||||||
|
+ "return sani(readRaw());"
|
||||||
|
+ "}catch(e){return null;}})();";
|
||||||
|
try {
|
||||||
|
activityMain2Binding.webview.evaluateJavascript(js, this::onSiteUserResult);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理 JS 探测结果。evaluateJavascript 回调返回的是 JS 值的 JSON 编码形式,字符串需要先解一层。
|
||||||
|
*/
|
||||||
|
private void onSiteUserResult(String rawResult) {
|
||||||
|
if (TextUtils.isEmpty(rawResult) || "null".equals(rawResult)) {
|
||||||
|
// 未登录或无有效用户信息,保持短间隔继续探测
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String userInfo;
|
||||||
|
try {
|
||||||
|
userInfo = new Gson().fromJson(rawResult, String.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
userInfo = rawResult;
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(userInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 已命中有效用户信息,切换为长间隔(1天)复查
|
||||||
|
siteUserPollInterval = SITE_USER_POLL_INTERVAL_LONG;
|
||||||
|
|
||||||
|
// 前端去重:优先按手机号,取不到再退化为整份用户信息
|
||||||
|
String phone = extractPhone(userInfo);
|
||||||
|
String dedupKey = TextUtils.isEmpty(phone) ? userInfo : phone;
|
||||||
|
|
||||||
|
String stored = getString(MainActivity.this, SP_KEY_SITE_USER_DEDUP, "");
|
||||||
|
if (dedupKey.equals(stored)) {
|
||||||
|
// 同一用户已上报过,跳过
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
saveString(MainActivity.this, SP_KEY_SITE_USER_DEDUP, dedupKey);
|
||||||
|
reportSiteUser(userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从用户信息 JSON 中提取手机号(手机号字段名不一定是 mobile)。
|
||||||
|
*/
|
||||||
|
private String extractPhone(String userInfoJson) {
|
||||||
|
try {
|
||||||
|
HashMap<String, Object> map = new Gson().fromJson(userInfoJson,
|
||||||
|
new com.google.gson.reflect.TypeToken<HashMap<String, Object>>() {
|
||||||
|
}.getType());
|
||||||
|
if (map != null) {
|
||||||
|
for (String key : SITE_USER_PHONE_KEYS) {
|
||||||
|
Object v = map.get(key);
|
||||||
|
if (v != null) {
|
||||||
|
String s = String.valueOf(v).trim();
|
||||||
|
if (!s.isEmpty() && !"null".equals(s)) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 解析失败时无手机号,返回空
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前 WebView 所在站点的域名(host)。
|
||||||
|
*/
|
||||||
|
private String getCurrentDomain() {
|
||||||
|
try {
|
||||||
|
String u = activityMain2Binding.webview.getUrl();
|
||||||
|
if (!TextUtils.isEmpty(u)) {
|
||||||
|
String host = Uri.parse(u).getHost();
|
||||||
|
if (host != null) {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报站点用户信息,绑定对应 app 的网站ID(userId) 和当前站点域名(domain)。
|
||||||
|
*/
|
||||||
|
private void reportSiteUser(String userInfo) {
|
||||||
|
HashMap<String, Object> body = new HashMap<>();
|
||||||
|
body.put("userId", userId);
|
||||||
|
body.put("domain", getCurrentDomain());
|
||||||
|
body.put("userInfo", userInfo);
|
||||||
|
Api.getInstance().reportSiteUser(body)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver<Result>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Result o) {
|
||||||
|
LogUtils.i("站点用户信息上报成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String msg) {
|
||||||
|
// 上报失败清掉去重记录,下次轮询可重试
|
||||||
|
saveString(MainActivity.this, SP_KEY_SITE_USER_DEDUP, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError2(Result o) {
|
||||||
|
saveString(MainActivity.this, SP_KEY_SITE_USER_DEDUP, "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// WebView webViews;
|
// WebView webViews;
|
||||||
WebViewClient webViewClient = new WebViewClient() {
|
WebViewClient webViewClient = new WebViewClient() {
|
||||||
@@ -1017,6 +1211,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
hasSignIn = true;
|
hasSignIn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 页面首次加载完成后启动 localStorage 用户信息轮询
|
||||||
|
startSiteUserPolling();
|
||||||
|
|
||||||
int w = View.MeasureSpec.makeMeasureSpec(0,
|
int w = View.MeasureSpec.makeMeasureSpec(0,
|
||||||
View.MeasureSpec.UNSPECIFIED);
|
View.MeasureSpec.UNSPECIFIED);
|
||||||
int h = View.MeasureSpec.makeMeasureSpec(0,
|
int h = View.MeasureSpec.makeMeasureSpec(0,
|
||||||
@@ -1350,6 +1547,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
// 停止用户信息轮询
|
||||||
|
handler.removeCallbacks(siteUserPollRunnable);
|
||||||
if (activityMain2Binding.webview!= null) {
|
if (activityMain2Binding.webview!= null) {
|
||||||
//加载null内容
|
//加载null内容
|
||||||
activityMain2Binding.webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
|
activityMain2Binding.webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class MessageInfo implements Serializable {
|
|||||||
private int pushId;
|
private int pushId;
|
||||||
private String createTime;
|
private String createTime;
|
||||||
private int recordId;
|
private int recordId;
|
||||||
|
private long receiveTimes;
|
||||||
|
private long readTimes;
|
||||||
public int status;
|
public int status;
|
||||||
private String jumpUrl;
|
private String jumpUrl;
|
||||||
private boolean isShowAll = false;
|
private boolean isShowAll = false;
|
||||||
@@ -30,6 +32,22 @@ public class MessageInfo implements Serializable {
|
|||||||
this.recordId = recordId;
|
this.recordId = recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getReceiveTimes() {
|
||||||
|
return receiveTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceiveTimes(long receiveTimes) {
|
||||||
|
this.receiveTimes = receiveTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getReadTimes() {
|
||||||
|
return readTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReadTimes(long readTimes) {
|
||||||
|
this.readTimes = readTimes;
|
||||||
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
|
|
||||||
private List<MessageInfo> listdata;
|
private List<MessageInfo> listdata;
|
||||||
private onItemClickPostionListener itemClickPostionListener;
|
private onItemClickPostionListener itemClickPostionListener;
|
||||||
|
private onItemExpandListener itemExpandListener;
|
||||||
private Context context;
|
private Context context;
|
||||||
private MessageInfo messageItem;
|
private MessageInfo messageItem;
|
||||||
|
|
||||||
@@ -49,6 +50,10 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
this.itemClickPostionListener = onItemClick;
|
this.itemClickPostionListener = onItemClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnItemExpand(onItemExpandListener onItemExpand) {
|
||||||
|
this.itemExpandListener = onItemExpand;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@@ -103,7 +108,8 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
holder.itemNotifyListBinding.tvMsgTime.setText(messageInfo.getCreateTime());
|
holder.itemNotifyListBinding.tvMsgTime.setText(messageInfo.getCreateTime());
|
||||||
holder.itemNotifyListBinding.ivNotifyjumpclick.setVisibility(View.GONE);
|
holder.itemNotifyListBinding.ivNotifyjumpclick.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.itemNotifyListBinding.lookIv.setText(longTime(messageInfo.getCreateTime()));
|
// 左下角眼睛图标显示后端返回的真实阅读次数
|
||||||
|
holder.itemNotifyListBinding.lookIv.setText(String.valueOf(messageInfo.getReadTimes()));
|
||||||
if (!TextUtils.isEmpty(messageInfo.getImage())) {
|
if (!TextUtils.isEmpty(messageInfo.getImage())) {
|
||||||
LogUtils.i("地址是啥:"+messageInfo.getImage());
|
LogUtils.i("地址是啥:"+messageInfo.getImage());
|
||||||
holder.itemNotifyListBinding.ivNotifyimage.setVisibility(View.VISIBLE);
|
holder.itemNotifyListBinding.ivNotifyimage.setVisibility(View.VISIBLE);
|
||||||
@@ -126,7 +132,11 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
holder.itemNotifyListBinding.layoutMore.setVisibility(View.GONE);
|
holder.itemNotifyListBinding.layoutMore.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.itemView.setOnClickListener(view -> {
|
holder.itemView.setOnClickListener(view -> {
|
||||||
messageInfo.setShowAll(!messageInfo.isShowAll());
|
boolean willExpand = !messageInfo.isShowAll();
|
||||||
|
messageInfo.setShowAll(willExpand);
|
||||||
|
if (willExpand && itemExpandListener != null) {
|
||||||
|
itemExpandListener.item(messageInfo);
|
||||||
|
}
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -167,4 +177,8 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
void item(int position);
|
void item(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface onItemExpandListener {
|
||||||
|
void item(MessageInfo messageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
adapter.setOnItemClick(position -> {
|
adapter.setOnItemClick(position -> {
|
||||||
try{
|
try{
|
||||||
MessageInfo messageInfo = listdata.get(position);
|
MessageInfo messageInfo = listdata.get(position);
|
||||||
|
recordNotify(messageInfo);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(messageInfo.getJumpUrl()));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(messageInfo.getJumpUrl()));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -89,8 +90,44 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
adapter.setOnItemExpand(this::recordNotify);
|
||||||
getNotifyList();
|
getNotifyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 小铃铛列表中用户展开通知时,按文档查询详情并异步增加阅读次数。 */
|
||||||
|
private void recordNotify(MessageInfo messageInfo) {
|
||||||
|
if (messageInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pushId = messageInfo.getPushId() > 0 ? messageInfo.getPushId() : messageInfo.getRecordId();
|
||||||
|
if (pushId <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Api.getInstance().getNotifyDetail(pushId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver<Result<MessageInfo>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Result<MessageInfo> o) {
|
||||||
|
// 后端采用异步最终一致,详情响应可能仍是加一前的值;稍后刷新列表读取最终值。
|
||||||
|
if (o != null && o.data != null && o.data.getReadTimes() > messageInfo.getReadTimes()) {
|
||||||
|
messageInfo.setReadTimes(o.data.getReadTimes());
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
activityNotifylistBinding.recyclerNofity.postDelayed(() -> getNotifyList(), 1200L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String msg) {
|
||||||
|
LogUtils.i("阅读次数上报失败 pushId=" + pushId + ", error=" + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError2(Result<MessageInfo> o) {
|
||||||
|
LogUtils.i("阅读次数上报失败 pushId=" + pushId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 启用Edge-to-Edge模式(核心方法)
|
* 启用Edge-to-Edge模式(核心方法)
|
||||||
*
|
*
|
||||||
@@ -121,7 +158,7 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void getNotifyList() {
|
public void getNotifyList() {
|
||||||
//通知列表
|
//通知列表
|
||||||
Api.getInstance().getNotifyList(userId, page, 10)
|
Api.getInstance().getNotifyList(userId, page, 10, 0)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<>() {
|
||||||
|
|||||||
@@ -38,13 +38,6 @@ public interface ApiService {
|
|||||||
@PUT("api/statistics/use")
|
@PUT("api/statistics/use")
|
||||||
Observable<Result> totalTongJi(@Body Map<String, Object> map);
|
Observable<Result> totalTongJi(@Body Map<String, Object> map);
|
||||||
|
|
||||||
/**
|
|
||||||
* 统计通知
|
|
||||||
*/
|
|
||||||
@POST("api/push/statistics")
|
|
||||||
Observable<Result> totalNotify(@Body Map<String, Object> map);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通知列表
|
* 获取通知列表
|
||||||
* @param userid
|
* @param userid
|
||||||
@@ -53,7 +46,18 @@ public interface ApiService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET("api/push/pushRecords")
|
@GET("api/push/pushRecords")
|
||||||
Observable<Result<ResultDataInfo<MessageInfo>>> getNotifyList(@Query("userId") int userid, @Query("page") int page, @Query("size") int size);
|
Observable<Result<ResultDataInfo<MessageInfo>>> getNotifyList(
|
||||||
|
@Query("userId") int userid,
|
||||||
|
@Query("page") int page,
|
||||||
|
@Query("size") int size,
|
||||||
|
@Query("isScheduler") int isScheduler
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通知详情。查询成功后,后端会异步将该通知的阅读次数加一。
|
||||||
|
*/
|
||||||
|
@GET("api/push/client/pushRecord/{id}")
|
||||||
|
Observable<Result<MessageInfo>> getNotifyDetail(@Path("id") int pushId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void getNotifyList() {
|
public void getNotifyList() {
|
||||||
|
|
||||||
Api.getInstance().getNotifyList(userId, 1, 1)
|
Api.getInstance().getNotifyList(userId, 1, 1, 0)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<>() {
|
||||||
@@ -814,14 +814,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void recordNotify(int pushId) {
|
public void recordNotify(int pushId) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
if (pushId <= 0) {
|
||||||
map.put("pushId", pushId);
|
return;
|
||||||
Api.getInstance().totalNotify(map)
|
}
|
||||||
|
Api.getInstance().getNotifyDetail(pushId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<Result<MessageInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Result o) {
|
public void onSuccess(Result<MessageInfo> o) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,7 +831,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError2(Result o) {
|
public void onError2(Result<MessageInfo> o) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class MessageInfo implements Serializable {
|
|||||||
private int pushId;
|
private int pushId;
|
||||||
private String createTime;
|
private String createTime;
|
||||||
private int recordId;
|
private int recordId;
|
||||||
|
private long receiveTimes;
|
||||||
|
private long readTimes;
|
||||||
public int status;
|
public int status;
|
||||||
private String jumpUrl;
|
private String jumpUrl;
|
||||||
private boolean isShowAll = false;
|
private boolean isShowAll = false;
|
||||||
@@ -30,6 +32,22 @@ public class MessageInfo implements Serializable {
|
|||||||
this.recordId = recordId;
|
this.recordId = recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getReceiveTimes() {
|
||||||
|
return receiveTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReceiveTimes(long receiveTimes) {
|
||||||
|
this.receiveTimes = receiveTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getReadTimes() {
|
||||||
|
return readTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReadTimes(long readTimes) {
|
||||||
|
this.readTimes = readTimes;
|
||||||
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
|
|
||||||
private List<MessageInfo> listdata;
|
private List<MessageInfo> listdata;
|
||||||
private onItemClickPostionListener itemClickPostionListener;
|
private onItemClickPostionListener itemClickPostionListener;
|
||||||
|
private onItemExpandListener itemExpandListener;
|
||||||
private Context context;
|
private Context context;
|
||||||
private MessageInfo messageItem;
|
private MessageInfo messageItem;
|
||||||
|
|
||||||
@@ -49,6 +50,10 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
this.itemClickPostionListener = onItemClick;
|
this.itemClickPostionListener = onItemClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnItemExpand(onItemExpandListener onItemExpand) {
|
||||||
|
this.itemExpandListener = onItemExpand;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@@ -103,7 +108,8 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
holder.itemNotifyListBinding.tvMsgTime.setText(messageInfo.getCreateTime());
|
holder.itemNotifyListBinding.tvMsgTime.setText(messageInfo.getCreateTime());
|
||||||
holder.itemNotifyListBinding.ivNotifyjumpclick.setVisibility(View.GONE);
|
holder.itemNotifyListBinding.ivNotifyjumpclick.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.itemNotifyListBinding.lookIv.setText(longTime(messageInfo.getCreateTime()));
|
// 左下角眼睛图标显示后端返回的真实阅读次数
|
||||||
|
holder.itemNotifyListBinding.lookIv.setText(String.valueOf(messageInfo.getReadTimes()));
|
||||||
if (!TextUtils.isEmpty(messageInfo.getImage())) {
|
if (!TextUtils.isEmpty(messageInfo.getImage())) {
|
||||||
LogUtils.i("地址是啥:"+messageInfo.getImage());
|
LogUtils.i("地址是啥:"+messageInfo.getImage());
|
||||||
holder.itemNotifyListBinding.ivNotifyimage.setVisibility(View.VISIBLE);
|
holder.itemNotifyListBinding.ivNotifyimage.setVisibility(View.VISIBLE);
|
||||||
@@ -126,7 +132,11 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
holder.itemNotifyListBinding.layoutMore.setVisibility(View.GONE);
|
holder.itemNotifyListBinding.layoutMore.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
holder.itemView.setOnClickListener(view -> {
|
holder.itemView.setOnClickListener(view -> {
|
||||||
messageInfo.setShowAll(!messageInfo.isShowAll());
|
boolean willExpand = !messageInfo.isShowAll();
|
||||||
|
messageInfo.setShowAll(willExpand);
|
||||||
|
if (willExpand && itemExpandListener != null) {
|
||||||
|
itemExpandListener.item(messageInfo);
|
||||||
|
}
|
||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -167,4 +177,8 @@ public class MyNotifyListAdapter extends RecyclerView.Adapter<MyNotifyListAdapte
|
|||||||
void item(int position);
|
void item(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface onItemExpandListener {
|
||||||
|
void item(MessageInfo messageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
adapter.setOnItemClick(position -> {
|
adapter.setOnItemClick(position -> {
|
||||||
try{
|
try{
|
||||||
MessageInfo messageInfo = listdata.get(position);
|
MessageInfo messageInfo = listdata.get(position);
|
||||||
|
recordNotify(messageInfo);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(messageInfo.getJumpUrl()));
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(messageInfo.getJumpUrl()));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -89,8 +90,44 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
adapter.setOnItemExpand(this::recordNotify);
|
||||||
getNotifyList();
|
getNotifyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 小铃铛列表中用户展开通知时,按文档查询详情并异步增加阅读次数。 */
|
||||||
|
private void recordNotify(MessageInfo messageInfo) {
|
||||||
|
if (messageInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pushId = messageInfo.getPushId() > 0 ? messageInfo.getPushId() : messageInfo.getRecordId();
|
||||||
|
if (pushId <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Api.getInstance().getNotifyDetail(pushId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver<Result<MessageInfo>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Result<MessageInfo> o) {
|
||||||
|
// 后端采用异步最终一致,详情响应可能仍是加一前的值;稍后刷新列表读取最终值。
|
||||||
|
if (o != null && o.data != null && o.data.getReadTimes() > messageInfo.getReadTimes()) {
|
||||||
|
messageInfo.setReadTimes(o.data.getReadTimes());
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
activityNotifylistBinding.recyclerNofity.postDelayed(() -> getNotifyList(), 1200L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String msg) {
|
||||||
|
LogUtils.i("阅读次数上报失败 pushId=" + pushId + ", error=" + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError2(Result<MessageInfo> o) {
|
||||||
|
LogUtils.i("阅读次数上报失败 pushId=" + pushId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 启用Edge-to-Edge模式(核心方法)
|
* 启用Edge-to-Edge模式(核心方法)
|
||||||
*
|
*
|
||||||
@@ -121,7 +158,7 @@ public class NotifyListActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void getNotifyList() {
|
public void getNotifyList() {
|
||||||
//通知列表
|
//通知列表
|
||||||
Api.getInstance().getNotifyList(userId, page, 10)
|
Api.getInstance().getNotifyList(userId, page, 10, 0)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<>() {
|
.subscribe(new BaseObserver<>() {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ plugins {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
outputPath = "${project.rootDir}/apks"
|
outputPath = "${project.rootDir}/apks"
|
||||||
versionCode = 131
|
versionCode = 100
|
||||||
versionName = "v1.3.1"
|
versionName = "v1.0.0"
|
||||||
namespace = "com.webclip.base"
|
namespace = "com.webclip.base"
|
||||||
JAVA_VERSION = JavaVersion.VERSION_17
|
JAVA_VERSION = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
@@ -100,3 +100,5 @@ include ':JDCLUB9VIP'//158
|
|||||||
include ':ANTBET'//307
|
include ':ANTBET'//307
|
||||||
include ':BOSSKU'//308
|
include ':BOSSKU'//308
|
||||||
include ':jpot9'//309
|
include ':jpot9'//309
|
||||||
|
include ':titanplayz'//310
|
||||||
|
include ':amazy'//311
|
||||||
2
titanplayz/.gitignore
vendored
Normal file
2
titanplayz/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/release
|
||||||
93
titanplayz/build.gradle
Normal file
93
titanplayz/build.gradle
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
id 'com.google.gms.google-services'
|
||||||
|
}
|
||||||
|
|
||||||
|
def appOutPutName = "FlyDragon"
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace rootProject.ext.namespace
|
||||||
|
compileSdk 36
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 24
|
||||||
|
targetSdk 36
|
||||||
|
versionCode rootProject.ext.versionCode
|
||||||
|
versionName rootProject.ext.versionName
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
applicationId "com.sbadab.FlyDragon"
|
||||||
|
|
||||||
|
//app大背景色
|
||||||
|
resValue('color', 'windows_color', '#000000')
|
||||||
|
//底部导航栏颜色 大背景颜色为 windows_color——style_color的上下渐变色
|
||||||
|
resValue('color', 'style_color', '#000000')
|
||||||
|
//app 名字
|
||||||
|
resValue('string', 'app_name', 'FlyDragon')
|
||||||
|
|
||||||
|
|
||||||
|
buildConfigField "String", "BASE_URL", "\"https://live22x.com/\""
|
||||||
|
buildConfigField "int", "USERID", "310"
|
||||||
|
buildConfigField "boolean", "IS_WHITE", "false"
|
||||||
|
buildConfigField "boolean", "IS_ROUND", "true"
|
||||||
|
buildConfigField "int", "ROUND_RADIUS", "10"
|
||||||
|
buildConfigField "boolean", "HAS_CONTACT", "true"
|
||||||
|
buildConfigField "boolean", "HAS_HOOK", "false"
|
||||||
|
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file('telur33.jks')
|
||||||
|
storePassword "android2014"
|
||||||
|
keyAlias 'key0'
|
||||||
|
keyPassword "android2014"
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
storeFile file('telur33.jks')
|
||||||
|
storePassword "android2014"
|
||||||
|
keyAlias 'key0'
|
||||||
|
keyPassword "android2014"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility rootProject.ext.JAVA_VERSION
|
||||||
|
targetCompatibility rootProject.ext.JAVA_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.all {
|
||||||
|
def outputDir = new File(rootProject.ext.outputPath)
|
||||||
|
outputDir.mkdirs()
|
||||||
|
def outputFileName = "${appOutPutName}.apk"
|
||||||
|
setOutputFileName(outputFileName)
|
||||||
|
def newOutputFile = new File(outputDir, outputFileName)
|
||||||
|
newOutputFile.parentFile.mkdirs()
|
||||||
|
variant.assemble.doLast {
|
||||||
|
try {
|
||||||
|
java.nio.file.Files.copy(
|
||||||
|
outputFile.toPath(),
|
||||||
|
newOutputFile.toPath(),
|
||||||
|
java.nio.file.StandardCopyOption.REPLACE_EXISTING
|
||||||
|
)
|
||||||
|
} catch (java.io.IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(path: ':base')
|
||||||
|
}
|
||||||
29
titanplayz/google-services.json
Normal file
29
titanplayz/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "546127961982",
|
||||||
|
"project_id": "titanplayz-a2589",
|
||||||
|
"storage_bucket": "titanplayz-a2589.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:546127961982:android:7a3eaeeee14fb134519d2f",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.sbadab.FlyDragon"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDTG90A20wZnkpFqez0Ohr7J-OnRMc9y-U"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
BIN
titanplayz/justlet.jks
Normal file
BIN
titanplayz/justlet.jks
Normal file
Binary file not shown.
32
titanplayz/proguard-rules.pro
vendored
Normal file
32
titanplayz/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-dontwarn dalvik.**
|
||||||
|
-dontwarn com.tencent.smtt.**
|
||||||
|
|
||||||
|
-keep class com.tencent.smtt.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class com.tencent.tbs.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
67
titanplayz/src/main/AndroidManifest.xml
Normal file
67
titanplayz/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- <uses-permission android:name="android.permission.READ_CONTACTS" />-->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<!-- 8.0+系统需要-->
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
|
<!--推送权限-->
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".WebApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:icon="@mipmap/app_logo"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:roundIcon="@mipmap/app_logo"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.AppTheme"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".IndexActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
android:exported="true"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:theme="@style/AppThemeStart">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".MyFirebaseMessageingService"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||||
|
android:resource="@mipmap/app_logo" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_color"
|
||||||
|
android:resource="@color/notify_color" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||||
|
android:value="@string/app_name" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
79
titanplayz/src/main/java/com/webclip/base/IndexActivity.java
Normal file
79
titanplayz/src/main/java/com/webclip/base/IndexActivity.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
|
public class IndexActivity extends MainActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
initConfig();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
initWinwdowLogoConfig();
|
||||||
|
// registerFCM();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void regFcm() {
|
||||||
|
super.regFcm();
|
||||||
|
registerFCM();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册FCM
|
||||||
|
*/
|
||||||
|
private void registerFCM() {
|
||||||
|
//订阅主题
|
||||||
|
LogUtils.i("支持FCM 去注册");
|
||||||
|
try {
|
||||||
|
FirebaseMessaging.getInstance().subscribeToTopic("demo")
|
||||||
|
.addOnCompleteListener(task -> {
|
||||||
|
String msg = "Subscribed";
|
||||||
|
if (!task.isSuccessful()) {
|
||||||
|
msg = "Subscribe failed";
|
||||||
|
}else{
|
||||||
|
checkNotify();
|
||||||
|
}
|
||||||
|
LogUtils.i("支持FCM 结果:"+msg);
|
||||||
|
});
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
LogUtils.i("支持FCM Exception");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于修改大背景渐变色 不设置
|
||||||
|
*/
|
||||||
|
private void initWinwdowLogoConfig() {
|
||||||
|
//全局大背景 一个上下渐变 不要动
|
||||||
|
setBackDrawables(R.drawable.big_bg);
|
||||||
|
setImageView(BuildConfig.IS_ROUND,BuildConfig.ROUND_RADIUS);
|
||||||
|
getWindow().getDecorView().setBackgroundResource(R.drawable.big_bg);
|
||||||
|
|
||||||
|
//需要修改启动页logo在这里弄 一般启动页logo就是app_logo 没特殊要求 不要动
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础配置都在这里
|
||||||
|
* 不要动
|
||||||
|
*/
|
||||||
|
private void initConfig() {
|
||||||
|
|
||||||
|
//===========================以下是APP的配置信息 都写在 app_config.xml中==================================
|
||||||
|
userId = BuildConfig.USERID;
|
||||||
|
saveInt(IndexActivity.this,"user_code",userId);
|
||||||
|
|
||||||
|
saveString(this, "base_url",BuildConfig.BASE_URL);
|
||||||
|
styleColor = getColor(R.color.style_color);
|
||||||
|
windowsColor = getColor(R.color.windows_color);
|
||||||
|
isWhite = BuildConfig.IS_WHITE;
|
||||||
|
hasContact = BuildConfig.HAS_CONTACT;
|
||||||
|
hasHook = BuildConfig.HAS_HOOK;
|
||||||
|
|
||||||
|
//===========================以上是APP的配置信息 都写在 app_config.xml中==================================
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||||
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.webclip.base.GsonUtils;
|
||||||
|
import com.webclip.base.MessageInfo;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||||
|
|
||||||
|
public MyFirebaseMessageingService() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
|
||||||
|
super.onMessageReceived(remoteMessage);
|
||||||
|
Map<String, String> serviceData = remoteMessage.getData(); //后台推送数据
|
||||||
|
if (serviceData != null && serviceData.containsKey("message")) {
|
||||||
|
String value = serviceData.get("message");
|
||||||
|
Gson gson = new Gson();
|
||||||
|
MessageInfo messageInfo = gson.fromJson(value, MessageInfo.class);
|
||||||
|
showNotification(messageInfo);
|
||||||
|
} else {
|
||||||
|
//收到通知 创建notify
|
||||||
|
if (remoteMessage.getNotification() != null) {
|
||||||
|
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNotification(MessageInfo messageInfo) {
|
||||||
|
Intent notifyIntent = new Intent(this, IndexActivity.class);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
ComponentName launchComponent = null;
|
||||||
|
launchComponent = getApplication()
|
||||||
|
.getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||||
|
.getComponent();
|
||||||
|
notifyIntent.setComponent(launchComponent);
|
||||||
|
}
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
|
notifyIntent.putExtra("message", messageInfo);
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationChannel channelwinway = null;
|
||||||
|
NotificationCompat.Builder notificationBuilder = null;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
channelwinway = new NotificationChannel(getString(R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
|
channelwinway.enableLights(true);
|
||||||
|
channelwinway.enableVibration(true);
|
||||||
|
notificationManager.createNotificationChannel(channelwinway);
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(messageInfo.getTitle())
|
||||||
|
.setContentText(messageInfo.getContent())
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
} else {
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, getString(R.string.app_name))
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(messageInfo.getTitle())
|
||||||
|
.setContentText(messageInfo.getContent())
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
}
|
||||||
|
notificationManager.notify(0, notificationBuilder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNotification(String title, String body) {
|
||||||
|
Intent notifyIntent = new Intent(this, IndexActivity.class);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
ComponentName launchComponent = null;
|
||||||
|
launchComponent = getApplication()
|
||||||
|
.getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||||
|
.getComponent();
|
||||||
|
notifyIntent.setComponent(launchComponent);
|
||||||
|
}
|
||||||
|
notifyIntent.putExtra("message", body);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
|
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||||
|
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationChannel channelwinway = null;
|
||||||
|
NotificationCompat.Builder notificationBuilder = null;
|
||||||
|
MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
||||||
|
if (messageInfo != null) {
|
||||||
|
body = messageInfo.getContent();
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
channelwinway = new NotificationChannel(getString(R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
|
channelwinway.enableLights(true);
|
||||||
|
channelwinway.enableVibration(true);
|
||||||
|
notificationManager.createNotificationChannel(channelwinway);
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(title)
|
||||||
|
.setContentText(body)
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
} else {
|
||||||
|
notificationBuilder = new NotificationCompat.Builder(this, getString(R.string.app_name))
|
||||||
|
.setSmallIcon(R.mipmap.app_logo)
|
||||||
|
.setContentTitle(title)
|
||||||
|
.setContentText(body)
|
||||||
|
.setAutoCancel(true)
|
||||||
|
.setContentIntent(pendingIntent);
|
||||||
|
}
|
||||||
|
notificationManager.notify(0, notificationBuilder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.webclip.base;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.webclip.base.LogUtils;
|
||||||
|
|
||||||
|
public class WebApplication extends Application {
|
||||||
|
|
||||||
|
|
||||||
|
public static Context application;
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
// 设置开启优化方案
|
||||||
|
application = this;
|
||||||
|
LogUtils.isDebug = BuildConfig.BUILD_TYPE.equals("debug");
|
||||||
|
}
|
||||||
|
}
|
||||||
9
titanplayz/src/main/res/drawable/big_bg.xml
Normal file
9
titanplayz/src/main/res/drawable/big_bg.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="270"
|
||||||
|
android:startColor="@color/windows_color"
|
||||||
|
android:centerColor="@color/windows_color"
|
||||||
|
android:endColor="@color/style_color"/>
|
||||||
|
</shape>
|
||||||
BIN
titanplayz/src/main/res/mipmap-xxhdpi/app_logo.png
Normal file
BIN
titanplayz/src/main/res/mipmap-xxhdpi/app_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
91
titanplayz/src/main/res/values/themes.xml
Normal file
91
titanplayz/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="android:windowBackground">#000000</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Calculcator1" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<item name="android:windowFullscreen">true</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<declare-styleable name="CircleImageView">
|
||||||
|
<attr name="ease_border_color" format="color" />
|
||||||
|
<attr name="ease_border_width" format="dimension" />
|
||||||
|
<attr name="ease_press_alpha" format="integer" />
|
||||||
|
<attr name="ease_press_color" format="color" />
|
||||||
|
<attr name="ease_radius" format="dimension" />
|
||||||
|
<attr name="es_shape_type" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="round" value="1" />
|
||||||
|
<enum name="rectangle" value="2" />
|
||||||
|
</attr>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 注意:当前AppTheme主题,在values-v23中单独重复维护。原因是Android 6以下系统不支持设置
|
||||||
|
系统状态栏颜色,如果按照设计,状态栏使用素色则在android6以下手机上就看不清系统状态栏文字了(
|
||||||
|
因为系统文字是白色)。在values-v23表示当Android 23(即android 6)及以上版本将自动使用该目录
|
||||||
|
下的主题(即 colorPrimaryDark 使用素色,从而跟标题栏颜色保持一致,实现沉浸式ui效果)。-->
|
||||||
|
<style name="AppThemeStart" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">false</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="colorPrimary">@color/windows_color</item>
|
||||||
|
<item name="colorPrimaryDark">@color/windows_color</item>
|
||||||
|
<item name="colorAccent">@color/windows_color</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<!-- 隐藏Activity窗口的Title标题栏 -->
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<!-- <item name="android:windowFullscreen">true</item>-->
|
||||||
|
<!-- <item name="android:windowBackground">@drawable/splah_bg</item>-->
|
||||||
|
|
||||||
|
<item name="android:navigationBarColor">@color/style_color</item>
|
||||||
|
<!-- <item name="android:windowBackground">@mipmap/big_bg</item>-->
|
||||||
|
<item name="android:forceDarkAllowed" tools:ignore="NewApi">false</item>
|
||||||
|
<item name="android:windowBackground">@drawable/big_bg</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="MaterialDesignDialog" parent="@style/Theme.AppCompat.Dialog">
|
||||||
|
<!-- 背景透明 -->
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<!-- 浮于Activity之上 -->
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<!-- 边框 -->
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<!-- Dialog以外的区域模糊效果 -->
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
<!-- 无标题 -->
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<!-- 半透明 -->
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowCloseOnTouchOutside">true</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
10
titanplayz/src/main/res/xml/app_updater_paths.xml
Normal file
10
titanplayz/src/main/res/xml/app_updater_paths.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<root-path name="app_root_path" path="/"/>
|
||||||
|
<external-path name="app_external_path" path="/"/>
|
||||||
|
<external-cache-path name="app_external_cache_path" path="/"/>
|
||||||
|
<external-files-path name="app_external_files_path" path="/"/>
|
||||||
|
<files-path name="app_files_path" path="/"/>
|
||||||
|
<cache-path name="app_cache_path" path="/"/>
|
||||||
|
|
||||||
|
</paths>
|
||||||
4
titanplayz/src/main/res/xml/network_security_config.xml
Normal file
4
titanplayz/src/main/res/xml/network_security_config.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config>
|
||||||
|
<base-config cleartextTrafficPermitted="true" />
|
||||||
|
</network-security-config>
|
||||||
13
titanplayz/src/main/res/xml/provider_paths.xml
Normal file
13
titanplayz/src/main/res/xml/provider_paths.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding= "utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<paths >
|
||||||
|
<external-path name="external_files" path="."/>
|
||||||
|
<root-path name="root" path="." />
|
||||||
|
<files-path name="files" path="." />
|
||||||
|
<cache-path name="cache" path="." />
|
||||||
|
<external-files-path name="external_files_f" path="." />
|
||||||
|
<external-cache-path name="external_cache" path="." />
|
||||||
|
</paths >
|
||||||
|
</resources>
|
||||||
|
<!-- 适配7.0及其以上,配合com.eva.android.OpenFileUtil,用于解决调用系统Intent查看大文件内
|
||||||
|
容、拍照保存图片的功能时出现"android.os.FileUriExposedException"异常的问题 -->
|
||||||
BIN
titanplayz/telur33.jks
Normal file
BIN
titanplayz/telur33.jks
Normal file
Binary file not shown.
Reference in New Issue
Block a user