Преглед изворни кода

1.对接支付宝微信支付

shihuiyun пре 2 година
родитељ
комит
43b7190207
38 измењених фајлова са 936 додато и 69 уклоњено
  1. 1 0
      alipay/.gitignore
  2. 40 0
      alipay/build.gradle
  3. BIN
      alipay/libs/alipaysdk-15.8.01.210112203525.aar
  4. 95 0
      alipay/proguard-rules.pro
  5. 55 0
      alipay/src/main/AndroidManifest.xml
  6. 50 0
      alipay/src/main/debug/AndroidManifest.xml
  7. 16 0
      alipay/src/main/java/com/quansu/alipay/componnent/CpAlipay.kt
  8. 0 0
      alipay/src/main/java/com/quansu/alipay/utils/AuthResult.java
  9. 1 0
      alipay/src/main/java/com/quansu/alipay/utils/PayResult.java
  10. 109 0
      alipay/src/main/java/com/quansu/alipay/utils/PayUtils.kt
  11. 5 0
      alipay/src/main/res/values/colors.xml
  12. 3 0
      alipay/src/main/res/values/dimens.xml
  13. 26 0
      alipay/src/main/res/values/strings.xml
  14. 4 0
      alipay/src/main/res/values/styles.xml
  15. 3 1
      app/build.gradle
  16. 24 0
      app/src/main/AndroidManifest.xml
  17. 7 2
      app/src/main/java/com/zswc/creativity/activity/MyInfoActivity.kt
  18. 26 9
      app/src/main/java/com/zswc/creativity/activity/TibetanDetailsActivity.kt
  19. 1 0
      app/src/main/java/com/zswc/creativity/config/ConfigRx.kt
  20. 12 0
      app/src/main/java/com/zswc/creativity/model/Locality.kt
  21. 23 17
      app/src/main/java/com/zswc/creativity/utils/LoadEngin.kt
  22. 83 5
      app/src/main/java/com/zswc/creativity/utils/PopuShareWxUtils.kt
  23. 3 0
      app/src/main/java/com/zswc/creativity/utils/SaveLocalUtils.java
  24. 1 0
      app/src/main/java/com/zswc/creativity/utils/ShareWxDilaog.kt
  25. 41 0
      app/src/main/java/com/zswc/creativity/utils/WeChatUtil.kt
  26. 8 2
      app/src/main/java/com/zswc/creativity/utils/net/ApiService.kt
  27. 68 1
      app/src/main/java/com/zswc/creativity/vmodel/MyInfoVModel.kt
  28. 1 1
      app/src/main/java/com/zswc/creativity/vmodel/OrderListVModel.kt
  29. 9 9
      app/src/main/java/com/zswc/creativity/vmodel/RechargeVModel.kt
  30. 26 0
      app/src/main/java/com/zswc/creativity/vmodel/TibetanDetailsVModel.kt
  31. 78 0
      app/src/main/java/com/zswc/creativity/wxapi/WXPayEntryActivity.kt
  32. BIN
      app/src/main/res/drawable-xxhdpi/share_qq.png
  33. 1 0
      app/src/main/res/layout/activity_my_info.xml
  34. 34 0
      app/src/main/res/layout/activity_tibetan_details.xml
  35. 3 3
      app/src/main/res/layout/item_pop_buy.xml
  36. 14 0
      app/src/main/res/layout/item_wx_share.xml
  37. 63 18
      app/src/main/res/xml/file_paths.xml
  38. 2 1
      settings.gradle

+ 1 - 0
alipay/.gitignore

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

+ 40 - 0
alipay/build.gradle

@@ -0,0 +1,40 @@
+apply plugin: 'com.android.library'
+apply from: rootProject.file('common-build.gradle')
+
+android {
+    compileSdkVersion rootProject.target_sdk_version
+
+
+    defaultConfig {
+        minSdkVersion rootProject.min_sdk_version
+        targetSdkVersion rootProject.target_sdk_version
+        versionCode rootProject.application_version_code
+        versionName rootProject.application_version_name
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+
+    packagingOptions {
+        exclude 'META-INF/XXXX'
+    }
+
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+
+}
+
+dependencies {
+    implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
+    implementation project(':base')
+    //支付宝
+//    implementation files('libs/alipaysdk-15.8.01.210112203525.aar')
+
+
+}

BIN
alipay/libs/alipaysdk-15.8.01.210112203525.aar


+ 95 - 0
alipay/proguard-rules.pro

@@ -0,0 +1,95 @@
+# 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
+-dontshrink
+-dontpreverify
+-dontoptimize
+-dontusemixedcaseclassnames
+
+-flattenpackagehierarchy
+-allowaccessmodification
+-printmapping map.txt
+
+-optimizationpasses 7
+-verbose
+-keepattributes Exceptions,InnerClasses
+-dontskipnonpubliclibraryclasses
+-dontskipnonpubliclibraryclassmembers
+-ignorewarnings
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-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 java.lang.Throwable {*;}
+-keep public class * extends java.lang.Exception {*;}
+
+-keep class com.alipay.android.app.IAlixPay{*;}
+-keep class com.alipay.android.app.IAlixPay$Stub{*;}
+-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
+-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
+-keep class com.alipay.sdk.app.PayTask{ public *;}
+-keep class com.alipay.sdk.app.AuthTask{ public *;}
+-keep class com.alipay.sdk.app.H5PayCallback {
+    <fields>;
+    <methods>;
+}
+-keep class com.alipay.android.phone.mrpc.core.** { *; }
+-keep class com.alipay.apmobilesecuritysdk.** { *; }
+-keep class com.alipay.mobile.framework.service.annotation.** { *; }
+-keep class com.alipay.mobilesecuritysdk.face.** { *; }
+-keep class com.alipay.tscenter.biz.rpc.** { *; }
+-keep class org.json.alipay.** { *; }
+-keep class com.alipay.tscenter.** { *; }
+-keep class com.ta.utdid2.** { *;}
+-keep class com.ut.device.** { *;}
+
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
+
+# adding this in to preserve line numbers so that the stack traces
+# can be remapped
+-renamesourcefileattribute SourceFile
+-keepattributes SourceFile,LineNumberTable

+ 55 - 0
alipay/src/main/AndroidManifest.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    package="com.quansu.alipay">
+
+    <!-- Normal Permissions 不需要运行时注册 -->
+    <!-- 获取运营商信息,用于支持提供运营商信息相关的接口 -->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 -->
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+    <!-- 这个权限用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
+    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
+
+    <!-- 请求网络 -->
+    <uses-permission android:name="android.permission.INTERNET"/>
+
+    <!-- 不是SDK需要的权限,是示例中的后台唤醒定位需要的权限 -->
+    <uses-permission android:name="android.permission.WAKE_LOCK"/>
+
+    <!-- 需要运行时注册的权限 -->
+    <!-- 用于进行网络定位 -->
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <!-- 用于访问GPS定位 -->
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+    <!-- 用于提高GPS定位速度 -->
+    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
+    <!-- 写入扩展存储,向扩展卡写入数据,用于写入缓存定位数据 -->
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <!-- 读取缓存数据 -->
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+
+    <!-- 用于读取手机当前的状态 -->
+    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
+
+    <!-- 更改设置 -->
+    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
+
+    <!--如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限-->
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
+    <!--如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明-->
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
+
+    <application
+        android:allowBackup="true"
+        android:label="@string/app_name"
+        android:supportsRtl="true"
+        android:largeHeap="true"
+        android:exported="false"
+        >
+
+
+    </application>
+
+</manifest>

+ 50 - 0
alipay/src/main/debug/AndroidManifest.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="com.quansu.alipay"
+          xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:tools="http://schemas.android.com/tools" >
+    <!-- Normal Permissions 不需要运行时注册 -->
+    <!-- 获取运营商信息,用于支持提供运营商信息相关的接口 -->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 -->
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+    <!-- 这个权限用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
+
+    <!-- 请求网络 -->
+    <uses-permission android:name="android.permission.INTERNET"/>
+
+    <!-- 不是SDK需要的权限,是示例中的后台唤醒定位需要的权限 -->
+    <uses-permission android:name="android.permission.WAKE_LOCK"/>
+
+    <!-- 需要运行时注册的权限 -->
+    <!-- 用于进行网络定位 -->
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <!-- 用于访问GPS定位 -->
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+    <!-- 用于提高GPS定位速度 -->
+    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
+    <!-- 写入扩展存储,向扩展卡写入数据,用于写入缓存定位数据 -->
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <!-- 读取缓存数据 -->
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+
+    <!-- 用于读取手机当前的状态 -->
+    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
+
+
+    <!--如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限-->
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
+    <!--如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明-->
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
+
+
+    <application
+        android:allowBackup="true"
+        android:label="@string/app_name"
+        android:supportsRtl="true"
+        android:largeHeap="true" >
+
+
+    </application >
+
+</manifest >

+ 16 - 0
alipay/src/main/java/com/quansu/alipay/componnent/CpAlipay.kt

@@ -0,0 +1,16 @@
+package com.quansu.alipay.componnent
+
+import android.content.Context
+import com.quansu.alipay.utils.PayUtils
+
+/**
+ *Created by shihuiyun
+ *on 2020/12/21
+ */
+object CpAlipay {
+
+    fun pay(context: Context, orderInfo: String) {
+        PayUtils.toPay(orderInfo, context)
+    }
+
+}

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
alipay/src/main/java/com/quansu/alipay/utils/AuthResult.java


+ 1 - 0
alipay/src/main/java/com/quansu/alipay/utils/PayResult.java

@@ -0,0 +1 @@
+package com.quansu.alipay.utils;

import java.util.Map;

import android.text.TextUtils;

public class PayResult {
	private String resultStatus;
	private String result;
	private String memo;

	public PayResult(Map<String, String> rawResult) {
		if (rawResult == null) {
			return;
		}

		for (String key : rawResult.keySet()) {
			if (TextUtils.equals(key, "resultStatus")) {
				resultStatus = rawResult.get(key);
			} else if (TextUtils.equals(key, "result")) {
				result = rawResult.get(key);
			} else if (TextUtils.equals(key, "memo")) {
				memo = rawResult.get(key);
			}
		}
	}

	@Override
	public String toString() {
		return "resultStatus={" + resultStatus + "};memo={" + memo
				+ "};result={" + result + "}";
	}

	/**
	 * @return the resultStatus
	 */
	public String getResultStatus() {
		return resultStatus;
	}

	/**
	 * @return the memo
	 */
	public String getMemo() {
		return memo;
	}

	/**
	 * @return the result
	 */
	public String getResult() {
		return result;
	}
}

+ 109 - 0
alipay/src/main/java/com/quansu/alipay/utils/PayUtils.kt

@@ -0,0 +1,109 @@
+package com.quansu.alipay.utils
+
+import android.app.Activity
+import android.content.Context
+import android.os.Handler
+import android.os.Looper
+import android.os.Message
+import android.text.TextUtils
+import android.widget.Toast
+import com.alipay.sdk.app.PayTask
+import com.hwangjr.rxbus.RxBus
+
+
+/**
+ *Created by shihuiyun
+ *on 2020/12/21
+ */
+object PayUtils {
+    private const val SDK_PAY_FLAG = 1
+    private const val SDK_AUTH_FLAG = 2
+    private var context: Context? = null
+
+
+    private val mHandler = object : Handler(Looper.getMainLooper()) {
+
+        override fun handleMessage(msg: Message) {
+            super.handleMessage(msg)
+
+            when (msg.what) {
+                SDK_PAY_FLAG -> {
+
+                    val payResult = PayResult(msg.obj as Map<String?, String?>)
+                    /**
+                     * 对于支付结果,请商户依赖服务端的异步通知结果。同步通知结果,仅作为支付结束的通知。
+                     */
+                    /**
+                     * 对于支付结果,请商户依赖服务端的异步通知结果。同步通知结果,仅作为支付结束的通知。
+                     */
+                    // val resultInfo = payResult.result // 同步返回需要验证的信息
+
+                    val resultStatus = payResult.resultStatus
+
+                    // 判断resultStatus 为9000则代表支付成功
+                    if (TextUtils.equals(resultStatus, "9000")) {
+                        // 该笔订单是否真实支付成功,需要依赖服务端的异步通知。
+                        //支付成功
+                        RxBus.get().post("PAY_COMPLETE", "")
+
+                    } else {
+                        // 该笔订单真实的支付结果,需要依赖服务端的异步通知。
+                        //
+                        if (null != context) {
+                            Toast.makeText(context, "支付失败", Toast.LENGTH_SHORT).show()
+                        }
+
+                    }
+
+                }
+                SDK_AUTH_FLAG -> {
+                    val authResult = AuthResult(msg.obj as Map<String?, String?>, true)
+                    val resultStatus: String = authResult.resultStatus
+                    // 判断resultStatus 为“9000”且result_code
+                    // 为“200”则代表授权成功,具体状态码代表含义可参考授权接口文档
+                    if (TextUtils.equals(resultStatus, "9000") && TextUtils.equals(authResult.getResultCode(), "200")) {
+                        // 获取alipay_open_id,调支付时作为参数extern_token 的value
+                        // 传入,则支付账户为该授权账户
+                        //认证成功
+                    } else {
+                        // 其他状态值则为授权失败
+                        //认证失败
+                    }
+
+
+                }
+
+
+            }
+
+
+        }
+    }
+
+
+    //去支付
+    fun toPay(orderInfo: String, context: Context) {
+
+        this.context = context
+
+        var payRunnable = Runnable {
+
+            kotlin.run {
+                var alipay = PayTask(context as Activity)
+                val result = alipay.payV2(orderInfo, true)
+
+                val msg = Message()
+                msg.what = SDK_PAY_FLAG
+                msg.obj = result
+                mHandler.sendMessage(msg)
+            }
+        }
+
+        // 必须异步调用
+        val payThread = Thread(payRunnable)
+        payThread.start()
+
+
+    }
+
+}

+ 5 - 0
alipay/src/main/res/values/colors.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+
+</resources>

+ 3 - 0
alipay/src/main/res/values/dimens.xml

@@ -0,0 +1,3 @@
+<resources >
+
+</resources >

+ 26 - 0
alipay/src/main/res/values/strings.xml

@@ -0,0 +1,26 @@
+<resources >
+    <string name="app_name" >alipay</string >
+    <string name="demo_info_text">Warning: \n\nFor demonstration purpose, the assembling and signing of the request parameters are done on the client side.\nHowever, in practice, both assembling and signing MUST BE carried out on the server side.</string>
+    <string name="pay_with_alipay">Pay with Alipay</string>
+    <string name="pay_with_alipay_hk">Pay with AlipayHK</string>
+    <string name="auth_with_alipay">Authenticate with Alipay</string>
+    <string name="web_to_native">Call Alipay from Web Content</string>
+    <string name="check_sdk_version">Alipay SDK Version</string>
+    <string name="pay_success">Payment success:</string>
+    <string name="auth_failed"> 认证失败:</string>
+    <string name="error_missing_appid_rsa_private">Error: Missing \"APPID\" or \"RSA_PRIVATE\" in PayDemoActivity.</string>
+    <string name="error_missing_hk_partner_seller_rsa_private">Error: Missing \"PARTNER\", \"SELLER\", or \"RSA_PRIVATE\\ in OrderUtils1_0_HK.</string>
+    <string name="pay_result">Payment result:</string>
+    <string name="error_auth_missing_partner_appid_rsa_private_target_id">Error: Missing \"PARTNER\", \"APP_ID\", \"RSA_PRIVATE\", or \"TARGET_ID\" in PayDemoActivity.</string>
+    <string name="confirm">确认</string>
+    <string name="pay_failed">Payment failed:</string>
+    <string name="auth_success">认证成功:</string>
+    <string name="alipay_sdk_version_is">"Alipay SDK version: "</string>
+    <string name="error_missing_h5_pay_url">Missing URL to load. Please configure in PayDemoActivity.h5Pay()</string>
+    <string name="error">Error</string>
+    <string name="pay_cross_border">Cross-border Pay with Alipay</string>
+    <string name="error_missing_global_partner_seller_rsa_private" >Error: Missing \"PARTNER\", \"SELLER\", or \"RSA_PRIVATE\\ in OrderUtils1_0_Global.</string>
+    <string name="payment_inst_hk">Payer: HK</string>
+    <string name="payment_inst_cn">Payer: CN</string>
+
+</resources >

+ 4 - 0
alipay/src/main/res/values/styles.xml

@@ -0,0 +1,4 @@
+<resources >
+
+
+</resources >

+ 3 - 1
app/build.gradle

@@ -122,8 +122,10 @@ dependencies {
 
     implementation project(':base')
     implementation project(path: ':update')
+    implementation project(path: ':alipay')
 
-  // addComponent 'umeng'
+
+    // addComponent 'umeng'
 //    addComponent 'jpush'
 //   addComponent 'lookimg'
 

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

@@ -98,6 +98,21 @@
             android:exported="true"
             android:launchMode="singleTask"
             android:taskAffinity="com.quansu.heifengwuliu" />
+        <activity
+            android:name="com.zswc.creativity.wxapi.WXPayEntryActivity"
+            android:exported="true"
+            android:launchMode="singleTop"
+            android:screenOrientation="portrait"
+            android:taskAffinity="com.quansu.trailertiger" >
+
+            <intent-filter >
+                <action android:name="android.intent.action.VIEW" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+
+                <data android:scheme="wx151fbb467c63bace" />
+            </intent-filter >
+        </activity >
 
         <activity android:name="com.zswc.creativity.activity.MsgActivity" >
             <intent-filter>
@@ -126,6 +141,15 @@
                android:hardwareAccelerated="false"
             />
 
+        <provider
+            android:name="androidx.core.content.FileProvider"
+            android:authorities="${applicationId}"
+            android:exported="false"
+            android:grantUriPermissions="true" >
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/file_paths" />
+        </provider >
 
 
 

+ 7 - 2
app/src/main/java/com/zswc/creativity/activity/MyInfoActivity.kt

@@ -22,6 +22,10 @@ import com.zswc.creativity.utils.OssUtils
 import com.zswc.creativity.vmodel.MyInfoVModel
 import com.zswc.creativity.vmodel.SpreadVModel
 import kotlinx.coroutines.launch
+import okhttp3.MediaType
+import okhttp3.MultipartBody
+import okhttp3.RequestBody
+import java.io.File
 import java.util.ArrayList
 
 /**
@@ -86,8 +90,9 @@ class MyInfoActivity : MBActivity<MyInfoVModel, ActivityMyInfoBinding>(), OnUplo
                     list.add(selectList[0].path)
                 }
 
-                OssUtils(this,vm)
-                        .setUpLoad("bank", list, this)
+                vm.toUpImg(list[0])
+//                OssUtils(this,vm)
+//                        .setUpLoad("bank", list, this)
 
             }
 

+ 26 - 9
app/src/main/java/com/zswc/creativity/activity/TibetanDetailsActivity.kt

@@ -1,6 +1,5 @@
 package com.zswc.creativity.activity
 
-import android.os.Build
 import android.os.Build.VERSION.SDK_INT
 import android.os.Bundle
 import android.os.Handler
@@ -16,20 +15,17 @@ import coil.decode.ImageDecoderDecoder
 import coil.load
 import com.hwangjr.rxbus.annotation.Subscribe
 import com.hwangjr.rxbus.annotation.Tag
-import com.ysnows.base.binding.ViewBindingAdapter
-import com.ysnows.base.utils.UiSwitch
-import com.ysnows.base.utils.UiUtils
+import com.qmuiteam.qmui.kotlin.onClick
+import com.quansu.alipay.componnent.CpAlipay
 import com.zswc.creativity.R
 import com.zswc.creativity.base.MBActivity
 import com.zswc.creativity.config.ConfigRx
 import com.zswc.creativity.databinding.ActivityTibetanDetailsBinding
+import com.zswc.creativity.utils.WeChatUtil
 import com.zswc.creativity.utils.net.NetEngine
 import com.zswc.creativity.vmodel.TibetanDetailsVModel
 import kotlinx.coroutines.launch
-import java.io.File
-import java.lang.reflect.Modifier
 import java.text.DecimalFormat
-import kotlin.math.log
 
 /**
  * 藏品详情
@@ -42,6 +38,7 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
     override fun init(savedInstanceState: Bundle?) {
         super.init(savedInstanceState)
         titleBar()?.imgRight?.setImageResource(R.drawable.ct_share)
+        vm.ll = binding.ll
         var id = intent?.extras?.getString("id")
         vm.getInfo(id!!)
 
@@ -54,7 +51,10 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
                 if (ss == "gif" || ss == "GIF") {
                     binding.imageView.visibility = View.GONE
                     //设置图片加载gif
+
                     val imageLoader=ImageLoader.Builder(context = this)
+                            .crossfade(true)
+                            .allowRgb565(true)
                             .componentRegistry{
                                 if (SDK_INT>28){
                                     add(ImageDecoderDecoder())
@@ -79,6 +79,17 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
     override fun listeners() {
         super.listeners()
 
+        binding.butBuy.onClick {
+            vm.toBuy(binding.butBuy)
+        }
+        binding.imgShare.onClick {
+            //分享
+            vm.getUrl()
+
+        }
+
+
+
 //        screenHeightPixels = UiUtils.getScreenHeightPixels(getContext());
 //
 //        obscroll.setOnScrollListener(object : OnScrollChangedListener() {
@@ -146,7 +157,7 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
     }
 
     override fun title(): String? {
-        return "商品详情"
+        return null
     }
 
     override val isRxbus: Boolean
@@ -240,7 +251,7 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
                     CpAlipay.pay(vm.repository().context!!, orderInfo)
                 } else {//微信
                     if (WeChatUtil.isWeixinAvilible(context())) {
-                        WeChatUtil.toWXPay(context(), it.datas!!)
+                        WeChatUtil.toWXPay(context(), it.data!!)
                     }
                 }
             }
@@ -256,5 +267,11 @@ class TibetanDetailsActivity : MBActivity<TibetanDetailsVModel, ActivityTibetanD
     }
 
 
+    @Subscribe(tags = [Tag(ConfigRx.PAY_COMPLETE)])
+    fun setPayComplete(money: String) {//充值了保证金后刷新
+        //刷新 todo:
+        toast("支付完成")
+    }
+
 
 }

+ 1 - 0
app/src/main/java/com/zswc/creativity/config/ConfigRx.kt

@@ -30,6 +30,7 @@ object ConfigRx {
     const val REFRESH_USER_DATA = "REFRESH_USER_DATA" //刷新用户信息
 
     const val CHOSE_PAY_TYPE = "CHOSE_PAY_TYPE" //支付方式  //1支付宝 2微信  //默认支付宝
+    const val PAY_COMPLETE = "PAY_COMPLETE" //支付完成-客户端
 
 
 

+ 12 - 0
app/src/main/java/com/zswc/creativity/model/Locality.kt

@@ -0,0 +1,12 @@
+package com.zswc.creativity.model
+
+import com.ysnows.base.inter.IModel
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/25
+ */
+data class Locality(var url:String,
+
+): IModel {
+}

+ 23 - 17
app/src/main/java/com/zswc/creativity/utils/LoadEngin.kt

@@ -18,14 +18,17 @@ import java.io.File
  object  LoadEngin : ImageEngine {
 
 
+
     override fun loadImage(context: Context, url: String, imageView: ImageView) {
-       // imageView.load(url)
+        // imageView.load(url)
         if(url.contains("content://")){
-            imageView.load(url) {
-                crossfade(true)
-                placeholder(R.drawable.picture_image_placeholder)
-                transformations(CircleCropTransformation())
-            }
+//            imageView.load(url) {
+//                crossfade(true)
+//                placeholder(R.drawable.picture_image_placeholder)
+//                transformations(CircleCropTransformation())
+//            }
+
+            imageView.load(url)
 
         }else{
             imageView.load(File(url))
@@ -59,11 +62,13 @@ import java.io.File
     override fun loadGridImage(context: Context, url: String, imageView: ImageView) {
         Log.e("-shy-", "url5=: "+url )
         if(url.contains("content://")){
-            imageView.load(url) {
-                crossfade(true)
-                placeholder(R.drawable.picture_image_placeholder)
-                transformations(CircleCropTransformation())
-            }
+//            imageView.load(url) {
+//                crossfade(true)
+//                placeholder(R.drawable.picture_image_placeholder)
+//                transformations(CircleCropTransformation())
+//            }
+
+            imageView.load(url)
 
         }else{
             imageView.load(File(url))
@@ -75,12 +80,13 @@ import java.io.File
     override fun loadFolderImage(context: Context, url: String, imageView: ImageView) {
 
         Log.e("-shy-", "url6=: "+url )
-        imageView.load(url) {
-            crossfade(true)
-            placeholder(R.drawable.picture_image_placeholder)
-            transformations(CircleCropTransformation())
-        }
-    }
+//        imageView.load(url) {
+//            crossfade(true)
+//            placeholder(R.drawable.picture_image_placeholder)
+//            transformations(CircleCropTransformation())
+//        }
 
+        imageView.load(url)
+    }
 
 }

+ 83 - 5
app/src/main/java/com/zswc/creativity/utils/PopuShareWxUtils.kt

@@ -4,6 +4,7 @@ import android.Manifest
 import android.annotation.SuppressLint
 import android.app.Activity
 import android.content.ComponentName
+import android.content.ContentResolver
 import android.content.Context
 import android.content.Intent
 import android.graphics.Bitmap
@@ -27,17 +28,20 @@ import com.qmuiteam.qmui.widget.QMUIRadiusImageView
 import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
 import com.qmuiteam.qmui.widget.popup.QMUIPopup
 import com.qmuiteam.qmui.widget.popup.QMUIPopups
-import com.zswc.creativity.R
 import com.yanzhenjie.permission.Action
 import com.yanzhenjie.permission.AndPermission
+import com.yanzhenjie.permission.FileProvider
 import com.ysnows.base.utils.UiUtils
 import com.zhy.http.okhttp.OkHttpUtils
 import com.zhy.http.okhttp.callback.FileCallBack
+import com.zswc.creativity.BuildConfig
+import com.zswc.creativity.R
 import okhttp3.Call
 import java.io.File
 import java.io.FileNotFoundException
 import java.util.*
 
+
 /**
  * 分享
  *Created by shihuiyun
@@ -50,8 +54,9 @@ object  PopuShareWxUtils {
     var tipDialog: QMUITipDialog? = null
     private var downimg: String? = null
     private val uriArrayList = ArrayList<Uri>() //下载到本地的图片的集合
-    fun show(context: Context, url: String, view: View){
-
+    var cr:ContentResolver?=null
+    fun show(context: Context, url: String, view: View, contentResolver: ContentResolver){
+        cr=contentResolver
         var mNormalPopup = QMUIPopups.fullScreenPopup(context)
         val builder: QMUISkinValueBuilder = QMUISkinValueBuilder.acquire()
         val frameLayout = QMUIFrameLayout(context)
@@ -62,6 +67,7 @@ object  PopuShareWxUtils {
         val img: QMUIRadiusImageView =layout.findViewById(R.id.img)
         val ivShareOne:ImageView=layout.findViewById(R.id.iv_share_one)
         val ivShareTwo:ImageView=layout.findViewById(R.id.iv_share_two)
+        val ivShareThree:ImageView=layout.findViewById(R.id.iv_share_three)
         val ivSave:ImageView=layout.findViewById(R.id.iv_save)
         val ivClose:ImageView=layout.findViewById(R.id.iv_close)
 
@@ -70,8 +76,8 @@ object  PopuShareWxUtils {
         val display = (context as Activity).windowManager.defaultDisplay
         val screenWidth = display.width
         params.width = screenWidth - UiUtils.dp2Px(context, 60f)
-      //  params.height = (((screenWidth - UiUtils.dp2Px(context, 60f)) * 1.6).toInt())
-        params.height=screenWidth - UiUtils.dp2Px(context, 60f)
+        params.height = (((screenWidth - UiUtils.dp2Px(context, 60f)) * 1.6).toInt())
+     //   params.height=screenWidth - UiUtils.dp2Px(context, 60f)
 
         img.layoutParams = params
 
@@ -93,6 +99,13 @@ object  PopuShareWxUtils {
             mNormalPopup.dismiss()
 
         }
+        ivShareThree.onClick {
+            //分享到QQ
+           // toShareQQ(context,url)
+            chose = 3
+            setShareImages(context, url)
+            mNormalPopup.dismiss()
+        }
 
         ivClose.onClick {
             mNormalPopup.dismiss()
@@ -307,10 +320,75 @@ object  PopuShareWxUtils {
 
 
         }
+        if(chose==3){//qq好友
+            //todo:分享失败
+            try {
+//                var fileUri: Uri? =null
+//                if (Build.VERSION.SDK_INT >= 24) {
+//                    fileUri = getUriForFile24(context, downimg)
+//                } else {
+//                    fileUri = Uri.fromFile(File(downimg))
+//                }
+                var fileUri: Uri? =null
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+
+                    fileUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileProvider", File(downimg))
+
+                }else{
+                    fileUri=Uri.fromFile(File(downimg))
+                }
+
+                val intent = Intent()
+                val comp = ComponentName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity")
+                intent.component = comp
+
+                intent.action = Intent.ACTION_SEND
+                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+                intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
+                intent.putExtra(Intent.EXTRA_STREAM, fileUri)
+                intent.type = "image/*" //分享文件
+                context.startActivity(Intent.createChooser(intent, "分享"))
+            } catch (e: java.lang.Exception) {
+                Log.e("-shy-", "e=: $e")
+                Toast.makeText(context,"分享图片到QQ失败",Toast.LENGTH_SHORT).show()
+//            ContextUtil.getInstance().showToastMsg("分享图片到**失败");
+            }
+
+
+
+        }
     }
 
 
 
+
+
+
+    fun  toShareQQ(context:Context,url:String){
+
+        try {
+
+            val bitmap: Bitmap = SaveLocalUtils.returnBitMap(url)
+            val intent = Intent()
+            val comp = ComponentName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity")
+            intent.component = comp
+
+            intent.action = Intent.ACTION_SEND
+            intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+           // intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(File(path)))
+            intent.type = "image/*" //分享文件
+
+            context.startActivity(Intent.createChooser(intent, "分享"))
+        } catch (e: java.lang.Exception) {
+            Toast.makeText(context,"分享图片到QQ失败",Toast.LENGTH_SHORT).show()
+//            ContextUtil.getInstance().showToastMsg("分享图片到**失败");
+        }
+
+    }
+
+
+
+
     private fun insertImageToSystem(context: Context, imagePath: String): String? {
         var url: String? = ""
         try {

+ 3 - 0
app/src/main/java/com/zswc/creativity/utils/SaveLocalUtils.java

@@ -213,6 +213,8 @@ public class SaveLocalUtils {
         if (Build.VERSION.SDK_INT >= 29) {
 //            boolean isTrue = saveSignImage(bitName, bitmap);
             saveSignImage(context,bitName,bitmap);
+            Log.e("shy", "ss=" + Uri.parse("file://" + fileName));
+
             return true;
 //            file= getPrivateAlbumStorageDir(NewPeoActivity.this, bitName,brand);
 //            return isTrue;
@@ -262,6 +264,7 @@ public class SaveLocalUtils {
 //        if(Build.VERSION.SDK_INT >= 29){
 //            copyPrivateToDownload(this,file.getAbsolutePath(),bitName);
 //        }
+
         context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + fileName)));
 
         return true;

+ 1 - 0
app/src/main/java/com/zswc/creativity/utils/ShareWxDilaog.kt

@@ -115,6 +115,7 @@ object ShareWxDilaog {
 
 
         Thread(Runnable {
+            //todo:文件后缀可以通过文件获取
             val bitmap: Bitmap = SaveLocalUtils.returnBitMap(url)
             SaveLocalUtils.saveBitmap(context, bitmap, "loc" + System.currentTimeMillis() + ".png")
             //                SaveLocalUtils.saveBmp2Gallery(

+ 41 - 0
app/src/main/java/com/zswc/creativity/utils/WeChatUtil.kt

@@ -6,9 +6,11 @@ import android.content.Intent
 import android.content.IntentFilter
 import com.tencent.mm.opensdk.constants.ConstantsAPI
 import com.tencent.mm.opensdk.modelmsg.SendAuth
+import com.tencent.mm.opensdk.modelpay.PayReq
 import com.tencent.mm.opensdk.openapi.IWXAPI
 import com.tencent.mm.opensdk.openapi.WXAPIFactory
 import com.ysnows.base.utils.Toasts
+import com.zswc.creativity.model.OrderPay
 
 /**
  *Created by shihuiyun
@@ -83,6 +85,45 @@ import com.ysnows.base.utils.Toasts
         }
 
 
+
+
+        /* 调支付的方法
+    * <p>
+    * 注意: 每次调用微信支付的时候都会校验 appid 、包名 和 应用签名的。 这三个必须保持一致才能够成功调起微信
+    *
+    * @param wxPayBean
+    */
+        fun toWXPay(context: Context?, bean: OrderPay) {
+
+            var mWXApi: IWXAPI
+            if (iwxapi != null) {
+                mWXApi = iwxapi!!
+            } else {
+                mWXApi = WXAPIFactory.createWXAPI(context, null)
+                mWXApi.registerApp(WECHAT_APP_ID)
+            }
+
+            //这里的bean,是服务器返回的json生成的bean
+            val payRequest = PayReq()
+            payRequest.appId = WECHAT_APP_ID
+            payRequest.partnerId = bean.wechat.partnerid
+            payRequest.prepayId = bean.wechat.prepayid
+            payRequest.packageValue = "Sign=WXPay" //固定值
+
+            payRequest.nonceStr = bean.wechat.noncestr
+            payRequest.timeStamp = bean.wechat.timestamp
+            payRequest.sign = bean.wechat.sign
+
+            //发起请求,调起微信前去支付
+            mWXApi.sendReq(payRequest)
+
+
+        }
+
+
+
+
+
     }
 
 }

+ 8 - 2
app/src/main/java/com/zswc/creativity/utils/net/ApiService.kt

@@ -4,6 +4,7 @@ import com.zswc.creativity.model.*
 import com.ysnows.base.net.PageResp
 import com.ysnows.base.net.Resp
 import io.reactivex.Observable
+import okhttp3.MultipartBody
 import retrofit2.http.*
 import java.util.*
 
@@ -90,8 +91,13 @@ interface ApiService {
     @GET("Index/CollectionDetail")
     suspend fun CollectionDetail(@Query("id") id: String?): Resp<TibetaDetails>
 
-
-
+    /**
+     * 上传头像
+     * @return
+     */
+    @Multipart
+    @POST("Publics/uploadLocality")
+    suspend fun uploadLocality(@Field("file") file: MultipartBody.Part??): Resp<Locality>
 
 
 

+ 68 - 1
app/src/main/java/com/zswc/creativity/vmodel/MyInfoVModel.kt

@@ -1,15 +1,29 @@
 package com.zswc.creativity.vmodel
 
 import android.app.Application
-import com.zswc.creativity.activity.LoginActivity
+import android.util.Log
+import androidx.lifecycle.MutableLiveData
 import com.tencent.mmkv.MMKV
+import com.ysnows.base.base.BApp
 import com.ysnows.base.base.BRepository
 import com.ysnows.base.base.BViewModel
 import com.ysnows.base.utils.UiSwitch
+import com.zhy.http.okhttp.OkHttpUtils
+import com.zhy.http.okhttp.callback.StringCallback
+import com.zswc.creativity.R
+import com.zswc.creativity.activity.LoginActivity
 import com.zswc.creativity.utils.ChosePhotoUtils
+import okhttp3.Call
+import okhttp3.RequestBody
+import org.json.JSONObject
+import java.io.File
+import java.util.regex.Pattern
+
 
 class MyInfoVModel(application: Application) : BViewModel<BRepository>(application)  {
 
+    var imagUrl = MutableLiveData<String>()
+
     //退出登录
     fun  toExitLogin(){
         //只清空token
@@ -24,6 +38,59 @@ class MyInfoVModel(application: Application) : BViewModel<BRepository>(applicati
 
     }
 
+    fun toUpImg(url:String){
+
+
+        var name: String //文件名字不能含有中文
+        val index =url.lastIndexOf("/")
+
+        name = if (isContainChinese(url.substring(index + 1))) {
+            System.currentTimeMillis().toString() + ".jpg"
+        } else {
+            url.substring(index + 1)
+        }
+
+        val requestCall = OkHttpUtils.post()
+                .url(BApp.config.baseUrl()+"Publics/uploadLocality")
+                .addFile("file", name,  File(url))
+                .build()
+
+        requestCall.execute(object : StringCallback() {
+            override fun onError(call: Call, e: Exception, id: Int) {
+                bView.toast(bView.getStr(R.string.upload_pic_fail)+e)
+                Log.e("-shy-", "onError: $e")
+
+            }
+
+            override fun onResponse(response: String, id: Int) {
+                //地址
+                val root = JSONObject(response)
+                val root1 = JSONObject(root.getString("data"))
+                var url=root1.get("url")
+                imagUrl.value = url.toString()
+
+
+
+
+            }
+        })
+
+
+
+    }
+    /**
+     * url中是否含有中文
+     *
+     * @param str
+     * @return
+     */
+    fun isContainChinese(str: String?): Boolean {
+        val p = Pattern.compile("[\u4e00-\u9fa5]")
+        val m = p.matcher(str)
+        return m.find()
+    }
+
+
 
 
 }

+ 1 - 1
app/src/main/java/com/zswc/creativity/vmodel/OrderListVModel.kt

@@ -62,7 +62,7 @@ class OrderListVModel(application: Application) : BRViewModel<BRRepository>(appl
 
                         )
                 .onGranted { data ->
-                    PopuShareWxUtils.show(repository().context!!,qrcode, ll!!)
+                  //  PopuShareWxUtils.show(repository().context!!,qrcode, ll!!)
                 }
                 .onDenied {
                     toast("读写权限被拒接,请手动打开!")

+ 9 - 9
app/src/main/java/com/zswc/creativity/vmodel/RechargeVModel.kt

@@ -49,15 +49,15 @@ class RechargeVModel(application: Application): BViewModel<BRepository>(applicat
             return
         }
 
-        repository().rxLreq(NetEngine.service.amountAdd(money, url.value))
-                .doOnNext {
-                    if (it.ok(true)) {
-                        var con = repository().context as Activity
-                        con.setResult(Activity.RESULT_OK, Intent())
-                        con.finish()
-                    }
-                }
-                .subscribe()
+//        repository().rxLreq(NetEngine.service.amountAdd(money, url.value))
+//                .doOnNext {
+//                    if (it.ok(true)) {
+//                        var con = repository().context as Activity
+//                        con.setResult(Activity.RESULT_OK, Intent())
+//                        con.finish()
+//                    }
+//                }
+//                .subscribe()
 
     }
 

+ 26 - 0
app/src/main/java/com/zswc/creativity/vmodel/TibetanDetailsVModel.kt

@@ -1,17 +1,21 @@
 package com.zswc.creativity.vmodel
 
 import android.app.Application
+import android.text.TextUtils
 import android.view.View
+import android.widget.LinearLayout
 import androidx.lifecycle.MutableLiveData
 import androidx.lifecycle.viewModelScope
 import com.ysnows.base.base.BRepository
 import com.ysnows.base.base.BViewModel
 import com.zswc.creativity.model.TibetaDetails
 import com.zswc.creativity.utils.PopuBuyUtils
+import com.zswc.creativity.utils.PopuShareWxUtils
 import com.zswc.creativity.utils.net.NetEngine
 import kotlinx.coroutines.launch
 
 class TibetanDetailsVModel(application: Application) : BViewModel<BRepository>(application)  {
+    var ll: LinearLayout? = null
 
     var data= MutableLiveData<TibetaDetails>()
     //倒计时
@@ -34,10 +38,32 @@ class TibetanDetailsVModel(application: Application) : BViewModel<BRepository>(a
 
     fun  toBuy(view :View){//支付弹框
         PopuBuyUtils.show(repository().context!!,  view)
+    }
+
+    fun getUrl() {
+
+
+//        viewModelScope.launch {
+//            var it = repository().lreq { NetEngine.service.getAppCode(k_id, "1") }
+//            if (it.ok()) {
+//
+//                toShareCode(it.datas?.appcode)
+//
+//            }
+//        }
 
+        //测试
+        toShareCode("https://img.chuangchi.vip/nft/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220704134149.jpg20220704014839.jpg?time=1658644985996")
     }
 
 
+    fun toShareCode(shareUrl: String?) {
+        if (TextUtils.isEmpty(shareUrl)) {
+            return
+        }
+
+        PopuShareWxUtils.show(repository().context!!, shareUrl!!, ll!!,repository().context!!.contentResolver)
+    }
 
 
 }

+ 78 - 0
app/src/main/java/com/zswc/creativity/wxapi/WXPayEntryActivity.kt

@@ -0,0 +1,78 @@
+package com.zswc.creativity.wxapi
+
+import android.app.Activity
+import android.os.Bundle
+import android.util.Log
+import android.widget.Toast
+import com.hwangjr.rxbus.RxBus
+import com.tencent.mm.opensdk.modelbase.BaseReq
+import com.tencent.mm.opensdk.modelbase.BaseResp
+import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
+import com.tencent.mm.opensdk.openapi.WXAPIFactory
+import com.zswc.creativity.config.ConfigRx
+import com.zswc.creativity.utils.WeChatUtil
+
+/**
+ *Created by shihuiyun
+ *on 2021/1/8
+ */
+class WXPayEntryActivity : Activity(), IWXAPIEventHandler {
+    override fun onReq(baseResp: BaseReq?) {
+//        if (baseResp?.type === ConstantsAPI.COMMAND_PAY_BY_WX) {
+//            when (baseResp.hashCode()) {
+//                0 -> {
+//                    RxBus.get().post(ConfigRx.PAY_COMPLETE, "")
+//                    Toast.makeText(this, "支付成功", Toast.LENGTH_SHORT).show()
+//                    //  Log.d(TAG, "onResp: resp.errCode = 0   支付成功")
+//                }
+//                -1 -> {
+//                    Toast.makeText(this, "支付错误" + baseResp.hashCode(), Toast.LENGTH_SHORT).show()
+//                    // Log.d(TAG, "onResp: resp.errCode = -1  支付错误")
+//                }
+//                -2 -> {
+//                    // Log.d(TAG, "onResp: resp.errCode = -2  用户取消")
+//                    Toast.makeText(this, "用户取消" + baseResp.hashCode(), Toast.LENGTH_SHORT).show()
+//                }
+//            }
+//            finish() //这里需要关闭该页面
+//        }
+    }
+
+    override fun onResp(resp: BaseResp?) {
+
+
+        /*  if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setTitle(R.string.app_tip);
+            builder.setMessage(getString(R.string.pay_result_callback_msg, String.valueOf(resp.errCode)));
+            builder.show();
+        }*/
+        val errCode = resp!!.errCode
+        if (errCode == 0) {    //显示充值成功的页面和需要的操作
+            RxBus.get().post(ConfigRx.PAY_COMPLETE, "")
+            Toast.makeText(this, "支付成功", Toast.LENGTH_SHORT).show()
+        } else if (errCode == -1) {  //错误
+            Toast.makeText(this, "支付错误$errCode", Toast.LENGTH_SHORT).show()
+        } else if (errCode == -2) { //用户取消
+            Log.e("-pay--", "pay=ff: ")
+
+        }
+
+        finish() //这里需要关闭该页面
+
+
+    }
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        RxBus.get().register(this)
+        val mWXApi = WXAPIFactory.createWXAPI(this, WeChatUtil.WECHAT_APP_ID, true)
+        mWXApi.handleIntent(intent, this)
+
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        RxBus.get().unregister(this)
+    }
+}

BIN
app/src/main/res/drawable-xxhdpi/share_qq.png


+ 1 - 0
app/src/main/res/layout/activity_my_info.xml

@@ -42,6 +42,7 @@
                 android:layout_width="38dp"
                 android:layout_height="38dp"
                 android:layout_marginEnd="8dp"
+               app:url="@{vm.imagUrl}"
                 android:background="@drawable/ic_default_avatar"
                 app:qmui_is_oval="true" />
 

+ 34 - 0
app/src/main/res/layout/activity_tibetan_details.xml

@@ -11,10 +11,43 @@
     </data>
 
     <LinearLayout
+        android:id="@+id/ll"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@color/white"
         android:orientation="vertical">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="20dp"
+            android:paddingBottom="10dp"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:layout_width="38dp"
+                android:layout_height="20dp"
+                android:paddingLeft="20dp"
+                android:src="@drawable/ic_back_black" />
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:layout_height="wrap_content"
+                android:layout_marginEnd="14dp"
+                android:gravity="center_horizontal"
+                android:text="臧品详情"
+                android:textColor="@color/text_title"
+                android:textSize="18sp"
+                android:textStyle="bold" />
+
+            <ImageView
+                android:id="@+id/img_share"
+                android:layout_width="28dp"
+                android:layout_height="20dp"
+                android:layout_marginEnd="16dp"
+                android:src="@drawable/ct_share" />
+
+        </LinearLayout>
 
         <androidx.core.widget.NestedScrollView
             android:layout_width="match_parent"
@@ -439,6 +472,7 @@
                 android:layout_height="wrap_content"/>
 
             <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+                android:id="@+id/but_buy"
                 android:layout_width="180dp"
                 android:layout_height="40dp"
                 app:qmui_radius="4dp"

+ 3 - 3
app/src/main/res/layout/item_pop_buy.xml

@@ -187,7 +187,7 @@
                 <ImageView
                     android:layout_width="16dp"
                     android:layout_height="16dp"
-                    android:src="@{vm.isWx?@drawable/ct_tr_chose_on:@drawable/ct_tr_chose_off}"
+                    android:src="@drawable/ct_tr_chose_on"
                     tools:src="@drawable/ct_tr_chose_off" />
 
 
@@ -223,8 +223,8 @@
                 <ImageView
                     android:layout_width="16dp"
                     android:layout_height="16dp"
-                    android:src="@{vm.isWx?@drawable/ct_tr_chose_on:@drawable/ct_tr_chose_off}"
-                    tools:src="@drawable/ct_tr_chose_off" />
+                    android:src="@drawable/ct_tr_chose_off"
+                    />
 
 
             </LinearLayout>

+ 14 - 0
app/src/main/res/layout/item_wx_share.xml

@@ -64,6 +64,20 @@
                     android:src="@drawable/share_friends"></ImageView>
 
             </LinearLayout>
+            <LinearLayout
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+
+                android:gravity="center">
+
+                <ImageView
+                    android:id="@+id/iv_share_three"
+                    android:layout_width="49dp"
+                    android:layout_height="51dp"
+                    android:src="@drawable/share_qq"></ImageView>
+
+            </LinearLayout>
 
             <LinearLayout
                 android:layout_width="0dp"

+ 63 - 18
app/src/main/res/xml/file_paths.xml

@@ -1,19 +1,64 @@
 <?xml version="1.0" encoding="utf-8"?>
-<paths >
-    <!--为了适配所有路径可以设置 path = "." -->
-    <external-path
-        name="tt_external_root"
-        path="." />
-    <external-path
-        name="tt_external_download"
-        path="Download" />
-    <external-files-path
-        name="tt_external_files_download"
-        path="Download" />
-    <files-path
-        name="tt_internal_file_download"
-        path="Download" />
-    <cache-path
-        name="tt_internal_cache_download"
-        path="Download" />
-</paths >
+<resources >
+
+    <paths >
+        <external-path
+            name="my_images"
+            path="Pictures" />
+
+        <external-path
+            name="Pictures"
+            path="." />
+
+        <external-path
+            name="app_update"
+            path="AppUpdate" />
+
+        <external-path
+            name="app_update_external"
+            path="/" />
+        <external-cache-path
+            name="app_update_cache"
+            path="/" />
+
+        <external-path
+            name="external_files"
+            path="." />
+
+        <external-path
+            name="camera_photos"
+            path="" />
+
+        <external-path
+            name="external_storage_root"
+            path="." />
+        <files-path
+            name="files-path"
+            path="." />
+        <cache-path
+            name="cache-path"
+            path="." />
+        <!--/storage/emulated/0/Android/data/...-->
+        <external-files-path
+            name="external_file_path"
+            path="." />
+        <!--代表app 外部存储区域根目录下的文件 Context.getExternalCacheDir目录下的目录-->
+        <external-cache-path
+            name="external_cache_path"
+            path="." />
+        <!--配置root-path。这样子可以读取到sd卡和一些应用分身的目录,否则微信分身保存的图片,就会导致 java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/999/tencent/MicroMsg/WeiXin/export1544062754693.jpg,在小米6的手机上微信分身有这个crash,华为没有
+    -->
+        <root-path
+            name="root-path"
+            path="" />
+
+<!--        <root-path path="Android/data/com.zswc.creativity/" name="files_root" />-->
+<!--        <root-path path="." name="external_storage_root" />-->
+
+
+    </paths >
+
+
+
+
+</resources >

+ 2 - 1
settings.gradle

@@ -1,8 +1,9 @@
-include ':jpush'
+//include ':jpush'
 //include ':umeng'
 include ':update'
 //include ':gaode'
 include ':lookimg'
+include ':alipay'
 
 include ':app',':base'
 

Неке датотеке нису приказане због велике количине промена