Merge remote-tracking branch 'origin/dev_改版主分支-升级融云SDK&AGP8' into dev_改版主分支-升级融云SDK&AGP8

This commit is contained in:
zlzw 2024-03-26 17:39:10 +08:00
commit 210d3a5184
13 changed files with 78 additions and 51 deletions

View File

@ -229,7 +229,7 @@ dependencies {
api project(':lib_google') api project(':lib_google')
//samsung插件包 //samsung插件包
api project(':IAP6Helper') //api project(':IAP6Helper')
// //
api 'com.contrarywind:Android-PickerView:4.1.9' api 'com.contrarywind:Android-PickerView:4.1.9'

Binary file not shown.

View File

@ -3,14 +3,16 @@ package com.yunbao.common.pay.samsung;
import android.content.Context; import android.content.Context;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.samsung.android.sdk.iap.lib2.helper.HelperDefine; import com.samsung.android.sdk.iap.lib.constants.HelperDefine;
import com.samsung.android.sdk.iap.lib2.helper.IapHelper; import com.samsung.android.sdk.iap.lib.helper.IapHelper;
import com.samsung.android.sdk.iap.lib2.listener.OnConsumePurchasedItemsListener; import com.samsung.android.sdk.iap.lib.listener.OnConsumePurchasedItemsListener;
import com.samsung.android.sdk.iap.lib2.listener.OnGetOwnedListListener; import com.samsung.android.sdk.iap.lib.listener.OnGetOwnedListListener;
import com.samsung.android.sdk.iap.lib2.listener.OnPaymentListener; import com.samsung.android.sdk.iap.lib.listener.OnPaymentListener;
import com.samsung.android.sdk.iap.lib2.vo.ConsumeVo; import com.samsung.android.sdk.iap.lib.vo.ConsumeVo;
import com.samsung.android.sdk.iap.lib2.vo.ErrorVo; import com.samsung.android.sdk.iap.lib.vo.ErrorVo;
import com.samsung.android.sdk.iap.lib2.vo.OwnedProductVo; import com.samsung.android.sdk.iap.lib.vo.OwnedProductVo;
import com.samsung.android.sdk.iap.lib.vo.PurchaseVo;
import com.yunbao.common.R;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import java.util.ArrayList; import java.util.ArrayList;
@ -57,9 +59,27 @@ public class SamsungUtil {
*/ */
public void buy(String skuId, OnPaymentListener onPaymentListener) { public void buy(String skuId, OnPaymentListener onPaymentListener) {
//购买 //购买
iapHelper.startPayment(skuId, "", onPaymentListener); iapHelper.startPayment(skuId, "", (errorVo, purchaseVo) -> {
if (purchaseVo != null) {
onPaymentListener.onPaymentSuccess(purchaseVo.getPurchaseId());
} else {
if (errorVo.getErrorCode() == HelperDefine.IAP_PAYMENT_IS_CANCELED) {
onPaymentListener.onPaymentFailed(mContext.getString(R.string.pay_cancel));
} else {
onPaymentListener.onPaymentFailed(errorVo.getErrorString());
}
}
});
} }
public interface OnPaymentListener {
void onPaymentSuccess(String purchaseVo);
void onPaymentFailed(String errorVo);
}
/** /**
* 消耗指定商品 * 消耗指定商品
* *

View File

@ -27,4 +27,5 @@
<string name="focus_on">Focus on</string> <string name="focus_on">Focus on</string>
<string name="see_more">See more</string> <string name="see_more">See more</string>
<string name="close">close</string> <string name="close">close</string>
<string name="time_cannot_be_greater_than_the_current_time">Time cannot be greater than the current time</string>
</resources> </resources>

View File

@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string> <string name="focus_on">關注</string>
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources> </resources>

View File

@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string> <string name="focus_on">關注</string>
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources> </resources>

View File

@ -1490,4 +1490,5 @@
<string name="focus_on">關注</string> <string name="focus_on">關注</string>
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources> </resources>

View File

@ -1512,6 +1512,7 @@ Limited ride And limited avatar frame</string>
<string name="focus_on">關注</string> <string name="focus_on">關注</string>
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources> </resources>

View File

@ -22,7 +22,7 @@ ext {
// true表示谷歌支付 false // true表示谷歌支付 false
// isGooglePlay : false, // isGooglePlay : false,
// true表示谷歌支付 false 0 1 2 // true表示谷歌支付 false 0 1 2
isGooglePlay : 1, isGooglePlay : 3,
// //
isUploadLog : true, isUploadLog : true,

View File

@ -288,24 +288,31 @@ public class CommunitySendActivity extends AbsActivity {
} }
} }
TimePickerView timePickerView;
public void showTimeChooseDialog() { public void showTimeChooseDialog() {
Calendar startCalendar = Calendar.getInstance(); Calendar startCalendar = Calendar.getInstance();
startCalendar.set(1990, 1, 1); startCalendar.set(1990, 1, 1);
Calendar endCalendar = Calendar.getInstance(); Calendar endCalendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR); int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1; // Calendar.MONTH 从0开始计数 int month = calendar.get(Calendar.MONTH); // Calendar.MONTH 从0开始计数
int day = calendar.get(Calendar.DAY_OF_MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH);
int hour = calendar.get(Calendar.HOUR); // 使用24小时制 int hour = calendar.get(Calendar.HOUR_OF_DAY); // 使用24小时制
int minute = calendar.get(Calendar.MINUTE); int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND); int second = calendar.get(Calendar.SECOND);
endCalendar.set(year, month, day, hour, minute, second); endCalendar.set(year, month, day, hour, minute, second);
TimePickerView timePickerView = new TimePickerBuilder(CommunitySendActivity.this, new OnTimeSelectListener() { timePickerView = new TimePickerBuilder(CommunitySendActivity.this, new OnTimeSelectListener() {
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
public void onTimeSelect(Date date, View v) { public void onTimeSelect(Date date, View v) {
chooseTime.setText(DateFormatUtil.getTimeStrings(date.getTime())); if (date.getTime() > new Date().getTime()) {
ToastUtil.show(getResources().getString(com.yunbao.main.R.string.time_cannot_be_greater_than_the_current_time));
timePickerView.show();
} else {
chooseTime.setText(DateFormatUtil.getTimeStrings(date.getTime()));
}
} }
}).setType(new boolean[]{true, true, true, true, true, false})// 默认全部显示 }).setType(new boolean[]{true, true, true, true, true, false})// 默认全部显示
.setCancelText(getResources().getString(R.string.cancel))//取消按钮文字 .setCancelText(getResources().getString(R.string.cancel))//取消按钮文字
@ -318,12 +325,6 @@ public class CommunitySendActivity extends AbsActivity {
.isCenterLabel(false) //是否只显示中间选中项的label文字false则每项item全部都带有label .isCenterLabel(false) //是否只显示中间选中项的label文字false则每项item全部都带有label
.build(); .build();
timePickerView.show(); timePickerView.show();
timePickerView.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(Object o) {
}
});
} }
private void openImageChooserActivity() { private void openImageChooserActivity() {

View File

@ -14,10 +14,6 @@ import android.webkit.WebView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.samsung.android.sdk.iap.lib2.helper.HelperDefine;
import com.samsung.android.sdk.iap.lib2.listener.OnPaymentListener;
import com.samsung.android.sdk.iap.lib2.vo.ErrorVo;
import com.samsung.android.sdk.iap.lib2.vo.PurchaseVo;
import com.yunbao.common.pay.samsung.SamsungUtil; import com.yunbao.common.pay.samsung.SamsungUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
@ -99,15 +95,13 @@ public class SamsungFragment extends Fragment {
mProductId = ProductId; mProductId = ProductId;
mOrderid = OrderNumber; mOrderid = OrderNumber;
MoneyUsds = MoneyUsd; MoneyUsds = MoneyUsd;
SamsungUtil.newInstance(getActivity()).buy(mProductId, new SamsungUtil.OnPaymentListener() {
SamsungUtil.newInstance(getActivity()).buy(mProductId, new OnPaymentListener() {
@Override @Override
public void onPayment(ErrorVo _errorVO, PurchaseVo _purchaseVO) { public void onPaymentSuccess(String purchaseVo) {
if (_purchaseVO != null) { SamsungUtil.newInstance(getActivity()).consume(purchaseVo);
SamsungUtil.newInstance(getActivity()).consume(_purchaseVO.getPurchaseId()); payHandler.post(new Runnable() {
payHandler.post(new Runnable() { @Override
@Override public void run() {
public void run() {
// CommonHttpUtil.notifySamsung(_purchaseVO.getPurchaseId(), mOrderid, new HttpCallback() { // CommonHttpUtil.notifySamsung(_purchaseVO.getPurchaseId(), mOrderid, new HttpCallback() {
// @Override // @Override
// public void onSuccess(int code, String msg, String[] info) { // public void onSuccess(int code, String msg, String[] info) {
@ -117,23 +111,22 @@ public class SamsungFragment extends Fragment {
// } // }
// } // }
// }); // });
} }
}); });
} else { }
payHandler.post(new Runnable() {
@Override @Override
public void run() { public void onPaymentFailed(String errorVo) {
if (_errorVO.getErrorCode() == HelperDefine.IAP_PAYMENT_IS_CANCELED) { payHandler.post(new Runnable() {
ToastUtil.show(getString(R.string.pay_cancel)); @Override
} else { public void run() {
ToastUtil.show(_errorVO.getErrorString()); ToastUtil.show(errorVo);
} }
} });
});
}
} }
}); });
} }
lastClickTime = currentTime; lastClickTime = currentTime;
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd); Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
@ -149,6 +142,7 @@ public class SamsungFragment extends Fragment {
public void androidGoBack() { public void androidGoBack() {
getActivity().onBackPressed(); getActivity().onBackPressed();
} }
} }

View File

@ -5,12 +5,10 @@ import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Outline; import android.graphics.Outline;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.MediaStore;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.View; import android.view.View;
import android.view.ViewOutlineProvider; import android.view.ViewOutlineProvider;
@ -271,7 +269,7 @@ public class UserHomeActivity extends AbsActivity {
tagList.add(userInfo.getUserHomeTopInfo().getAge() + (WordUtil.isNewZh() ? "" : "years old")); tagList.add(userInfo.getUserHomeTopInfo().getAge() + (WordUtil.isNewZh() ? "" : "years old"));
} }
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getHeight())) { if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getHeight())) {
tagList.add(userInfo.getUserHomeTopInfo().getHeight()); tagList.add(userInfo.getUserHomeTopInfo().getHeight() + "cm");
} }
if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) { if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) {
tagList.add(userInfo.getUserHomeTopInfo().getCareer()); tagList.add(userInfo.getUserHomeTopInfo().getCareer());
@ -354,6 +352,9 @@ public class UserHomeActivity extends AbsActivity {
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
bannerImgList.remove(position); bannerImgList.remove(position);
uploadImg(false); uploadImg(false);
if (bannerImgList.isEmpty()) {
bannerImgList.add(userInfo.getUserHomeTopInfo().getUser_avatar());
}
} }
}); });
} }
@ -761,6 +762,12 @@ public class UserHomeActivity extends AbsActivity {
} }
private void uploadImg(boolean isUp) { private void uploadImg(boolean isUp) {
for (int i = 0; i < bannerImgList.size(); i++) {
if (bannerImgList.get(i).equals(userInfo.getUserHomeTopInfo().getUser_avatar())) {
bannerImgList.remove(i);
break;
}
}
CommonHttpUtil.uploadUserInfoImg(new Gson().toJson(bannerImgList), new com.yunbao.common.http.HttpCallback() { CommonHttpUtil.uploadUserInfoImg(new Gson().toJson(bannerImgList), new com.yunbao.common.http.HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {

View File

@ -6,4 +6,4 @@ include ':Share'
include ':pluginsForAnchor' include ':pluginsForAnchor'
//include ':lib_huawei' //include ':lib_huawei'
include ':lib_google' include ':lib_google'
include ':IAP6Helper' //include ':IAP6Helper'