Merge remote-tracking branch 'origin/master' into pdlive_samsung
# Conflicts: # config.gradle # main/src/main/java/com/yunbao/main/activity/GoogleFragment.java
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class CoolConfig extends BaseModel {
|
||||
private int rate=1;
|
||||
private String ticketCount="0" ;
|
||||
private int rate = 1;
|
||||
private String ticketCount = "0";
|
||||
private String yuanbao = "0";
|
||||
|
||||
public String getYuanbao() {
|
||||
return yuanbao;
|
||||
}
|
||||
|
||||
public CoolConfig setYuanbao(String yuanbao) {
|
||||
this.yuanbao = yuanbao;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTicketCount() {
|
||||
return ticketCount;
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CoolConfig;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class CinemaTicketPopupWindow extends CenterPopupView {
|
||||
private CoolConfig mCoolConfig;
|
||||
private TextView cinemaTicket, ticketsPlusMinus, quantityNeed;
|
||||
private TextView cinemaTicket, quantityNeed, quantityNeed2;
|
||||
private EditText ticketsPlusMinus;
|
||||
private int ticket = 1;
|
||||
private CinemaTicketPopupWindowCallBack mCinemaTicketPopupWindowCallBack;
|
||||
|
||||
@@ -41,9 +51,30 @@ public class CinemaTicketPopupWindow extends CenterPopupView {
|
||||
cinemaTicket = findViewById(R.id.cinema_ticket);
|
||||
ticketsPlusMinus = findViewById(R.id.tickets_plus_minus);
|
||||
quantityNeed = findViewById(R.id.quantity_need);
|
||||
cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString());
|
||||
quantityNeed2 = findViewById(R.id.quantity_need2);
|
||||
cinemaTicket.setText(mCoolConfig.getTicketCount());
|
||||
ticketsPlusMinus.setText(String.valueOf(ticket));
|
||||
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
|
||||
quantityNeed2.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).floatValue()+"");
|
||||
quantityNeed.setText(mCoolConfig.getYuanbao());
|
||||
ticketsPlusMinus.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (!TextUtils.isEmpty(charSequence.toString())) {
|
||||
ticket = new BigDecimal(charSequence.toString()).intValue();
|
||||
quantityNeed2.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).floatValue()+"");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@@ -56,9 +87,8 @@ public class CinemaTicketPopupWindow extends CenterPopupView {
|
||||
if (ticket > 1) {
|
||||
ticket = ticket - 1;
|
||||
|
||||
cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString());
|
||||
ticketsPlusMinus.setText(String.valueOf(ticket));
|
||||
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
|
||||
quantityNeed2.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).floatValue()+"");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -66,33 +96,42 @@ public class CinemaTicketPopupWindow extends CenterPopupView {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ticket = ticket + 1;
|
||||
cinemaTicket.setText(new BigDecimal(ticket).add(new BigDecimal(mCoolConfig.getTicketCount())).toString());
|
||||
ticketsPlusMinus.setText(String.valueOf(ticket));
|
||||
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
|
||||
quantityNeed2.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).floatValue()+"");
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_exchange), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
LiveNetManager.get(getContext())
|
||||
.buyTicket(String.valueOf(ticket), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (ticket>=1&&ticket<=9999){
|
||||
LiveNetManager.get(getContext())
|
||||
.buyTicket(String.valueOf(ticket), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
|
||||
|
||||
if (mCinemaTicketPopupWindowCallBack != null) {
|
||||
mCinemaTicketPopupWindowCallBack.onCallBack(data);
|
||||
if (mCinemaTicketPopupWindowCallBack != null) {
|
||||
mCinemaTicketPopupWindowCallBack.onCallBack(data);
|
||||
}
|
||||
dialog.dismiss();
|
||||
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "兌換數量區間為[1 - 9999]" : "The exchange quantity range is [1-9999]");
|
||||
}
|
||||
InputMethodManager inputMethodManager = (InputMethodManager)ticketsPlusMinus.getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(ticketsPlusMinus.getWindowToken(), 0);
|
||||
MobclickAgent.onEvent(getContext(), "dj_exchange", "兑换按钮点");
|
||||
}
|
||||
});
|
||||
InputMethodManager inputMethodManager = (InputMethodManager)ticketsPlusMinus.getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(ticketsPlusMinus.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
public interface CinemaTicketPopupWindowCallBack {
|
||||
|
||||
@@ -481,6 +481,7 @@ public class LiveNetManager {
|
||||
* @param liveUid
|
||||
*/
|
||||
public void leaveRoomNew(String stream, String liveUid, HttpCallback<String> callback) {
|
||||
Log.e("观看时长","leaveRoomNew-----------------------"+liveUid);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.leaveRoomNew("g" + liveUid, stream)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -183,6 +183,7 @@ public class OpenAdManager {
|
||||
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);
|
||||
showMap.remove(model.getId());
|
||||
}
|
||||
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
|
||||
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
|
||||
@@ -185,6 +185,19 @@ 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 void setFirebaseTokenListener(Activity activity, FirebaseTokenListener firebaseTokenListener) {
|
||||
Timer timer = new Timer();
|
||||
TimerTask task = new TimerTask() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yunbao.common.views;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
@@ -114,7 +115,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
|
||||
//华为
|
||||
//todo
|
||||
launchAppDetail(mContext, "com.pdlive.shayu", "com.pdlive.shayu");
|
||||
launchAppDetail(mContext, "com.pdlive.shayu", "com.huawei.appmarket");
|
||||
} else {
|
||||
versionImmediateUse.setVisibility(GONE);
|
||||
updateLine.setVisibility(VISIBLE);
|
||||
@@ -129,19 +130,31 @@ public class APKUpdateCustomPopup extends CenterPopupView {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isAppStoreExist(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
packageManager.getPackageInfo("com.huawei.appmarket", PackageManager.GET_ACTIVITIES);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void launchAppDetail(Context mContext, String appPkg, String marketPkg) {
|
||||
try {
|
||||
if (TextUtils.isEmpty(appPkg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = Uri.parse("market://details?id=" + appPkg);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
if (!TextUtils.isEmpty(marketPkg)) {
|
||||
intent.setPackage(marketPkg);
|
||||
if (isAppStoreExist(mContext)) {
|
||||
Uri uri = Uri.parse("appmarket://details?id=" + appPkg);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
if (!TextUtils.isEmpty(marketPkg)) {
|
||||
intent.setPackage(marketPkg);
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user