From 2f3b0ec98456bd483225b033467153d17627e92c Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 19 十一月 2018 16:56:56 +0800
Subject: [PATCH] update 易接sdk接入逻辑
---
Project/yj_sdk/libs/jcore-android-1.2.1.jar | 0
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CrashCatchUtil.java | 233 +++
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/LogUtil.java | 114 +
Project/yj_sdk/src/main/res/xml/file_paths.xml | 5
Project/settings.gradle | 2
ChannelDiff/Android/yjgame/libs/yj_sdk-game_yj-release.aar | 0
Project/yj_sdk/proguard-rules.pro | 59
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeA2U.java | 59
Project/yj_sdk/src/main/res/layout/jpush_webview_layout.xml | 59
Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_btn_selector.xml | 21
Project/yj_sdk/src/main/res/layout/jpush_popwin_layout.xml | 15
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/DebugUtil.java | 59
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeU2A.java | 85 +
Project/yj_sdk/src/main/res/values/colors.xml | 6
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/FileUtil.java | 211 +++
Project/yj_sdk/libs/android-support-v4.jar | 0
Project/yj_sdk/src/main/res/values/strings.xml | 4
Project/yj_sdk/libs/buglyagent.jar | 0
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/JPushReceiver.java | 147 ++
Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/H2EngineSDK.java | 472 +++++++
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniqueID.java | 226 +++
Project/yj_sdk/.gitignore | 1
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java | 401 ++++++
Project/yj_sdk/src/main/res/values/styles.xml | 8
Project/yj_sdk/libs/jpush-android-3.1.3.jar | 0
Project/yj_sdk/src/main/res/drawable/web_btn_close_icon.png | 0
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/MainActivity.java | 200 +++
Project/sp_sdk/libs/sp_common_lib.jar | 0
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/StaticDefine.java | 18
Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png | 0
Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png | 0
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/BatteryUtil.java | 113 +
ChannelDiff/Android/yjgame/AndroidManifest.xml | 143 ++
Project/yj_sdk/libs/ahelper.jar | 0
Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJSplashActivity.java | 22
Project/yj_sdk/src/main/AndroidManifest.xml | 92 +
Project/yj_sdk/src/game_yj/AndroidManifest.xml | 151 ++
Project/yj_sdk/src/main/res/drawable/app_icon.png | 0
Project/yj_sdk/build.gradle | 55
Project/yj_sdk/src/main/res/layout/activity_main.xml | 30
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/NotchPhoneUtil.java | 347 +++++
Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJPlatformUtil.java | 258 +++
Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/WebViewUtil.java | 185 ++
Project/yj_sdk/libs/gangaonlinehelper.jar | 0
Project/yj_sdk/libs/bugly.jar | 0
GradleDiff/yjgame/mainTemplate.gradle | 59
Project/yj_sdk/libs/tracking1.3.0.jar | 0
Project/yj_sdk/libs/unity-classes.jar | 0
Project/yj_sdk/src/game_yj/assets/Sonnenblume/res.bin | 0
Project/yj_sdk/libs/gangaonlineyijie.jar | 0
Project/yj_sdk/src/main/res/values/jpush_style.xml | 13
Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_progressbar.xml | 20
52 files changed, 3,892 insertions(+), 1 deletions(-)
diff --git a/ChannelDiff/Android/yjgame/AndroidManifest.xml b/ChannelDiff/Android/yjgame/AndroidManifest.xml
new file mode 100644
index 0000000..828af7f
--- /dev/null
+++ b/ChannelDiff/Android/yjgame/AndroidManifest.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.secondworld.univeralsdk"
+ android:installLocation="auto"
+ android:versionCode="1"
+ android:versionName="1.1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="26" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.GET_TASKS" />
+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_LOGS" />
+ <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
+ <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+
+ <application
+ android:name="com.snowfish.cn.ganga.helper.SFOnlineApplication"
+ android:allowBackup="true"
+ android:hardwareAccelerated="false"
+ android:icon="@drawable/app_icon"
+ android:isGame="true"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075838976.000000" />
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+
+ <!-- <meta-data -->
+ <!-- android:name="android.notch_support" -->
+ <!-- android:value="true" /> -->
+
+ <meta-data
+ android:name="notch.config"
+ android:value="none" />
+ <meta-data
+ android:name="android.vendor.full_screen"
+ android:value="true" />
+
+ <activity
+ android:name="com.secondworld.univeralsdk.YJSplashActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name="com.secondworld.univeralsdk.MainActivity"
+ android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection"
+ android:label="@string/app_name"
+ android:launchMode="singleTask"
+ android:screenOrientation="sensorLandscape" >
+ <intent-filter>
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
+ </intent-filter>
+
+ <meta-data
+ android:name="unityplayer.UnityActivity"
+ android:value="true" />
+ <meta-data
+ android:name="unityplayer.SkipPermissionsDialog"
+ android:value="true" />
+ <meta-data
+ android:name="android.vendor.home_indicator"
+ android:value="hide" />
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075419520.000000" />
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+ </activity>
+
+ <!-- 閽堝7.0浠ヤ笂鐨刟pi寮�鏀剧殑鏂囦欢鏉冮檺 -->
+ <!-- <provider -->
+ <!-- android:name="android.support.v4.content.FileProvider" -->
+ <!-- android:authorities="${appId}.fileProvider" -->
+ <!-- android:grantUriPermissions="true" -->
+ <!-- android:exported="false"> -->
+ <!-- <meta-data -->
+ <!-- android:name="android.support.FILE_PROVIDER_PATHS" -->
+ <!-- android:resource="@xml/file_paths" /> -->
+ <!-- </provider> -->
+
+
+ <!-- SNOWFISH SDK -->
+ <service
+ android:name="com.snowfish.a.a.s.ABGSvc"
+ android:enabled="true"
+ android:process="com.snowfish.a.a.bg" >
+ <intent-filter>
+ <action android:name="com.snowfish.a.a.s.ABGSvc" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </service>
+
+ <meta-data
+ android:name="com.snowfish.appid"
+ android:value="{0988C5A3-101098E5}" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.channelid"
+ android:value="{4ff036a1-3254eafe}" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.customer"
+ android:value="SNOWFISH" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.channel"
+ android:value="SNOWFISH" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.sdk.version"
+ android:value="1" >
+ </meta-data>
+ <!-- SNOWFISH SDK -->
+
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/ChannelDiff/Android/yjgame/libs/yj_sdk-game_yj-release.aar b/ChannelDiff/Android/yjgame/libs/yj_sdk-game_yj-release.aar
new file mode 100644
index 0000000..f1694ad
--- /dev/null
+++ b/ChannelDiff/Android/yjgame/libs/yj_sdk-game_yj-release.aar
Binary files differ
diff --git a/GradleDiff/yjgame/mainTemplate.gradle b/GradleDiff/yjgame/mainTemplate.gradle
new file mode 100644
index 0000000..a845dc5
--- /dev/null
+++ b/GradleDiff/yjgame/mainTemplate.gradle
@@ -0,0 +1,59 @@
+// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
+buildscript {
+ repositories {
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.1.0'
+ }
+}
+
+allprojects {
+ repositories {
+ flatDir {
+ dirs 'libs'
+ }
+ }
+}
+
+apply plugin: 'com.android.application'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+**DEPS**}
+
+android {
+ compileSdkVersion **APIVERSION**
+ buildToolsVersion '**BUILDTOOLS**'
+
+ defaultConfig {
+ targetSdkVersion **TARGETSDKVERSION**
+ applicationId '**APPLICATIONID**'
+ ndk {
+ abiFilters **ABIFILTERS**
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+ aaptOptions {
+ noCompress '.unity3d', '.ress', '.resource', '.obb'
+ }
+
+**SIGN**
+ buildTypes {
+ debug {
+ jniDebuggable true
+ }
+ release {
+ // Set minifyEnabled to true if you want to run ProGuard on your project
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
+ **SIGNCONFIG**
+ }
+ }
+
+}
diff --git a/Project/settings.gradle b/Project/settings.gradle
index 0c0f71e..205471a 100644
--- a/Project/settings.gradle
+++ b/Project/settings.gradle
@@ -1 +1 @@
-include ':app', ':mr_sdk', ':sp_sdk', ':js_sdk'
+include ':app', ':mr_sdk', ':sp_sdk', ':js_sdk', ':yj_sdk'
diff --git a/Project/sp_sdk/libs/sp_common_lib.jar b/Project/sp_sdk/libs/sp_common_lib.jar
index 05b2adf..cb9abcf 100644
--- a/Project/sp_sdk/libs/sp_common_lib.jar
+++ b/Project/sp_sdk/libs/sp_common_lib.jar
Binary files differ
diff --git a/Project/yj_sdk/.gitignore b/Project/yj_sdk/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/Project/yj_sdk/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/Project/yj_sdk/build.gradle b/Project/yj_sdk/build.gradle
new file mode 100644
index 0000000..f006f61
--- /dev/null
+++ b/Project/yj_sdk/build.gradle
@@ -0,0 +1,55 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 26
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 26
+ versionCode 1
+ versionName "1.1.0"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ flavorDimensions "default"
+ productFlavors {
+ game_yj {
+ dimension "default"
+ manifestPlaceholders.put("appId", "{0988C5A3-101098E5}")
+// manifestPlaceholders.put("JpushAppKey", "22186239fee975f883198cf4")
+ }
+ }
+}
+
+dependencies {
+ implementation files('libs/ahelper.jar')
+ implementation files('libs/android-support-v4.jar')
+ implementation files('libs/bugly.jar')
+ implementation files('libs/buglyagent.jar')
+ implementation files('libs/gangaonlinehelper.jar')
+ implementation files('libs/gangaonlineyijie.jar')
+ implementation files('libs/jcore-android-1.2.1.jar')
+ implementation files('libs/jpush-android-3.1.3.jar')
+ implementation files('libs/tracking1.3.0.jar')
+ compileOnly files('libs/unity-classes.jar')
+}
+
+task autoCopy_yjgame_Manifest(type: Copy) {
+ dependsOn 'assembleGame_yjRelease'
+ from zipTree("build/outputs/aar/yj_sdk-game_yj-release.aar")
+ include "AndroidManifest.xml"
+ into "C:\\Unity3D_SDK\\ChannelDiff\\Android\\yjgame\\"
+}
+
+task autoCopy_yjgame(type: Copy) {
+ dependsOn autoCopy_yjgame_Manifest
+ from "build/outputs/aar/"
+ include "yj_sdk-game_yj-release.aar"
+ into "C:\\Unity3D_SDK\\ChannelDiff\\Android\\yjgame\\libs\\"
+}
diff --git a/Project/yj_sdk/libs/ahelper.jar b/Project/yj_sdk/libs/ahelper.jar
new file mode 100644
index 0000000..a662b0a
--- /dev/null
+++ b/Project/yj_sdk/libs/ahelper.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/android-support-v4.jar b/Project/yj_sdk/libs/android-support-v4.jar
new file mode 100644
index 0000000..2ff47f4
--- /dev/null
+++ b/Project/yj_sdk/libs/android-support-v4.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/bugly.jar b/Project/yj_sdk/libs/bugly.jar
new file mode 100644
index 0000000..618cff3
--- /dev/null
+++ b/Project/yj_sdk/libs/bugly.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/buglyagent.jar b/Project/yj_sdk/libs/buglyagent.jar
new file mode 100644
index 0000000..b3d5fcf
--- /dev/null
+++ b/Project/yj_sdk/libs/buglyagent.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/gangaonlinehelper.jar b/Project/yj_sdk/libs/gangaonlinehelper.jar
new file mode 100644
index 0000000..3280e99
--- /dev/null
+++ b/Project/yj_sdk/libs/gangaonlinehelper.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/gangaonlineyijie.jar b/Project/yj_sdk/libs/gangaonlineyijie.jar
new file mode 100644
index 0000000..d82dc88
--- /dev/null
+++ b/Project/yj_sdk/libs/gangaonlineyijie.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/jcore-android-1.2.1.jar b/Project/yj_sdk/libs/jcore-android-1.2.1.jar
new file mode 100644
index 0000000..9cb8439
--- /dev/null
+++ b/Project/yj_sdk/libs/jcore-android-1.2.1.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/jpush-android-3.1.3.jar b/Project/yj_sdk/libs/jpush-android-3.1.3.jar
new file mode 100644
index 0000000..ed4e115
--- /dev/null
+++ b/Project/yj_sdk/libs/jpush-android-3.1.3.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/tracking1.3.0.jar b/Project/yj_sdk/libs/tracking1.3.0.jar
new file mode 100644
index 0000000..612fcd5
--- /dev/null
+++ b/Project/yj_sdk/libs/tracking1.3.0.jar
Binary files differ
diff --git a/Project/yj_sdk/libs/unity-classes.jar b/Project/yj_sdk/libs/unity-classes.jar
new file mode 100644
index 0000000..3c32bf7
--- /dev/null
+++ b/Project/yj_sdk/libs/unity-classes.jar
Binary files differ
diff --git a/Project/yj_sdk/proguard-rules.pro b/Project/yj_sdk/proguard-rules.pro
new file mode 100644
index 0000000..cb633ad
--- /dev/null
+++ b/Project/yj_sdk/proguard-rules.pro
@@ -0,0 +1,59 @@
+# 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
+-dontoptimize
+-dontpreverify
+
+-dontwarn okio.**
+-keep class okio.** { *;}
+-dontwarn com.squareup.okhttp.**
+-keep class com.squareup.okhttp.** { *;}
+-dontwarn cn.jpush.**
+-keep class cn.jpush.** { *; }
+-keep class * extends cn.jpush.android.helpers.JPushMessageReceiver { *; }
+-dontwarn cn.jiguang.**
+-keep class cn.jiguang.** { *; }
+-dontwarn cn.jiguang.android.service.**
+-keep class cn.jiguang.android.service.** { *;}
+-dontwarn com.google.gson.**
+-keep class com.google.gson.** { *;}
+-dontwarn com.tencent.bugly.**
+-keep class com.tencent.bugly.** { *;}
+-dontwarn com.tencent.bugly.agent.**
+-keep class com.tencent.bugly.agent.** { *;}
+-dontwarn android.support.**
+-keep class android.support.** { *;}
+-dontwarn com.reyun.tracking.**
+-keep class com.reyun.tracking.** { *;}
+-dontwarn com.ss.**
+-keep class com.ss.tracking.** { *;}
+-dontwarn com.bytedance.**
+-keep class com.bytedance.** { *;}
+
+-dontwarn okhttp3.**
+-keep class okhttp3.** { *;}
+
+-dontwarn com.secondworld.univeralsdk.**
+-keep class com.secondworld.univeralsdk.** { *;}
+
+-keep class com.snowfish.** { *; }
+-dontwarn com.unity3d.**
+-keep class com.unity3d.**{*;}
\ No newline at end of file
diff --git a/Project/yj_sdk/src/game_yj/AndroidManifest.xml b/Project/yj_sdk/src/game_yj/AndroidManifest.xml
new file mode 100644
index 0000000..efde5e5
--- /dev/null
+++ b/Project/yj_sdk/src/game_yj/AndroidManifest.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.secondworld.univeralsdk"
+ android:installLocation="auto"
+ android:versionCode="1"
+ android:versionName="1.1.0">
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="22" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.GET_TASKS" />
+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_LOGS" />
+ <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
+ <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/app_icon"
+ android:hardwareAccelerated="false"
+ android:isGame="true"
+ android:name="com.snowfish.cn.ganga.helper.SFOnlineApplication"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen">
+
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075838976.000000" />
+
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+
+ <!--<meta-data-->
+ <!--android:name="android.notch_support"-->
+ <!--android:value="true" />-->
+
+ <meta-data
+ android:name="notch.config"
+ android:value="none" />
+
+ <meta-data
+ android:name="android.vendor.full_screen"
+ android:value="true" />
+
+ <activity
+ android:name="com.secondworld.univeralsdk.YJSplashActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity
+ android:name="com.secondworld.univeralsdk.MainActivity"
+ android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection"
+ android:label="@string/app_name"
+ android:launchMode="singleTask"
+ android:screenOrientation="sensorLandscape">
+ <intent-filter>
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
+ </intent-filter>
+
+ <meta-data
+ android:name="unityplayer.UnityActivity"
+ android:value="true" />
+ <meta-data
+ android:name="unityplayer.SkipPermissionsDialog"
+ android:value="true" />
+
+ <meta-data
+ android:name="android.vendor.home_indicator"
+ android:value="hide" />
+
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075419520.000000" />
+
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+
+ </activity>
+
+ <!-- 閽堝7.0浠ヤ笂鐨刟pi寮�鏀剧殑鏂囦欢鏉冮檺 -->
+ <!--<provider-->
+ <!--android:name="android.support.v4.content.FileProvider"-->
+ <!--android:authorities="${appId}.fileProvider"-->
+ <!--android:grantUriPermissions="true"-->
+ <!--android:exported="false">-->
+ <!--<meta-data-->
+ <!--android:name="android.support.FILE_PROVIDER_PATHS"-->
+ <!--android:resource="@xml/file_paths" />-->
+ <!--</provider>-->
+
+ <!-- SNOWFISH SDK -->
+ <service
+ android:name="com.snowfish.a.a.s.ABGSvc"
+ android:enabled="true"
+ android:process="com.snowfish.a.a.bg" >
+ <intent-filter>
+ <action android:name="com.snowfish.a.a.s.ABGSvc" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </service>
+
+ <meta-data
+ android:name="com.snowfish.appid"
+ android:value="${appId}" >
+ </meta-data>
+
+ <meta-data
+ android:name="com.snowfish.channelid"
+ android:value="{4ff036a1-3254eafe}" >
+ </meta-data>
+
+ <meta-data
+ android:name="com.snowfish.customer"
+ android:value="SNOWFISH" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.channel"
+ android:value="SNOWFISH" >
+ </meta-data>
+ <meta-data
+ android:name="com.snowfish.sdk.version"
+ android:value="1" >
+ </meta-data>
+ <!-- SNOWFISH SDK -->
+
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/game_yj/assets/Sonnenblume/res.bin b/Project/yj_sdk/src/game_yj/assets/Sonnenblume/res.bin
new file mode 100644
index 0000000..75b4c04
--- /dev/null
+++ b/Project/yj_sdk/src/game_yj/assets/Sonnenblume/res.bin
Binary files differ
diff --git a/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/H2EngineSDK.java b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/H2EngineSDK.java
new file mode 100644
index 0000000..923341a
--- /dev/null
+++ b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/H2EngineSDK.java
@@ -0,0 +1,472 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.Settings;
+import android.widget.Toast;
+
+import com.snowfish.cn.ganga.helper.SFOnlineHelper;
+import com.unity3d.player.UnityPlayer;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import cn.jpush.android.api.JPushInterface;
+import cn.jpush.android.data.JPushLocalNotification;
+
+public class H2EngineSDK
+{
+ private static final String TAG = "H2EngineSDK";
+ private static String APP_ID = "";
+
+ private static boolean PushEnable = true;
+
+ public static void HandleUnityMessage(String json)
+ {
+ LogUtil.i(TAG, "鏀跺埌Unity鍙戞潵鐨勪俊鎭�: " + json);
+ Activity _activity = UnityPlayer.currentActivity;
+ try
+ {
+ JSONObject _json = new JSONObject(json);
+
+ int _code = _json.getInt("code");
+
+ switch (_code)
+ {
+ case CodeU2A.Init:
+ APP_ID = _json.getString("appID");
+ init(_activity);
+ break;
+ case CodeU2A.CopyOneAsset:
+ FileUtil.copy(_activity, _json.getString("fileName"));
+ break;
+ case CodeU2A.AssetCopy:
+ FileUtil.copyAssets(_activity);
+ break;
+ case CodeU2A.BatteryListenStart:
+ BatteryUtil.getInstance().start(_activity);
+ break;
+ case CodeU2A.BatteryListenStop:
+ BatteryUtil.getInstance().stop(_activity);
+ break;
+ case CodeU2A.UniqueID:
+ break;
+ case CodeU2A.CopyContent:
+ CopyContent(_activity, _json.getString("content"));
+ break;
+ case CodeU2A.OpenWebView:
+ WebViewUtil.OpenWebView(_activity, _json.getString("url"));
+ break;
+ case CodeU2A.RestartApp:
+ RestartApp(_activity);
+ break;
+ case CodeU2A.InstallAPK:
+ InstallApp(_activity, _json.getString("path"));
+ break;
+ case CodeU2A.ExteneralStorage:
+ GetExternalStorage();
+ break;
+ case CodeU2A.RequestPermission:
+ break;
+ case CodeU2A.RequestManifestPermissions:
+ break;
+ case CodeU2A.FreePlatformInit:
+ break;
+ case CodeU2A.FreePlatformLogin:
+ YJPlatformUtil.getInstance().login(_activity);
+ break;
+ case CodeU2A.FreePlatformSwitchAccount:
+ break;
+ case CodeU2A.FreePlatformLogout:
+ YJPlatformUtil.getInstance().logout(_activity);
+ break;
+ case CodeU2A.FreePlatformPay:
+
+ JSONObject _extraData = new JSONObject();
+ _extraData.put("appid", APP_ID);
+ _extraData.put("cpinfo", _json.getString("cpInfo"));
+ _extraData.put("cporderid", _json.getString("orderId"));
+ try
+ {
+
+ YJPlatformUtil.getInstance().pay(_activity,
+ _json.getString("title"),
+ _json.getString("cpInfo"),
+ (float) _json.getDouble("mount"),
+ URLEncoder.encode( _extraData.toString(),"utf-8"));
+ }catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+
+ break;
+ case CodeU2A.PayFinished:
+ YJPlatformUtil.getInstance().payProcessing = false;
+ break;
+ case CodeU2A.CreateRole:
+ YJPlatformUtil.getInstance().createRole(_activity,
+ _json.getString("sid"),
+ _json.getString("serverName"),
+ _json.getString("roleID"),
+ _json.getString(
+ "roleName").trim().replace(" ",
+ ""),
+ _json.getString("level"),
+ _json.getString(
+ "familyName").trim().replace(
+ " ", ""),
+ _json.getString("createTime"),
+ _json.getString("levelUpTime"),
+ _json.getString("vipLevel"),
+ _json.getString("money"));
+ break;
+ case CodeU2A.RoleLogin:
+ YJPlatformUtil.getInstance().enterWorld(_activity,
+ _json.getString("sid"),
+ _json.getString("serverName"),
+ _json.getString("roleID"),
+ _json.getString(
+ "roleName").trim().replace(" ",
+ ""),
+ _json.getString("level"),
+ _json.getString(
+ "familyName").trim().replace(
+ " ", ""),
+ _json.getString("createTime"),
+ _json.getString("levelUpTime"),
+ _json.getString("vipLevel"),
+ _json.getString("money"));
+ break;
+ case CodeU2A.RoleLevelUp:
+ YJPlatformUtil.getInstance().levelUp(_activity,
+ _json.getString("sid"),
+ _json.getString("serverName"),
+ _json.getString("roleID"),
+ _json.getString("roleName").trim().replace(
+ " ", ""),
+ _json.getString("level"),
+ _json.getString(
+ "familyName").trim().replace(" ",
+ ""),
+ _json.getString("createTime"),
+ _json.getString("levelUpTime"),
+ _json.getString("vipLevel"),
+ _json.getString("money"));
+ break;
+ case CodeU2A.ClientPackage:
+ break;
+ case CodeU2A.JPushAddLocalMessage:
+ addLocalNotification(_activity,
+ _json.getInt("id"),
+ _json.getString("title"),
+ _json.getString("content"),
+ _json.getLong("fireTime"));
+ break;
+ case CodeU2A.JPushRemoveLocalMessage:
+ removeNotification(_activity, _json.getInt("id"));
+ break;
+ }
+
+ } catch (JSONException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ // 鏈湴鎺ㄩ��
+ public static void addLocalNotification(Activity activity, int id, String title, String content,
+ long fireTime)
+ {
+ if (PushEnable)
+ {
+ try
+ {
+ JPushLocalNotification ln = new JPushLocalNotification();
+ ln.setBuilderId(0);// 璁剧疆鏍峰紡
+ ln.setNotificationId(id);// id
+ ln.setTitle(title);// 鏍囬
+
+ ln.setContent(content);// 鍐呭
+ ln.setBroadcastTime(fireTime);// 绛夊緟鏃堕棿
+ JPushInterface.addLocalNotification(activity, ln);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void removeNotification(Activity activity, int id)
+ {
+ if (PushEnable)
+ {
+ JPushInterface.removeLocalNotification(activity, id);
+ }
+ }
+
+ public static void GetExternalStorage()
+ {
+ Map<String, Object> _msg = new HashMap<>();
+ _msg.put("code", CodeA2U.ExternalStorage);
+ _msg.put("path", Environment.getExternalStorageDirectory().getAbsolutePath());
+ UniversalUtil.sendMessageToUnity(_msg);
+ }
+
+ public static void InstallApp(Activity activity, String path)
+ {
+ File _file = new File(path);
+
+ if (_file == null)
+ {
+ LogUtil.i(TAG, "鎵句笉鍒扮粰瀹氬湴鍧�鐨刟pk: " + path);
+ return;
+ }
+
+ try
+ {
+ Intent _intent = new Intent(Intent.ACTION_VIEW);
+
+// if (Build.VERSION.SDK_INT >= 23)
+// {
+// _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+// Uri _contentUri = FileProvider.getUriForFile(activity,
+// "com.shandangceshi.snxxz.fileProvider",
+// _file);
+// _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive");
+//
+// }
+// else
+// {
+ _intent.setDataAndType(Uri.fromFile(_file),
+ "application/vnd.android.package-archive");
+ _intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+// }
+
+ activity.startActivity(_intent);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ Toast.makeText(activity, "娌℃湁鎵惧埌鎵撳紑姝ょ被鏂囦欢鐨勭▼搴�", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ public static void CopyContent(final Activity activity, final String content)
+ {
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ ClipboardManager _mgr = (ClipboardManager) activity.getSystemService(
+ Context.CLIPBOARD_SERVICE);
+ ClipData _data = ClipData.newPlainText("playerId", content);
+ _mgr.setPrimaryClip(_data);
+ }
+ });
+ }
+
+ public static void RestartApp(final Activity activity)
+ {
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ String _pn = activity.getPackageName();
+ PackageManager _pm = activity.getPackageManager();
+ Intent _l = _pm.getLaunchIntentForPackage(_pn);
+ _l.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ activity.startActivity(_l);
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }
+ }.start();
+ activity.finish();
+ }
+ });
+ }
+
+ public static void init(final Activity activity)
+ {
+ final int _memoryTotal = (int) (UniversalUtil.getMemTotal() / 1024);
+ if (_memoryTotal < 1024)
+ {
+ LogUtil.i(TAG, "妫�娴嬭澶囧唴瀛樹笉婊¤冻杩愯绋嬪簭鏍囧噯");
+ AlertDialog.Builder _builder = new AlertDialog.Builder(activity);
+ _builder.setIcon(R.drawable.app_icon);
+ _builder.setTitle("璀﹀憡");
+ _builder.setMessage("鎮ㄧ殑鎵嬫満鍐呭瓨涓嶈冻,鏃犳硶姝e父杩愯娓告垙");
+ _builder.setPositiveButton("纭畾", new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i)
+ {
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }
+ });
+ _builder.show();
+ return;
+ }
+
+ PushEnable = activity.getPackageName().equals("com.xjaz.sp");
+
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ LogUtil.i(TAG, "寮�濮嬫墽琛屽垵濮嬪寲");
+
+ GetExternalStorage();
+
+ // ------------------------------- 璁惧淇℃伅 -------------------------------
+ Map<String, Object> _msgStruct = new HashMap<>();
+ _msgStruct.put("code", CodeA2U.DeviceInfo);
+ _msgStruct.put("userAgent", System.getProperty("http.agent"));
+ _msgStruct.put("mac", UniqueID.getLocalMac(activity));
+ _msgStruct.put("imei", UniqueID.getDeviceId(activity));
+ _msgStruct.put("android_id",
+ Settings.System.getString(activity.getContentResolver(),
+ Settings.System.ANDROID_ID));
+ _msgStruct.put("unique_id", UniqueID.get(activity));
+ _msgStruct.put("memoryTotal", _memoryTotal);
+ UniversalUtil.sendMessageToUnity(_msgStruct);
+
+ // ------------------------------- 鏋佸厜鎺ㄩ�� -------------------------------
+ String _registrationID = "0";
+ if (PushEnable)
+ {
+ JPushInterface.setDebugMode(true);
+ JPushInterface.init(activity);
+
+ final long _waitingTime = System.currentTimeMillis();
+
+ while (true)
+ {
+ // 绛夊緟鑾峰彇鏋佸厜registrationID
+ if (!JPushInterface.getRegistrationID(activity).equals(""))
+ {
+ _registrationID = JPushInterface.getRegistrationID(activity);
+ break;
+ }
+
+ long _escapeTime = System.currentTimeMillis() - _waitingTime;
+
+ if (_escapeTime > 3000)
+ {
+ LogUtil.w(TAG, "绛夊緟鑾峰彇鏋佸厜鎺ㄩ�乺egistrationID瓒呮椂: 3绉�");
+ break;
+ }
+ }
+ }
+
+ _msgStruct.clear();
+ _msgStruct.put("code", CodeA2U.PushClientID);
+ _msgStruct.put("clientID", _registrationID);
+ UniversalUtil.sendMessageToUnity(_msgStruct);
+
+ _msgStruct.clear();
+ _msgStruct.put("code", CodeA2U.SdkInitComplete);
+ _msgStruct.put("channelPlatform", "yj");
+ _msgStruct.put("yj_appid", UniversalUtil.getMetaString(activity,"yj_appid"));
+ _msgStruct.put("yj_spid", UniversalUtil.getMetaString(activity,"yj_spid"));
+ UniversalUtil.sendMessageToUnity(_msgStruct);
+
+ LogUtil.i(TAG, "鍒濆鍖栨墽琛屽畬姣�");
+ }
+
+ }).start();
+ }
+
+ public static void onCreate(Activity activity, Bundle savedInstanceState)
+ {
+ YJPlatformUtil.getInstance().onCreate(activity, savedInstanceState);
+ }
+
+ private static boolean m_IsFocus = true;
+
+ public static void onWindowFocusChanged(boolean b)
+ {
+// if (MrPlatformUtil.getInstance().payProcessing)
+// {
+// if (b)
+// {
+// Map<String, Object> _msgStruct = new HashMap<>();
+// _msgStruct.put("code", CodeA2U.FreePlatformPayCancel);
+// UniversalUtil.sendMessageToUnity(_msgStruct);
+// MrPlatformUtil.getInstance().payProcessing = false;
+// }
+// }
+ }
+
+ public static void onNewIntent(final Activity activity, final Intent intent)
+ {
+ }
+
+ public static void onActivityResult(int requestCode,
+ int resultCode,
+ final Intent data,
+ final Activity activity)
+ {
+ }
+
+ public static void onConfigurationChanged(final Configuration newConfig) {}
+
+ public static void onRestart(final Activity activity)
+ {
+ SFOnlineHelper.onRestart(activity);
+ }
+
+ public static void onStart(final Activity activity)
+ {
+ }
+
+ public static void onPause(final Activity activity)
+ {
+ SFOnlineHelper.onPause(activity);
+ }
+
+ public static void onResume(final Activity activity)
+ {
+ SFOnlineHelper.onResume(activity);
+
+// if (YJPlatformUtil.getInstance().payProcessing)
+// {
+// Map<String, Object> _msgStruct = new HashMap<>();
+// _msgStruct.put("code", CodeA2U.FreePlatformPayCancel);
+// UniversalUtil.sendMessageToUnity(_msgStruct);
+// YJPlatformUtil.getInstance().payProcessing = false;
+// }
+ }
+
+ public static void onStop(final Activity activity)
+ {
+ SFOnlineHelper.onStop(activity);
+ }
+
+ public static void onDestroy(final Activity activity)
+ {
+ SFOnlineHelper.onDestroy(activity);
+ }
+}
diff --git a/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJPlatformUtil.java b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJPlatformUtil.java
new file mode 100644
index 0000000..9e21127
--- /dev/null
+++ b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJPlatformUtil.java
@@ -0,0 +1,258 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.snowfish.cn.ganga.helper.SFOnlineHelper;
+import com.snowfish.cn.ganga.helper.SFOnlineInitListener;
+import com.snowfish.cn.ganga.helper.SFOnlineLoginListener;
+import com.snowfish.cn.ganga.helper.SFOnlinePayResultListener;
+import com.snowfish.cn.ganga.helper.SFOnlineUser;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2018/9/18 0018.
+ */
+
+public class YJPlatformUtil
+{
+ private static SFOnlineUser USER = null;
+ private final static String PAY_CALLBACK_URL = "";
+ private final static String LOGIN_CHECK_URL = "";
+ private static final String TAG = "YJPlatformUtil";
+
+ private static YJPlatformUtil m_Instance;
+
+ public static YJPlatformUtil getInstance()
+ {
+ if (m_Instance == null)
+ {
+ m_Instance = new YJPlatformUtil();
+ }
+ return m_Instance;
+ }
+
+ private Map<String, Object> m_Message = new HashMap<>();
+ public boolean payProcessing = false;
+
+ public void onCreate(final Activity activity, Bundle savedInstanceState)
+ {
+ SFOnlineHelper.onCreate(activity, new SFOnlineInitListener()
+ {
+ @Override
+ public void onResponse(String s, String s1)
+ {
+ m_Message.clear();
+ if (s.equalsIgnoreCase("success"))
+ {
+ m_Message.put("code", CodeA2U.FreePlatformInitOk);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ }
+ else if (s.equalsIgnoreCase("fail"))
+ {
+ m_Message.put("code", CodeA2U.FreePlatformInitFail);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ }
+ }
+ });
+
+ SFOnlineHelper.setLoginListener(activity, new SFOnlineLoginListener()
+ {
+ @Override
+ public void onLogout(Object o)
+ {
+ m_Message.clear();
+ //闇�瑕佹妸娓告垙鍒囨崲鍥炵櫥闄嗗墠鐨勫満鏅�,骞堕噸鏂板脊鍑虹櫥褰曟绛夋搷浣�
+ m_Message.put("code", CodeA2U.FreePlatformLogoutOk);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ }
+
+ @Override
+ public void onLoginSuccess(SFOnlineUser sfOnlineUser, Object o)
+ {
+ m_Message.clear();
+ USER = sfOnlineUser;
+
+ //鏍规嵁鍥炶皟鑾峰彇鐢ㄦ埛淇℃伅
+ String userName = USER.getUserName();
+ String timestamp = USER.getToken();
+ String token = USER.getToken();
+ String userId = USER.getChannelUserId();
+ try
+ {
+ JSONObject _info = new JSONObject();
+ _info.put("account", userName);
+ _info.put("token", token);
+ _info.put("timeStamp", timestamp);
+ _info.put("account_id", userId);
+ _info.put("yjSdkId", USER.getChannelId());
+ _info.put("yjAppId", USER.getProductCode());
+ m_Message.put("code", CodeA2U.FreePlatformLoginOk);
+ m_Message.put("info", _info);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ } catch (JSONException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onLoginFailed(String s, Object o)
+ {
+ m_Message.clear();
+ m_Message.put("code", CodeA2U.FreePlatformLoginFail);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ }
+ });
+ }
+
+ public void login(final Activity activity)
+ {
+ SFOnlineHelper.login(activity, "Login");
+ }
+
+ public void logout(final Activity activity)
+ {
+ SFOnlineHelper.logout(activity, "LoginOut");
+ }
+
+ public void pay(final Activity activity, String productName, String productID, float price,
+ String extData)
+ {
+ SFOnlineHelper.pay(activity,
+ (int) (price * 100),
+ productName,
+ 1,
+ extData,
+ PAY_CALLBACK_URL,
+ new SFOnlinePayResultListener()
+ {
+ @Override
+ public void onFailed(String s)
+ {
+ m_Message.clear();
+ //鏍规嵁鍥炶皟鑾峰彇鏀粯璁㈠崟淇℃伅
+ LogUtil.i(TAG, "Pay Fail Info: " + s);
+ m_Message.put("code", CodeA2U.FreePlatformPayFail);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ payProcessing = false;
+ }
+
+ @Override
+ public void onSuccess(String s)
+ {
+ m_Message.clear();
+ //鏍规嵁鍥炶皟鑾峰彇鏀粯璁㈠崟淇℃伅
+ LogUtil.i(TAG, "Pay Success Info: " + s);
+ m_Message.put("code", CodeA2U.FreePlatformPayOk);
+ UniversalUtil.sendMessageToUnity(m_Message);
+ payProcessing = false;
+ }
+
+ @Override
+ public void onOderNo(String s)
+ {
+ LogUtil.i(TAG, "Pay Order No: " + s);
+ }
+ });
+ payProcessing = true;
+ }
+
+ public void createRole(final Activity activity,
+ String serverID,
+ String serverName,
+ String roleID,
+ String roleName,
+ String roleLevel,
+ String FamilyName,
+ String createTime,
+ String levelUpTime,
+ String vipLevel,
+ String surplusMoney)
+ {
+ SFOnlineHelper.setRoleData(activity, roleID, roleName, roleLevel, serverID, serverName);
+ String _info = createGameData(serverID, serverName, roleID, roleName, roleLevel, FamilyName,
+ createTime, levelUpTime, vipLevel, surplusMoney);
+ SFOnlineHelper.setData(activity, "createrole", _info); // 鍒涘缓鏂拌鑹叉椂璋冪敤 蹇呮帴
+ }
+
+ public void enterWorld(Activity activity,
+ String serverID,
+ String serverName,
+ String roleID,
+ String roleName,
+ String roleLevel,
+ String FamilyName,
+ String createTime,
+ String levelUpTime,
+ String vipLevel,
+ String surplusMoney)
+ {
+ String _info = createGameData(serverID, serverName, roleID, roleName, roleLevel, FamilyName,
+ createTime, levelUpTime, vipLevel, surplusMoney);
+ SFOnlineHelper.setData(activity, "enterServer", _info); // 鍒涘缓鏂拌鑹叉椂璋冪敤 蹇呮帴
+ }
+
+ public void levelUp(final Activity activity,
+ String serverID,
+ String serverName,
+ String roleID,
+ String roleName,
+ String roleLevel,
+ String FamilyName,
+ String createTime,
+ String levelUpTime,
+ String vipLevel,
+ String surplusMoney)
+ {
+ String _info = createGameData(serverID, serverName, roleID, roleName, roleLevel, FamilyName,
+ createTime, levelUpTime, vipLevel, surplusMoney);
+ SFOnlineHelper.setData(activity, "levelup", _info); // 鍒涘缓鏂拌鑹叉椂璋冪敤 蹇呮帴
+ }
+
+ private String createGameData(String serverID,
+ String serverName,
+ String roleID,
+ String roleName,
+ String roleLevel,
+ String FamilyName,
+ String createTime,
+ String levelUpTime,
+ String vipLevel,
+ String surplusMoney)
+ {
+ try
+ {
+ JSONObject roleInfo = new JSONObject();
+ roleInfo.put("roleId", roleID); //褰撳墠鐧诲綍鐨勭帺瀹惰鑹睮D锛屽繀椤讳负鏁板瓧
+ roleInfo.put("roleName", roleName); //褰撳墠鐧诲綍鐨勭帺瀹惰鑹插悕锛屼笉鑳戒负绌猴紝涓嶈兘涓簄ull
+ roleInfo.put("roleLevel", roleLevel); //褰撳墠鐧诲綍鐨勭帺瀹惰鑹茬瓑绾э紝蹇呴』涓烘暟瀛楋紝涓斾笉鑳戒负0锛岃嫢鏃狅紝浼犲叆1
+ roleInfo.put("zoneId", serverID); //褰撳墠鐧诲綍鐨勬父鎴忓尯鏈岻D锛屽繀椤讳负鏁板瓧锛屼笖涓嶈兘涓�0锛岃嫢鏃狅紝浼犲叆1
+ roleInfo.put("zoneName", serverName);//褰撳墠鐧诲綍鐨勬父鎴忓尯鏈嶅悕绉帮紝涓嶈兘涓虹┖锛屼笉鑳戒负null
+ roleInfo.put("balance", surplusMoney); //鐢ㄦ埛娓告垙甯佷綑棰濓紝蹇呴』涓烘暟瀛楋紝鑻ユ棤锛屼紶鍏�0
+ roleInfo.put("vip", vipLevel); //褰撳墠鐢ㄦ埛VIP绛夌骇锛屽繀椤讳负鏁板瓧锛岃嫢鏃狅紝浼犲叆1
+ roleInfo.put("partyName", FamilyName);//褰撳墠瑙掕壊鎵�灞炲府娲撅紝涓嶈兘涓虹┖锛屼笉鑳戒负null锛岃嫢鏃狅紝浼犲叆鈥滄棤甯淳鈥�
+ roleInfo.put("roleCTime", createTime); //鍗曚綅涓虹锛屽垱寤鸿鑹茬殑鏃堕棿
+ roleInfo.put("roleLevelMTime", levelUpTime); //鍗曚綅涓虹锛岃鑹茬瓑绾у彉鍖栨椂闂�
+ return roleInfo.toString();
+ } catch (JSONException ex)
+ {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+}
diff --git a/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJSplashActivity.java b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJSplashActivity.java
new file mode 100644
index 0000000..05896d9
--- /dev/null
+++ b/Project/yj_sdk/src/game_yj/java/com/secondworld/univeralsdk/YJSplashActivity.java
@@ -0,0 +1,22 @@
+package com.secondworld.univeralsdk;
+import android.content.Intent;
+import android.graphics.Color;
+
+import com.snowfish.cn.ganga.helper.SFOnlineSplashActivity;
+
+public class YJSplashActivity extends SFOnlineSplashActivity
+{
+ public int getBackgroundColor()
+ {
+ return Color.WHITE;
+ }
+
+ @Override
+ public void onSplashStop()
+ {
+ Intent _intent = new Intent(this, MainActivity.class);
+ startActivity(_intent);
+ this.finish();
+ }
+
+}
diff --git a/Project/yj_sdk/src/main/AndroidManifest.xml b/Project/yj_sdk/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3ee8c3b
--- /dev/null
+++ b/Project/yj_sdk/src/main/AndroidManifest.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.secondworld.univeralsdk"
+ android:installLocation="auto"
+ android:versionCode="1"
+ android:versionName="1.1.0">
+
+ <uses-sdk
+ android:minSdkVersion="16"
+ android:targetSdkVersion="22" />
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.GET_TASKS" />
+ <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_LOGS" />
+ <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
+ <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/app_icon"
+ android:hardwareAccelerated="false"
+ android:isGame="true"
+ android:name="com.snowfish.cn.ganga.helper.SFOnlineApplication"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen">
+
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075838976.000000" />
+
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+
+ <!--<meta-data-->
+ <!--android:name="android.notch_support"-->
+ <!--android:value="true" />-->
+
+ <meta-data
+ android:name="notch.config"
+ android:value="none" />
+
+ <meta-data
+ android:name="android.vendor.full_screen"
+ android:value="true" />
+
+ <activity
+ android:name="com.secondworld.univeralsdk.MainActivity"
+ android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection"
+ android:label="@string/app_name"
+ android:launchMode="singleTask"
+ android:screenOrientation="sensorLandscape">
+ <intent-filter>
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
+ </intent-filter>
+
+ <meta-data
+ android:name="unityplayer.UnityActivity"
+ android:value="true" />
+ <meta-data
+ android:name="unityplayer.SkipPermissionsDialog"
+ android:value="true" />
+
+ <meta-data
+ android:name="android.vendor.home_indicator"
+ android:value="hide" />
+
+ <meta-data
+ android:name="android.max_aspect"
+ android:value="1075419520.000000" />
+
+ <meta-data
+ android:name="com.samsung.android.keepalive.density"
+ android:value="true" />
+
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/BatteryUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/BatteryUtil.java
new file mode 100644
index 0000000..abd77fb
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/BatteryUtil.java
@@ -0,0 +1,113 @@
+package com.secondworld.univeralsdk;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.BatteryManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2018/7/15 0015.
+ */
+
+public class BatteryUtil
+{
+ private static BatteryUtil s_Instance = null;
+
+ public static BatteryUtil getInstance()
+ {
+ if (s_Instance == null)
+ {
+ s_Instance = new BatteryUtil();
+ }
+ return s_Instance;
+ }
+
+ private BatteryBroadCastReceiver m_BatteryBroadCastReceiver;
+
+ private BatteryUtil() {}
+
+ public void start(Context context)
+ {
+ m_BatteryBroadCastReceiver = new BatteryBroadCastReceiver();
+ IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
+ context.registerReceiver(m_BatteryBroadCastReceiver, filter);
+ }
+
+ public void stop(Context context)
+ {
+ context.unregisterReceiver(m_BatteryBroadCastReceiver);
+ m_BatteryBroadCastReceiver = null;
+ }
+
+ private class BatteryBroadCastReceiver extends BroadcastReceiver
+ {
+ private int m_BatteryLevel;
+ private int m_Status;
+
+ public BatteryBroadCastReceiver()
+ {
+ m_BatteryLevel = 0;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ if (intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED))
+ {
+ int _batteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
+
+ Map<String, Object> _msg = new HashMap<>();
+
+ if (_batteryLevel != m_BatteryLevel)
+ {
+ try
+ {
+ _msg.put("code", CodeA2U.BatteryLevel);
+ _msg.put("level", _batteryLevel);
+
+ UniversalUtil.sendMessageToUnity(_msg);
+
+ m_BatteryLevel = _batteryLevel;
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ int _status = intent.getIntExtra("status", 0);
+
+ if (_status != m_Status)
+ {
+ _msg.clear();
+
+ int _transCode = 0;
+ if (_status == BatteryManager.BATTERY_STATUS_CHARGING)
+ {
+ _transCode = 2;
+ }
+ else if (_status == BatteryManager.BATTERY_STATUS_NOT_CHARGING ||
+ _status == BatteryManager.BATTERY_STATUS_DISCHARGING)
+ {
+ _transCode = 1;
+ }
+ else if (_status == BatteryManager.BATTERY_STATUS_FULL)
+ {
+ _transCode = 3;
+ }
+
+ _msg.put("code", CodeA2U.BatteryCharging);
+ _msg.put("status", _transCode);
+
+ UniversalUtil.sendMessageToUnity(_msg);
+
+ m_Status = _status;
+ }
+ }
+ }
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeA2U.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeA2U.java
new file mode 100644
index 0000000..f74f976
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeA2U.java
@@ -0,0 +1,59 @@
+package com.secondworld.univeralsdk;
+
+/**
+ * Created by Administrator on 2018/7/18 0018.
+ */
+
+public class CodeA2U
+{
+ /**
+ * 璧勬簮鎷疯礉瀹屾垚
+ */
+ public static final int AssetCopyFinished = 0;
+ /**
+ * 鐢甸噺鏀瑰彉
+ */
+ public static final int BatteryLevel = 1;
+ /**
+ * 鍏呯數鐘舵�佹敼鍙�
+ */
+ public static final int BatteryCharging = 2;
+ /**
+ * 鍥炶皟sdk閫昏緫瀹屾瘯
+ * */
+ public static final int SdkInitComplete = 90;
+ /**
+ * 鍥炶皟android璁惧淇℃伅
+ * */
+ public static final int DeviceInfo = 3;
+ /**
+ * 鍥炶皟鎺ㄩ�佺殑鐙珛id
+ * */
+ public static final int PushClientID = 4;
+ /**
+ * 鍥炶皟澶栭儴瀛樺偍鏍圭洰褰曞湴鍧�
+ */
+ public static final int ExternalStorage = 5;
+
+ /**
+ * --------------------------------------------------------------------------------------------
+ * 浠ヤ笅涓哄悇鑷」鐩甋DK鐩稿叧
+ * --------------------------------------------------------------------------------------------
+ */
+
+ // ------------------------------------------------------------------------------------------
+ // 鑷敱SDK鐩稿叧鍥炶皟Code
+ // ------------------------------------------------------------------------------------------
+ public static final int FreePlatformInitOk = 10;
+ public static final int FreePlatformInitFail = 11;
+ public static final int FreePlatformLoginOk = 12;
+ public static final int FreePlatformLoginFail = 13;
+ public static final int FreePlatformLoginCancel = 14;
+ public static final int FreePlatformLogoutOk = 15;
+ public static final int FreePlatformLogoutFail = 16;
+ public static final int FreePlatformSwitchAccountOk = 17;
+ public static final int FreePlatformPayOk = 18;
+ public static final int FreePlatformPayFail = 19;
+ public static final int FreePlatformPayCancel = 20;
+ public static final int FreePlatformRegisterOk = 21;
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeU2A.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeU2A.java
new file mode 100644
index 0000000..352fb2f
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CodeU2A.java
@@ -0,0 +1,85 @@
+package com.secondworld.univeralsdk;
+
+/**
+ * Created by Administrator on 2018/7/18 0018.
+ */
+
+public class CodeU2A
+{
+ /**
+ * 鎵ц璧勬簮鎷疯礉
+ */
+ public static final int AssetCopy = 0;
+ /**
+ * 鎵ц寮�濮嬬數閲忔敼鍙�,鍏呯數鐘舵�佹敼鍙樼洃鍚�
+ */
+ public static final int BatteryListenStart = 1;
+ /**
+ * 鎵ц鍋滄鐢甸噺鏀瑰彉,鍏呯數鐘舵�佹敼鍙樼洃鍚�
+ */
+ public static final int BatteryListenStop = 2;
+ /**
+ * 鑾峰彇鍞竴璇嗗埆鐮�
+ */
+ public static final int UniqueID = 3;
+ /**
+ * 鐢宠鍦ˋndroidManifest鏂囦欢涓�
+ */
+ public static final int RequestManifestPermissions = 4;
+ /**
+ * 鍗曠嫭鍔ㄦ�佺敵璇锋煇涓�涓潈闄�
+ */
+ public static final int RequestPermission = 5;
+ /**
+ * 閲嶅惎搴旂敤
+ */
+ public static final int RestartApp = 6;
+ /**
+ * 鎷疯礉鏂囨湰淇℃伅
+ */
+ public static final int CopyContent = 7;
+ /**
+ * 鎵撳紑缃戝潃
+ */
+ public static final int OpenWebView = 8;
+ /**
+ * SDK鍒濆鍖�, 瀹屽叏鑷姩鍒濆鍖栫殑娴佺▼, 瀹屾垚蹇呰閫昏緫鍚庡啀鍥炶皟鍥炲幓
+ */
+ public static final int Init = 9;
+ /**
+ * 瀹夎搴旂敤
+ */
+ public static final int InstallAPK = 10;
+ /**
+ * 澶栭儴瀛樺偍鏍圭洰褰曞湴鍧�
+ */
+ public static final int ExteneralStorage = 11;
+
+ public static final int CopyOneAsset = 12;
+ /**
+ * --------------------------------------------------------------------------------------------
+ * 浠ヤ笅涓哄悇鑷」鐩甋DK鐩稿叧
+ * --------------------------------------------------------------------------------------------
+ */
+ /**
+ * 鑷敱sdk鐩稿叧
+ * */
+ public static final int FreePlatformInit = 100;
+ public static final int FreePlatformLogin = 101;
+ public static final int FreePlatformLogout = 102;
+ public static final int FreePlatformSwitchAccount = 103;
+ public static final int FreePlatformPay = 104;
+ public static final int PayFinished = 105;
+ public static final int CreateRole = 106;
+ public static final int RoleLogin = 107;
+ public static final int RoleLevelUp = 108;
+ /**
+ * 鏋佸厜鎺ㄩ��
+ * */
+ public static final int JPushAddLocalMessage = 200;
+ public static final int JPushRemoveLocalMessage = 201;
+ /**
+ * ClientPackage鍚憇dk鍙戦�佸垎鍖卛d
+ */
+ public static final int ClientPackage = 400;
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CrashCatchUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CrashCatchUtil.java
new file mode 100644
index 0000000..21f1d5c
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/CrashCatchUtil.java
@@ -0,0 +1,233 @@
+package com.secondworld.univeralsdk;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Looper;
+import android.os.SystemClock;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2018/7/19 0019.
+ */
+
+public class CrashCatchUtil implements Thread.UncaughtExceptionHandler
+{
+ private static final String TAG = "CrashCatchUtil";
+ private Context m_Context;
+ private Thread.UncaughtExceptionHandler m_UncaughtExceptionHandler;
+ private Map<String, String> m_DevicceInfo = new HashMap<>();
+
+ private CrashCatchUtil() {}
+
+ private static CrashCatchUtil m_Instance;
+
+ public static CrashCatchUtil getInstance()
+ {
+ if (m_Instance == null)
+ {
+ m_Instance = new CrashCatchUtil();
+ }
+ return m_Instance;
+ }
+
+ public void init(Context context)
+ {
+ m_Context = context;
+ m_UncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+ Thread.setDefaultUncaughtExceptionHandler(this);
+ autoClear(5);
+ }
+
+ @Override
+ public void uncaughtException(Thread thread, Throwable throwable)
+ {
+ if (!handleException(throwable) && m_UncaughtExceptionHandler != null)
+ {
+ m_UncaughtExceptionHandler.uncaughtException(thread, throwable);
+ }
+ else
+ {
+ SystemClock.sleep(3000);
+ android.os.Process.killProcess(android.os.Process.myPid());
+ System.exit(1);
+ }
+ }
+
+ private void recordDeviceInfo()
+ {
+ m_DevicceInfo.clear();
+ m_DevicceInfo.put("brand", Build.BRAND);
+ m_DevicceInfo.put("model", Build.MODEL);
+ m_DevicceInfo.put("android_version", String.valueOf(Build.VERSION.SDK_INT));
+ try
+ {
+ PackageManager _pkgMgr = m_Context.getPackageManager();
+ PackageInfo _pkgInfo = _pkgMgr.getPackageInfo(m_Context.getPackageName(),
+ PackageManager.GET_ACTIVITIES);
+ if (_pkgInfo != null)
+ {
+ m_DevicceInfo.put("versionName", _pkgInfo.versionName);
+ m_DevicceInfo.put("versionCode", String.valueOf(_pkgInfo.versionCode));
+ }
+ } catch (PackageManager.NameNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private boolean handleException(Throwable throwable)
+ {
+ if (throwable == null)
+ {
+ return false;
+ }
+
+ try
+ {
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ Looper.prepare();
+ Toast.makeText(m_Context, "绋嬪簭鍑虹幇寮傚父,鍗冲皢閲嶅惎", Toast.LENGTH_LONG).show();
+ Looper.loop();
+ }
+ }).start();
+
+ recordDeviceInfo();
+
+ save(throwable);
+
+ SystemClock.sleep(3000);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ private String save(Throwable throwable) throws Exception
+ {
+ StringBuffer sb = new StringBuffer();
+ try
+ {
+ SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String date = sDateFormat.format(new Date());
+ sb.append("\r\n" + date + "\n");
+ for (Map.Entry<String, String> entry : m_DevicceInfo.entrySet())
+ {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ sb.append(key + "=" + value + "\n");
+ }
+
+ Writer writer = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(writer);
+ throwable.printStackTrace(printWriter);
+ Throwable cause = throwable.getCause();
+ while (cause != null)
+ {
+ cause.printStackTrace(printWriter);
+ cause = cause.getCause();
+ }
+ printWriter.flush();
+ printWriter.close();
+ String result = writer.toString();
+ sb.append(result);
+
+ String fileName = writeFile(sb.toString());
+ return fileName;
+ } catch (Exception e)
+ {
+ sb.append("鍐欏叆宕╂簝鏃ュ織鏃�, 鍑虹幇浜嗗紓甯哥姸鍐�...\r\n");
+ writeFile(sb.toString());
+ }
+ return null;
+
+ }
+
+ private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+
+ private String writeFile(String sb) throws Exception
+ {
+ String time = formatter.format(new Date());
+ String fileName = "crash-" + time + ".log";
+ String path = getPath();
+ File dir = new File(getPath());
+ if (!dir.exists())
+ {
+ dir.mkdirs();
+ }
+ FileOutputStream fos = new FileOutputStream(path + fileName, true);
+ fos.write(sb.getBytes());
+ fos.flush();
+ fos.close();
+ return fileName;
+ }
+
+ private String getPath()
+ {
+ return m_Context.getExternalFilesDir("").getAbsolutePath()
+ + File.separator
+ + "crash"
+ + File.separator;
+ }
+
+ /**
+ * 鏂囦欢鍒犻櫎
+ *
+ * @param autoClearDay 鏂囦欢淇濆瓨澶╂暟
+ */
+ public void autoClear(final int autoClearDay)
+ {
+ delete(getPath(), new FilenameFilter()
+ {
+ @Override
+ public boolean accept(File file, String filename)
+ {
+ String s = FileUtil.getFileNameWithoutExtension(filename);
+ int day = autoClearDay < 0 ? autoClearDay : -1 * autoClearDay;
+ String date = "crash-" + getOtherDay(day);
+ return date.compareTo(s) >= 0;
+ }
+ });
+ }
+
+ private void delete(String path, FilenameFilter filter)
+ {
+ File _file = new File(path);
+ if (!_file.exists())
+ {
+ return;
+ }
+ File[] _files = _file.listFiles(filter);
+ for (int i = _files.length - 1; i >= 0; i--)
+ {
+ _files[i].delete();
+ }
+ }
+
+ private String getOtherDay(int offset)
+ {
+ Calendar _calendar = Calendar.getInstance();
+ _calendar.add(Calendar.DATE, offset);
+ return formatter.format(_calendar.getTime());
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/DebugUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/DebugUtil.java
new file mode 100644
index 0000000..5e6da5d
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/DebugUtil.java
@@ -0,0 +1,59 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.os.Environment;
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Created by Administrator on 2018/7/20 0020.
+ */
+
+public class DebugUtil
+{
+ private final String TAG = "DebugUtil";
+
+ private static DebugUtil s_Instance;
+
+ public static DebugUtil getInstance()
+ {
+ if (s_Instance == null)
+ {
+ s_Instance = new DebugUtil();
+ }
+ return s_Instance;
+ }
+
+ private DebugUtil() {}
+
+ private boolean m_Enable = false;
+
+ private Activity m_Activity;
+
+ public void init(Activity activity)
+ {
+ m_Activity = activity;
+
+ String _path = Environment.getExternalStorageDirectory() + File.separator + activity.getPackageName();
+ Log.i(TAG, _path);
+ File _dir = new File(_path);
+ if (!_dir.exists())
+ {
+ _dir.mkdir();
+ }
+ _path = _path + File.separator + "SdkDebug";
+ _dir = new File(_path);
+ m_Enable = _dir.exists();
+ if(m_Enable){
+ Log.i(TAG, "--------- SDK璋冭瘯妯″紡: 寮�鍚� ---------");
+ }else{
+ Log.i(TAG, "--------- SDK璋冭瘯妯″紡: 鍏抽棴 ---------");
+ }
+ }
+
+ public boolean enable()
+ {
+ return m_Enable;
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/FileUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/FileUtil.java
new file mode 100644
index 0000000..9dbafb9
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/FileUtil.java
@@ -0,0 +1,211 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.AssetManager;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2018/6/14 0014.
+ */
+
+public class FileUtil
+{
+
+ private static final String TAG = "H2Engine_FileUtil";
+
+ /**
+ * Unity闅忓寘璧勬簮(StreamingAssets)鎷疯礉鑷� persistentDataPath 璺緞涓�
+ */
+ public static void copyAssets(final Activity activity)
+ {
+
+ // 鍒ゆ柇鏄惁宸茬粡鎵ц杩�
+ SharedPreferences _sp = activity.getPreferences(Context.MODE_PRIVATE);
+ Boolean _isCopied = hasCopy(activity);
+
+ LogUtil.i(TAG, "鏄惁宸茬粡鎵ц杩囨嫹璐濋�昏緫: " + _isCopied);
+
+ // 鑾峰彇褰撳墠鍖呯殑鐗堟湰鍙�
+ final String _currentVer = UniversalUtil.GetVersionName(activity);
+
+ // 宸茬粡鎷疯礉杩�, 鍒欏啀娆″垽鏂竴娆$増鏈彿
+ // 濡傛灉鐗堟湰鍙蜂笉鐩稿悓, 鍒欓噸鏂拌繘琛屾嫹璐�
+ // 鑾峰彇鏈湴瀛樺偍鐨勭増鏈彿
+ String _installVer = _sp.getString(StaticDefine.LS_KEY_VERSION, "");
+
+ if (!_installVer.equals(_currentVer))
+ {
+ LogUtil.i(TAG, "鐗堟湰姣旇緝杩囧悗鍙戠幇涓嶅悓: " + _installVer + " != " + _currentVer);
+ SharedPreferences.Editor _editor = _sp.edit();
+ // 瀛樺偍姝ゆ鐨勭増鏈俊鎭�
+ _editor.putString(StaticDefine.LS_KEY_VERSION, _currentVer);
+ _editor.apply();
+
+ if (_isCopied)
+ {
+ // 灏嗘湰鍦板瓨鍌ㄤ慨鏀逛负鏈嫹璐濊繃
+ deleteRecord(activity);
+ _isCopied = false;
+ }
+ }
+
+ if (_isCopied)
+ {
+ Map<String, Object> _msg = new HashMap<>();
+ _msg.put("code", CodeA2U.AssetCopyFinished);
+ UniversalUtil.sendMessageToUnity(_msg);
+ return;
+ }
+
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+
+ String _dest = activity.getExternalFilesDir("").getAbsolutePath();
+ AssetManager _assetMgr = activity.getAssets();
+
+ try
+ {
+
+ String[] _fileNames = _assetMgr.list("android");
+ if (_fileNames != null)
+ {
+ for (String _fileName : _fileNames)
+ {
+ copy(activity, "android" + File.separator + _fileName,
+ _dest + File.separator + _fileName);
+ }
+ }
+
+ recordCopy(activity);
+
+ Map<String, Object> _msg = new HashMap<>();
+ _msg.put("code", CodeA2U.AssetCopyFinished);
+ UniversalUtil.sendMessageToUnity(_msg);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+ }).start();
+ }
+
+ public static void copy(Context context, String fileName)
+ {
+ String _originalPath = "android" + File.separator + fileName;
+ String _destPath = context.getExternalFilesDir(
+ "").getAbsolutePath() + File.separator + fileName;
+ String _destDir = _destPath.substring(0, _destPath.lastIndexOf('/') + 1);
+ File _file = new File(_destDir);
+ if(!_file.exists())
+ {
+ LogUtil.i(TAG,"鍗曠嫭鎷疯礉 => 涓嶅瓨鍦ㄦ寚瀹氳矾寰�: " + _destDir + ", 杩欓噷鍒涘缓...");
+ _file.mkdir();
+ }
+ try
+ {
+ InputStream _is = context.getAssets().open(_originalPath);
+ FileOutputStream _fos = new FileOutputStream(new File(_destPath));
+ byte[] _buffer = new byte[1024];
+ int _byteCount;
+ while ((_byteCount = _is.read(_buffer)) != -1)
+ {
+ _fos.write(_buffer, 0, _byteCount);
+ }
+ _fos.flush();
+ _is.close();
+ _fos.close();
+ LogUtil.i("FileUtil", "鍗曠嫭鎷疯礉 => 鏂囦欢: " + _originalPath + " 宸叉嫹璐濊嚦: " + _destPath);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static void copy(Context context, String original, String dest)
+ {
+ try
+ {
+ String _fileNames[] = context.getAssets().list(original);
+ if (_fileNames.length > 0)
+ {
+ File _dir = new File(dest);
+ _dir.mkdir();
+ LogUtil.i("FileUtil", "[" + original + "] 鏄竴涓枃浠跺す, 鍒涘缓鏂囦欢澶�: [" + dest + "]");
+ for (String _fileName : _fileNames)
+ {
+ copy(context, original + File.separator + _fileName,
+ dest + File.separator + _fileName);
+ }
+ }
+ else
+ {
+ InputStream _is = context.getAssets().open(original);
+ FileOutputStream _fos = new FileOutputStream(new File(dest));
+ byte[] _buffer = new byte[1024];
+ int _byteCount;
+ while ((_byteCount = _is.read(_buffer)) != -1)
+ {
+ _fos.write(_buffer, 0, _byteCount);
+ }
+ _fos.flush();
+ _is.close();
+ _fos.close();
+ LogUtil.i("FileUtil", "鏂囦欢: " + original + " 宸叉嫹璐濊嚦: " + dest);
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static String getFileNameWithoutExtension(String fileName)
+ {
+ return fileName.substring(0, fileName.lastIndexOf("."));
+ }
+
+ private static boolean hasCopy(Context context)
+ {
+ File _file = new File(context.getExternalFilesDir(""), "/assetCopyFinish.txt");
+ return _file.exists();
+ }
+
+ private static void deleteRecord(Context context)
+ {
+ File _file = new File(context.getExternalFilesDir(""), "/assetCopyFinish.txt");
+ if (_file.exists())
+ {
+ _file.delete();
+ }
+ }
+
+ private static void recordCopy(Context context)
+ {
+ File _file = new File(context.getExternalFilesDir(""), "/assetCopyFinish.txt");
+ try
+ {
+ FileOutputStream _fos = new FileOutputStream(_file);
+ Writer _writer = new OutputStreamWriter(_fos, "UTF-8");
+ _writer.write(1);
+ _writer.close();
+ _fos.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/JPushReceiver.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/JPushReceiver.java
new file mode 100644
index 0000000..9ec4e3b
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/JPushReceiver.java
@@ -0,0 +1,147 @@
+package com.secondworld.univeralsdk;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import cn.jpush.android.api.JPushInterface;
+
+/**
+ * Created by Administrator on 2018/6/16 0016.
+ */
+public class JPushReceiver extends BroadcastReceiver
+{
+ private static final String TAG = "JPushReceiver";
+
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ try
+ {
+ Bundle bundle = intent.getExtras();
+ Log.d(TAG,
+ "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(
+ bundle));
+
+ if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction()))
+ {
+ String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
+ Log.d(TAG, "[MyReceiver] 鎺ユ敹Registration Id : " + regId);
+ //send the Registration Id to your server...
+ Map<String, Object> _msgStruct = new HashMap<>();
+ _msgStruct.put("code", CodeA2U.PushClientID);
+ _msgStruct.put("clientID", regId);
+ UniversalUtil.sendMessageToUnity(_msgStruct);
+ }
+ else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction()))
+ {
+ processCustomMessage(context, bundle);
+ }
+ else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction()))
+ {
+ Log.d(TAG, "[MyReceiver] 鎺ユ敹鍒版帹閫佷笅鏉ョ殑閫氱煡");
+ int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
+ Log.d(TAG, "[MyReceiver] 鎺ユ敹鍒版帹閫佷笅鏉ョ殑閫氱煡鐨処D: " + notifactionId);
+ }
+ else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction()))
+ {
+ Log.d(TAG, "[MyReceiver] 鐢ㄦ埛鐐瑰嚮鎵撳紑浜嗛�氱煡");
+ //鎵撳紑鑷畾涔夌殑Activity
+ Intent i = new Intent(context, MainActivity.class);
+ i.putExtras(bundle);
+ i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ context.startActivity(i);
+ }
+ else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction()))
+ {
+ Log.d(TAG, "[MyReceiver] 鐢ㄦ埛鏀跺埌鍒癛ICH PUSH CALLBACK: " + bundle.getString(
+ JPushInterface.EXTRA_EXTRA));
+ //鍦ㄨ繖閲屾牴鎹� JPushInterface.EXTRA_EXTRA 鐨勫唴瀹瑰鐞嗕唬鐮侊紝姣斿鎵撳紑鏂扮殑Activity锛� 鎵撳紑涓�涓綉椤电瓑..
+ }
+ else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction()))
+ {
+ boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE,
+ false);
+ Log.w(TAG,
+ "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
+ }
+ else
+ {
+ Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
+ }
+ } catch (Exception e)
+ {
+
+ }
+
+ }
+
+ // 鎵撳嵃鎵�鏈夌殑 intent extra 鏁版嵁
+ private static String printBundle(Bundle bundle)
+ {
+ StringBuilder sb = new StringBuilder();
+// for (String key : bundle.keySet()) {
+// if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
+// sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
+// }else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
+// sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
+// } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
+// if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
+// Logger.i(TAG, "This message has no Extra data");
+// continue;
+// }
+//
+// try {
+// JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
+// Iterator<String> it = json.keys();
+//
+// while (it.hasNext()) {
+// String myKey = it.next();
+// sb.append("\nkey:" + key + ", value: [" +
+// myKey + " - " +json.optString(myKey) + "]");
+// }
+// } catch (JSONException e) {
+// Logger.e(TAG, "Get message extra JSON error!");
+// }
+//
+// } else {
+// sb.append("\nkey:" + key + ", value:" + bundle.get(key));
+// }
+// }
+ return sb.toString();
+ }
+
+// public static final String KEY_TITLE = "title";
+// public static final String KEY_MESSAGE = "message";
+// public static final String KEY_EXTRAS = "extras";
+
+ //send msg to MainActivity
+ private void processCustomMessage(Context context, Bundle bundle)
+ {
+ Log.d(TAG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![MyReceiver] 鎺ユ敹鍒版帹閫佷笅鏉ョ殑鑷畾涔夋秷鎭�: " + bundle.getString(
+ JPushInterface.EXTRA_MESSAGE));
+// if (MainActivity.isForeground) {
+// String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
+// String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
+// Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
+// msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
+// if (!UniversalUtil.isEmpty(extras)) {
+// try {
+// JSONObject extraJson = new JSONObject(extras);
+// if (extraJson.length() > 0) {
+// msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
+// }
+// } catch (JSONException e) {
+//
+// }
+//
+// }
+// LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
+// }
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/LogUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/LogUtil.java
new file mode 100644
index 0000000..f92fca1
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/LogUtil.java
@@ -0,0 +1,114 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Created by Administrator on 2018/7/25 0025.
+ */
+
+public class LogUtil
+{
+ private static final String Global_TAG = "h2EngineSdk";
+ private static final String TAG = "LogUtil";
+ public static boolean UPLOAD = false;
+ private static boolean SAVE = false;
+ private static boolean SHOW = true;
+
+ private final static SimpleDateFormat m_DateFormatMS = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss.SSS");
+ private final static SimpleDateFormat m_DateFormatDay = new SimpleDateFormat("yyyy-MM-dd");
+
+ private static Activity m_Activity;
+
+ public static void init(Activity activity, boolean showLog)
+ {
+ m_Activity = activity;
+ SHOW = showLog;
+ File _file = new File(getPath());
+ if (_file.exists())
+ {
+ SAVE = true;
+ i(TAG, "鍚姩鏈湴log瀛樺偍鍔熻兘");
+ }
+ else
+ {
+ SAVE = false;
+ i(TAG, "鏈惎鍔ㄦ湰鍦發og瀛樺偍鍔熻兘");
+ }
+ }
+
+ public static void i(String tag, String content)
+ {
+ content = ("[" + m_DateFormatMS.format(new Date()) + "]") + "[" + tag + "] " + content;
+ Log.i(Global_TAG, content);
+ if (SAVE)
+ {
+ write(content);
+ }
+ }
+
+ public static void w(String tag, String content)
+ {
+ content = ("[" + m_DateFormatMS.format(new Date()) + "]") + "[" + tag + "] " + content;
+ Log.w(Global_TAG, content);
+ if (SAVE)
+ {
+ write(content);
+ }
+ }
+
+ public static void e(String tag, String content)
+ {
+ content = ("[" + m_DateFormatMS.format(new Date()) + "]") + "[" + tag + "] " + content;
+ Log.e(Global_TAG, content);
+ if (SAVE)
+ {
+ write(content);
+ }
+ }
+
+ private static String getPath()
+ {
+ if (m_Activity.getExternalFilesDir("") == null)
+ {
+ Log.i(TAG,"m_Activity.getExternalFilesDir(\"\") == null");
+ return "";
+ }
+
+ return m_Activity.getExternalFilesDir("").getAbsolutePath()
+ + File.separator
+ + "debugLog"
+ + File.separator;
+ }
+
+ private static void write(String content)
+ {
+ try
+ {
+ String time = m_DateFormatDay.format(new Date());
+ String fileName = "log_" + time + ".log";
+ FileOutputStream fos = new FileOutputStream(getPath() + fileName, true);
+ fos.write(content.getBytes());
+ fos.flush();
+ fos.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static void upLoad()
+ {
+ if (!UPLOAD)
+ {
+ return;
+ }
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/MainActivity.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/MainActivity.java
new file mode 100644
index 0000000..a06d631
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/MainActivity.java
@@ -0,0 +1,200 @@
+package com.secondworld.univeralsdk;
+
+import android.Manifest;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Process;
+import android.provider.Settings;
+import android.support.v4.content.PermissionChecker;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.RelativeLayout;
+
+import com.unity3d.player.UnityPlayerActivity;
+
+public class MainActivity extends UnityPlayerActivity
+{
+ private static final String TAG = "MainActivity";
+ public static boolean isForeground = false;
+ // 鍚敤6.0浠ヤ笂鏉冮檺鍥炶皟code
+ // private static final int CODE_REQUEST_PERMISSION = 1000;
+
+ private RelativeLayout m_MainContainer;
+ private int mType;
+ private boolean isNotch = false;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ LogUtil.i(TAG, "onCreate");
+ LogUtil.init(this, true);
+
+ setContentView(R.layout.activity_main);
+
+ m_MainContainer = (RelativeLayout) findViewById(R.id.main_container);
+
+ String _brand = NotchPhoneUtil.getDeviceBrand();
+ if (_brand.toUpperCase().contains("VIVO"))
+ {
+ isNotch = NotchPhoneUtil.HasNotchVivo(MainActivity.this);
+ mType = 1;
+ }
+ else if (_brand.toUpperCase().contains("HUAWEI")
+ || _brand.toUpperCase().contains("HONOR"))
+ {
+// isNotch = NotchPhoneUtil.hasNotchAtHuawei(this);;
+// mType = 2;
+ }
+ else if (_brand.toUpperCase().contains("OPPO"))
+ {
+ isNotch = NotchPhoneUtil.HasNotchOPPO(MainActivity.this);
+ mType = 3;
+ }
+ else if (_brand.toUpperCase().contains("XIAOMI"))
+ {
+ isNotch = NotchPhoneUtil.HasNotchXiaoMi();
+ mType = 4;
+ }
+
+ NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer);
+
+ FrameLayout _frameLayout = (FrameLayout) findViewById(R.id.unity_view);
+ View unityView = mUnityPlayer.getView();
+ _frameLayout.addView(unityView);
+
+ H2EngineSDK.onCreate(this, savedInstanceState);
+ }
+
+ @Override
+ public void onWindowFocusChanged(boolean b)
+ {
+ super.onWindowFocusChanged(b);
+ H2EngineSDK.onWindowFocusChanged(b);
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent)
+ {
+ super.onNewIntent(intent);
+ H2EngineSDK.onNewIntent(this, intent);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data)
+ {
+ H2EngineSDK.onActivityResult(requestCode, resultCode, data, this);
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig)
+ {
+ NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer);
+
+ H2EngineSDK.onConfigurationChanged(newConfig);
+
+ super.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ protected void onStart()
+ {
+ H2EngineSDK.onStart(this);
+
+ super.onStart();
+ }
+
+ @Override
+ protected void onStop()
+ {
+ isForeground = false;
+ H2EngineSDK.onStop(this);
+
+ super.onStop();
+ }
+
+ @Override
+ protected void onResume()
+ {
+ isForeground = true;
+ H2EngineSDK.onResume(this);
+
+ super.onResume();
+
+ // 妫�娴嬫湰鍦板瓨鍌ㄦ潈闄愭槸鍚︽湁, 娌℃湁鐨勮瘽瑕佹彁绀虹敤鎴�
+ if (PermissionChecker.checkPermission(this,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ Process.myPid(), Process.myUid(),
+ getPackageName()) != PackageManager.PERMISSION_GRANTED
+ || PermissionChecker.checkPermission(this,
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Process.myPid(), Process.myUid(),
+ getPackageName()) != PackageManager.PERMISSION_GRANTED)
+ {
+ new AlertDialog.Builder(this)
+ .setMessage("搴旂敤娌℃湁瀛樺偍璇诲彇鏉冮檺,鐐瑰嚮纭畾鑷宠缃腑寮�鍚�,鍚﹀垯鏃犳硶缁х画娓告垙.")
+ .setCancelable(false)
+ .setPositiveButton("纭畾",
+ new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialogInterface,
+ int i)
+ {
+ UniversalUtil.hasGoToSetting = true;
+ Intent intent = new Intent(
+ Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = Uri.fromParts("package",
+ getPackageName(),
+ null);
+ intent.setData(uri);
+ startActivity(intent);
+ }
+ })
+ .setNegativeButton("鎷掔粷",
+ new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialogInterface,
+ int i)
+ {
+ finish();
+ }
+ })
+ .show();
+ }
+ }
+
+ @Override
+ protected void onPause()
+ {
+ H2EngineSDK.onPause(this);
+
+ super.onPause();
+ }
+
+ @Override
+ protected void onDestroy()
+ {
+ H2EngineSDK.onDestroy(this);
+
+ super.onDestroy();
+ }
+
+ @Override
+ protected void onRestart()
+ {
+ H2EngineSDK.onRestart(this);
+
+ super.onRestart();
+ }
+
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/NotchPhoneUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/NotchPhoneUtil.java
new file mode 100644
index 0000000..51a355c
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/NotchPhoneUtil.java
@@ -0,0 +1,347 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.Surface;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+import java.lang.reflect.Method;
+
+/**
+ * Created by Administrator on 2018/9/11 0011.
+ */
+
+public class NotchPhoneUtil
+{
+ private final static String TAG = "Notch";
+ /**
+ * 鍗庝负鎵嬫満鍒ゆ柇鏄笉鏄垬娴锋墜鏈�
+ *
+ * @param context
+ * @return
+ */
+ public static boolean hasNotchAtHuawei(Context context)
+ {
+ boolean ret = false;
+ try
+ {
+ ClassLoader classLoader = context.getClassLoader();
+ Class HwNotchSizeUtil = classLoader.loadClass(
+ "com.huawei.android.util.HwNotchSizeUtil");
+ Method get = HwNotchSizeUtil.getMethod("hasNotchInScreen");
+ ret = (boolean) get.invoke(HwNotchSizeUtil);
+ } catch (ClassNotFoundException e)
+ {
+ LogUtil.e(TAG, "hasNotchAtHuawei ClassNotFoundException");
+ } catch (NoSuchMethodException e)
+ {
+ LogUtil.e(TAG, "hasNotchAtHuawei NoSuchMethodException");
+ } catch (Exception e)
+ {
+ LogUtil.e(TAG, "hasNotchAtHuawei Exception");
+ } finally
+ {
+ return ret;
+ }
+ }
+
+
+ /**
+ * 鍗庝负鎵嬫満鑾峰彇鍒樻捣鐨勫楂�
+ * int[0]鍊间负鍒樻捣瀹藉害 int[1]鍊间负鍒樻捣楂樺害
+ */
+ public static int[] getNotchSizeAtHuawei(Context context)
+ {
+ int[] ret = new int[]{0, 0};
+ try
+ {
+ ClassLoader cl = context.getClassLoader();
+ Class HwNotchSizeUtil = cl.loadClass("com.huawei.android.util.HwNotchSizeUtil");
+ Method get = HwNotchSizeUtil.getMethod("getNotchSize");
+ ret = (int[]) get.invoke(HwNotchSizeUtil);
+ } catch (ClassNotFoundException e)
+ {
+ LogUtil.e(TAG, "getNotchSizeAtHuawei ClassNotFoundException");
+ } catch (NoSuchMethodException e)
+ {
+ LogUtil.e(TAG, "getNotchSizeAtHuawei NoSuchMethodException");
+ } catch (Exception e)
+ {
+ LogUtil.e(TAG, "getNotchSizeAtHuawei Exception");
+ } finally
+ {
+ return ret;
+ }
+ }
+
+
+ /**
+ * OPPO鍒ゆ柇鏄笉鏄垬娴锋墜鏈�,
+ * OPPO涓嶆彁渚涙帴鍙h幏鍙栧垬娴峰昂瀵革紝鐩墠鍏舵湁鍒樻捣灞忕殑鏈哄瀷灏哄瑙勬牸閮芥槸缁熶竴鐨勩�備笉鎺掗櫎浠ュ悗鏈哄瀷浼氭湁鍙樺寲銆�
+ * 鍒樻捣鍖哄煙鍒欓兘鏄搴︿负324px, 楂樺害涓�80px銆�
+ *
+ * @param context
+ * @return
+ */
+ public static boolean HasNotchOPPO(Context context)
+ {
+ return context.getPackageManager().hasSystemFeature(
+ "com.oppo.feature.screen.heteromorphism");
+ }
+
+
+ public static final int VIVO_NOTCH = 0x00000020;//鏄惁鏈夊垬娴�
+
+ /**
+ * vivo鍒ゆ柇鏄笉鏄垬娴锋墜鏈�
+ */
+ public static boolean HasNotchVivo(Context context)
+ {
+ boolean ret = false;
+ try
+ {
+ ClassLoader classLoader = context.getClassLoader();
+ Class FtFeature = classLoader.loadClass("android.util.FtFeature");
+ Method method = FtFeature.getMethod("isFeatureSupport", int.class);
+ ret = (boolean) method.invoke(FtFeature, VIVO_NOTCH);
+ } catch (ClassNotFoundException e)
+ {
+ LogUtil.e(TAG, "hasNotchAtVivo ClassNotFoundException");
+ } catch (NoSuchMethodException e)
+ {
+ LogUtil.e(TAG, "hasNotchAtVivo NoSuchMethodException");
+ } catch (Exception e)
+ {
+ LogUtil.e(TAG, "hasNotchAtVivo Exception");
+ } finally
+ {
+ return ret;
+ }
+
+ }
+
+ /**
+ * 灏忕背鎵嬫満鍒ゆ柇鏄笉鏄垬娴锋墜鏈�
+ *
+ * @return
+ */
+ public static boolean HasNotchXiaoMi()
+ {
+ Boolean _hasNotchXiaoMi = getPropertyInt("ro.miui.notch", 0) == 1 ? true : false;
+ LogUtil.i(TAG,"鏄惁鏄皬绫冲垬娴锋墜鏈�: " + _hasNotchXiaoMi);
+ return _hasNotchXiaoMi;
+ }
+
+ private static int getPropertyInt(String key,int defaultValue)
+ {
+ int value = defaultValue;
+ try
+ {
+ Class<?> c = Class.forName("android.os.SystemProperties");
+ Method get = c.getMethod("get", String.class, String.class);
+ value = (int) (get.invoke(c, key, "unknown"));
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ } finally
+ {
+ return value;
+ }
+ }
+
+ /**
+ * 灏忕背鎵嬫満鑾峰彇鍒樻捣鐨勯珮搴�
+ */
+ public static int getStatusBarHeight(Context context)
+ {
+ int statusBarHeight = 0;
+ int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen",
+ "android");
+ if (resourceId > 0)
+ {
+ statusBarHeight = context.getResources().getDimensionPixelSize(resourceId);
+ }
+ return statusBarHeight;
+ }
+
+ /**
+ * 灞忓箷鏃嬭浆姹囨�荤殑鏂规硶
+ *
+ * @param activity
+ * @param isNotch
+ * @param type
+ * @param viewGroup
+ */
+ public static void onConfigurationChanged(Activity activity, Boolean isNotch, int type,
+ ViewGroup viewGroup)
+ {
+ if (getDisplayRotation(activity) == 0)
+ {
+ if (isNotch)
+ {
+ switch (type)
+ {
+ case 1: //vivo
+ FrameLayout.LayoutParams lpvivo = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpvivo.topMargin = dp2px(activity, 32);
+ lpvivo.leftMargin = 0;
+ lpvivo.rightMargin = 0;
+ viewGroup.setLayoutParams(lpvivo);
+ break;
+ case 2: //HUAWEI
+
+ int[] sizeAtHuawei = NotchPhoneUtil.getNotchSizeAtHuawei(activity);
+ FrameLayout.LayoutParams lphuawei = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lphuawei.topMargin = sizeAtHuawei[1];
+ lphuawei.leftMargin = 0;
+ lphuawei.rightMargin = 0;
+ viewGroup.setLayoutParams(lphuawei);
+
+ break;
+ case 3: //OPPO 鐩墠閮戒负 80px
+ FrameLayout.LayoutParams lpOppo = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpOppo.topMargin = 80;
+ lpOppo.leftMargin = 0;
+ lpOppo.rightMargin = 0;
+ viewGroup.setLayoutParams(lpOppo);
+
+
+ break;
+ case 4: //Xiaomi
+ int sizeAtXiaomi = NotchPhoneUtil.getStatusBarHeight(activity);
+ FrameLayout.LayoutParams lpXiaomi = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpXiaomi.topMargin = sizeAtXiaomi;
+ lpXiaomi.leftMargin = 0;
+ lpXiaomi.rightMargin = 0;
+ viewGroup.setLayoutParams(lpXiaomi);
+
+ break;
+ }
+
+ }
+
+ }
+ else if (getDisplayRotation(activity) == 90)
+ {
+ leftAndRightChange(activity, isNotch, type, viewGroup);
+ }
+ else if (getDisplayRotation(activity) == 180)
+ {
+ }
+ else if (getDisplayRotation(activity) == 270)
+ {
+ leftAndRightChange(activity, isNotch, type, viewGroup);
+ }
+
+
+ }
+
+ /**
+ * 宸﹀彸妯睆閮芥槸璁� leftMargin 鍜宺ightMargin 绌哄嚭涓�涓垬娴风殑璺濈
+ *
+ * @param activity
+ * @param isNotch
+ * @param type
+ * @param viewGroup
+ */
+ private static void leftAndRightChange(Activity activity, Boolean isNotch, int type,
+ ViewGroup viewGroup)
+ {
+ if (isNotch)
+ {
+ switch (type)
+ {
+ case 1: //vivo
+ FrameLayout.LayoutParams lpvivo = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpvivo.leftMargin = dp2px(activity, 32);
+ lpvivo.rightMargin = dp2px(activity, 32);
+ lpvivo.topMargin = 0;
+ lpvivo.bottomMargin = 0;
+ viewGroup.setLayoutParams(lpvivo);
+ break;
+ case 2: //HUAWEI
+
+ int[] sizeAtHuawei = NotchPhoneUtil.getNotchSizeAtHuawei(activity);
+ FrameLayout.LayoutParams lphuawei = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lphuawei.leftMargin = sizeAtHuawei[1];
+ lphuawei.rightMargin = sizeAtHuawei[1];
+ lphuawei.topMargin = 0;
+ lphuawei.bottomMargin = 0;
+ viewGroup.setLayoutParams(lphuawei);
+
+ break;
+ case 3: //OPPO 鐩墠閮戒负 80px
+ FrameLayout.LayoutParams lpOppo = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpOppo.leftMargin = 80;
+ lpOppo.rightMargin = 80;
+ lpOppo.topMargin = 0;
+ lpOppo.bottomMargin = 0;
+ viewGroup.setLayoutParams(lpOppo);
+
+ break;
+ case 4: //Xiaomi
+ int sizeAtXiaomi = NotchPhoneUtil.getStatusBarHeight(activity);
+ FrameLayout.LayoutParams lpXiaomi = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
+ lpXiaomi.leftMargin = sizeAtXiaomi;
+ lpXiaomi.rightMargin = sizeAtXiaomi;
+ lpXiaomi.topMargin = 0;
+ lpXiaomi.bottomMargin = 0;
+ viewGroup.setLayoutParams(lpXiaomi);
+ break;
+ }
+
+ }
+ }
+
+ /**
+ * 鑾峰彇褰撳墠灞忓箷鏃嬭浆瑙掑害
+ *
+ * @param activity
+ * @return 0琛ㄧず鏄珫灞�; 90琛ㄧず鏄乏妯睆; 180琛ㄧず鏄弽鍚戠珫灞�; 270琛ㄧず鏄彸妯睆
+ */
+ public static int getDisplayRotation(Activity activity)
+ {
+ if (activity == null)
+ {
+ return 0;
+ }
+
+ int rotation = activity.getWindowManager().getDefaultDisplay()
+ .getRotation();
+ switch (rotation)
+ {
+ case Surface.ROTATION_0:
+ return 0;
+ case Surface.ROTATION_90:
+ return 90;
+ case Surface.ROTATION_180:
+ return 180;
+ case Surface.ROTATION_270:
+ return 270;
+ }
+ return 0;
+ }
+
+ /**
+ * px杞琩p
+ *
+ * @param context
+ * @param dipValue
+ */
+ public static int dp2px(Context context, float dipValue)
+ {
+ final float scale = context.getResources().getDisplayMetrics().density;
+ return (int) (dipValue * scale + 0.5f);
+ }
+
+ /**
+ * 鑾峰彇鎵嬫満鍘傚晢
+ *
+ * @return 鎵嬫満鍘傚晢 Xiaomi HUAWEI vivo
+ */
+ public static String getDeviceBrand()
+ {
+ return android.os.Build.BRAND;
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/StaticDefine.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/StaticDefine.java
new file mode 100644
index 0000000..c53009b
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/StaticDefine.java
@@ -0,0 +1,18 @@
+package com.secondworld.univeralsdk;
+
+/**
+ * Created by Administrator on 2018/6/14 0014.
+ */
+
+public class StaticDefine {
+
+ public static final String UnityGameObjectName = "SDKUtility";
+ public static final String UnityHandleFuncName = "HandleSdkMessage";
+
+ public static final String LS_KEY_VERSION = "H2Engine_App_Version";
+ public static final String LS_KEY_COPIED = "H2Engine_Copy_Finished";
+ public final static String LS_KEY_IMEI = "H2Engine_DEVICE_IMEI";
+ public final static String LS_KEY_MAC = "H2Engine_DEVICE_MAC";
+ public final static String LS_KEY_ANDROID_ID = "H2Engine_DEVICE_ANDROID_ID";
+
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniqueID.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniqueID.java
new file mode 100644
index 0000000..11899ea
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniqueID.java
@@ -0,0 +1,226 @@
+package com.secondworld.univeralsdk;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.provider.Settings;
+import android.support.v4.content.ContextCompat;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.security.MessageDigest;
+import java.util.UUID;
+
+/**
+ * Created by Administrator on 2018/7/12 0012.
+ */
+
+public class UniqueID
+{
+ public static String get(Context context)
+ {
+ String _id = read(context);
+
+ if (_id != null && !_id.equals(""))
+ {
+ return _id;
+ }
+
+ StringBuffer _buffer = new StringBuffer();
+
+ _id = getDeviceId(context);
+ _buffer.append(_id);
+
+ _id = getLocalMac(context).replace(":", "");
+ _buffer.append(_id);
+
+ if (_buffer == null || _buffer.length() <= 0)
+ {
+ UUID _uuid = UUID.randomUUID();
+ _id = _uuid.toString().replace("-", "");
+ _buffer.append(_id);
+ }
+
+ _id = getMD5(_buffer.toString(), false);
+
+ if (_id.length() > 0)
+ {
+ save(_id, context);
+ }
+ return _id;
+ }
+
+ private static String read(Context context)
+ {
+ File _file = new File(context.getExternalFilesDir(""), "/tsw_device_unique_id.txt");
+ if (!_file.exists())
+ {
+ return null;
+ }
+ StringBuffer _buffer = new StringBuffer();
+ try
+ {
+ FileInputStream _fis = new FileInputStream(_file);
+ InputStreamReader _isr = new InputStreamReader(_fis, "UTF-8");
+ Reader _in = new BufferedReader(_isr);
+ int _index;
+ while ((_index = _in.read()) > -1)
+ {
+ _buffer.append((char) _index);
+ }
+ _in.close();
+ return _buffer.toString();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static void save(String id, Context context)
+ {
+ File _file = new File(context.getExternalFilesDir(""), "/tsw_device_unique_id.txt");
+ try
+ {
+ Log.i("UniqueIDUtil", "path: " + _file.getAbsolutePath());
+ FileOutputStream _fos = new FileOutputStream(_file);
+ Writer _writer = new OutputStreamWriter(_fos, "UTF-8");
+ _writer.write(id);
+ _writer.close();
+ _fos.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static String getAndroidID(Context context)
+ {
+ return Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);
+ }
+
+ public static String getDeviceId(Context context)
+ {
+ SharedPreferences _sp = context.getSharedPreferences(context.getPackageName(),
+ Context.MODE_PRIVATE);
+ String _deviceId = _sp.getString(StaticDefine.LS_KEY_IMEI, "");
+ if (!_deviceId.equals(""))
+ {
+ return _deviceId;
+ }
+
+ TelephonyManager tm = (TelephonyManager) context
+ .getSystemService(Context.TELEPHONY_SERVICE);
+
+ if (ContextCompat.checkSelfPermission(context,
+ Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)
+ {
+ _deviceId = tm.getDeviceId();
+ SharedPreferences.Editor _e = _sp.edit();
+ _e.putString(StaticDefine.LS_KEY_IMEI, _deviceId);
+ _e.apply();
+ return _deviceId;
+ }
+ return "";
+ }
+
+ public static String getLocalMac(Context context)
+ {
+ SharedPreferences _sp = context.getSharedPreferences(context.getPackageName(),
+ Context.MODE_PRIVATE);
+ String _macAddress = _sp.getString(StaticDefine.LS_KEY_MAC, "");
+ if (!_macAddress.equals(""))
+ {
+ return _macAddress;
+ }
+ StringBuffer _buffer = new StringBuffer();
+ NetworkInterface _networkInterface;
+ try
+ {
+ _networkInterface = NetworkInterface.getByName("eth1");
+ if (_networkInterface == null)
+ {
+ _networkInterface = NetworkInterface.getByName("wlan0");
+ }
+ if (_networkInterface == null)
+ {
+ return "";
+ }
+ byte[] _addresses = _networkInterface.getHardwareAddress();
+ for (byte b : _addresses)
+ {
+ _buffer.append(String.format("%02X:", b));
+ }
+ if (_buffer.length() > 0)
+ {
+ _buffer.deleteCharAt(_buffer.length() - 1);
+ }
+ _macAddress = _buffer.toString();
+ SharedPreferences.Editor _e = _sp.edit();
+ _e.putString(StaticDefine.LS_KEY_MAC, _macAddress);
+ _e.apply();
+ } catch (SocketException e)
+ {
+ e.printStackTrace();
+ return "";
+ }
+ return _macAddress;
+ }
+
+ public static String getMD5(String message, boolean upperCase)
+ {
+ String md5str = "";
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("MD5");
+
+ byte[] input = message.getBytes();
+
+ byte[] buff = md.digest(input);
+
+ md5str = bytesToHex(buff, upperCase);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return md5str;
+ }
+
+ private static String bytesToHex(byte[] bytes, boolean upperCase)
+ {
+ StringBuffer md5str = new StringBuffer();
+ int digital;
+ for (int i = 0; i < bytes.length; i++)
+ {
+ digital = bytes[i];
+
+ if (digital < 0)
+ {
+ digital += 256;
+ }
+ if (digital < 16)
+ {
+ md5str.append("0");
+ }
+ md5str.append(Integer.toHexString(digital));
+ }
+ if (upperCase)
+ {
+ return md5str.toString().toUpperCase();
+ }
+ return md5str.toString().toLowerCase();
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java
new file mode 100644
index 0000000..8b2a47c
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/UniversalUtil.java
@@ -0,0 +1,401 @@
+package com.secondworld.univeralsdk;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PermissionInfo;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.Uri;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Process;
+import android.provider.Settings;
+import android.support.v4.content.PermissionChecker;
+import android.widget.Toast;
+
+import com.unity3d.player.UnityPlayer;
+
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2018/6/15 0015.
+ */
+
+public class UniversalUtil
+{
+ private final static String TAG = "UniversalUtil";
+
+ /**
+ * 鑾峰緱搴旂敤鐨勭増鏈彿
+ */
+ public static String GetVersionName(Context context)
+ {
+ PackageManager _packageManager = context.getPackageManager();
+ PackageInfo _packageInfo = null;
+
+ try
+ {
+ _packageInfo = _packageManager.getPackageInfo(context.getPackageName(), 0);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ if (_packageInfo != null)
+ {
+ return _packageInfo.versionName;
+ }
+ return null;
+ }
+
+ public static void sendMessageToUnity(Map<String, Object> jsonMap)
+ {
+ if (jsonMap == null || jsonMap.isEmpty())
+ {
+ return;
+ }
+
+ JSONObject _jsonObject = new JSONObject(jsonMap);
+
+ UnityPlayer.UnitySendMessage(StaticDefine.UnityGameObjectName,
+ StaticDefine.UnityHandleFuncName,
+ _jsonObject.toString());
+ }
+
+ public static void InstallAPK(Context context, final String path)
+ {
+ File _file = new File(path);
+
+ if (_file == null)
+ {
+ Toast.makeText(context, "缁欏畾鐨勫湴鍧�[" + path + "]鎵句笉鍒拌瀹夎鐨勫簲鐢ㄦ枃浠�", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ try
+ {
+ Intent _intent = new Intent(Intent.ACTION_VIEW);
+
+// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
+// {
+// _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+// Uri _contentUri = FileProvider.getUriForFile(context,
+// context.getPackageName() + ".fileProvider",
+// _file);
+// _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive");
+// }
+// else
+// {
+ _intent.setDataAndType(Uri.fromFile(_file),
+ "application/vnd.android.package-archive");
+ _intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+// }
+
+ context.startActivity(_intent);
+
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ Toast.makeText(context, "鎵句笉鍒版墦寮�姝ょ被鍨嬫枃浠剁殑绋嬪簭", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ public static void CopyTextToClipboard(final Activity activity, final String text)
+ {
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ ClipboardManager _mgr = (ClipboardManager) activity.getSystemService(
+ Context.CLIPBOARD_SERVICE);
+ ClipData _data = ClipData.newPlainText("playerId", text);
+ _mgr.setPrimaryClip(_data);
+ }
+ });
+ }
+
+ public static long getMemTotal()
+ {
+ try
+ {
+ FileReader fileReader = new FileReader("/proc/meminfo");
+ BufferedReader bufferedReader = new BufferedReader(fileReader, 4 * 1024);
+ String str;
+ while ((str = bufferedReader.readLine()) != null)
+ {
+ if (str.contains("MemTotal"))
+ {
+ break;
+ }
+ }
+ bufferedReader.close();
+ fileReader.close();
+ String[] array = str.split("\\s+");
+ // 鑾峰緱绯荤粺鎬诲唴瀛橈紝鍗曚綅鏄疜B
+ return Integer.valueOf(array[1]).intValue();
+ } catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return 0;
+ }
+
+ public static String getPublicIp(boolean useHttps)
+ {
+ String _ip;
+ try
+ {
+ URL ipify = useHttps ? new URL("https://api.ipify.org") : new URL(
+ "http://api.ipify.org");
+ URLConnection conn = ipify.openConnection();
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ _ip = in.readLine();
+ in.close();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ public static String getIP(Context context)
+ {
+ NetworkInfo info = ((ConnectivityManager) context
+ .getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
+ if (info != null && info.isConnected())
+ {
+ if (info.getType() == ConnectivityManager.TYPE_MOBILE)
+ {//褰撳墠浣跨敤2G/3G/4G缃戠粶
+ try
+ {
+ for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); )
+ {
+ NetworkInterface intf = en.nextElement();
+ for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); )
+ {
+ InetAddress inetAddress = enumIpAddr.nextElement();
+ if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address)
+ {
+ return inetAddress.getHostAddress();
+ }
+ }
+ }
+ } catch (SocketException e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+ else if (info.getType() == ConnectivityManager.TYPE_WIFI)
+ {//褰撳墠浣跨敤鏃犵嚎缃戠粶
+ WifiManager wifiManager = (WifiManager) context.getSystemService(
+ Context.WIFI_SERVICE);
+ WifiInfo wifiInfo = wifiManager.getConnectionInfo();
+ return intIP2StringIP(wifiInfo.getIpAddress());
+ }
+ }
+ else
+ {
+ //褰撳墠鏃犵綉缁滆繛鎺�,璇峰湪璁剧疆涓墦寮�缃戠粶
+ }
+ return null;
+ }
+
+ private static String intIP2StringIP(int ip)
+ {
+ return (ip & 0xFF) + "." +
+ ((ip >> 8) & 0xFF) + "." +
+ ((ip >> 16) & 0xFF) + "." +
+ (ip >> 24 & 0xFF);
+ }
+
+ public static boolean hasRWP = false;
+ public static boolean hasGoToSetting = false;
+
+ public static void CheckWriteAndReadExternalStorage(final Activity activity)
+ {
+ //Log.i("MainActivity", "CheckWriteAndReadExternalStorage 寮�濮� hasGoToSetting: " + hasGoToSetting);
+
+ if (hasRWP && !hasGoToSetting)
+ {
+ //Log.i("MainActivity", "1111 鏈夋潈闄�");
+ return;
+ }
+
+ if (PermissionChecker.checkPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE,
+ Process.myPid(), Process.myUid(),
+ activity.getPackageName()) == PackageManager.PERMISSION_GRANTED)
+ {
+ //Log.i("MainActivity", "鏈夋潈闄�");
+ hasRWP = true;
+ if (hasGoToSetting)
+ {
+ //Log.i("MainActivity", "鍘昏繃璁剧疆鐣岄潰, 杩欓噷閲嶅惎");
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ String _packageName = activity.getPackageName();
+ Intent _launch = activity.getBaseContext().getPackageManager().getLaunchIntentForPackage(
+ _packageName);
+ _launch.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ activity.startActivity(_launch);
+ Process.killProcess(Process.myPid());
+ }
+ }.start();
+ activity.finish();
+ }
+ });
+ }
+ return;
+ }
+
+ if (!hasRWP)
+ {
+ new AlertDialog.Builder(activity)
+ .setMessage("搴旂敤娌℃湁瀛樺偍璇诲彇鏉冮檺,鐐瑰嚮纭畾鑷宠缃腑寮�鍚�,鍚﹀垯鏃犳硶缁х画娓告垙.")
+ .setCancelable(false)
+ .setPositiveButton("纭畾",
+ new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialogInterface,
+ int i)
+ {
+ UniversalUtil.hasGoToSetting = true;
+ Intent intent = new Intent(
+ Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = Uri.fromParts("package",
+ activity.getPackageName(),
+ null);
+ intent.setData(uri);
+ activity.startActivity(intent);
+ }
+ })
+ .setNegativeButton("鎷掔粷",
+ new DialogInterface.OnClickListener()
+ {
+ @Override
+ public void onClick(DialogInterface dialogInterface,
+ int i)
+ {
+ activity.finish();
+ }
+ })
+ .show();
+ }
+ }
+
+ public static boolean checkPermission22(Activity activity, String permission)
+ {
+ PackageManager _pkgMgr = activity.getPackageManager();
+ LogUtil.i(TAG, "寮�濮嬫娴嬫潈闄�: " + permission);
+ try
+ {
+ PermissionInfo _info = _pkgMgr.getPermissionInfo(permission,
+ PackageManager.GET_META_DATA);
+
+ LogUtil.i(TAG, " |-- 淇濇姢绾у埆: " + _info.protectionLevel);
+ if (_info.protectionLevel != PermissionInfo.PROTECTION_DANGEROUS && _info.protectionLevel != 4097)
+ {
+ LogUtil.i(TAG, " |-- 涓嶆槸鍗遍櫓鏉冮檺.");
+ return false;
+ }
+
+ } catch (PackageManager.NameNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+
+ int _result = PermissionChecker.checkPermission(activity, permission,
+ Process.myPid(), Process.myUid(),
+ activity.getPackageName());
+
+ LogUtil.i(TAG, " |-- 鑾峰彇绫诲瀷: " + _result);
+
+ if (_result == PackageManager.PERMISSION_GRANTED)
+ {
+ LogUtil.i(TAG, permission + " 鏈夎繖涓潈闄�.");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static String getMetaString(Activity activity, String key)
+ {
+ PackageManager _pkgMgr = activity.getPackageManager();
+ ApplicationInfo _appInfo;
+ try
+ {
+ _appInfo = _pkgMgr.getApplicationInfo(activity.getPackageName(),
+ PackageManager.GET_META_DATA);
+ return _appInfo.metaData.getString(key);
+ } catch (PackageManager.NameNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static int getMetaInt(Activity activity, String key)
+ {
+ LogUtil.i(TAG, "灏嗚鑾峰彇鐨凪etaKey: " + key);
+ PackageManager _pkgMgr = activity.getPackageManager();
+ ApplicationInfo _appInfo;
+ try
+ {
+ _appInfo = _pkgMgr.getApplicationInfo(activity.getPackageName(),
+ PackageManager.GET_META_DATA);
+ return _appInfo.metaData.getInt(key);
+ } catch (PackageManager.NameNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ return -1;
+ }
+
+ public static boolean isEmpty(String s) {
+ if (null == s)
+ return true;
+ if (s.length() == 0)
+ return true;
+ if (s.trim().length() == 0)
+ return true;
+ return false;
+ }
+}
diff --git a/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/WebViewUtil.java b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/WebViewUtil.java
new file mode 100644
index 0000000..8c14377
--- /dev/null
+++ b/Project/yj_sdk/src/main/java/com/secondworld/univeralsdk/WebViewUtil.java
@@ -0,0 +1,185 @@
+package com.secondworld.univeralsdk;
+
+import android.app.Activity;
+import android.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.net.Uri;
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebChromeClient;
+import android.webkit.WebResourceResponse;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+
+/**
+ * Created by Administrator on 2018/8/1 0001.
+ */
+public class WebViewUtil
+{
+ private static Activity m_Activity;
+ private static String m_ReceivedUrl;
+ private static WebView m_WebView;
+ private static Button m_BtnClose;
+
+ public static void OpenWebView(final Activity activity, final String url)
+ {
+ m_Activity = activity;
+ m_ReceivedUrl = url;
+
+ activity.runOnUiThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ if (m_WebView != null && m_WebView.getVisibility() == View.VISIBLE)
+ {
+ processClose();
+ return;
+ }
+
+ DisplayMetrics _dm = new DisplayMetrics();
+ m_Activity.getWindowManager().getDefaultDisplay().getMetrics(_dm);
+ final float _scale = _dm.widthPixels * 1f / 1344;
+ final int _width = (int) (_scale * 982);
+ final int _height = (int) (_scale * 560);
+
+ m_BtnClose = (Button) m_Activity.findViewById(R.id.webView_btn_close);
+ ViewGroup.MarginLayoutParams _margin = new ViewGroup.MarginLayoutParams(
+ m_BtnClose.getLayoutParams());
+ RelativeLayout.LayoutParams _params = new RelativeLayout.LayoutParams(_margin);
+ _params.width = 0;
+ _params.height = 0;
+ _params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.webView);
+ _params.addRule(RelativeLayout.ALIGN_RIGHT, R.id.webView);
+ m_BtnClose.setLayoutParams(_params);
+
+ m_BtnClose.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ processClose();
+ }
+ });
+
+ m_WebView = (WebView) m_Activity.findViewById(R.id.webView);
+ ViewGroup.MarginLayoutParams margin = new ViewGroup.MarginLayoutParams(
+ m_WebView.getLayoutParams());
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(margin);
+ layoutParams.width = 0;
+ layoutParams.height = 0;
+ layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
+ m_WebView.setLayoutParams(layoutParams);
+ m_WebView.getSettings().setJavaScriptEnabled(true);
+ m_WebView.setWebViewClient(new WebViewClient()
+ {
+ @Override
+ public void onReceivedError(WebView view, int errorCode, String description,
+ String failingUrl)
+ {
+ super.onReceivedError(view, errorCode, description, failingUrl);
+ view.loadUrl(m_ReceivedUrl);
+ }
+
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url)
+ {
+ if (url.startsWith("http") || url.startsWith("https"))
+ { //http鍜宧ttps鍗忚寮�澶寸殑鎵ц姝e父鐨勬祦绋�
+ view.loadUrl(url);
+ return true;
+ }
+ else
+ { //鍏朵粬鐨刄RL鍒欎細寮�鍚竴涓狝citity鐒跺悗鍘昏皟鐢ㄥ師鐢烝PP
+ return super.shouldOverrideUrlLoading(view, url);
+ }
+ }
+
+ @Override
+ public WebResourceResponse shouldInterceptRequest(WebView view, String url)
+ {
+ if (url.startsWith("http") || url.startsWith("https"))
+ { //http鍜宧ttps鍗忚寮�澶寸殑鎵ц姝e父鐨勬祦绋�
+ return super.shouldInterceptRequest(view, url);
+ }
+ else
+ { //鍏朵粬鐨刄RL鍒欎細寮�鍚竴涓狝citity鐒跺悗鍘昏皟鐢ㄥ師鐢烝PP
+ try
+ {
+ Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ m_Activity.startActivity(in);
+ } catch (ActivityNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+ });
+ m_WebView.setWebChromeClient(new WebChromeClient()
+ {
+ @Override
+ public void onReceivedTitle(WebView view, String title)
+ {
+ if (title.contains("I'm QQ"))
+ {
+ m_WebView.loadUrl(m_ReceivedUrl);
+ }
+ super.onReceivedTitle(view, title);
+ }
+
+ @Override
+ public void onProgressChanged(WebView view, int newProgress)
+ {
+ if (newProgress == 100)
+ {
+ if (view.getUrl().contains("noticeweb"))
+ {
+
+ ViewGroup.MarginLayoutParams margin = new ViewGroup.MarginLayoutParams(
+ m_WebView.getLayoutParams());
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
+ margin);
+ layoutParams.width = _width;
+ layoutParams.height = _height;
+ layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT,
+ RelativeLayout.TRUE);
+ m_WebView.setLayoutParams(layoutParams);
+
+ ViewGroup.MarginLayoutParams _margin = new ViewGroup.MarginLayoutParams(
+ m_BtnClose.getLayoutParams());
+ RelativeLayout.LayoutParams _params = new RelativeLayout.LayoutParams(
+ _margin);
+ _params.width = (int) (180 * _scale);
+ _params.height = (int) (72 * _scale);
+ _params.rightMargin = (int) (250 * _scale);
+ _params.bottomMargin = (int) (10 * _scale);
+ _params.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.webView);
+ _params.addRule(RelativeLayout.ALIGN_RIGHT, R.id.webView);
+ m_BtnClose.setLayoutParams(_params);
+ }
+ }
+ }
+ });
+
+ m_WebView.loadUrl(m_ReceivedUrl);
+
+ m_WebView.setVisibility(View.VISIBLE);
+ m_BtnClose.setVisibility(View.VISIBLE);
+ }
+ });
+ }
+
+ private static void processClose()
+ {
+ m_WebView.clearFocus();
+ m_WebView.clearCache(true);
+ m_WebView.clearHistory();
+ m_WebView.clearFormData();
+ m_WebView.setVisibility(View.INVISIBLE);
+ m_BtnClose.setVisibility(View.INVISIBLE);
+ }
+}
diff --git a/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png
new file mode 100644
index 0000000..c9f4e4d
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png
Binary files differ
diff --git a/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png
new file mode 100644
index 0000000..f289651
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png
Binary files differ
diff --git a/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_btn_selector.xml b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_btn_selector.xml
new file mode 100644
index 0000000..c6dd002
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_btn_selector.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <!-- 鑾峰緱鐒︾偣浣嗘湭鎸変笅鏃剁殑鑳屾櫙鍥剧墖 -->
+ <item
+ android:state_focused="true"
+ android:state_enabled="true"
+ android:state_pressed="false"
+ android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+ <!-- 鎸変笅鏃剁殑鑳屾櫙鍥剧墖 -->
+ <item
+ android:state_enabled="true"
+ android:state_pressed="true"
+ android:drawable="@android:color/darker_gray" />
+ <!-- 鎸変笅鏃剁殑鑳屾櫙鍥剧墖 -->
+ <item
+ android:state_enabled="true"
+ android:state_checked="true"
+ android:drawable="@android:color/darker_gray" />
+ <!-- 榛樿鏃剁殑鑳屾櫙鍥剧墖 -->
+ <item android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+</selector>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_progressbar.xml b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_progressbar.xml
new file mode 100644
index 0000000..a1d9b8f
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable-hdpi/jpush_richpush_progressbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <!-- 鑳屾櫙 gradient鏄笎鍙�,corners瀹氫箟鐨勬槸鍦嗚 -->
+ <item android:id="@android:id/background">
+ <shape>
+ <solid android:color="#ffffff" />
+ </shape>
+ </item>
+
+ <!-- 杩涘害鏉� -->
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <solid android:color="#4393ea" />
+ </shape>
+ </clip>
+ </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/drawable/app_icon.png b/Project/yj_sdk/src/main/res/drawable/app_icon.png
new file mode 100644
index 0000000..9f03b9d
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable/app_icon.png
Binary files differ
diff --git a/Project/yj_sdk/src/main/res/drawable/web_btn_close_icon.png b/Project/yj_sdk/src/main/res/drawable/web_btn_close_icon.png
new file mode 100644
index 0000000..7ac8e4d
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/drawable/web_btn_close_icon.png
Binary files differ
diff --git a/Project/yj_sdk/src/main/res/layout/activity_main.xml b/Project/yj_sdk/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..4bf1374
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/layout/activity_main.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/main_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <FrameLayout
+ android:id="@+id/unity_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <WebView
+ android:id="@+id/webView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:visibility="invisible" />
+
+ <Button
+ android:id="@+id/webView_btn_close"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBottom="@id/webView"
+ android:layout_alignRight="@id/webView"
+ android:background="@drawable/web_btn_close_icon"
+ android:text="鎴戠煡閬撲簡"
+ android:textSize="16dp"
+ android:visibility="invisible" />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/layout/jpush_popwin_layout.xml b/Project/yj_sdk/src/main/res/layout/jpush_popwin_layout.xml
new file mode 100644
index 0000000..f43e478
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/layout/jpush_popwin_layout.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/popLayoutId"
+ style="@style/MyDialogStyle"
+ android:orientation="vertical"
+ android:layout_width="280dp"
+ android:layout_height="250dp" >
+
+ <WebView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/wvPopwin"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/layout/jpush_webview_layout.xml b/Project/yj_sdk/src/main/res/layout/jpush_webview_layout.xml
new file mode 100644
index 0000000..bebdd61
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/layout/jpush_webview_layout.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<cn.jpush.android.ui.FullScreenView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/actionbarLayoutId"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <RelativeLayout
+ android:id="@+id/rlRichpushTitleBar"
+ android:layout_width="match_parent"
+ android:layout_height="40.0dp"
+ android:background="#29313a">
+
+ <ImageButton
+ android:id="@+id/imgRichpushBtnBack"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="9dp"
+ android:layout_marginRight="10dp"
+ android:background="@drawable/jpush_richpush_btn_selector" />
+
+ <ImageView
+ android:id="@+id/imgView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_toRightOf="@id/imgRichpushBtnBack"
+ android:clickable="false"
+ android:src="@drawable/jpush_ic_richpush_actionbar_divider" />
+
+ <TextView
+ android:id="@+id/tvRichpushTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="7dp"
+ android:layout_marginRight="5dp"
+ android:layout_toRightOf="@id/imgView"
+ android:clickable="false"
+ android:text=" "
+ android:textSize="20sp"
+ android:textColor="#ffffff" />
+ </RelativeLayout>
+
+ <ProgressBar
+ android:id="@+id/pushPrograssBar"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:progress="0"
+ android:progressDrawable="@drawable/jpush_richpush_progressbar"
+ style="?android:attr/progressBarStyleHorizontal" />
+ <WebView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/fullWebView"
+ android:background="#000000" />
+
+</cn.jpush.android.ui.FullScreenView>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/values/colors.xml b/Project/yj_sdk/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+</resources>
diff --git a/Project/yj_sdk/src/main/res/values/jpush_style.xml b/Project/yj_sdk/src/main/res/values/jpush_style.xml
new file mode 100644
index 0000000..81dfdbb
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/values/jpush_style.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="MyDialogStyle">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowFrame">@null</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowIsFloating">true</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/Project/yj_sdk/src/main/res/values/strings.xml b/Project/yj_sdk/src/main/res/values/strings.xml
new file mode 100644
index 0000000..0f462ac
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+<resources>
+ <string name="app_name">UniveralSDK</string>
+ <string name="sf_class_name">com.secondworld.univeralsdk.MainActivity</string>
+</resources>
diff --git a/Project/yj_sdk/src/main/res/values/styles.xml b/Project/yj_sdk/src/main/res/values/styles.xml
new file mode 100644
index 0000000..ff6c9d2
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
diff --git a/Project/yj_sdk/src/main/res/xml/file_paths.xml b/Project/yj_sdk/src/main/res/xml/file_paths.xml
new file mode 100644
index 0000000..517ede7
--- /dev/null
+++ b/Project/yj_sdk/src/main/res/xml/file_paths.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<paths>
+ <external-path path="Android/data/com.shandangceshi.snxxz/" name="files_root" />
+ <external-path path="." name="external_storage_root" />
+</paths>
\ No newline at end of file
--
Gitblit v1.8.0