Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b899ede62a | ||
![]() |
26154b3c57 | ||
![]() |
068a80cb83 | ||
![]() |
7ec2cacaac | ||
![]() |
0b4a20b506 | ||
![]() |
10027cdcac | ||
![]() |
86e7543a00 | ||
![]() |
a5eed53e33 | ||
![]() |
970b4e8ad8 | ||
![]() |
f8c016c722 |
@ -10,5 +10,5 @@ key pass: 7654321Kingsome_
|
|||||||
vivo key alias: vivo
|
vivo key alias: vivo
|
||||||
oppo key alias: oppo
|
oppo key alias: oppo
|
||||||
xiaomi key alias: release
|
xiaomi key alias: release
|
||||||
|
uc key alias: uc
|
||||||
```
|
```
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 26
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.hnjc.wjtx.mi"
|
applicationId "com.hnjc.wjtx.aligames"
|
||||||
minSdkVersion 18
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 26
|
||||||
versionCode 1
|
versionCode 8
|
||||||
versionName "1.0.0"
|
versionName "1.0.8"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
}
|
}
|
||||||
@ -27,16 +27,19 @@ android {
|
|||||||
debug.setRoot('build-types/debug')
|
debug.setRoot('build-types/debug')
|
||||||
release.setRoot('build-types/release')
|
release.setRoot('build-types/release')
|
||||||
}
|
}
|
||||||
buildToolsVersion '28.0.3'
|
buildToolsVersion '26.0.3'
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
useLibrary 'org.apache.http.legacy'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||||
implementation 'com.android.volley:volley:1.1.1'
|
implementation 'com.android.volley:volley:1.1.1'
|
||||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||||
|
implementation 'com.jakewharton:butterknife:8.2.1'
|
||||||
|
annotationProcessor('com.jakewharton:butterknife-compiler:8.2.1')
|
||||||
}
|
}
|
||||||
|
BIN
app/libs/alipaySdk-15.6.4-20190611174341.aar
Normal file
BIN
app/libs/alipaySdk-15.6.4-20190611174341.aar
Normal file
Binary file not shown.
BIN
app/libs/net-sdk-9.2.4.4.aar
Normal file
BIN
app/libs/net-sdk-9.2.4.4.aar
Normal file
Binary file not shown.
BIN
app/libs/ugpsdk-net-7.6.3.1.aar
Normal file
BIN
app/libs/ugpsdk-net-7.6.3.1.aar
Normal file
Binary file not shown.
114
app/proguard-rules.pro
vendored
114
app/proguard-rules.pro
vendored
@ -1,90 +1,34 @@
|
|||||||
-keepattributes InnerClasses,Signature,Exceptions,Deprecated,*Annotation*
|
-printmapping 'mapping.txt'
|
||||||
|
# this is very dangerous that cause bug
|
||||||
|
-ignorewarnings
|
||||||
|
|
||||||
|
-dontskipnonpubliclibraryclassmembers
|
||||||
|
-dontshrink
|
||||||
|
-dontoptimize
|
||||||
|
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * extends cn.gundam.sdk.shell.even.SDKEventReceiver
|
||||||
|
|
||||||
|
-keep class cn.uc.**{
|
||||||
|
<methods>;
|
||||||
|
<fields>;
|
||||||
|
}
|
||||||
|
-keep class cn.gundam.**{
|
||||||
|
<methods>;
|
||||||
|
<fields>;
|
||||||
|
}
|
||||||
|
-keep class android.**{
|
||||||
|
<methods>;
|
||||||
|
<fields>;
|
||||||
|
}
|
||||||
|
-keep class org.json.**{
|
||||||
|
<methods>;
|
||||||
|
<fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-dontwarn android.**
|
-keep class com.hnjc.wjtx.aligames.** { *; }
|
||||||
-dontwarn com.google.**
|
-dontwarn com.hnjc.wjtx.aligams.**
|
||||||
-keep class android.** {*;}
|
|
||||||
-keep class com.google.** {*;}
|
|
||||||
-keep class com.android.** {*;}
|
|
||||||
-dontwarn org.apache.**
|
|
||||||
-keep class org.apache.** { *; }
|
|
||||||
-keep class sun.misc.Unsafe { *; }
|
|
||||||
-keep class com.google.** {*;}
|
|
||||||
|
|
||||||
-keep public class android.arch.core.internal.FastSafeIterableMap
|
|
||||||
-keep public class android.arch.core.util.Function
|
|
||||||
-keep public class android.arch.lifecycle.Lifecycle
|
|
||||||
-keep public class android.arch.lifecycle.Observer
|
|
||||||
-keep public class android.arch.lifecycle.ReportFragment
|
|
||||||
-keep public class android.arch.lifecycle.ViewModel
|
|
||||||
-keep public class android.support.v4.app.Fragment
|
|
||||||
-keep public class android.support.annotation.AnimatorRes
|
|
||||||
-keep public class android.support.v4.app.ActivityCompat
|
|
||||||
-keep public class android.support.design.widget.CoordinatorLayout
|
|
||||||
-keep public class android.support.v4.app.AppLaunchChecker
|
|
||||||
-keep public class android.support.v4.app.BackStackState
|
|
||||||
|
|
||||||
#-libraryjars libs/alipaySdk.jar
|
|
||||||
-dontwarn com.alipay.**
|
|
||||||
-keep class com.alipay.** {*;}
|
|
||||||
-keep class com.ut.device.** {*;}
|
|
||||||
-keep class com.ta.utdid2.** {*;}
|
|
||||||
|
|
||||||
#-libraryjars libs/eventbus-3.jar
|
|
||||||
-keep class org.greenrobot.eventbus.** { *; }
|
|
||||||
-keep class de.greenrobot.event.** { *; }
|
|
||||||
-keep class de.greenrobot.dao.** {*;}
|
|
||||||
|
|
||||||
-keepclassmembers class ** {
|
|
||||||
public void onEvent*(**);
|
|
||||||
void onEvent*(**);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keepclassmembers class ** {
|
|
||||||
@org.greenrobot.eventbus.Subscribe <methods>;
|
|
||||||
}
|
|
||||||
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
|
|
||||||
# Only required if you use AsyncExecutor
|
|
||||||
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
|
|
||||||
<init>(java.lang.Throwable);
|
|
||||||
}
|
|
||||||
#-libraryjars libs/wechat.jar
|
|
||||||
-keep class com.tencent.** {*;}
|
|
||||||
|
|
||||||
#-libraryjars libs/glide.jar
|
|
||||||
-keep class com.bumptech.glide.** {*;}
|
|
||||||
|
|
||||||
-dontwarn com.xiaomi.**
|
|
||||||
-keep class com.xiaomi.** {*;}
|
|
||||||
-keep class com.mi.** {*;}
|
|
||||||
-keep class com.wali.** {*;}
|
|
||||||
-keep class cn.com.wali.** {*;}
|
|
||||||
-keep class miui.net.**{*;}
|
|
||||||
-keep class org.xiaomi.** {*;}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#保留位于View类中的get和set方法
|
|
||||||
-keepclassmembers public class * extends android.view.View{
|
|
||||||
void set*(***);
|
|
||||||
*** get*();
|
|
||||||
}
|
|
||||||
#保留在Activity中以View为参数的方法不变
|
|
||||||
-keepclassmembers class * extends android.app.Activity{
|
|
||||||
public void *(android.view.View);
|
|
||||||
}
|
|
||||||
#保留实现了Parcelable的类名不变,
|
|
||||||
-keep class * implements android.os.Parcelable{
|
|
||||||
public static final android.os.Parcelable$Creator *;
|
|
||||||
}
|
|
||||||
#保留R$*类中静态成员的变量名
|
|
||||||
-keep class **.R$* {*;}
|
|
||||||
|
|
||||||
-dontwarn android.support.**
|
|
||||||
-keep class **.R$styleable{*;}
|
|
||||||
|
|
||||||
-keep class com.hnjc.wjtx.mi.** { *; }
|
|
||||||
-dontwarn com.hnjc.wjtx.mi.**
|
|
||||||
|
|
||||||
|
|
||||||
-keep class org.egret.** { *; }
|
-keep class org.egret.** { *; }
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.hnjc.wjtx">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.hnjc.wjtx.aligames">
|
||||||
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
@ -10,9 +12,17 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<supports-screens
|
||||||
|
android:anyDensity="true"
|
||||||
|
android:largeScreens="true"
|
||||||
|
android:normalScreens="true"
|
||||||
|
android:resizeable="true"
|
||||||
|
android:smallScreens="true" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
tools:replace="android:allowBackup"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
android:name=".JCApplication"
|
android:name=".JCApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
@ -38,19 +48,45 @@
|
|||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
<!-- 增加app拉起相关cn.uc.gamesdk.activity.PullupActivity的声明 -->
|
||||||
|
<activity
|
||||||
|
android:name="cn.uc.gamesdk.activity.PullupActivity"
|
||||||
|
android:theme="@android:style/Theme.Translucent"
|
||||||
|
android:taskAffinity="com.hnjc.wjtx.aligames.diff"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:label="PullupActivity"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:exported="true"
|
||||||
|
tools:node="replace">
|
||||||
|
|
||||||
<!-- <activity android:name=".MainActivity"-->
|
<intent-filter>
|
||||||
<!-- android:launchMode="singleTask"-->
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<!-- android:screenOrientation="portrait"-->
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<!-- android:windowSoftInputMode="adjustPan|stateAlwaysVisible"-->
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<!-- android:configChanges="orientation|keyboardHidden|screenSize|screenLayout"-->
|
<data android:scheme="ng1179479" />
|
||||||
<!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen">-->
|
</intent-filter>
|
||||||
<!-- <intent-filter>-->
|
</activity>
|
||||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
|
||||||
|
<activity
|
||||||
|
android:name="cn.gundam.sdk.shell.activity.ProxyActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
|
android:windowSoftInputMode="adjustResize" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.uc.gamesdk.sdkweb" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- sdk service -->
|
||||||
|
<service
|
||||||
|
android:name="cn.gundam.sdk.shell.service.ProxyService"
|
||||||
|
android:exported="true"
|
||||||
|
android:process=":bgservice" />
|
||||||
|
<!-- sdk service end -->
|
||||||
|
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
|
||||||
<!-- </intent-filter>-->
|
|
||||||
<!-- </activity>-->
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package com.hnjc.wjtx;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class JCApplication extends Application {
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
Log.i("JCApplication", "JCApplication onCreate");
|
|
||||||
}
|
|
||||||
}
|
|
18
app/src/main/java/com/hnjc/wjtx/aligames/JCApplication.java
Normal file
18
app/src/main/java/com/hnjc/wjtx/aligames/JCApplication.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import cn.uc.gamesdk.SDKHelper;
|
||||||
|
|
||||||
|
public class JCApplication extends Application {
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
Log.i("JCApplication", "JCApplication onCreate");
|
||||||
|
if(!SDKHelper.isBackground(this)){
|
||||||
|
//调用super方法
|
||||||
|
super.onCreate();
|
||||||
|
//表示当前为SDK所属的子进程,不应该再执行其他游戏相关的初始化
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx;
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -11,19 +11,30 @@ import android.os.Message;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.hnjc.wjtx.net.DownloadRunnable;
|
import com.hnjc.wjtx.aligames.net.DownloadRunnable;
|
||||||
import com.hnjc.wjtx.net.TaskInfo;
|
import com.hnjc.wjtx.aligames.net.TaskInfo;
|
||||||
import com.hnjc.wjtx.net.WebApi;
|
import com.hnjc.wjtx.aligames.net.WebApi;
|
||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.aligames.util.AssetsUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
import com.hnjc.wjtx.aligames.util.StringUtil;
|
||||||
import com.hnjc.wjtx.util.UnzipRunnable;
|
import com.hnjc.wjtx.aligames.util.UnzipRunnable;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventKey;
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventReceiver;
|
||||||
|
import cn.gundam.sdk.shell.even.Subscribe;
|
||||||
|
import cn.gundam.sdk.shell.exception.AliLackActivityException;
|
||||||
|
import cn.gundam.sdk.shell.open.ParamInfo;
|
||||||
|
import cn.gundam.sdk.shell.open.UCOrientation;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParamKey;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParams;
|
||||||
|
import cn.uc.gamesdk.UCGameSdk;
|
||||||
|
|
||||||
public class LaunchActivity extends Activity {
|
public class LaunchActivity extends Activity {
|
||||||
private final String TAG = "LaunchActivity";
|
private final String TAG = "LaunchActivity";
|
||||||
private final String ZERO_VERSION = "0";
|
private final String ZERO_VERSION = "0";
|
||||||
@ -100,7 +111,35 @@ public class LaunchActivity extends Activity {
|
|||||||
requestPermissions(permissions, 111);
|
requestPermissions(permissions, 111);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compareVersions();
|
ucNetworkAndInitUCGameSDK();
|
||||||
|
UCGameSdk.defaultSdk().registerSDKEventReceiver(receiver);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ucNetworkAndInitUCGameSDK() {
|
||||||
|
//!!!在调用SDK初始化前进行网络检查
|
||||||
|
//当前没有拥有网络
|
||||||
|
ucSdkInit();//执行UCGameSDK初始化
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ucSdkInit() {
|
||||||
|
ParamInfo gameParamInfo = new ParamInfo();
|
||||||
|
|
||||||
|
gameParamInfo.setGameId(UCSdkConfig.gameId);
|
||||||
|
|
||||||
|
gameParamInfo.setOrientation(UCOrientation.PORTRAIT);
|
||||||
|
|
||||||
|
SDKParams sdkParams = new SDKParams();
|
||||||
|
sdkParams.put(SDKParamKey.GAME_PARAMS, gameParamInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
UCGameSdk.defaultSdk().initSdk(this, sdkParams);
|
||||||
|
} catch (AliLackActivityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,7 +182,7 @@ public class LaunchActivity extends Activity {
|
|||||||
*/
|
*/
|
||||||
private void getLocalVersionInfo() {
|
private void getLocalVersionInfo() {
|
||||||
String fileName = gameUrl.replace("index.html", "version.json");
|
String fileName = gameUrl.replace("index.html", "version.json");
|
||||||
String realPath = getFileDirByUrl(fileName);
|
String realPath = preloadPath + "/" + getFileDirByUrl(fileName) + "version.json" ;
|
||||||
File versionFile = new File(realPath);
|
File versionFile = new File(realPath);
|
||||||
if (versionFile.exists()) {
|
if (versionFile.exists()) {
|
||||||
JSONObject data = AssetsUtil.readJsonFromFile(this, realPath);
|
JSONObject data = AssetsUtil.readJsonFromFile(this, realPath);
|
||||||
@ -211,7 +250,7 @@ public class LaunchActivity extends Activity {
|
|||||||
}
|
}
|
||||||
// 更新远程资源
|
// 更新远程资源
|
||||||
private void preloadGame() {
|
private void preloadGame() {
|
||||||
String dir = preloadPath + getFileDirByUrl(gameUrl);
|
String dir = preloadPath + "/" + getFileDirByUrl(gameUrl);
|
||||||
File dirFile = new File(dir);
|
File dirFile = new File(dir);
|
||||||
if (!dirFile.exists()) {
|
if (!dirFile.exists()) {
|
||||||
dirFile.mkdirs();
|
dirFile.mkdirs();
|
||||||
@ -301,6 +340,7 @@ public class LaunchActivity extends Activity {
|
|||||||
handler.removeCallbacksAndMessages(null);
|
handler.removeCallbacksAndMessages(null);
|
||||||
handler = null;
|
handler = null;
|
||||||
}
|
}
|
||||||
|
UCGameSdk.defaultSdk().unregisterSDKEventReceiver(receiver);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -309,5 +349,22 @@ public class LaunchActivity extends Activity {
|
|||||||
// 移除activity的移出场动画
|
// 移除activity的移出场动画
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
ucNetworkAndInitUCGameSDK();
|
||||||
|
}
|
||||||
|
SDKEventReceiver receiver = new SDKEventReceiver() {
|
||||||
|
@Subscribe(event = SDKEventKey.ON_INIT_SUCC)
|
||||||
|
private void onInitSucc() {
|
||||||
|
compareVersions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_INIT_FAILED)
|
||||||
|
private void onInitFailed(String data) {
|
||||||
|
//初始化失败
|
||||||
|
Toast.makeText(LaunchActivity.this, "init failed", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.i(TAG, "UC SDK init failed");
|
||||||
|
ucNetworkAndInitUCGameSDK();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package com.hnjc.wjtx;
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@ -16,15 +15,27 @@ import android.widget.FrameLayout;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.aligames.util.AssetsUtil;
|
||||||
import com.hnjc.wjtx.util.IdUtil;
|
import com.hnjc.wjtx.aligames.util.StorageUtil;
|
||||||
import com.hnjc.wjtx.util.StorageUtil;
|
import com.hnjc.wjtx.aligames.util.StringUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
|
||||||
|
|
||||||
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventKey;
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventReceiver;
|
||||||
|
import cn.gundam.sdk.shell.even.Subscribe;
|
||||||
|
import cn.gundam.sdk.shell.exception.AliLackActivityException;
|
||||||
|
import cn.gundam.sdk.shell.exception.AliNotInitException;
|
||||||
|
import cn.gundam.sdk.shell.open.OrderInfo;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParamKey;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParams;
|
||||||
|
import cn.uc.gamesdk.UCGameSdk;
|
||||||
|
|
||||||
//Android项目发布设置详见doc目录下的README_ANDROID.md
|
//Android项目发布设置详见doc目录下的README_ANDROID.md
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
@ -40,7 +51,7 @@ public class MainActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
||||||
String gameUrl = this.getString(R.string.game_url);
|
|
||||||
|
|
||||||
nativeAndroid = new EgretNativeAndroid(this);
|
nativeAndroid = new EgretNativeAndroid(this);
|
||||||
if (!nativeAndroid.checkGlEsVersion()) {
|
if (!nativeAndroid.checkGlEsVersion()) {
|
||||||
@ -59,7 +70,7 @@ public class MainActivity extends Activity {
|
|||||||
nativeAndroid.config.preloadPath = preloadPath;
|
nativeAndroid.config.preloadPath = preloadPath;
|
||||||
|
|
||||||
setExternalInterfaces();
|
setExternalInterfaces();
|
||||||
|
String gameUrl = this.getString(R.string.game_url);
|
||||||
if (!nativeAndroid.initialize(gameUrl)) {
|
if (!nativeAndroid.initialize(gameUrl)) {
|
||||||
Toast.makeText(this, "Initialize native failed.",
|
Toast.makeText(this, "Initialize native failed.",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
@ -67,8 +78,13 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
setContentView(nativeAndroid.getRootFrameLayout());
|
setContentView(nativeAndroid.getRootFrameLayout());
|
||||||
rootLayout = nativeAndroid.getRootFrameLayout();
|
rootLayout = nativeAndroid.getRootFrameLayout();
|
||||||
|
nativeAndroid.pause();
|
||||||
showLoadingView();
|
showLoadingView();
|
||||||
vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
|
vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
UCGameSdk.defaultSdk().registerSDKEventReceiver(receiver);
|
||||||
|
}
|
||||||
|
public void startGame() {
|
||||||
|
nativeAndroid.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,19 +102,11 @@ public class MainActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
//声明并初始化弹出对象
|
try {
|
||||||
AlertDialog.Builder builder=new AlertDialog.Builder(this);
|
UCGameSdk.defaultSdk().exit(this, null);
|
||||||
builder.setTitle("提示:");
|
} catch (Exception e) {
|
||||||
builder.setMessage("是否退出");
|
e.printStackTrace();
|
||||||
//设置确认按钮
|
}
|
||||||
builder.setNegativeButton("确定", (dialog, which) -> {
|
|
||||||
nativeAndroid.exitGame();
|
|
||||||
finish();//退出程序
|
|
||||||
});
|
|
||||||
//设置取消按钮
|
|
||||||
builder.setPositiveButton("取消",null);
|
|
||||||
//显示弹框
|
|
||||||
builder.show();
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return super.onKeyDown(keyCode, keyEvent);
|
return super.onKeyDown(keyCode, keyEvent);
|
||||||
@ -163,18 +171,7 @@ public class MainActivity extends Activity {
|
|||||||
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("getUid", message -> {
|
nativeAndroid.setExternalInterface("getUid", message -> {
|
||||||
//TODO: 平台的登陆
|
ucSdkLogin();
|
||||||
JSONObject obj = new JSONObject();
|
|
||||||
try {
|
|
||||||
obj.put("openid", IdUtil.getUid(this));
|
|
||||||
obj.put("token", "");
|
|
||||||
// 如果其他登陆过程中的错误, 则传入一个大于0的errorcode
|
|
||||||
obj.put("errorcode", 1);
|
|
||||||
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
nativeAndroid.callExternalInterface("loginCancel", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("@onState", message -> {
|
nativeAndroid.setExternalInterface("@onState", message -> {
|
||||||
@ -192,21 +189,18 @@ public class MainActivity extends Activity {
|
|||||||
nativeAndroid.setExternalInterface("@onError", message -> Log.e(TAG, "Get @onError: " + message));
|
nativeAndroid.setExternalInterface("@onError", message -> Log.e(TAG, "Get @onError: " + message));
|
||||||
// 支付
|
// 支付
|
||||||
nativeAndroid.setExternalInterface("pay", message -> {
|
nativeAndroid.setExternalInterface("pay", message -> {
|
||||||
|
Log.i(TAG, "client pay: " + message);
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(message);
|
JSONObject jsonObject = new JSONObject(message);
|
||||||
String cpOrderId = jsonObject.getString("orderId");
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
String productCode = jsonObject.getString("productCode");
|
paramMap.put(SDKParamKey.CALLBACK_INFO, jsonObject.getString("callbackInfo"));
|
||||||
int count = jsonObject.getInt("count");
|
paramMap.put(SDKParamKey.NOTIFY_URL, jsonObject.getString("notifyUrl"));
|
||||||
//TODO: 平台的支付
|
paramMap.put(SDKParamKey.AMOUNT, jsonObject.getString("amount"));
|
||||||
JSONObject obj = new JSONObject();
|
paramMap.put(SDKParamKey.CP_ORDER_ID, jsonObject.getString("cpOrderId"));
|
||||||
try {
|
paramMap.put(SDKParamKey.ACCOUNT_ID, jsonObject.getString("accountId"));
|
||||||
obj.put("errcode", 0);
|
paramMap.put(SDKParamKey.SIGN, jsonObject.getString("sign"));
|
||||||
obj.put("errmsg", "");
|
paramMap.put(SDKParamKey.SIGN_TYPE, jsonObject.getString("signType"));
|
||||||
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
ucSdkPay(paramMap);
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
@ -230,11 +224,30 @@ public class MainActivity extends Activity {
|
|||||||
*/
|
*/
|
||||||
nativeAndroid.setExternalInterface("reportRoleInfo", message -> {
|
nativeAndroid.setExternalInterface("reportRoleInfo", message -> {
|
||||||
Log.i(TAG, "Get reportRoleInfo: " + message);
|
Log.i(TAG, "Get reportRoleInfo: " + message);
|
||||||
|
try {
|
||||||
|
JSONObject data = new JSONObject(message);
|
||||||
|
SDKParams sdkParams = new SDKParams();
|
||||||
|
sdkParams.put(SDKParamKey.STRING_ROLE_ID, data.getString("userRoleId"));
|
||||||
|
sdkParams.put(SDKParamKey.STRING_ROLE_NAME, data.getString("userRoleName"));
|
||||||
|
sdkParams.put(SDKParamKey.LONG_ROLE_LEVEL, (long) data.getInt("userRoleLevel"));
|
||||||
|
/**
|
||||||
|
*角色创建时间,需要传递当前服务器时间,不可传递设备本地时间,值生成后保持唯一,且角色创建、升级、退出重登三个时机均需传递此参数
|
||||||
|
**/
|
||||||
|
sdkParams.put(SDKParamKey.LONG_ROLE_CTIME, data.getLong("roleCreateTime"));
|
||||||
|
sdkParams.put(SDKParamKey.STRING_ZONE_ID, data.getString("serverId"));
|
||||||
|
sdkParams.put(SDKParamKey.STRING_ZONE_NAME, data.getString("serverName"));
|
||||||
|
UCGameSdk.defaultSdk().submitRoleData(this, sdkParams);
|
||||||
|
// Toast.makeText(MainActivity.this,"submitData = "+sdkParams, Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (AliNotInitException | AliLackActivityException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
UCGameSdk.defaultSdk().unregisterSDKEventReceiver(receiver);
|
||||||
|
receiver = null;
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,4 +279,118 @@ public class MainActivity extends Activity {
|
|||||||
launchScreenImageView = null;
|
launchScreenImageView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void ucSdkLogin() {
|
||||||
|
try {
|
||||||
|
UCGameSdk.defaultSdk().login(this, null);
|
||||||
|
} catch (AliLackActivityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (AliNotInitException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ucSdkPay(Map<String, Object> paramMap) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
SDKParams sdkParams = new SDKParams();
|
||||||
|
sdkParams.putAll(paramMap);
|
||||||
|
|
||||||
|
UCGameSdk.defaultSdk().pay(this, sdkParams);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
// addOutputResult("charge failed - Exception: " + e.toString() + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDKEventReceiver receiver = new SDKEventReceiver() {
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGIN_SUCC)
|
||||||
|
private void onLoginSucc(String sid) {
|
||||||
|
Log.i(TAG, "UC onLoaginSucc: " + sid);
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("openid", sid);
|
||||||
|
obj.put("token", sid);
|
||||||
|
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGIN_FAILED)
|
||||||
|
private void onLoginFailed(String desc) {
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGOUT_SUCC)
|
||||||
|
private void onLogoutSucc() {
|
||||||
|
nativeAndroid.callExternalInterface("loginOut", "");
|
||||||
|
// AccountInfo.instance().setSid("");
|
||||||
|
ucSdkLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGOUT_FAILED)
|
||||||
|
private void onLogoutFailed() {
|
||||||
|
Toast.makeText(MainActivity.this, "logout failed", Toast.LENGTH_SHORT).show();
|
||||||
|
// printMsg("注销失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_EXIT_SUCC)
|
||||||
|
private void onExit(String desc) {
|
||||||
|
nativeAndroid.exitGame();
|
||||||
|
finish();//退出程序
|
||||||
|
|
||||||
|
// // 退出程序
|
||||||
|
// Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
// intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
// startActivity(intent);
|
||||||
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
// printMsg(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_EXIT_CANCELED)
|
||||||
|
private void onExitCanceled(String desc) {
|
||||||
|
// Toast.makeText(MainActivity.this, desc, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_CREATE_ORDER_SUCC)
|
||||||
|
private void onCreateOrderSucc(OrderInfo orderInfo) {
|
||||||
|
if (orderInfo != null) {
|
||||||
|
String txt = orderInfo.getOrderAmount() + "," + orderInfo.getOrderId() + "," + orderInfo.getPayWay();
|
||||||
|
Log.i(TAG, "下单成功: " + txt + "\n");
|
||||||
|
}
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("errcode", 0);
|
||||||
|
obj.put("errmsg", "");
|
||||||
|
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Log.i(TAG, "pay succ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_PAY_USER_EXIT)
|
||||||
|
private void onPayUserExit(OrderInfo orderInfo) {
|
||||||
|
if (orderInfo != null) {
|
||||||
|
String txt = orderInfo.getOrderAmount() + "," + orderInfo.getOrderId() + "," + orderInfo.getPayWay();
|
||||||
|
// addOutputResult("页面关闭,订单信息: " + txt + "\n");
|
||||||
|
}
|
||||||
|
Log.i(TAG, "pay cancel");
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("errcode", 1);
|
||||||
|
obj.put("errmsg", "user cancel");
|
||||||
|
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
14
app/src/main/java/com/hnjc/wjtx/aligames/UCSdkConfig.java
Normal file
14
app/src/main/java/com/hnjc/wjtx/aligames/UCSdkConfig.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
|
public class UCSdkConfig {
|
||||||
|
// 以下参数仅供测试。在正式集成SDK时,需要使用正式的id数据。
|
||||||
|
// 游戏开发人员需要跟自己的商务或运营人员联系获取。
|
||||||
|
|
||||||
|
|
||||||
|
public static final int gameId = 1179479;
|
||||||
|
|
||||||
|
public static final String sign_key = "bf4dcf740ca7cd6f0980e4d8fa7f77b0";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import com.android.volley.AuthFailureError;
|
import com.android.volley.AuthFailureError;
|
||||||
import com.android.volley.NetworkResponse;
|
import com.android.volley.NetworkResponse;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class BaseMode {
|
public class BaseMode {
|
||||||
private boolean status;
|
private boolean status;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class RequestErrorEvent {
|
public class RequestErrorEvent {
|
||||||
private int type;
|
private int type;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class TaskInfo {
|
public class TaskInfo {
|
||||||
private String name;//文件名
|
private String name;//文件名
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class WebApi {
|
|||||||
|
|
||||||
public void getVersionInfo(BaseInterface iFace) {
|
public void getVersionInfo(BaseInterface iFace) {
|
||||||
this.mInterface = iFace;
|
this.mInterface = iFace;
|
||||||
// String versionUrl = "http://10.0.1.3:7021/game/zip/version.json";
|
// String versionUrl = "https://test.kingsome.cn/wjtx/config/version_native.json";
|
||||||
String versionUrl = "https://h5games-al.kingsome.cn/wjtx/config/version_native.json";
|
String versionUrl = "https://h5games-al.kingsome.cn/wjtx/config/version_native.json";
|
||||||
AppRequestUtil.getInstance().getRequest(context, versionUrl, new RequestListener() {
|
AppRequestUtil.getInstance().getRequest(context, versionUrl, new RequestListener() {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
@ -12,6 +12,7 @@ import org.json.JSONObject;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -187,12 +188,15 @@ public class AssetsUtil {
|
|||||||
*/
|
*/
|
||||||
public static String readFromFile(Context context, String path) {
|
public static String readFromFile(Context context, String path) {
|
||||||
try {
|
try {
|
||||||
InputStreamReader inputReader = new InputStreamReader(context.openFileInput(path));
|
FileInputStream fileInputStream = new FileInputStream(new File(path));
|
||||||
|
InputStreamReader inputReader = new InputStreamReader(fileInputStream);
|
||||||
BufferedReader bufReader = new BufferedReader(inputReader);
|
BufferedReader bufReader = new BufferedReader(inputReader);
|
||||||
|
|
||||||
String line="";
|
String line="";
|
||||||
StringBuilder result= new StringBuilder();
|
StringBuilder result= new StringBuilder();
|
||||||
while((line = bufReader.readLine()) != null)
|
while((line = bufReader.readLine()) != null)
|
||||||
result.append(line);
|
result.append(line);
|
||||||
|
fileInputStream.close();
|
||||||
inputReader.close();
|
inputReader.close();
|
||||||
bufReader.close();
|
bufReader.close();
|
||||||
return result.toString();
|
return result.toString();
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -20,7 +20,7 @@ public class IdUtil {
|
|||||||
while (enumeration.hasMoreElements()) {
|
while (enumeration.hasMoreElements()) {
|
||||||
NetworkInterface netInterface = enumeration.nextElement();
|
NetworkInterface netInterface = enumeration.nextElement();
|
||||||
if (netInterface.getName().equals("wlan0")) {
|
if (netInterface.getName().equals("wlan0")) {
|
||||||
return com.hnjc.wjtx.util.StringUtil.getMD5(netInterface.getHardwareAddress().toString(), false);
|
return com.hnjc.wjtx.aligames.util.StringUtil.getMD5(netInterface.getHardwareAddress().toString(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -59,9 +59,9 @@ public class IdUtil {
|
|||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
String wifiMac = getWifiMac();
|
String wifiMac = getWifiMac();
|
||||||
String androidId = getAndroidId(resolver);
|
String androidId = getAndroidId(resolver);
|
||||||
if (com.hnjc.wjtx.util.StringUtil.notBlank(androidId)) {
|
if (com.hnjc.wjtx.aligames.util.StringUtil.notBlank(androidId)) {
|
||||||
return androidId;
|
return androidId;
|
||||||
} else if (com.hnjc.wjtx.util.StringUtil.notBlank(wifiMac)) {
|
} else if (com.hnjc.wjtx.aligames.util.StringUtil.notBlank(wifiMac)) {
|
||||||
return wifiMac;
|
return wifiMac;
|
||||||
} else {
|
} else {
|
||||||
return getUniquePsuedoID();
|
return getUniquePsuedoID();
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.hnjc.wjtx.net.TaskInfo;
|
import com.hnjc.wjtx.aligames.net.TaskInfo;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 1.1 MiB |
@ -3,7 +3,7 @@
|
|||||||
<string name="load_game">下载游戏资源</string>
|
<string name="load_game">下载游戏资源</string>
|
||||||
<string name="start_game">进入游戏</string>
|
<string name="start_game">进入游戏</string>
|
||||||
<string name="preload_path">preload</string>
|
<string name="preload_path">preload</string>
|
||||||
<string name="game_url">http://local/index.html?channel=7103</string>
|
<string name="game_url">http://local/index.html?channel=7110</string>
|
||||||
<string name="local_version">1.0.0</string>
|
<string name="local_version">1.0.0</string>
|
||||||
<string name="load_back">load_back</string>
|
<string name="load_back">load_back</string>
|
||||||
<string name="launch_version">获取游戏版本</string>
|
<string name="launch_version">获取游戏版本</string>
|
||||||
|
@ -15,6 +15,9 @@ buildscript {
|
|||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||||
|
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
|
||||||
|
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,6 @@ org.gradle.jvmargs=-Xmx1536m
|
|||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
android.injected.testOnly=false
|
#android.injected.testOnly=false
|
||||||
android.useAndroidX=true
|
#android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
#android.enableJetifier=true
|
BIN
key/publish_key
BIN
key/publish_key
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user