Browse Source

提交奇境SDK.

trevorHsu 3 years ago
parent
commit
5149abc689
100 changed files with 12851 additions and 2 deletions
  1. 8 2
      .gitignore
  2. 1 0
      app/.gitignore
  3. 38 0
      app/build.gradle
  4. 23 0
      app/proguard-rules.pro
  5. 18 0
      app/release/output-metadata.json
  6. 58 0
      app/src/main/AndroidManifest.xml
  7. 2 0
      app/src/main/assets/YyrhParam1.cnf
  8. 568 0
      app/src/main/java/constant/yysdk/com/main_yy_rh_sdk/MainActivity.java
  9. 34 0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  10. 170 0
      app/src/main/res/drawable/ic_launcher_background.xml
  11. 175 0
      app/src/main/res/layout/activity_main.xml
  12. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  13. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  14. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  15. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  16. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  17. 26 0
      app/src/main/res/values/colors.xml
  18. 6 0
      app/src/main/res/values/strings.xml
  19. 9 0
      app/src/main/res/values/styles.xml
  20. 28 0
      build.gradle
  21. 15 0
      gradle.properties
  22. BIN
      gradle/wrapper/gradle-wrapper.jar
  23. 6 0
      gradle/wrapper/gradle-wrapper.properties
  24. 172 0
      gradlew
  25. 84 0
      gradlew.bat
  26. 1 0
      hnqj/.gitignore
  27. 43 0
      hnqj/build.gradle
  28. 139 0
      hnqj/proguard-rules.pro
  29. 420 0
      hnqj/progurd.pro
  30. 24 0
      hnqj/src/main/AndroidManifest.xml
  31. 5 0
      hnqj/src/main/java/com/yyrh/Version.java
  32. 20 0
      hnqj/src/main/java/com/yyrh/advertisement/AdSdkCallback.java
  33. 122 0
      hnqj/src/main/java/com/yyrh/advertisement/Advertise.java
  34. 56 0
      hnqj/src/main/java/com/yyrh/advertisement/AdvertiseFactory.java
  35. 107 0
      hnqj/src/main/java/com/yyrh/advertisement/AdvertiseManager.java
  36. 194 0
      hnqj/src/main/java/com/yyrh/behavior/ReportLogUtil.java
  37. 19 0
      hnqj/src/main/java/com/yyrh/constant/Constants.java
  38. 161 0
      hnqj/src/main/java/com/yyrh/constant/RoleInfo.java
  39. 86 0
      hnqj/src/main/java/com/yyrh/constant/SDKSettings.java
  40. 49 0
      hnqj/src/main/java/com/yyrh/constant/URLConstants.java
  41. 252 0
      hnqj/src/main/java/com/yyrh/easypermission/EasyPermission.java
  42. 35 0
      hnqj/src/main/java/com/yyrh/easypermission/GrantResult.java
  43. 18 0
      hnqj/src/main/java/com/yyrh/easypermission/NextAction.java
  44. 24 0
      hnqj/src/main/java/com/yyrh/easypermission/NextActionType.java
  45. 88 0
      hnqj/src/main/java/com/yyrh/easypermission/Permission.java
  46. 198 0
      hnqj/src/main/java/com/yyrh/easypermission/PermissionRequestFragment.java
  47. 23 0
      hnqj/src/main/java/com/yyrh/easypermission/PermissionRequestListener.java
  48. 122 0
      hnqj/src/main/java/com/yyrh/easypermission/PermissionSettingPage.java
  49. 87 0
      hnqj/src/main/java/com/yyrh/easypermission/PermissionUtils.java
  50. 19 0
      hnqj/src/main/java/com/yyrh/easypermission/RequestPermissionRationalListener.java
  51. 168 0
      hnqj/src/main/java/com/yyrh/factory/ChannelSdkOperation.java
  52. 64 0
      hnqj/src/main/java/com/yyrh/factory/ISdkOperation.java
  53. 17 0
      hnqj/src/main/java/com/yyrh/factory/SdkFactory.java
  54. 124 0
      hnqj/src/main/java/com/yyrh/factory/SdkManager.java
  55. 120 0
      hnqj/src/main/java/com/yyrh/factory/YyrhSdkOperation.java
  56. 172 0
      hnqj/src/main/java/com/yyrh/imei/ImeiUtil.java
  57. 1065 0
      hnqj/src/main/java/com/yyrh/networking/NetRequestApi.java
  58. 256 0
      hnqj/src/main/java/com/yyrh/networking/urlhttp/CallBackUtil.java
  59. 243 0
      hnqj/src/main/java/com/yyrh/networking/urlhttp/RealRequest.java
  60. 15 0
      hnqj/src/main/java/com/yyrh/networking/urlhttp/RealResponse.java
  61. 244 0
      hnqj/src/main/java/com/yyrh/networking/urlhttp/RequestUtil.java
  62. 254 0
      hnqj/src/main/java/com/yyrh/networking/urlhttp/UrlHttpUtil.java
  63. 117 0
      hnqj/src/main/java/com/yyrh/pay/PaymentNotify.java
  64. 192 0
      hnqj/src/main/java/com/yyrh/pay/WvPayYyrhDialog.java
  65. 539 0
      hnqj/src/main/java/com/yyrh/sdk/SDKEntry.java
  66. 553 0
      hnqj/src/main/java/com/yyrh/sdk/YyrhSdkManager.java
  67. 5 0
      hnqj/src/main/java/com/yyrh/sdk/callback/ExitCallback.java
  68. 10 0
      hnqj/src/main/java/com/yyrh/sdk/callback/InitCallback.java
  69. 7 0
      hnqj/src/main/java/com/yyrh/sdk/callback/LoginCallback.java
  70. 6 0
      hnqj/src/main/java/com/yyrh/sdk/callback/LogoutCallback.java
  71. 5 0
      hnqj/src/main/java/com/yyrh/sdk/callback/OpenFloatViewCallback.java
  72. 6 0
      hnqj/src/main/java/com/yyrh/sdk/callback/PayCallback.java
  73. 11 0
      hnqj/src/main/java/com/yyrh/sdk/callback/PayOrderCallback.java
  74. 5 0
      hnqj/src/main/java/com/yyrh/sdk/callback/RealNameMsgCallback.java
  75. 6 0
      hnqj/src/main/java/com/yyrh/sdk/callback/RegisterCallback.java
  76. 8 0
      hnqj/src/main/java/com/yyrh/sdk/callback/ShowPolicyCallback.java
  77. 10 0
      hnqj/src/main/java/com/yyrh/sdk/callback/UserPolicyCallback.java
  78. 168 0
      hnqj/src/main/java/com/yyrh/ui/AutoLoginDialog.java
  79. 52 0
      hnqj/src/main/java/com/yyrh/ui/BaseDialog.java
  80. 34 0
      hnqj/src/main/java/com/yyrh/ui/ConstantDialog.java
  81. 82 0
      hnqj/src/main/java/com/yyrh/ui/CustomExitGameDialog.java
  82. 200 0
      hnqj/src/main/java/com/yyrh/ui/ForgetPwdLayout.java
  83. 62 0
      hnqj/src/main/java/com/yyrh/ui/GameSplashDialog.java
  84. 271 0
      hnqj/src/main/java/com/yyrh/ui/LoginLayout.java
  85. 41 0
      hnqj/src/main/java/com/yyrh/ui/MarqueTextView.java
  86. 45 0
      hnqj/src/main/java/com/yyrh/ui/PageJsInteraction.java
  87. 294 0
      hnqj/src/main/java/com/yyrh/ui/PhoneRegisterLayout.java
  88. 168 0
      hnqj/src/main/java/com/yyrh/ui/PrivacyPolicyDialog.java
  89. 64 0
      hnqj/src/main/java/com/yyrh/ui/ProgressDialogUtils.java
  90. 209 0
      hnqj/src/main/java/com/yyrh/ui/RegisterLayout.java
  91. 73 0
      hnqj/src/main/java/com/yyrh/ui/SingleButtonDialog.java
  92. 32 0
      hnqj/src/main/java/com/yyrh/ui/activity/BaseActivity.java
  93. 57 0
      hnqj/src/main/java/com/yyrh/ui/activity/UseLoginActivity.java
  94. 391 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/DotImageView.java
  95. 112 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatItem.java
  96. 1036 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatLogoMenu.java
  97. 424 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatMenuView.java
  98. 232 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/WvPageListDialog.java
  99. 771 0
      hnqj/src/main/java/com/yyrh/ui/floatmenu/customfloat/BaseFloatDailog.java
  100. 53 0
      hnqj/src/main/java/com/yyrh/ui/fragment/BaseFragment.java

+ 8 - 2
.gitignore

@@ -1,3 +1,10 @@
+# IDEA
+*.iml
+.gradle
+.idea
+/local.properties
+.DS_Store
+
 # ---> Android
 # Built application files
 *.apk
@@ -30,5 +37,4 @@ proguard/
 .navigation/
 
 # Android Studio captures folder
-captures/
-
+captures/

+ 1 - 0
app/.gitignore

@@ -0,0 +1 @@
+/build

+ 38 - 0
app/build.gradle

@@ -0,0 +1,38 @@
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 28
+    defaultConfig {
+
+        applicationId "com.fx.qyj2.gdtdevp100001.hnqj"
+
+        minSdkVersion 15
+        targetSdkVersion 26
+        versionCode 1
+        versionName "1.0"
+
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+
+    lintOptions {
+        abortOnError false
+        checkReleaseBuilds false
+    }
+
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: '*.jar')
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation  project(':hnqj')
+
+
+
+
+
+}

+ 23 - 0
app/proguard-rules.pro

@@ -0,0 +1,23 @@
+# 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
+
+

+ 18 - 0
app/release/output-metadata.json

@@ -0,0 +1,18 @@
+{
+  "version": 2,
+  "artifactType": {
+    "type": "APK",
+    "kind": "Directory"
+  },
+  "applicationId": "com.fx.qyj2.gdtdevp100001.hnqj",
+  "variantName": "processReleaseResources",
+  "elements": [
+    {
+      "type": "SINGLE",
+      "filters": [],
+      "versionCode": 1,
+      "versionName": "1.0",
+      "outputFile": "app-release.apk"
+    }
+  ]
+}

+ 58 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="constant.yysdk.com.main_yy_rh_sdk">
+
+<!--    landscape -->
+<!--    portrait -->
+    <application
+
+        android:name="com.yythird.sdk.YYRhApplication"
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme">
+        <activity android:name="constant.yysdk.com.main_yy_rh_sdk.MainActivity"
+            android:screenOrientation="landscape"
+            android:launchMode="singleTop"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+
+            >
+
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name="com.yyrh.ui.activity.UseLoginActivity"
+            android:launchMode="singleTop"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:theme="@style/qj_transparent"
+            >
+
+        </activity>
+
+        <!--适配全面屏手机-->
+
+        <meta-data android:name="android.max_aspect"
+
+            android:value="2.1"/>
+
+
+
+        <meta-data
+            android:name="yyrh_game_code"
+            android:value="100001" />
+
+
+
+
+
+    </application>
+
+
+
+
+
+</manifest>

+ 2 - 0
app/src/main/assets/YyrhParam1.cnf

@@ -0,0 +1,2 @@
+GCP_CODE=P010101
+CHANNELTAG=YYRHSDK

+ 568 - 0
app/src/main/java/constant/yysdk/com/main_yy_rh_sdk/MainActivity.java

@@ -0,0 +1,568 @@
+package constant.yysdk.com.main_yy_rh_sdk;
+
+
+
+import android.app.Activity;
+
+
+import android.content.DialogInterface;
+import android.content.Intent;
+
+
+import android.content.res.Configuration;
+import android.net.Uri;
+
+import android.os.Bundle;
+
+
+
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ScrollView;
+import android.widget.Toast;
+
+
+import com.yyrh.advertisement.AdvertiseManager;
+import com.yyrh.constant.RoleInfo;
+
+
+import com.yyrh.easypermission.EasyPermission;
+import com.yyrh.easypermission.GrantResult;
+import com.yyrh.easypermission.Permission;
+import com.yyrh.easypermission.PermissionRequestListener;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+
+import com.yyrh.sdk.callback.ShowPolicyCallback;
+import com.yyrh.sdk.callback.UserPolicyCallback;
+import com.yyrh.ui.AutoLoginDialog;
+import com.yyrh.ui.activity.UseLoginActivity;
+import com.yyrh.utils.InspectSimulator;
+
+
+
+import com.yyrh.constant.Constants;
+
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.callback.ExitCallback;
+import com.yyrh.sdk.callback.InitCallback;
+import com.yyrh.sdk.callback.LoginCallback;
+import com.yyrh.sdk.callback.LogoutCallback;
+import com.yyrh.sdk.callback.PayCallback;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.Utils;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class MainActivity extends Activity implements View.OnClickListener {
+
+    private EditText et_hasgold;
+    private EditText et_money;
+    private EditText et_partyid;
+    private EditText et_partyname;
+    private EditText et_reincarnationrCount;
+    private EditText et_rolectime;
+    private EditText et_roleid;
+    private EditText et_rolelevel;
+    private EditText et_rolename;
+    private EditText et_rolepower;
+    private EditText et_rolesex;
+    private EditText et_serveid;
+    private EditText et_servername;
+    private EditText et_viplevel;
+    private EditText et_charge;
+    private boolean isDebug = true;
+    private Button logOut;
+    private Button login_btn;
+    private Button pay_btn;
+    private Button permission;
+    private SDKEntry sdk;
+    private Button upload_btn;
+    private Button upload_btn1;
+    private Button upload_btn2;
+    private Button userCenter;
+
+
+
+
+    @Override
+    protected void onCreate(final Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+
+        requestWindowFeature(Window.FEATURE_NO_TITLE);
+        //隐藏顶部状态栏
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+        setContentView(R.layout.activity_main);
+
+        ScrollView ll = findViewById(R.id.scl_1);
+
+        this.login_btn = (Button) findViewById(R.id.login_btn);
+        this.upload_btn = (Button) findViewById(R.id.upload_btn);
+        this.upload_btn1 = (Button) findViewById(R.id.upload_btn1);
+        this.upload_btn2 = (Button) findViewById(R.id.upload_btn2);
+        this.pay_btn = (Button) findViewById(R.id.pay_btn);
+        this.logOut = (Button) findViewById(R.id.logout_btn);
+        this.userCenter = (Button) findViewById(R.id.user_btn);
+        this.permission = (Button) findViewById(R.id.permission);
+        this.et_roleid = (EditText) findViewById(R.id.et_roleid);
+        this.et_rolename = (EditText) findViewById(R.id.et_rolename);
+        this.et_rolelevel = (EditText) findViewById(R.id.et_rolelevel);
+        this.et_rolesex = (EditText) findViewById(R.id.et_rolesex);
+        this.et_serveid = (EditText) findViewById(R.id.et_serveid);
+        this.et_servername = (EditText) findViewById(R.id.et_servername);
+        this.et_hasgold = (EditText) findViewById(R.id.et_hasgold);
+        this.et_viplevel = (EditText) findViewById(R.id.et_viplevel);
+        this.et_partyname = (EditText) findViewById(R.id.et_partyname);
+        this.et_partyid = (EditText) findViewById(R.id.et_partyid);
+        this.et_rolectime = (EditText) findViewById(R.id.et_rolectime);
+        this.et_rolepower = (EditText) findViewById(R.id.et_rolepower);
+        this.et_reincarnationrCount = (EditText) findViewById(R.id.et_reincarnationrCount);
+        this.et_money = (EditText) findViewById(R.id.et_money);
+        this.et_charge = findViewById(R.id.et_charge);
+        this.upload_btn.setOnClickListener(this);
+        this.upload_btn1.setOnClickListener(this);
+        this.upload_btn2.setOnClickListener(this);
+        this.pay_btn.setOnClickListener(this);
+        this.logOut.setOnClickListener(this);
+        this.userCenter.setOnClickListener(this);
+        this.permission.setOnClickListener(this);
+        this.login_btn.setOnClickListener(this);
+
+
+
+        sdk = SDKEntry.getSdkInstance();
+        sdk.showPrivacyPolicy(this, new UserPolicyCallback() {
+            @Override
+            public void onAgree() {
+               //用户同意隐私政策,执行初始化相关操作
+                init(savedInstanceState);
+            }
+
+            @Override
+            public void onDisagree() {
+                //用户不用同意隐私政策,游戏方关闭游戏操作
+                finish();
+            }
+
+            @Override
+            public void onHide() {
+                //不需要对用户显示隐私政策内容,直接进入游戏
+                init(savedInstanceState);
+            }
+
+            @Override
+            public void onError() {
+                //接口请求发生错误
+                finish();
+            }
+        });
+
+
+
+
+    }
+
+
+    private void init(Bundle savedInstanceState){
+        //正式上线,需把isDebug 设置为false
+        sdk.initSdk(this, new InitCallback() {
+            @Override
+            public void onInitSuccess(String msg) {
+                Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT)
+                        .show();
+            }
+
+            @Override
+            public void onInitFailed(String msg) {
+                Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT)
+                        .show();
+            }
+
+            @Override
+            public void onInitError(String _strError) {
+                Toast.makeText(MainActivity.this, _strError, Toast.LENGTH_SHORT)
+                        .show();
+            }
+
+            @Override
+            public void onGetOaid(boolean isSuccess, String oaid) {
+
+            }
+        }, true);
+        sdk.sdkOnCreate(this, savedInstanceState);
+        sdk.setSDKLogoutListener(this, new LogoutCallback() {
+            @Override
+            public void onLogoutSuccess() {
+                Toast.makeText(MainActivity.this, "退出成功", Toast.LENGTH_LONG)
+                        .show();
+            }
+
+            @Override
+            public void onLogoutFailed() {
+
+            }
+        });
+
+    }
+
+    @Override
+    public void onClick(View view) {
+        int id = view.getId();
+        if (id == R.id.pay_btn) {
+            HashMap hashMap = new HashMap();
+            String obj = this.et_money.getText().toString();
+            if (judgeStrNull(obj)) {
+                Toast.makeText(this, "输入金额不能为空", 1).show();
+                return;
+            }
+
+
+            int[]  order_split =  new int[] {1, 2, 3};
+
+            hashMap.put("order_split", order_split);
+
+            hashMap.put("role_id", this.et_roleid.getText().toString());
+            hashMap.put("role_name", this.et_rolename.getText().toString());
+            hashMap.put("role_level", this.et_rolelevel.getText().toString());
+            hashMap.put("server_id", this.et_serveid.getText().toString());
+            hashMap.put("server_name", this.et_servername.getText().toString());
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append(System.currentTimeMillis());
+            stringBuilder.append("");
+            hashMap.put("game_no", stringBuilder.toString());
+            hashMap.put("pay_money", obj);
+            hashMap.put("order_desc", "购买10元宝");
+            hashMap.put("order_name", "111");
+            hashMap.put("product_name", "钻石");
+            hashMap.put("productId", "1020122152");
+            hashMap.put("ext", "111");
+            hashMap.put("vip_level", this.et_viplevel.getText().toString());
+            hashMap.put("count", "商品数量");
+            hashMap.put("radio", "商品数量与rmb比例");
+            hashMap.put("reincarnationCount", "0");
+            this.sdk.pay(hashMap, new PayCallback() {
+                public void onPaySuccess(String str) {
+                    Toast.makeText(MainActivity.this, str, 1).show();
+                }
+
+                public void onPayFailed(String str) {
+                    Toast.makeText(MainActivity.this, str, 1).show();
+                }
+            }, this);
+        } else if (id != R.id.permission) {
+            switch (id) {
+                case R.id.login_btn /*2131034177*/:
+                    /**
+                    AutoLoginDialog.Builder builder = new AutoLoginDialog.Builder(this);
+                    builder.setPositiveButton(new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            //取消回调
+                            dialog.dismiss();
+
+
+                        }
+                    }).setCloseDialogCallback(new AutoLoginDialog.CloseDialogCallback(){
+
+                        @Override
+                        public void onclose() {
+
+                        }
+                    });
+
+                    builder.Create().show();
+
+                    Intent intent = new Intent(this, UseLoginActivity.class);
+                    //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                    intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+                    intent.putExtra("isLandscape", Utils.isLandscape(this));
+                    this.startActivity(intent);
+
+                     **/
+                    sdk.login(this, new LoginCallback() {
+                        @Override
+                        public void onLoginSuccess(String token) {
+
+                            Toast.makeText(MainActivity.this, "token:"+token, Toast.LENGTH_LONG).show();
+                        }
+
+                        @Override
+                        public void onLoginFailed(String msg) {
+
+                        }
+
+                        @Override
+                        public void onLoginError(String msg) {
+
+                        }
+                    });
+
+
+                    break;
+                case R.id.logout_btn /*2131034178*/:
+                    String[]  permissions = new String[]{Permission.READ_PHONE_STATE,Permission.WRITE_EXTERNAL_STORAGE};
+                    EasyPermission.with(this)
+                            .addPermissions(permissions)          //申请打电话权限
+                            .request(new PermissionRequestListener() {
+                                @Override
+                                public void onGrant(Map<String, GrantResult> result) {
+                                    //权限申请返回
+
+                                }
+
+                                @Override
+                                public void onCancel(String stopPermission) {
+                                    //在addRequestPermissionRationaleHandler的处理函数里面调用了NextAction.next(NextActionType.STOP,就会中断申请过程,直接回调到这里来
+
+                                }
+                            });
+                    break;
+                default:
+                    RoleInfo roleInfo;
+                    StringBuilder stringBuilder2;
+                    switch (id) {
+                        case R.id.upload_btn /*2131034222*/:
+                            roleInfo = new RoleInfo();
+                            roleInfo.setRoleId(this.et_roleid.getText().toString());
+                            roleInfo.setRoleName(this.et_rolename.getText().toString());
+                            roleInfo.setRoleLevel(this.et_rolelevel.getText().toString());
+                            roleInfo.setGender(this.et_rolesex.getText().toString());
+                            roleInfo.setServerId(this.et_serveid.getText().toString());
+                            roleInfo.setServerName(this.et_servername.getText().toString());
+                            roleInfo.setHasGold(this.et_hasgold.getText().toString());
+                            roleInfo.setVipLevel(this.et_viplevel.getText().toString());
+                            roleInfo.setRolePower(this.et_rolepower.getText().toString());
+                            roleInfo.setPartyName(this.et_partyname.getText().toString());
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setRoleCreateTime(this.et_rolectime.getText().toString());
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setReincarnationCount(this.et_reincarnationrCount.getText().toString());
+                            roleInfo.setCharge(et_charge.getText().toString());
+                            this.sdk.upLoadRoleInfo(Constants.UPLOADTYPE_CREATEROLE, this, roleInfo);
+                            stringBuilder2 = new StringBuilder();
+                            stringBuilder2.append("roleInfo:=");
+                            stringBuilder2.append(roleInfo.getAllParam().toString());
+                            Toast.makeText(this, stringBuilder2.toString(), Toast.LENGTH_LONG).show();
+                            break;
+                        case R.id.upload_btn1 /*2131034223*/:
+                            roleInfo = new RoleInfo();
+                            roleInfo.setRoleId(this.et_roleid.getText().toString());
+                            roleInfo.setRoleName(this.et_rolename.getText().toString());
+                            roleInfo.setRoleLevel(this.et_rolelevel.getText().toString());
+                            roleInfo.setGender(this.et_rolesex.getText().toString());
+                            roleInfo.setServerId(this.et_serveid.getText().toString());
+                            roleInfo.setServerName(this.et_servername.getText().toString());
+                            roleInfo.setHasGold(this.et_hasgold.getText().toString());
+                            roleInfo.setVipLevel(this.et_viplevel.getText().toString());
+                            roleInfo.setRolePower("7653471597");
+                            Integer i  = Integer.valueOf(roleInfo.getRolePower()).intValue();
+                            Log.i("",i+"");
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setPartyName(this.et_partyname.getText().toString());
+                            roleInfo.setRoleCreateTime(this.et_rolectime.getText().toString());
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setReincarnationCount(this.et_reincarnationrCount.getText().toString());
+                            roleInfo.setCharge(et_charge.getText().toString());
+                            this.sdk.upLoadRoleInfo(Constants.UPLOADTYPE_ENTERGAME, this, roleInfo);
+                            stringBuilder2 = new StringBuilder();
+                            stringBuilder2.append("roleInfo:=");
+                            stringBuilder2.append(roleInfo.getAllParam().toString());
+                            Toast.makeText(this, stringBuilder2.toString(), Toast.LENGTH_LONG).show();
+                            break;
+                        case R.id.upload_btn2 /*2131034224*/:
+                            roleInfo = new RoleInfo();
+                            roleInfo.setRoleId(this.et_roleid.getText().toString());
+                            roleInfo.setRoleName(this.et_rolename.getText().toString());
+                            roleInfo.setRoleLevel(this.et_rolelevel.getText().toString());
+                            roleInfo.setGender(this.et_rolesex.getText().toString());
+                            roleInfo.setServerId(this.et_serveid.getText().toString());
+                            roleInfo.setServerName(this.et_servername.getText().toString());
+                            roleInfo.setHasGold(this.et_hasgold.getText().toString());
+                            roleInfo.setVipLevel(this.et_viplevel.getText().toString());
+                            roleInfo.setRolePower(this.et_rolepower.getText().toString());
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setPartyName(this.et_partyname.getText().toString());
+                            roleInfo.setRoleCreateTime(this.et_rolectime.getText().toString());
+                            roleInfo.setPartyId(this.et_partyid.getText().toString());
+                            roleInfo.setReincarnationCount(this.et_reincarnationrCount.getText().toString());
+                            roleInfo.setCharge(et_charge.getText().toString());
+                            this.sdk.upLoadRoleInfo(Constants.UPLOADTYPE_LEVELUP, this, roleInfo);
+                            stringBuilder2 = new StringBuilder();
+                            stringBuilder2.append("roleInfo:=");
+                            stringBuilder2.append(roleInfo.getAllParam().toString());
+                            Toast.makeText(this, stringBuilder2.toString(), Toast.LENGTH_LONG).show();
+                            break;
+                        case R.id.user_btn /*2131034225*/:
+                            this.sdk.getRealNameInfo(this, new RealNameMsgCallback() {
+                                public void onLoadRealNameMsg(boolean z, String str) {
+                                    if (z) {
+                                        Toast.makeText(MainActivity.this, str, Toast.LENGTH_LONG).show();
+                                    } else {
+                                        Toast.makeText(MainActivity.this, str, Toast.LENGTH_LONG).show();
+                                    }
+                                }
+                            });
+                            break;
+                    }
+                    break;
+            }
+        } else {
+            Toast.makeText(this, String.format("%010d", new Object[]{Long.valueOf(System.currentTimeMillis() / 1000)}), Toast.LENGTH_LONG).show();
+        }
+
+    }
+
+
+
+    // 发送消息给Unity
+    private void SendToUnity(String msg) {
+
+
+    }
+    public void binaryToDecimal2(int n){
+        String str = "";
+        while(n!=0){
+            str = n%2+str;
+            n = n/2;
+        }
+        System.out.println(str);
+    }
+
+    public void binaryToDecimal(int n){
+        for(int i = 31;i >= 0; i--)
+            System.out.print(n >>> i & 1);
+    }
+
+    @Override
+    protected void onStart() {
+        // TODO Auto-generated method stub
+        sdk.sdkOnStart(MainActivity.this);
+
+        super.onStart();
+    }
+
+    @Override
+    protected void onStop() {
+        // TODO Auto-generated method stub
+        sdk.sdkOnStop(MainActivity.this);
+        super.onStop();
+    }
+
+    @Override
+    protected void onResume() {
+        // TODO Auto-generated method stub
+        super.onResume();
+        sdk.sdkOnResume(MainActivity.this);
+    }
+
+    @Override
+    protected void onDestroy() {
+        // TODO Auto-generated method stub
+        sdk.sdkOnDestroy(MainActivity.this);
+        super.onDestroy();
+    }
+
+    @Override
+    protected void onPause() {
+        // TODO Auto-generated method stub
+        super.onPause();
+        sdk.sdkOnPause(MainActivity.this);
+    }
+
+    @Override
+    protected void onRestart() {
+        super.onRestart();
+        sdk.sdkOnRestart(MainActivity.this);
+    }
+
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        // TODO Auto-generated method stub
+        super.onActivityResult(requestCode, resultCode, data);
+        sdk.onActivityResult(this, requestCode, resultCode, data);
+
+    }
+
+    @Override
+    public void onBackPressed() {
+        // TODO Auto-generated method stub
+        sdk.exitGame(MainActivity.this, new ExitCallback() {
+
+            @Override
+            public void onExit(boolean needExit) {
+                // TODO Auto-generated method stub
+                if (needExit) {
+//                    System.exit(0);
+                    finish();
+                }
+            }
+
+
+        });
+
+    }
+
+
+
+
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        // TODO Auto-generated method stub
+        super.onConfigurationChanged(newConfig);
+        sdk.onConfigurationChanged(newConfig);
+    }
+
+    @Override
+    public void onWindowFocusChanged(boolean hasFocus) {
+        super.onWindowFocusChanged(hasFocus);
+        sdk.onWindowFocusChanged(this, hasFocus);
+    }
+
+    @Override
+    protected void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        sdk.sdkOnNewIntent(this, intent);
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        sdk.onRequestPermissionsResult(requestCode,permissions,grantResults);
+
+    }
+
+
+
+
+    public void callPhone(String phoneNum) {
+        String url = "tel:" + "123456";
+        Intent intent = new Intent();
+        intent.setData(Uri.parse(url));
+        intent.setAction(Intent.ACTION_DIAL);
+        // 是否可以处理跳转到拨号的 Intent
+        boolean canResolveIntent = intent.resolveActivity(this.getPackageManager()) != null;
+
+        Log.i("canResolveIntent",canResolveIntent + "");
+    }
+
+
+    public static boolean judgeStrNull(String str) {
+        return str == null || str.equals("");
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+    }
+
+}

+ 34 - 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml

@@ -0,0 +1,34 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:aapt="http://schemas.android.com/aapt"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillType="evenOdd"
+        android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000">
+        <aapt:attr name="android:fillColor">
+            <gradient
+                android:endX="78.5885"
+                android:endY="90.9159"
+                android:startX="48.7653"
+                android:startY="61.0927"
+                android:type="linear">
+                <item
+                    android:color="#44000000"
+                    android:offset="0.0" />
+                <item
+                    android:color="#00000000"
+                    android:offset="1.0" />
+            </gradient>
+        </aapt:attr>
+    </path>
+    <path
+        android:fillColor="#FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000" />
+</vector>

+ 170 - 0
app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#008577"
+        android:pathData="M0,0h108v108h-108z" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M9,0L9,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,0L19,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,0L29,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,0L39,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,0L49,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,0L59,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,0L69,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,0L79,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M89,0L89,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M99,0L99,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,9L108,9"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,19L108,19"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,29L108,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,39L108,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,49L108,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,59L108,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,69L108,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,79L108,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,89L108,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,99L108,99"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,29L89,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,39L89,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,49L89,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,59L89,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,69L89,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,79L89,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,19L29,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,19L39,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,19L49,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,19L59,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,19L69,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,19L79,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+</vector>

+ 175 - 0
app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:id="@+id/scl_1"
+
+    >
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+
+    android:orientation="vertical">
+
+        <Button
+            android:id="@+id/login_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="登陆"/>
+
+        <EditText
+            android:id="@+id/et_roleid"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入角色ID"
+            android:text="120000"
+                />
+        <EditText
+            android:id="@+id/et_rolename"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入角色名称"
+            android:text="角德玛"
+            />
+        <EditText
+            android:id="@+id/et_rolelevel"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入角色等级"
+            android:text="110"
+            />
+        <EditText
+            android:id="@+id/et_rolesex"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入角色性别"
+            android:text="男"
+            />
+        <EditText
+            android:id="@+id/et_serveid"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入服务器id"
+            android:text="1"
+            />
+        <EditText
+            android:id="@+id/et_servername"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入服务器名称"
+            android:text="1服"
+        />
+        <EditText
+            android:id="@+id/et_hasgold"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入剩余元宝"
+            android:text="100"
+            />
+        <EditText
+            android:id="@+id/et_viplevel"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入vip等级"
+            android:text="5"
+            />
+        <EditText
+            android:id="@+id/et_partyname"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入帮派名称"
+            android:text="青帮"
+            />
+        <EditText
+            android:id="@+id/et_rolepower"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入战斗力"
+            android:text="100000"
+            />
+        <EditText
+            android:id="@+id/et_partyid"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入帮派id"
+            android:text="1200"
+            />
+        <EditText
+            android:id="@+id/et_rolectime"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入角色创建时间"
+            android:text="1604044240"
+            />
+        <EditText
+            android:id="@+id/et_reincarnationrCount"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入转生次数"
+            android:text="2"
+            />
+
+        <EditText
+            android:id="@+id/et_charge"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入累充金额"
+            android:text="10"
+            />
+
+        <Button
+            android:id="@+id/upload_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="上传角色信息(创建角色)"/>
+        <Button
+            android:id="@+id/upload_btn1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="上传角色信息(进入游戏)"/>
+        <Button
+            android:id="@+id/upload_btn2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="上传角色信息(角色升级)"/>
+
+        <EditText
+            android:id="@+id/et_money"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入支付金额"
+            />
+        <Button
+            android:id="@+id/pay_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="支付"/>
+        <Button
+            android:id="@+id/user_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="实名认证"/>
+
+        <Button
+            android:id="@+id/logout_btn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="LogOut"/>
+        <Button
+            android:id="@+id/permission"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="request_permission"/>
+
+
+
+    </LinearLayout>
+</ScrollView>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


+ 26 - 0
app/src/main/res/values/colors.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#008577</color>
+    <color name="colorPrimaryDark">#00574B</color>
+    <color name="colorAccent">#D81B60</color>
+
+
+
+
+    <!-- yy color start -->
+
+
+
+    <color name="yyrh_font_lightblack">#3D3D3D</color>
+
+    <color name="yyrh_deepgrey">#DBDBDB</color>
+
+    <color name="yyrh_red">#cc021b</color>
+
+    <color name="yyrh_white">#FFFFFF</color>
+
+    <color name="yyrh_deepyellow">#FFA800</color>
+
+    <color name="yyrh_white_90">#E6FFFFFF</color>
+    <!--  yy color end -->
+</resources>

+ 6 - 0
app/src/main/res/values/strings.xml

@@ -0,0 +1,6 @@
+<resources>
+
+    <string name="app_name">海南奇境SDK</string>
+
+
+</resources>

+ 9 - 0
app/src/main/res/values/styles.xml

@@ -0,0 +1,9 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="android:Theme.Light">
+        <!-- Customize your theme here. -->
+
+    </style>
+
+</resources>

+ 28 - 0
build.gradle

@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    
+    repositories {
+        google()
+        jcenter()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:4.1.1'
+        
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+
+}
+
+allprojects {
+    repositories {
+        google()
+        jcenter()
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}

+ 15 - 0
gradle.properties

@@ -0,0 +1,15 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+android.injected.testOnly=false
+

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
+#Wed Dec 23 16:56:58 CST 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

+ 172 - 0
gradlew

@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"

+ 84 - 0
gradlew.bat

@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 1 - 0
hnqj/.gitignore

@@ -0,0 +1 @@
+/build

+ 43 - 0
hnqj/build.gradle

@@ -0,0 +1,43 @@
+apply plugin: 'com.android.library'
+android {
+    compileSdkVersion 28
+
+
+
+    defaultConfig {
+        minSdkVersion 15
+        targetSdkVersion 26
+        versionCode 1
+        versionName "1.0"
+
+
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled true
+            shrinkResources false
+            proguardFiles 'proguard-rules.pro'
+        }
+    }
+
+
+
+    dependencies {
+        implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+
+    }
+
+}
+android.libraryVariants.all { variant ->
+    variant.outputs.all {
+        outputFileName = 'yyxxrh_n-release-2.2.0_debug.aar'
+    }
+}
+
+
+dependencies {
+    implementation 'com.android.support:support-v4:28.0.0'
+
+}

+ 139 - 0
hnqj/proguard-rules.pro

@@ -0,0 +1,139 @@
+# 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
+
+# 代码混淆压缩比,在0~7之间,默认为5,一般不做修改
+-optimizationpasses 5
+# 混合时不使用大小写混合,混合后的类名为小写
+-dontusemixedcaseclassnames
+# 指定不去忽略非公共库的类
+-dontskipnonpubliclibraryclasses
+-dontoptimize
+# 这句话能够使我们的项目混淆后产生映射文件
+# 包含有类名->混淆后类名的映射关系
+-verbose
+-ignorewarnings
+# 指定不去忽略非公共库的类成员
+-dontskipnonpubliclibraryclassmembers
+# 指定混淆是采用的算法,后面的参数是一个过滤器
+# 这个过滤器是谷歌推荐的算法,一般不做更改
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+# 保留java与js交互注解
+-keepattributes *Annotation*
+-keepattributes *JavascriptInterface*
+
+# 保留内部类
+-keepattributes Exceptions,InnerClasses
+
+# 保留泛型
+-keepattributes Signature
+
+-keepnames class * implements java.io.Serializable
+-keepclassmembers class * implements java.io.Serializable {
+   static final long serialVersionUID;
+   private static final java.io.ObjectStreamField[] serialPersistentFields;
+   !static !transient <fields>;
+   private void writeObject(java.io.ObjectOutputStream);
+   private void readObject(java.io.ObjectInputStream);
+   java.lang.Object writeReplace();
+   java.lang.Object readResolve();
+}
+
+-keepclassmembers class **.R$* {
+    public static <fields>;
+}
+-keep class **.R$* {
+ *;
+}
+
+-keep public class * extends android.app.Activity{
+	public <fields>;
+	public <methods>;
+}
+-keep public class * extends android.app.Application{
+	public <fields>;
+	public <methods>;
+}
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keepclasseswithmembers class * {
+	public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+	public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclasseswithmembernames class *{
+	native <methods>;
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
+
+
+-keep class **JNI* {*;}
+
+-keep class com.yyrh.sdk.SDKEntry {
+    public <fields>;
+    public <methods>;
+}
+
+-keep class com.yyrh.sdk.callback.* {
+    public <fields>;
+    public <methods>;
+}
+
+-keep class com.yyrh.constant.Constants {
+    public <fields>;
+    public <methods>;
+    }
+-keep class com.yyrh.constant.RoleInfo {
+    public <fields>;
+    public <methods>;
+    }
+
+-keep class com.yyrh.behavior.ReportLogUtil {
+        public <fields>;
+        public <methods>;
+    }
+
+
+-keep class com.yythird.base.* { public <fields>;public <methods>; }
+-keep class com.yythird.sdk.* { public <fields>;public <methods>; }
+
+
+-keep class com.yyrh.advertisement.* {*; }
+-keep class com.yyrh.Version{*;}
+
+-keep class com.yyrh.ui.PageJsInteraction{public <fields>; public <methods>;}

+ 420 - 0
hnqj/progurd.pro

@@ -0,0 +1,420 @@
+#-injars E:\921\finish\921sdk_v1.2.1.jar
+#-outjars E:\921\finish\success\921sdk_v1.2.1.jar
+
+#-libraryjars '/mnt/0001D02E000A26ED/android/jdk/jdk1.8.0_151/jre/lib/rt.jar'
+#-libraryjars '/mnt/0001D02E000A26ED/android/sdk/android-sdk-linux/platforms/android-20/android.jar'
+
+
+
+
+
+-ignorewarnings                # 抑制警告
+
+#-libraryjars jar\classes.jar
+
+
+# ----------------------------------
+#   混淆时不会产生形形色色的类名 
+#   -dontusemixedcaseclassnames
+# ----------------------------------
+-dontusemixedcaseclassnames
+# ----------------------------------
+#      指定不去忽略非公共的库类
+#  -dontskipnonpubliclibraryclasses
+# ----------------------------------
+-dontskipnonpubliclibraryclasses
+
+# ----------------------------------
+#       不预校验
+#    -dontpreverify
+# ----------------------------------
+-dontpreverify
+
+# ----------------------------------
+#      输出生成信息
+#       -verbose
+# ----------------------------------
+-verbose
+
+#混淆时应用侵入式重载 
+-overloadaggressively 
+ 
+#优化时允许访问并修改有修饰符的类和类的成员 
+-allowaccessmodification
+#确定统一的混淆类的成员名称来增加混淆 
+-useuniqueclassmembernames
+
+-dontwarn com.ninswmix.sdk.**
+-dontwarn com.ninswmix.login.**
+-dontwarn com.ninswmix.pay.**
+-dontwarn com.android.volley.**
+-dontwarn com.ninswmix.util.**
+-dontwarn com.ninswmix.common.utils.**
+-dontwarn com.ninswmix.service.**
+-dontwarn com.ninswmix.**
+-dontwarn android.support.**
+
+
+
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.webkit.WebView
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+
+
+
+
+-renamesourcefileattribute SourceFile
+-keepattributes Exceptions,InnerClasses,Signature,SourceFile,LineNumberTable,*Annotation*
+
+
+# Keep - Applications. Keep all application classes, along with their 'main'
+# methods.
+-keepattributes *Annotation*
+-keepattributes *JavascriptInterface*
+-keepclasseswithmembers public class * {
+    public static void main(java.lang.String[]);
+}
+
+
+-keep class **.R$* {   
+*;   
+}
+-keep class **.R$* {*;}
+
+# Also keep - Enumerations. Keep the special static methods that are required in
+# enumeration classes.
+-keepclassmembers enum  * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
+-keep class * extends java.sql.Driver
+
+
+
+# Keep names - Native method names. Keep all native class/method names.
+-keepclasseswithmembers,allowshrinking class * {
+    native <methods>;
+}
+
+
+
+
+
+
+-keep class * implements android.os.IInterface {*;}
+
+
+-keepclassmembers class **.R$* {
+  public static <fields>;
+}
+
+# ---------保护所有实体中的字段名称----------
+-keepclassmembers class * implements java.io.Serializable {
+    <fields>;
+}
+-keepclassmembers class * implements android.os.Parcel {
+    <fields>;
+}
+
+# --------- 保护类中的所有方法名 ------------  
+-keepclassmembers class * {  
+    public <methods>; 
+}
+
+-keep public class * extends android.view.View {
+    public <init>(android.content.Context);
+    public <init>(android.content.Context, android.util.AttributeSet);
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+    public void set*(...);
+}
+# Remove - System method calls. Remove all invocations of System
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.System {
+    public static long currentTimeMillis();
+    static java.lang.Class getCallerClass();
+    public static int identityHashCode(java.lang.Object);
+    public static java.lang.SecurityManager getSecurityManager();
+    public static java.util.Properties getProperties();
+    public static java.lang.String getProperty(java.lang.String);
+    public static java.lang.String getenv(java.lang.String);
+    public static java.lang.String mapLibraryName(java.lang.String);
+    public static java.lang.String getProperty(java.lang.String,java.lang.String);
+}
+
+# Remove - Math method calls. Remove all invocations of Math
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.Math {
+    public static double sin(double);
+    public static double cos(double);
+    public static double tan(double);
+    public static double asin(double);
+    public static double acos(double);
+    public static double atan(double);
+    public static double toRadians(double);
+    public static double toDegrees(double);
+    public static double exp(double);
+    public static double log(double);
+    public static double log10(double);
+    public static double sqrt(double);
+    public static double cbrt(double);
+    public static double IEEEremainder(double,double);
+    public static double ceil(double);
+    public static double floor(double);
+    public static double rint(double);
+    public static double atan2(double,double);
+    public static double pow(double,double);
+    public static int round(float);
+    public static long round(double);
+    public static double random();
+    public static int abs(int);
+    public static long abs(long);
+    public static float abs(float);
+    public static double abs(double);
+    public static int max(int,int);
+    public static long max(long,long);
+    public static float max(float,float);
+    public static double max(double,double);
+    public static int min(int,int);
+    public static long min(long,long);
+    public static float min(float,float);
+    public static double min(double,double);
+    public static double ulp(double);
+    public static float ulp(float);
+    public static double signum(double);
+    public static float signum(float);
+    public static double sinh(double);
+    public static double cosh(double);
+    public static double tanh(double);
+    public static double hypot(double,double);
+    public static double expm1(double);
+    public static double log1p(double);
+}
+
+# Remove - Number method calls. Remove all invocations of Number
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.* extends java.lang.Number {
+    public static java.lang.String toString(byte);
+    public static java.lang.Byte valueOf(byte);
+    public static byte parseByte(java.lang.String);
+    public static byte parseByte(java.lang.String,int);
+    public static java.lang.Byte valueOf(java.lang.String,int);
+    public static java.lang.Byte valueOf(java.lang.String);
+    public static java.lang.Byte decode(java.lang.String);
+    public int compareTo(java.lang.Byte);
+    public static java.lang.String toString(short);
+    public static short parseShort(java.lang.String);
+    public static short parseShort(java.lang.String,int);
+    public static java.lang.Short valueOf(java.lang.String,int);
+    public static java.lang.Short valueOf(java.lang.String);
+    public static java.lang.Short valueOf(short);
+    public static java.lang.Short decode(java.lang.String);
+    public static short reverseBytes(short);
+    public int compareTo(java.lang.Short);
+    public static java.lang.String toString(int,int);
+    public static java.lang.String toHexString(int);
+    public static java.lang.String toOctalString(int);
+    public static java.lang.String toBinaryString(int);
+    public static java.lang.String toString(int);
+    public static int parseInt(java.lang.String,int);
+    public static int parseInt(java.lang.String);
+    public static java.lang.Integer valueOf(java.lang.String,int);
+    public static java.lang.Integer valueOf(java.lang.String);
+    public static java.lang.Integer valueOf(int);
+    public static java.lang.Integer getInteger(java.lang.String);
+    public static java.lang.Integer getInteger(java.lang.String,int);
+    public static java.lang.Integer getInteger(java.lang.String,java.lang.Integer);
+    public static java.lang.Integer decode(java.lang.String);
+    public static int highestOneBit(int);
+    public static int lowestOneBit(int);
+    public static int numberOfLeadingZeros(int);
+    public static int numberOfTrailingZeros(int);
+    public static int bitCount(int);
+    public static int rotateLeft(int,int);
+    public static int rotateRight(int,int);
+    public static int reverse(int);
+    public static int signum(int);
+    public static int reverseBytes(int);
+    public int compareTo(java.lang.Integer);
+    public static java.lang.String toString(long,int);
+    public static java.lang.String toHexString(long);
+    public static java.lang.String toOctalString(long);
+    public static java.lang.String toBinaryString(long);
+    public static java.lang.String toString(long);
+    public static long parseLong(java.lang.String,int);
+    public static long parseLong(java.lang.String);
+    public static java.lang.Long valueOf(java.lang.String,int);
+    public static java.lang.Long valueOf(java.lang.String);
+    public static java.lang.Long valueOf(long);
+    public static java.lang.Long decode(java.lang.String);
+    public static java.lang.Long getLong(java.lang.String);
+    public static java.lang.Long getLong(java.lang.String,long);
+    public static java.lang.Long getLong(java.lang.String,java.lang.Long);
+    public static long highestOneBit(long);
+    public static long lowestOneBit(long);
+    public static int numberOfLeadingZeros(long);
+    public static int numberOfTrailingZeros(long);
+    public static int bitCount(long);
+    public static long rotateLeft(long,int);
+    public static long rotateRight(long,int);
+    public static long reverse(long);
+    public static int signum(long);
+    public static long reverseBytes(long);
+    public int compareTo(java.lang.Long);
+    public static java.lang.String toString(float);
+    public static java.lang.String toHexString(float);
+    public static java.lang.Float valueOf(java.lang.String);
+    public static java.lang.Float valueOf(float);
+    public static float parseFloat(java.lang.String);
+    public static boolean isNaN(float);
+    public static boolean isInfinite(float);
+    public static int floatToIntBits(float);
+    public static int floatToRawIntBits(float);
+    public static float intBitsToFloat(int);
+    public static int compare(float,float);
+    public boolean isNaN();
+    public boolean isInfinite();
+    public int compareTo(java.lang.Float);
+    public static java.lang.String toString(double);
+    public static java.lang.String toHexString(double);
+    public static java.lang.Double valueOf(java.lang.String);
+    public static java.lang.Double valueOf(double);
+    public static double parseDouble(java.lang.String);
+    public static boolean isNaN(double);
+    public static boolean isInfinite(double);
+    public static long doubleToLongBits(double);
+    public static long doubleToRawLongBits(double);
+    public static double longBitsToDouble(long);
+    public static int compare(double,double);
+    public boolean isNaN();
+    public boolean isInfinite();
+    public int compareTo(java.lang.Double);
+    public <init>(byte);
+    public <init>(short);
+    public <init>(int);
+    public <init>(long);
+    public <init>(float);
+    public <init>(double);
+    public <init>(java.lang.String);
+    public byte byteValue();
+    public short shortValue();
+    public int intValue();
+    public long longValue();
+    public float floatValue();
+    public double doubleValue();
+    public int compareTo(java.lang.Object);
+    public boolean equals(java.lang.Object);
+    public int hashCode();
+    public java.lang.String toString();
+}
+
+# Remove - String method calls. Remove all invocations of String
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.String {
+    public <init>();
+    public <init>(byte[]);
+    public <init>(byte[],int);
+    public <init>(byte[],int,int);
+    public <init>(byte[],int,int,int);
+    public <init>(byte[],int,int,java.lang.String);
+    public <init>(byte[],java.lang.String);
+    public <init>(char[]);
+    public <init>(char[],int,int);
+    public <init>(java.lang.String);
+    public <init>(java.lang.StringBuffer);
+    public static java.lang.String copyValueOf(char[]);
+    public static java.lang.String copyValueOf(char[],int,int);
+    public static java.lang.String valueOf(boolean);
+    public static java.lang.String valueOf(char);
+    public static java.lang.String valueOf(char[]);
+    public static java.lang.String valueOf(char[],int,int);
+    public static java.lang.String valueOf(double);
+    public static java.lang.String valueOf(float);
+    public static java.lang.String valueOf(int);
+    public static java.lang.String valueOf(java.lang.Object);
+    public static java.lang.String valueOf(long);
+    public boolean contentEquals(java.lang.StringBuffer);
+    public boolean endsWith(java.lang.String);
+    public boolean equalsIgnoreCase(java.lang.String);
+    public boolean equals(java.lang.Object);
+    public boolean matches(java.lang.String);
+    public boolean regionMatches(boolean,int,java.lang.String,int,int);
+    public boolean regionMatches(int,java.lang.String,int,int);
+    public boolean startsWith(java.lang.String);
+    public boolean startsWith(java.lang.String,int);
+    public byte[] getBytes();
+    public byte[] getBytes(java.lang.String);
+    public char charAt(int);
+    public char[] toCharArray();
+    public int compareToIgnoreCase(java.lang.String);
+    public int compareTo(java.lang.Object);
+    public int compareTo(java.lang.String);
+    public int hashCode();
+    public int indexOf(int);
+    public int indexOf(int,int);
+    public int indexOf(java.lang.String);
+    public int indexOf(java.lang.String,int);
+    public int lastIndexOf(int);
+    public int lastIndexOf(int,int);
+    public int lastIndexOf(java.lang.String);
+    public int lastIndexOf(java.lang.String,int);
+    public int length();
+    public java.lang.CharSequence subSequence(int,int);
+    public java.lang.String concat(java.lang.String);
+    public java.lang.String replaceAll(java.lang.String,java.lang.String);
+    public java.lang.String replace(char,char);
+    public java.lang.String replaceFirst(java.lang.String,java.lang.String);
+    public java.lang.String[] split(java.lang.String);
+    public java.lang.String[] split(java.lang.String,int);
+    public java.lang.String substring(int);
+    public java.lang.String substring(int,int);
+    public java.lang.String toLowerCase();
+    public java.lang.String toLowerCase(java.util.Locale);
+    public java.lang.String toString();
+    public java.lang.String toUpperCase();
+    public java.lang.String toUpperCase(java.util.Locale);
+    public java.lang.String trim();
+}
+
+# Remove - StringBuffer method calls. Remove all invocations of StringBuffer
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.StringBuffer {
+    public <init>();
+    public <init>(int);
+    public <init>(java.lang.String);
+    public <init>(java.lang.CharSequence);
+    public java.lang.String toString();
+    public char charAt(int);
+    public int capacity();
+    public int codePointAt(int);
+    public int codePointBefore(int);
+    public int indexOf(java.lang.String,int);
+    public int lastIndexOf(java.lang.String);
+    public int lastIndexOf(java.lang.String,int);
+    public int length();
+    public java.lang.String substring(int);
+    public java.lang.String substring(int,int);
+}
+
+# Remove - StringBuilder method calls. Remove all invocations of StringBuilder
+# methods without side effects whose return values are not used.
+-assumenosideeffects public class java.lang.StringBuilder {
+    public <init>();
+    public <init>(int);
+    public <init>(java.lang.String);
+    public <init>(java.lang.CharSequence);
+    public java.lang.String toString();
+    public char charAt(int);
+    public int capacity();
+    public int codePointAt(int);
+    public int codePointBefore(int);
+    public int indexOf(java.lang.String,int);
+    public int lastIndexOf(java.lang.String);
+    public int lastIndexOf(java.lang.String,int);
+    public int length();
+    public java.lang.String substring(int);
+    public java.lang.String substring(int,int);
+}

+ 24 - 0
hnqj/src/main/AndroidManifest.xml

@@ -0,0 +1,24 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="constant.yysdk.com.yyxxrh" >
+    <!--yyrh permmission begin -->
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+    <uses-permission android:name="android.permission.BLUETOOTH"/>
+    <!--yyrh permmission end-->
+    <supports-screens
+        android:resizeableActivity="true"
+        android:anyDensity="true"
+        android:largeScreens="true"
+        android:normalScreens="true"
+        android:smallScreens="true" />
+    <application
+        >
+
+    </application>
+    </manifest>
+

+ 5 - 0
hnqj/src/main/java/com/yyrh/Version.java

@@ -0,0 +1,5 @@
+package com.yyrh;
+
+public class Version {
+    public static final String VERSION_NAME = "2.2.0";
+}

+ 20 - 0
hnqj/src/main/java/com/yyrh/advertisement/AdSdkCallback.java

@@ -0,0 +1,20 @@
+package com.yyrh.advertisement;
+
+import android.app.Activity;
+
+import com.yyrh.constant.RoleInfo;
+
+import java.util.HashMap;
+
+public interface AdSdkCallback {
+     void onRegisterSuccess(String msg);
+     void onLoginSuccess(String msg);
+     void onPaySuccess(HashMap<String, Object> map);
+     void onCreateOrder(HashMap<String, Object> map);
+     void onUpLoadRoleInfo(String type, RoleInfo roleInfo);
+     void onResume(Activity activity);
+     void onPause(Activity activity);
+     void onDestory(Activity activity);
+     void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults);
+     void onExitGame(Activity activity);
+}

+ 122 - 0
hnqj/src/main/java/com/yyrh/advertisement/Advertise.java

@@ -0,0 +1,122 @@
+package com.yyrh.advertisement;
+
+import android.app.Activity;
+import android.app.Application;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.util.Log;
+
+import com.yyrh.constant.RoleInfo;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+
+
+public class Advertise {
+
+    public void advertiseInitInApplication(Application application) {
+    }
+
+    public void advertiseInit(Activity activity) {
+    }
+
+    public void login(Activity activity,String account) {
+    }
+
+    public void active(Activity activity) {
+    }
+
+    public void registration(Activity activity,String account) {
+    }
+
+    public void callPayment(Activity activity, HashMap<String, Object> info) {
+    }
+
+    public void paymentFinish(Activity activity, HashMap<String, Object> info) {
+    }
+    public void uploadRoleInfo(Activity activity,String type,  RoleInfo roleInfo) {
+
+    }
+    public void onResume(Activity activity) {
+
+    }
+
+    public void onPause(Activity activity) {
+    }
+    public void onDestory(Activity activity) {
+    }
+    public void onExitGame(Activity activity) {
+    }
+    public Advertise() {
+    }
+
+    public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
+    }
+
+    public static String GetApplicationMetaData(Context context, String metaName) {
+        Object metaData = "";
+
+        if (null == metaName || metaName.isEmpty()) {
+
+            return "";
+        }
+        try {
+            ApplicationInfo info = context.getPackageManager()
+                    .getApplicationInfo(context.getPackageName(),
+                            PackageManager.GET_META_DATA);
+            metaData = info.metaData.get(metaName);
+            // 是否有引用
+            if (null != metaData && metaData.toString().contains("ref=")) {
+                String newMetaName = metaData.toString().split("=")[1];
+                metaData = GetApplicationMetaData(context, newMetaName);
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+
+        }
+        if (null == metaData) {
+            metaData = "";
+        }
+        return metaData.toString();
+    }
+
+    public static String getParamFromCnfByName(Context context, String name) {
+        String value = "";
+
+        InputStream input_stream = null;
+        try {
+            input_stream = context.getAssets().open("YyrhAdParam.cnf");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        InputStreamReader inputStreamReader = new InputStreamReader(
+                input_stream);
+
+        BufferedReader reader = new BufferedReader(inputStreamReader);
+
+        String tempString = null;
+
+        try {
+            while ((tempString = reader.readLine()) != null) {
+
+                if (tempString.contains(name)) {
+
+                    value = tempString.substring(tempString.indexOf("=") + 1,
+                            tempString.length());
+                    break;
+                }
+            }
+            reader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return value;
+
+    }
+
+}

+ 56 - 0
hnqj/src/main/java/com/yyrh/advertisement/AdvertiseFactory.java

@@ -0,0 +1,56 @@
+package com.yyrh.advertisement;
+
+import android.content.Context;
+
+
+
+import com.yyrh.utils.Utils;
+
+
+import java.lang.reflect.Constructor;
+
+
+
+
+public class AdvertiseFactory {
+
+
+
+
+    private AdvertiseFactory(){}
+
+
+
+    public static Advertise GetAdvertise(Context context) {
+
+        return AdvertiseFactory.GetAdvertise(context, "YyrhAdParam.cnf");
+    }
+
+    public static Advertise GetAdvertise(Context context, String adParamPath) {
+        String adClassName = Utils.getParamCnfValuebyKey(context, adParamPath, "CLASSNAME");
+        if (adClassName == null || adClassName.equals("")) {
+            return null;
+
+        }
+
+        Advertise advertise = null;
+        try {
+            Class clz = Class.forName(adClassName);
+            Constructor constructor = clz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            advertise = (Advertise)clz.newInstance();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        }
+
+        return advertise;
+    }
+
+
+}

+ 107 - 0
hnqj/src/main/java/com/yyrh/advertisement/AdvertiseManager.java

@@ -0,0 +1,107 @@
+package com.yyrh.advertisement;
+
+import android.app.Activity;
+import android.app.Application;
+import android.content.Context;
+
+import com.yyrh.constant.RoleInfo;
+
+import java.util.HashMap;
+
+
+public class AdvertiseManager {
+
+    private static AdvertiseManager manager = null;
+
+    private Advertise advertise;
+
+    private AdvertiseManager(Context context) {
+        advertise = AdvertiseFactory.GetAdvertise(context);
+    }
+
+    public static AdvertiseManager defaultManager(Context context) {
+        if (manager == null) {
+            synchronized (AdvertiseManager.class) {
+                if (manager == null) {
+                    manager = new AdvertiseManager(context);
+                }
+            }
+        }
+        return manager;
+    }
+
+    public void advertiseInitInApplication(Application application) {
+        if (advertise != null)
+            advertise.advertiseInitInApplication(application);
+    }
+
+    public void advertiseInit(Activity activity) {
+        if (advertise != null)
+            advertise.advertiseInit(activity);
+    }
+
+    public void login(Activity activity,String account) {
+        if (advertise != null) {
+            advertise.login(activity,account);
+        }
+    }
+
+    public void active(Activity activity) {
+        if (advertise != null) {
+            advertise.active(activity);
+        }
+    }
+    public void upLoadRoleInfo(Activity activity,String type, RoleInfo roleInfo){
+        if (advertise != null) {
+            advertise.uploadRoleInfo(activity,type,roleInfo);
+        }
+    }
+    public void registration(Activity activity,String account) {
+        if (advertise != null) {
+            advertise.registration(activity,account);
+        }
+    }
+
+    public void callPayment(Activity activity, HashMap<String, Object> info) {
+        if (advertise != null) {
+            advertise.callPayment(activity, info);
+        }
+    }
+
+    public void paymentFinish(Activity activity, HashMap<String, Object> info) {
+        if (advertise != null) {
+            advertise.paymentFinish(activity, info);
+        }
+    }
+
+    public void onResume(Activity activity) {
+        if (advertise != null) {
+            advertise.onResume(activity);
+        }
+    }
+
+    public void onPause(Activity activity) {
+        if (advertise != null) {
+            advertise.onPause(activity);
+        }
+    }
+
+    public void onDestory(Activity activity) {
+        if (advertise != null) {
+            advertise.onDestory(activity);
+        }
+    }
+
+    public void onExitGame(Activity activity){
+        if (advertise != null) {
+            advertise.onExitGame(activity);
+        }
+    }
+
+    public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
+        if (advertise != null) {
+            advertise.onRequestPermissionsResult(requestCode,permissions,grantResults);
+        }
+    }
+
+}

+ 194 - 0
hnqj/src/main/java/com/yyrh/behavior/ReportLogUtil.java

@@ -0,0 +1,194 @@
+package com.yyrh.behavior;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.networking.urlhttp.CallBackUtil;
+import com.yyrh.networking.urlhttp.UrlHttpUtil;
+import com.yyrh.utils.SignUtils;
+import com.yyrh.utils.YYLog;
+
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+import static com.yyrh.constant.URLConstants.ACTION_LOG_URL;
+
+import static com.yyrh.constant.URLConstants.SDK_AD_LOG;
+import static com.yyrh.constant.URLConstants.SDK_ERROR_LOG;
+import static com.yyrh.constant.URLConstants.SDK_LOG;
+
+public class ReportLogUtil {
+
+
+    public static void reportNormalLog(String action,String reqName,String reqParam){
+
+
+
+        String timestamp = System.currentTimeMillis()/1000  + "";
+
+
+
+
+        JSONObject json = new JSONObject();
+        try {
+            json.put("action",action);
+            json.put("cs_ver",SDKSettings.SDK_VERSION);
+            json.put("device_model",SDKSettings.device_model);
+            json.put("device_ver",SDKSettings.version);
+
+            json.put("game_code",SDKSettings.game_code);
+            json.put("gcp_code",SDKSettings.gcp_code);
+            json.put("ifa",SDKSettings.imei);
+            json.put("log_type",SDK_LOG);
+
+            json.put("package_name",SDKSettings.package_name);
+            json.put("req_name",reqName);
+            json.put("req_param",reqParam);
+            json.put("system",SDKSettings.system);
+
+            json.put("timestamp",timestamp);
+
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        String sign = SignUtils.sdkLogParamSign(timestamp,json.toString());
+
+
+
+        String url =  ACTION_LOG_URL + "timestamp="  + timestamp +"&sign="+sign;
+
+
+
+        UrlHttpUtil.postJson(url,json.toString(), new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+                YYLog.i(response);
+            }
+        });
+    }
+
+    public static void reportErrorLog(String action,String reqName,String reqParam){
+
+        String timestamp = System.currentTimeMillis()/1000  + "";
+
+
+
+
+        JSONObject json = new JSONObject();
+        try {
+            json.put("action",action);
+            json.put("cs_ver",SDKSettings.SDK_VERSION);
+            json.put("device_model",SDKSettings.device_model);
+            json.put("device_ver",SDKSettings.version);
+
+            json.put("game_code",SDKSettings.game_code);
+            json.put("gcp_code",SDKSettings.gcp_code);
+            json.put("ifa",SDKSettings.imei);
+            json.put("log_type",SDK_ERROR_LOG);
+
+            json.put("package_name",SDKSettings.package_name);
+            json.put("req_name",reqName);
+            json.put("req_param",reqParam);
+            json.put("system",SDKSettings.system);
+
+            json.put("timestamp",timestamp);
+
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        String sign = SignUtils.sdkLogParamSign(timestamp,json.toString());
+
+
+
+        String url =  ACTION_LOG_URL + "timestamp="  + timestamp +"&sign="+sign;
+
+
+
+
+
+
+
+        UrlHttpUtil.postJson(url,json.toString(), new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+                YYLog.i(response);
+            }
+        });
+    }
+
+    public static void reportAdLog(String action,String adParam){
+
+
+
+        String timestamp = System.currentTimeMillis()/1000  + "";
+
+
+
+
+        JSONObject json = new JSONObject();
+        try {
+            json.put("action",action);
+            json.put("ad_param",adParam);
+            json.put("cs_ver",SDKSettings.SDK_VERSION);
+            json.put("device_model",SDKSettings.device_model);
+            json.put("device_ver",SDKSettings.version);
+
+            json.put("game_code",SDKSettings.game_code);
+            json.put("gcp_code",SDKSettings.gcp_code);
+            json.put("ifa",SDKSettings.imei);
+            json.put("log_type",SDK_AD_LOG);
+
+            json.put("package_name",SDKSettings.package_name);
+
+            json.put("system",SDKSettings.system);
+
+            json.put("timestamp",timestamp);
+
+            json.put("yyrh_sp_code",SDKSettings.sp_code);
+
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        String sign = SignUtils.sdkLogParamSign(timestamp,json.toString());
+
+
+
+        String url =  ACTION_LOG_URL + "timestamp="  + timestamp +"&sign="+sign;
+
+
+
+
+
+        UrlHttpUtil.postJson(url,json.toString(), new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+                YYLog.i(response);
+            }
+        });
+
+
+    }
+
+
+}

+ 19 - 0
hnqj/src/main/java/com/yyrh/constant/Constants.java

@@ -0,0 +1,19 @@
+package com.yyrh.constant;
+
+public class Constants {
+
+    public static final String UPLOADTYPE_CREATEROLE = "UPLOADTYPE_CREATEROLE";					//创建角色
+    public static final String UPLOADTYPE_ENTERGAME = "UPLOADTYPE_ENTERGAME";
+    public static final String UPLOADTYPE_LEVELUP = "UPLOADTYPE_LEVELUP";
+
+
+    public static final String LOGIN = "LOGIN";
+
+    public static final String LOGOUT = "LOGOUT";
+
+
+
+
+
+
+}

+ 161 - 0
hnqj/src/main/java/com/yyrh/constant/RoleInfo.java

@@ -0,0 +1,161 @@
+package com.yyrh.constant;
+
+public class RoleInfo {
+    private String roleId;
+    private String roleName;
+    private String roleLevel;
+    private String gender;
+    private String serverId;
+    private String serverName;
+    private String hasGold;
+    private String vipLevel;
+    private String rolePower;
+    private String partyId;
+
+    public String getAllParam(){
+        return "roleId:"+getRoleId()+"--roleName:"+getRoleName()+"--roleLevel:"+getRoleLevel()
+                +"--gender:"+getGender()+"--serverId:"+getServerId()+"--serverName:"+getServerName()
+                +"--hasGold:"+getHasGold()+"--vipLevel:"+getVipLevel()+"--rolePower:"+getRolePower()
+                +"--partyId:"+getPartyId()+"--partyName:"+getPartyName()+"--roleCreateTime:"+getRoleCreateTime()
+                +"--reincarnationCount:"+getReincarnationCount() + "----charge:" + getCharge() +
+                "----profession:" + getProfession() + "----roleExt:" + getRoleExt();
+    }
+    public String getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public String getRoleLevel() {
+        return roleLevel;
+    }
+
+    public void setRoleLevel(String roleLevel) {
+        this.roleLevel = roleLevel;
+    }
+
+    public String getGender() {
+        return gender;
+    }
+
+    public void setGender(String gender) {
+        this.gender = gender;
+    }
+
+    public String getServerId() {
+        return serverId;
+    }
+
+    public void setServerId(String serverId) {
+        this.serverId = serverId;
+    }
+
+    public String getServerName() {
+        return serverName;
+    }
+
+    public void setServerName(String serverName) {
+        this.serverName = serverName;
+    }
+
+    public String getHasGold() {
+        return hasGold;
+    }
+
+    public void setHasGold(String hasGold) {
+        this.hasGold = hasGold;
+    }
+
+    public String getVipLevel() {
+        return vipLevel;
+    }
+
+    public void setVipLevel(String vipLevel) {
+        this.vipLevel = vipLevel;
+    }
+
+    public String getRolePower() {
+        return rolePower;
+    }
+
+    public void setRolePower(String rolePower) {
+        this.rolePower = rolePower;
+    }
+
+    public String getPartyId() {
+        return partyId;
+    }
+
+    public void setPartyId(String partyId) {
+        this.partyId = partyId;
+    }
+
+    public String getPartyName() {
+        return partyName;
+    }
+
+    public void setPartyName(String partyName) {
+        this.partyName = partyName;
+    }
+
+    public String getRoleCreateTime() {
+        return roleCreateTime;
+    }
+
+    public void setRoleCreateTime(String roleCreateTime) {
+        this.roleCreateTime = roleCreateTime;
+    }
+
+    public String getReincarnationCount() {
+        return reincarnationCount;
+    }
+
+    public void setReincarnationCount(String reincarnationCount) {
+        this.reincarnationCount = reincarnationCount;
+    }
+
+    private String partyName;
+    private String roleCreateTime;
+    private String  reincarnationCount;
+
+    private String charge;
+
+    private String profession;
+
+    private String roleExt;
+
+    public String getCharge() {
+        return charge;
+    }
+
+    public void setCharge(String charge) {
+        this.charge = charge;
+    }
+
+    public String getProfession() {
+        return profession;
+    }
+
+    public void setProfession(String profession) {
+        this.profession = profession;
+    }
+
+
+    public String getRoleExt() {
+        return roleExt;
+    }
+
+    public void setRoleExt(String roleExt) {
+        this.roleExt = roleExt;
+    }
+}

+ 86 - 0
hnqj/src/main/java/com/yyrh/constant/SDKSettings.java

@@ -0,0 +1,86 @@
+package com.yyrh.constant;
+
+import android.app.Activity;
+import android.content.Context;
+
+import com.yyrh.utils.Utils;
+import com.yythird.sdk.ChannelSDK;
+
+public class SDKSettings {
+    public static String game_code;                // AndroidManifest.xml中配置的游戏id
+    public static String gcp_code;
+    public static String order_ext;
+
+    public static String imei = "";                    // 手机串号
+    public static String ifa_type = "0";
+    public static String android_id;
+
+    public static String version;                // 手机当前版本号
+
+    public static String versionName;        // 版本号
+
+
+    public static String sp_code;
+    public static String device_model;
+    public static String channelTag = "";
+    public static String package_name = "";
+
+    public static String isSimulator = "0";
+
+    public static boolean isDebug = false;        // debug模式配置
+    public static String system = "android";
+    public static String SDK_VERSION = "2.2.0";
+
+
+    public static String UNAME = "";
+    public static String CHANNELUID = "";
+    public static String USER_BIRTHDAY = "";
+
+    public static int orderReqCount = 0;
+    public static String LOGINTAG = Constants.LOGIN;
+    public static boolean isThirdLogin = true; //启用第3方登录
+    public static boolean isThirdPay = true; //启用第3方登录
+    public static String UserCentUrl = ""; //用户中心功能
+    public static boolean isLandscape = true; //用户中心功能
+
+    public static boolean isOpenRealName = false;
+
+    public static boolean isOpenFloatView = false;
+
+    public static boolean isVefityRealName = true;
+
+    public static boolean isForceRealName = false;
+
+    public static String o_cfg = "";
+
+
+    public static void initSetting(Context context) {
+
+
+        game_code = Utils.GetApplicationMetaData(context, "yyrh_game_code");
+        order_ext = Utils.GetApplicationMetaData(context, "yyrh_order_ext");
+
+        gcp_code = Utils.getParamCnfValuebyKey(context, "YyrhParam.cnf",
+                "GCP_CODE");
+
+        channelTag = Utils.getParamCnfValuebyKey(context, "YyrhParam.cnf",
+                "CHANNELTAG");
+
+
+        sp_code = Utils.GetApplicationMetaData(context, "yyrh_sp_code");
+
+
+        version = Utils.getDeviceVersion();
+
+
+        versionName = Utils.getVersionName(context);
+        device_model = Utils.getDeviceModel();
+        isLandscape = Utils.isLandscape((Activity) context);
+        LOGINTAG = Constants.LOGIN;
+
+        package_name = Utils.getPackageName((Activity) context);
+        android_id = Utils.getAndroidId(context);
+        o_cfg = ChannelSDK.getInstance().SDKGetPkgExt(context);
+    }
+
+}

+ 49 - 0
hnqj/src/main/java/com/yyrh/constant/URLConstants.java

@@ -0,0 +1,49 @@
+package com.yyrh.constant;
+
+public class URLConstants {
+
+//    public static final String BASEURL = "https://sdkapi.yyxxgame.com";
+  public static final String BASEURL = "http://testsdkapi.yyxxgame.com";
+
+
+    //    public static final String BASEURL = "http://49.234.153.160";
+    public static final String  INIT = "/activate";
+
+    public static final String  FASTREGISTER = "/fast_register";
+    public static final String  USERLOGIN = "/user_login";
+    public static final String  UPLOADROLEINFO = "/report_role_info";
+    public static final String  RECHARGEINT = "/recharge_init";
+    public static final String  CHANNELLOGIN = "/channel_login";
+    public static final String  GETCAPTCHA = "/phone_captcha";
+    public static final String  REGISTERWITHPHONE = "/phone_register";
+    public static final String  RESETPWDWITHPHONE = "/phone_reset_pwd";
+    public static final String  REALNAMERECORD = "/user_rn_record";
+    public static final String  QUERYORDER = "/order_query";
+  	public static final String  AGREEMENTINIT = "/agreement_init";
+
+    public static final String  CHANNELZTAG = "YYRHSDK";
+
+
+
+
+    public static final String  USERPOLICYWEB = "/privacy_policy.html?";
+    public static final String  PHONEBINDWEB = "/phone_bind.html?";
+    public static final String  USERCENTERLISTWEB = "/list.html?";
+    public static final String  USERPROTOCOLWEB = "/protocol.html?";
+    public static final String  USERBINDINFO = "/user_info_bind.html?";
+
+
+    public static final String  RSAKEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3eXf1JxdFtx6c8AJTdlSverL8WqRE11yFB6Q+GbQeEVXjSCgQN48qePat7mXbH4LAtjaSEqXHruP4hJO8777wYtEKNKIN2VZgWQElrllAuAtaHyA+UGKwulOKmkR8k1Oxmfd46fnQBwzy+Giab4lqQRQAObCT0QtUrlrsU1U+zwIDAQAB";
+
+
+  public static final String ACTION_LOG_URL = "https://ronghefaxingmd.yyxxgameyw.com/api/apm?";
+
+  public static final String APP_KEY = "c4746e44-daed-11ea-be52-fa163eac610f";
+
+  public static final String SDK_LOG = "sdk_log";
+
+  public static final String SDK_ERROR_LOG = "sdk_log_err";
+
+  public static final String SDK_AD_LOG = "adsdk_log";
+
+}

+ 252 - 0
hnqj/src/main/java/com/yyrh/easypermission/EasyPermission.java

@@ -0,0 +1,252 @@
+package com.yyrh.easypermission;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Process;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @className: EasyPermission
+ * @classDescription:便捷易用的Android 6.0 动态权限适配库,使用方便,无其他引用依赖,copy 即用
+ * @author: Pan_
+ * @createTime: 2018/10/24
+ */
+public class EasyPermission implements NextAction {
+    public static final String TAG = "EasyPermission";
+    private Activity mActivity;
+    private LinkedList<String> mPermissionList = new LinkedList<>();
+    private PermissionRequestListener mPermissionRequestListener;
+    private String mCurPermission;
+
+    private HashMap<String, RequestPermissionRationalListener> mRequestPermissionRationalListenerMap = new HashMap<>();
+    private HashMap<String, GrantResult> mPermissionGrantMap = new HashMap<>();
+
+    public EasyPermission(Activity activity) {
+        mActivity = activity;
+    }
+
+    /**
+     * 创建一个EasyPermission实例,一切从这里开始
+     *
+     * @param activity
+     * @return
+     */
+    public static EasyPermission with(Activity activity) {
+        return new EasyPermission(activity);
+    }
+
+    /**
+     * 添加一个需要获取的权限
+     *
+     * @param permission
+     * @return
+     */
+    public EasyPermission addPermission(String permission) {
+        if (TextUtils.isEmpty(permission)) {
+            return this;
+        }
+
+        mPermissionList.add(permission);
+        return this;
+    }
+
+
+    /**
+     * 添加一组需要获取的权限
+     *
+     * @param permission
+     * @return
+     */
+    public EasyPermission addPermissions(String... permission) {
+        if (permission == null || permission.length <= 0) {
+            return this;
+        }
+
+        mPermissionList.addAll(Arrays.asList(permission));
+        return this;
+    }
+
+    /**
+     * 添加一组需要获取的权限
+     *
+     * @param permission
+     * @return
+     */
+    public EasyPermission addPermissions(String[]... permission) {
+        if (permission == null || permission.length <= 0) {
+            return this;
+        }
+
+        for (String[] group : permission) {
+            mPermissionList.addAll(Arrays.asList(group));
+        }
+        return this;
+    }
+
+
+    /**
+     * 添加一组需要获取的权限
+     *
+     * @param permission
+     * @return
+     */
+    public EasyPermission addPermissions(List<String> permission) {
+        if (permission == null || permission.isEmpty()) {
+            return this;
+        }
+
+        mPermissionList.addAll(permission);
+        return this;
+    }
+
+    /**
+     * 添加一个权限的Rational的处理
+     *
+     * @param permission
+     * @param listener
+     * @return
+     */
+    public EasyPermission addRequestPermissionRationaleHandler(String permission, RequestPermissionRationalListener listener) {
+        if (TextUtils.isEmpty(permission) || listener == null) {
+            return this;
+        }
+
+        mRequestPermissionRationalListenerMap.put(permission, listener);
+        return this;
+    }
+
+    /**
+     * 判断是否已经该权限
+     *
+     * @param context     上下文
+     * @param permissions 权限数组
+     * @return
+     */
+    public static boolean isPermissionGrant(Context context, String... permissions) {
+        for (String permission : permissions) {
+            if (context.checkPermission(permission, Process.myPid(), Process.myUid()) != PackageManager.PERMISSION_GRANTED) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * 打开权限设置页面
+     *
+     * @param context 上下文
+     */
+    public static void openSettingPage(Context context) {
+        PermissionSettingPage.start(context, false);
+    }
+
+    /**
+     * 打开权限设置页面
+     *
+     * @param context 上下文
+     * @param newTask 是否开启新的堆栈打开
+     */
+    public static void openSettingPage(Context context, boolean newTask) {
+        PermissionSettingPage.start(context, newTask);
+    }
+
+    /**
+     * 开始申请权限
+     *
+     * @param listener
+     */
+    public void request(PermissionRequestListener listener) {
+        if (listener == null) {
+            return;
+        }
+        if (mPermissionList.isEmpty()) {
+            throw new RuntimeException("must add some permission to request!!");
+        }
+
+        if (Build.VERSION.SDK_INT < 23) {
+            Log.i(TAG, "targetSdk < 23 ,no need to request permission dynamic");
+            HashMap<String, GrantResult> grantMap = new HashMap<>();
+            for (String permission : mPermissionList) {
+                grantMap.put(permission, GrantResult.GRANT);
+            }
+            listener.onGrant(grantMap);
+            return;
+        }
+        PermissionUtils.checkPermissions(mActivity, mPermissionList);
+        mPermissionRequestListener = listener;
+        pollPermission();
+    }
+
+
+    @TargetApi(23)
+    private void pollPermission() {
+        if (mPermissionList.isEmpty()) {
+            Log.i(TAG, "permission检查完成,开始申请权限");
+            PermissionRequestFragment.build(mPermissionGrantMap, mPermissionRequestListener).go(mActivity);
+            return;
+        }
+        String permission = mPermissionList.pollFirst();
+
+        if (Permission.REQUEST_INSTALL_PACKAGES.equals(permission)) {
+           if(PermissionUtils.isHasInstallPermission(mActivity)){
+               mPermissionGrantMap.put(permission, GrantResult.GRANT);
+               pollPermission();
+           }else{
+               mPermissionGrantMap.put(permission, GrantResult.DENIED);
+               pollPermission();
+           }
+
+        } else if (Permission.SYSTEM_ALERT_WINDOW.equals(permission)) {
+            if(PermissionUtils.isHasOverlaysPermission(mActivity)){
+                mPermissionGrantMap.put(permission, GrantResult.GRANT);
+                pollPermission();
+            }else{
+                mPermissionGrantMap.put(permission, GrantResult.DENIED);
+                pollPermission();
+            }
+        } else if (mActivity.checkPermission(permission, Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED) {
+            mPermissionGrantMap.put(permission, GrantResult.GRANT);
+            pollPermission();
+        } else {
+            mPermissionGrantMap.put(permission, GrantResult.DENIED);
+            if (mRequestPermissionRationalListenerMap.get(permission) != null) {
+                mCurPermission = permission;
+                mRequestPermissionRationalListenerMap.get(permission).onRequestPermissionRational(permission, mActivity.shouldShowRequestPermissionRationale(permission), this);
+            } else {
+                pollPermission();
+            }
+        }
+    }
+
+    @Override
+    public void next(NextActionType next) {
+        if (next == null) {
+            mPermissionGrantMap.put(mCurPermission, GrantResult.IGNORE);
+            pollPermission();
+            return;
+        }
+        switch (next) {
+            case NEXT:
+                pollPermission();
+                break;
+            case IGNORE:
+                mPermissionGrantMap.put(mCurPermission, GrantResult.IGNORE);
+                pollPermission();
+                break;
+            case STOP:
+                mPermissionRequestListener.onCancel(mCurPermission);
+                break;
+        }
+    }
+}

+ 35 - 0
hnqj/src/main/java/com/yyrh/easypermission/GrantResult.java

@@ -0,0 +1,35 @@
+package com.yyrh.easypermission;
+
+/**
+ * @className: GrantResult
+ * @classDescription:申请权限结果枚举类
+ * @author: Pan_
+ * @createTime: 2018/10/25
+ */
+public enum GrantResult {
+
+    /**
+     * 授予权限
+     */
+    GRANT(0),
+
+    /**
+     * 拒接权限
+     */
+    DENIED(-1),
+
+    /**
+     * 之前在requestPremissionRational里面的next接口返回了IGNORE
+     */
+    IGNORE(-2);
+
+    private int type;
+
+    GrantResult(int type) {
+        this.type = type;
+    }
+
+    public int getValue(){
+        return type;
+    }
+}

+ 18 - 0
hnqj/src/main/java/com/yyrh/easypermission/NextAction.java

@@ -0,0 +1,18 @@
+package com.yyrh.easypermission;
+
+/**
+ * @className: NextAction
+ * @classDescription: addRequestPermissionRationaleHandler的处理函数,当定义了一个权限的rationaleHandler的时候,必须在处理回调里面调用这个接口的next方法, 才能进行下一步,
+ * 否则整个权限申请链条将会中断,权限申请将不会触发
+ * @author: Pan_
+ * @createTime: 2018/10/24
+ */
+public interface NextAction {
+
+    /**
+     * addRequestPermissionRationaleHandler的处理函数,当定义了一个权限的rationaleHandler的时候,必须在处理回调里面调用这个接口的next方法, 才能进行下一步,
+     * 否则整个权限申请链条将会中断,权限申请将不会触发
+     * @param next
+     */
+    public void next(NextActionType next);
+}

+ 24 - 0
hnqj/src/main/java/com/yyrh/easypermission/NextActionType.java

@@ -0,0 +1,24 @@
+package com.yyrh.easypermission;
+
+/**
+ * @className: NextActionType
+ * @classDescription:NextAction 回调的类型
+ * @author: Pan_
+ * @createTime: 2018/10/24
+ */
+public enum NextActionType {
+    /**
+     * 忽略这个权限,后面的步骤不会申请这个权限
+     */
+    IGNORE,
+
+    /**
+     * 表示继续处理,继续下一个权限
+     */
+    NEXT,
+
+    /**
+     * 停止处理,直接回调onCancel函数
+     */
+    STOP;
+}

+ 88 - 0
hnqj/src/main/java/com/yyrh/easypermission/Permission.java

@@ -0,0 +1,88 @@
+package com.yyrh.easypermission;
+
+/**
+ * @className: Permission
+ * @classDescription:权限定义类
+ * @author: Pan_
+ * @createTime: 2018/10/26
+ */
+public class Permission {
+
+    public static final String READ_CALENDAR = "android.permission.READ_CALENDAR";
+    public static final String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR";
+
+    public static final String CAMERA = "android.permission.CAMERA";
+
+    public static final String READ_CONTACTS = "android.permission.READ_CONTACTS";
+    public static final String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
+    public static final String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
+
+    public static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
+    public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
+
+    public static final String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
+
+    public static final String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
+    public static final String CALL_PHONE = "android.permission.CALL_PHONE";
+    public static final String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
+    public static final String WRITE_CALL_LOG = "android.permission.WRITE_CALL_LOG";
+    public static final String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
+    public static final String USE_SIP = "android.permission.USE_SIP";
+    public static final String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
+
+    public static final String BODY_SENSORS = "android.permission.BODY_SENSORS";
+
+    public static final String SEND_SMS = "android.permission.SEND_SMS";
+    public static final String RECEIVE_SMS = "android.permission.RECEIVE_SMS";
+    public static final String READ_SMS = "android.permission.READ_SMS";
+    public static final String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
+    public static final String RECEIVE_MMS = "android.permission.RECEIVE_MMS";
+
+    public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
+    public static final String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
+
+    public static final String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES"; // 8.0及以上应用安装权限
+    public static final String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW"; // 6.0及以上悬浮窗权限
+
+    public static final class Group {
+        public static final String[] CALENDAR = new String[]{
+                Permission.READ_CALENDAR,
+                Permission.WRITE_CALENDAR};
+
+        public static final String[] CAMERA = new String[]{Permission.CAMERA};
+
+        public static final String[] CONTACTS = new String[]{
+                Permission.READ_CONTACTS,
+                Permission.WRITE_CONTACTS,
+                Permission.GET_ACCOUNTS};
+
+        public static final String[] LOCATION = new String[]{
+                Permission.ACCESS_FINE_LOCATION,
+                Permission.ACCESS_COARSE_LOCATION};
+
+        public static final String[] MICROPHONE = new String[]{Permission.RECORD_AUDIO};
+
+        public static final String[] PHONE = new String[]{
+                Permission.READ_PHONE_STATE,
+                Permission.CALL_PHONE,
+                Permission.READ_CALL_LOG,
+                Permission.WRITE_CALL_LOG,
+                Permission.ADD_VOICEMAIL,
+                Permission.USE_SIP,
+                Permission.PROCESS_OUTGOING_CALLS};
+
+        public static final String[] SENSORS = new String[]{Permission.BODY_SENSORS};
+
+        public static final String[] SMS = new String[]{
+                Permission.SEND_SMS,
+                Permission.RECEIVE_SMS,
+                Permission.READ_SMS,
+                Permission.RECEIVE_WAP_PUSH,
+                Permission.RECEIVE_MMS};
+
+        public static final String[] STORAGE = new String[]{
+                Permission.READ_EXTERNAL_STORAGE,
+                Permission.WRITE_EXTERNAL_STORAGE};
+    }
+}
+

+ 198 - 0
hnqj/src/main/java/com/yyrh/easypermission/PermissionRequestFragment.java

@@ -0,0 +1,198 @@
+package com.yyrh.easypermission;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.app.Fragment;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Looper;
+import android.provider.Settings;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @className: PermissionRequestFragment
+ * @classDescription:权限申请代理fragment
+ * @author: Pan_
+ * @createTime: 2018/10/25
+ */
+
+public final class PermissionRequestFragment extends Fragment implements Runnable {
+    private int mRequestCode;
+    private PermissionRequestListener mPermissionRequestListener;
+    private HashMap<String, GrantResult> mPermissionGrantMap = new HashMap<>();
+    private RequestCodeGenerater mRequestCodeGenerater = new RequestCodeGenerater();
+
+
+    /**
+     * build函数构造一个用于权限请求的fragment
+     *
+     * @param permissionMap
+     * @param permissionRequestListener
+     * @return
+     */
+    public static PermissionRequestFragment build(HashMap<String, GrantResult> permissionMap, PermissionRequestListener permissionRequestListener) {
+        PermissionRequestFragment fragment = new PermissionRequestFragment();
+        fragment.setPermissionGrantMap(permissionMap);
+        fragment.setPermissionRequestListener(permissionRequestListener);
+        return fragment;
+    }
+
+
+    public void setPermissionRequestListener(PermissionRequestListener permissionRequestListener) {
+        mPermissionRequestListener = permissionRequestListener;
+    }
+
+    public void setPermissionGrantMap(HashMap<String, GrantResult> permissionGrantMap) {
+        mPermissionGrantMap = permissionGrantMap;
+    }
+
+    /**
+     * 开始请求
+     */
+    public void go(Activity activity) {
+        if (activity != null) {
+            if (Looper.getMainLooper() != Looper.myLooper()) {
+                throw new RuntimeException("you must request permission in main thread!!");
+            }
+            activity.getFragmentManager().beginTransaction().add(this, activity.getClass().getName()).commit();
+        } else {
+            throw new RuntimeException("activity is null!!");
+        }
+    }
+
+    private boolean isBackCall;//是否已经回调了,避免安装权限和悬浮窗同时请求导致的重复回调
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        //super.onActivityResult(requestCode, resultCode, data);
+        if (!isBackCall && requestCode == mRequestCode) {
+            isBackCall = true;
+            //需要延迟执行,不然有些华为机型授权了但是获取不到权限
+            getActivity().getWindow().getDecorView().postDelayed(this, 500);
+        }
+    }
+
+
+    @Override
+    public void run() {
+        //请求其他危险权限
+        startRequestPermission();
+    }
+
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        mRequestCode = mRequestCodeGenerater.generate();
+        if ((mPermissionGrantMap.containsKey(Permission.REQUEST_INSTALL_PACKAGES) && mPermissionGrantMap.get(Permission.REQUEST_INSTALL_PACKAGES) == GrantResult.DENIED)
+                || (mPermissionGrantMap.containsKey(Permission.SYSTEM_ALERT_WINDOW) && mPermissionGrantMap.get(Permission.SYSTEM_ALERT_WINDOW) == GrantResult.DENIED)) {
+            if (mPermissionGrantMap.containsKey(Permission.REQUEST_INSTALL_PACKAGES)) {
+                //跳转到允许安装未知来源设置页面
+                Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:" + getActivity().getPackageName()));
+                startActivityForResult(intent, mRequestCode);
+            }
+
+            if (mPermissionGrantMap.containsKey(Permission.SYSTEM_ALERT_WINDOW)) {
+                //跳转到悬浮窗设置页面
+                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getActivity().getPackageName()));
+                startActivityForResult(intent, mRequestCode);
+            }
+
+        } else {
+            startRequestPermission();
+        }
+    }
+
+    @TargetApi(23)
+    private void startRequestPermission() {
+        ArrayList<String> needRequestPermissionList = new ArrayList<>();
+        Set<Map.Entry<String, GrantResult>> entrySet = mPermissionGrantMap.entrySet();
+        for (Map.Entry<String, GrantResult> entry : entrySet) {
+            if (entry.getValue() == GrantResult.DENIED) {
+                needRequestPermissionList.add(entry.getKey());
+            }
+        }
+
+        for (String permission : needRequestPermissionList) {
+            Log.i(EasyPermission.TAG, "需要申请的权限:" + permission);
+        }
+        if (needRequestPermissionList.isEmpty() && mPermissionRequestListener != null) {
+            Log.i(EasyPermission.TAG, "没有需要申请的权限,直接回调");
+            mPermissionRequestListener.onGrant(mPermissionGrantMap);
+            return;
+        }
+        String[] permissionArray = needRequestPermissionList.toArray(new String[needRequestPermissionList.size()]);
+        requestPermissions(permissionArray, mRequestCode);
+    }
+
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+        if (requestCode != mRequestCode) {
+            Log.i(EasyPermission.TAG, "requestCode不一致,不处理");
+            return;
+        }
+
+        for (int i = 0; i < permissions.length; i++) {
+            Log.i(EasyPermission.TAG, "onRequestPermissionsResult返回状态,权限:" + permissions[i] + "  是否授权:" + grantResults[i]);
+            String permission = permissions[i];
+            if (Permission.REQUEST_INSTALL_PACKAGES.equals(permission)) {
+                if (PermissionUtils.isHasInstallPermission(getActivity().getApplicationContext())) {
+                    mPermissionGrantMap.put(permission, GrantResult.GRANT);
+                } else {
+                    mPermissionGrantMap.put(permission, GrantResult.DENIED);
+                }
+
+            } else if (Permission.SYSTEM_ALERT_WINDOW.equals(permission)) {
+                if (PermissionUtils.isHasOverlaysPermission(getActivity().getApplicationContext())) {
+                    mPermissionGrantMap.put(permission, GrantResult.GRANT);
+                } else {
+                    mPermissionGrantMap.put(permission, GrantResult.DENIED);
+                }
+            } else {
+                mPermissionGrantMap.put(permissions[i], grantResults[i] == PackageManager.PERMISSION_GRANTED ? GrantResult.GRANT : GrantResult.DENIED);
+            }
+
+        }
+
+
+        //打印返回结果
+        Set<Map.Entry<String, GrantResult>> entrySet = mPermissionGrantMap.entrySet();
+        Log.i(EasyPermission.TAG, "打印最终返回结果:");
+        for (Map.Entry<String, GrantResult> entry : entrySet) {
+            Log.i(EasyPermission.TAG, "权限:" + entry.getKey() + "  状态:" + entry.getValue());
+        }
+        if (mPermissionRequestListener != null) {
+            mPermissionRequestListener.onGrant(mPermissionGrantMap);
+        }
+        getFragmentManager().beginTransaction().remove(this).commit();
+    }
+
+
+    /**
+     * requestCode的生成器,用于生成不重复的requestCode
+     */
+    private static class RequestCodeGenerater {
+        /**
+         * 生成初始化值
+         */
+        private volatile static int FACTOR_REQUEST_CODE = 0;
+
+        /**
+         * 同步生成方法
+         *
+         * @return
+         */
+        public synchronized int generate() {
+            return FACTOR_REQUEST_CODE++;
+        }
+    }
+
+}

+ 23 - 0
hnqj/src/main/java/com/yyrh/easypermission/PermissionRequestListener.java

@@ -0,0 +1,23 @@
+package com.yyrh.easypermission;
+
+import java.util.Map;
+
+/**
+ * @className: PermissionRequestListener
+ * @classDescription:
+ * @author: Pan_
+ * @createTime: 2018/10/25
+ */
+public abstract class PermissionRequestListener {
+    /**
+     * 权限申请结果的回调,map里面对应着需要申请的权限和结果
+     * @param result
+     */
+    public abstract void onGrant(Map<String,GrantResult> result);
+
+    /**
+     * 当用户在RequestPermissionRationalListner的next函数里面回调STOP,则会调用这个回调,返回stop时候的权限的字符串
+     * @param stopPermission
+     */
+    public abstract void onCancel(String stopPermission);
+}

+ 122 - 0
hnqj/src/main/java/com/yyrh/easypermission/PermissionSettingPage.java

@@ -0,0 +1,122 @@
+package com.yyrh.easypermission;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import android.provider.Settings;
+
+/**
+ * @className: PermissionSettingPage
+ * @classDescription:权限设置页面的跳转工具类
+ * @author: Pan_
+ * @createTime: 2018/10/26
+ */
+public class PermissionSettingPage {
+
+    private static final String MARK = Build.MANUFACTURER.toLowerCase();
+
+    /**
+     * 跳转到应用权限设置页面
+     *
+     * @param context 上下文对象
+     * @param newTask 是否使用新的任务栈启动
+     */
+    static void start(Context context, boolean newTask) {
+
+        Intent intent = null;
+        if (MARK.contains("huawei")) {
+            intent = huawei(context);
+        } else if (MARK.contains("xiaomi")) {
+            intent = xiaomi(context);
+        } else if (MARK.contains("oppo")) {
+            intent = oppo(context);
+        } else if (MARK.contains("vivo")) {
+            intent = vivo(context);
+        } else if (MARK.contains("meizu")) {
+            intent = meizu(context);
+        }
+
+        if (intent == null || !hasIntent(context, intent)) {
+            intent = google(context);
+        }
+
+        if (newTask) {
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        }
+
+        try {
+            context.startActivity(intent);
+        } catch (Exception ignored) {
+            intent = google(context);
+            context.startActivity(intent);
+        }
+    }
+
+    private static Intent google(Context context) {
+        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+        intent.setData(Uri.fromParts("package", context.getPackageName(), null));
+        return intent;
+    }
+
+    private static Intent huawei(Context context) {
+        Intent intent = new Intent();
+        intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity"));
+        if (hasIntent(context, intent)) return intent;
+        intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.addviewmonitor.AddViewMonitorActivity"));
+        if (hasIntent(context, intent)) return intent;
+        intent.setComponent(new ComponentName("com.huawei.systemmanager", "com.huawei.notificationmanager.ui.NotificationManagmentActivity"));
+        return intent;
+    }
+
+    private static Intent xiaomi(Context context) {
+        Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR");
+        intent.putExtra("extra_pkgname", context.getPackageName());
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setPackage("com.miui.securitycenter");
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity");
+        return intent;
+    }
+
+    private static Intent oppo(Context context) {
+        Intent intent = new Intent();
+        intent.putExtra("packageName", context.getPackageName());
+        intent.setClassName("com.color.safecenter", "com.color.safecenter.permission.floatwindow.FloatWindowListActivity");
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setClassName("com.coloros.safecenter", "com.coloros.safecenter.sysfloatwindow.FloatWindowListActivity");
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setClassName("com.oppo.safe", "com.oppo.safe.permission.PermissionAppListActivity");
+        return intent;
+    }
+
+    private static Intent vivo(Context context) {
+        Intent intent = new Intent();
+        intent.setClassName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.FloatWindowManager");
+        intent.putExtra("packagename", context.getPackageName());
+        if (hasIntent(context, intent)) return intent;
+
+        intent.setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.safeguard.SoftPermissionDetailActivity"));
+        return intent;
+    }
+
+    private static Intent meizu(Context context) {
+        Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
+        intent.putExtra("packageName", context.getPackageName());
+        intent.setComponent(new ComponentName("com.meizu.safe", "com.meizu.safe.security.AppSecActivity"));
+        return intent;
+    }
+
+    private static boolean hasIntent(Context context, Intent intent) {
+        return context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
+    }
+}

+ 87 - 0
hnqj/src/main/java/com/yyrh/easypermission/PermissionUtils.java

@@ -0,0 +1,87 @@
+package com.yyrh.easypermission;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.provider.Settings;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @className: PermissionUtils
+ * @classDescription:
+ * @author: Pan_
+ * @createTime: 2018/10/25
+ */
+
+final class PermissionUtils {
+    /**
+     * 是否是6.0以上版本
+     */
+    static boolean isOverMarshmallow() {
+        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
+    }
+
+    /**
+     * 是否是8.0以上版本
+     */
+    static boolean isOverOreo() {
+        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
+    }
+
+    /**
+     * 返回应用程序在清单文件中注册的权限
+     */
+    static List<String> getManifestPermissions(Context context) {
+        PackageManager pm = context.getPackageManager();
+        try {
+            return Arrays.asList(pm.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS).requestedPermissions);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+
+
+    /**
+     * 检测权限有没有在清单文件中注册
+     *
+     * @param activity              Activity对象
+     * @param requestPermissions    请求的权限组
+     */
+    static void checkPermissions(Activity activity, List<String> requestPermissions) {
+        List<String> manifest = PermissionUtils.getManifestPermissions(activity);
+        if (manifest != null && manifest.size() != 0) {
+            for (String permission : requestPermissions) {
+                if (!manifest.contains(permission)) {
+                    throw new RuntimeException("you must add this permission:"+permission+" to AndroidManifest");
+                }
+            }
+        }
+    }
+
+    /**
+     * 是否有安装权限
+     */
+    static boolean isHasInstallPermission(Context context) {
+        if (isOverOreo()) {
+            return context.getPackageManager().canRequestPackageInstalls();
+        }
+        return true;
+    }
+
+    /**
+     * 是否有悬浮窗权限
+     */
+    static boolean isHasOverlaysPermission(Context context) {
+        if (isOverMarshmallow()) {
+            return Settings.canDrawOverlays(context);
+        }
+        return true;
+    }
+
+
+}

+ 19 - 0
hnqj/src/main/java/com/yyrh/easypermission/RequestPermissionRationalListener.java

@@ -0,0 +1,19 @@
+package com.yyrh.easypermission;
+
+/**
+ * @className: RequestPermissionRationalListener
+ * @classDescription:
+ * @author: Pan_
+ * @createTime: 2018/10/24
+ */
+public interface RequestPermissionRationalListener {
+
+    /**
+     * 申请权限Rationale的处理回调函数,可以在这个函数里面处理权限rational的情况,例如弹一些dialog提示用户允许开启权限等,但是调用完成后必须调用NextAction
+     * 方法,传进去一个NextActionType,否则后续操作不会执行,同时NextActionType最好不要传空,传空默认当成IGNORE处理
+     * @param permission
+     * @param requestPermissionRationaleResult
+     * @param nextAction
+     */
+    public void onRequestPermissionRational(String permission, boolean requestPermissionRationaleResult, NextAction nextAction);
+}

+ 168 - 0
hnqj/src/main/java/com/yyrh/factory/ChannelSdkOperation.java

@@ -0,0 +1,168 @@
+package com.yyrh.factory;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+import com.yyrh.constant.RoleInfo;
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yyrh.utils.Utils;
+import com.yyrh.utils.YYLog;
+import com.yythird.base.ChannelSdkCallback;
+import com.yythird.sdk.ChannelSDK;
+
+import java.util.HashMap;
+
+
+public class ChannelSdkOperation implements ISdkOperation {
+    private static ChannelSDK channelSdk = null;
+
+    public ChannelSdkOperation(Context context) {
+        channelSdk = ChannelSDK.getInstance();
+    }
+
+
+
+    @Override
+    public void login(Activity activity) {
+        channelSdk.SDKLogin(activity, SDKEntry.getSdkInstance().tCallBack);
+    }
+
+    @Override
+    public void uploadRoleInfo(String type, Activity activity, RoleInfo roleInfo) {
+        String roleId = roleInfo.getRoleId();
+        String roleName = roleInfo.getRoleName();
+        String roleLevel = roleInfo.getRoleLevel();
+        String gender = roleInfo.getGender();
+        String serverId = roleInfo.getServerId();
+        String serverName = roleInfo.getServerName();
+        String hasGold = roleInfo.getHasGold();
+        String vipLevel = roleInfo.getVipLevel();
+        String roleCreateTime = roleInfo.getRoleCreateTime();
+        String partyName = roleInfo.getPartyName();
+        String role_power = roleInfo.getRolePower();
+        String partyId = roleInfo.getPartyId();
+        String reincarnationCount = roleInfo.getReincarnationCount();
+
+
+        if (Utils.judgeStrNull(roleId) || Utils.judgeStrNull(roleName)
+                || Utils.judgeStrNull(roleLevel)
+                || Utils.judgeStrNull(gender)
+                || Utils.judgeStrNull(serverId)
+                || Utils.judgeStrNull(serverName)
+                || Utils.judgeStrNull(hasGold)
+                || Utils.judgeStrNull(vipLevel)
+                || Utils.judgeStrNull(roleCreateTime)
+                || Utils.judgeStrNull(role_power)
+                || Utils.judgeStrNull(partyId)
+                || Utils.judgeStrNull(reincarnationCount)) {
+
+            YYLog.i("上传参数有空值,请检查: " + roleInfo.getAllParam());
+
+        } else {
+
+            channelSdk.SDKUploadInfo(type, activity, roleInfo);
+
+        }
+    }
+
+    @Override
+    public void setSDKLogoutListener(Activity ac, ChannelSdkCallback sdkCallback) {
+        channelSdk.setSDKLogoutListener(ac, sdkCallback);
+    }
+
+    @Override
+    public void pay(Activity activity, HashMap<String, Object> map) {
+
+        if (SDKSettings.isThirdPay){
+            channelSdk.SDKPay(activity, map, SDKEntry.getSdkInstance().tCallBack);
+        }else{
+            YyrhSdkManager.defaultManager(activity).yyrhPay(activity,map);
+        }
+
+    }
+
+    @Override
+    public void exit(Activity activity) {
+        channelSdk.SDKExit(activity, SDKEntry.getSdkInstance().tCallBack);
+    }
+
+    @Override
+    public void logOut() {
+        channelSdk.SDKLogout();
+    }
+
+    @Override
+    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback) {
+        if (Utils.getTextIsNull(SDKSettings.USER_BIRTHDAY)) {
+            ChannelSDK.getInstance().onGetChannelRealNameInfo(activity);
+        } else {
+            realNameMsgCallback.onLoadRealNameMsg(true, SDKSettings.USER_BIRTHDAY);
+        }
+    }
+
+    @Override
+    public void sdkOnStart(Activity activity) {
+        channelSdk.onStart(activity);
+    }
+
+    @Override
+    public void sdkOnCreate(Activity activity, Bundle savedInstanceState) {
+        channelSdk.onCreate(activity, savedInstanceState);
+    }
+
+    @Override
+    public void sdkOnPause(Activity activity) {
+        channelSdk.onPause(activity);
+    }
+
+    @Override
+    public void sdkOnResume(Activity activity) {
+        channelSdk.onResume(activity);
+    }
+
+    @Override
+    public void sdkOnRestart(Activity activity) {
+        channelSdk.onRestart(activity);
+    }
+
+    @Override
+    public void sdkOnNewIntent(Activity acitivty, Intent intent) {
+        channelSdk.onNewIntent(acitivty, intent);
+    }
+
+    @Override
+    public void sdkOnStop(Activity activity) {
+        channelSdk.onStop(activity);
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfigs) {
+        channelSdk.onConfigurationChanged(newConfigs);
+    }
+
+    @Override
+    public void sdkOnDestroy(Activity activity) {
+        channelSdk.onDestroy(activity);
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+        channelSdk.onRequestPermissionsResult(requestCode, permissions, grantResults);
+    }
+
+    @Override
+    public void onActivityResult(Activity ac, int requestCode, int resultCode, Intent data) {
+        channelSdk.onActivityResult(ac, requestCode, resultCode, data);
+    }
+
+    @Override
+    public void onWindowFocusChanged(Activity activity, boolean hasFocus) {
+        channelSdk.onWindowFocusChanged(activity, hasFocus);
+    }
+}

+ 64 - 0
hnqj/src/main/java/com/yyrh/factory/ISdkOperation.java

@@ -0,0 +1,64 @@
+package com.yyrh.factory;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+import com.yyrh.constant.RoleInfo;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yythird.base.ChannelSdkCallback;
+
+import java.util.HashMap;
+
+public interface ISdkOperation {
+
+    /**
+     * operation
+     */
+
+
+    void login(Activity activity);
+
+    void uploadRoleInfo(String type, Activity activity, RoleInfo roleInfo);
+
+    void setSDKLogoutListener(Activity ac, ChannelSdkCallback sdkCallback);
+
+    void pay(Activity activity, HashMap<String, Object> map);
+
+    void exit(Activity activity);
+
+    void logOut();
+
+    void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback);
+
+
+    /**
+     * 生命周期
+     */
+    void sdkOnStart(Activity activity);
+
+    void sdkOnCreate(Activity activity, Bundle savedInstanceState);
+
+    void sdkOnPause(Activity activity);
+
+    void sdkOnResume(Activity activity);
+
+    void sdkOnRestart(Activity activity);
+
+    void sdkOnNewIntent(Activity acitivty, Intent intent);
+
+    void sdkOnStop(Activity activity);
+
+    void onConfigurationChanged(Configuration newConfigs);
+
+    void sdkOnDestroy(Activity activity);
+
+
+    void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
+
+    void onActivityResult(Activity ac, int requestCode, int resultCode, Intent data);
+
+    void onWindowFocusChanged(Activity activity, boolean hasFocus);
+
+}

+ 17 - 0
hnqj/src/main/java/com/yyrh/factory/SdkFactory.java

@@ -0,0 +1,17 @@
+package com.yyrh.factory;
+
+import android.content.Context;
+
+import com.yyrh.constant.SDKSettings;
+
+public class SdkFactory {
+    private SdkFactory(){}
+    public static ISdkOperation GetSdk(Context context) {
+
+         if (SDKSettings.isThirdLogin){
+             return new ChannelSdkOperation(context);
+         }else{
+             return new YyrhSdkOperation(context);
+         }
+    }
+}

+ 124 - 0
hnqj/src/main/java/com/yyrh/factory/SdkManager.java

@@ -0,0 +1,124 @@
+package com.yyrh.factory;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+import com.yyrh.constant.RoleInfo;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yythird.base.ChannelSdkCallback;
+
+import java.util.HashMap;
+
+public class SdkManager {
+
+    private static SdkManager manager = null;
+
+    private ISdkOperation operation;
+
+    private SdkManager(Context context) {
+        operation = SdkFactory.GetSdk(context);
+    }
+
+    public static SdkManager defaultManager(Context context) {
+        if (manager == null) {
+            synchronized (SdkManager.class) {
+                if (manager == null) {
+                    manager = new SdkManager(context);
+                }
+            }
+        }
+        return manager;
+    }
+
+
+
+    /**
+     * operation
+     */
+
+    public  void  onInitSuccess(Activity activity){
+        operation = SdkFactory.GetSdk(activity);
+    }
+
+    public void login(Activity activity){
+        operation.login(activity);
+    }
+
+    public void uploadRoleInfo(String type, Activity activity, RoleInfo roleInfo){
+        operation.uploadRoleInfo(type,activity,roleInfo);
+    }
+
+    public void pay(Activity activity, HashMap<String, Object> map){
+        operation.pay(activity,map);
+    }
+    public void exit(Activity activity){
+        operation.exit(activity);
+    }
+    public void logOut(){
+        operation.logOut();
+    }
+    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback){
+        operation.getRealNameInfo(activity,realNameMsgCallback);
+    }
+    public void setSDKLogoutListener(Activity ac, ChannelSdkCallback sdkCallback){
+        operation.setSDKLogoutListener(ac,sdkCallback);
+    }
+
+
+    /**
+     * 生命周期
+     */
+    public void sdkOnStart(Activity activity){
+        operation.sdkOnStart(activity);
+    }
+
+    public void sdkOnCreate(Activity activity, Bundle savedInstanceState){
+        operation.sdkOnCreate(activity,savedInstanceState);
+    }
+
+    public void sdkOnPause(Activity activity){
+        operation.sdkOnPause(activity);
+    }
+
+    public void sdkOnResume(Activity activity){
+        operation.sdkOnResume(activity);
+    }
+
+    public void sdkOnRestart(Activity activity){
+        operation.sdkOnRestart(activity);
+    }
+
+    public void sdkOnNewIntent(Activity acitivty, Intent intent){
+        operation.sdkOnNewIntent(acitivty,intent);
+    }
+
+    public void sdkOnStop(Activity activity){
+        operation.sdkOnStop(activity);
+    }
+
+    public void onConfigurationChanged(Configuration newConfigs){
+        operation.onConfigurationChanged(newConfigs);
+    }
+
+    public void sdkOnDestroy(Activity activity){
+        operation.sdkOnDestroy(activity);
+    }
+
+
+    public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
+        operation.onRequestPermissionsResult(requestCode,permissions,grantResults);
+    }
+
+    public void onActivityResult(Activity ac,int requestCode, int resultCode, Intent data){
+        operation.onActivityResult(ac,requestCode,resultCode,data);
+    }
+
+    public void onWindowFocusChanged(Activity activity, boolean hasFocus){
+        operation.onWindowFocusChanged(activity,hasFocus);
+    }
+
+
+}

+ 120 - 0
hnqj/src/main/java/com/yyrh/factory/YyrhSdkOperation.java

@@ -0,0 +1,120 @@
+package com.yyrh.factory;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+
+import com.yyrh.constant.RoleInfo;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yythird.base.ChannelSdkCallback;
+
+import java.util.HashMap;
+
+public class YyrhSdkOperation implements ISdkOperation {
+
+    private static YyrhSdkManager yyrhSdkManager = null;
+
+    public YyrhSdkOperation(Context context){
+        yyrhSdkManager = YyrhSdkManager.defaultManager(context);
+    }
+
+
+    @Override
+    public void login(Activity activity) {
+        yyrhSdkManager.yyrhLogin(activity);
+    }
+
+    @Override
+    public void uploadRoleInfo(String type, Activity activity, RoleInfo roleInfo) {
+
+    }
+
+    @Override
+    public void setSDKLogoutListener(Activity ac, ChannelSdkCallback sdkCallback) {
+
+    }
+
+
+    @Override
+    public void pay(Activity activity, HashMap<String, Object> map) {
+        yyrhSdkManager.yyrhPay(activity,map);
+    }
+
+    @Override
+    public void exit(Activity activity) {
+        yyrhSdkManager.yyrhExitGame(activity);
+    }
+
+    @Override
+    public void logOut() {
+        yyrhSdkManager.yyrhLogout();
+    }
+
+    @Override
+    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback) {
+        yyrhSdkManager.yyrhGetRealNameInfo(activity,realNameMsgCallback);
+    }
+
+    @Override
+    public void sdkOnStart(Activity activity) {
+
+    }
+
+    @Override
+    public void sdkOnCreate(Activity activity, Bundle savedInstanceState) {
+
+    }
+
+    @Override
+    public void sdkOnPause(Activity activity) {
+        yyrhSdkManager.onPause(activity);
+    }
+
+    @Override
+    public void sdkOnResume(Activity activity) {
+        yyrhSdkManager.onResume(activity);
+    }
+
+    @Override
+    public void sdkOnRestart(Activity activity) {
+
+    }
+
+    @Override
+    public void sdkOnNewIntent(Activity acitivty, Intent intent) {
+
+    }
+
+    @Override
+    public void sdkOnStop(Activity activity) {
+
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfigs) {
+
+    }
+
+    @Override
+    public void sdkOnDestroy(Activity activity) {
+        yyrhSdkManager.onDestroy(activity);
+    }
+
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+
+    }
+
+    @Override
+    public void onActivityResult(Activity ac, int requestCode, int resultCode, Intent data) {
+
+    }
+
+    @Override
+    public void onWindowFocusChanged(Activity activity, boolean hasFocus) {
+
+    }
+}

+ 172 - 0
hnqj/src/main/java/com/yyrh/imei/ImeiUtil.java

@@ -0,0 +1,172 @@
+package com.yyrh.imei;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.Build;
+
+import android.provider.Settings;
+import android.support.v4.app.ActivityCompat;
+import android.telephony.TelephonyManager;
+
+
+import com.yyrh.constant.Constants;
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.utils.Utils;
+import com.yythird.sdk.ChannelSDK;
+
+
+public class ImeiUtil {
+    public static String getImei(Context context) {
+
+        TelephonyManager telephonyManager = null;
+        String imei = "";
+        try {
+            telephonyManager = (TelephonyManager) context
+                    .getSystemService(Context.TELEPHONY_SERVICE);
+
+
+            if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
+                // TODO: Consider calling
+                //    ActivityCompat#requestPermissions
+                // here to request the missing permissions, and then overriding
+                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
+                //                                          int[] grantResults)
+                // to handle the case where the user grants the permission. See the documentation
+                // for ActivityCompat#requestPermissions for more details.
+
+                imei = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
+
+
+                if (judgeStrNull(imei)){
+                    return userSimulateImei(context);
+                }else{
+                    SDKSettings.ifa_type = "3";
+                    return imei;
+                }
+
+
+
+
+            }
+
+            if (telephonyManager.getDeviceId() != null) {
+
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                    imei =  telephonyManager.getImei();
+                }else{
+                    imei = telephonyManager.getDeviceId();
+                }
+                SDKSettings.ifa_type = "1";
+
+            } else {
+
+                imei = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
+                SDKSettings.ifa_type = "3";
+
+            }
+
+            } catch (Exception e) {
+                System.out.println(e.toString());
+            }
+
+
+
+            if (judgeStrNull(imei)){
+
+                return userSimulateImei(context);
+
+
+            }else{
+                Utils.setSharedPreferences("yyrh","simulateImei",imei,context);
+            }
+
+            return imei;
+
+
+    }
+
+     static String userSimulateImei(Context context){
+
+        SharedPreferences sp = context.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+        String  simulateImei = sp.getString("simulateImei", "");
+
+        if (!judgeStrNull(simulateImei)){
+            return simulateImei;
+        }else {
+
+
+            // 用putString的方法保存数据
+            String encryptMD5to16 ="YYR" + encryptMD5to16();
+            SDKSettings.ifa_type = "0";
+            Utils.setSharedPreferences("yyrh","simulateImei",encryptMD5to16,context);
+
+
+            return encryptMD5to16;
+        }
+    }
+    public static boolean judgeStrNull(String str) {
+        return (str == null || str.equals(""));
+    }
+
+    public static String encryptMD5to16() {
+        return simulateUniqueId().substring(8, 24);
+
+    }
+
+
+    //获得独一无二的Psuedo ID
+    public static String simulateUniqueId() {
+        String serial = null;
+
+        String m_szDevIDShort = "" +
+                Build.BOARD.length() % 10 + Build.BRAND.length() % 10 +
+
+                Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 +
+
+                Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 +
+
+                Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 +
+
+                Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 +
+
+                Build.TAGS.length() % 10 + Build.TYPE.length() % 10 +
+
+                Build.USER.length() % 10; //13 位
+
+        String  time = m_szDevIDShort + (System.currentTimeMillis());
+        return  getMD5(time);
+    }
+
+    public static String getMD5(String content) {
+        String s = null;
+        char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+                'a', 'b', 'c', 'd', 'e', 'f'};
+        try {
+            java.security.MessageDigest md = java.security.MessageDigest
+                    .getInstance("MD5");
+            md.update(content.getBytes());
+            byte tmp[] = md.digest();
+            char str[] = new char[16 * 2];
+            int k = 0;
+            for (int i = 0; i < 16; i++) {
+                byte byte0 = tmp[i];
+                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+                str[k++] = hexDigits[byte0 & 0xf];
+            }
+            s = new String(str);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return s;
+    }
+
+    public void  getOaid(final Context context){
+       ChannelSDK.getInstance().SDKGetOaid();
+    }
+
+
+}

+ 1065 - 0
hnqj/src/main/java/com/yyrh/networking/NetRequestApi.java

@@ -0,0 +1,1065 @@
+package com.yyrh.networking;
+
+import android.app.Activity;
+import android.os.Message;
+
+import android.widget.Toast;
+
+
+import com.yyrh.pay.PaymentNotify;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.callback.ShowPolicyCallback;
+import com.yyrh.ui.ForgetPwdLayout;
+import com.yyrh.ui.PhoneRegisterLayout;
+import com.yyrh.ui.fragment.UserPhoneLoginFragment;
+import com.yyrh.ui.fragment.UserRetrievePwdFragment;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.SignUtils;
+import com.yyrh.utils.SwitchUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+import com.yyrh.utils.YYLog;
+
+import com.yyrh.constant.Constants;
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.networking.urlhttp.CallBackUtil;
+import com.yyrh.networking.urlhttp.UrlHttpUtil;
+import com.yyrh.sdk.callback.InitCallback;
+import com.yyrh.sdk.callback.LoginCallback;
+import com.yyrh.sdk.callback.PayOrderCallback;
+import com.yyrh.sdk.callback.RegisterCallback;
+import com.yyrh.ui.ProgressDialogUtils;
+import com.yythird.sdk.ChannelSDK;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+import static com.yyrh.constant.Constants.LOGIN;
+import static com.yyrh.constant.SDKSettings.channelTag;
+
+import static com.yyrh.constant.SDKSettings.isThirdLogin;
+import static com.yyrh.constant.SDKSettings.isThirdPay;
+
+import static com.yyrh.constant.SDKSettings.order_ext;
+import static com.yyrh.constant.URLConstants.AGREEMENTINIT;
+import static com.yyrh.constant.URLConstants.BASEURL;
+import static com.yyrh.constant.URLConstants.CHANNELLOGIN;
+import static com.yyrh.constant.URLConstants.CHANNELZTAG;
+import static com.yyrh.constant.URLConstants.FASTREGISTER;
+import static com.yyrh.constant.URLConstants.GETCAPTCHA;
+import static com.yyrh.constant.URLConstants.INIT;
+
+import static com.yyrh.constant.URLConstants.QUERYORDER;
+import static com.yyrh.constant.URLConstants.REALNAMERECORD;
+import static com.yyrh.constant.URLConstants.RECHARGEINT;
+import static com.yyrh.constant.URLConstants.REGISTERWITHPHONE;
+import static com.yyrh.constant.URLConstants.RESETPWDWITHPHONE;
+import static com.yyrh.constant.URLConstants.RSAKEY;
+import static com.yyrh.constant.URLConstants.UPLOADROLEINFO;
+import static com.yyrh.constant.URLConstants.USERLOGIN;
+
+
+public class NetRequestApi {
+    public static void init(final Activity activity, final InitCallback initCallback) {
+
+
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_initing")));
+
+        HashMap<String, String> map = getCommonParams();
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+
+        String url = BASEURL + INIT;
+
+        if (BASEURL.equals("http://testsdkapi.yyxxgame.com")) {
+            Toast.makeText(activity, "正在使用测试环境,请勿上线" + BASEURL, Toast.LENGTH_SHORT).show();
+        }
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+                YYLog.i(errorMessage);
+
+
+                initCallback.onInitError(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+
+            }
+
+            @Override
+            public void onResponse(String response) {
+                ProgressDialogUtils.dismiss();
+
+                try {
+                    JSONObject json = new JSONObject(response);
+                    int code = json.optInt("code", -1);
+                    String msg = json.optString("msg", "");
+                    if (code != 1) {
+                        initCallback.onInitFailed(msg);
+                        return;
+                    }
+                    JSONObject data = json.getJSONObject("data");
+                    int state = data.optInt("sdk_login", 100);
+
+                    if (state == 1) {
+                        if (channelTag.equals(CHANNELZTAG)) {
+                            isThirdLogin = false;
+                        } else {
+                            isThirdLogin = true;
+                        }
+
+
+                    } else {
+                        SDKSettings.UserCentUrl = data.optString("h5_web_host", "");
+                        isThirdLogin = false;
+                    }
+
+
+                    SwitchUtil.ControlKFSwitch(data.optInt("bswitch"));
+
+                    YYLog.i("初始化成功。");
+                    initCallback.onInitSuccess("init success");
+
+                } catch (JSONException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        });
+
+    }
+
+    public static void loginWithYy(boolean isShowPrg, final Activity activity, String account, String password, final LoginCallback loginCallback) {
+        if (isShowPrg){
+            ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_logging")));
+        }
+
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
+
+
+        String uname_pwd = null;
+
+        try {
+            uname_pwd = SignUtils.encryptRsaByPublicKey(RSAKEY, account + "|" + password);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        map.put("uname_pwd", uname_pwd);
+        map.put("package_name", SDKSettings.package_name);
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+        String url = BASEURL + USERLOGIN;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+                new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip"))).show();
+
+                loginCallback.onLoginError(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                JSONObject data = null;
+                try {
+                    json = new JSONObject(response);
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+
+                    YYLog.i("登录失败:" + json.optString("msg", "登录失败"));
+                    loginCallback.onLoginFailed(json.optString("msg", "登录失败"));
+                    return;
+                }
+                String token = data.optString("token", "");
+
+
+                SDKSettings.UNAME = data.optString("uname", "");
+                SDKSettings.CHANNELUID = data.optString("channel_uid", "");
+                SDKSettings.USER_BIRTHDAY = data.optString("rn_bd", "");
+                SDKSettings.LOGINTAG = LOGIN;
+                int is_rn = data.optInt("is_rn");
+                if (is_rn == 0) {
+                    SDKSettings.isVefityRealName = false;
+                } else {
+                    SDKSettings.isVefityRealName = true;
+                }
+
+                YYLog.i("登录成功。+ token:" + token);
+
+                loginCallback.onLoginSuccess(token);
+
+            }
+        });
+
+    }
+
+    public static void registerWithYy(final Activity activity, String account, String password, final RegisterCallback registerCallback) {
+
+        if (ProgressDialogUtils.isShowing()) {
+            return;
+        }
+
+
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_registering")));
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
+
+
+        String uname_pwd = null;
+
+        try {
+            uname_pwd = SignUtils.encryptRsaByPublicKey(RSAKEY, account + "|" + password);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        map.put("uname_pwd", uname_pwd);
+        map.put("package_name", SDKSettings.package_name);
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+
+        String url = BASEURL + FASTREGISTER;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+                registerCallback.onRegisterFailed(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                JSONObject data = null;
+                try {
+                    json = new JSONObject(response);
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+                    YYLog.i("注册账号失败:" + json.optString("msg", "注册失败"));
+                    registerCallback.onRegisterFailed(json.optString("msg", "注册失败"));
+                    return;
+                }
+                String token = data.optString("token", "");
+
+                SDKSettings.UNAME = data.optString("uname", "");
+                SDKSettings.CHANNELUID = data.optString("channel_uid", "");
+
+                YYLog.i("注册账号成功。 token:" + token);
+                registerCallback.onRegisterSuccess(token);
+
+            }
+        });
+
+    }
+
+    public static void loginWithChannel(final Activity activity, String channelLoginInfo, final LoginCallback loginCallback) {
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_logging")));
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("sdk_params", channelLoginInfo);
+
+        map.put("package_name", SDKSettings.package_name);
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + CHANNELLOGIN;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+
+                new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip"))).show();
+
+
+                loginCallback.onLoginError(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+                ProgressDialogUtils.dismiss();
+
+
+                JSONObject json = null;
+                JSONObject data = null;
+                String errMsg = null;
+                try {
+                    json = new JSONObject(response);
+                    errMsg = json.optString("msg", "登录验证失败");
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                    SDKEntry.getSdkInstance().tCallBack.onLoginChannelFail(errMsg);
+                    return;
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+                    YYLog.i("登录验证失败");
+                    String msg = json.optString("msg", "登录验证失败");
+                    loginCallback.onLoginFailed(msg);
+                    SDKEntry.getSdkInstance().tCallBack.onLoginChannelFail(msg);
+                    return;
+                }
+                String token = data.optString("token", "");
+
+                SDKSettings.UNAME = data.optString("uname", "");
+                SDKSettings.CHANNELUID = data.optString("channel_uid", "");
+                SDKSettings.USER_BIRTHDAY = data.optString("rn_bd", "");
+                SDKEntry.getSdkInstance().tCallBack.onLoginChannelSuccess(data.toString());
+                YYLog.i("渠道登录验证成功。token:" + token);
+
+                loginCallback.onLoginSuccess(token);
+            }
+        });
+
+    }
+
+    public static void upLoadingRoleInfo(String type, Activity activity,
+                                         String roleId, String roleName, String roleLevel, String serverId,
+                                         String serverName, String hasGold, String vipLevel, String role_power, String partyId, String partyName, String createTime, String charge) {
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        if (type.equals(Constants.UPLOADTYPE_CREATEROLE)) {
+            map.put("report_role_type", "createRole");
+        } else if (type.equals(Constants.UPLOADTYPE_ENTERGAME)) {
+            map.put("report_role_type", "enterGame");
+        } else if (type.equals(Constants.UPLOADTYPE_LEVELUP)) {
+            map.put("report_role_type", "roleUpgrade");
+            return;
+        }
+        if (partyName.equals("暂无")) {
+            partyName = "";
+        }
+
+
+        if (createTime.length() != 10) {
+            new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_ctime_format_error"))).show();
+
+            return;
+        }
+
+
+        map.put("uname", SDKSettings.UNAME);
+        map.put("channel_uid", SDKSettings.CHANNELUID);
+        map.put("party_id", partyId);
+        map.put("party_name", partyName);
+        map.put("server_id", serverId);
+        map.put("server_name", serverName);
+        map.put("role_id", roleId);
+        map.put("role_name", roleName);
+        map.put("role_level", roleLevel);
+        map.put("vip_level", vipLevel);
+        map.put("role_power", role_power);
+        map.put("role_gold", hasGold);
+        map.put("role_ctime", createTime);
+
+        map.put("role_charge", charge);
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+
+        String url = BASEURL + UPLOADROLEINFO;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                try {
+                    JSONObject json = new JSONObject(response);
+                    int code = json.optInt("code", -1);
+                    if (code == 1) {
+                        YYLog.i("上传角色信息成功。");
+                        return;
+                    } else {
+                        YYLog.i("上传角色信息失败,请检查参数是否为空。");
+                    }
+
+                } catch (JSONException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+
+
+            }
+        });
+
+    }
+
+    public static void payOrderInit(final HashMap<String, Object> map,
+                                    final Activity activity, final PayOrderCallback callback) {
+
+
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_pay_init")));
+        String cp_order_id = (String) map.get("game_no");
+        String money = (String) map.get("pay_money");
+        String server_id = (String) map.get("server_id");
+        String server_name = (String) map.get("server_name");
+        String role_id = (String) map.get("role_id");
+        String role_level = (String) map.get("role_level");
+        String role_name = (String) map.get("role_name");
+        String ext = (String) map.get("ext");
+        String order_name = (String) map.get("order_desc");
+        String product_id = (String) map.get("productId");
+
+
+        if (Utils.judgeStrNull(cp_order_id) || Utils.judgeStrNull(money)
+                || Utils.judgeStrNull(server_id)
+                || Utils.judgeStrNull(server_name)
+                || Utils.judgeStrNull(role_id)
+                || Utils.judgeStrNull(role_name)
+                || Utils.judgeStrNull(ext)
+                || Utils.judgeStrNull(order_name)
+                || Utils.judgeStrNull(product_id)
+        ) {
+            ProgressDialogUtils.dismiss();
+            YYLog.i("下单参数有空值,请检查: " + map.toString());
+            return;
+
+        }
+
+        YYLog.i("下单参数: " + map.toString());
+
+        String app_name = Utils.getApplicationName(activity);
+
+        String role_ctime = (String) map.get("role_ctime");
+        if (Utils.judgeStrNull(role_ctime)) {
+            new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_pls_upload_roleinfo_frist"))).show();
+            ProgressDialogUtils.dismiss();
+            return;
+        }
+
+
+        HashMap<String, String> orderMap = getCommonParams();
+
+
+        orderMap.put("uname", SDKSettings.UNAME);
+        orderMap.put("channel_uid", SDKSettings.CHANNELUID);
+        orderMap.put("cp_order_id", cp_order_id);
+        orderMap.put("money", money);
+        orderMap.put("server_id", server_id);
+        orderMap.put("server_name", server_name);
+        orderMap.put("role_id", role_id);
+        orderMap.put("role_name", role_name);
+        orderMap.put("role_level", role_level);
+        orderMap.put("ext", ext);
+        orderMap.put("order_name", order_name);
+        orderMap.put("app_name", app_name);
+
+        orderMap.put("role_ctime", role_ctime);
+        orderMap.put("product_id", product_id);
+
+
+        String channelOrderExt = ChannelSDK.getInstance().SDKGetOrderExt();
+
+        if (!Utils.judgeStrNull(channelOrderExt)) {
+            orderMap.put("sdk_params", channelOrderExt);
+        }
+
+        if (!Utils.judgeStrNull(order_ext)) {
+            orderMap.put("order_ext", SignUtils.toURLEncoded(SDKSettings.order_ext));
+        }
+
+
+        String url = BASEURL + RECHARGEINT;
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(orderMap, time);
+        orderMap.put("time", time);
+        orderMap.put("sign", paramSign);
+
+        UrlHttpUtil.post(url, orderMap, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+                new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip"))).show();
+
+                callback.onPayFailed(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+                ProgressDialogUtils.dismiss();
+
+                try {
+                    JSONObject json = new JSONObject(response);
+                    int code = json.optInt("code", -1);
+                    if (code != 1) {
+                        String msg = json.optString("msg");
+                        callback.onPayFailed(msg);
+                        return;
+                    }
+
+                    JSONObject data = json.getJSONObject("data");
+                    int state = data.optInt("sdk_pay", 100);
+
+                    if (state == 1) {
+
+                        if (channelTag.equals(CHANNELZTAG)) {
+                            map.put("url", data.optString("pay_web_url", ""));
+                            isThirdPay = false;
+                        } else {
+                            isThirdPay = true;
+                        }
+
+                    } else {
+                        map.put("url", data.optString("pay_web_url", ""));
+                        isThirdPay = false;
+                    }
+                    map.put("order_id", data.optString("order_id", ""));
+                    map.put("3rdext", data.optString("3rdext", ""));
+                    map.put("query_params", data.optString("query_params", ""));
+                    callback.onPaySuccess(map);
+
+                } catch (JSONException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        });
+
+    }
+
+    public static void getPhoneCaptcha(final Activity activity, String phone, String action, final UserPhoneLoginFragment.CaptchaCallback captchaCallback) {
+
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_get_code")));
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("phone", SignUtils.toURLEncoded(phone));
+        map.put("action", SignUtils.toURLEncoded(action));
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + GETCAPTCHA;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+                new TosUtil(activity, "blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip"))).show();
+
+                captchaCallback.onGetFailed(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+                ProgressDialogUtils.dismiss();
+
+
+                JSONObject json = null;
+
+                try {
+                    json = new JSONObject(response);
+
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                    return;
+                }
+                int code = json.optInt("code", -1);
+                if (code == 1) {
+                    captchaCallback.onGetSuccess(json.optString("msg", "验证码发送成功"));
+                } else {
+                    captchaCallback.onGetFailed(json.optString("msg", "验证码发送失败"));
+                }
+
+            }
+        });
+
+    }
+
+    public static void registerWithPhone(final Activity activity, String code, String userInfo, final UserPhoneLoginFragment.PhoneRegisterCallback phoneRegisterCallback) {
+        if (ProgressDialogUtils.isShowing()) {
+            return;
+        }
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_registering")));
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("uname_pwd", userInfo);
+        map.put("sms", SignUtils.toURLEncoded(code));
+        map.put("smt_type", SignUtils.toURLEncoded(SDKSettings.isSimulator));
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + REGISTERWITHPHONE;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+
+                phoneRegisterCallback.onRegisterFailed(activity.getString(ResourceUtil.getStringId(activity, "yyrh_network_error_tip")));
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                JSONObject data = null;
+                try {
+                    json = new JSONObject(response);
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+
+                    YYLog.i("手机注册失败:" + json.optString("msg", "手机注册失败"));
+                    phoneRegisterCallback.onRegisterFailed(json.optString("msg", "手机注册失败"));
+                    return;
+                }
+                String token = data.optString("token", "");
+
+
+                SDKSettings.UNAME = data.optString("uname", "");
+                SDKSettings.CHANNELUID = data.optString("channel_uid", "");
+
+                YYLog.i("手机注册成功,正在登录游戏。+ token:" + token);
+                phoneRegisterCallback.onRegisterSuccess(token);
+            }
+        });
+    }
+
+    /**
+     * 支付回调通用扩展,目前仅应用宝需要用到
+     */
+    public static void payChannelNotify(final HashMap<String, String> payInfo, final String notifyUrl) {
+
+        final HashMap<String, String> ntymap = new HashMap();
+
+        for (Map.Entry<String, String> entry : payInfo.entrySet()) {
+
+
+            ntymap.put(entry.getKey(), SignUtils.toURLEncoded(entry.getValue()));
+
+        }
+        String url = notifyUrl + "?" + SignUtils.encryptParam(ntymap);
+        Message payMsg = new Message();
+        payMsg.what = 1;
+        HashMap<String, String> paydata = new HashMap<>();
+        paydata.put("url", url);
+        payMsg.obj = paydata;
+        new PaymentNotify().sendMessage(payMsg);
+
+    }
+
+    public static void resetPwdWithPhone(Activity activity, String phone, String code, String pwd, final UserRetrievePwdFragment.ResetPwdCallback resetPwdCallback) {
+
+        ProgressDialogUtils.show(activity, activity.getString(ResourceUtil.getStringId(activity, "yyrh_resetpwd")));
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        String uname_pwd = null;
+        try {
+            uname_pwd = SignUtils.encryptRsaByPublicKey(RSAKEY, phone + "|" + pwd + "|" + code);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+
+        map.put("phone_pwd", uname_pwd);
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + RESETPWDWITHPHONE;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                String msg = "";
+                try {
+                    json = new JSONObject(response);
+                    msg = json.optString("msg");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+
+                    resetPwdCallback.onResetFailed(msg);
+
+                    return;
+                }
+
+                resetPwdCallback.onResetSuccess(msg);
+
+
+            }
+        });
+
+
+    }
+
+    public static void upLoadUserRealNameInfo(String report_type, String channelRealNameInfo) {
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("channel_uid", SignUtils.toURLEncoded(SDKSettings.CHANNELUID));
+        map.put("uname", SignUtils.toURLEncoded(SDKSettings.UNAME));
+        map.put("report_type", report_type);
+        map.put("sdk_params", channelRealNameInfo);
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+        String url = BASEURL + REALNAMERECORD;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+
+                try {
+                    json = new JSONObject(response);
+
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+
+                if (code == 1) {
+                    String rn_bd = "";
+                    try {
+                        JSONObject data = json.getJSONObject("data");
+                        rn_bd = data.optString("rn_bd", "");
+                    } catch (JSONException e) {
+                        e.printStackTrace();
+                    }
+                    SDKSettings.USER_BIRTHDAY = rn_bd;
+
+                }
+
+
+            }
+        });
+
+    }
+
+    public static void recordUserRealNameInfo(Activity activity, String report_type, String channelRealNameInfo) {
+
+        HashMap<String, String> map = getCommonParams();
+
+
+        map.put("channel_uid", SignUtils.toURLEncoded(SDKSettings.CHANNELUID));
+        map.put("uname", SignUtils.toURLEncoded(SDKSettings.UNAME));
+        map.put("report_type", report_type);
+        map.put("sdk_params", channelRealNameInfo);
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + REALNAMERECORD;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                ProgressDialogUtils.dismiss();
+
+
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                String msg = "";
+                try {
+                    json = new JSONObject(response);
+                    msg = json.optString("msg");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code", -1);
+                if (code != 1) {
+
+                    SDKEntry.getSdkInstance().realNameMsgCallback.onLoadRealNameMsg(false, "");
+                } else {
+                    String rn_bd = "";
+                    try {
+                        JSONObject data = json.getJSONObject("data");
+                        rn_bd = data.optString("rn_bd", "");
+                    } catch (JSONException e) {
+                        e.printStackTrace();
+                    }
+                    SDKSettings.USER_BIRTHDAY = rn_bd;
+                    SDKEntry.getSdkInstance().realNameMsgCallback.onLoadRealNameMsg(true, rn_bd);
+                }
+
+
+            }
+        });
+
+
+    }
+
+    public static void queryOrder(String order_id, final HashMap<String, Object> payMap) {
+        HashMap<String, String> map = getCommonParams();
+
+
+        String query_params = (String) payMap.get("query_params");
+
+        YYLog.i("begin query order,order_id:" + order_id + "----  and query_params:" + query_params);
+        if (Utils.judgeStrNull(query_params)) {
+            return;
+        }
+
+
+        map.put("order_id", SignUtils.toURLEncoded(order_id));
+        map.put("package_name", SDKSettings.package_name);
+
+
+        map.put("query_params", query_params);
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + QUERYORDER;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                YYLog.i(errorMessage);
+            }
+
+            @Override
+            public void onResponse(String response) {
+
+                JSONObject json = null;
+                JSONObject data = null;
+                try {
+                    json = new JSONObject(response);
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+
+                int code = json.optInt("code", -1);
+
+                YYLog.i(response);
+                if (code == 1) {
+
+                    int orderStatus = data.optInt("order_status");
+
+                    if (orderStatus == 1) {
+                        SDKEntry.getSdkInstance().adSdkCallback.onPaySuccess(payMap);
+                    }
+                }
+
+
+            }
+        });
+
+    }
+
+    public static void initAgreement(Activity activity, final ShowPolicyCallback showPolicyCallback) {
+
+
+        HashMap<String, String> map = new HashMap();
+
+        String game_code = Utils.GetApplicationMetaData(activity, "yyrh_game_code");
+
+        String gcp_code = Utils.getParamCnfValuebyKey(activity, "YyrhParam.cnf",
+                "GCP_CODE");
+
+        map.put("game_code", game_code);
+        map.put("gcp_code", gcp_code);
+
+
+        String time = SignUtils.toURLEncoded(System.currentTimeMillis() / 1000 + "");
+        String paramSign = SignUtils.paramSign(map, time);
+
+        map.put("time", time);
+        map.put("sign", paramSign);
+
+        String url = BASEURL + AGREEMENTINIT;
+
+        UrlHttpUtil.post(url, map, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+
+                showPolicyCallback.onError();
+            }
+
+            @Override
+            public void onResponse(String response) {
+                ProgressDialogUtils.dismiss();
+
+                JSONObject json = null;
+                JSONObject data = null;
+                try {
+                    json = new JSONObject(response);
+                    data = json.getJSONObject("data");
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+
+                int code = json.optInt("code", -1);
+
+                YYLog.i(response);
+                if (code == 1) {
+
+                    String agreement_url = data.optString("agreement_url");
+                    if (Utils.judgeStrNull(agreement_url)) {
+                        showPolicyCallback.onHide();
+                    } else {
+                        showPolicyCallback.onShow(agreement_url);
+                    }
+
+
+                }
+
+            }
+        });
+    }
+
+    private static HashMap<String, String> getCommonParams() {
+        HashMap<String, String> map = new HashMap();
+
+        map.put("game_code", SignUtils.toURLEncoded(SDKSettings.game_code));
+        map.put("gcp_code", SignUtils.toURLEncoded(SDKSettings.gcp_code));
+        map.put("cs_ver", SignUtils.toURLEncoded(SDKSettings.SDK_VERSION));
+        map.put("system", SignUtils.toURLEncoded(SDKSettings.system));
+        map.put("ifa", SignUtils.toURLEncoded(SDKSettings.imei));
+        map.put("device_ver", SignUtils.toURLEncoded(SDKSettings.version));
+        map.put("sp_code", SignUtils.toURLEncoded(SDKSettings.sp_code));
+
+        map.put("device_model", SignUtils.toURLEncoded(SDKSettings.device_model));
+        map.put("package_name", SDKSettings.package_name);
+        map.put("ifa_type", SDKSettings.ifa_type);
+        map.put("android_id", SDKSettings.android_id);
+
+        if (!Utils.judgeStrNull(SDKSettings.o_cfg)) {
+            map.put("o_cfg", SDKSettings.o_cfg);
+            YYLog.i("o_cfg : " + SDKSettings.o_cfg);
+        } else {
+            YYLog.i("o_cfg is null");
+        }
+
+        return map;
+    }
+
+}

+ 256 - 0
hnqj/src/main/java/com/yyrh/networking/urlhttp/CallBackUtil.java

@@ -0,0 +1,256 @@
+package com.yyrh.networking.urlhttp;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Handler;
+import android.os.Looper;
+import android.widget.ImageView;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * Created by fighting on 2017/4/7.
+ */
+
+public abstract class CallBackUtil<T> {
+    static Handler mMainHandler = new Handler(Looper.getMainLooper());
+
+
+    public  void onProgress(float progress, long total ){}
+
+    void onError(final RealResponse response){
+
+        final String errorMessage;
+        if(response.inputStream != null){
+            errorMessage = getRetString(response.inputStream);
+        }else if(response.errorStream != null) {
+            errorMessage = getRetString(response.errorStream);
+        }else if(response.exception != null) {
+            errorMessage = response.exception.getMessage();
+        }else {
+            errorMessage = "";
+        }
+        mMainHandler.post(new Runnable() {
+            @Override
+            public void run() {
+
+                onFailure(response.code,errorMessage);
+
+            }
+        });
+    }
+    void onSeccess(RealResponse response){
+        final T obj = onParseResponse(response);
+        mMainHandler.post(new Runnable() {
+            @Override
+            public void run() {
+                onResponse(obj);
+            }
+        });
+    }
+
+
+    /**
+     * 解析response,执行在子线程
+     */
+    public abstract T onParseResponse(RealResponse response);
+
+    /**
+     * 访问网络失败后被调用,执行在UI线程
+     */
+    public abstract void onFailure(int code,String errorMessage);
+
+    /**
+     *
+     * 访问网络成功后被调用,执行在UI线程
+     */
+    public abstract void onResponse(T response);
+
+
+
+    public static abstract class CallBackDefault extends CallBackUtil<RealResponse> {
+        @Override
+        public RealResponse onParseResponse(RealResponse response) {
+            return response;
+        }
+    }
+
+    public static abstract class CallBackString extends CallBackUtil<String> {
+        @Override
+        public String onParseResponse(RealResponse response) {
+            try {
+                return getRetString(response.inputStream);
+            } catch (Exception e) {
+                throw new RuntimeException("failure");
+            }
+        }
+    }
+
+
+    public static abstract class CallBackBitmap extends CallBackUtil<Bitmap> {
+        private int mTargetWidth;
+        private int mTargetHeight;
+
+        public CallBackBitmap(){};
+        public CallBackBitmap(int targetWidth,int targetHeight){
+            mTargetWidth = targetWidth;
+            mTargetHeight = targetHeight;
+        };
+        public CallBackBitmap(ImageView imageView){
+            int width = imageView.getWidth();
+            int height = imageView.getHeight();
+            if(width <=0 || height <=0){
+                throw new RuntimeException("无法获取ImageView的width或height");
+            }
+            mTargetWidth = width;
+            mTargetHeight = height;
+        };
+        @Override
+        public Bitmap onParseResponse(RealResponse response) {
+            if(mTargetWidth ==0 || mTargetHeight == 0){
+                return BitmapFactory.decodeStream(response.inputStream);
+            }else {
+                return getZoomBitmap( response.inputStream);
+            }
+        }
+
+        /**
+         * 压缩图片,避免OOM异常
+         */
+        private Bitmap getZoomBitmap(InputStream inputStream) {
+            byte[] data = null;
+            try {
+                data = input2byte(inputStream);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            BitmapFactory.Options options = new BitmapFactory.Options();
+            options.inJustDecodeBounds = true;
+
+            BitmapFactory.decodeByteArray(data,0,data.length,options);
+            int picWidth = options.outWidth;
+            int picHeight = options.outHeight;
+            int sampleSize = 1;
+            int heightRatio = (int) Math.floor((float) picWidth / (float) mTargetWidth);
+            int widthRatio = (int) Math.floor((float) picHeight / (float) mTargetHeight);
+            if (heightRatio > 1 || widthRatio > 1){
+                sampleSize = Math.max(heightRatio,widthRatio);
+            }
+            options.inSampleSize = sampleSize;
+            options.inJustDecodeBounds = false;
+            Bitmap bitmap = BitmapFactory.decodeByteArray(data,0,data.length,options);
+
+            if(bitmap == null){
+                throw new RuntimeException("Failed to decode stream.");
+            }
+            return bitmap;
+        }
+    }
+
+    public static final byte[] input2byte(InputStream inStream)
+            throws IOException {
+        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
+        byte[] buff = new byte[100];
+        int rc = 0;
+        while ((rc = inStream.read(buff, 0, 100)) > 0) {
+            swapStream.write(buff, 0, rc);
+        }
+        byte[] in2b = swapStream.toByteArray();
+        return in2b;
+    }
+
+    /**
+     * 下载文件时的回调类
+     */
+    public static abstract class CallBackFile extends CallBackUtil<File> {
+
+        private final String mDestFileDir;
+        private final String mdestFileName;
+
+        /**
+         *
+         * @param destFileDir:文件目录
+         * @param destFileName:文件名
+         */
+        public CallBackFile(String destFileDir, String destFileName){
+            mDestFileDir = destFileDir;
+            mdestFileName = destFileName;
+        }
+        @Override
+        public File onParseResponse(RealResponse response) {
+
+            InputStream is = null;
+            byte[] buf = new byte[1024*8];
+            int len = 0;
+            FileOutputStream fos = null;
+            try{
+                is = response.inputStream;
+                final long total = response.contentLength;
+
+                long sum = 0;
+
+                File dir = new File(mDestFileDir);
+                if (!dir.exists()){
+                    dir.mkdirs();
+                }
+                File file = new File(dir, mdestFileName);
+                fos = new FileOutputStream(file);
+                while ((len = is.read(buf)) != -1){
+                    sum += len;
+                    fos.write(buf, 0, len);
+                    final long finalSum = sum;
+                    mMainHandler.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            onProgress(finalSum * 100.0f / total,total);
+                        }
+                    });
+                }
+                fos.flush();
+
+                return file;
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally{
+                try{
+                    fos.close();
+                    if (is != null) is.close();
+                } catch (IOException e){
+                }
+                try{
+                    if (fos != null) fos.close();
+                } catch (IOException e){
+                }
+
+            }
+            return null;
+        }
+    }
+
+
+    private static String getRetString(InputStream is) {
+        String buf;
+        try {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8"));
+            StringBuilder sb = new StringBuilder();
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                sb.append(line + "\n");
+            }
+            is.close();
+            buf = sb.toString();
+            return buf;
+
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+}

+ 243 - 0
hnqj/src/main/java/com/yyrh/networking/urlhttp/RealRequest.java

@@ -0,0 +1,243 @@
+package com.yyrh.networking.urlhttp;
+
+import android.text.TextUtils;
+
+import java.io.BufferedWriter;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by fighting on 2017/4/24.
+ */
+
+ class RealRequest {
+    private static final String BOUNDARY = java.util.UUID.randomUUID().toString();
+    private static final String TWO_HYPHENS = "--";
+    private static final String LINE_END = "\r\n";
+
+    /**
+     * get请求
+     */
+    RealResponse getData(String requestURL, Map<String, String> headerMap){
+        HttpURLConnection conn = null;
+        try {
+            conn= getHttpURLConnection(requestURL,"GET");
+            conn.setDoInput(true);
+            if(headerMap != null){
+                setHeader(conn,headerMap);
+            }
+            conn.connect();
+            return getRealResponse(conn);
+        } catch (Exception e) {
+            return getExceptonResponse(conn, e);
+        }
+    }
+
+    /**
+     * post请求
+     */
+    RealResponse postData(String requestURL, String body, String bodyType, Map<String, String> headerMap) {
+        HttpURLConnection conn = null;
+        try {
+            conn = getHttpURLConnection(requestURL,"POST");
+            conn.setDoOutput(true);//可写出
+            conn.setDoInput(true);//可读入
+            conn.setUseCaches(false);//不是有缓存
+
+            if(!TextUtils.isEmpty(bodyType)) {
+                conn.setRequestProperty("Content-Type", bodyType);
+            }
+            if(headerMap != null){
+                setHeader(conn,headerMap);//请求头必须放在conn.connect()之前
+            }
+            conn.connect();// 连接,以上所有的请求配置必须在这个API调用之前
+            if(!TextUtils.isEmpty(body)) {
+                BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
+                writer.write(body);
+                writer.close();
+            }
+
+            return getRealResponse(conn);
+        } catch (Exception e) {
+            return getExceptonResponse(conn, e);
+        }
+    }
+
+    /**
+     * 上传文件
+     */
+    RealResponse uploadFile(String requestURL, File file,List<File> fileList,Map<String,File> fileMap,String fileKey,String fileType,Map<String,String> paramsMap,Map<String, String> headerMap,CallBackUtil callBack) {
+        HttpURLConnection conn = null;
+        try {
+            conn = getHttpURLConnection(requestURL,"POST");
+            setConnection(conn);
+            if(headerMap != null){
+                setHeader(conn,headerMap);
+            }
+            conn.connect();
+            DataOutputStream outputStream = new DataOutputStream(conn.getOutputStream());
+            if (paramsMap != null) {
+                outputStream.write(getParamsString(paramsMap).getBytes());//上传参数
+                outputStream.flush();
+            }
+            if(file != null) {
+                writeFile(file, fileKey, fileType, outputStream,callBack);//上传文件
+            }else if(fileList != null){
+                for (File f : fileList){
+                    writeFile(f, fileKey, fileType, outputStream,null);
+                }
+            }else if(fileMap != null){
+                for (String key : fileMap.keySet()){
+                    writeFile(fileMap.get(key), key, fileType, outputStream,null);
+                }
+            }
+            byte[] endData = (LINE_END + TWO_HYPHENS + BOUNDARY + TWO_HYPHENS + LINE_END).getBytes();//写结束标记位
+            outputStream.write(endData);
+            outputStream.flush();
+            return getRealResponse(conn);
+        } catch (Exception e) {
+            return getExceptonResponse(conn,e);
+        }
+    }
+
+    /**
+     * 得到Connection对象,并进行一些设置
+     */
+    private HttpURLConnection getHttpURLConnection(String requestURL,String requestMethod) throws IOException {
+        URL url = new URL(requestURL);
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        conn.setConnectTimeout(12*1000);
+        conn.setReadTimeout(12*1000);
+        conn.setRequestMethod(requestMethod);
+        return conn;
+    }
+
+    /**
+     * 设置请求头
+     */
+    private void setHeader(HttpURLConnection conn, Map<String, String> headerMap) {
+        if(headerMap != null){
+            for (String key: headerMap.keySet()){
+                conn.setRequestProperty(key, headerMap.get(key));
+            }
+        }
+    }
+
+    /**
+     * 上传文件时设置Connection参数
+     */
+    private void setConnection(HttpURLConnection conn) throws ProtocolException {
+        conn.setDoOutput(true);
+        conn.setDoInput(true);
+        conn.setUseCaches(false);
+        conn.setRequestProperty("Connection", "Keep-Alive");
+        conn.setRequestProperty("Charset", "UTF-8");
+        conn.setRequestProperty("Content-Type","multipart/form-data; BOUNDARY=" + BOUNDARY);
+    }
+
+    /**
+     * 上传文件时得到拼接的参数字符串
+     */
+    private String getParamsString(Map<String, String> paramsMap) {
+        StringBuffer strBuf = new StringBuffer();
+        for (String key : paramsMap.keySet()){
+            strBuf.append(TWO_HYPHENS);
+            strBuf.append(BOUNDARY);
+            strBuf.append(LINE_END);
+            strBuf.append("Content-Disposition: form-data; name=\"" + key + "\"");
+            strBuf.append(LINE_END);
+
+            strBuf.append("Content-Type: " + "text/plain" );
+            strBuf.append(LINE_END);
+            strBuf.append("Content-Lenght: "+paramsMap.get(key).length());
+            strBuf.append(LINE_END);
+            strBuf.append(LINE_END);
+            strBuf.append(paramsMap.get(key));
+            strBuf.append(LINE_END);
+        }
+        return strBuf.toString();
+    }
+
+    /**
+     * 上传文件时写文件
+     */
+    private void writeFile(File file, String fileKey, String fileType, DataOutputStream outputStream, final CallBackUtil callBack) throws IOException {
+        outputStream.write(getFileParamsString(file, fileKey, fileType).getBytes());
+        outputStream.flush();
+
+        FileInputStream inputStream = new FileInputStream(file);
+        final long total = file.length();
+        long sum = 0;
+        byte[] buffer = new byte[1024*2];
+        int length = -1;
+        while ((length = inputStream.read(buffer)) != -1){
+            outputStream.write(buffer,0,length);
+            sum = sum + length;
+            if(callBack != null){
+                final long finalSum = sum;
+                CallBackUtil.mMainHandler.post(new Runnable() {
+                    @Override
+                    public void run() {
+                        callBack.onProgress(finalSum * 100.0f / total,total);
+                    }
+                });
+            }
+        }
+        outputStream.flush();
+        inputStream.close();
+    }
+
+    /**
+     * 上传文件时得到一定格式的拼接字符串
+     */
+    private String getFileParamsString(File file, String fileKey, String fileType) {
+        StringBuffer strBuf = new StringBuffer();
+        strBuf.append(LINE_END);
+        strBuf.append(TWO_HYPHENS);
+        strBuf.append(BOUNDARY);
+        strBuf.append(LINE_END);
+        strBuf.append("Content-Disposition: form-data; name=\"" + fileKey + "\"; filename=\"" + file.getName() + "\"");
+        strBuf.append(LINE_END);
+        strBuf.append("Content-Type: " + fileType );
+        strBuf.append(LINE_END);
+        strBuf.append("Content-Lenght: "+file.length());
+        strBuf.append(LINE_END);
+        strBuf.append(LINE_END);
+        return strBuf.toString();
+    }
+
+    /**
+     * 当正常返回时,得到Response对象
+     */
+    private RealResponse getRealResponse(HttpURLConnection conn) throws IOException {
+
+        RealResponse response = new RealResponse();
+        response.code = conn.getResponseCode();
+        response.contentLength = conn.getContentLength();
+        response.inputStream = conn.getInputStream();
+        response.errorStream = conn.getErrorStream();
+        return response;
+    }
+
+    /**
+     * 当发生异常时,得到Response对象
+     */
+    private RealResponse getExceptonResponse(HttpURLConnection conn, Exception e) {
+        if(conn != null){
+            conn.disconnect();
+        }
+        e.printStackTrace();
+        RealResponse response = new RealResponse();
+        response.exception = e;
+        return response;
+    }
+
+}

+ 15 - 0
hnqj/src/main/java/com/yyrh/networking/urlhttp/RealResponse.java

@@ -0,0 +1,15 @@
+package com.yyrh.networking.urlhttp;
+
+import java.io.InputStream;
+
+/**
+ * Created by fighting on 2017/4/24.
+ */
+
+public class RealResponse {
+    public InputStream inputStream;
+    public InputStream errorStream;
+    public int code;
+    public long contentLength;
+    public Exception exception;
+}

+ 244 - 0
hnqj/src/main/java/com/yyrh/networking/urlhttp/RequestUtil.java

@@ -0,0 +1,244 @@
+package com.yyrh.networking.urlhttp;
+
+import android.text.TextUtils;
+
+
+import com.yyrh.behavior.ReportLogUtil;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+
+import static com.yyrh.constant.URLConstants.ACTION_LOG_URL;
+
+/**
+ * Created by fighting on 2017/4/24.
+ */
+
+class RequestUtil{
+    private Thread mThread;
+
+    /**
+     * 一般的get请求或post请求
+     */
+    RequestUtil(String method,String url, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        switch (method){
+            case "GET":
+            urlHttpGet(url,paramsMap,headerMap,callBack);
+            break;
+            case "POST":
+            urlHttpPost(url,paramsMap,null,headerMap,callBack);
+            break;
+        }
+    }
+
+    /**
+     * post请求,传递json格式数据。
+     */
+    RequestUtil(String url, String jsonStr, Map<String, String> headerMap, CallBackUtil callBack) {
+        urlHttpPost(url,null,jsonStr,headerMap,callBack);
+    }
+
+    /**
+     * 上传文件
+     */
+    RequestUtil(String url, File file ,List<File> fileList,Map<String,File> fileMap,String fileKey,String fileType, Map<String,String> paramsMap, Map<String, String> headerMap,CallBackUtil callBack) {
+        urlHttpUploadFile(url,file,fileList,fileMap,fileKey,fileType,paramsMap,headerMap,callBack);
+    }
+
+    /**
+     * get请求
+     */
+    private void urlHttpGet(final String url, final Map<String, String> paramsMap, final Map<String, String> headerMap, final CallBackUtil callBack) {
+        mThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                RealResponse response = new RealRequest().getData(getUrl(url,paramsMap),headerMap);
+                if(response.code == HttpURLConnection.HTTP_OK){
+                    callBack.onSeccess(response);
+                }else {
+                    callBack.onError(response);
+                }
+            }
+
+        });
+    }
+
+    /**
+     * post请求
+     */
+    private void urlHttpPost(final String url, final Map<String, String> paramsMap, final String jsonStr, final Map<String, String> headerMap, final CallBackUtil callBack) {
+        mThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                RealResponse response = new RealRequest().postData(url, getPostBody(paramsMap,jsonStr),getPostBodyType(paramsMap,jsonStr),headerMap);
+                if(response.code == HttpURLConnection.HTTP_OK){
+                    callBack.onSeccess(response);
+                }else {
+                    callBack.onError(response);
+
+                    if (!url.startsWith(ACTION_LOG_URL)){
+                        resportErrorLog(url,response);
+                    }
+
+                }
+
+            }
+
+        });
+
+    }
+
+    /**
+     * 上报接口错误日志
+     */
+    private void  resportErrorLog(String url,RealResponse response){
+
+
+        String errorMessage = "";
+        if(response.inputStream != null){
+            errorMessage = getRetString(response.inputStream);
+        }else if(response.errorStream != null) {
+            errorMessage = getRetString(response.errorStream);
+        }else if(response.exception != null) {
+            errorMessage = response.exception.getMessage();
+        }else {
+            errorMessage = "";
+        }
+
+
+        String tag =url.split("/")[url.split("/").length-1];
+
+        JSONObject json = new JSONObject();
+        try {
+            json.put("errorMessage",errorMessage);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        ReportLogUtil.reportErrorLog(tag,tag,json.toString());
+    }
+
+    /**
+     * 上传文件
+     */
+    private void urlHttpUploadFile(final String url, final File file , final List<File> fileList, final Map<String,File> fileMap, final String fileKey, final String fileType, final Map<String,String> paramsMap, final Map<String, String> headerMap, final CallBackUtil callBack) {
+        mThread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                RealResponse response = null;
+                response = new RealRequest().uploadFile(url, file,fileList,fileMap,fileKey,fileType,paramsMap,headerMap,callBack);
+                if(response.code == HttpURLConnection.HTTP_OK){
+                    callBack.onSeccess(response);
+                }else {
+                    callBack.onError(response);
+                }
+            }
+
+        });
+    }
+
+
+
+    /**
+     * get请求,将键值对凭接到url上
+     */
+    private String getUrl(String path,Map<String, String> paramsMap) {
+        if(paramsMap != null){
+            path = path+"?";
+            for (String key: paramsMap.keySet()){
+                path = path + key+"="+paramsMap.get(key)+"&";
+            }
+            path = path.substring(0,path.length()-1);
+        }
+        return path;
+    }
+
+    /**
+     * 得到post请求的body
+     */
+    private  String getPostBody(Map<String, String> params,String jsonStr) {//throws UnsupportedEncodingException {
+        if(params != null){
+            return getPostBodyFormParameMap(params);
+        }else if(!TextUtils.isEmpty(jsonStr)){
+            return jsonStr;
+        }
+        return null;
+    }
+
+
+    /**
+     * 根据键值对参数得到body
+     */
+    private  String getPostBodyFormParameMap(Map<String, String> params) {//throws UnsupportedEncodingException {
+        StringBuilder result = new StringBuilder();
+        boolean first = true;
+        try {
+            for (Map.Entry<String, String> entry : params.entrySet()) {
+                if (first)
+                    first = false;
+                else
+                    result.append("&");
+                result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
+                result.append("=");
+                result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
+            }
+            return result.toString();
+        } catch (UnsupportedEncodingException e) {
+            return null;
+        }
+
+    }
+
+    /**
+     * 得到bodyType
+     */
+    private String getPostBodyType(Map<String, String> paramsMap, String jsonStr) {
+        if(paramsMap != null){
+            //return "text/plain";不知为什么这儿总是报错。目前暂不设置(20170424)
+            return null;
+        }else if(!TextUtils.isEmpty(jsonStr)){
+            return "application/json;charset=utf-8";
+        }
+        return null;
+    }
+
+
+    /**
+     * 开启子线程,调用run方法
+     */
+    void execute(){
+        if(mThread != null){
+            mThread.start();
+        }
+    }
+
+
+    private static String getRetString(InputStream is) {
+        String buf;
+        try {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8"));
+            StringBuilder sb = new StringBuilder();
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                sb.append(line + "\n");
+            }
+            is.close();
+            buf = sb.toString();
+            return buf;
+
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+
+}

+ 254 - 0
hnqj/src/main/java/com/yyrh/networking/urlhttp/UrlHttpUtil.java

@@ -0,0 +1,254 @@
+package com.yyrh.networking.urlhttp;
+
+import com.yyrh.utils.YYLog;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by fighting on 2017/4/24.
+ */
+
+public class UrlHttpUtil {
+    private static final String METHOD_GET = "GET";
+    private static final String METHOD_POST = "POST";
+
+    public static final String FILE_TYPE_FILE = "file/*";
+    public static final String FILE_TYPE_IMAGE = "image/*";
+    public static final String FILE_TYPE_AUDIO = "audio/*";
+    public static final String FILE_TYPE_VIDEO = "video/*";
+
+    /**
+     * get请求
+     * @param url:url
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void get(String url, CallBackUtil callBack) {
+        get(url, null, null, callBack);
+    }
+
+    /**
+     * get请求,可以传递参数
+     * @param url:url
+     * @param paramsMap:map集合,封装键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void get(String url, Map<String, String> paramsMap, CallBackUtil callBack) {
+        get(url, paramsMap, null, callBack);
+    }
+
+    /**
+     * get请求,可以传递参数
+     * @param url:url
+     * @param paramsMap:map集合,封装键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void get(String url, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(METHOD_GET, url, paramsMap, headerMap, callBack).execute();
+    }
+
+    /**
+     * post请求
+     * @param url:url
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void post(String url, CallBackUtil callBack) {
+        post(url, null, callBack);
+    }
+
+    /**
+     * post请求,可以传递参数
+     * @param url:url
+     * @param paramsMap:map集合,封装键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void post(String url, Map<String, String> paramsMap, CallBackUtil callBack) {
+        YYLog.i(url + "------" + paramsMap.toString());
+        post(url, paramsMap, null, callBack);
+    }
+
+    /**
+     * post请求,可以传递参数
+     * @param url:url
+     * @param paramsMap:map集合,封装键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void post(String url, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(METHOD_POST,url,paramsMap,headerMap,callBack).execute();
+    }
+    /**
+     * post请求,可以传递参数
+     * @param url:url
+     * @param jsonStr:json格式的键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void postJson(String url, String jsonStr, CallBackUtil callBack) {
+        postJson(url, jsonStr, null, callBack);
+    }
+
+    /**
+     * post请求,可以传递参数
+     * @param url:url
+     * @param jsonStr:json格式的键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void postJson(String url, String jsonStr, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(url,jsonStr,headerMap,callBack).execute();
+    }
+
+
+
+
+    /**
+     * post请求,上传单个文件
+     * @param url:url
+     * @param file:File对象
+     * @param fileKey:上传参数时file对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。还可以重写onProgress方法,得到上传进度
+     */
+    public static void uploadFile(String url, File file, String fileKey, String fileType, CallBackUtil callBack) {
+        uploadFile(url, file, fileKey,fileType, null, callBack);
+    }
+
+    /**
+     * post请求,上传单个文件
+     * @param url:url
+     * @param file:File对象
+     * @param fileKey:上传参数时file对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。还可以重写onProgress方法,得到上传进度
+     */
+    public static void uploadFile(String url, File file, String fileKey, String fileType, Map<String, String> paramsMap, CallBackUtil callBack) {
+        uploadFile(url, file,fileKey, fileType, paramsMap, null, callBack);
+    }
+
+    /**
+     * post请求,上传单个文件
+     * @param url:url
+     * @param file:File对象
+     * @param fileKey:上传参数时file对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。还可以重写onProgress方法,得到上传进度
+     */
+    public static void uploadFile(String url, File file, String fileKey, String fileType, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(url,file,null,null,fileKey,fileType,paramsMap,headerMap,callBack).execute();
+    }
+
+
+    /**
+     * post请求,上传多个文件,以list集合的形式
+     * @param url:url
+     * @param fileList:集合元素是File对象
+     * @param fileKey:上传参数时fileList对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadListFile(String url, List<File> fileList, String fileKey, String fileType, CallBackUtil callBack) {
+        uploadListFile(url, fileList, fileKey, fileType,null, callBack);
+    }
+
+    /**
+     * post请求,上传多个文件,以list集合的形式
+     * @param url:url
+     * @param fileList:集合元素是File对象
+     * @param fileKey:上传参数时fileList对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadListFile(String url, List<File> fileList, String fileKey, String fileType, Map<String, String> paramsMap, CallBackUtil callBack) {
+        uploadListFile(url, fileList, fileKey, fileType,paramsMap, null, callBack);
+    }
+
+    /**
+     * post请求,上传多个文件,以list集合的形式
+     * @param url:url
+     * @param fileList:集合元素是File对象
+     * @param fileKey:上传参数时fileList对应的键
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadListFile(String url, List<File> fileList, String fileKey, String fileType, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(url,null,fileList,null,fileKey,fileType,paramsMap,headerMap,callBack).execute();
+    }
+
+    /**
+     * post请求,上传多个文件,以map集合的形式
+     * @param url:url
+     * @param fileMap:集合key是File对象对应的键,集合value是File对象
+     * @param fileType:File类型,是image,video,audio,file
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadMapFile(String url, Map<String, File> fileMap, String fileType, CallBackUtil callBack) {
+        uploadMapFile(url, fileMap, fileType, null, callBack);
+    }
+
+    /**
+     * post请求,上传多个文件,以map集合的形式
+     * @param url:url
+     * @param fileMap:集合key是File对象对应的键,集合value是File对象
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadMapFile(String url, Map<String, File> fileMap, String fileType, Map<String, String> paramsMap, CallBackUtil callBack) {
+        uploadMapFile(url, fileMap, fileType, paramsMap, null, callBack);
+    }
+
+    /**
+     * post请求,上传多个文件,以map集合的形式
+     * @param url:url
+     * @param fileMap:集合key是File对象对应的键,集合value是File对象
+     * @param fileType:File类型,是image,video,audio,file
+     * @param paramsMap:map集合,封装键值对参数
+     * @param headerMap:map集合,封装请求头键值对
+     * @param callBack:回调接口,onFailure方法在请求失败时调用,onResponse方法在请求成功后调用,这两个方法都执行在UI线程。
+     */
+    public static void uploadMapFile(String url, Map<String, File> fileMap, String fileType, Map<String, String> paramsMap, Map<String, String> headerMap, CallBackUtil callBack) {
+        new RequestUtil(url,null,null,fileMap,null,fileType,paramsMap,headerMap,callBack).execute();
+    }
+
+    /**
+     * 加载图片
+     */
+    public static void getBitmap(String url, CallBackUtil.CallBackBitmap callBack) {
+        getBitmap(url, null, callBack);
+    }
+    /**
+     * 加载图片,带参数
+     */
+    public static void getBitmap(String url,Map<String, String> paramsMap,  CallBackUtil.CallBackBitmap callBack) {
+        get(url, paramsMap, null, callBack);
+    }
+
+    /**
+     * 下载文件,不带参数
+     */
+    public static void downloadFile(String url, CallBackUtil.CallBackFile callBack) {
+        downloadFile(url,null,callBack);
+    }
+
+    /**
+     * 下载文件,带参数
+     */
+    public static void downloadFile(String url, Map<String, String> paramsMap, CallBackUtil.CallBackFile callBack) {
+        downloadFile(url, paramsMap, null, callBack);
+    }
+    /**
+     * 下载文件,带参数,带请求头
+     */
+    public static void downloadFile(String url, Map<String, String> paramsMap,Map<String, String> headerMap, CallBackUtil.CallBackFile callBack) {
+        get(url, paramsMap, headerMap, callBack);
+    }
+
+}

+ 117 - 0
hnqj/src/main/java/com/yyrh/pay/PaymentNotify.java

@@ -0,0 +1,117 @@
+package com.yyrh.pay;
+
+
+import android.os.Handler;
+import android.os.Message;
+
+import com.yyrh.networking.urlhttp.CallBackUtil;
+import com.yyrh.networking.urlhttp.UrlHttpUtil;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.utils.YYLog;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Date;
+import java.util.HashMap;
+
+public class PaymentNotify extends Handler {
+    private static final int MAX_TIME = 5;
+
+    @Override
+    public void handleMessage(final Message msg) {
+        super.handleMessage(msg);
+        final HashMap<String, String> payInfo = (HashMap<String, String>) msg.obj;
+        String url = payInfo.get("url");
+       // url = "http://testmixplatformapi.yyxxgame.com:9003/client_test";
+        int times = 0;
+
+        if (payInfo.containsKey("resend_times")) {
+            times = Integer.valueOf(payInfo.get("resend_times")).intValue();
+            payInfo.remove("resend_times");
+        }
+
+        final int finalTimes = times;
+        UrlHttpUtil.post(url, new CallBackUtil.CallBackString() {
+            @Override
+            public void onFailure(int code, String errorMessage) {
+                if (finalTimes < MAX_TIME) {
+                    payInfo.put("resend_times", finalTimes + 1 + "");
+                    Message msg = new Message();
+                    msg.what = 1;
+                    msg.obj = payInfo;
+
+                    YYLog.i( "PaymentNotify-payInfo: NetWork Error" + payInfo.toString());
+
+                    switch (finalTimes) {
+
+                        case 0:
+                            sendMessageDelayed(msg, 10000);
+                            break;
+                        case 1:
+                            sendMessageDelayed(msg, 30000);
+                            break;
+                        case 2:
+                            sendMessageDelayed(msg, 60000);
+                            break;
+                        case 3:
+                            sendMessageDelayed(msg, 180000);
+                            break;
+                        case 4:
+                            sendMessageDelayed(msg, 300000);
+                            break;
+
+                    }
+                }
+            }
+
+            @Override
+            public void onResponse(String response) {
+                JSONObject json = null;
+
+                try {
+                    json = new JSONObject(response);
+
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
+                int code = json.optInt("code",-1);
+                if (code != 1 && finalTimes < MAX_TIME){
+                    payInfo.put("resend_times", finalTimes + 1 + "");
+                    Message msg = new Message();
+                    msg.what = 1;
+                    msg.obj = payInfo;
+
+                    YYLog.i( "PaymentNotify-payInfo:" + payInfo.toString());
+                    switch (finalTimes){
+                        case 0:
+
+                            sendMessageDelayed(msg, 10000);
+                            break;
+                        case 1:
+
+                            sendMessageDelayed(msg, 30000);
+                            break;
+                        case 2:
+
+                            sendMessageDelayed(msg, 60000);
+                            break;
+                        case 3:
+
+                            sendMessageDelayed(msg, 180000);
+                            break;
+                        case 4:
+
+                            sendMessageDelayed(msg, 300000);
+                            break;
+
+                    }
+
+                }else{
+
+                    SDKEntry.getSdkInstance().payCall.onPaySuccess("pay success");
+                }
+            }
+        });
+    }
+}

+ 192 - 0
hnqj/src/main/java/com/yyrh/pay/WvPayYyrhDialog.java

@@ -0,0 +1,192 @@
+package com.yyrh.pay;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.webkit.DownloadListener;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.ui.PageJsInteraction;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.ui.BaseDialog;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+
+
+public class WvPayYyrhDialog extends BaseDialog implements View.OnClickListener{
+
+
+    private Context context;
+    private WebView webView;
+    private WebSettings webSettings;
+    private String url,orderId;
+    private ImageView iv_reback_close;
+    private  HashMap<String, Object> payMap;
+
+    public WvPayYyrhDialog(Context context) {
+        super(context);
+        this.context = context;
+    }
+
+
+    public WvPayYyrhDialog(Context context, int theme, String url, HashMap<String, Object> map) {
+        super(context, theme);
+        this.context = context;
+        this.payMap = map;
+        this.url = url;
+
+    }
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        if (SDKSettings.isLandscape){
+            setContentView(ResourceUtil.getLayoutId(context,
+                    "yyrh_pay_webview_landscape"));
+        } else {
+        setContentView(ResourceUtil.getLayoutId(context,
+                "yyrh_pay_webview_portrait"));
+        }
+
+        iv_reback_close = findViewById(ResourceUtil.getId(context,
+                "iv_reback_close"));
+        iv_reback_close.setOnClickListener(this);
+
+        webView = findViewById(ResourceUtil.getId(context,
+                "wb_with_xd"));
+
+
+
+        webSettings = webView.getSettings();
+        webSettings.setAllowFileAccess(true);
+        webSettings.setJavaScriptEnabled(true);
+        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
+
+        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
+        webSettings.setBuiltInZoomControls(false);// 设置支持缩放
+        webSettings.setDomStorageEnabled(true);
+        webView.addJavascriptInterface(new PageJsInteraction(this), "yyrhsdk");
+        webView.setHorizontalScrollBarEnabled(false);//水平不显示
+        webView.setVerticalScrollBarEnabled(false); //垂直不显示
+        webView.setWebChromeClient(new WebChromeClient());
+        webView.setWebViewClient(new WebViewClient(){
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView view, String url) {
+                String httpHead = url.substring(0, 5);
+                if (httpHead.equals("http:") || httpHead.equals("https")) {
+                    return super.shouldOverrideUrlLoading(view, url);
+                } else if (url.equals("yyrhsdk://pay_close")) {
+
+                    dismiss();
+
+                    return true;
+
+                } else if (url.equals("yyrhsdk://pay_success")) {
+                    dismiss();
+                    return true;
+                } else {
+                    if (httpHead.equals("yyrhsdk")) {
+                        toDoHttp_https(url);
+                        return true;
+                    } else {
+                        openWXPay(url);
+                        return true;
+                    }
+                }
+            }
+
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                super.onPageFinished(view, url);
+
+            }
+
+            private void toDoHttp_https(String url) {
+                String[] strArray = url.split("=");
+                String strurl = Utils.decoBase64(strArray[1]);
+                String code_url = null;
+                try {
+                    JSONObject json = new JSONObject(strurl);
+                    code_url = json.getString("code_url");
+                } catch (JSONException e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                }
+                openWXPay(code_url);
+
+
+            }
+
+            private void openWXPay(String code_url) {
+                try {
+                    Intent it = new Intent(Intent.ACTION_VIEW);
+                    it.setData(Uri.parse(code_url));
+                    context.startActivity(it);
+                } catch (Exception e) {
+
+                }
+            }
+        });
+
+        webView.setDownloadListener(new DownloadListener() {
+            @Override
+            public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
+                Uri uri = Uri.parse(url);
+                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                context.startActivity(intent);
+            }
+        });
+
+
+        webView.loadUrl(url);
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == ResourceUtil.getId(context, "iv_reback_close")) {
+            dismiss();
+
+        }
+    }
+
+    @Override
+    public void dismiss() {
+        super.dismiss();
+        if (!Utils.judgeStrNull(orderId)){
+            YyrhSdkManager.defaultManager(context).queryOrder(orderId,this.payMap);
+        }
+    }
+
+
+    @Override
+    public void zfOrder(String message) {
+        super.zfOrder(message);
+        orderId = message;
+    }
+
+    @Override
+    public void zfColse() {
+        super.zfColse();
+        dismiss();
+    }
+
+    @Override
+    public void showJsMsg(String message) {
+        super.showJsMsg(message);
+        new TosUtil(context,"blue",  message).show();
+    }
+}

+ 539 - 0
hnqj/src/main/java/com/yyrh/sdk/SDKEntry.java

@@ -0,0 +1,539 @@
+package com.yyrh.sdk;
+
+import android.app.Activity;
+
+import android.content.Intent;
+
+
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+
+
+import com.yyrh.advertisement.AdSdkCallback;
+import com.yyrh.advertisement.AdvertiseManager;
+import com.yyrh.constant.RoleInfo;
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.factory.SdkManager;
+import com.yyrh.imei.ImeiUtil;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yyrh.sdk.callback.ShowPolicyCallback;
+import com.yyrh.sdk.callback.UserPolicyCallback;
+import com.yyrh.utils.PermissionUtils;
+import com.yyrh.utils.ResourceUtil;
+
+import com.yyrh.easypermission.EasyPermission;
+import com.yyrh.easypermission.GrantResult;
+
+import com.yyrh.easypermission.Permission;
+import com.yyrh.easypermission.PermissionRequestListener;
+
+
+import com.yyrh.ui.GameSplashDialog;
+import com.yyrh.utils.TosUtil;
+import com.yythird.base.ChannelSdkCallback;
+import com.yythird.sdk.ChannelSDK;
+import com.yyrh.utils.Utils;
+import com.yyrh.utils.YYLog;
+
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.sdk.callback.ExitCallback;
+import com.yyrh.sdk.callback.InitCallback;
+import com.yyrh.sdk.callback.LoginCallback;
+import com.yyrh.sdk.callback.LogoutCallback;
+import com.yyrh.sdk.callback.PayCallback;
+import com.yyrh.sdk.callback.PayOrderCallback;
+
+
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+import static com.yyrh.constant.SDKSettings.sp_code;
+
+
+public class SDKEntry {
+
+    public InitCallback initCall;
+    public LoginCallback loginCall;
+    public PayCallback payCall;
+    public LogoutCallback logoutCall;
+    public ExitCallback exitCall;
+    public RealNameMsgCallback realNameMsgCallback;
+    public Activity gameAct;
+
+    private ChannelSDK sdk = null;
+
+
+    private YyrhSdkManager manager = null;
+
+    private static volatile SDKEntry sdkInstance = null;
+
+    private  String role_ctime="";
+
+    public AdSdkCallback adSdkCallback = new AdSdkCallback() {
+        @Override
+        public void onRegisterSuccess(String msg) {
+
+            AdvertiseManager.defaultManager(gameAct).registration(gameAct,msg);
+        }
+
+        @Override
+        public void onLoginSuccess(String msg) {
+            AdvertiseManager.defaultManager(gameAct).login(gameAct,msg);
+        }
+
+        @Override
+        public void onPaySuccess(HashMap<String, Object> map) {
+            AdvertiseManager.defaultManager(gameAct).paymentFinish(gameAct,map);
+        }
+
+        @Override
+        public void onCreateOrder(HashMap<String, Object> map) {
+            AdvertiseManager.defaultManager(gameAct).callPayment(gameAct,map);
+        }
+
+        @Override
+        public void onUpLoadRoleInfo(String type, RoleInfo roleInfo) {
+            AdvertiseManager.defaultManager(gameAct).upLoadRoleInfo(gameAct,type,roleInfo);
+        }
+
+        @Override
+        public void onResume(Activity activity) {
+            AdvertiseManager.defaultManager(activity).onResume(activity);
+        }
+
+        @Override
+        public void onPause(Activity activity) {
+            AdvertiseManager.defaultManager(activity).onPause(activity);
+        }
+
+        @Override
+        public void onDestory(Activity activity) {
+            AdvertiseManager.defaultManager(activity).onDestory(activity);
+
+        }
+
+        @Override
+        public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+            AdvertiseManager.defaultManager(gameAct).onRequestPermissionsResult(requestCode,permissions,grantResults);
+        }
+
+        @Override
+        public void onExitGame(Activity activity) {
+            AdvertiseManager.defaultManager(activity).onExitGame(activity);
+        }
+    };
+
+    public ChannelSdkCallback tCallBack = new ChannelSdkCallback() {
+
+        @Override
+        public void onSetChannelTagCallback(String msg) {
+
+        }
+
+        @Override
+        public void onInitCallback(boolean success, String msg) {
+
+                if (success){
+                    initCall.onInitSuccess(msg);
+
+                }else{
+
+                    new TosUtil(gameAct,"blue", msg).show();
+
+                    initCall.onInitFailed(msg);
+
+                }
+
+
+
+        }
+
+        @Override
+        public void onLoginChannelCallback(String msg) {
+            NetRequestApi.loginWithChannel(gameAct,msg,loginCall);
+        }
+
+
+        @Override
+        public void onLogOutCallback(String msg) {
+            logoutCall.onLogoutSuccess();
+        }
+
+        @Override
+        public void onPayFinishCallback(boolean success, String msg) {
+            if (success){
+                payCall.onPaySuccess(msg);
+            }else{
+                payCall.onPayFailed(msg);
+            }
+
+        }
+
+
+        @Override
+        public void onExiGameCallback(boolean success, String msg) {
+            exitCall.onExit(true);
+        }
+
+
+
+
+        @Override
+        public void onPayExtParamCallback(HashMap<String, String> payInfo, String url) {
+            NetRequestApi.payChannelNotify(payInfo,url);
+        }
+
+        @Override
+        public void onGetChannelRealNameCallback(boolean isRealName, String report_type, String channelRealNameInfo) {
+            if (isRealName){
+                NetRequestApi.recordUserRealNameInfo(gameAct,report_type,channelRealNameInfo);
+            }else{
+                realNameMsgCallback.onLoadRealNameMsg(false,"");
+            }
+
+        }
+
+        @Override
+        public void onLoginChannelFail(String msg) {
+
+            new TosUtil(gameAct,"blue",  msg).show();
+            sdk.SDKLoginChannelFail(msg);
+        }
+
+        @Override
+        public void onLoginChannelSuccess(String msg) {
+            sdk.SDKLoginChannelSuccess(msg);
+        }
+
+        @Override
+        public void onUploadUserRealNameInfo(String report_type,String msg) {
+            NetRequestApi.upLoadUserRealNameInfo(report_type,msg);
+        }
+
+        @Override
+        public void onGetOaidCallback(final boolean isSuccess, final String oaid) {
+            gameAct.runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+
+                    if (isSuccess){
+                        if (Build.VERSION.SDK_INT > 28){
+                            SDKSettings.ifa_type = "2";
+                            initCall.onGetOaid(true,oaid);
+                        }else{
+                            initCall.onGetOaid(false,"");
+                        }
+                        SDKSettings.imei = oaid;
+                        Utils.setSharedPreferences("yyrh","simulateImei",oaid,gameAct);
+                    }else{
+                        SDKSettings.imei = ImeiUtil.getImei(gameAct);
+                        initCall.onGetOaid(false,"");
+                    }
+
+                    Log.i("imei:",SDKSettings.imei);
+
+                    manager.yyrhInit(gameAct);
+
+                }
+            });
+
+        }
+
+        @Override
+        public String onGetChannelUid() {
+            return SDKSettings.CHANNELUID;
+        }
+    };
+
+    /**
+     * 实现单例
+     */
+    private SDKEntry() {
+    }
+
+    public static SDKEntry getSdkInstance() {
+
+        if (sdkInstance == null) {
+            synchronized (SDKEntry.class) {
+                if (sdkInstance == null) {
+                    sdkInstance = new SDKEntry();
+
+                }
+            }
+        }
+
+        return sdkInstance;
+    }
+
+    public void showPrivacyPolicy(Activity activity, UserPolicyCallback userPolicyCallback){
+
+
+            YyrhSdkManager.defaultManager(activity).yyrhShowPolicy(activity,userPolicyCallback);
+
+
+    }
+    public void initSdk(final Activity activity, final InitCallback callback, final boolean isDebug){
+
+        this.gameAct = activity;
+        this.initCall = callback;
+        sdk = ChannelSDK.getInstance();
+        manager = YyrhSdkManager.defaultManager(activity);
+        sdk.SDKInit(activity,tCallBack);
+
+        InputStream inputStream = null;
+        try {
+            inputStream = activity.getAssets().open("yyrh_start_image.jpg");
+        } catch (IOException e) {
+
+        }
+        if(inputStream != null){
+            new GameSplashDialog(activity, ResourceUtil.getStyleId(activity,"yyrh_welcome_dialog")).show();
+        }
+
+
+        int checkResult;
+        if (PermissionUtils.checkIsHasPermission(activity,PermissionUtils.CODE_READ_PHONE_STATE) == 0 &&
+                PermissionUtils.checkIsHasPermission(activity,PermissionUtils.CODE_WRITE_EXTERNAL_STORAGE) == 0){
+            checkResult = 0;
+        }else{
+            checkResult = -1;
+        }
+        switch (checkResult){
+             case 0 :
+				AdvertiseManager.defaultManager(activity).advertiseInit(activity);
+				manager.yyrhInitDevice(activity, isDebug);
+                 break;
+             case -1 :
+                 String[]  permissions = new String[]{Permission.READ_PHONE_STATE,Permission.WRITE_EXTERNAL_STORAGE};
+                 EasyPermission.with(activity)
+                         .addPermissions(permissions)          //申请打电话权限
+                         .request(new PermissionRequestListener() {
+                             @Override
+                             public void onGrant(Map<String, GrantResult> result) {
+                                 //权限申请返回
+								 AdvertiseManager.defaultManager(activity).advertiseInit(activity);
+								 manager.yyrhInitDevice(activity, isDebug);
+                             }
+
+                             @Override
+                             public void onCancel(String stopPermission) {
+                                 //在addRequestPermissionRationaleHandler的处理函数里面调用了NextAction.next(NextActionType.STOP,就会中断申请过程,直接回调到这里来
+
+                             }
+                         });
+                 break;
+         }
+
+
+
+    }
+
+
+    public void login (Activity activity, LoginCallback callback){
+
+
+        this.loginCall = callback;
+        SdkManager.defaultManager(activity).login(activity);
+
+    }
+    public void pay(final HashMap<String, Object> map,
+                    final PayCallback callback, final Activity activity) {
+        this.payCall = callback;
+        YYLog.i("payOrderInit");
+        map.put("role_ctime",this.role_ctime);
+        if (SDKSettings.UNAME.equals("")){
+            new TosUtil(activity,"blue", activity.getString(ResourceUtil.getStringId(activity, "yyrh_login2pay"))).show();
+
+            return;
+        }
+        NetRequestApi.payOrderInit(map, activity, new PayOrderCallback() {
+
+
+            @Override
+            public void onPaySuccess(HashMap<String, Object> map) {
+
+
+                adSdkCallback.onCreateOrder(map);
+                SdkManager.defaultManager(activity).pay(activity, map);
+
+            }
+
+            @Override
+            public void onPayFailed(String msg) {
+                callback.onPayFailed(msg);
+            }
+
+
+        });
+    }
+
+
+    public void setSDKLogoutListener(Activity activity, final LogoutCallback callback) {
+        YYLog.i("SDKLogoutListener");
+        logoutCall = callback;
+        SdkManager.defaultManager(activity).setSDKLogoutListener(activity, tCallBack);
+    }
+    public void logout(){
+        YYLog.i("logout");
+        SdkManager.defaultManager(gameAct).logOut();
+
+
+    }
+    public void exitGame(Activity activity, final ExitCallback callback) {
+        YYLog.i("exitGame");
+        this.exitCall = callback;
+        SdkManager.defaultManager(activity).exit(activity);
+
+    }
+    public void upLoadRoleInfo(String type, Activity activity,RoleInfo roleInfo){
+        YYLog.i("sdk uploadUserInfo");
+
+        this.role_ctime = roleInfo.getRoleCreateTime();
+        String roleId = roleInfo.getRoleId();
+        String roleName = roleInfo.getRoleName();
+        String roleLevel = roleInfo.getRoleLevel();
+        String gender = roleInfo.getGender();
+        String serverId = roleInfo.getServerId();
+        String serverName = roleInfo.getServerName();
+        String hasGold = roleInfo.getHasGold();
+        String vipLevel = roleInfo.getVipLevel();
+        String roleCreateTime = roleInfo.getRoleCreateTime();
+        String partyName = roleInfo.getPartyName();
+        String role_power = roleInfo.getRolePower();
+        String partyId = roleInfo.getPartyId();
+        String reincarnationCount = roleInfo.getReincarnationCount();
+        String charge = roleInfo.getCharge();
+        if (Utils.judgeStrNull(charge)){
+            charge = "0";
+        }
+
+        if (Utils.judgeStrNull(roleId) || Utils.judgeStrNull(roleName)
+                || Utils.judgeStrNull(roleLevel)
+                || Utils.judgeStrNull(gender)
+                || Utils.judgeStrNull(serverId)
+                || Utils.judgeStrNull(serverName)
+                || Utils.judgeStrNull(hasGold)
+                || Utils.judgeStrNull(vipLevel)
+                || Utils.judgeStrNull(roleCreateTime)
+                || Utils.judgeStrNull(role_power)
+                || Utils.judgeStrNull(reincarnationCount)) {
+
+            YYLog.i("上报参数有空值,请检查: "+ roleInfo.getAllParam());
+
+        }else{
+            YYLog.i("游戏角色信息上报sdk相关参数: "+ roleInfo.getAllParam());
+
+            YyrhSdkManager.defaultManager(activity).uploadRoleInfo(type, activity, roleId, roleName, roleLevel, serverId,
+                    serverName, hasGold, vipLevel, role_power, partyId, partyName, roleCreateTime,charge);
+            SdkManager.defaultManager(activity).uploadRoleInfo(type, activity, roleInfo);
+            adSdkCallback.onUpLoadRoleInfo(type,roleInfo);
+
+        }
+    }
+
+
+    /**
+     * 生命周期
+     */
+    public void sdkOnStart(Activity activity) {
+        YYLog.i("sdk OnStart");
+        SdkManager.defaultManager(activity).sdkOnStart(activity);
+    }
+
+
+    public void sdkOnCreate(Activity activity,Bundle savedInstanceState) {
+        YYLog.i("sdk onCreate");
+
+        SdkManager.defaultManager(activity).sdkOnCreate(activity, savedInstanceState);
+    }
+
+    public void sdkOnPause(Activity activity) {
+        YYLog.i("sdk OnPause");
+        SDKEntry.getSdkInstance().adSdkCallback.onPause(activity);
+        SdkManager.defaultManager(activity).sdkOnPause(activity);
+
+
+    }
+
+    public void sdkOnResume(Activity activity) {
+        YYLog.i("sdk OnResume");
+        SDKEntry.getSdkInstance().adSdkCallback.onResume(activity);
+        SdkManager.defaultManager(activity).sdkOnResume(activity);
+
+
+    }
+
+    public void sdkOnRestart(Activity activity) {
+        YYLog.i("sdk onRestart");
+        SdkManager.defaultManager(activity).sdkOnRestart(activity);
+    }
+
+
+    public void sdkOnNewIntent(Activity acitivty, Intent intent) {
+        YYLog.i("sdk OnNewIntent");
+        SdkManager.defaultManager(acitivty).sdkOnNewIntent(acitivty, intent);
+
+    }
+
+    public void sdkOnStop(Activity activity) {
+        YYLog.i("sdk OnStop");
+        SdkManager.defaultManager(activity).sdkOnStop(activity);
+
+
+    }
+
+    public void onConfigurationChanged(Configuration newConfigs) {
+        YYLog.i("sdk onConfigurationChanged");
+        SdkManager.defaultManager(gameAct).onConfigurationChanged(newConfigs);
+    }
+
+
+    public void sdkOnDestroy(Activity activity) {
+        YYLog.i("sdk OnDestroy");
+        SDKEntry.getSdkInstance().adSdkCallback.onDestory(activity);
+        SdkManager.defaultManager(gameAct).sdkOnDestroy(activity);
+
+
+
+    }
+
+    public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
+        YYLog.i("sdk onRequestPermissionsResult");
+        SDKEntry.getSdkInstance().adSdkCallback.onRequestPermissionsResult(requestCode,permissions,grantResults);
+        SdkManager.defaultManager(gameAct).onRequestPermissionsResult(requestCode, permissions, grantResults);
+    }
+
+    public void onActivityResult(Activity ac,int requestCode, int resultCode, Intent data) {
+        YYLog.i("sdk onActivityResult");
+        SdkManager.defaultManager(gameAct).onActivityResult(ac, requestCode, resultCode, data);
+
+
+    }
+
+    public void onWindowFocusChanged(Activity activity, boolean hasFocus){
+        YYLog.i("sdk onWindowFocusChanged");
+        SdkManager.defaultManager(gameAct).onWindowFocusChanged(activity, hasFocus);
+    }
+
+
+
+    public void getRealNameInfo(Activity activity, RealNameMsgCallback realNameMsgCallback){
+        this.realNameMsgCallback = realNameMsgCallback;
+        if (Utils.getTextIsNull(SDKSettings.UNAME)){
+            new TosUtil(activity,"blue",  activity.getString(ResourceUtil.getStringId(activity, "yyrh_login2pay"))).show();
+            return;
+        }
+        SdkManager.defaultManager(gameAct).getRealNameInfo(activity, realNameMsgCallback);
+    }
+
+
+}

+ 553 - 0
hnqj/src/main/java/com/yyrh/sdk/YyrhSdkManager.java

@@ -0,0 +1,553 @@
+package com.yyrh.sdk;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.BitmapFactory;
+import android.os.Build;
+import android.os.Handler;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.yyrh.advertisement.AdvertiseManager;
+import com.yyrh.constant.URLConstants;
+import com.yyrh.factory.SdkManager;
+import com.yyrh.imei.ImeiUtil;
+import com.yyrh.pay.WvPayYyrhDialog;
+import com.yyrh.sdk.callback.RealNameMsgCallback;
+import com.yyrh.sdk.callback.ShowPolicyCallback;
+import com.yyrh.sdk.callback.UserPolicyCallback;
+import com.yyrh.ui.AutoLoginDialog;
+import com.yyrh.ui.PrivacyPolicyDialog;
+import com.yyrh.ui.SingleButtonDialog;
+import com.yyrh.ui.activity.UseLoginActivity;
+import com.yyrh.ui.floatmenu.FloatItem;
+import com.yyrh.ui.floatmenu.FloatLogoMenu;
+import com.yyrh.ui.floatmenu.FloatMenuView;
+import com.yyrh.ui.floatmenu.WvPageListDialog;
+import com.yyrh.ui.fragment.FragmentUtils;
+import com.yyrh.ui.userlist.DatabaseHelper;
+import com.yyrh.utils.InspectSimulator;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.networking.NetRequestApi;
+
+import com.yyrh.sdk.callback.InitCallback;
+import com.yyrh.ui.ConstantDialog;
+import com.yyrh.ui.CustomExitGameDialog;
+import com.yyrh.utils.YYLog;
+import com.yythird.sdk.ChannelSDK;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+
+
+import static com.yyrh.constant.Constants.LOGOUT;
+
+
+import static com.yyrh.constant.SDKSettings.isOpenFloatView;
+import static com.yyrh.constant.SDKSettings.isOpenRealName;
+
+import static com.yyrh.constant.SDKSettings.isVefityRealName;
+
+public class YyrhSdkManager {
+    private static YyrhSdkManager manager = null;
+
+
+    FloatLogoMenu mFloatMenu;
+    String HOME = "用户中心";
+    String FEEDBACK = "切换账号";
+
+
+    String CLOSE = "隐藏";
+    String[] MENU_ITEMS = {HOME,FEEDBACK,CLOSE};
+    private  Context context;
+
+    ArrayList<FloatItem> itemList = new ArrayList<>();
+
+
+    private YyrhSdkManager(Context context) {
+       super();
+        this.context = context;
+    }
+
+    public static YyrhSdkManager defaultManager(Context context) {
+        if (manager == null) {
+            synchronized (YyrhSdkManager.class) {
+                if (manager == null) {
+                    manager = new YyrhSdkManager(context);
+                }
+            }
+        }
+
+        return manager;
+    }
+    public void queryOrder(final String order, final HashMap<String, Object> payMap){
+
+        String status = Utils.getParamCnfValuebyKey(context, "YyrhAdParam.cnf",
+                "QUERY_ORDER");
+        if (status.equals("YES")){
+            new Handler().postDelayed(new Runnable() {
+
+                @Override
+                public void run() {
+                    NetRequestApi.queryOrder(order,payMap);
+                }
+            }, 5000);
+        }
+
+
+
+    }
+
+
+    public void yyrhShowPolicy(final Activity activity, final UserPolicyCallback userPolicyCallback){
+
+        YYLog.i("yyrhShowPolicy ");
+
+        final SharedPreferences sp = activity.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+        String  isShowPolicy = sp.getString("yyrhShowPolicy", "");
+
+        if (isShowPolicy.equals("")){
+
+            NetRequestApi.initAgreement(activity,new ShowPolicyCallback() {
+
+                @Override
+                public void onShow(String agreement_url) {
+                    YYLog.i("need to display the policy");
+                    new PrivacyPolicyDialog(activity, ResourceUtil.getStyleId(activity, "yyrh_base_dialog"), agreement_url,
+                            new PrivacyPolicyDialog.OnClosePageListener() {
+                                @Override
+                                public void onUserAgreePolicy() {
+
+                                    YYLog.i("User agree policy");
+                                    SharedPreferences.Editor editor = sp.edit();
+                                    editor.putString("yyrhShowPolicy", "1");
+                                    editor.commit();
+
+
+                                    userPolicyCallback.onAgree();
+                                }
+
+                                @Override
+                                public void onUserDisagreePolicy() {
+                                    YYLog.i("User disagree policy");
+                                    userPolicyCallback.onDisagree();
+                                }
+                            }).show();
+
+
+                }
+
+                @Override
+                public void onHide() {
+                    YYLog.i(" don't need to display the policy");
+                    userPolicyCallback.onHide();
+                }
+
+                @Override
+                public void onError() {
+                    YYLog.i(" request policy error");
+                    userPolicyCallback.onError();
+                }
+            });
+
+
+
+        }else {
+            YYLog.i("The user has agreed to the policy");
+            userPolicyCallback.onAgree();
+        }
+
+
+    }
+    public void yyrhInitDevice(final Activity activity, boolean isDebug){
+
+        SDKSettings.isDebug = isDebug;
+
+        String isdebug	=	Utils.GetApplicationMetaData(context, "yyrh_debug");
+        if (isdebug.equals("true")){
+            SDKSettings.isDebug = true;
+        }
+        SDKSettings.initSetting(activity);
+
+        if (Build.VERSION.SDK_INT > 28) {
+            ChannelSDK.getInstance().SDKGetOaid();
+        }else{
+            SDKSettings.imei =  ImeiUtil.getImei(context);
+            SDKEntry.getSdkInstance().tCallBack.onGetOaidCallback(true,SDKSettings.imei);
+        }
+
+
+    }
+
+
+    public void yyrhInit(final Activity activity){
+
+
+
+        NetRequestApi.init(activity, new InitCallback() {
+            @Override
+            public void onInitSuccess(String msg) {
+                SdkManager.defaultManager(activity).onInitSuccess(activity);
+                ChannelSDK.getInstance().SDKInitSuccess(msg);
+                SDKEntry.getSdkInstance().initCall.onInitSuccess(msg);
+
+            }
+
+            @Override
+            public void onInitFailed(String msg) {
+
+                ChannelSDK.getInstance().SDKInitFail(msg);
+                SDKEntry.getSdkInstance().initCall.onInitFailed(msg);
+
+                SingleButtonDialog.Builder builder = new SingleButtonDialog.Builder(activity);
+                builder.setPositiveButton(new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+
+                        System.exit(0);
+                    }
+                });
+                builder.Create(msg).show();
+            }
+
+            @Override
+            public void onInitError(String _strError) {
+
+                ChannelSDK.getInstance().SDKInitFail(_strError);
+                SDKEntry.getSdkInstance().initCall.onInitError(_strError);
+
+                SingleButtonDialog.Builder builder = new SingleButtonDialog.Builder(activity);
+                builder.setPositiveButton(new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+
+                        System.exit(0);
+
+                    }
+                });
+                builder.Create(_strError).show();
+            }
+
+            @Override
+            public void onGetOaid(boolean isSuccess, String oaid) {
+
+            }
+
+        });
+
+        SDKSettings.isSimulator = InspectSimulator.isSimulator(activity);
+        Log.i("idSimu:",SDKSettings.isSimulator);
+    }
+    public void yyrhLogin(Activity activity){
+        SharedPreferences sp = activity.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+        if (!Utils.judgeStrNull(sp.getString("username", "")) &&
+                !SDKSettings.LOGINTAG.equals(LOGOUT)) {
+            yyrhAutoLogin(activity);
+
+        }
+        else {
+            yyrh_showLoginDialog(activity);
+        }
+    }
+
+    private void yyrh_showLoginDialog(Activity activity) {
+        destroyFloat();
+        Intent intent = new Intent(activity, UseLoginActivity.class);
+        //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+        intent.putExtra("isLandscape", Utils.isLandscape(activity));
+        intent.putExtra("fragmentTag", FragmentUtils.SDK_LOGIN_TAG);
+        activity.startActivity(intent);
+    }
+
+    private void yyrhAutoLogin(final Activity activity) {
+        AutoLoginDialog.Builder builder = new AutoLoginDialog.Builder(activity);
+        builder.setPositiveButton(new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                //取消回调
+                dialog.dismiss();
+
+                yyrh_showLoginDialog(activity);
+
+            }
+        }).setCloseDialogCallback(new AutoLoginDialog.CloseDialogCallback(){
+
+            @Override
+            public void onclose() {
+                //成功回调
+//                constantDialog.dismiss();
+            }
+        });
+
+        builder.Create().show();
+    }
+    public void yyrhLogout(){
+        SDKSettings.CHANNELUID = "";
+        SDKSettings.UNAME = "";
+        SDKSettings.USER_BIRTHDAY = "";
+        Activity activity  = (Activity)context;
+        activity.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                destroyFloat();
+            }
+
+        });
+
+        SDKSettings.LOGINTAG = LOGOUT;
+        SDKEntry.getSdkInstance().logoutCall.onLogoutSuccess();
+
+    }
+    public void yyrhOpenFloatView(final Activity activity){
+        if (isOpenFloatView != true){
+            return;
+        }
+        itemList.clear();
+
+        final int[] menuIcons = new int[]{ResourceUtil.getMipmapId(activity,"yyrh_user_center_icon"),ResourceUtil.getMipmapId(activity,"yyrh_switch_account_icon"), ResourceUtil.getMipmapId(activity,"yyrh_hide_icon")};
+
+
+
+        itemList.add(new FloatItem(MENU_ITEMS[0], 0x99000000, 0x99000000, BitmapFactory.decodeResource(activity.getResources(), menuIcons[0]), String.valueOf(0)));
+        itemList.add(new FloatItem(MENU_ITEMS[1], 0x99000000, 0x99000000, BitmapFactory.decodeResource(activity.getResources(), menuIcons[1]), String.valueOf(0)));
+        itemList.add(new FloatItem(MENU_ITEMS[2], 0x99000000, 0x99000000, BitmapFactory.decodeResource(activity.getResources(), menuIcons[2]), String.valueOf(0)));
+
+        if (mFloatMenu == null) {
+            mFloatMenu = new FloatLogoMenu.Builder()
+                    .withActivity(activity)
+//                    .withContext(mActivity.getApplication())//这个在7.0(包括7.0)以上以及大部分7.0以下的国产手机上需要用户授权,需要搭配<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+                    .logo(BitmapFactory.decodeResource(activity.getResources(),ResourceUtil.getMipmapId(activity,"yyrh_float_icon")))
+                    .drawCicleMenuBg(true)
+                    .backMenuColor(0xffe4e3e1)
+                    .setBgDrawable(activity.getResources().getDrawable(ResourceUtil.getDrawableId(activity,"yyrh_game_float_menu_bg")))
+                    //这个背景色需要和logo的背景色一致
+                    .setFloatItems(itemList)
+                    .defaultLocation(FloatLogoMenu.LEFT)
+                    .drawRedPointNum(false)
+                    .showWithListener(new FloatMenuView.OnMenuClickListener() {
+                        @Override
+                        public void onItemClick(int position, String title) {
+
+                            itemList.set(position,new FloatItem(MENU_ITEMS[position], 0x99000000, 0x99000000, BitmapFactory.decodeResource(activity.getResources(), menuIcons[position]), String.valueOf(0)));
+
+                            if (title.equals("隐藏")){
+                                destroyFloat();
+                                itemList.clear();
+
+                            }else if (title.equals("切换账号")){
+                                yyrhLogout();
+                            }else if (title.equals("用户中心")){
+                                HashMap<String,String> map = new HashMap<>();
+                                map.put("game_code",SDKSettings.game_code);
+                                map.put("gcp_code",SDKSettings.gcp_code);
+                                map.put("uname",SDKSettings.UNAME);
+                                String url  = Utils.getUserCententerUrl(URLConstants.USERCENTERLISTWEB,map);
+
+                                new WvPageListDialog(activity,ResourceUtil.getStyleId(activity,"yyrh_base_dialog"),url).show();
+                                mFloatMenu.hideMenu();
+                            }
+                            else{
+                                mFloatMenu.hide();
+                                mFloatMenu.show();
+
+                            }
+
+
+                        }
+
+                        @Override
+                        public void dismiss() {
+
+                        }
+                    });
+
+
+
+
+        }
+    }
+
+
+    public void yyrhPay(Activity activity,HashMap<String, Object> map){
+
+
+        String url = (String) map.get("url");
+        if (Utils.judgeStrNull(url)){
+            return;
+        }
+        new WvPayYyrhDialog(activity,ResourceUtil.getStyleId(activity,"yyrh_base_dialog"),url,map).show();
+
+
+
+    }
+
+    public void yyrhExitGame(final Activity activity){
+        CustomExitGameDialog.Builder builder = new CustomExitGameDialog.Builder(activity);
+        builder.setPositiveButton(new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+                SDKEntry.getSdkInstance().adSdkCallback.onExitGame(activity);
+                SDKEntry.getSdkInstance().exitCall.onExit(true);
+            }
+        });
+        builder.setnegativeButton(new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                dialog.dismiss();
+            }
+        });
+
+        builder.Create().show();
+    }
+    public void uploadRoleInfo(String type, Activity activity,
+                               String roleId, String roleName, String roleLevel, String serverId,
+                               String serverName, String hasGold, String vipLevel,String role_power,String partyId,String partyName, String createTime,String charge){
+        NetRequestApi.upLoadingRoleInfo(type, activity, roleId,roleName,roleLevel,serverId,
+                serverName, hasGold, vipLevel,role_power, partyId, partyName, createTime,charge);
+
+    }
+
+    public void saveUserLoginInfo(final Context context, final String account, String pwd, final String token){
+        SharedPreferences sp = context
+                .getSharedPreferences("yyrh",
+                        Activity.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+        editor.putString("username", account);
+        editor.putString("password", pwd);
+        editor.commit();
+
+
+        String timeStamp = System.currentTimeMillis() + "";
+
+        String delete_sql = "delete from user where name = '" + account + "'";
+
+        String insert_sql = "insert into user(name,pwd,time) values('" + account
+                + "','" + pwd + "','" + timeStamp + "')";
+
+        DatabaseHelper.excuteSql(context, delete_sql);
+        DatabaseHelper.excuteSql(context, insert_sql);
+
+
+        if (isOpenRealName){
+
+            if (!isVefityRealName){
+                HashMap<String,String> ifmap = new HashMap<>();
+                ifmap.put("game_code",SDKSettings.game_code);
+                ifmap.put("gcp_code",SDKSettings.gcp_code);
+                ifmap.put("uname",account);
+                String url  = Utils.getUserCententerUrl(URLConstants.USERBINDINFO,ifmap);
+                if (SDKSettings.isForceRealName){
+                    url = url + "&smrz=1";
+                    new WvPageListDialog(context, ResourceUtil.getStyleId(context, "yyrh_base_dialog"), url,
+                            new WvPageListDialog.OnClosePageListener() {
+                                @Override
+                                public void onClose() {
+                                    if (SDKSettings.USER_BIRTHDAY.equals("")){
+                                        SDKSettings.CHANNELUID = "";
+                                        SDKSettings.UNAME = "";
+
+                                    }
+
+                                }
+
+                                @Override
+                                public void onRealNameSuccess(String birthday) {
+                                    openFloatViewInUIThread((Activity) context);
+                                    SDKEntry.getSdkInstance().loginCall.onLoginSuccess(token);
+                                    SDKEntry.getSdkInstance().adSdkCallback.onLoginSuccess(account);
+
+
+                                }
+                            },SDKSettings.isForceRealName).show();
+                }else {
+                    new WvPageListDialog(context, ResourceUtil.getStyleId(context, "yyrh_base_dialog"), url,
+                                 new WvPageListDialog.OnClosePageListener() {
+                                     @Override
+                                     public void onClose() {
+                                         openFloatViewInUIThread((Activity) context);
+                                         SDKEntry.getSdkInstance().loginCall.onLoginSuccess(token);
+                                         SDKEntry.getSdkInstance().adSdkCallback.onLoginSuccess(account);
+
+                                     }
+
+                                     @Override
+                                     public void onRealNameSuccess(String birthday) {
+                                         YYLog.i("onRealNameSuccess");
+                                     }
+                                 }).show();
+
+
+                }
+
+            }else {
+                openFloatViewInUIThread((Activity) context);
+                SDKEntry.getSdkInstance().loginCall.onLoginSuccess(token);
+                SDKEntry.getSdkInstance().adSdkCallback.onLoginSuccess(account);
+            }
+
+        }else{
+            openFloatViewInUIThread((Activity) context);
+            SDKEntry.getSdkInstance().loginCall.onLoginSuccess(token);
+        }
+}
+
+    public void yyrhGetRealNameInfo(Activity activity,RealNameMsgCallback msgCallback){
+
+        if(Utils.getTextIsNull(SDKSettings.USER_BIRTHDAY)){
+            msgCallback.onLoadRealNameMsg(false,"");
+        }else{
+            msgCallback.onLoadRealNameMsg(true,SDKSettings.USER_BIRTHDAY);
+        }
+
+    }
+    private void openFloatViewInUIThread(final Activity gameAct){
+        gameAct.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+
+                YyrhSdkManager.defaultManager(gameAct).yyrhOpenFloatView(gameAct);
+            }
+        });
+    }
+
+    public void onResume(Activity activity){
+
+        if (mFloatMenu != null) {
+
+            mFloatMenu.show();
+        }
+
+    }
+    public void onPause(Activity activity){
+
+        hideFloat();
+    }
+    public void onDestroy(Activity activity){
+        destroyFloat();
+
+    }
+
+    public void hideFloat() {
+        if (mFloatMenu != null) {
+            mFloatMenu.hide();
+        }
+    }
+
+    public void destroyFloat() {
+        if (mFloatMenu != null) {
+            mFloatMenu.destoryFloat();
+        }
+        itemList.clear();
+        mFloatMenu = null;
+
+    }
+}

+ 5 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/ExitCallback.java

@@ -0,0 +1,5 @@
+package com.yyrh.sdk.callback;
+
+public interface ExitCallback {
+    public void onExit(boolean needExit);
+}

+ 10 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/InitCallback.java

@@ -0,0 +1,10 @@
+package com.yyrh.sdk.callback;
+
+public interface InitCallback {
+
+    public void onInitSuccess(String msg);
+    public void onInitFailed(String msg);
+    public void onInitError(String _strError);
+    public void onGetOaid(boolean isSuccess,String oaid);
+
+}

+ 7 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/LoginCallback.java

@@ -0,0 +1,7 @@
+package com.yyrh.sdk.callback;
+
+public interface LoginCallback {
+    public void onLoginSuccess(String token);
+    public void onLoginFailed(String msg);
+    public void onLoginError(String msg);
+}

+ 6 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/LogoutCallback.java

@@ -0,0 +1,6 @@
+package com.yyrh.sdk.callback;
+
+public interface LogoutCallback {
+ public void onLogoutSuccess();
+ public void onLogoutFailed();
+}

+ 5 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/OpenFloatViewCallback.java

@@ -0,0 +1,5 @@
+package com.yyrh.sdk.callback;
+
+public interface OpenFloatViewCallback {
+    public void isOpen(boolean isOpen,String msg);
+}

+ 6 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/PayCallback.java

@@ -0,0 +1,6 @@
+package com.yyrh.sdk.callback;
+
+public interface PayCallback {
+ public void onPaySuccess(String msg);
+ public void onPayFailed(String msg);
+}

+ 11 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/PayOrderCallback.java

@@ -0,0 +1,11 @@
+package com.yyrh.sdk.callback;
+
+import java.util.HashMap;
+
+public interface PayOrderCallback {
+
+    public void onPaySuccess(HashMap<String, Object> map);
+    public void onPayFailed(String msg);
+
+
+}

+ 5 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/RealNameMsgCallback.java

@@ -0,0 +1,5 @@
+package com.yyrh.sdk.callback;
+
+public interface RealNameMsgCallback {
+    public void onLoadRealNameMsg(boolean isRealName,String birthday);
+}

+ 6 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/RegisterCallback.java

@@ -0,0 +1,6 @@
+package com.yyrh.sdk.callback;
+
+public interface RegisterCallback {
+    public void onRegisterSuccess(String token);
+    public void onRegisterFailed(String msg);
+}

+ 8 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/ShowPolicyCallback.java

@@ -0,0 +1,8 @@
+package com.yyrh.sdk.callback;
+
+public interface ShowPolicyCallback {
+
+    public void onShow(String agreement_url);
+    public void onHide();
+    public void onError();
+}

+ 10 - 0
hnqj/src/main/java/com/yyrh/sdk/callback/UserPolicyCallback.java

@@ -0,0 +1,10 @@
+package com.yyrh.sdk.callback;
+
+public interface UserPolicyCallback {
+
+    public void onAgree();
+    public void onDisagree();
+    public void onHide();
+    public void onError();
+
+}

+ 168 - 0
hnqj/src/main/java/com/yyrh/ui/AutoLoginDialog.java

@@ -0,0 +1,168 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.SharedPreferences;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.sdk.callback.LoginCallback;
+
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+public class AutoLoginDialog extends Dialog {
+
+
+
+	private	static TextView qj_auto_login_account_text,qj_auto_login_cancel_text;
+	private static AutoLoginDialog dialog;
+	private static Timer timer;
+
+	public AutoLoginDialog(Context context, int theme) {
+		super(context, theme);
+
+	}
+
+	public  static class  Builder{
+		private Context context;
+		private OnClickListener positiveButtonClickListener;
+		private CloseDialogCallback closeDialogCallback;
+
+		public Builder(Context context){ this.context = context;}
+		public Builder setPositiveButton(OnClickListener listener){
+			this.positiveButtonClickListener = listener;
+			return this;
+		}
+		public Builder setCloseDialogCallback(CloseDialogCallback closeDialogCallback){
+			this.closeDialogCallback = closeDialogCallback;
+			return this;
+		}
+
+
+		public void  dialogDismiss(){
+		    if (timer != null){
+                timer.cancel();
+            }
+			dialog.dismiss();
+		}
+		public AutoLoginDialog Create(){
+			{
+				LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+				dialog = new AutoLoginDialog(context,ResourceUtil.getStyleId(context,"qj_auto_login_dialog"));
+				View layout =  inflater.inflate(ResourceUtil.getLayoutId(context, "qj_quick_login_bar"),null);
+				ViewGroup.LayoutParams  layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+				Window window = dialog.getWindow();
+				window.setGravity(Gravity.TOP);
+				WindowManager.LayoutParams lp = window.getAttributes();
+
+				lp.y = dp2Px(50, context);  //设置出现的高度,距离顶部
+				window.setAttributes(lp);
+
+				dialog.addContentView(layout,layoutParams);
+
+				qj_auto_login_cancel_text =dialog.findViewById(ResourceUtil.getId(context,
+						"qj_auto_login_cancel_text"));
+				qj_auto_login_account_text =dialog.findViewById(ResourceUtil.getId(context,
+						"qj_auto_login_account_text"));
+
+
+
+
+				if (qj_auto_login_cancel_text!=null){
+					qj_auto_login_cancel_text.setOnClickListener(new View.OnClickListener() {
+						@Override
+						public void onClick(View view) {
+							if (timer != null){
+								timer.cancel();
+							}
+
+							timer = null;
+							positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);
+						}
+					});
+				}
+
+				SharedPreferences sp = context.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+				String qj_enter_game_tip = context.getString(ResourceUtil.getStringId(context,"qj_enter_game_tip"));
+				String autoTip = sp.getString("username", "") + qj_enter_game_tip;
+				qj_auto_login_account_text.setText(autoTip);
+                dialog.setCancelable(false);
+				timer = new Timer();
+				timer.schedule(task, 2000);
+				return dialog;
+			}
+		}
+
+		TimerTask  task = new TimerTask() {
+
+			@Override
+			public void run() {
+
+				dialogDismiss();
+
+				SharedPreferences sp = context.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+				final String account = sp.getString("username", "");
+				final String pwd = sp.getString("password", "");
+				NetRequestApi.loginWithYy(false,(Activity) context,account,pwd, new LoginCallback() {
+					@Override
+					public void onLoginSuccess(String token) {
+
+
+
+
+						closeDialogCallback.onclose();
+
+						YyrhSdkManager.defaultManager(context).saveUserLoginInfo(context,account,pwd,token);
+
+					}
+
+					@Override
+					public void onLoginFailed(String msg) {
+						new TosUtil(context,"blue",  msg).show();
+
+
+					}
+
+					@Override
+					public void onLoginError(String msg) {
+						new TosUtil(context,"blue",  msg).show();
+
+
+					}
+				});
+
+			}
+
+		};
+
+
+	}
+	public interface CloseDialogCallback {
+		public void onclose();
+	}
+	public static int dp2Px(float dp, Context mContext) {
+		return (int) TypedValue.applyDimension(
+				TypedValue.COMPLEX_UNIT_DIP,
+				dp,
+				mContext.getResources().getDisplayMetrics());
+	}
+}

+ 52 - 0
hnqj/src/main/java/com/yyrh/ui/BaseDialog.java

@@ -0,0 +1,52 @@
+package com.yyrh.ui;
+
+
+import android.app.Dialog;
+import android.content.Context;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+
+
+
+import com.yyrh.utils.YYLog;
+
+
+
+public class BaseDialog extends Dialog {
+
+
+    public BaseDialog(@NonNull Context context) {
+        super(context);
+    }
+
+    public BaseDialog(@NonNull Context context, int themeResId) {
+        super(context, themeResId);
+    }
+
+    protected BaseDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
+        super(context, cancelable, cancelListener);
+    }
+
+    public void zfColse() {   //提供给js调用的方法
+        YYLog.i("zfColse");
+    }
+
+
+    public void usrRn(String message) {
+        YYLog.i("usrRn:" + message);
+    }
+
+    public void showJsMsg(String message) {
+        YYLog.i("showJsMsg:" + message);
+    }
+
+    public void modifyPwd(String message) {
+        YYLog.i("modifyPwd:" + message);
+    }
+
+    public void zfOrder(String message) {   //提供给js调用的方法
+        YYLog.i("zfOrder:" + message);
+    }
+
+}

+ 34 - 0
hnqj/src/main/java/com/yyrh/ui/ConstantDialog.java

@@ -0,0 +1,34 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.view.View;
+
+import com.yyrh.utils.Utils;
+
+
+public class ConstantDialog extends Dialog{
+
+
+    public Context context;
+
+
+    public ConstantDialog(Context context,int themeResId) {
+        super(context,themeResId);
+        SharedPreferences sp = context.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+
+
+        if (!Utils.judgeStrNull(sp.getString("username", ""))){
+            new LoginLayout(context,this);
+        }else{
+            new RegisterLayout(context,this);
+        }
+
+
+    }
+
+
+
+}

+ 82 - 0
hnqj/src/main/java/com/yyrh/ui/CustomExitGameDialog.java

@@ -0,0 +1,82 @@
+package com.yyrh.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.utils.ResourceUtil;
+
+
+public class CustomExitGameDialog extends Dialog {
+
+	private	static Button bt_exit_game;
+	private static Button bt_goon_game;
+
+	private static CustomExitGameDialog dialog;
+
+	public CustomExitGameDialog(Context context, int theme) {
+		super(context, theme);
+
+	}
+	public  static class  Builder{
+		private Context context;
+		private OnClickListener positiveButtonClickListener;
+		private OnClickListener negativeButtonClickListener;
+		public Builder(Context context){ this.context = context;}
+		public Builder setPositiveButton(OnClickListener listener){
+			this.positiveButtonClickListener = listener;
+			return this;
+		}
+		public Builder setnegativeButton(OnClickListener listener){
+			this.negativeButtonClickListener = listener;
+			return this;
+		}
+		public void  dialogDismiss(){dialog.dismiss();}
+		public CustomExitGameDialog Create(){
+			{
+				LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+				dialog = new CustomExitGameDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"));
+				View layout;
+				if (SDKSettings.isLandscape){
+					layout =  inflater.inflate(ResourceUtil.getLayoutId(context, "yyrh_exit_game_dialog"),null);
+				}else{
+					layout =  inflater.inflate(ResourceUtil.getLayoutId(context, "yyrh_exit_game_dialog_protrait"),null);
+				}
+
+
+				dialog.addContentView(layout,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+
+				bt_exit_game =(Button) dialog.findViewById(ResourceUtil.getId(context,
+						"find_pwd_confirm_btn"));
+				bt_goon_game = (Button) dialog.findViewById(ResourceUtil.getId(context,
+						"find_pwd_cancel_btn"));
+				if (bt_exit_game!=null){
+					bt_exit_game.setOnClickListener(new View.OnClickListener() {
+						@Override
+						public void onClick(View view) {
+							positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);
+						}
+					});
+				}
+				if (bt_goon_game!=null){
+					bt_goon_game.setOnClickListener(new View.OnClickListener() {
+						@Override
+						public void onClick(View view) {
+							negativeButtonClickListener.onClick(dialog,DialogInterface.BUTTON_NEGATIVE);
+						}
+					});
+				}
+				return dialog;
+			}
+		}
+
+
+	}
+
+
+}

+ 200 - 0
hnqj/src/main/java/com/yyrh/ui/ForgetPwdLayout.java

@@ -0,0 +1,200 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.content.Context;
+
+import android.content.SharedPreferences;
+import android.os.CountDownTimer;
+import android.text.method.HideReturnsTransformationMethod;
+import android.text.method.PasswordTransformationMethod;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.ui.fragment.UserPhoneLoginFragment;
+import com.yyrh.ui.fragment.UserRetrievePwdFragment;
+import com.yyrh.ui.userlist.DatabaseHelper;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+
+public class ForgetPwdLayout implements View.OnClickListener {
+
+
+    private Context context;
+    private ConstantDialog constantDialog;
+    private EditText et_user_phone,et_user_code,et_user_pwd;
+    private Button btn_get_code,reg_compete_btn;
+    private ImageView down_eye_btn, close_btn;
+    private boolean isShowPwd = false;
+    public ForgetPwdLayout(Context context, ConstantDialog constantDialog){
+
+        this.context = context;
+        this.constantDialog = constantDialog;
+        if (SDKSettings.isLandscape){
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_phone_find_pwd_dialog"));
+        }else{
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_phone_find_pwd_dialog_protrait"));
+        }
+
+
+        et_user_phone = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_phone"));
+        et_user_code = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_code"));
+        et_user_pwd  = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_pwd"));
+        btn_get_code  = constantDialog.findViewById(ResourceUtil.getId(context, "btn_get_code"));
+        reg_compete_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "reg_compete_btn"));
+        down_eye_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "down_eye_btn"));
+
+        close_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "close_btn"));
+        down_eye_btn.setOnClickListener(this);
+        btn_get_code.setOnClickListener(this);
+        close_btn.setOnClickListener(this);
+        reg_compete_btn.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == ResourceUtil.getId(context, "btn_get_code")) {
+            String phone =  et_user_phone.getText().toString();
+
+            if (phone.length() < 10) {
+                new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_phone"))).show();
+                return;
+            }
+            getPhoneCaptcha((Activity) context,phone,"modify_pwd");
+        }else if (id == ResourceUtil.getId(context, "reg_compete_btn")) {
+            String phone =  et_user_phone.getText().toString();
+            String code = et_user_code.getText().toString();
+            final String pwd = et_user_pwd.getText().toString();
+            if (phone.length() < 10) {
+
+                new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_phone"))).show();
+
+                return;
+            }
+            if(code.length() < 4 || Utils.judgeStrNull(code))
+            {
+                new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_code"))).show();
+
+
+                return;
+            }
+            if(pwd.length() < 6 || Utils.judgeStrNull(pwd))
+            {
+                new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_pwd_limit_6"))).show();
+
+                return;
+            }
+            resetPwdWithPhone((Activity) context,phone,code,pwd);
+
+        }else if (id == ResourceUtil.getId(context, "close_btn")) {
+            new LoginLayout(context,constantDialog);
+        }else if (id == ResourceUtil.getId(context, "down_eye_btn")) {
+            if (!isShowPwd) {
+                isShowPwd = true;
+                et_user_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
+                down_eye_btn.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_select"));
+            } else {
+                isShowPwd = false;
+                et_user_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
+                down_eye_btn.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_normal"));
+            }
+        }
+
+    }
+
+    private void  getPhoneCaptcha(Activity activity, String phone, String action){
+        NetRequestApi.getPhoneCaptcha(activity, phone, action, new UserPhoneLoginFragment.CaptchaCallback() {
+            @Override
+            public void onGetSuccess(String msg) {
+                getCodeSuccess();
+                new TosUtil(context,"green", context.getString(ResourceUtil.getStringId(context, "yyrh_send_code_success"))).show();
+
+
+            }
+
+            @Override
+            public void onGetFailed(String msg) {
+                new TosUtil(context,"blue", msg).show();
+
+            }
+        });
+    }
+
+    private void resetPwdWithPhone(Activity activity, final String phone, String code, final String pwd) {
+        NetRequestApi.resetPwdWithPhone(activity, phone, code, pwd, new UserRetrievePwdFragment.ResetPwdCallback() {
+            @Override
+            public void onResetSuccess(String msg) {
+
+                SharedPreferences sp = context
+                        .getSharedPreferences("yyrh",
+                                Activity.MODE_PRIVATE);
+                SharedPreferences.Editor editor = sp.edit();
+                editor.putString("username", phone);
+                editor.putString("password", pwd);
+                editor.commit();
+                String timeStamp = System.currentTimeMillis() + "";
+                String delete_sql = "delete from user where name = '" + phone + "'";
+                String insert_sql = "insert into user(name,pwd,time) values('" + phone
+                        + "','" + pwd + "','" + timeStamp + "')";
+
+                DatabaseHelper.excuteSql(context, delete_sql);
+                DatabaseHelper.excuteSql(context, insert_sql);
+                new LoginLayout(context,constantDialog);
+
+                new TosUtil(context,"green", msg).show();
+
+            }
+
+            @Override
+            public void onResetFailed(String msg) {
+
+                new TosUtil(context,"blue",  msg).show();
+
+            }
+        });
+    }
+
+    private void getCodeSuccess() {
+        btn_get_code.setEnabled(false);
+        btn_get_code.setText("60s");
+        btn_get_code.setBackgroundResource(ResourceUtil.getDrawableId(context,"yyrh_radius_main_color_1dp"));
+        TimeCount time = new TimeCount(60000, 1000);
+        time.start();
+    }
+
+    class TimeCount extends CountDownTimer {
+
+        public TimeCount(long millisInFuture, long countDownInterval) {
+            super(millisInFuture, countDownInterval);
+            // TODO Auto-generated constructor stub
+        }
+
+        @Override
+        public void onTick(long millisUntilFinished) {
+            // TODO Auto-generated method stub
+            btn_get_code.setText(millisUntilFinished / 1000 + "s");
+
+        }
+
+        @Override
+        public void onFinish() {
+            // TODO Auto-generated method stub
+            btn_get_code.setEnabled(true);
+            btn_get_code.setBackgroundResource(ResourceUtil.getDrawableId(context,"yyrh_radius_main_color_1dp"));
+            btn_get_code.setText(ResourceUtil.getStringId(context, "yyrh_get_phone_code"));
+        }
+
+    }
+    public interface ResetPwdCallback {
+
+        void onResetSuccess(String msg);
+        void onResetFailed(String msg);
+
+
+    }
+}

+ 62 - 0
hnqj/src/main/java/com/yyrh/ui/GameSplashDialog.java

@@ -0,0 +1,62 @@
+package com.yyrh.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.WindowManager;
+import android.widget.ImageView;
+
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.YYLog;
+
+public class GameSplashDialog extends Dialog {
+    private static ImageView iv_bg;
+    private static Bitmap bit = null;
+    private Context context;
+    public GameSplashDialog(Context context, int theme) {
+        super(context, theme);
+        this.context = context;
+    }
+    public GameSplashDialog(Context context) {
+        super(context);
+        this.context = context;
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(ResourceUtil.getLayoutId(context,
+                "yyrh_show_splash_view"));
+        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
+        iv_bg =  findViewById(ResourceUtil.getId(context, "iv_show_bg"));
+        try {
+            bit = BitmapFactory.decodeStream(context.getAssets().open("yyrh_start_image.jpg"));
+            iv_bg.setImageBitmap(bit);
+        } catch (Exception e) {
+            // TODO: handle exception
+
+        }
+        if(bit != null){
+            new Handler().postDelayed(new Runnable() {
+
+                @Override
+                public void run() {
+                    onSplashStop();
+                }
+            }, 2500);
+        }else{
+
+            YYLog.i("No adding welcomeImage");
+            onSplashStop();
+        }
+    }
+
+    private void onSplashStop() {
+        dismiss();
+
+    }
+
+}

+ 271 - 0
hnqj/src/main/java/com/yyrh/ui/LoginLayout.java

@@ -0,0 +1,271 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Paint;
+import android.os.CountDownTimer;
+import android.text.method.HideReturnsTransformationMethod;
+import android.text.method.PasswordTransformationMethod;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.callback.LoginCallback;
+import com.yyrh.ui.userlist.DatabaseHelper;
+import com.yyrh.ui.userlist.User;
+import com.yyrh.ui.userlist.UserListAdapter;
+
+import java.util.ArrayList;
+
+public class LoginLayout implements View.OnClickListener {
+
+
+
+    private Context context;
+
+    private Button loginButton,registButton,forgetPwdBtn;
+
+    private EditText accountEdit, pwdEdit;
+
+    private ImageView showListView,showPwd;
+
+    private boolean isShowList = false;
+
+    private ConstantDialog constantDialog;
+
+    private boolean isShowPwd = false;
+
+
+    DatabaseHelper dbHelper;
+    public TextView tv;
+    private UserListAdapter adapter;
+    private ListView listView;
+
+
+    public LoginLayout(Context context,ConstantDialog constantDialog){
+
+        this.context = context;
+        this.constantDialog = constantDialog;
+        if (SDKSettings.isLandscape){
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_login_dialog"));
+        }else{
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_login_dialog_protrait"));
+        }
+
+        loginButton 		=  constantDialog.findViewById(ResourceUtil.getId(context, "yyrh_enter_btn"));
+        registButton 		=  constantDialog.findViewById(ResourceUtil.getId(context, "yyrh_reg_btn"));
+        listView 			=  constantDialog.findViewById(ResourceUtil.getId(context, "account_listview"));
+        accountEdit 		=  constantDialog.findViewById(ResourceUtil.getId(context, "yyrh_user_edit"));
+        pwdEdit 			=  constantDialog.findViewById(ResourceUtil.getId(context, "yyrh_pwd_edit"));
+        showListView 		= constantDialog.findViewById(ResourceUtil.getId(context, "down_btn"));
+        showPwd = constantDialog.findViewById(ResourceUtil.getId(context, "down_eye_btn"));
+        tv 					= constantDialog.findViewById(ResourceUtil.getId(context, "list_text"));
+        forgetPwdBtn = constantDialog.findViewById(ResourceUtil.getId(context, "yyrh_forget_pwd_btn"));
+
+        showListView.setOnClickListener(this);
+        loginButton.setOnClickListener(this);
+        registButton.setOnClickListener(this);
+        showPwd.setOnClickListener(this);
+        forgetPwdBtn.setOnClickListener(this);
+
+        SharedPreferences sp = context.getSharedPreferences("yyrh", Activity.MODE_PRIVATE);
+        accountEdit.setText(sp.getString("username", ""));
+        pwdEdit.setText(sp.getString("password", ""));
+        pwdEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
+
+
+        adapter = new UserListAdapter(this,context,getData());
+        listView.setAdapter(adapter);
+        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                accountEdit.setText(adapter.list.get(position).uname);
+                pwdEdit.setText(adapter.list.get(position).pwd);
+                hideListView();
+            }
+        });
+    }
+
+
+
+    @Override
+    public void onClick(View v) {
+
+        int id = v.getId();
+        if (id == ResourceUtil.getId(context, "yyrh_enter_btn")) { 			/*	进入游戏		*/
+
+            startLogin(accountEdit.getText().toString(), pwdEdit.getText().toString());
+
+        } else if (id == ResourceUtil.getId(context, "yyrh_reg_btn")) {		/*	1秒注册		*/
+            new RegisterLayout(context,constantDialog);
+
+        }else if (id == ResourceUtil.getId(context, "yyrh_forget_pwd_btn")) {		/*	1秒注册		*/
+            new ForgetPwdLayout(context,constantDialog);
+
+        } else if (id == ResourceUtil.getId(context, "down_eye_btn")) {		/*	1秒注册		*/
+            if (!isShowPwd) {
+                isShowPwd = true;
+                pwdEdit.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
+                showPwd.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_select"));
+            } else {
+                isShowPwd = false;
+                pwdEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
+                showPwd.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_normal"));
+            }
+
+        }else if (id == ResourceUtil.getId(context, "down_btn")){
+
+            /*	显示缓存账号	*/
+            if (!isShowList) {
+                showListView.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_arrow_select"));
+                showListView();
+            } else {
+
+                showListView.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_arrow_normal"));
+                hideListView();
+            }
+        }
+
+    }
+
+    private void showListView() {
+        if (adapter.list.size() == 0) {
+            tv.setVisibility(View.VISIBLE);
+        } else {
+            listView.setVisibility(View.VISIBLE);
+            tv.setVisibility(View.GONE);
+
+        }
+        isShowList = true;
+
+
+    }
+
+    private void hideListView() {
+        listView.setVisibility(View.GONE);
+        tv.setVisibility(View.GONE);
+        isShowList = false;
+
+        showListView.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_arrow_normal"));
+    }
+
+
+    private void startLogin(final String account, final String pwd) {
+        if (Utils.judgeStrNull(account)){
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_account"))).show();
+           // ToastUtil.show(context, context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_account")));
+            return;
+        }
+        if (Utils.judgeStrNull(pwd)){
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_pwd"))).show();
+          //  ToastUtil.show(context, context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_pwd")));
+            return;
+        }
+
+        if(account.length()<6)
+        {
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_account_limit_6"))).show();
+         //   ToastUtil.show(context, context.getString(ResourceUtil.getStringId(context, "yyrh_account_limit_6")));
+            return;
+        }
+        if(pwd.length()<6)
+        {
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pwd_limit_6"))).show();
+           // ToastUtil.show(context, context.getString(ResourceUtil.getStringId(context, "yyrh_pwd_limit_6")));
+            return;
+        }
+        registerInterval();
+        NetRequestApi.loginWithYy(true,(Activity) context, account, pwd, new LoginCallback() {
+            @Override
+            public void onLoginSuccess(String token) {
+
+                constantDialog.dismiss();
+
+
+                YyrhSdkManager.defaultManager(context).saveUserLoginInfo(context,account,pwd,token);
+
+            }
+
+            @Override
+            public void onLoginFailed(String msg) {
+                new TosUtil(context,"blue", msg).show();
+
+                SDKEntry.getSdkInstance().loginCall.onLoginFailed(msg);
+            }
+
+            @Override
+            public void onLoginError(String msg) {
+                new TosUtil(context,"blue", msg).show();
+            }
+        });
+
+    }
+
+    private ArrayList<User> getData() {
+        ArrayList<User> userList = new ArrayList<User>();
+        dbHelper = new DatabaseHelper(context);
+        SQLiteDatabase db = null;
+        db = dbHelper.getReadableDatabase();
+        String qurey_sql = "select name,pwd from user order by time desc";
+        Cursor cursor = db.rawQuery(qurey_sql, null);
+        while (cursor.moveToNext()) {
+            User user = new User();
+            user.uname = cursor.getString(0);
+            user.pwd = cursor.getString(1);
+            userList.add(user);
+        }
+        cursor.close();
+        db.close();
+        return userList;
+    }
+
+    private void registerInterval() {
+
+
+        loginButton.setEnabled(false);
+        loginButton.setText("3s");
+        loginButton.setBackgroundResource(ResourceUtil.getColorId(context,"yyrh_black_color_40"));
+        TimeCount time = new TimeCount(3000, 1000);
+        time.start();
+    }
+
+
+    class TimeCount extends CountDownTimer {
+
+        public TimeCount(long millisInFuture, long countDownInterval) {
+            super(millisInFuture, countDownInterval);
+            // TODO Auto-generated constructor stub
+        }
+
+        @Override
+        public void onTick(long millisUntilFinished) {
+            // TODO Auto-generated method stub
+            loginButton.setText(millisUntilFinished / 1000 + "s");
+
+        }
+
+        @Override
+        public void onFinish() {
+            // TODO Auto-generated method stub
+            loginButton.setEnabled(true);
+            loginButton.setBackgroundResource(ResourceUtil.getColorId(context,"yyrh_btn1_color"));
+            loginButton.setText(ResourceUtil.getStringId(context, "yyrh_enter_game"));
+        }
+
+    }
+}

+ 41 - 0
hnqj/src/main/java/com/yyrh/ui/MarqueTextView.java

@@ -0,0 +1,41 @@
+package com.yyrh.ui;
+
+
+import android.content.Context;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+/**
+ * Created by admin on 2017/11/10.
+ */
+
+public class MarqueTextView extends TextView {
+    public MarqueTextView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        setLineBG();
+
+    }
+
+
+
+    public MarqueTextView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        setLineBG();
+    }
+
+    public MarqueTextView(Context context) {
+        super(context);
+        setLineBG();
+    }
+
+    private void setLineBG() {
+        getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG);
+        getPaint().setAntiAlias(true);
+    }
+    @Override
+
+    public boolean isFocused() {
+        return true;
+    }
+}

+ 45 - 0
hnqj/src/main/java/com/yyrh/ui/PageJsInteraction.java

@@ -0,0 +1,45 @@
+package com.yyrh.ui;
+
+
+import android.webkit.JavascriptInterface;
+
+
+
+public class PageJsInteraction {
+
+    private BaseDialog baseDialog;
+    public PageJsInteraction(BaseDialog baseDialog) {
+
+        this.baseDialog =baseDialog;
+    }
+
+
+
+    @JavascriptInterface
+    public void zfColse() {   //提供给js调用的方法
+        this.baseDialog.zfColse();
+    }
+
+    @JavascriptInterface
+    public void usrRn(String message) {
+        this.baseDialog.usrRn(message);
+    }
+    @JavascriptInterface
+    public void showJsMsg(String message) {
+        this.baseDialog.showJsMsg(message);
+    }
+    @JavascriptInterface
+    public void modifyPwd(String message) {   //提供给js调用的方法
+
+        this.baseDialog.modifyPwd(message);
+
+    }
+
+
+    @JavascriptInterface
+    public void zfOrder(String message) {
+        this.baseDialog.zfOrder(message);
+    }
+
+
+}

+ 294 - 0
hnqj/src/main/java/com/yyrh/ui/PhoneRegisterLayout.java

@@ -0,0 +1,294 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Paint;
+import android.os.CountDownTimer;
+import android.text.method.HideReturnsTransformationMethod;
+import android.text.method.PasswordTransformationMethod;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.constant.URLConstants;
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.ui.floatmenu.WvPageListDialog;
+import com.yyrh.ui.fragment.UserPhoneLoginFragment;
+import com.yyrh.ui.userlist.User;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.SignUtils;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+
+import static com.yyrh.constant.URLConstants.RSAKEY;
+
+public class PhoneRegisterLayout implements View.OnClickListener {
+
+
+    private Context context;
+    private ConstantDialog constantDialog;
+    private EditText et_user_phone,et_user_code,et_user_pwd;
+    private Button btn_get_code,et_reg_compete_btn;
+    private ImageView down_eye_btn,close_btn;
+    private boolean isShowPwd = false;
+    private CheckBox cb_register;
+    private TextView tv_tip,tv_private_policy;
+    public PhoneRegisterLayout(Context context, ConstantDialog constantDialog){
+
+        this.context = context;
+        this.constantDialog = constantDialog;
+        if (SDKSettings.isLandscape){
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_phone_register_dialog"));
+        }else{
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_phone_register_dialog_protrait"));
+        }
+
+
+        et_user_phone = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_phone"));
+        et_user_code = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_code"));
+        et_user_pwd  = constantDialog.findViewById(ResourceUtil.getId(context, "et_user_pwd"));
+        btn_get_code  = constantDialog.findViewById(ResourceUtil.getId(context, "btn_get_code"));
+        et_reg_compete_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "et_reg_compete_btn"));
+        down_eye_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "down_eye_btn"));
+
+        cb_register = constantDialog.findViewById(ResourceUtil.getId(context, "cb_register"));
+
+        close_btn  = constantDialog.findViewById(ResourceUtil.getId(context, "close_btn"));
+
+        tv_tip = constantDialog.findViewById(ResourceUtil.getId(context, "tv_tip"));
+        tv_tip.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );
+        tv_tip.getPaint().setAntiAlias(true);
+
+        tv_private_policy = constantDialog.findViewById(ResourceUtil.getId(context, "tv_private_policy"));
+        tv_private_policy.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );
+        tv_private_policy.getPaint().setAntiAlias(true);
+
+
+        tv_private_policy.setOnClickListener(this);
+        down_eye_btn.setOnClickListener(this);
+        btn_get_code.setOnClickListener(this);
+        close_btn.setOnClickListener(this);
+        tv_tip.setOnClickListener(this);
+        et_reg_compete_btn.setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == ResourceUtil.getId(context, "btn_get_code")) {
+           String phone =  et_user_phone.getText().toString();
+
+            if (phone.length() < 10) {
+                new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_phone"))).show();
+               // ToastUtil.show(context, context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_phone")));
+                return;
+            }
+            getPhoneCaptcha((Activity) context,phone,"register");
+
+        }else if (id == ResourceUtil.getId(context, "et_reg_compete_btn")) {
+
+            registerWithPhone((Activity) context);
+        }else if (id == ResourceUtil.getId(context, "close_btn")) {
+            new RegisterLayout(context,constantDialog);
+        }else if (id == ResourceUtil.getId(context, "tv_tip")) {
+
+            String url  =  SDKSettings.UserCentUrl + URLConstants.USERPROTOCOLWEB + "gcp_code=" + SDKSettings.gcp_code
+                    + "&game_code=" + SDKSettings.game_code;
+
+            new WvPageListDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"),url).show();
+
+        }else if (id == ResourceUtil.getId(context, "tv_private_policy")) {
+
+
+                String url  =  SDKSettings.UserCentUrl + URLConstants.USERPOLICYWEB + "gcp_code=" + SDKSettings.gcp_code
+                        + "&game_code=" + SDKSettings.game_code;
+
+                new WvPageListDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"),url).show();
+
+        } else if (id == ResourceUtil.getId(context, "down_eye_btn")) {
+            if (!isShowPwd) {
+                isShowPwd = true;
+                et_user_pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
+                down_eye_btn.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_select"));
+            } else {
+                isShowPwd = false;
+                et_user_pwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
+                down_eye_btn.setImageResource(ResourceUtil.getMipmapId(context, "yyrh_eye_icon_normal"));
+            }
+        }
+
+    }
+
+    private void  getPhoneCaptcha(Activity activity, String phone, String action){
+        NetRequestApi.getPhoneCaptcha(activity, phone, action, new UserPhoneLoginFragment.CaptchaCallback() {
+            @Override
+            public void onGetSuccess(String msg) {
+                getCodeSuccess();
+
+                new TosUtil(context,"green",context.getString(ResourceUtil.getStringId(context, "yyrh_send_code_success"))).show();
+
+
+               // ToastUtil.show(context,context.getString(ResourceUtil.getStringId(context, "yyrh_send_code_success")));
+            }
+
+            @Override
+            public void onGetFailed(String msg) {
+
+                new TosUtil(context,"blue",msg).show();
+
+            }
+        });
+    }
+    private void registerWithPhone(final Activity activity){
+        String code = et_user_code.getText().toString();
+        final String account = et_user_phone.getText().toString();
+        final String pwd = et_user_pwd.getText().toString();
+        String userInfo ="";
+
+        if(account.length() < 10 || Utils.judgeStrNull(account))
+        {
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_phone"))).show();
+
+
+            return;
+        }
+        if(pwd.length() < 6 || Utils.judgeStrNull(pwd))
+        {
+
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pwd_limit_6"))).show();
+
+
+
+            return;
+        }
+        if(code.length() < 4 || Utils.judgeStrNull(code))
+        {
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pls_input_right_code"))).show();
+
+            return;
+        }
+
+        if (!cb_register.isChecked()){
+
+            new TosUtil(context, "blue",context.getString(ResourceUtil.getStringId(context, "yyrh_pls_checked_reg_tip"))).show();
+
+            return;
+
+        }
+
+        try {
+            userInfo =  SignUtils.encryptRsaByPublicKey(RSAKEY,account+"|"+ pwd);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        registerInterval();
+        NetRequestApi.registerWithPhone(activity,code,userInfo, new UserPhoneLoginFragment.PhoneRegisterCallback() {
+            @Override
+            public void onRegisterSuccess(String msg) {
+
+
+                constantDialog.dismiss();
+
+
+                YyrhSdkManager.defaultManager(context).saveUserLoginInfo(context,account,pwd,msg);
+
+                SDKEntry.getSdkInstance().adSdkCallback.onRegisterSuccess(account);
+            }
+
+            @Override
+            public void onRegisterFailed(String msg) {
+                new TosUtil(context,"blue", msg).show();
+            }
+        });
+    }
+    private void getCodeSuccess() {
+        btn_get_code.setEnabled(false);
+        btn_get_code.setText("60s");
+        btn_get_code.setBackgroundResource(ResourceUtil.getDrawableId(context,"yyrh_radius_main_color_1dp"));
+        TimeCount time = new TimeCount(60000, 1000);
+        time.start();
+    }
+
+    class TimeCount extends CountDownTimer {
+
+        public TimeCount(long millisInFuture, long countDownInterval) {
+            super(millisInFuture, countDownInterval);
+            // TODO Auto-generated constructor stub
+        }
+
+        @Override
+        public void onTick(long millisUntilFinished) {
+            // TODO Auto-generated method stub
+            btn_get_code.setText(millisUntilFinished / 1000 + "s");
+
+        }
+
+        @Override
+        public void onFinish() {
+            // TODO Auto-generated method stub
+            btn_get_code.setEnabled(true);
+            btn_get_code.setBackgroundResource(ResourceUtil.getDrawableId(context,"yyrh_radius_green_3dp"));
+            btn_get_code.setText(ResourceUtil.getStringId(context, "yyrh_get_phone_code"));
+        }
+
+    }
+
+    public interface CaptchaCallback {
+
+        void onGetSuccess(String msg);
+        void onGetFailed(String msg);
+
+
+    }
+
+    public interface PhoneRegisterCallback {
+
+        void onRegisterSuccess(String msg);
+        void onRegisterFailed(String msg);
+
+
+    }
+
+    private void registerInterval() {
+
+
+
+
+        et_reg_compete_btn.setEnabled(false);
+        et_reg_compete_btn.setText("3s");
+        et_reg_compete_btn.setBackgroundResource(ResourceUtil.getColorId(context,"yyrh_black_color_40"));
+        RegTimeCount time = new RegTimeCount(3000, 1000);
+        time.start();
+    }
+
+    class RegTimeCount extends CountDownTimer {
+
+        public RegTimeCount(long millisInFuture, long countDownInterval) {
+            super(millisInFuture, countDownInterval);
+            // TODO Auto-generated constructor stub
+        }
+
+        @Override
+        public void onTick(long millisUntilFinished) {
+            // TODO Auto-generated method stub
+            et_reg_compete_btn.setText(millisUntilFinished / 1000 + "s");
+
+        }
+
+        @Override
+        public void onFinish() {
+            // TODO Auto-generated method stub
+            et_reg_compete_btn.setEnabled(true);
+            et_reg_compete_btn.setBackgroundResource(ResourceUtil.getColorId(context,"yyrh_btn1_color"));
+            et_reg_compete_btn.setText(ResourceUtil.getStringId(context, "yyrh_register_success"));
+        }
+
+    }
+}

+ 168 - 0
hnqj/src/main/java/com/yyrh/ui/PrivacyPolicyDialog.java

@@ -0,0 +1,168 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.webkit.DownloadListener;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.Button;
+import android.widget.ImageView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.ui.userlist.DatabaseHelper;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+
+import static com.yyrh.constant.SDKSettings.USER_BIRTHDAY;
+import static com.yyrh.constant.SDKSettings.isVefityRealName;
+
+public class PrivacyPolicyDialog extends Dialog {
+
+
+    private ImageView yyrh_loading;
+    private Context context;
+    private WebView webView;
+    private WebSettings webSettings;
+
+    private Button btn_disagree,btn_agree;
+    private String url;
+    public OnClosePageListener listener;
+
+    public PrivacyPolicyDialog(Context context) {
+        super(context);
+        this.context = context;
+    }
+
+
+    public PrivacyPolicyDialog(Context context, int theme, String url) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+
+    }
+
+    public PrivacyPolicyDialog(Context context, int theme, String url, OnClosePageListener listener) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+        this.listener = listener;
+    }
+    public PrivacyPolicyDialog(Context context, int theme, String url, OnClosePageListener listener, boolean isHiddenClose) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+        this.listener = listener;
+
+    }
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        boolean isLandscape = Utils.isLandscape((Activity) context);
+        if (isLandscape){
+            setContentView(ResourceUtil.getLayoutId(context,
+                    "yyrh_privacy_policy_dialog"));
+        }else{
+            setContentView(ResourceUtil.getLayoutId(context,
+                    "yyrh_privacy_policy_dialog_protrait"));
+        }
+
+        webView = findViewById(ResourceUtil.getId(context,
+                "wb_user_info"));
+
+
+
+        yyrh_loading = findViewById(ResourceUtil.getId(context, "yyrh_loading"));
+        Animation rotateAnimation = AnimationUtils.loadAnimation(context, ResourceUtil.getAnimId(context, "yyrh_rotate_anim"));
+        yyrh_loading.startAnimation(rotateAnimation);
+
+
+        btn_disagree = findViewById(ResourceUtil.getId(context, "btn_disagree"));
+        btn_agree = findViewById(ResourceUtil.getId(context, "btn_agree"));
+
+        setCancelable(false);
+
+        btn_disagree.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+                if (listener != null){
+                    listener.onUserDisagreePolicy();
+                }
+
+                webView.destroy();
+                dismiss();
+
+            }
+        });
+        btn_agree.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+                if (listener != null){
+                    listener.onUserAgreePolicy();
+                }
+
+                webView.destroy();
+                dismiss();
+
+            }
+        });
+
+        webSettings = webView.getSettings();
+        webSettings.setAllowFileAccess(true);
+        webSettings.setJavaScriptEnabled(true);
+        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
+        webSettings.setBuiltInZoomControls(false);// 设置支持缩放
+        webSettings.setDomStorageEnabled(true);
+        webView.setHorizontalScrollBarEnabled(false);//水平不显示
+        webView.setVerticalScrollBarEnabled(false); //垂直不显示
+
+
+        webView.setWebViewClient(new WebViewClient(){
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                super.onPageFinished(view, url);
+                yyrh_loading.clearAnimation();
+                yyrh_loading.setVisibility(View.GONE);
+                if (webView.canGoBack()){
+
+                }
+            }
+
+        });
+
+        webView.setDownloadListener(new DownloadListener() {
+            @Override
+            public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
+                Uri uri = Uri.parse(url);
+                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                context.startActivity(intent);
+            }
+        });
+
+
+        webView.loadUrl(url);
+    }
+
+
+
+
+    public interface OnClosePageListener {
+         void onUserAgreePolicy();
+         void onUserDisagreePolicy();
+    }
+
+}

+ 64 - 0
hnqj/src/main/java/com/yyrh/ui/ProgressDialogUtils.java

@@ -0,0 +1,64 @@
+package com.yyrh.ui;
+
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.widget.TextView;
+
+ ;import com.yyrh.utils.ResourceUtil;
+
+public class ProgressDialogUtils {
+	private static Dialog progressDialog;
+	private static Activity activity;
+	
+
+	
+	public static void show(Activity _activity,final String _mesage){
+
+		if(progressDialog != null && _activity != activity && progressDialog.isShowing()){
+			progressDialog.dismiss();
+		}
+
+		if(progressDialog == null || _activity != activity){
+			activity = _activity;
+
+			progressDialog = new Dialog(_activity,ResourceUtil.getStyleId(_activity, "yyrh_progress_dialog"));
+			progressDialog.setContentView(ResourceUtil.getLayoutId(_activity, "yyrh_dialog_progress"));
+            progressDialog.setCancelable(false);
+            progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
+            TextView msg =  progressDialog.findViewById(ResourceUtil.getId(_activity, "id_tv_loadingmsg"));
+            msg.setText(_mesage);
+		}
+		if(progressDialog!=null&&_activity == activity){
+			 TextView msg = progressDialog.findViewById(ResourceUtil.getId(_activity, "id_tv_loadingmsg"));
+	          msg.setText(_mesage);
+		}
+		_activity.runOnUiThread(new Runnable() {
+			
+			@Override
+			public void run() {
+				// TODO Auto-generated method stub
+
+				progressDialog.show();
+			}
+		});
+		
+	}
+
+	public static boolean isShowing(){
+		if (progressDialog.isShowing()){
+			return true;
+		}else{
+			return false;
+		}
+	}
+	public static void dismiss(){
+
+		if(progressDialog != null && activity != null){
+			progressDialog.dismiss();
+		}
+	}
+	public static void Destroy(){
+		progressDialog=null;
+	}
+}

+ 209 - 0
hnqj/src/main/java/com/yyrh/ui/RegisterLayout.java

@@ -0,0 +1,209 @@
+package com.yyrh.ui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Paint;
+import android.os.CountDownTimer;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.constant.URLConstants;
+import com.yyrh.sdk.SDKEntry;
+import com.yyrh.sdk.YyrhSdkManager;
+import com.yyrh.ui.floatmenu.WvPageListDialog;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.ScreenShotUtil;
+import com.yyrh.utils.TosUtil;
+import com.yyrh.utils.Utils;
+import com.yyrh.networking.NetRequestApi;
+import com.yyrh.sdk.callback.RegisterCallback;
+
+public class RegisterLayout implements View.OnClickListener {
+
+
+    private ConstantDialog constantDialog;
+    private Context context;
+    private EditText accountEdit,registPwdEdit;
+    private Button backToLogin,registCompete,reg_phone_btn;
+    private CheckBox cb_register;
+    private TextView tv_tip,tv_private_policy;
+    public RegisterLayout(Context context,ConstantDialog constantDialog){
+        this.constantDialog = constantDialog;
+        this.context = context;
+        if (SDKSettings.isLandscape){
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_register_dialog"));
+        }else{
+            constantDialog.setContentView(ResourceUtil.getLayoutId(context, "yyrh_register_dialog_protrait"));
+        }
+
+
+
+        backToLogin =  constantDialog.findViewById(ResourceUtil.getId(context, "reg_back_btn"));
+        registCompete =  constantDialog.findViewById(ResourceUtil.getId(context, "reg_compete_btn"));
+
+        accountEdit = constantDialog.findViewById(ResourceUtil.getId(context, "reg_account_edit"));
+        registPwdEdit = constantDialog.findViewById(ResourceUtil.getId(context, "reg_pwd_edit"));
+
+        cb_register = constantDialog.findViewById(ResourceUtil.getId(context, "cb_register"));
+        tv_tip = constantDialog.findViewById(ResourceUtil.getId(context, "tv_tip"));
+        tv_tip.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );
+        tv_tip.getPaint().setAntiAlias(true);
+
+        tv_private_policy = constantDialog.findViewById(ResourceUtil.getId(context, "tv_private_policy"));
+        tv_private_policy.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );
+        tv_private_policy.getPaint().setAntiAlias(true);
+        tv_private_policy.setOnClickListener(this);
+
+
+        reg_phone_btn = constantDialog.findViewById(ResourceUtil.getId(context, "reg_phone_btn"));
+
+        accountEdit.setText("qj" + Utils.getRandom(7));
+        registPwdEdit.setText(Utils.getRandom(7));
+        backToLogin.setOnClickListener(this);
+        registCompete.setOnClickListener(this);
+        tv_tip.setOnClickListener(this);
+        reg_phone_btn.setOnClickListener(this);
+
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == ResourceUtil.getId(context, "reg_compete_btn")) {
+
+            registerInterval();
+            startRegister(accountEdit.getText().toString(), registPwdEdit.getText().toString());
+        }else if (id == ResourceUtil.getId(context, "reg_back_btn")) {
+
+            new LoginLayout(context,constantDialog);
+        }
+        else if (id == ResourceUtil.getId(context, "tv_tip")) {
+
+
+            String url  =  SDKSettings.UserCentUrl + URLConstants.USERPROTOCOLWEB + "gcp_code=" + SDKSettings.gcp_code
+                    + "&game_code=" + SDKSettings.game_code;
+
+            new WvPageListDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"),url).show();
+
+        }else if (id == ResourceUtil.getId(context, "tv_private_policy")) {
+
+
+            String url  =  SDKSettings.UserCentUrl + URLConstants.USERPOLICYWEB + "gcp_code=" + SDKSettings.gcp_code
+                    + "&game_code=" + SDKSettings.game_code;
+
+            new WvPageListDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"),url).show();
+
+        }else if (id == ResourceUtil.getId(context, "reg_phone_btn")) {
+
+            new PhoneRegisterLayout(context,constantDialog);
+        }
+    }
+
+    private void startRegister(final String account, final String pwd) {
+        if (!cb_register.isChecked()){
+
+            new TosUtil(context,"blue", context.getString(ResourceUtil.getStringId(context, "yyrh_pls_checked_reg_tip"))).show();
+
+            return;
+        }
+        if (Utils.judgeStrNull(account)){
+            new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_account"))).show();
+
+
+
+            return;
+        }
+        if (Utils.isNumeric(account)){
+            new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_acount_not_only_number"))).show();
+
+            return;
+        }
+        if (Utils.judgeStrNull(pwd)){
+            new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_band_need_pwd"))).show();
+
+
+            return;
+        }
+
+        if (account.length() < 6 || pwd.length() > 20) {
+            new TosUtil(context,"blue",  context.getString(ResourceUtil.getStringId(context, "yyrh_regist_account_error"))).show();
+
+
+            return;
+        }
+
+        if (pwd.length() < 6 || pwd.length() > 20) {
+
+            new TosUtil(context, "blue", context.getString(ResourceUtil.getStringId(context, "yyrh_regist_pwd_error"))).show();
+            return;
+        }
+
+
+
+        NetRequestApi.registerWithYy((Activity) context, account, pwd, new RegisterCallback() {
+            @Override
+            public void onRegisterSuccess(String token) {
+
+
+                if (ScreenShotUtil.shotByDialog(context,constantDialog)){
+                    new TosUtil(context,"green",  context.getString(ResourceUtil.getStringId(context, "yyrh_register_screen_tip"))).show();
+
+
+                }
+
+                constantDialog.dismiss();
+                SDKSettings.isVefityRealName = false;
+                YyrhSdkManager.defaultManager(context).saveUserLoginInfo(context,account,pwd,token);
+                SDKEntry.getSdkInstance().adSdkCallback.onRegisterSuccess(account);
+            }
+
+            @Override
+            public void onRegisterFailed(String msg) {
+
+                new TosUtil(context,"blue",  msg).show();
+
+
+            }
+
+        });
+    }
+
+    private void registerInterval() {
+
+
+        registCompete.setEnabled(false);
+        registCompete.setText("3s");
+        registCompete.setBackgroundResource(ResourceUtil.getColorId(context,"yyrh_black_color_40"));
+        TimeCount time = new TimeCount(3000, 1000);
+        time.start();
+    }
+
+    class TimeCount extends CountDownTimer {
+
+        public TimeCount(long millisInFuture, long countDownInterval) {
+            super(millisInFuture, countDownInterval);
+            // TODO Auto-generated constructor stub
+        }
+
+        @Override
+        public void onTick(long millisUntilFinished) {
+            // TODO Auto-generated method stub
+            registCompete.setText(millisUntilFinished / 1000 + "s");
+
+        }
+
+        @Override
+        public void onFinish() {
+            // TODO Auto-generated method stub
+            registCompete.setEnabled(true);
+            registCompete.setBackgroundResource(ResourceUtil.getDrawableId(context,"qj_login_bg"));
+            registCompete.setText(ResourceUtil.getStringId(context, "yyrh_register_success"));
+        }
+
+    }
+}
+

+ 73 - 0
hnqj/src/main/java/com/yyrh/ui/SingleButtonDialog.java

@@ -0,0 +1,73 @@
+package com.yyrh.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import android.widget.TextView;
+
+
+import com.yyrh.utils.ResourceUtil;
+
+
+public class SingleButtonDialog extends Dialog {
+
+	private	static TextView bt_exit_game,content;
+
+
+	private static SingleButtonDialog dialog;
+
+	public SingleButtonDialog(Context context, int theme) {
+		super(context, theme);
+
+	}
+	public  static class  Builder{
+		private Context context;
+		private OnClickListener positiveButtonClickListener;
+
+		public Builder(Context context){ this.context = context;}
+		public Builder setPositiveButton(OnClickListener listener){
+			this.positiveButtonClickListener = listener;
+			return this;
+		}
+
+		public void  dialogDismiss(){dialog.dismiss();}
+		public SingleButtonDialog Create(String msg){
+			{
+				LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+				dialog = new SingleButtonDialog(context,ResourceUtil.getStyleId(context,"yyrh_base_dialog"));
+				View layout;
+
+				layout =  inflater.inflate(ResourceUtil.getLayoutId(context, "yyrh_ios_style_dialog"),null);
+
+
+
+				dialog.addContentView(layout,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+
+				bt_exit_game =(TextView) dialog.findViewById(ResourceUtil.getId(context,
+						"confirm"));
+				content =(TextView) dialog.findViewById(ResourceUtil.getId(context,
+						"content"));
+				content.setText(msg);
+
+				if (bt_exit_game!=null){
+					bt_exit_game.setOnClickListener(new View.OnClickListener() {
+						@Override
+						public void onClick(View view) {
+							positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);
+						}
+					});
+				}
+
+				}
+				return dialog;
+			}
+		}
+
+
+
+
+}

+ 32 - 0
hnqj/src/main/java/com/yyrh/ui/activity/BaseActivity.java

@@ -0,0 +1,32 @@
+package com.yyrh.ui.activity;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.Window;
+import android.view.WindowManager;
+
+import com.yyrh.utils.Utils;
+
+public class BaseActivity extends Activity {
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);// 设置全屏
+    }
+
+    public void addFragmentToActivity(FragmentManager fragmentManager,
+                                      Fragment fragment, int frameId) {
+        Utils.checkNotNull(fragmentManager);
+        Utils.checkNotNull(fragment);
+        FragmentTransaction transaction = fragmentManager.beginTransaction();
+        transaction.add(frameId, fragment);
+        transaction.commit();
+    }
+}

+ 57 - 0
hnqj/src/main/java/com/yyrh/ui/activity/UseLoginActivity.java

@@ -0,0 +1,57 @@
+package com.yyrh.ui.activity;
+
+
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.KeyEvent;
+import android.view.Window;
+import android.widget.FrameLayout;
+
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.ui.fragment.FragmentUtils;
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.Utils;
+
+public class UseLoginActivity extends BaseActivity {
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(ResourceUtil.getLayoutId(this,"qj_login_activity"));
+        initView(this);
+    }
+    private void initView(Context context){
+        Intent intent = getIntent();
+        boolean isLandscape =intent.getBooleanExtra("isLandscape",true);
+        int fragmentTag  =intent.getIntExtra("fragmentTag",FragmentUtils.SDK_REGISTER_TAG);
+        Fragment mJmUserLoginFragment = FragmentUtils.getSdkFragment(context,fragmentTag);
+
+
+        FrameLayout layout = findViewById(ResourceUtil.getId(this,"qj_content"));
+
+        if (isLandscape){
+            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        }else{
+            Float x = Float.valueOf("0.9").floatValue();
+            Float y = Float.valueOf("0.9").floatValue();
+            layout.setScaleX(x);
+            layout.setScaleY(y);
+            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+        }
+
+
+        addFragmentToActivity(getFragmentManager(),mJmUserLoginFragment,layout.getId());
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+}

+ 391 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/DotImageView.java

@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 2016, Shanghai YUEWEN Information Technology Co., Ltd.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *  Neither the name of Shanghai YUEWEN Information Technology Co., Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SHANGHAI YUEWEN INFORMATION TECHNOLOGY CO., LTD. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.yyrh.ui.floatmenu;
+
+import android.animation.Animator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Camera;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.support.annotation.Nullable;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.animation.LinearInterpolator;
+
+
+/**
+ * Created by wengyiming on 2017/7/21.
+ */
+
+/**
+ * 00%=FF(不透明)    5%=F2    10%=E5    15%=D8    20%=CC    25%=BF    30%=B2    35%=A5    40%=99    45%=8c    50%=7F
+ * 55%=72    60%=66    65%=59    70%=4c    75%=3F    80%=33    85%=21    90%=19    95%=0c    100%=00(全透明)
+ */
+public class DotImageView extends View {
+    private static final String TAG = DotImageView.class.getSimpleName();
+    public static final int NORMAL = 0;//不隐藏
+    public static final int HIDE_LEFT = 1;//左边隐藏
+    public static final int HIDE_RIGHT = 2;//右边隐藏
+    private Paint mPaint;//用于画anything
+
+    private Paint mPaintBg;//用于画anything
+    private String dotNum = null;//红点数字
+    private float mAlphValue;//透明度动画值
+    private float mRolateValue = 1f;//旋转动画值
+    private boolean inited = false;//标记透明动画是否执行过,防止因onreseme 切换导致重复执行
+
+
+    private Bitmap mBitmap;//logo
+    private final int mLogoBackgroundRadius = dip2px(25);//logo的灰色背景圆的半径
+    private final int mLogoWhiteRadius = dip2px(20);//logo的白色背景的圆的半径
+    private final int mRedPointRadiusWithNum = dip2px(6);//红点圆半径
+    private final int mRedPointRadius = dip2px(3);//红点圆半径
+    private final int mRedPointOffset = dip2px(10);//红点对logo的偏移量,比如左红点就是logo中心的 x - mRedPointOffset
+
+    private boolean isDraging = false;//是否 绘制旋转放大动画,只有 非停靠边缘才绘制
+    private float scaleOffset;//放大偏移值
+    private ValueAnimator mDragingValueAnimator;//放大、旋转 属性动画
+    private LinearInterpolator mLinearInterpolator = new LinearInterpolator();//通用用加速器
+    public boolean mDrawDarkBg = true;//是否绘制黑色背景,当菜单关闭时,才绘制灰色背景
+    private static final float hideOffset = 0.5f;//往左右隐藏多少宽度的偏移值, 隐藏宽度的0.4
+    private static final float hideOffsetAlpha = 0.5f;//往左右隐藏多少宽度的偏移值, 隐藏宽度的0.4
+    private Camera mCamera;//camera用于执行3D动画
+
+    private boolean mDrawNum = false;//只绘制红点还是红点+白色数字
+
+    private int mStatus = NORMAL;//0 正常,1 左,2右,3 中间方法旋转
+    private int mLastStatus = mStatus;
+    private Matrix mMatrix;
+    private boolean mIsResetPosition;
+
+    private int mBgColor = 0x99000000;
+
+
+    public void setBgColor(int bgColor) {
+        mBgColor = bgColor;
+    }
+
+
+    public void setDrawNum(boolean drawNum) {
+        this.mDrawNum = drawNum;
+    }
+
+    public void setDrawDarkBg(boolean drawDarkBg) {
+        mDrawDarkBg = drawDarkBg;
+        invalidate();
+    }
+
+    public int getStatus() {
+        return mStatus;
+    }
+
+
+    public void setStatus(int status) {
+        this.mStatus = status;
+        isDraging = false;
+        if (this.mStatus != NORMAL) {
+            setDrawNum(mDrawNum);
+            this.mDrawDarkBg = true;
+        }
+        invalidate();
+
+    }
+
+    public void setBitmap(Bitmap bitmap) {
+        mBitmap = bitmap;
+    }
+
+    public DotImageView(Context context, Bitmap bitmap) {
+        super(context);
+        this.mBitmap = bitmap;
+        init();
+    }
+
+
+    public DotImageView(Context context) {
+        super(context);
+        init();
+    }
+
+    public DotImageView(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+        init();
+    }
+
+    public DotImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        init();
+    }
+
+    private void init() {
+        mPaint = new Paint();
+        mPaint.setAntiAlias(true);
+        mPaint.setTextSize(sp2px(10));
+        mPaint.setStyle(Paint.Style.FILL);
+
+        mPaintBg = new Paint();
+        mPaintBg.setAntiAlias(true);
+        mPaintBg.setStyle(Paint.Style.FILL);
+        mPaintBg.setColor(mBgColor);//60% 黑色背景 (透明度 40%)
+
+        mCamera = new Camera();
+        mMatrix = new Matrix();
+    }
+
+    /**
+     * 这个方法是否有优化空间
+     */
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        int wh = mLogoBackgroundRadius * 2;
+        setMeasuredDimension(wh, wh);
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        float centryX = getWidth() / 2;
+        float centryY = getHeight() / 2;
+        canvas.save();//保存一份快照,方便后面恢复
+        mCamera.save();
+        setAlpha(1.0f);
+        if (mStatus == NORMAL) {
+            if (mLastStatus != NORMAL) {
+                canvas.restore();//恢复画布的原始快照
+                mCamera.restore();
+            }
+
+            if (isDraging) {
+
+                //如果当前是拖动状态则放大并旋转
+               // canvas.scale((scaleOffset + 1f), (scaleOffset + 1f), getWidth() / 2, getHeight() / 2);
+                if (mIsResetPosition) {
+                    //手指拖动后离开屏幕复位时使用 x轴旋转 3d动画
+                    mCamera.save();
+                    mCamera.rotateX(720 * scaleOffset);//0-720度 最多转两圈
+                    mCamera.getMatrix(mMatrix);
+
+                    mMatrix.preTranslate(-getWidth() / 2, -getHeight() / 2);
+                    mMatrix.postTranslate(getWidth() / 2, getHeight() / 2);
+                    canvas.concat(mMatrix);
+                    mCamera.restore();
+                } else {
+                    //手指拖动且手指未离开屏幕则使用 绕图心2d旋转动画
+                    canvas.rotate(60 * mRolateValue, getWidth() / 2, getHeight() / 2);
+                }
+            }
+
+
+        } else if (mStatus == HIDE_LEFT) {
+            canvas.translate(-getWidth() * hideOffset, 0);
+            canvas.rotate(0, getWidth() / 2, getHeight() / 2);
+            setAlpha(hideOffsetAlpha);
+
+        } else if (mStatus == HIDE_RIGHT) {
+            canvas.translate(getWidth() * hideOffset, 0);
+            canvas.rotate(0, getWidth() / 2, getHeight() / 2);
+            setAlpha(hideOffsetAlpha);
+        }
+        canvas.save();
+        if (!isDraging) {
+            if (mDrawDarkBg) {
+                mPaintBg.setColor(Color.TRANSPARENT);
+                canvas.drawCircle(centryX, centryY, mLogoBackgroundRadius, mPaintBg);
+                // 60% 白色 (透明度 40%)
+                mPaint.setColor(0x99ffffff);
+            } else {
+                //100% 白色背景 (透明度 0%)
+                mPaint.setColor(0xFFFFFFFF);
+            }
+            if (mAlphValue != 0) {
+                mPaint.setAlpha((int) (mAlphValue * 255));
+            }
+            canvas.drawCircle(centryX, centryY, mLogoWhiteRadius, mPaint);
+        }
+
+        canvas.restore();
+        //100% 白色背景 (透明度 0%)
+        mPaint.setColor(0xFFFFFFFF);
+        int left = (int) (centryX - mBitmap.getWidth() / 2);
+        int top = (int) (centryY - mBitmap.getHeight() / 2);
+        canvas.drawBitmap(mBitmap, left, top, mPaint);
+
+
+        if (!TextUtils.isEmpty(dotNum)) {
+            int readPointRadus = (mDrawNum ? mRedPointRadiusWithNum : mRedPointRadius);
+            mPaint.setColor(Color.RED);
+            if (mStatus == HIDE_LEFT) {
+                canvas.drawCircle(centryX + mRedPointOffset, centryY - mRedPointOffset, readPointRadus, mPaint);
+                if (mDrawNum) {
+                    mPaint.setColor(Color.WHITE);
+                    canvas.drawText(dotNum, centryX + mRedPointOffset - getTextWidth(dotNum, mPaint) / 2, centryY - mRedPointOffset + getTextHeight(dotNum, mPaint) / 2, mPaint);
+                }
+            } else if (mStatus == HIDE_RIGHT) {
+                canvas.drawCircle(centryX - mRedPointOffset, centryY - mRedPointOffset, readPointRadus, mPaint);
+                if (mDrawNum) {
+                    mPaint.setColor(Color.WHITE);
+                    canvas.drawText(dotNum, centryX - mRedPointOffset - getTextWidth(dotNum, mPaint) / 2, centryY - mRedPointOffset + getTextHeight(dotNum, mPaint) / 2, mPaint);
+                }
+            } else {
+                if (mLastStatus == HIDE_LEFT) {
+                    canvas.drawCircle(centryX + mRedPointOffset, centryY - mRedPointOffset, readPointRadus, mPaint);
+                    if (mDrawNum) {
+                        mPaint.setColor(Color.WHITE);
+                        canvas.drawText(dotNum, centryX + mRedPointOffset - getTextWidth(dotNum, mPaint) / 2, centryY - mRedPointOffset + getTextHeight(dotNum, mPaint) / 2, mPaint);
+                    }
+                } else if (mLastStatus == HIDE_RIGHT) {
+                    canvas.drawCircle(centryX - mRedPointOffset, centryY - mRedPointOffset, readPointRadus, mPaint);
+                    if (mDrawNum) {
+                        mPaint.setColor(Color.WHITE);
+                        canvas.drawText(dotNum, centryX - mRedPointOffset - getTextWidth(dotNum, mPaint) / 2, centryY - mRedPointOffset + getTextHeight(dotNum, mPaint) / 2, mPaint);
+                    }
+                }
+            }
+        }
+        mLastStatus = mStatus;
+    }
+
+
+    public void setDotNum(int num, Animator.AnimatorListener l) {
+        if (!inited) {
+            startAnim(num, l);
+        } else {
+            refreshDot(num);
+        }
+    }
+
+    public void refreshDot(int num) {
+        if (num > 0) {
+            String dotNumTmp = String.valueOf(num);
+            if (!TextUtils.equals(dotNum, dotNumTmp)) {
+                dotNum = dotNumTmp;
+                invalidate();
+            }
+        } else {
+            dotNum = null;
+        }
+    }
+
+    public void startAnim(final int num, Animator.AnimatorListener l) {
+        ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.f, 0.6f, 1f, 0.6f);
+        valueAnimator.setInterpolator(mLinearInterpolator);
+        valueAnimator.setDuration(3000);
+        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator animation) {
+                mAlphValue = (float) animation.getAnimatedValue();
+                invalidate();
+
+            }
+        });
+        valueAnimator.addListener(l);
+        valueAnimator.addListener(new Animator.AnimatorListener() {
+            @Override
+            public void onAnimationStart(Animator animation) {
+
+            }
+
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                inited = true;
+                refreshDot(num);
+                mAlphValue = 0;
+
+            }
+
+            @Override
+            public void onAnimationCancel(Animator animation) {
+                mAlphValue = 0;
+            }
+
+            @Override
+            public void onAnimationRepeat(Animator animation) {
+
+            }
+        });
+        valueAnimator.start();
+    }
+
+    public void setDraging(boolean draging, float offset, boolean isResetPosition) {
+        isDraging = draging;
+        this.mIsResetPosition = isResetPosition;
+        if (offset > 0 && offset != this.scaleOffset) {
+            this.scaleOffset = offset;
+        }
+        if (isDraging && mStatus == NORMAL) {
+            if (mDragingValueAnimator != null) {
+                if (mDragingValueAnimator.isRunning()) return;
+            }
+            mDragingValueAnimator = ValueAnimator.ofFloat(0, 6f, 12f, 0f);
+            mDragingValueAnimator.setInterpolator(mLinearInterpolator);
+            mDragingValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+                @Override
+                public void onAnimationUpdate(ValueAnimator animation) {
+                    mRolateValue = (float) animation.getAnimatedValue();
+                    invalidate();
+                }
+            });
+            mDragingValueAnimator.addListener(new Animator.AnimatorListener() {
+                @Override
+                public void onAnimationStart(Animator animation) {
+
+                }
+
+                @Override
+                public void onAnimationEnd(Animator animation) {
+                    isDraging = false;
+                    mIsResetPosition = false;
+                }
+
+                @Override
+                public void onAnimationCancel(Animator animation) {
+
+                }
+
+                @Override
+                public void onAnimationRepeat(Animator animation) {
+
+                }
+            });
+            mDragingValueAnimator.setDuration(1000);
+            mDragingValueAnimator.start();
+        }
+    }
+
+    private int dip2px(float dipValue) {
+        final float scale = getContext().getResources().getDisplayMetrics().density;
+        return (int) (dipValue * scale + 0.5f);
+    }
+
+    private int sp2px(float spValue) {
+        final float fontScale = getContext().getResources().getDisplayMetrics().scaledDensity;
+        return (int) (spValue * fontScale + 0.5f);
+    }
+
+    private float getTextHeight(String text, Paint paint) {
+        Rect rect = new Rect();
+        paint.getTextBounds(text, 0, text.length(), rect);
+        return rect.height() / 1.1f;
+    }
+
+    private float getTextWidth(String text, Paint paint) {
+        return paint.measureText(text);
+    }
+}

+ 112 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatItem.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016, Shanghai YUEWEN Information Technology Co., Ltd.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *  Neither the name of Shanghai YUEWEN Information Technology Co., Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SHANGHAI YUEWEN INFORMATION TECHNOLOGY CO., LTD. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.yyrh.ui.floatmenu;
+
+import android.graphics.Bitmap;
+import android.graphics.Color;
+
+/**
+ * Created by wengyiming on 2017/7/21.
+ */
+
+public class FloatItem {
+    public String title;
+    public int titleColor = Color.BLACK;
+    public int bgColor = Color.WHITE;
+    public Bitmap icon;
+    public String dotNum = null;
+
+    public FloatItem(String title, int titleColor, int bgColor, Bitmap icon, String dotNum) {
+        this.title = title;
+        this.titleColor = titleColor;
+        this.bgColor = bgColor;
+        this.icon = icon;
+        this.dotNum = dotNum;
+    }
+
+    public String getDotNum() {
+        return dotNum;
+    }
+
+
+    public FloatItem(String title, int titleColor, int bgColor, Bitmap bitmap) {
+        this.title = title;
+        this.titleColor = titleColor;
+        this.bgColor = bgColor;
+        this.icon = bitmap;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getTitleColor() {
+        return titleColor;
+    }
+
+    public void setTitleColor(int titleColor) {
+        this.titleColor = titleColor;
+    }
+
+    public int getBgColor() {
+        return bgColor;
+    }
+
+    public void setBgColor(int bgColor) {
+        this.bgColor = bgColor;
+    }
+
+    public Bitmap getIcon() {
+        return icon;
+    }
+
+    public void setIcon(Bitmap icon) {
+        this.icon = icon;
+    }
+
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (obj == this) return true;
+
+        if (obj instanceof FloatItem) {
+            FloatItem floatItem = (FloatItem) obj;
+            return floatItem.title.equals(this.title);
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return title.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return "FloatItem{" +
+                "title='" + title + '\'' +
+                ", titleColor=" + titleColor +
+                ", bgColor=" + bgColor +
+                ", icon=" + icon +
+                ", dotNum='" + dotNum + '\'' +
+                '}';
+    }
+}

+ 1036 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatLogoMenu.java

@@ -0,0 +1,1036 @@
+/*
+ * Copyright (c) 2016, Shanghai YUEWEN Information Technology Co., Ltd.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *  Neither the name of Shanghai YUEWEN Information Technology Co., Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SHANGHAI YUEWEN INFORMATION TECHNOLOGY CO., LTD. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.yyrh.ui.floatmenu;
+
+import android.animation.Animator;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.Bitmap;
+import android.graphics.Color;
+import android.graphics.PixelFormat;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.os.Looper;
+import android.text.TextUtils;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by wengyiming on 2017/7/20.
+ */
+public class FloatLogoMenu {
+    /**
+     * 记录 logo 停放的位置,以备下次恢复
+     */
+    private static final String LOCATION_X = "hintLocation";
+    private static final String LOCATION_Y = "locationY";
+
+    /**
+     * 悬浮球 坐落 左 右 标记
+     */
+    public static final int LEFT = 0;
+    public static final int RIGHT = 1;
+
+    /**
+     * 记录系统状态栏的高度
+     */
+    private int mStatusBarHeight;
+    /**
+     * 记录当前手指位置在屏幕上的横坐标值
+     */
+    private float mXInScreen;
+
+    /**
+     * 记录当前手指位置在屏幕上的纵坐标值
+     */
+    private float mYInScreen;
+
+    /**
+     * 记录手指按下时在屏幕上的横坐标的值
+     */
+    private float mXDownInScreen;
+
+    /**
+     * 记录手指按下时在屏幕上的纵坐标的值
+     */
+    private float mYDownInScreen;
+
+    /**
+     * 记录手指按下时在小悬浮窗的View上的横坐标的值
+     */
+    private float mXInView;
+
+    /**
+     * 记录手指按下时在小悬浮窗的View上的纵坐标的值
+     */
+    private float mYinview;
+
+    /**
+     * 记录屏幕的宽度
+     */
+    private int mScreenWidth;
+
+    /**
+     * 来自 activity 的 wManager
+     */
+    private WindowManager wManager;
+
+
+    /**
+     * 为 wManager 设置 LayoutParams
+     */
+    private WindowManager.LayoutParams wmParams;
+
+    /**
+     * 带透明度动画、旋转、放大的悬浮球
+     */
+    private DotImageView mFloatLogo;
+
+
+    /**
+     * 用于 定时 隐藏 logo的定时器
+     */
+    private CountDownTimer mHideTimer;
+
+
+    /**
+     * float menu的高度
+     */
+    private Handler mHandler = new Handler(Looper.getMainLooper());
+
+
+    /**
+     * 悬浮窗左右移动到默认位置 动画的 加速器
+     */
+    private Interpolator mLinearInterpolator = new LinearInterpolator();
+
+    /**
+     * 用于记录上次菜单打开的时间,判断时间间隔
+     */
+    private static double DOUBLE_CLICK_TIME = 0L;
+
+    /**
+     * 标记是否拖动中
+     */
+    private boolean isDraging = false;
+
+    /**
+     * 用于恢复悬浮球的location的属性动画值
+     */
+    private int mResetLocationValue;
+
+    /**
+     * 手指离开屏幕后 用于恢复 悬浮球的 logo 的左右位置
+     */
+    private Runnable updatePositionRunnable = new Runnable() {
+        @Override
+        public void run() {
+            isDraging = true;
+            checkPosition();
+
+        }
+    };
+
+    /**
+     * 这个事件不做任何事情、直接return false则 onclick 事件生效
+     */
+    private OnTouchListener mDefaultOnTouchListerner = new OnTouchListener() {
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            isDraging = false;
+            return false;
+        }
+    };
+
+    /**
+     * 这个事件用于处理移动、自定义点击或者其它事情,return true可以保证onclick事件失效
+     */
+    private OnTouchListener touchListener = new OnTouchListener() {
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    floatEventDown(event);
+                    break;
+                case MotionEvent.ACTION_MOVE:
+                    floatEventMove(event);
+                    break;
+                case MotionEvent.ACTION_UP:
+                case MotionEvent.ACTION_CANCEL:
+                    floatEventUp();
+                    break;
+            }
+            return true;
+        }
+    };
+
+
+    /**
+     * 菜单背景颜色
+     */
+    private int mBackMenuColor = 0xffe4e3e1;
+
+    /**
+     * 是否绘制红点数字
+     */
+    private boolean mDrawRedPointNum;
+
+
+    /**
+     * 是否绘制圆形菜单项,false绘制方形
+     */
+    private boolean mCicleMenuBg;
+
+
+    /**
+     * R.drawable.game_logo
+     *
+     * @param floatItems
+     */
+    private Bitmap mLogoRes;
+
+    /**
+     * 用于显示在 mActivity 上的 mActivity
+     */
+    private Context mActivity;
+
+    /**
+     * 菜单 点击、关闭 监听
+     */
+    private FloatMenuView.OnMenuClickListener mOnMenuClickListener;
+
+
+    /**
+     * 停靠默认位置
+     */
+    private int mDefaultLocation = RIGHT;
+
+
+    /**
+     * 悬浮窗 坐落 位置
+     */
+    private int mHintLocation = mDefaultLocation;
+
+
+    /**
+     * 用于记录菜单项内容
+     */
+    private List<FloatItem> mFloatItems = new ArrayList<>();
+
+    private LinearLayout rootViewRight;
+
+    private LinearLayout rootView;
+
+    private ValueAnimator valueAnimator;
+
+    private boolean isExpaned = false;
+
+    private Drawable mBackground;
+
+
+    private FloatLogoMenu(Builder builder) {
+        mBackMenuColor = builder.mBackMenuColor;
+        mDrawRedPointNum = builder.mDrawRedPointNum;
+        mCicleMenuBg = builder.mCicleMenuBg;
+        mLogoRes = builder.mLogoRes;
+        mActivity = builder.mActivity;
+        mOnMenuClickListener = builder.mOnMenuClickListener;
+        mDefaultLocation = builder.mDefaultLocation;
+        mFloatItems = builder.mFloatItems;
+        mBackground = builder.mDrawable;
+
+
+//        if (mActivity == null || mActivity.isFinishing() || mActivity.getWindowManager() == null) {
+//            throw new IllegalArgumentException("Activity = null, or Activity is isFinishing ,or this Activity`s  token is bad");
+//        }
+
+        if (mLogoRes == null) {
+            throw new IllegalArgumentException("No logo found,you can setLogo/showWithLogo to set a FloatLogo ");
+        }
+
+        if (mFloatItems.isEmpty()) {
+            throw new IllegalArgumentException("At least one menu item!");
+        }
+
+        initFloatWindow();
+        initTimer();
+        initFloat();
+
+    }
+
+    public void setFloatItemList(List<FloatItem> floatItems) {
+        this.mFloatItems = floatItems;
+        caculateDotNum();
+    }
+
+    /**
+     * 初始化悬浮球 window
+     */
+    private void initFloatWindow() {
+        wmParams = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT,
+                WindowManager.LayoutParams.WRAP_CONTENT,
+                WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
+                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+                        | WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                PixelFormat.TRANSLUCENT);
+
+        if (mActivity instanceof Activity) {
+            Activity activity = (Activity) mActivity;
+            wManager = activity.getWindowManager();
+            //类似dialog,寄托在activity的windows上,activity关闭时需要关闭当前float
+            wmParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL;
+
+
+
+        } else {
+            wManager = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+                if (Build.VERSION.SDK_INT > 23) {
+                    //在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
+                    wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+                } else {
+                    wmParams.type =WindowManager.LayoutParams.TYPE_TOAST;
+                }
+            } else {
+                wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+            }
+        }
+
+        mScreenWidth = wManager.getDefaultDisplay().getWidth();
+        int screenHeigth = wManager.getDefaultDisplay().getHeight();
+
+        //判断状态栏是否显示 如果不显示则statusBarHeight为0
+        mStatusBarHeight = dp2Px(0, mActivity);
+
+        wmParams.format = PixelFormat.RGBA_8888;
+        wmParams.gravity = Gravity.LEFT | Gravity.TOP;
+
+
+
+
+        wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+        | WindowManager.LayoutParams.FLAG_FULLSCREEN;
+        mHintLocation = getSetting(LOCATION_X, mDefaultLocation);
+        int defaultY = ((screenHeigth - mStatusBarHeight) / 2) / 3;
+        int y = getSetting(LOCATION_Y, defaultY);
+        if (mHintLocation == LEFT) {
+            wmParams.x = 0;
+        } else {
+            wmParams.x = mScreenWidth;
+        }
+
+
+        if (y != 0 && y != defaultY) {
+            wmParams.y = y;
+        } else {
+            wmParams.y = defaultY;
+        }
+
+        wmParams.alpha = 1;
+        wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
+        wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
+    }
+
+
+    /**
+     * 初始化悬浮球
+     */
+    private void initFloat() {
+        genarateLeftLineLayout();
+        genarateRightLineLayout();
+        mFloatLogo = new DotImageView(mActivity, mLogoRes);
+        mFloatLogo.setLayoutParams(new WindowManager.LayoutParams(dp2Px(50, mActivity), dp2Px(50, mActivity)));
+        mFloatLogo.setDrawNum(mDrawRedPointNum);
+        mFloatLogo.setBgColor(mBackMenuColor);
+        mFloatLogo.setDrawDarkBg(true);
+
+        caculateDotNum();
+        floatBtnEvent();
+        try {
+
+
+            wManager.addView(mFloatLogo, wmParams);
+
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void genarateLeftLineLayout() {
+        DotImageView floatLogo = new DotImageView(mActivity, mLogoRes);
+        floatLogo.setLayoutParams(new WindowManager.LayoutParams(dp2Px(50, mActivity), dp2Px(50, mActivity)));
+        floatLogo.setDrawNum(mDrawRedPointNum);
+        floatLogo.setDrawDarkBg(false);
+
+        rootView = new LinearLayout(mActivity);
+        rootView.setOrientation(LinearLayout.HORIZONTAL);
+        rootView.setGravity(Gravity.CENTER);
+        rootView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp2Px(50, mActivity)));
+
+        rootView.setBackgroundDrawable(mBackground);
+
+
+        final FloatMenuView mFloatMenuView = new FloatMenuView.Builder(mActivity)
+                .setFloatItems(mFloatItems)
+                .setBackgroundColor(Color.TRANSPARENT)
+                .setCicleBg(mCicleMenuBg)
+                .setStatus(FloatMenuView.STATUS_LEFT)
+                .setMenuBackgroundColor(Color.TRANSPARENT)
+                .drawNum(mDrawRedPointNum)
+                .create();
+        setMenuClickListener(mFloatMenuView);
+
+        rootView.addView(floatLogo);
+        rootView.addView(mFloatMenuView);
+
+
+        floatLogo.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (isExpaned) {
+                    try {
+                        wManager.removeViewImmediate(rootView);
+                        wManager.addView(FloatLogoMenu.this.mFloatLogo, wmParams);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    isExpaned = false;
+                }
+            }
+        });
+    }
+    public void hideMenu(){
+        if (isExpaned) {
+            try {
+                wManager.removeViewImmediate(mHintLocation == LEFT ? rootView : rootViewRight);
+                wManager.addView(FloatLogoMenu.this.mFloatLogo, wmParams);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            isExpaned = false;
+        }
+    }
+    private void genarateRightLineLayout() {
+        final DotImageView floatLogo = new DotImageView(mActivity, mLogoRes);
+        floatLogo.setLayoutParams(new WindowManager.LayoutParams(dp2Px(50, mActivity), dp2Px(50, mActivity)));
+        floatLogo.setDrawNum(mDrawRedPointNum);
+        floatLogo.setDrawDarkBg(false);
+
+        floatLogo.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (isExpaned) {
+                    try {
+                        wManager.removeViewImmediate(rootViewRight);
+                        wManager.addView(FloatLogoMenu.this.mFloatLogo, wmParams);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    isExpaned = false;
+                }
+            }
+        });
+
+        rootViewRight = new LinearLayout(mActivity);
+        rootViewRight.setOrientation(LinearLayout.HORIZONTAL);
+        rootViewRight.setGravity(Gravity.CENTER);
+        rootViewRight.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp2Px(50, mActivity)));
+
+
+        rootViewRight.setBackgroundDrawable(mBackground);
+
+
+        FloatMenuView mFloatMenuView = new FloatMenuView.Builder(mActivity)
+                .setFloatItems(mFloatItems)
+                .setBackgroundColor(Color.TRANSPARENT)
+                .setCicleBg(mCicleMenuBg)
+                .setStatus(FloatMenuView.STATUS_RIGHT)
+                .setMenuBackgroundColor(Color.TRANSPARENT)
+                .drawNum(mDrawRedPointNum)
+                .create();
+        setMenuClickListener(mFloatMenuView);
+
+        rootViewRight.addView(mFloatMenuView);
+        rootViewRight.addView(floatLogo);
+
+
+    }
+
+    /**
+     * 初始化 隐藏悬浮球的定时器
+     */
+    private void initTimer() {
+        mHideTimer = new CountDownTimer(2000, 10) {        //悬浮窗超过5秒没有操作的话会自动隐藏
+            @Override
+            public void onTick(long millisUntilFinished) {
+                if (isExpaned) {
+                    mHideTimer.cancel();
+                }
+            }
+
+            @Override
+            public void onFinish() {
+                if (isExpaned) {
+                    mHideTimer.cancel();
+                    return;
+                }
+                if (!isDraging) {
+                    if (mHintLocation == LEFT) {
+                        mFloatLogo.setStatus(DotImageView.HIDE_LEFT);
+                        mFloatLogo.setDrawDarkBg(true);
+                    } else {
+                        mFloatLogo.setStatus(DotImageView.HIDE_RIGHT);
+                        mFloatLogo.setDrawDarkBg(true);
+                    }
+//                    mFloatLogo.setOnTouchListener(mDefaultOnTouchListerner);//把onClick事件分发下去,防止onclick无效
+                }
+            }
+        };
+    }
+
+
+    /**
+     * 用于 拦截 菜单项的 关闭事件,以方便开始 隐藏定时器
+     *
+     * @param mFloatMenuView
+     */
+    private void setMenuClickListener(final FloatMenuView mFloatMenuView) {
+        mFloatMenuView.setOnMenuClickListener(new FloatMenuView.OnMenuClickListener() {
+            @Override
+            public void onItemClick(int position, String title) {
+
+
+
+                mFloatLogo.refreshDot(0);
+
+                mOnMenuClickListener.onItemClick(position, title);
+
+
+            }
+
+            @Override
+            public void dismiss() {
+                mFloatLogo.setDrawDarkBg(true);
+                mOnMenuClickListener.dismiss();
+                mHideTimer.start();
+            }
+        });
+
+    }
+private void closeMenu(){
+    wManager.removeViewImmediate(rootView);
+    wManager.addView(FloatLogoMenu.this.mFloatLogo, wmParams);
+}
+
+    /**
+     * 悬浮窗的点击事件和touch事件的切换
+     */
+    private void floatBtnEvent() {
+        //这里的onCick只有 touchListener = mDefaultOnTouchListerner 才会触发
+//        mFloatLogo.setOnClickListener(new OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (!isDraging) {
+//                    if (mFloatLogo.getStatus() != DotImageView.NORMAL) {
+//                        mFloatLogo.setBitmap(mLogoRes);
+//                        mFloatLogo.setStatus(DotImageView.NORMAL);
+//                        if (!mFloatLogo.mDrawDarkBg) {
+//                            mFloatLogo.setDrawDarkBg(true);
+//                        }
+//                    }
+//                    mFloatLogo.setOnTouchListener(touchListener);
+//                    mHideTimer.start();
+//                }
+//            }
+//        });
+
+        mFloatLogo.setOnTouchListener(touchListener);//恢复touch事件
+    }
+
+    /**
+     * 悬浮窗touch事件的 down 事件
+     */
+    private void floatEventDown(MotionEvent event) {
+        isDraging = false;
+        mHideTimer.cancel();
+        if (mFloatLogo.getStatus() != DotImageView.NORMAL) {
+            mFloatLogo.setStatus(DotImageView.NORMAL);
+        }
+        if (!mFloatLogo.mDrawDarkBg) {
+            mFloatLogo.setDrawDarkBg(true);
+        }
+        if (mFloatLogo.getStatus() != DotImageView.NORMAL) {
+            mFloatLogo.setStatus(DotImageView.NORMAL);
+        }
+        mXInView = event.getX();
+        mYinview = event.getY();
+        mXDownInScreen = event.getRawX();
+        mYDownInScreen = event.getRawY();
+        mXInScreen = event.getRawX();
+        mYInScreen = event.getRawY();
+
+
+    }
+
+    /**
+     * 悬浮窗touch事件的 move 事件
+     */
+    private void floatEventMove(MotionEvent event) {
+        mXInScreen = event.getRawX();
+        mYInScreen = event.getRawY();
+
+
+        //连续移动的距离超过3则更新一次视图位置
+        if (Math.abs(mXInScreen - mXDownInScreen) > mFloatLogo.getWidth() / 4 || Math.abs(mYInScreen - mYDownInScreen) > mFloatLogo.getWidth() / 4) {
+            wmParams.x = (int) (mXInScreen - mXInView);
+            wmParams.y = (int) (mYInScreen - mYinview) - mFloatLogo.getHeight() / 2;
+            updateViewPosition(); // 手指移动的时候更新小悬浮窗的位置
+            double a = mScreenWidth / 2;
+            float offset = (float) ((a - (Math.abs(wmParams.x - a))) / a);
+            mFloatLogo.setDraging(isDraging, offset, false);
+        } else {
+            isDraging = false;
+            mFloatLogo.setDraging(false, 0, true);
+        }
+    }
+
+    /**
+     * 悬浮窗touch事件的 up 事件
+     */
+    private void floatEventUp() {
+        if (mXInScreen < mScreenWidth / 2) {   //在左边
+            mHintLocation = LEFT;
+        } else {                   //在右边
+            mHintLocation = RIGHT;
+        }
+        if (valueAnimator == null) {
+            valueAnimator = ValueAnimator.ofInt(64);
+            valueAnimator.setInterpolator(mLinearInterpolator);
+            valueAnimator.setDuration(1000);
+            valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+                @Override
+                public void onAnimationUpdate(ValueAnimator animation) {
+                    mResetLocationValue = (int) animation.getAnimatedValue();
+                    mHandler.post(updatePositionRunnable);
+                }
+            });
+
+            valueAnimator.addListener(new Animator.AnimatorListener() {
+                @Override
+                public void onAnimationStart(Animator animation) {
+
+                }
+
+                @Override
+                public void onAnimationEnd(Animator animation) {
+                    if (Math.abs(wmParams.x) < 0) {
+                        wmParams.x = 0;
+                    } else if (Math.abs(wmParams.x) > mScreenWidth) {
+                        wmParams.x = mScreenWidth;
+                    }
+                    updateViewPosition();
+                    isDraging = false;
+                    mFloatLogo.setDraging(false, 0, true);
+                    mHideTimer.start();
+                }
+
+                @Override
+                public void onAnimationCancel(Animator animation) {
+                    if (Math.abs(wmParams.x) < 0) {
+                        wmParams.x = 0;
+                    } else if (Math.abs(wmParams.x) > mScreenWidth) {
+                        wmParams.x = mScreenWidth;
+                    }
+
+                    updateViewPosition();
+                    isDraging = false;
+                    mFloatLogo.setDraging(false, 0, true);
+                    mHideTimer.start();
+
+                }
+
+                @Override
+                public void onAnimationRepeat(Animator animation) {
+
+                }
+            });
+        }
+        if (!valueAnimator.isRunning()) {
+            valueAnimator.start();
+        }
+
+//        //这里需要判断如果如果手指所在位置和logo所在位置在一个宽度内则不移动,
+        if (Math.abs(mXInScreen - mXDownInScreen) > mFloatLogo.getWidth() / 5 || Math.abs(mYInScreen - mYDownInScreen) > mFloatLogo.getHeight() / 5) {
+            isDraging = false;
+        } else {
+            openMenu();
+        }
+
+    }
+
+
+    /**
+     * 用于检查并更新悬浮球的位置
+     */
+    private void checkPosition() {
+        if (wmParams.x > 0 && wmParams.x < mScreenWidth) {
+            if (mHintLocation == LEFT) {
+                wmParams.x = wmParams.x - mResetLocationValue;
+            } else {
+                wmParams.x = wmParams.x + mResetLocationValue;
+            }
+            updateViewPosition();
+            double a = mScreenWidth / 2;
+            float offset = (float) ((a - (Math.abs(wmParams.x - a))) / a);
+            mFloatLogo.setDraging(isDraging, offset, true);
+            return;
+        }
+
+
+        if (Math.abs(wmParams.x) < 0) {
+            wmParams.x = 0;
+        } else if (Math.abs(wmParams.x) > mScreenWidth) {
+            wmParams.x = mScreenWidth;
+        }
+        if (valueAnimator.isRunning()) {
+            valueAnimator.cancel();
+        }
+
+
+        updateViewPosition();
+        isDraging = false;
+
+
+    }
+
+
+    /**
+     * 打开菜单
+     */
+    private void openMenu() {
+        if (isDraging) return;
+
+        if (!isExpaned) {
+            mFloatLogo.setDrawDarkBg(false);
+            try {
+                wManager.removeViewImmediate(mFloatLogo);
+                if (mHintLocation == RIGHT) {
+                    wManager.addView(rootViewRight, wmParams);
+                } else {
+                    wManager.addView(rootView, wmParams);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            isExpaned = true;
+            mHideTimer.cancel();
+        } else {
+            mFloatLogo.setDrawDarkBg(true);
+            if (isExpaned) {
+                try {
+                    wManager.removeViewImmediate(mHintLocation == LEFT ? rootView : rootViewRight);
+                    wManager.addView(mFloatLogo, wmParams);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+                isExpaned = false;
+            }
+            mHideTimer.start();
+        }
+
+    }
+
+
+    /**
+     * 更新悬浮窗在屏幕中的位置。
+     */
+    private void updateViewPosition() {
+        isDraging = true;
+        try {
+            if (!isExpaned) {
+                if (wmParams.y - mFloatLogo.getHeight() / 2 <= 0) {
+                    wmParams.y = mStatusBarHeight;
+                    isDraging = true;
+                }
+                wManager.updateViewLayout(mFloatLogo, wmParams);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void show() {
+        try {
+            if (wManager != null && wmParams != null && mFloatLogo != null) {
+                wManager.addView(mFloatLogo, wmParams);
+            }
+            if (mHideTimer != null) {
+                mHideTimer.start();
+            } else {
+                initTimer();
+                mHideTimer.start();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 关闭菜单
+     */
+    public void hide() {
+        destoryFloat();
+    }
+
+
+    /**
+     * 移除所有悬浮窗 释放资源
+     */
+    public void destoryFloat() {
+        //记录上次的位置logo的停放位置,以备下次恢复
+        saveSetting(LOCATION_X, mHintLocation);
+        saveSetting(LOCATION_Y, wmParams.y);
+        mFloatLogo.clearAnimation();
+        try {
+            mHideTimer.cancel();
+            if (isExpaned) {
+                wManager.removeViewImmediate(mHintLocation == LEFT ? rootView : rootViewRight);
+            } else {
+                wManager.removeViewImmediate(mFloatLogo);
+            }
+            isExpaned = false;
+            isDraging = false;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 计算总红点数
+     */
+    private void caculateDotNum() {
+        int dotNum = 0;
+        for (FloatItem floatItem : mFloatItems) {
+            if (!TextUtils.isEmpty(floatItem.getDotNum())) {
+                int num = Integer.parseInt(floatItem.getDotNum());
+                dotNum = dotNum + num;
+            }
+        }
+        mFloatLogo.setDrawNum(mDrawRedPointNum);
+        setDotNum(dotNum);
+    }
+
+    /**
+     * 绘制悬浮球的红点
+     *
+     * @param dotNum d
+     */
+    private void setDotNum(int dotNum) {
+        mFloatLogo.setDotNum(dotNum, new Animator.AnimatorListener() {
+            @Override
+            public void onAnimationStart(Animator animation) {
+
+            }
+
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                if (!isDraging) {
+                    mHideTimer.start();
+                }
+            }
+
+            @Override
+            public void onAnimationCancel(Animator animation) {
+
+            }
+
+            @Override
+            public void onAnimationRepeat(Animator animation) {
+
+            }
+        });
+    }
+
+    /**
+     * 用于暴露给外部判断是否包含某个菜单项
+     *
+     * @param menuLabel string
+     * @return boolean
+     */
+    public boolean hasMenu(String menuLabel) {
+        for (FloatItem menuItem : mFloatItems) {
+            if (TextUtils.equals(menuItem.getTitle(), menuLabel)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 用于保存悬浮球的位置记录
+     *
+     * @param key          String
+     * @param defaultValue int
+     * @return int
+     */
+    private int getSetting(String key, int defaultValue) {
+        try {
+            SharedPreferences sharedata = mActivity.getSharedPreferences("floatLogo", 0);
+            return sharedata.getInt(key, defaultValue);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return defaultValue;
+    }
+
+    /**
+     * 用于保存悬浮球的位置记录
+     *
+     * @param key   String
+     * @param value int
+     */
+    public void saveSetting(String key, int value) {
+        try {
+            SharedPreferences.Editor sharedata = mActivity.getSharedPreferences("floatLogo", 0).edit();
+            sharedata.putInt(key, value);
+            sharedata.apply();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static int dp2Px(float dp, Context mContext) {
+        return (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP,
+                dp,
+                mContext.getResources().getDisplayMetrics());
+    }
+
+
+    public interface OnMenuClickListener {
+        void onMenuExpended(boolean isExpened);
+    }
+
+
+    public void setValueAnimator() {
+
+    }
+
+    public static final class Builder {
+        private int mBackMenuColor;
+        private boolean mDrawRedPointNum;
+        private boolean mCicleMenuBg;
+        private Bitmap mLogoRes;
+        private int mDefaultLocation;
+        private List<FloatItem> mFloatItems = new ArrayList<>();
+        private Context mActivity;
+        private FloatMenuView.OnMenuClickListener mOnMenuClickListener;
+        private Drawable mDrawable;
+
+
+        public Builder setBgDrawable(Drawable drawable) {
+            mDrawable = drawable;
+            return this;
+        }
+
+        public Builder() {
+        }
+
+        public Builder setFloatItems(List<FloatItem> mFloatItems) {
+            this.mFloatItems = mFloatItems;
+            return this;
+        }
+
+        public Builder addFloatItem(FloatItem floatItem) {
+            this.mFloatItems.add(floatItem);
+            return this;
+        }
+
+        public Builder backMenuColor(int val) {
+            mBackMenuColor = val;
+            return this;
+        }
+
+        public Builder drawRedPointNum(boolean val) {
+            mDrawRedPointNum = val;
+            return this;
+        }
+
+        public Builder drawCicleMenuBg(boolean val) {
+            mCicleMenuBg = val;
+            return this;
+        }
+
+        public Builder logo(Bitmap val) {
+            mLogoRes = val;
+            return this;
+        }
+
+        public Builder withActivity(Activity val) {
+            mActivity = val;
+            return this;
+        }
+
+        public Builder withContext(Context val) {
+            mActivity = val;
+            return this;
+        }
+
+        public Builder setOnMenuItemClickListener(FloatMenuView.OnMenuClickListener val) {
+            mOnMenuClickListener = val;
+            return this;
+        }
+
+        public Builder defaultLocation(int val) {
+            mDefaultLocation = val;
+            return this;
+        }
+
+        public FloatLogoMenu showWithListener(FloatMenuView.OnMenuClickListener val) {
+            mOnMenuClickListener = val;
+            return new FloatLogoMenu(this);
+        }
+
+        public FloatLogoMenu showWithLogo(Bitmap val) {
+            mLogoRes = val;
+            return new FloatLogoMenu(this);
+        }
+
+        public FloatLogoMenu show() {
+            return new FloatLogoMenu(this);
+        }
+    }
+
+
+}

+ 424 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/FloatMenuView.java

@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2016, Shanghai YUEWEN Information Technology Co., Ltd.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *  Neither the name of Shanghai YUEWEN Information Technology Co., Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SHANGHAI YUEWEN INFORMATION TECHNOLOGY CO., LTD. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.yyrh.ui.floatmenu;
+
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PointF;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by wengyiming on 2017/7/21.
+ */
+
+public class FloatMenuView extends View {
+    public static final int STATUS_LEFT = 3;//展开左边菜单
+    public static final int STATUS_RIGHT = 4;//展开右边菜单
+
+    private int mStatus = STATUS_RIGHT;//默认右边
+
+    private Paint mPaint;//画笔
+    private int mBackgroundColor = 0x00FFFFFF;//默认背景颜色 完全透明的白色
+
+    private int mMenuBackgroundColor = -1;//菜单的背景颜色
+
+    private RectF mBgRect;//菜单的背景矩阵
+    private int mItemWidth = dip2px(50);//菜单项的宽度
+    private int mItemHeight = dip2px(50);//菜单项的高度
+    private int mItemLeft = 0;//菜单项左边的默认偏移值,这里是0
+    private int mCorner = dip2px(2);//菜单背景的圆角多出的宽度
+
+
+    private int mRadius = dip2px(4);//红点消息半径
+    private final int mRedPointRadiuWithNoNum = dip2px(3);//红点圆半径
+
+    private int mFontSizePointNum = sp2px(10);//红点消息数字的文字大小
+
+    private int mFontSizeTitle = sp2px(10);//菜单项的title的文字大小
+    private float mFirstItemTop;//菜单项的最小y值,上面起始那条线
+    private boolean mDrawNum = false;//是否绘制数字,false则只绘制红点
+    private boolean cicleBg = false;//菜单项背景是否绘制成圆形,false则绘制矩阵
+
+    private Canvas canvas = null;
+    private List<FloatItem> mItemList = new ArrayList<>();//菜单项的内容
+    private List<RectF> mItemRectList = new ArrayList<>();//菜单项所占用位置的记录,用于判断点击事件
+
+    private OnMenuClickListener mOnMenuClickListener;//菜单项的点击事件回调
+
+    private ObjectAnimator mAlphaAnim;//消失关闭动画的透明值
+
+    //设置菜单内容集合
+    public void setItemList(List<FloatItem> itemList) {
+        mItemList = itemList;
+    }
+
+    //设置是否绘制红点数字
+    public void drawNum(boolean drawNum) {
+        mDrawNum = drawNum;
+    }
+
+    //设置是否绘制圆形菜单,否则矩阵
+    public void setCicleBg(boolean cicleBg) {
+        this.cicleBg = cicleBg;
+    }
+
+    //用于标记所依赖的view的screen的坐标,实际view的坐标是window坐标,所以这里后面会减去状态栏的高度
+
+
+    //设置菜单的背景颜色
+    public void setMenuBackgroundColor(int mMenuBackgroundColor) {
+        this.mMenuBackgroundColor = mMenuBackgroundColor;
+    }
+
+    //设置这个view(整个屏幕)的背景,这里默认透明
+    public void setBackgroundColor(int BackgroundColor) {
+        this.mBackgroundColor = BackgroundColor;
+    }
+
+
+    //下面开始的注释我写不动了,看不懂的话请自行领悟吧
+    public FloatMenuView(Context context) {
+        super(context);
+    }
+
+    public FloatMenuView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public FloatMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    public FloatMenuView(Context baseContext, int status) {
+        super(baseContext);
+        mStatus = status;
+        int screenWidth = getResources().getDisplayMetrics().widthPixels;
+        int screenHeight = getResources().getDisplayMetrics().heightPixels;
+        mBgRect = new RectF(0, 0, screenWidth, screenHeight);
+        initView();
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        setMeasuredDimension(mItemWidth * mItemList.size(), mItemHeight);
+    }
+
+    private void initView( ) {
+        mPaint = new Paint();
+        mPaint.setAntiAlias(true);
+        mPaint.setStyle(Paint.Style.FILL);
+        mPaint.setTextSize(sp2px(10));
+
+        mAlphaAnim = ObjectAnimator.ofFloat(this, "alpha", 1.0f, 0f);
+        mAlphaAnim.setDuration(50);
+        mAlphaAnim.addListener(new MyAnimListener() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                if (mOnMenuClickListener != null) {
+                    removeView();
+                    mOnMenuClickListener.dismiss();
+                }
+            }
+        });
+
+        mFirstItemTop = 0;
+        if (mStatus == STATUS_LEFT) {
+            mItemLeft = 0;
+        } else {
+            mItemLeft = 0;
+        }
+
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        this.canvas = canvas;
+        switch (mStatus) {
+            case STATUS_LEFT:
+                drawBackground(canvas);
+                drawFloatLeftItem(canvas);
+                break;
+            case STATUS_RIGHT:
+                drawBackground(canvas);
+                drawFloatLeftItem(canvas);
+
+                break;
+        }
+    }
+
+    private void drawBackground(Canvas canvas) {
+        mPaint.setColor(mBackgroundColor);
+        canvas.drawRect(mBgRect, mPaint);
+
+    }
+
+    private void drawFloatLeftItem(Canvas canvas) {
+        mItemRectList.clear();
+        for (int i = 0; i < mItemList.size(); i++) {
+            canvas.save();
+            mPaint.setColor(mMenuBackgroundColor);
+            if (cicleBg) {
+                float cx = (mItemLeft + i * mItemWidth) + mItemWidth / 2;//x中心点
+                float cy = mFirstItemTop + mItemHeight / 2;//y中心点
+                float radius = mItemWidth / 2;//半径
+                canvas.drawCircle(cx, cy, radius, mPaint);
+            } else {
+                mPaint.setColor(mItemList.get(i).bgColor);
+                canvas.drawRect(mItemLeft + i * mItemWidth, mFirstItemTop, mItemLeft + mItemWidth + i * mItemWidth, mFirstItemTop + mItemHeight, mPaint);
+            }
+
+            mItemRectList.add(new RectF(mItemLeft + i * mItemWidth, mFirstItemTop, mItemLeft + mItemWidth + i * mItemWidth, mFirstItemTop + mItemHeight));
+            mPaint.setColor(mItemList.get(i).bgColor);
+            drawIconTitleDot(canvas, i);
+        }
+        canvas.restore();
+    }
+
+
+    private void drawIconTitleDot(Canvas canvas, int position) {
+        FloatItem floatItem = mItemList.get(position);
+
+        if (floatItem.icon != null) {
+            float centryX = mItemLeft + mItemWidth / 2 + (mItemWidth) * position;//计算每一个item的中心点x的坐标值
+            float centryY = mFirstItemTop + mItemHeight / 2;//计算每一个item的中心点的y坐标值
+
+            float left = centryX - mItemWidth / 4;//计算icon的左坐标值 中心点往左移宽度的四分之一
+            float right = centryX + mItemWidth / 4;
+
+            float iconH = mItemHeight * 0.5f;//计算出icon的宽度 = icon的高度
+
+            float textH = getTextHeight(floatItem.getTitle(), mPaint);
+            float paddH = (mItemHeight - iconH - textH - mRadius) / 2;//总高度减去文字的高度,减去icon高度,再除以2就是上下的间距剩余
+
+            float top = centryY - mItemHeight / 2 + paddH;//计算icon的上坐标值
+            float bottom = top + iconH;//剩下的高度空间用于画文字
+
+            //画icon
+            mPaint.setColor(floatItem.titleColor);
+            canvas.drawBitmap(floatItem.icon, null, new RectF(left, top, right, bottom), mPaint);
+
+            if (!TextUtils.isEmpty(floatItem.dotNum) && !floatItem.dotNum.equals("0")) {
+                float dotLeft = centryX + mItemWidth / 5;
+                float cx = dotLeft + mCorner;//x中心点
+                float cy = top + mCorner;//y中心点
+
+                int radiu = mDrawNum ? mRadius : mRedPointRadiuWithNoNum;
+                //画红点
+                mPaint.setColor(Color.RED);
+                canvas.drawCircle(cx, cy, radiu, mPaint);
+                if (mDrawNum) {
+                    mPaint.setColor(Color.WHITE);
+                    mPaint.setTextSize(mFontSizePointNum);
+                    //画红点消息数
+                    canvas.drawText(floatItem.dotNum, cx - getTextWidth(floatItem.getDotNum(), mPaint) / 2, cy + getTextHeight(floatItem.getDotNum(), mPaint) / 2, mPaint);
+                }
+            }
+            mPaint.setColor(floatItem.titleColor);
+            mPaint.setTextSize(mFontSizeTitle);
+            //画menu title
+            canvas.drawText(floatItem.title, centryX - getTextWidth(floatItem.getTitle(), mPaint) / 2, centryY + iconH / 2 + getTextHeight(floatItem.getTitle(), mPaint) / 2, mPaint);
+        }
+    }
+
+
+    public void startAnim() {
+        if (mItemList.size() == 0) {
+            return;
+        }
+        invalidate();
+    }
+
+
+    public void dismiss() {
+        if (!mAlphaAnim.isRunning()) {
+            mAlphaAnim.start();
+        }
+    }
+
+    private void removeView() {
+        ViewGroup vg = (ViewGroup) this.getParent();
+        if (vg != null) {
+            vg.removeView(this);
+        }
+    }
+
+    @Override
+    protected void onWindowVisibilityChanged(int visibility) {
+        if (visibility == GONE) {
+            if (mOnMenuClickListener != null) {
+                mOnMenuClickListener.dismiss();
+            }
+        }
+        super.onWindowVisibilityChanged(visibility);
+
+
+    }
+
+    public void setOnMenuClickListener(OnMenuClickListener onMenuClickListener) {
+        this.mOnMenuClickListener = onMenuClickListener;
+
+    }
+
+    public interface OnMenuClickListener {
+        void onItemClick(int position, String title);
+
+        void dismiss();
+
+    }
+
+    private abstract class MyAnimListener implements Animator.AnimatorListener {
+        @Override
+        public void onAnimationStart(Animator animation) {
+
+        }
+
+        @Override
+        public void onAnimationCancel(Animator animation) {
+
+        }
+
+        @Override
+        public void onAnimationRepeat(Animator animation) {
+
+        }
+    }
+
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                for (int i = 0; i < mItemRectList.size(); i++) {
+                    if (mOnMenuClickListener != null && isPointInRect(new PointF(event.getX(), event.getY()), mItemRectList.get(i))) {
+                        mOnMenuClickListener.onItemClick(i, mItemList.get(i).title);
+
+                        return true;
+                    }
+                }
+                dismiss();
+        }
+        return false;
+    }
+
+    private boolean isPointInRect(PointF pointF, RectF targetRect) {
+        return pointF.x >= targetRect.left && pointF.x <= targetRect.right && pointF.y >= targetRect.top && pointF.y <= targetRect.bottom;
+    }
+
+
+    public static class Builder {
+
+        private Context mActivity;
+        private List<FloatItem> mFloatItems = new ArrayList<>();
+        private int mBgColor = Color.TRANSPARENT;
+        private int mStatus = STATUS_LEFT;
+        private boolean cicleBg = false;
+        private int mMenuBackgroundColor = -1;
+        private boolean mDrawNum = false;
+
+
+        public Builder drawNum(boolean drawNum) {
+            mDrawNum = drawNum;
+            return this;
+        }
+
+
+        public Builder setMenuBackgroundColor(int mMenuBackgroundColor) {
+            this.mMenuBackgroundColor = mMenuBackgroundColor;
+            return this;
+        }
+
+
+        public Builder setCicleBg(boolean cicleBg) {
+            this.cicleBg = cicleBg;
+            return this;
+        }
+
+        public Builder setStatus(int status) {
+            mStatus = status;
+            return this;
+        }
+
+        public Builder setFloatItems(List<FloatItem> floatItems) {
+            this.mFloatItems = floatItems;
+            return this;
+        }
+
+
+        public Builder(Context activity ) {
+            mActivity = activity;
+        }
+
+        public Builder addItem(FloatItem floatItem) {
+            mFloatItems.add(floatItem);
+            return this;
+        }
+
+        public Builder addItems(List<FloatItem> list) {
+            mFloatItems.addAll(list);
+            return this;
+        }
+
+        public Builder setBackgroundColor(int color) {
+            mBgColor = color;
+            return this;
+        }
+
+        public FloatMenuView create() {
+            FloatMenuView floatMenuView = new FloatMenuView(mActivity, mStatus);
+            floatMenuView.setItemList(mFloatItems);
+            floatMenuView.setBackgroundColor(mBgColor);
+            floatMenuView.setCicleBg(cicleBg);
+            floatMenuView.startAnim();
+            floatMenuView.drawNum(mDrawNum);
+            floatMenuView.setMenuBackgroundColor(mMenuBackgroundColor);
+            return floatMenuView;
+        }
+
+    }
+
+
+    private int dip2px(float dipValue) {
+        final float scale = getContext().getResources().getDisplayMetrics().density;
+        return (int) (dipValue * scale + 0.5f);
+    }
+
+    private int sp2px(float spValue) {
+        final float fontScale = getContext().getResources().getDisplayMetrics().scaledDensity;
+        return (int) (spValue * fontScale + 0.5f);
+    }
+
+    private float getTextHeight(String text, Paint paint) {
+        Rect rect = new Rect();
+        paint.getTextBounds(text, 0, text.length(), rect);
+        return rect.height() / 1.1f;
+    }
+
+    private float getTextWidth(String text, Paint paint) {
+        return paint.measureText(text);
+    }
+}

+ 232 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/WvPageListDialog.java

@@ -0,0 +1,232 @@
+package com.yyrh.ui.floatmenu;
+
+import android.app.Activity;
+import android.content.Context;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.webkit.DownloadListener;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import android.widget.ImageView;
+
+
+
+import com.yyrh.constant.SDKSettings;
+import com.yyrh.ui.PageJsInteraction;
+import com.yyrh.ui.BaseDialog;
+import com.yyrh.ui.userlist.DatabaseHelper;
+
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.TosUtil;
+
+
+import static com.yyrh.constant.SDKSettings.USER_BIRTHDAY;
+import static com.yyrh.constant.SDKSettings.isVefityRealName;
+
+public class WvPageListDialog extends BaseDialog {
+
+
+    private ImageView close_btn,yyrh_loading;
+    private Context context;
+    private WebView webView;
+    private WebSettings webSettings;
+
+    private String url;
+    public OnClosePageListener listener;
+    private boolean isHiddenClo = false;
+    public WvPageListDialog(Context context) {
+        super(context);
+        this.context = context;
+    }
+
+
+    public WvPageListDialog(Context context, int theme,String url) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+
+    }
+
+    public WvPageListDialog(Context context, int theme,String url,OnClosePageListener listener) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+        this.listener = listener;
+    }
+    public WvPageListDialog(Context context, int theme,String url,OnClosePageListener listener,boolean isHiddenClose) {
+        super(context, theme);
+        this.context = context;
+
+        this.url = url;
+        this.listener = listener;
+        this.isHiddenClo = isHiddenClose;
+    }
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        if (SDKSettings.isLandscape){
+            setContentView(ResourceUtil.getLayoutId(context,
+                    "yyrh_webview_common_dialog"));
+        }else{
+            setContentView(ResourceUtil.getLayoutId(context,
+                    "yyrh_webview_common_dialog_portrait"));
+        }
+
+        webView = findViewById(ResourceUtil.getId(context,
+                "wb_user_info"));
+
+        close_btn = findViewById(ResourceUtil.getId(context,
+                "close_btn"));
+
+        yyrh_loading = findViewById(ResourceUtil.getId(context, "yyrh_loading"));
+        Animation rotateAnimation = AnimationUtils.loadAnimation(context, ResourceUtil.getAnimId(context, "yyrh_rotate_anim"));
+        yyrh_loading.startAnimation(rotateAnimation);
+
+        close_btn.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+                if (listener != null){
+                    listener.onClose();
+                }
+
+                webView.destroy();
+                dismiss();
+
+            }
+        });
+        if (isHiddenClo){
+            close_btn.setVisibility(View.GONE);
+        }
+
+//        reback_btn.setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (webView.canGoBack()) {
+//                    webView.goBack();
+//                }else {
+//                    webView.destroy();
+//                    dismiss();
+//                }
+//
+//            }
+//        });
+
+
+//        wv_title.setText(title);
+        webSettings = webView.getSettings();
+        webSettings.setAllowFileAccess(true);
+        webSettings.setJavaScriptEnabled(true);
+        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
+        webSettings.setBuiltInZoomControls(false);// 设置支持缩放
+        webSettings.setDomStorageEnabled(true);
+        webView.setHorizontalScrollBarEnabled(false);//水平不显示
+        webView.setVerticalScrollBarEnabled(false); //垂直不显示
+
+        webView.addJavascriptInterface(new PageJsInteraction(this), "yyrhsdk");
+        webView.setWebViewClient(new WebViewClient(){
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                super.onPageFinished(view, url);
+                yyrh_loading.clearAnimation();
+                yyrh_loading.setVisibility(View.GONE);
+                if (webView.canGoBack()){
+//                    reback_btn.setVisibility(VISIBLE);
+                }else{
+//                    reback_btn.setVisibility(GONE);
+                }
+            }
+
+        });
+
+        webView.setDownloadListener(new DownloadListener() {
+            @Override
+            public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
+                Uri uri = Uri.parse(url);
+                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+                context.startActivity(intent);
+            }
+        });
+
+
+        webView.loadUrl(url);
+    }
+
+
+
+
+    public interface OnClosePageListener {
+         void onClose();
+         void onRealNameSuccess(String birthday);
+    }
+
+
+
+    @Override
+    public void zfColse() {
+        super.zfColse();
+        if (listener != null){
+            listener.onClose();
+        }
+        dismiss();
+    }
+
+    @Override
+    public void showJsMsg(String message) {
+        super.showJsMsg(message);
+        new TosUtil(context,"blue",  message).show();
+    }
+
+    @Override
+    public void usrRn(String message) {
+        super.usrRn(message);
+        isVefityRealName = true;
+        USER_BIRTHDAY = message;
+        listener.onRealNameSuccess(message);
+    }
+
+    @Override
+    public void modifyPwd(String message) {
+        super.modifyPwd(message);
+        SharedPreferences sp = context
+                .getSharedPreferences("yyrh",
+                        Activity.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+        editor.putString("username", SDKSettings.UNAME);
+        editor.putString("password", message);
+        editor.commit();
+
+        String timeStamp = System.currentTimeMillis() + "";
+
+        String delete_sql = "delete from user where name = '" + SDKSettings.UNAME + "'";
+
+        String insert_sql = "insert into user(name,pwd,time) values('" + SDKSettings.UNAME
+                + "','" + message + "','" + timeStamp + "')";
+
+        DatabaseHelper.excuteSql(context, delete_sql);
+        DatabaseHelper.excuteSql(context, insert_sql);
+    }
+
+    @Override
+    public void dismiss() {
+        super.dismiss();
+        if (isHiddenClo){
+            if (SDKSettings.USER_BIRTHDAY.equals("")){
+                SDKSettings.CHANNELUID = "";
+                SDKSettings.UNAME = "";
+
+            }
+
+        }
+    }
+}

+ 771 - 0
hnqj/src/main/java/com/yyrh/ui/floatmenu/customfloat/BaseFloatDailog.java

@@ -0,0 +1,771 @@
+/*
+ * Copyright (c) 2016, Shanghai YUEWEN Information Technology Co., Ltd.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *  Neither the name of Shanghai YUEWEN Information Technology Co., Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY SHANGHAI YUEWEN INFORMATION TECHNOLOGY CO., LTD. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package com.yyrh.ui.floatmenu.customfloat;
+
+import android.animation.Animator;
+import android.animation.ValueAnimator;
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.PixelFormat;
+import android.os.Build;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+
+
+/**
+ * Created by wengyiming on 2017/8/25.
+ */
+
+public abstract class BaseFloatDailog {
+
+    /**
+     * 悬浮球 坐落 左 右 标记
+     */
+    public static final int LEFT = 0;
+    public static final int RIGHT = 1;
+
+    /**
+     * 记录 logo 停放的位置,以备下次恢复
+     */
+    private static final String LOCATION_X = "hintLocation";
+    private static final String LOCATION_Y = "locationY";
+
+
+    /**
+     * 停靠默认位置
+     */
+    private int mDefaultLocation = RIGHT;
+
+
+    /**
+     * 悬浮窗 坐落 位置
+     */
+    private int mHintLocation = mDefaultLocation;
+
+
+    /**
+     * 记录当前手指位置在屏幕上的横坐标值
+     */
+    private float mXInScreen;
+
+    /**
+     * 记录当前手指位置在屏幕上的纵坐标值
+     */
+    private float mYInScreen;
+
+    /**
+     * 记录手指按下时在屏幕上的横坐标的值
+     */
+    private float mXDownInScreen;
+
+    /**
+     * 记录手指按下时在屏幕上的纵坐标的值
+     */
+    private float mYDownInScreen;
+
+    /**
+     * 记录手指按下时在小悬浮窗的View上的横坐标的值
+     */
+    private float mXInView;
+
+    /**
+     * 记录手指按下时在小悬浮窗的View上的纵坐标的值
+     */
+    private float mYinview;
+
+    /**
+     * 记录屏幕的宽度
+     */
+    private int mScreenWidth;
+
+    /**
+     * 来自 activity 的 wManager
+     */
+    private WindowManager wManager;
+
+
+    /**
+     * 为 wManager 设置 LayoutParams
+     */
+    private WindowManager.LayoutParams wmParams;
+
+
+    /**
+     * 用于显示在 mActivity 上的 mActivity
+     */
+    private Context mActivity;
+
+
+    /**
+     * 用于 定时 隐藏 logo的定时器
+     */
+    private CountDownTimer mHideTimer;
+
+
+    /**
+     * float menu的高度
+     */
+    private Handler mHandler = new Handler(Looper.getMainLooper());
+
+
+    /**
+     * 悬浮窗左右移动到默认位置 动画的 加速器
+     */
+    private Interpolator mLinearInterpolator = new LinearInterpolator();
+
+    /**
+     * 标记是否拖动中
+     */
+    private boolean isDraging = false;
+
+    /**
+     * 用于恢复悬浮球的location的属性动画值
+     */
+    private int mResetLocationValue;
+
+    public boolean isApplictionDialog() {
+        return isApplictionDialog;
+    }
+
+    private boolean isApplictionDialog = false;
+
+    /**
+     * 这个事件用于处理移动、自定义点击或者其它事情,return true可以保证onclick事件失效
+     */
+    private View.OnTouchListener touchListener = new View.OnTouchListener() {
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    floatEventDown(event);
+                    break;
+                case MotionEvent.ACTION_MOVE:
+                    floatEventMove(event);
+                    break;
+                case MotionEvent.ACTION_UP:
+                case MotionEvent.ACTION_CANCEL:
+                    floatEventUp();
+                    break;
+            }
+            return true;
+        }
+    };
+
+    ValueAnimator valueAnimator = null;
+    private boolean isExpaned = false;
+
+    private View logoView;
+    private View rightView;
+    private View leftView;
+
+    private GetViewCallback mGetViewCallback;
+
+
+
+    public Context getContext() {
+        return mActivity;
+    }
+
+    public static class FloatDialogImp extends BaseFloatDailog {
+
+
+        public FloatDialogImp(Context context, GetViewCallback getViewCallback) {
+            super(context, getViewCallback);
+        }
+
+        public FloatDialogImp(Context context) {
+            super(context);
+        }
+
+        @Override
+        protected View getLeftView(LayoutInflater inflater, View.OnTouchListener touchListener) {
+            return null;
+        }
+
+        @Override
+        protected View getRightView(LayoutInflater inflater, View.OnTouchListener touchListener) {
+            return null;
+        }
+
+        @Override
+        protected View getLogoView(LayoutInflater inflater) {
+            return null;
+        }
+
+        @Override
+        protected void resetLogoViewSize(int hintLocation, View logoView) {
+
+        }
+
+        @Override
+        protected void dragingLogoViewOffset(View logoView, boolean isDraging, boolean isResetPosition, float offset) {
+
+        }
+
+        @Override
+        protected void shrinkLeftLogoView(View logoView) {
+
+        }
+
+        @Override
+        protected void shrinkRightLogoView(View logoView) {
+
+        }
+
+        @Override
+        protected void leftViewOpened(View leftView) {
+
+        }
+
+        @Override
+        protected void rightViewOpened(View rightView) {
+
+        }
+
+        @Override
+        protected void leftOrRightViewClosed(View logoView) {
+
+        }
+
+        @Override
+        protected void onDestoryed() {
+
+        }
+    }
+
+    protected BaseFloatDailog(Context context, GetViewCallback getViewCallback) {
+        this(context);
+        this.mGetViewCallback = getViewCallback;
+        if (mGetViewCallback == null) {
+            throw new IllegalArgumentException("GetViewCallback cound not be null!");
+        }
+
+    }
+
+    protected BaseFloatDailog(Context context) {
+        this.mActivity = context;
+        initFloatWindow();
+        initTimer();
+        initFloatView();
+
+    }
+
+
+    private void initFloatView() {
+        LayoutInflater inflater = LayoutInflater.from(mActivity);
+        logoView = mGetViewCallback == null ? getLogoView(inflater) : mGetViewCallback.getLogoView(inflater);
+        leftView = mGetViewCallback == null ? getLeftView(inflater, touchListener) : mGetViewCallback.getLeftView(inflater, touchListener);
+        rightView = mGetViewCallback == null ? getRightView(inflater, touchListener) : mGetViewCallback.getRightView(inflater, touchListener);
+
+        if (logoView == null) {
+            throw new IllegalArgumentException("Must impl GetViewCallback or impl " + this.getClass().getSimpleName() + "and make getLogoView() not return null !");
+        }
+
+        logoView.setOnTouchListener(touchListener);//恢复touch事件
+
+    }
+
+    /**
+     * 初始化 隐藏悬浮球的定时器
+     */
+    private void initTimer() {
+        mHideTimer = new CountDownTimer(2000, 10) {        //悬浮窗超过5秒没有操作的话会自动隐藏
+            @Override
+            public void onTick(long millisUntilFinished) {
+                if (isExpaned) {
+                    mHideTimer.cancel();
+                }
+            }
+
+            @Override
+            public void onFinish() {
+                if (isExpaned) {
+                    mHideTimer.cancel();
+                    return;
+                }
+                if (!isDraging) {
+                    if (mHintLocation == LEFT) {
+                        if (mGetViewCallback == null) {
+                            shrinkLeftLogoView(logoView);
+                        } else {
+                            mGetViewCallback.shrinkLeftLogoView(logoView);
+                        }
+                    } else {
+                        if (mGetViewCallback == null) {
+                            shrinkRightLogoView(logoView);
+                        } else {
+                            mGetViewCallback.shrinkRightLogoView(logoView);
+                        }
+                    }
+                }
+            }
+        };
+    }
+
+
+
+
+
+    /**
+     * 初始化悬浮球 window
+     */
+    private void initFloatWindow() {
+        wmParams = new WindowManager.LayoutParams();
+        if (mActivity instanceof Activity) {
+            Activity activity = (Activity) mActivity;
+            wManager = activity.getWindowManager();
+            //类似dialog,寄托在activity的windows上,activity关闭时需要关闭当前float
+            wmParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;
+            isApplictionDialog = true;
+        } else {
+            wManager = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
+            //判断状态栏是否显示 如果不显示则statusBarHeight为0
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+                if (Build.VERSION.SDK_INT > 23) {
+                    //在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
+                    wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+                } else {
+                    wmParams.type = WindowManager.LayoutParams.TYPE_TOAST;
+                }
+            } else {
+                wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+            }
+            isApplictionDialog = false;
+        }
+        mScreenWidth = wManager.getDefaultDisplay().getWidth();
+        int screenHeigth = wManager.getDefaultDisplay().getHeight();
+        wmParams.format = PixelFormat.RGBA_8888;
+        wmParams.gravity = Gravity.LEFT | Gravity.TOP;
+        wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
+        mHintLocation = getSetting(LOCATION_X, mDefaultLocation);
+        int defaultY = ((screenHeigth) / 2) / 3;
+        int y = getSetting(LOCATION_Y, defaultY);
+        if (mHintLocation == LEFT) {
+            wmParams.x = 0;
+        } else {
+            wmParams.x = mScreenWidth;
+        }
+        if (y != 0 && y != defaultY) {
+            wmParams.y = y;
+        } else {
+            wmParams.y = defaultY;
+        }
+        wmParams.alpha = 1;
+        wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
+        wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
+    }
+
+    /**
+     * 悬浮窗touch事件的 down 事件
+     */
+    private void floatEventDown(MotionEvent event) {
+        isDraging = false;
+        mHideTimer.cancel();
+
+        if (mGetViewCallback == null) {
+            resetLogoViewSize(mHintLocation, logoView);
+        } else {
+            mGetViewCallback.resetLogoViewSize(mHintLocation, logoView);
+        }
+
+        mXInView = event.getX();
+        mYinview = event.getY();
+        mXDownInScreen = event.getRawX();
+        mYDownInScreen = event.getRawY();
+        mXInScreen = event.getRawX();
+        mYInScreen = event.getRawY();
+
+
+    }
+
+    /**
+     * 悬浮窗touch事件的 move 事件
+     */
+    private void floatEventMove(MotionEvent event) {
+        mXInScreen = event.getRawX();
+        mYInScreen = event.getRawY();
+
+
+        //连续移动的距离超过3则更新一次视图位置
+        if (Math.abs(mXInScreen - mXDownInScreen) > logoView.getWidth() / 4 || Math.abs(mYInScreen - mYDownInScreen) > logoView.getWidth() / 4) {
+            wmParams.x = (int) (mXInScreen - mXInView);
+            wmParams.y = (int) (mYInScreen - mYinview) - logoView.getHeight() / 2;
+            updateViewPosition(); // 手指移动的时候更新小悬浮窗的位置
+            double a = mScreenWidth / 2;
+            float offset = (float) ((a - (Math.abs(wmParams.x - a))) / a);
+            if (mGetViewCallback == null) {
+                dragingLogoViewOffset(logoView, isDraging, false, offset);
+            } else {
+                mGetViewCallback.dragingLogoViewOffset(logoView, isDraging, false, offset);
+            }
+
+        } else {
+            isDraging = false;
+//            logoView.setDraging(false, 0, true);
+            if (mGetViewCallback == null) {
+                dragingLogoViewOffset(logoView, false, true, 0);
+            } else {
+                mGetViewCallback.dragingLogoViewOffset(logoView, false, true, 0);
+            }
+
+        }
+    }
+
+    /**
+     * 悬浮窗touch事件的 up 事件
+     */
+    private void floatEventUp() {
+        if (mXInScreen < mScreenWidth / 2) {   //在左边
+            mHintLocation = LEFT;
+        } else {                   //在右边
+            mHintLocation = RIGHT;
+        }
+
+
+        valueAnimator = ValueAnimator.ofInt(64);
+        valueAnimator.setInterpolator(mLinearInterpolator);
+        valueAnimator.setDuration(1000);
+        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+            @Override
+            public void onAnimationUpdate(ValueAnimator animation) {
+                mResetLocationValue = (int) animation.getAnimatedValue();
+                mHandler.post(updatePositionRunnable);
+            }
+        });
+
+        valueAnimator.addListener(new Animator.AnimatorListener() {
+            @Override
+            public void onAnimationStart(Animator animation) {
+
+            }
+
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                if (Math.abs(wmParams.x) < 0) {
+                    wmParams.x = 0;
+                } else if (Math.abs(wmParams.x) > mScreenWidth) {
+                    wmParams.x = mScreenWidth;
+                }
+                updateViewPosition();
+                isDraging = false;
+                if (mGetViewCallback == null) {
+                    dragingLogoViewOffset(logoView, false, true, 0);
+                } else {
+                    mGetViewCallback.dragingLogoViewOffset(logoView, false, true, 0);
+                }
+                mHideTimer.start();
+            }
+
+            @Override
+            public void onAnimationCancel(Animator animation) {
+                if (Math.abs(wmParams.x) < 0) {
+                    wmParams.x = 0;
+                } else if (Math.abs(wmParams.x) > mScreenWidth) {
+                    wmParams.x = mScreenWidth;
+                }
+
+                updateViewPosition();
+                isDraging = false;
+                if (mGetViewCallback == null) {
+                    dragingLogoViewOffset(logoView, false, true, 0);
+                } else {
+                    mGetViewCallback.dragingLogoViewOffset(logoView, false, true, 0);
+                }
+                mHideTimer.start();
+
+            }
+
+            @Override
+            public void onAnimationRepeat(Animator animation) {
+
+            }
+        });
+        if (!valueAnimator.isRunning()) {
+            valueAnimator.start();
+        }
+
+//        //这里需要判断如果如果手指所在位置和logo所在位置在一个宽度内则不移动,
+        if (Math.abs(mXInScreen - mXDownInScreen) > logoView.getWidth() / 5 || Math.abs(mYInScreen - mYDownInScreen) > logoView.getHeight() / 5) {
+            isDraging = false;
+        } else {
+            openMenu();
+        }
+
+    }
+
+    /**
+     * 手指离开屏幕后 用于恢复 悬浮球的 logo 的左右位置
+     */
+    private Runnable updatePositionRunnable = new Runnable() {
+        @Override
+        public void run() {
+            isDraging = true;
+            checkPosition();
+        }
+    };
+
+
+    /**
+     * 用于检查并更新悬浮球的位置
+     */
+    private void checkPosition() {
+        if (wmParams.x > 0 && wmParams.x < mScreenWidth) {
+            if (mHintLocation == LEFT) {
+                wmParams.x = wmParams.x - mResetLocationValue;
+            } else {
+                wmParams.x = wmParams.x + mResetLocationValue;
+            }
+            updateViewPosition();
+            double a = mScreenWidth / 2;
+            float offset = (float) ((a - (Math.abs(wmParams.x - a))) / a);
+//            logoView.setDraging(isDraging, offset, true);
+            if (mGetViewCallback == null) {
+                dragingLogoViewOffset(logoView, false, true, 0);
+            } else {
+                mGetViewCallback.dragingLogoViewOffset(logoView, isDraging, true, offset);
+            }
+
+            return;
+        }
+
+
+        if (Math.abs(wmParams.x) < 0) {
+            wmParams.x = 0;
+        } else if (Math.abs(wmParams.x) > mScreenWidth) {
+            wmParams.x = mScreenWidth;
+        }
+        if (valueAnimator.isRunning()) {
+            valueAnimator.cancel();
+        }
+
+
+        updateViewPosition();
+        isDraging = false;
+
+
+    }
+
+    public void show() {
+        try {
+            if (wManager != null && wmParams != null && logoView != null) {
+                wManager.addView(logoView, wmParams);
+            }
+            if (mHideTimer != null) {
+                mHideTimer.start();
+            } else {
+                initTimer();
+                mHideTimer.start();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 打开菜单
+     */
+    private void openMenu() {
+        if (isDraging) return;
+
+        if (!isExpaned) {
+//            logoView.setDrawDarkBg(false);
+            try {
+                wManager.removeViewImmediate(logoView);
+                if (mHintLocation == RIGHT) {
+                    wManager.addView(rightView, wmParams);
+                    if (mGetViewCallback == null) {
+                        rightViewOpened(rightView);
+                    } else {
+                        mGetViewCallback.rightViewOpened(rightView);
+                    }
+                } else {
+                    wManager.addView(leftView, wmParams);
+                    if (mGetViewCallback == null) {
+                        leftViewOpened(leftView);
+                    } else {
+                        mGetViewCallback.leftViewOpened(leftView);
+                    }
+
+
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            isExpaned = true;
+            mHideTimer.cancel();
+        } else {
+//            logoView.setDrawDarkBg(true);
+            try {
+                wManager.removeViewImmediate(mHintLocation == LEFT ? leftView : rightView);
+                wManager.addView(logoView, wmParams);
+                if (mGetViewCallback == null) {
+                    leftOrRightViewClosed(logoView);
+                } else {
+                    mGetViewCallback.leftOrRightViewClosed(logoView);
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            isExpaned = false;
+            mHideTimer.start();
+        }
+
+    }
+
+
+    /**
+     * 更新悬浮窗在屏幕中的位置。
+     */
+    private void updateViewPosition() {
+        isDraging = true;
+        try {
+            if (!isExpaned) {
+                if (wmParams.y - logoView.getHeight() / 2 <= 0) {
+                    wmParams.y = 25;
+                    isDraging = true;
+                }
+                wManager.updateViewLayout(logoView, wmParams);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 移除所有悬浮窗 释放资源
+     */
+    public void dismiss() {
+        //记录上次的位置logo的停放位置,以备下次恢复
+        saveSetting(LOCATION_X, mHintLocation);
+        saveSetting(LOCATION_Y, wmParams.y);
+        logoView.clearAnimation();
+        try {
+            mHideTimer.cancel();
+            if (isExpaned) {
+                wManager.removeViewImmediate(mHintLocation == LEFT ? leftView : rightView);
+            } else {
+                wManager.removeViewImmediate(logoView);
+            }
+            isExpaned = false;
+            isDraging = false;
+            if (mGetViewCallback == null) {
+                onDestoryed();
+            } else {
+                mGetViewCallback.onDestoryed();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    protected abstract View getLeftView(LayoutInflater inflater, View.OnTouchListener touchListener);
+
+    protected abstract View getRightView(LayoutInflater inflater, View.OnTouchListener touchListener);
+
+    protected abstract View getLogoView(LayoutInflater inflater);
+
+    protected abstract void resetLogoViewSize(int hintLocation, View logoView);//logo恢复原始大小
+
+    protected abstract void dragingLogoViewOffset(View logoView, boolean isDraging, boolean isResetPosition, float offset);
+
+    protected abstract void shrinkLeftLogoView(View logoView);//logo左边收缩
+
+    protected abstract void shrinkRightLogoView(View logoView);//logo右边收缩
+
+    protected abstract void leftViewOpened(View leftView);//左菜单打开
+
+    protected abstract void rightViewOpened(View rightView);//右菜单打开
+
+    protected abstract void leftOrRightViewClosed(View logoView);
+
+    protected abstract void onDestoryed();
+
+    public interface GetViewCallback {
+        View getLeftView(LayoutInflater inflater, View.OnTouchListener touchListener);
+
+        View getRightView(LayoutInflater inflater, View.OnTouchListener touchListener);
+
+        View getLogoView(LayoutInflater inflater);
+
+
+        void resetLogoViewSize(int hintLocation, View logoView);//logo恢复原始大小
+
+        void dragingLogoViewOffset(View logoView, boolean isDraging, boolean isResetPosition, float offset);//logo正被拖动,或真在恢复原位
+
+        void shrinkLeftLogoView(View logoView);//logo左边收缩
+
+        void shrinkRightLogoView(View logoView);//logo右边收缩
+
+        void leftViewOpened(View leftView);//左菜单打开
+
+        void rightViewOpened(View rightView);//右菜单打开
+
+        void leftOrRightViewClosed(View logoView);
+
+        void onDestoryed();
+
+    }
+
+    /**
+     * 用于保存悬浮球的位置记录
+     *
+     * @param key          String
+     * @param defaultValue int
+     * @return int
+     */
+    private int getSetting(String key, int defaultValue) {
+        try {
+            SharedPreferences sharedata = mActivity.getSharedPreferences("floatLogo", 0);
+            return sharedata.getInt(key, defaultValue);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return defaultValue;
+    }
+
+    /**
+     * 用于保存悬浮球的位置记录
+     *
+     * @param key   String
+     * @param value int
+     */
+    public void saveSetting(String key, int value) {
+        try {
+            SharedPreferences.Editor sharedata = mActivity.getSharedPreferences("floatLogo", 0).edit();
+            sharedata.putInt(key, value);
+            sharedata.apply();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static int dp2Px(float dp, Context mContext) {
+        return (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP,
+                dp,
+                mContext.getResources().getDisplayMetrics());
+    }
+}

+ 53 - 0
hnqj/src/main/java/com/yyrh/ui/fragment/BaseFragment.java

@@ -0,0 +1,53 @@
+package com.yyrh.ui.fragment;
+
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+
+
+import com.yyrh.utils.ResourceUtil;
+import com.yyrh.utils.Utils;
+
+public class BaseFragment extends Fragment implements View.OnClickListener {
+    private Button btn_kefu;
+
+    @Override
+    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        btn_kefu = view.findViewById(ResourceUtil.getId(getActivity(),"btn_kefu"));
+        if (btn_kefu != null){
+            btn_kefu.setOnClickListener(this);
+        }
+
+    }
+
+    public void addFragmentToActivity(FragmentManager fragmentManager,
+                                      android.app.Fragment fragment, int frameId) {
+        Utils.checkNotNull(fragmentManager);
+        Utils.checkNotNull(fragment);
+        FragmentTransaction transaction = fragmentManager.beginTransaction();
+        transaction.add(frameId, fragment).addToBackStack(null);
+        transaction.commit();
+    }
+
+    public void replaceFragmentToActivity(FragmentManager fragmentManager, android.app.Fragment fragment, int frameId) {
+        Utils.checkNotNull(fragmentManager);
+        Utils.checkNotNull(fragment);
+
+        FragmentTransaction transaction = fragmentManager.beginTransaction();
+        transaction.replace(frameId, fragment);
+        transaction.commit();
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (v.getId() == ResourceUtil.getId(getActivity(), "btn_kefu")){
+            Toast.makeText(getActivity(), "这是客服",1).show();
+        }
+    }
+}

Some files were not shown because too many files changed in this diff