三星内购调用
This commit is contained in:
@@ -17,14 +17,17 @@ public class OpenAdModel extends BaseModel {
|
||||
public static final int MODEL_SQUARE = 1;//正方形
|
||||
public static final int MODEL_RECTANGLE = 2;//长方形
|
||||
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")
|
||||
private int id;
|
||||
@SerializedName("popup_location")
|
||||
private int type = TYPE_HOME;
|
||||
@SerializedName("activity_url")
|
||||
private String url;
|
||||
private String url;//点击跳转url
|
||||
@SerializedName("image_url")
|
||||
private String imageUrl;
|
||||
private String imageUrl;//图片url
|
||||
@SerializedName("display_time")
|
||||
private int showTime; //持续展示时间
|
||||
@SerializedName("delay_show_time")
|
||||
@@ -37,11 +40,48 @@ public class OpenAdModel extends BaseModel {
|
||||
private String endTime;//活动结束时间
|
||||
@SerializedName("popup_permission")
|
||||
private int permission;
|
||||
@SerializedName("popup_frequency")
|
||||
private int showModel = SHOW_DEF;//显示模式,1:杀死程序后弹出 2:指定时间内(本机时间) 3:1. 仅弹出一次
|
||||
@SerializedName("popup_frequency_time")
|
||||
private String section = "0";// SHOW_DEF = 2
|
||||
|
||||
|
||||
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() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
}
|
||||
|
||||
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() {
|
||||
put("quick_gift_if_first", "1");
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.yunbao.common.dialog.OpenAdBottomDialogPopup;
|
||||
import com.yunbao.common.dialog.OpenAdCenterDialogPopup;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
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 java.util.ArrayList;
|
||||
@@ -93,6 +95,18 @@ public class OpenAdManager {
|
||||
if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
|
||||
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())) {
|
||||
AdRunnable runnable = runnableMap.get(model.getId());
|
||||
if (runnable != null) {
|
||||
@@ -166,6 +180,10 @@ public class OpenAdManager {
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
}).showDialog();
|
||||
|
||||
@@ -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.OwnedProductVo;
|
||||
import com.samsung.android.sdk.iap.lib.vo.PurchaseVo;
|
||||
import com.yunbao.common.utils.L;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SamsungUtil {
|
||||
|
||||
public void init(Context context) {
|
||||
//初始化
|
||||
IapHelper iapHelper = IapHelper.getInstance(context);
|
||||
private Context mContext;
|
||||
|
||||
//设置支付模式 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买
|
||||
*
|
||||
* @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 消耗品&非消耗品
|
||||
iapHelper.getOwnedList(HelperDefine.PRODUCT_TYPE_ITEM, new OnGetOwnedListListener() {
|
||||
@Override
|
||||
@@ -33,6 +87,7 @@ public class SamsungUtil {
|
||||
for (OwnedProductVo item : _ownedList) {
|
||||
if (item.getIsConsumable()) {
|
||||
// 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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class GoogleUtils {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
|
||||
public static GoogleUtils newInstance(Context mContext) {
|
||||
if (googleUtils == null) {
|
||||
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) {
|
||||
if (googleUtils == null) {
|
||||
googleUtils = new GoogleUtils(mContext);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
|
||||
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);
|
||||
}else {
|
||||
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);
|
||||
|
||||
@@ -1390,8 +1390,8 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="conversion_quantity">Exchange quantity:</string>
|
||||
<string name="conversion_quantity_need">Need %s</string>
|
||||
<string name="conversion_quantity_need_of_use">Exchange&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_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_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_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">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">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>
|
||||
|
||||
@@ -1387,7 +1387,7 @@
|
||||
<string name="conversion_quantity">兌換數量:</string>
|
||||
<string name="conversion_quantity_need">需要 %s</string>
|
||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string>
|
||||
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||
</resources>
|
||||
|
||||
@@ -1386,7 +1386,7 @@
|
||||
<string name="conversion_quantity">兌換數量:</string>
|
||||
<string name="conversion_quantity_need">需要 %s</string>
|
||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊。</string>
|
||||
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||
</resources>
|
||||
|
||||
@@ -1386,8 +1386,8 @@
|
||||
<string name="conversion_quantity">兌換數量:</string>
|
||||
<string name="conversion_quantity_need">需要 %s</string>
|
||||
<string name="conversion_quantity_need_of_use">兌換&使用規則:</string>
|
||||
<string name="conversion_quantity_need_of_use1">·1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">·1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||
<string name="conversion_quantity_need_of_use1">1.1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;</string>
|
||||
<string name="conversion_quantity_need_of_use2">2.1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
|
||||
<string name="conversion_quantity_need_of_use3">3.觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1393,7 +1393,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="conversion_quantity">Exchange quantity:</string>
|
||||
<string name="conversion_quantity_need">Need %s</string>
|
||||
<string name="conversion_quantity_need_of_use">Exchange&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_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_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_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">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">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>
|
||||
|
||||
Reference in New Issue
Block a user