三星内购调用

This commit is contained in:
hch 2023-12-14 18:28:39 +08:00
commit c723e14182
23 changed files with 343 additions and 67 deletions

View File

@ -17,14 +17,17 @@ public class OpenAdModel extends BaseModel {
public static final int MODEL_SQUARE = 1;//正方形 public static final int MODEL_SQUARE = 1;//正方形
public static final int MODEL_RECTANGLE = 2;//长方形 public static final int MODEL_RECTANGLE = 2;//长方形
public static final int MODEL_BOTTOM = 3;//底部 public static final int MODEL_BOTTOM = 3;//底部
public static final int SHOW_DEF = 1;//1. 杀死程序后弹出
public static final int SHOW_DIY = 2;//2. 自定义时间自上次弹出弹窗后00:00小时范围00:01小时-48:00小时后再弹出到时间后也需满足触发条件再弹出
public static final int SHOW_ONE = 3;//3. 仅弹出一次
@SerializedName("id") @SerializedName("id")
private int id; private int id;
@SerializedName("popup_location") @SerializedName("popup_location")
private int type = TYPE_HOME; private int type = TYPE_HOME;
@SerializedName("activity_url") @SerializedName("activity_url")
private String url; private String url;//点击跳转url
@SerializedName("image_url") @SerializedName("image_url")
private String imageUrl; private String imageUrl;//图片url
@SerializedName("display_time") @SerializedName("display_time")
private int showTime; //持续展示时间 private int showTime; //持续展示时间
@SerializedName("delay_show_time") @SerializedName("delay_show_time")
@ -37,11 +40,48 @@ public class OpenAdModel extends BaseModel {
private String endTime;//活动结束时间 private String endTime;//活动结束时间
@SerializedName("popup_permission") @SerializedName("popup_permission")
private int permission; private int permission;
@SerializedName("popup_frequency")
private int showModel = SHOW_DEF;//显示模式1杀死程序后弹出 2指定时间内本机时间 31. 仅弹出一次
@SerializedName("popup_frequency_time")
private String section = "0";// SHOW_DEF = 2
public OpenAdModel() { public OpenAdModel() {
} }
public static OpenAdModel createTestData() {
OpenAdModel model = new OpenAdModel();
model.id=3;
model.type=1;
model.url = "/h5/GuildTournament/20230821/rank.html";
model.imageUrl = "https://ceshi.yaoulive.com/data/upload/20230913/1694589490.png";
model.showTime = 10;
model.delayShowTime = 0;
model.model = MODEL_SQUARE;
model.startTime = "2019-01-01 00:00:00";
model.endTime = "2029-01-01 00:00:00";
model.permission = 4;
model.showModel = SHOW_DIY;
model.section = "5";
return model;
}
public int getShowModel() {
return showModel;
}
public void setShowModel(int showModel) {
this.showModel = showModel;
}
public String getSection() {
return section;
}
public void setSection(String section) {
this.section = section;
}
public int getType() { public int getType() {
return type; return type;
} }

View File

@ -58,7 +58,7 @@ public class IMLoginManager extends BaseCacheManager {
} }
public boolean getRedPoint() { public boolean getRedPoint() {
return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1"); return !TextUtils.isEmpty(getString("RedPoint")) || !TextUtils.equals(getString("RedPoint"), "1");
} }
public void setQuickGiftIfFirst() { public void setQuickGiftIfFirst() {
put("quick_gift_if_first", "1"); put("quick_gift_if_first", "1");

View File

@ -11,6 +11,8 @@ import com.yunbao.common.dialog.OpenAdBottomDialogPopup;
import com.yunbao.common.dialog.OpenAdCenterDialogPopup; import com.yunbao.common.dialog.OpenAdCenterDialogPopup;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -93,6 +95,18 @@ public class OpenAdManager {
if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) { if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
continue; continue;
} }
if (model.getShowModel() == OpenAdModel.SHOW_ONE) {
if (SpUtil.getInstance().getBooleanValue("open_ad_popup_" + model.getId())) {
continue;
}
SpUtil.getInstance().setBooleanValue("open_ad_popup_" + model.getId(), true);
}
if (model.getShowModel() == OpenAdModel.SHOW_DIY) {
String value = SpUtil.getStringValue("open_ad_popup_time_" + model.getId());
if (!StringUtil.isEmpty(value) && System.currentTimeMillis() < Long.parseLong(value)) {
continue;
}
}
if (runnableMap.containsKey(model.getId())) { if (runnableMap.containsKey(model.getId())) {
AdRunnable runnable = runnableMap.get(model.getId()); AdRunnable runnable = runnableMap.get(model.getId());
if (runnable != null) { if (runnable != null) {
@ -166,6 +180,10 @@ public class OpenAdManager {
return; return;
} }
showMap.put(model.getId(), true); showMap.put(model.getId(), true);
if (model.getShowModel() == OpenAdModel.SHOW_DIY) {
String nextTime= String.valueOf(System.currentTimeMillis() + (Long.parseLong(model.getSection()) * 60 * 1000));
SpUtil.setStringValue("open_ad_popup_time_" + model.getId(), nextTime);
}
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) { if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> { new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
}).showDialog(); }).showDialog();

View File

@ -11,18 +11,72 @@ 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.ErrorVo;
import com.samsung.android.sdk.iap.lib.vo.OwnedProductVo; import com.samsung.android.sdk.iap.lib.vo.OwnedProductVo;
import com.samsung.android.sdk.iap.lib.vo.PurchaseVo; import com.samsung.android.sdk.iap.lib.vo.PurchaseVo;
import com.yunbao.common.utils.L;
import java.util.ArrayList; import java.util.ArrayList;
public class SamsungUtil { public class SamsungUtil {
public void init(Context context) { private Context mContext;
//初始化
IapHelper iapHelper = IapHelper.getInstance(context);
//设置支付模式 OPERATION_MODE_TEST 测试模式 IapHelper iapHelper;
private static SamsungUtil samsungUtil;
public static SamsungUtil newInstance(Context context) {
if (samsungUtil == null) {
samsungUtil = new SamsungUtil(context);
}
return samsungUtil;
}
public SamsungUtil(Context mContext) {
this.mContext = mContext;
}
/**
* 初始化
*/
public void init() {
iapHelper = IapHelper.getInstance(mContext);
//设置支付模式 OPERATION_MODE_PRODUCTION 正式模式 OPERATION_MODE_TEST 测试模式
iapHelper.setOperationMode(HelperDefine.OperationMode.OPERATION_MODE_TEST); iapHelper.setOperationMode(HelperDefine.OperationMode.OPERATION_MODE_TEST);
}
/**
* 购买
*
* @param skuId
*/
public void buy(String skuId) {
//购买
iapHelper.startPayment(skuId, "", new OnPaymentListener() {
@Override
public void onPayment(ErrorVo _errorVO, PurchaseVo _purchaseVO) {
L.e(_errorVO.getErrorString());
}
});
}
/**
* 消耗指定商品
*
* @param skuId
*/
public void consume(String skuId) {
//消耗
iapHelper.consumePurchasedItems(skuId, new OnConsumePurchasedItemsListener() {
@Override
public void onConsumePurchasedItems(ErrorVo _errorVO, ArrayList<ConsumeVo> _consumeList) {
}
});
}
/**
* 消耗所有未消耗的消耗品
*/
public void query() {
//查询商品 PRODUCT_TYPE_ITEM 消耗品&非消耗品 //查询商品 PRODUCT_TYPE_ITEM 消耗品&非消耗品
iapHelper.getOwnedList(HelperDefine.PRODUCT_TYPE_ITEM, new OnGetOwnedListListener() { iapHelper.getOwnedList(HelperDefine.PRODUCT_TYPE_ITEM, new OnGetOwnedListListener() {
@Override @Override
@ -33,6 +87,7 @@ public class SamsungUtil {
for (OwnedProductVo item : _ownedList) { for (OwnedProductVo item : _ownedList) {
if (item.getIsConsumable()) { if (item.getIsConsumable()) {
// TODO: 消耗尚未消耗的消耗品 // TODO: 消耗尚未消耗的消耗品
consume(item.getPurchaseId());
} }
} }
} }
@ -42,21 +97,5 @@ public class SamsungUtil {
} }
} }
}); });
//购买
iapHelper.startPayment("zs640", "", new OnPaymentListener() {
@Override
public void onPayment(ErrorVo _errorVO, PurchaseVo _purchaseVO) {
}
});
//消耗
iapHelper.consumePurchasedItems("zs640", new OnConsumePurchasedItemsListener() {
@Override
public void onConsumePurchasedItems(ErrorVo _errorVO, ArrayList<ConsumeVo> _consumeList) {
}
});
} }
} }

View File

@ -34,7 +34,6 @@ public class GoogleUtils {
this.mContext = mContext; this.mContext = mContext;
} }
public static GoogleUtils newInstance(Context mContext) { public static GoogleUtils newInstance(Context mContext) {
if (googleUtils == null) { if (googleUtils == null) {
googleUtils = new GoogleUtils(mContext); googleUtils = new GoogleUtils(mContext);
@ -43,6 +42,18 @@ public class GoogleUtils {
} }
public boolean getGoogleService() {
boolean flag;
try {
Class<?> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
flag = (boolean) googlePay.getClass().getMethod("getGoogleService").invoke(googlePay);
} catch (Exception e) {
throw new RuntimeException(e);
}
return flag;
}
public static GoogleUtils newInstance(Activity mContext) { public static GoogleUtils newInstance(Activity mContext) {
if (googleUtils == null) { if (googleUtils == null) {
googleUtils = new GoogleUtils(mContext); googleUtils = new GoogleUtils(mContext);

View File

@ -34,7 +34,7 @@ public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
funGameName.setText(model.getTitle()); funGameName.setText(model.getTitle());
if (!TextUtils.isEmpty(model.getSudGameIsNew())||TextUtils.equals(model.getSudGameIsNew(),"1")){ if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")){
itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE);
}else { }else {
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);

View File

@ -1390,8 +1390,8 @@ Limited ride And limited avatar frame</string>
<string name="conversion_quantity">Exchange quantity:</string> <string name="conversion_quantity">Exchange quantity:</string>
<string name="conversion_quantity_need">Need %s</string> <string name="conversion_quantity_need">Need %s</string>
<string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string> <string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string>
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string> <string name="conversion_quantity_need_of_use1">1.One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string> <string name="conversion_quantity_need_of_use2">2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string> <string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
</resources> </resources>

View File

@ -1387,7 +1387,7 @@
<string name="conversion_quantity">兌換數量:</string> <string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string> <string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string> <string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string> <string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string> <string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string> <string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
</resources> </resources>

View File

@ -1386,7 +1386,7 @@
<string name="conversion_quantity">兌換數量:</string> <string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string> <string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string> <string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string> <string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string> <string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string> <string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
</resources> </resources>

View File

@ -1386,8 +1386,8 @@
<string name="conversion_quantity">兌換數量:</string> <string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string> <string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string> <string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string> <string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string> <string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string> <string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
</resources> </resources>

View File

@ -1393,7 +1393,7 @@ Limited ride And limited avatar frame</string>
<string name="conversion_quantity">Exchange quantity:</string> <string name="conversion_quantity">Exchange quantity:</string>
<string name="conversion_quantity_need">Need %s</string> <string name="conversion_quantity_need">Need %s</string>
<string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string> <string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string>
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string> <string name="conversion_quantity_need_of_use1">1.One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string> <string name="conversion_quantity_need_of_use2">2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string> <string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
</resources> </resources>

View File

@ -19,11 +19,11 @@ ext {
baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB", baiduAppKey : "zgCgFhUKEOV7I3ZXDFpTfnRB",
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false 0 1 2 // true表示谷歌支付 false 0 1 2 3
isGooglePlay : 1, isGooglePlay : 3,
// //
isUploadLog : true, isUploadLog : true,
// //
isPluginModel : true, isPluginModel : false,
] ]
} }

View File

@ -20,6 +20,7 @@ import com.android.billingclient.api.SkuDetails;
import com.android.billingclient.api.SkuDetailsParams; import com.android.billingclient.api.SkuDetailsParams;
import com.android.billingclient.api.SkuDetailsResponseListener; import com.android.billingclient.api.SkuDetailsResponseListener;
import com.google.android.gms.ads.identifier.AdvertisingIdClient; import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.common.GooglePlayServicesRepairableException;
@ -119,6 +120,11 @@ public class GoogleBillingManage implements PurchasesUpdatedListener {
} }
} }
public boolean getGoogleService() {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mContext);
return code == 0;
}
int querySize = -1; int querySize = -1;
JSONArray tokenList = new JSONArray(); JSONArray tokenList = new JSONArray();
JSONArray orderList = new JSONArray(); JSONArray orderList = new JSONArray();

View File

@ -1874,6 +1874,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPointPrivilege == null) { if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPointPrivilege == null) {
return; return;
} }
manager.mLiveAudienceViewHolder.setShowCrownRed(isShow);
if (isShow) { if (isShow) {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
} else { } else {

View File

@ -364,7 +364,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} }
mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1; mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1;
quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity)); quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity));
MobclickAgent.onEvent(mContext, "small_pd_gifts", "连点"+quickGiftingIndex); MobclickAgent.onEvent(mContext, "small_pd_gifts", "连点" + quickGiftingIndex);
} }
} }
}); });
@ -401,7 +401,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
if (!(quickGiftContDown > 0 && quickGiftContDown < 120)) { if (!(quickGiftContDown > 0 && quickGiftContDown < 120)) {
quickGiftHandler.postDelayed(quickGiftRunnable, 1000); quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
} }
}else { } else {
circleProgress.setCurrent(2); circleProgress.setCurrent(2);
time_text.setVisibility(View.GONE); time_text.setVisibility(View.GONE);
} }
@ -720,6 +720,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
} }
private boolean mIsShow;
public void setShowCrownRed(boolean isShow) {
mIsShow = isShow;
}
/** /**
* 身份特权 * 身份特权
*/ */
@ -732,7 +738,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
// fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment"); // fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment");
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.enableDrag(false) .enableDrag(false)
.asCustom(new LiveNewRolePopup(mContext, mRedPointPrivilege.getVisibility() == View.VISIBLE)) .asCustom(new LiveNewRolePopup(mContext, mIsShow))
.show(); .show();
mRedPointPrivilege.setVisibility(View.GONE); mRedPointPrivilege.setVisibility(View.GONE);
} }

View File

@ -714,6 +714,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
combo_layout.setVisibility(View.GONE); combo_layout.setVisibility(View.GONE);
if (IMLoginManager.get(mContext).getQuickGiftIfFirst()) { if (IMLoginManager.get(mContext).getQuickGiftIfFirst()) {
quick_gift_reminder.setVisibility(View.VISIBLE); quick_gift_reminder.setVisibility(View.VISIBLE);
IMLoginManager.get(mContext).setQuickGiftIfFirst();
} else { } else {
quick_gift_reminder.setVisibility(View.GONE); quick_gift_reminder.setVisibility(View.GONE);
} }

View File

@ -454,8 +454,8 @@
<View <View
android:id="@+id/privilege_red_point" android:id="@+id/privilege_red_point"
android:layout_width="10dp" android:layout_width="6dp"
android:layout_height="10dp" android:layout_height="6dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:background="@drawable/bg_red_point" android:background="@drawable/bg_red_point"

View File

@ -17,8 +17,6 @@ import android.webkit.WebView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.facebook.appevents.AppEventsConstants; import com.facebook.appevents.AppEventsConstants;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
@ -42,8 +40,6 @@ public class GoogleFragment extends Fragment {
GoogleUtils googleUtils; GoogleUtils googleUtils;
boolean isGoogleService = true;
public GoogleFragment() { public GoogleFragment() {
} }
@ -63,13 +59,8 @@ public class GoogleFragment extends Fragment {
rlWebview = (WebView) view.findViewById(R.id.rlWebview); rlWebview = (WebView) view.findViewById(R.id.rlWebview);
Log.e("ttt", url); Log.e("ttt", url);
rlWebview.loadUrl(url); rlWebview.loadUrl(url);
initGooglePay();
// 验证是否已在此设备上安装并启用Google Play服务以及此设备上安装的旧版本是否为此客户端所需的版本 if (googleUtils.getGoogleService()) {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getActivity());
if (code == ConnectionResult.SUCCESS) {
isGoogleService = true;
// 支持Google服务
initGooglePay();
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {

View File

@ -26,6 +26,7 @@ import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.pay.hw.HwBuilder; import com.yunbao.common.pay.hw.HwBuilder;
import com.yunbao.common.pay.samsung.SamsungUtil;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
@ -64,13 +65,13 @@ public class MyWalletActivity extends AbsActivity {
GoogleUtils googleUtils; GoogleUtils googleUtils;
LoadingDialog loadingDialog; LoadingDialog loadingDialog;
SamsungUtil samsungUtil;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_my_wallet; return R.layout.activity_my_wallet;
} }
@Override
protected void main() { protected void main() {
super.main(); super.main();
@ -80,9 +81,13 @@ public class MyWalletActivity extends AbsActivity {
if (CommonAppConfig.IS_GOOGLE_PLAY == 1) { if (CommonAppConfig.IS_GOOGLE_PLAY == 1) {
googleUtils = new GoogleUtils(mContext); googleUtils = new GoogleUtils(mContext);
googleUtils.initGooglePay(); googleUtils.initGooglePay();
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
hwBuilder = new HwBuilder(MyWalletActivity.this);
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 3) {
samsungUtil = SamsungUtil.newInstance(mContext);
samsungUtil.init();
} }
hwBuilder = new HwBuilder(MyWalletActivity.this);
vp_content = (ViewPager) findViewById(R.id.vp_content); vp_content = (ViewPager) findViewById(R.id.vp_content);
TextView rView = (TextView) findViewById(R.id.rView); TextView rView = (TextView) findViewById(R.id.rView);
@ -158,6 +163,9 @@ public class MyWalletActivity extends AbsActivity {
HuaWeiFragment huaWeiFragment1 = null; HuaWeiFragment huaWeiFragment1 = null;
HuaWeiFragment huaWeiFragment2 = null; HuaWeiFragment huaWeiFragment2 = null;
SamsungFragment samsungFragment1 = null;
SamsungFragment samsungFragment2 = null;
final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)}; final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)};
if (getIntent().getStringExtra("tag") != null) { if (getIntent().getStringExtra("tag") != null) {
Log.i("tss", "首充"); Log.i("tss", "首充");
@ -195,6 +203,23 @@ public class MyWalletActivity extends AbsActivity {
Bundle bundle2 = new Bundle(); Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"); bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment2.setArguments(bundle2); huaWeiFragment2.setArguments(bundle2);
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 3) {
rView.setVisibility(View.VISIBLE);
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
samsungFragment1 = new SamsungFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
samsungFragment1.setArguments(bundle1);
samsungFragment2 = new SamsungFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
samsungFragment2.setArguments(bundle2);
} else { } else {
walletFragment = new WalletFragment(); walletFragment = new WalletFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -246,6 +271,21 @@ public class MyWalletActivity extends AbsActivity {
Bundle bundle2 = new Bundle(); Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"); bundle2.putString("url", CommonAppConfig.HOST + "/themes/simplebootx/appapi/mall/huaweipaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd");
huaWeiFragment2.setArguments(bundle2); huaWeiFragment2.setArguments(bundle2);
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 3) {
walletFragment = new WalletFragment();
Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
walletFragment.setArguments(bundle);
samsungFragment1 = new SamsungFragment();
Bundle bundle1 = new Bundle();
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
samsungFragment1.setArguments(bundle1);
samsungFragment2 = new SamsungFragment();
Bundle bundle2 = new Bundle();
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
samsungFragment2.setArguments(bundle2);
} else { } else {
Log.i("tss", "不是首充"); Log.i("tss", "不是首充");
//链接版本 //链接版本
@ -271,10 +311,11 @@ public class MyWalletActivity extends AbsActivity {
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment}; fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) { } else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
fragments = new Fragment[]{huaWeiFragment1, huaWeiFragment2, walletFragment}; fragments = new Fragment[]{huaWeiFragment1, huaWeiFragment2, walletFragment};
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 3) {
fragments = new Fragment[]{samsungFragment1, samsungFragment2, walletFragment};
} else { } else {
fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment}; fragments = new Fragment[]{googleFragment1, googleFragment2, walletFragment};
} }
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator); MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
CommonNavigator commonNavigator = new CommonNavigator(this); CommonNavigator commonNavigator = new CommonNavigator(this);
commonNavigator.setAdjustMode(true); commonNavigator.setAdjustMode(true);

View File

@ -0,0 +1,121 @@
package com.yunbao.main.activity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.fragment.app.Fragment;
import com.yunbao.common.pay.samsung.SamsungUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.main.R;
import com.yunbao.main.views.TestWebViewClient;
@SuppressLint("ValidFragment")
public class SamsungFragment extends Fragment {
private long lastClickTime = 0;
private static final long INTERVAL_TIME = 1500;
private View view;
public static String mOrderid, mProductId, MoneyUsds;
private WebView rlWebview;
private String url;
SamsungUtil samsungUtil;
public SamsungFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//通过参数中的布局填充获取对应布局
view = inflater.inflate(R.layout.activity_recharge, container, false);
assert getArguments() != null;
url = getArguments().getString("url");
if (StringUtil.isEmpty(url)) {
Log.e(TAG, "URL为空");
return view;
}
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
Log.e("ttt", url);
rlWebview.loadUrl(url);
initSamsung();
WebSettings webSettings = rlWebview.getSettings();
webSettings.setDomStorageEnabled(true);
webSettings.setTextZoom(100);
webSettings.setUseWideViewPort(true);
webSettings.setJavaScriptEnabled(true); // 是否开启JS支持
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕大小
webSettings.setSupportZoom(true); // 是否支持缩放
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放
rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
rlWebview.setWebViewClient(testWebViewClient);
return view;
}
String TAG = "SamsungPay";
private void initSamsung() {
samsungUtil = new SamsungUtil(getActivity());
samsungUtil.init();
}
private Handler payHandler = new Handler();
//js调用原生
public class JsInteration {
@JavascriptInterface
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
long currentTime = System.currentTimeMillis();
if (currentTime - lastClickTime > INTERVAL_TIME) {
mProductId = ProductId;
mOrderid = OrderNumber;
MoneyUsds = MoneyUsd;
SamsungUtil.newInstance(getActivity()).buy(mProductId);
}
lastClickTime = currentTime;
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
}
@JavascriptInterface
public void androidMethodBack() {
getActivity().onBackPressed();
}
@JavascriptInterface
public void androidGoBack() {
getActivity().onBackPressed();
}
}
public void release() {
}
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@ -9,14 +8,15 @@
android:id="@+id/classRecyclerView_top" android:id="@+id/classRecyclerView_top"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:overScrollMode="never"/> android:overScrollMode="never" />
<com.yunbao.common.custom.CommonRefreshView <com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView" android:id="@+id/refreshView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:layout_marginRight="10dp" /> android:layout_marginRight="10dp"
android:layout_marginBottom="55dp" />
<FrameLayout <FrameLayout
android:id="@+id/btn_dismiss" android:id="@+id/btn_dismiss"

View File

@ -11,6 +11,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:layout_marginBottom="55dp"
android:layout_marginRight="10dp"/> android:layout_marginRight="10dp"/>
</LinearLayout> </LinearLayout>

View File

@ -76,9 +76,9 @@
<ImageButton <ImageButton
android:id="@+id/change_batch" android:id="@+id/change_batch"
android:layout_width="wrap_content" android:layout_width="80dp"
android:clickable="true" android:clickable="true"
android:layout_height="wrap_content" android:layout_height="30dp"
android:layout_gravity="center_vertical|right" android:layout_gravity="center_vertical|right"
android:background="@mipmap/icon_cange" android:background="@mipmap/icon_cange"
android:focusable="true" /> android:focusable="true" />