diff --git a/common/build.gradle b/common/build.gradle index 931e41955..f20b49dc9 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -229,7 +229,7 @@ dependencies { api project(':lib_google') //samsung插件包 - api project(':IAP6Helper') + //api project(':IAP6Helper') //時間選擇器 api 'com.contrarywind:Android-PickerView:4.1.9' diff --git a/common/libs/samsung-iap-6.1.1.aar b/common/libs/samsung-iap-6.1.1.aar new file mode 100644 index 000000000..4195da69d Binary files /dev/null and b/common/libs/samsung-iap-6.1.1.aar differ diff --git a/common/src/main/java/com/yunbao/common/pay/samsung/SamsungUtil.java b/common/src/main/java/com/yunbao/common/pay/samsung/SamsungUtil.java index 0cacbf03e..d4b4080e2 100644 --- a/common/src/main/java/com/yunbao/common/pay/samsung/SamsungUtil.java +++ b/common/src/main/java/com/yunbao/common/pay/samsung/SamsungUtil.java @@ -3,14 +3,16 @@ package com.yunbao.common.pay.samsung; import android.content.Context; import com.google.gson.Gson; -import com.samsung.android.sdk.iap.lib2.helper.HelperDefine; -import com.samsung.android.sdk.iap.lib2.helper.IapHelper; -import com.samsung.android.sdk.iap.lib2.listener.OnConsumePurchasedItemsListener; -import com.samsung.android.sdk.iap.lib2.listener.OnGetOwnedListListener; -import com.samsung.android.sdk.iap.lib2.listener.OnPaymentListener; -import com.samsung.android.sdk.iap.lib2.vo.ConsumeVo; -import com.samsung.android.sdk.iap.lib2.vo.ErrorVo; -import com.samsung.android.sdk.iap.lib2.vo.OwnedProductVo; +import com.samsung.android.sdk.iap.lib.constants.HelperDefine; +import com.samsung.android.sdk.iap.lib.helper.IapHelper; +import com.samsung.android.sdk.iap.lib.listener.OnConsumePurchasedItemsListener; +import com.samsung.android.sdk.iap.lib.listener.OnGetOwnedListListener; +import com.samsung.android.sdk.iap.lib.listener.OnPaymentListener; +import com.samsung.android.sdk.iap.lib.vo.ConsumeVo; +import com.samsung.android.sdk.iap.lib.vo.ErrorVo; +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 java.util.ArrayList; @@ -57,9 +59,27 @@ public class SamsungUtil { */ 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); + } + + /** * 消耗指定商品 * diff --git a/common/src/main/res/values-en-rUS/strings.xml b/common/src/main/res/values-en-rUS/strings.xml index 31c5c0d2f..a16b1aa54 100644 --- a/common/src/main/res/values-en-rUS/strings.xml +++ b/common/src/main/res/values-en-rUS/strings.xml @@ -27,4 +27,5 @@ Focus on See more close + Time cannot be greater than the current time \ No newline at end of file diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index f75e70513..f9997b3ba 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1492,4 +1492,5 @@ 關注 查看更多 收起 + 时间不能大于当前时间 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index aaf1ba5a9..200bff418 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1492,4 +1492,5 @@ 關注 查看更多 收起 + 时间不能大于当前时间 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 99f403292..2d15a99f7 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1490,4 +1490,5 @@ 關注 查看更多 收起 + 时间不能大于当前时间 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 1c7f32e1b..94d835b22 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1512,6 +1512,7 @@ Limited ride And limited avatar frame 關注 查看更多 收起 + 时间不能大于当前时间 diff --git a/config.gradle b/config.gradle index 31994f1d9..87f2c9b5a 100644 --- a/config.gradle +++ b/config.gradle @@ -22,7 +22,7 @@ ext { // true表示谷歌支付 false // isGooglePlay : false, // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 - isGooglePlay : 1, + isGooglePlay : 3, //是否上报异常日志 isUploadLog : true, diff --git a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java index 97f620ca0..23583799c 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java @@ -288,24 +288,31 @@ public class CommunitySendActivity extends AbsActivity { } } + TimePickerView timePickerView; + public void showTimeChooseDialog() { Calendar startCalendar = Calendar.getInstance(); startCalendar.set(1990, 1, 1); Calendar endCalendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); 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 hour = calendar.get(Calendar.HOUR); // 使用24小时制 + int hour = calendar.get(Calendar.HOUR_OF_DAY); // 使用24小时制 int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.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") @Override 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})// 默认全部显示 .setCancelText(getResources().getString(R.string.cancel))//取消按钮文字 @@ -318,12 +325,6 @@ public class CommunitySendActivity extends AbsActivity { .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 .build(); timePickerView.show(); - timePickerView.setOnDismissListener(new OnDismissListener() { - @Override - public void onDismiss(Object o) { - - } - }); } private void openImageChooserActivity() { diff --git a/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java b/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java index 32b02eaba..8fa0a3d02 100644 --- a/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java +++ b/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java @@ -14,10 +14,6 @@ import android.webkit.WebView; 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.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; @@ -99,15 +95,13 @@ public class SamsungFragment extends Fragment { mProductId = ProductId; mOrderid = OrderNumber; MoneyUsds = MoneyUsd; - - SamsungUtil.newInstance(getActivity()).buy(mProductId, new OnPaymentListener() { + SamsungUtil.newInstance(getActivity()).buy(mProductId, new SamsungUtil.OnPaymentListener() { @Override - public void onPayment(ErrorVo _errorVO, PurchaseVo _purchaseVO) { - if (_purchaseVO != null) { - SamsungUtil.newInstance(getActivity()).consume(_purchaseVO.getPurchaseId()); - payHandler.post(new Runnable() { - @Override - public void run() { + public void onPaymentSuccess(String purchaseVo) { + SamsungUtil.newInstance(getActivity()).consume(purchaseVo); + payHandler.post(new Runnable() { + @Override + public void run() { // CommonHttpUtil.notifySamsung(_purchaseVO.getPurchaseId(), mOrderid, new HttpCallback() { // @Override // public void onSuccess(int code, String msg, String[] info) { @@ -117,23 +111,22 @@ public class SamsungFragment extends Fragment { // } // } // }); - } - }); - } else { - payHandler.post(new Runnable() { - @Override - public void run() { - if (_errorVO.getErrorCode() == HelperDefine.IAP_PAYMENT_IS_CANCELED) { - ToastUtil.show(getString(R.string.pay_cancel)); - } else { - ToastUtil.show(_errorVO.getErrorString()); - } - } - }); - } + } + }); + } + + @Override + public void onPaymentFailed(String errorVo) { + payHandler.post(new Runnable() { + @Override + public void run() { + ToastUtil.show(errorVo); + } + }); } }); } + lastClickTime = currentTime; Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd); @@ -149,6 +142,7 @@ public class SamsungFragment extends Fragment { public void androidGoBack() { getActivity().onBackPressed(); } + } diff --git a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java index 65c6b6aca..172771662 100644 --- a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java @@ -5,12 +5,10 @@ import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Intent; import android.content.pm.PackageManager; -import android.database.Cursor; import android.graphics.Color; import android.graphics.Outline; import android.net.Uri; import android.os.Build; -import android.provider.MediaStore; import android.util.SparseArray; import android.view.View; import android.view.ViewOutlineProvider; @@ -271,7 +269,7 @@ public class UserHomeActivity extends AbsActivity { tagList.add(userInfo.getUserHomeTopInfo().getAge() + (WordUtil.isNewZh() ? "歲" : "years old")); } if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getHeight())) { - tagList.add(userInfo.getUserHomeTopInfo().getHeight()); + tagList.add(userInfo.getUserHomeTopInfo().getHeight() + "cm"); } if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) { tagList.add(userInfo.getUserHomeTopInfo().getCareer()); @@ -354,6 +352,9 @@ public class UserHomeActivity extends AbsActivity { public void onConfirmClick(Dialog dialog, String content) { bannerImgList.remove(position); 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) { + 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() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/settings.gradle b/settings.gradle index b391e1573..c0913d2fb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,4 +6,4 @@ include ':Share' include ':pluginsForAnchor' //include ':lib_huawei' include ':lib_google' -include ':IAP6Helper' +//include ':IAP6Helper'