Merge branch 'master' into 声网升级
# Conflicts: # common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java # common/src/main/java/com/yunbao/common/http/PDLiveApi.java # common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java # common/src/main/java/com/yunbao/common/utils/DialogUitl.java # common/src/main/java/com/yunbao/common/utils/RouteUtil.java # live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java # live/src/main/java/com/yunbao/live/socket/SocketRyLinkMicPkUtil.java # main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java
This commit is contained in:
@@ -201,9 +201,7 @@ dependencies {
|
||||
//自定义圆角图片
|
||||
api 'com.makeramen:roundedimageview:2.3.0'
|
||||
// 友盟统计SDK
|
||||
api 'com.umeng.umsdk:common:9.6.3'// 必选
|
||||
api 'com.umeng.umsdk:asms:1.8.0'// 必选
|
||||
api 'com.umeng.umsdk:uyumao:1.1.2'
|
||||
// api(name: 'umeng-common-9.6.8+000', ext: 'aar')
|
||||
//高级运营分析功能依赖库,使用卸载分析、开启反作弊能力请务必集成,以免影响高级功能使用。common需搭配v9.6.3及以上版本,asms需搭配v1.7.0及以上版本。需更新隐私声明。
|
||||
// 标准版本SudMGP SDK
|
||||
api 'tech.sud.mgp:SudMGP:1.3.3.1158'
|
||||
@@ -214,7 +212,7 @@ dependencies {
|
||||
api 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
|
||||
//华为支付插件包
|
||||
//api project(':lib_huawei')
|
||||
// api project(':lib_huawei')
|
||||
|
||||
//google插件包
|
||||
api project(':lib_google')
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HtmlConfig {
|
||||
public static final String TURNTABLE_URL = CommonAppConfig.HOST + "/Appapi/Turntable/index";
|
||||
|
||||
//在线商城
|
||||
public static final String SHOP = CommonAppConfig.HOST + "/h5/shoppingMall.html";
|
||||
public static final String SHOP = CommonAppConfig.HOST + "/h5/shop/index.html";
|
||||
|
||||
//社区
|
||||
public static final String ENCOURAGE = CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ";
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
@@ -24,13 +25,12 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.LifeCycleListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ClickUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -92,7 +92,8 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
protected void main() {
|
||||
|
||||
}
|
||||
protected void create(){
|
||||
|
||||
protected void create() {
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +108,17 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTitleBold(boolean bold) {
|
||||
TextView titleView = (TextView) findViewById(R.id.titleView);
|
||||
if (titleView != null) {
|
||||
if (bold) {
|
||||
titleView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
titleView.setTypeface(Typeface.DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void backClick(View v) {
|
||||
if (v.getId() == R.id.btn_back) {
|
||||
onBackPressed();
|
||||
@@ -181,14 +193,14 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
//友盟统计
|
||||
// MobclickAgent.onResume(this);
|
||||
MobclickAgent.onPageStart(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onResume_"+this.mTag);
|
||||
Log.e("MobclickAgent", "MobclickAgent:_onResume_" + this.mTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
MobclickAgent.onPageEnd(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onPause_"+this.mTag);
|
||||
Log.e("MobclickAgent", "MobclickAgent:_onPause_" + this.mTag);
|
||||
if (mLifeCycleListeners != null) {
|
||||
for (LifeCycleListener listener : mLifeCycleListeners) {
|
||||
listener.onPause();
|
||||
@@ -382,11 +394,12 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
public boolean isKefu(String url){
|
||||
if(url.contains("kefu")){
|
||||
|
||||
public boolean isKefu(String url) {
|
||||
if (url.contains("kefu")) {
|
||||
return true;
|
||||
}
|
||||
if(url.contains("https://newkf.yaoulive.com/")){
|
||||
if (url.contains("https://newkf.yaoulive.com/")) {
|
||||
return true;
|
||||
}
|
||||
return url.startsWith("https://kefu.yaoulive.com");
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
@@ -100,7 +101,6 @@ public class WebViewActivity extends AbsActivity {
|
||||
ft_title = (FrameLayout) findViewById(R.id.ft_title);
|
||||
v_spacing = (View) findViewById(R.id.v_spacing);
|
||||
mWebView = findViewById(R.id.webView);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
// mWebView.setLayoutParams(params);
|
||||
@@ -136,11 +136,17 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (url.contains("for")) {
|
||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||
}
|
||||
|
||||
|
||||
if(url.startsWith(HtmlConfig.SHOP)){
|
||||
//商店页不做动态变换
|
||||
return;
|
||||
}
|
||||
//真实屏幕高度-(ft_title的高度+导航栏高度)
|
||||
//屏蔽掉是因为在线客服页面 AndroidBug5497Workaround会失效
|
||||
int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext);
|
||||
if (!navigationGestureEnabled(mContext)) {
|
||||
view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||
// view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,6 +200,8 @@ public class WebViewActivity extends AbsActivity {
|
||||
mWebView.getSettings().setAllowFileAccess(true);
|
||||
mWebView.getSettings().setUseWideViewPort(true); // 关键点
|
||||
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
|
||||
mWebView.setHorizontalScrollBarEnabled(false);
|
||||
mWebView.setVerticalScrollBarEnabled(false);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
@@ -213,6 +221,9 @@ public class WebViewActivity extends AbsActivity {
|
||||
ft_title.setVisibility(View.VISIBLE);
|
||||
v_spacing.setVisibility(View.GONE);
|
||||
}
|
||||
if(!StringUtil.isEmpty(url)&&url.startsWith(HtmlConfig.SHOP)){
|
||||
ft_title.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class DebugDialogAdapter extends RecyclerView.Adapter<DebugDialogAdapter.DebugViewHolder> {
|
||||
HashMap<String, View> paramMap = new HashMap<>();
|
||||
private Context mContext;
|
||||
|
||||
public DebugDialogAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setParamMap(HashMap<String, View> paramMap) {
|
||||
Log.i("debug弹窗", "setParamMap: 添加值到view " + paramMap.size());
|
||||
this.paramMap = paramMap;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public DebugViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
Log.i("debug弹窗", "onCreateViewHolder: 创建适配器");
|
||||
return new DebugViewHolder(new LinearLayout(mContext));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DebugViewHolder holder, int position) {
|
||||
List<String> list = new ArrayList<>(paramMap.keySet());
|
||||
Log.i("debug弹窗", "onBindViewHolder: 添加值到view " + list.size() + "|" + paramMap.size());
|
||||
holder.setData(list.get(position), paramMap.get(list.get(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
Log.i("debug弹窗", "getItemCount: " + paramMap.size());
|
||||
return paramMap.size();
|
||||
}
|
||||
|
||||
public class DebugViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public DebugViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
public void setData(String msg, View view) {
|
||||
Log.i("debug弹窗", "setData: 添加值到view " + view + "|" + msg + "|" + ((LinearLayout) itemView).indexOfChild(view));
|
||||
if (view instanceof TextView && StringUtil.isEmpty(((TextView) view).getText().toString())) {
|
||||
((TextView) view).setText(msg);
|
||||
}
|
||||
int indexOfChild = ((LinearLayout) itemView).indexOfChild(view);
|
||||
if (indexOfChild != -1) {
|
||||
if (((LinearLayout) itemView).getChildAt(indexOfChild) instanceof TextView) {
|
||||
((TextView) ((LinearLayout) itemView).getChildAt(indexOfChild)).setText(msg);
|
||||
} else {
|
||||
((LinearLayout) itemView).removeViewAt(indexOfChild);
|
||||
}
|
||||
} else {
|
||||
if (view.getParent() != null) {
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
}
|
||||
((LinearLayout) itemView).addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/28.
|
||||
*/
|
||||
|
||||
public class ImagePreviewAdapter extends RecyclerView.Adapter<ImagePreviewAdapter.Vh> {
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
private ActionListener mActionListener;
|
||||
private int mPageCount;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private int mCurPosition;
|
||||
|
||||
public ImagePreviewAdapter(Context context, int pageCount) {
|
||||
mPageCount = pageCount;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_preview_img, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPageCount;
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mImg;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mImg = (ImageView) itemView;
|
||||
}
|
||||
|
||||
void setData(int position) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.loadImage(mImg, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
public void setCurPosition(int curPosition) {
|
||||
mCurPosition = curPosition;
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageChanged(curPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurPosition(){
|
||||
return mCurPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
|
||||
pagerSnapHelper.attachToRecyclerView(recyclerView);
|
||||
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
if (position >= 0 && mCurPosition != position) {
|
||||
mCurPosition = position;
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageChanged(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public interface ActionListener {
|
||||
void onPageChanged(int position);
|
||||
|
||||
void loadImage(ImageView imageView, int position);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,14 @@ import com.yunbao.common.views.InteractionGamesChildViewHolder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 侧边栏游戏列表适配器,改游戏列表数量在这里改
|
||||
*/
|
||||
public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
private List<CustomSidebarChildModel> srcChild = new ArrayList<>();
|
||||
|
||||
public InteractionGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
@@ -46,7 +50,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
long activityID = TextUtils.isEmpty(model.getSrc()) ? 0 : Long.parseLong(model.getSrc());
|
||||
if (activityID != 0) {
|
||||
Bus.get().post(new CustomDrawerPopupEvent()
|
||||
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(child));
|
||||
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(srcChild));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +65,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
srcChild.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
@@ -68,6 +73,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
srcChild.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,14 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
/* if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
}*/
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
/**
|
||||
* 机器人助手IM消息
|
||||
@@ -22,6 +24,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
//标签图片
|
||||
@SerializedName("icon")
|
||||
private String icon;
|
||||
@SerializedName("icon_en")
|
||||
@JSONField(name = "icon_en")
|
||||
private String iconEn;
|
||||
//气泡背景
|
||||
@SerializedName("system_bubble")
|
||||
private String systemBubble;
|
||||
@@ -39,7 +44,7 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getAiName() {
|
||||
return aiName+":";
|
||||
return aiName + ":";
|
||||
}
|
||||
|
||||
public AiAutomaticSpeechModel setAiName(String aiName) {
|
||||
@@ -47,6 +52,15 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIconEn() {
|
||||
return iconEn;
|
||||
}
|
||||
|
||||
public AiAutomaticSpeechModel setIconEn(String iconEn) {
|
||||
this.iconEn = iconEn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
@@ -76,6 +90,9 @@ public class AiAutomaticSpeechModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
if (!WordUtil.isNewZh() && !StringUtil.isEmpty(iconEn)) {
|
||||
return iconEn;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
25
common/src/main/java/com/yunbao/common/bean/AvatarBean.java
Normal file
25
common/src/main/java/com/yunbao/common/bean/AvatarBean.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class AvatarBean extends BaseModel {
|
||||
private String avatar;
|
||||
private String avatarThumb;
|
||||
|
||||
public AvatarBean() {
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public void setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,21 @@ import java.util.Map;
|
||||
|
||||
public class LiveBattlePassRewardsBean extends BaseModel{
|
||||
private int level;
|
||||
private int is_received;
|
||||
private List<BattlePassType> live_battle_pass_type;
|
||||
private Map<Integer,Map<Integer,LiveBattlePassReward>> live_battle_pass_rewards;
|
||||
|
||||
public LiveBattlePassRewardsBean() {
|
||||
}
|
||||
|
||||
public int getIs_received() {
|
||||
return is_received;
|
||||
}
|
||||
|
||||
public void setIs_received(int is_received) {
|
||||
this.is_received = is_received;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,16 @@ public class RedPacketInfoModel extends BaseModel {
|
||||
//超级红包ID
|
||||
@SerializedName("super_jackpot_id")
|
||||
private String superJackpotId;
|
||||
@SerializedName("red_packet_type")
|
||||
private int redPacketType;// 1.普通红包 2.特殊红包
|
||||
|
||||
public int getRedPacketType() {
|
||||
return redPacketType;
|
||||
}
|
||||
|
||||
public void setRedPacketType(int redPacketType) {
|
||||
this.redPacketType = redPacketType;
|
||||
}
|
||||
|
||||
public String getSuperJackpotId() {
|
||||
return superJackpotId;
|
||||
|
||||
@@ -865,11 +865,20 @@ public class UserBean implements Parcelable {
|
||||
private String medal;
|
||||
private String bubble;
|
||||
private String medal_new;
|
||||
private String medal_new_en;
|
||||
|
||||
public String getMedal_new() {
|
||||
return medal_new;
|
||||
}
|
||||
|
||||
public String getMedal_new_en() {
|
||||
return medal_new_en;
|
||||
}
|
||||
|
||||
public void setMedal_new_en(String medal_new_en) {
|
||||
this.medal_new_en = medal_new_en;
|
||||
}
|
||||
|
||||
public void setMedal_new(String medal_new) {
|
||||
this.medal_new = medal_new;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CoolConfig;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
@@ -46,6 +46,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 半屏创建游戏房间
|
||||
*/
|
||||
public class CreateSudGamePopup extends BottomPopupView {
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private TextView createGameType, selectCurrencyType;
|
||||
@@ -315,20 +318,50 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
if (hasMoveUp) {
|
||||
InputMethodManager imm = getSystemService(getContext(), InputMethodManager.class);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(roomName.getWindowToken(), 0);
|
||||
imm.hideSoftInputFromWindow(gameSill.getWindowToken(), 0);
|
||||
}
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
}
|
||||
}, 500);
|
||||
}else {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
169
common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
Normal file
169
common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.interfaces.OnPermissionResult;
|
||||
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||
import com.yunbao.common.adapter.DebugDialogAdapter;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public class DebugDialog {
|
||||
RecyclerView recyclerView;
|
||||
HashMap<String, View> params;
|
||||
DebugDialogAdapter adapter;
|
||||
private static DebugDialog debugDialog;
|
||||
Context mContext;
|
||||
private ShowPattern showPattern = ShowPattern.CURRENT_ACTIVITY;
|
||||
|
||||
private DebugDialogRunnable runnable;
|
||||
|
||||
public static void getInstance(DebugDialogRunnable runnable) {
|
||||
if (debugDialog == null) {
|
||||
debugDialog = new DebugDialog(runnable);
|
||||
} else {
|
||||
runnable.run(debugDialog);
|
||||
}
|
||||
debugDialog.showPattern = ShowPattern.CURRENT_ACTIVITY;
|
||||
}
|
||||
|
||||
public static boolean checkShow() {
|
||||
return EasyFloat.isShow("debug");
|
||||
}
|
||||
|
||||
public DebugDialog clear() {
|
||||
params.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setParams(String tag, String msg) {
|
||||
Log.i("debug弹窗", "setParams: " + tag + "|" + msg);
|
||||
if (params.containsKey(tag)) {
|
||||
((TextView) params.get(tag)).setText(tag + ":" + msg);
|
||||
} else {
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setText(tag + ":" + msg);
|
||||
params.put(tag, textView);
|
||||
adapter.setParamMap(params);
|
||||
}
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
|
||||
private DebugDialog(DebugDialogRunnable runnable) {
|
||||
this.runnable = runnable;
|
||||
if (params == null) {
|
||||
Log.i("debug弹窗", "DebugDialog: 初始化参数");
|
||||
params = new HashMap<>();
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.mContext = AppManager.getInstance().getMainActivity();
|
||||
if (mContext == null) {
|
||||
startWaitMainActivity();
|
||||
return;
|
||||
}
|
||||
runnable.run(this);
|
||||
// createView();
|
||||
}
|
||||
|
||||
private void startWaitMainActivity() {
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i("debug弹窗", "run: " + AppManager.getInstance().getMainActivity());
|
||||
if (AppManager.getInstance().getMainActivity() != null) {
|
||||
init();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 0, 1000);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
EasyFloat.dismiss("debug");
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (showPattern == ShowPattern.CURRENT_ACTIVITY) {
|
||||
createView();
|
||||
return;
|
||||
}
|
||||
if (PermissionUtils.checkPermission(mContext)) {
|
||||
createView();
|
||||
} else {
|
||||
PermissionUtils.requestPermission((Activity) mContext, new OnPermissionResult() {
|
||||
@Override
|
||||
public void permissionResult(boolean b) {
|
||||
ToastUtil.show("悬浮权限" + b);
|
||||
if (b) {
|
||||
createView();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void createView() {
|
||||
recyclerView = new RecyclerView(mContext);
|
||||
adapter = new DebugDialogAdapter(mContext);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.setBackgroundColor(Color.WHITE);
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ToastUtil.show("debug弹窗:" + params.size());
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
});
|
||||
params.put("debug弹窗", textView);
|
||||
adapter.setParamMap(params);
|
||||
|
||||
EasyFloat.with(mContext)
|
||||
.setTag("debug")
|
||||
.setShowPattern(this.showPattern)
|
||||
.setLayout(recyclerView)
|
||||
.show();
|
||||
runnable.run(this);
|
||||
Log.i("debug弹窗", "createView: 创建");
|
||||
}
|
||||
|
||||
public void setView(String value, View view, View.OnClickListener onClickListener) {
|
||||
if (params.containsKey(value)) {
|
||||
params.get(value).setOnClickListener(onClickListener);
|
||||
} else {
|
||||
view.setOnClickListener(onClickListener);
|
||||
params.put(value, view);
|
||||
}
|
||||
adapter.setParamMap(params);
|
||||
EasyFloat.updateFloat("debug");
|
||||
}
|
||||
|
||||
public void setShowPattern(ShowPattern showPattern) {
|
||||
this.showPattern = showPattern;
|
||||
}
|
||||
|
||||
public interface DebugDialogRunnable {
|
||||
void run(DebugDialog dialog);
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,10 @@ public class GuardBuyTipsDialog {
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.VISIBLE);
|
||||
|
||||
} else if (guardType == mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.GONE);
|
||||
} else {
|
||||
} else if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") && guardType > mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
content1.setVisibility(View.GONE);
|
||||
|
||||
@@ -149,11 +149,11 @@ public class GuardUpgradePopup extends CenterPopupView {
|
||||
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
|
||||
htmlUrl.append(CommonAppConfig.HOST)
|
||||
.append("/h5/Guard/level.html?")
|
||||
.append("&token=")
|
||||
.append("token=")
|
||||
.append(userInfo.getToken())
|
||||
.append("&uid=")
|
||||
.append(userInfo.getId())
|
||||
.append("&&anchorUid=")
|
||||
.append("&anchorUid=")
|
||||
.append(mLiveUid)
|
||||
.append("&isZh=")
|
||||
.append(((WordUtil.isNewZh()) ? "1" : "0"));
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.ImagePreviewAdapter;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* Created by Martin on 2024/3/15.
|
||||
* 图片预览弹窗
|
||||
*/
|
||||
|
||||
public class ImagePreviewDialog extends AbsDialogFragment implements View.OnClickListener {
|
||||
|
||||
private View mBg;
|
||||
private RecyclerView mRecyclerView;
|
||||
private ValueAnimator mAnimator;
|
||||
private int mPosition;
|
||||
private int mPageCount;
|
||||
private ActionListener mActionListener;
|
||||
private TextView mCount;
|
||||
private ImagePreviewAdapter mAdapter;
|
||||
private boolean mNeedDelete;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_preview_image;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mBg = mRootView.findViewById(R.id.bg);
|
||||
mCount = (TextView) findViewById(R.id.count);
|
||||
findViewById(R.id.btn_close).setOnClickListener(this);
|
||||
if (mNeedDelete) {
|
||||
View btnDelete = findViewById(R.id.btn_delete);
|
||||
btnDelete.setVisibility(View.VISIBLE);
|
||||
btnDelete.setOnClickListener(this);
|
||||
}
|
||||
mRecyclerView = mRootView.findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||
mAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
mAnimator.setDuration(150);
|
||||
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
float v = (float) animation.getAnimatedValue();
|
||||
mBg.setAlpha(v);
|
||||
}
|
||||
});
|
||||
mAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (mRecyclerView != null && mPageCount > 0) {
|
||||
ImagePreviewAdapter adapter = new ImagePreviewAdapter(mContext, mPageCount);
|
||||
mAdapter = adapter;
|
||||
adapter.setActionListener(new ImagePreviewAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onPageChanged(int position) {
|
||||
if (mCount != null) {
|
||||
mCount.setText(StringUtil.contact(String.valueOf(position + 1), "/", String.valueOf(mPageCount)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadImage(ImageView imageView, int position) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.loadImage(imageView, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
if (mPosition >= 0 && mPosition < mPageCount) {
|
||||
adapter.setCurPosition(mPosition);
|
||||
mRecyclerView.scrollToPosition(mPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimator.start();
|
||||
}
|
||||
|
||||
public void setImageInfo(int pageCount, int position, boolean needDelete, ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
mPageCount = pageCount;
|
||||
mPosition = position;
|
||||
mNeedDelete = needDelete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mAnimator != null) {
|
||||
mAnimator.cancel();
|
||||
}
|
||||
mContext = null;
|
||||
mActionListener = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_close) {
|
||||
dismiss();
|
||||
} else if (i == R.id.btn_delete) {
|
||||
delete();
|
||||
}
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
if (mAdapter != null && mActionListener != null) {
|
||||
mActionListener.onDeleteClick(mAdapter.getCurPosition());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void loadImage(ImageView imageView, int position);
|
||||
|
||||
void onDeleteClick(int position);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//游戏弹窗
|
||||
public class LiveNewRolePopup extends BottomPopupView {
|
||||
private boolean showRed = false;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.yunbao.common.event.LiveSudGameHistoryEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
@@ -87,6 +88,11 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
if (mType == 0 || mType == 4) {
|
||||
topSelect.setText(getContext().getString(R.string.interactive_game_room_all));
|
||||
for (int i = 0; i < customSidebarChildModels.size(); i++) {
|
||||
/* if (!IMLoginManager.get(getContext()).getUserInfo().anchorUserType()) {
|
||||
if ("1490944230389182466".equals(customSidebarChildModels.get(i).getSrc())) {//友尽闯关
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
selectString.add(customSidebarChildModels.get(i).getTitle());
|
||||
if (TextUtils.equals(String.valueOf(interactionID), customSidebarChildModels.get(i).getSrc())) {
|
||||
index = i;
|
||||
|
||||
@@ -121,6 +121,7 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private String specialGiftName;
|
||||
@SerializedName("special_gift_name_en")
|
||||
private String specialGiftNameEn;
|
||||
|
||||
public int getSpecialGift() {
|
||||
return specialGift;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.Locale;
|
||||
*/
|
||||
|
||||
public class CommonHttpUtil {
|
||||
|
||||
public static final String GET_UPLOAD_QI_NIU_TOKEN = "getUploadQiNiuToken";
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
@@ -450,6 +450,16 @@ public class CommonHttpUtil {
|
||||
public static void getUserBaseinfo(String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO).params("touid", touid).execute(callback);
|
||||
}
|
||||
/**
|
||||
* 上传文件 获取七牛云token的接口
|
||||
*/
|
||||
public static void getUploadQiNiuToken(HttpCallback callback, boolean isImg) {
|
||||
HttpClient.getInstance().get("Pdluserhome.getQiNiuToken2", "Pdluserhome.getQiNiuToken2")
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("token", CommonAppConfig.getInstance().getToken())
|
||||
.params("ext", isImg ? ".jpeg" : ".mp4")
|
||||
.execute(callback);
|
||||
}
|
||||
//
|
||||
// //埋点唯一性
|
||||
// public static void setAdvertisingChannels(String operation, HttpCallback callback) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@@ -83,10 +84,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
@@ -112,7 +116,7 @@ public interface PDLiveApi {
|
||||
@Field("uuid_Device") String uuidDevice,
|
||||
@Field("pushid") String pushid,
|
||||
@Field("lastlogindevice") String lastlogindevice,
|
||||
@Field("langue")String langue
|
||||
@Field("langue") String langue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1187,12 +1191,48 @@ public interface PDLiveApi {
|
||||
|
||||
@GET("/api/public/?service=Guard.participateMoneyLong")
|
||||
Observable<ResponseModel<String>> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
|
||||
|
||||
@GET("/api/public/?service=Guard.endSendMoneyLong")
|
||||
Observable<ResponseModel<SendMoneyLongModel>> endSendMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey);
|
||||
|
||||
@GET("/api/public/?service=Guard.checkUpgrades")
|
||||
Observable<ResponseModel<CheckUpgradesModel>> checkUpgrades(@Query("liveuid") String liveUid);
|
||||
|
||||
@GET("/api/public/?service=Guard.getRewards")
|
||||
Observable<ResponseModel<Object>> guardGetRewards(@Query("guard_level") String guardLevel,@Query("liveuid") String liveUid);
|
||||
Observable<ResponseModel<Object>> guardGetRewards(@Query("guard_level") String guardLevel, @Query("liveuid") String liveUid);
|
||||
|
||||
@Multipart
|
||||
@POST("/api/public/?service=Pdlinfos.updateAvatar")
|
||||
Observable<ResponseModel<AvatarBean>> updateFile(@Part MultipartBody.Part file, @Query("uid") String uid, @Query("token") String token);
|
||||
|
||||
@GET("/api/public/?service=User.userFeedback")
|
||||
Observable<ResponseModel<List<BaseModel>>> feedback(@Query("problem_description") String content, @Query("problem_image") String images, @Query("contact_information") String ci);
|
||||
|
||||
|
||||
@GET("/api/public/?service=User.userFeedbackRestrict")
|
||||
Observable<ResponseModel<List<BaseModel>>> checkFeedback();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @param cmd 事件名称 生命值:addHeart 自动跳:hit
|
||||
* @param value 价格
|
||||
* @param gameId 游戏ID
|
||||
* @param fromUid 付费用户uid
|
||||
* @param toUid 目标用户uid
|
||||
* @param payload 附加值
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.createOrder")
|
||||
Observable<ResponseModel<List<BaseModel>>> createGameOrder(
|
||||
@Query("room_id")String roomId,
|
||||
@Query("cmd")String cmd,
|
||||
@Query("value")String value,
|
||||
@Query("mg_id")String gameId,
|
||||
@Query("from_uid")String fromUid,
|
||||
@Query("to_uid")String toUid,
|
||||
@Query("payload")String payload
|
||||
);
|
||||
@GET("/api/public/?service=Tx.getShengwangToken")
|
||||
Observable<ResponseModel<SwTokenModel>> getSwToken();
|
||||
}
|
||||
|
||||
@@ -4,9 +4,12 @@ import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@@ -80,6 +83,7 @@ import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -89,6 +93,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3184,6 +3192,123 @@ public class LiveNetManager {
|
||||
|
||||
}
|
||||
|
||||
public void updateFile(File file, HttpCallback<AvatarBean> callback) {
|
||||
MultipartBody.Part uploadFile = createUploadFile(file);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateFile(uploadFile, CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<AvatarBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<AvatarBean> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void feedback(
|
||||
String content,
|
||||
JSONArray images,
|
||||
String ci
|
||||
, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.feedback(content, images.toString(), ci)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkFeedback(
|
||||
HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkFeedback()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void createGameOrder(
|
||||
String roomId,
|
||||
String cmd,
|
||||
String value,
|
||||
String gameId,
|
||||
String fromUid,
|
||||
String toUid,
|
||||
String roundId,
|
||||
String payload
|
||||
, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createGameOrder(roomId, cmd, value, gameId, fromUid, toUid,payload)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -1,16 +1,62 @@
|
||||
package com.yunbao.common.interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.upload.UploadBean;
|
||||
import com.yunbao.common.upload.UploadCallback;
|
||||
import com.yunbao.common.upload.UploadQnImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/29.
|
||||
*/
|
||||
|
||||
public interface ImageResultCallback {
|
||||
public abstract class ImageResultCallback {
|
||||
//跳转相机前执行
|
||||
void beforeCamera();
|
||||
public void beforeCamera() {
|
||||
}
|
||||
|
||||
void onSuccess(File file);
|
||||
public void onSuccess(File file) {
|
||||
}
|
||||
|
||||
void onFailure();
|
||||
}
|
||||
public void onFailure() {
|
||||
}
|
||||
|
||||
public void onSuccessToUrl(File file, OnItemClickListener<String> listener) {
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.updateFile(file, new com.yunbao.common.http.base.HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
listener.onItemClick(data.getAvatar(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
listener.onItemClick(error, -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onSuccessToQiNiuUrl(Context mContext, File file, OnItemClickListener<String> listener) {
|
||||
UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext);
|
||||
List<UploadBean> beans = new ArrayList<>();
|
||||
beans.add(new UploadBean(file, UploadBean.IMG));
|
||||
mUploadStrategy.upload(beans, true, new UploadCallback() {
|
||||
@Override
|
||||
public void onFinish(List<UploadBean> list, boolean success) {
|
||||
if (success) {
|
||||
listener.onItemClick("https://downs.yaoulive.com/" + list.get(0).getRemoteAccessUrl(), 0);
|
||||
} else {
|
||||
listener.onItemClick(null, -1);
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.iflytek.cloud.SpeechUtility;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.RongIMConnectionStatusEvent;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGCache;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGDecorator;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGListener;
|
||||
@@ -16,7 +17,10 @@ import com.yunbao.common.sud.decorator.SudFSTAPPDecorator;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.model.GameViewInfoModel;
|
||||
import com.yunbao.common.sud.state.MGStateResponse;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.SudJsonUtils;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
import tech.sud.mgp.core.ISudFSTAPP;
|
||||
@@ -142,7 +146,10 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
|
||||
// 给装饰类设置回调
|
||||
sudFSMMGDecorator.setSudFSMMGListener(this);
|
||||
|
||||
sudFSMMGDecorator.setGameId(gameId);
|
||||
sudFSMMGDecorator.setRoomId(gameRoomId);
|
||||
sudFSMMGDecorator.setUserId(getUserId());
|
||||
Log.i("游戏回调", code + " " + gameId + " " + gameRoomId + " ");
|
||||
// 调用游戏sdk加载游戏
|
||||
ISudFSTAPP iSudFSTAPP = SudMGP.loadMG(activity, getUserId(), gameRoomId, code, gameId, getLanguageCode(), sudFSMMGDecorator);
|
||||
|
||||
@@ -282,6 +289,28 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
public void onGameLog(String str) {
|
||||
SudFSMMGListener.super.onGameLog(str);
|
||||
Log.e("onGameStarted", "游戏日志:" + str);
|
||||
if (!StringUtil.isEmpty()) {
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(str);
|
||||
if ("error".equals(json.getString("level"))) {
|
||||
String msg = json.getString("msg");
|
||||
JSONObject error = JSONObject.parseObject(msg);
|
||||
if (error.containsKey("msg")) {
|
||||
int resultCode = error.getInteger("resultCode");
|
||||
switch (resultCode) {
|
||||
case 100503:
|
||||
ToastUtil.show(WordUtil.isNewZh()?"有玩家未点击准备":":There are players who haven't clicked \"Ready\" yet.");
|
||||
break;
|
||||
case 100504:
|
||||
ToastUtil.show(WordUtil.isNewZh()?"小于游戏最小开始人数":"The number of players is less than the minimum required to start the game.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
/**
|
||||
* 游戏的语言代码
|
||||
*/
|
||||
public String languageCode = "zh-CN";
|
||||
public String languageCode = "zh-TW";
|
||||
|
||||
public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调
|
||||
|
||||
@@ -69,7 +69,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
@Override
|
||||
protected void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener) {
|
||||
if (IMLoginManager.get(activity).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
languageCode = "zh-CN";
|
||||
languageCode = "zh-TW";
|
||||
}else {
|
||||
languageCode = "en-US";
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
*/
|
||||
public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
|
||||
private static final String TAG = "游戏回调";
|
||||
private long gameId;
|
||||
private String gameRoomId;
|
||||
private String userId;
|
||||
// 回调
|
||||
private SudFSMMGListener sudFSMMGListener;
|
||||
|
||||
@@ -227,10 +231,10 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
}
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_STATE: // 10. 游戏状态
|
||||
Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::"+dataJson);
|
||||
Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::" + dataJson);
|
||||
SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class);
|
||||
sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState);
|
||||
if (mgCommonGameState.gameState==2){
|
||||
if (mgCommonGameState.gameState == 2) {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_STATE));
|
||||
}
|
||||
if (listener == null) {
|
||||
@@ -354,6 +358,14 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_CREATE_ORDER: // 25. 创建订单
|
||||
SudMGPMGState.MGCommonGameCreateOrder mgCommonGameCreateOrder = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCreateOrder.class);
|
||||
if (mgCommonGameCreateOrder != null) {
|
||||
mgCommonGameCreateOrder.gameId = gameId;
|
||||
mgCommonGameCreateOrder.gameRoomId = gameRoomId;
|
||||
mgCommonGameCreateOrder.userId = userId;
|
||||
mgCommonGameCreateOrder.dataJson = dataJson;
|
||||
}
|
||||
|
||||
Log.i(TAG, "onGameStateChange: " + dataJson);
|
||||
if (listener == null) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
} else {
|
||||
@@ -1021,4 +1033,15 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
return sudFSMMGCache;
|
||||
}
|
||||
|
||||
public void setGameId(long gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public void setRoomId(String gameRoomId) {
|
||||
this.gameRoomId = gameRoomId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
import com.yunbao.common.sud.decorator.game.JumpEvent;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.ISudFSMStateHandleUtils;
|
||||
|
||||
@@ -271,7 +272,13 @@ public interface SudFSMMGListener {
|
||||
* mg_common_game_create_order
|
||||
*/
|
||||
default void onGameMGCommonGameCreateOrder(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameCreateOrder model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
if ("addHeart".equals(model.cmd)) {
|
||||
JumpEvent.addHeart(model);
|
||||
} else if ("hit".equals(model.cmd)) {
|
||||
JumpEvent.hit(model);
|
||||
} else {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yunbao.common.sud.decorator.game;
|
||||
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.event.SubGameEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
public class JumpEvent {
|
||||
private static long clickTimer = 0;
|
||||
|
||||
public static void addHeart(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
createOrder(order);
|
||||
}
|
||||
|
||||
public static void hit(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
createOrder(order);
|
||||
}
|
||||
|
||||
private synchronized static void createOrder(SudMGPMGState.MGCommonGameCreateOrder order) {
|
||||
if (System.currentTimeMillis() - clickTimer < 500) {
|
||||
//TODO 防止重复点击
|
||||
HttpCallbackModel _data=new HttpCallbackModel(1001,"");
|
||||
Bus.get().post(new SubGameEvent(0, _data,order.dataJson));
|
||||
return;
|
||||
}
|
||||
clickTimer = System.currentTimeMillis();
|
||||
LiveNetManager.get(AppManager.getInstance().getLastActivity())
|
||||
.createGameOrder(order.gameRoomId,
|
||||
order.cmd,
|
||||
order.value + "",
|
||||
order.gameId + "",
|
||||
order.fromUid,
|
||||
order.toUid,
|
||||
order.gameRoomId,
|
||||
order.payload,
|
||||
new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() != 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
Bus.get().post(new SubGameEvent(0, data,order.dataJson));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -496,6 +496,11 @@ public class SudMGPMGState implements Serializable {
|
||||
public String toUid; // 目标用户uid
|
||||
public long value; // 所属的游戏价值
|
||||
public String payload; // 扩展数据 json 字符串, 特殊可选
|
||||
|
||||
public long gameId;
|
||||
public String gameRoomId;
|
||||
public String userId;
|
||||
public String dataJson;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
105
common/src/main/java/com/yunbao/common/upload/UploadBean.java
Normal file
105
common/src/main/java/com/yunbao/common/upload/UploadBean.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public class UploadBean {
|
||||
|
||||
public static final int IMG = 0;
|
||||
public static final int VIDEO = 1;
|
||||
public static final int VOICE = 2;
|
||||
private File mOriginFile;//要被上传的源文件
|
||||
private File mCompressFile;//压缩后的图片文件
|
||||
private String mRemoteFileName;//上传成功后在云存储上的文件名字
|
||||
private String mRemoteAccessUrl;//上传成功后在云存储上的访问地址
|
||||
private boolean mSuccess;//是否上传成功了
|
||||
private int mType;
|
||||
private Object mTag;
|
||||
|
||||
public UploadBean() {
|
||||
}
|
||||
|
||||
public UploadBean(File originFile, int type) {
|
||||
mOriginFile = originFile;
|
||||
mType = type;
|
||||
}
|
||||
|
||||
public File getOriginFile() {
|
||||
return mOriginFile;
|
||||
}
|
||||
|
||||
public void setOriginFile(File originFile) {
|
||||
mOriginFile = originFile;
|
||||
}
|
||||
|
||||
public String getRemoteFileName() {
|
||||
return mRemoteFileName;
|
||||
}
|
||||
|
||||
public void setRemoteFileName(String remoteFileName) {
|
||||
mRemoteFileName = remoteFileName;
|
||||
}
|
||||
|
||||
public String getRemoteAccessUrl() {
|
||||
return mRemoteAccessUrl;
|
||||
}
|
||||
|
||||
public void setRemoteAccessUrl(String remoteAccessUrl) {
|
||||
mRemoteAccessUrl = remoteAccessUrl;
|
||||
}
|
||||
|
||||
public File getCompressFile() {
|
||||
return mCompressFile;
|
||||
}
|
||||
|
||||
public void setCompressFile(File compressFile) {
|
||||
mCompressFile = compressFile;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return mSuccess;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
mSuccess = success;
|
||||
}
|
||||
|
||||
|
||||
public void setEmpty() {
|
||||
mOriginFile = null;
|
||||
mRemoteFileName = null;
|
||||
mRemoteAccessUrl = null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return mOriginFile == null && mRemoteFileName == null && mRemoteAccessUrl == null;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public Object getTag() {
|
||||
return mTag;
|
||||
}
|
||||
|
||||
public void setTag(Object tag) {
|
||||
mTag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UploadBean{" +
|
||||
"mOriginFile=" + mOriginFile +
|
||||
", mCompressFile=" + mCompressFile +
|
||||
", mRemoteFileName='" + mRemoteFileName + '\'' +
|
||||
", mRemoteAccessUrl='" + mRemoteAccessUrl + '\'' +
|
||||
", mSuccess=" + mSuccess +
|
||||
", mType=" + mType +
|
||||
", mTag=" + mTag +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public interface UploadCallback {
|
||||
void onFinish(List<UploadBean> list, boolean success);
|
||||
}
|
||||
224
common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java
Normal file
224
common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java
Normal file
@@ -0,0 +1,224 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.qiniu.android.common.ServiceAddress;
|
||||
import com.qiniu.android.common.Zone;
|
||||
import com.qiniu.android.http.ResponseInfo;
|
||||
import com.qiniu.android.storage.Configuration;
|
||||
import com.qiniu.android.storage.UpCompletionHandler;
|
||||
import com.qiniu.android.storage.UploadManager;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import top.zibin.luban.Luban;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
* 七牛上传文件
|
||||
*/
|
||||
|
||||
public class UploadQnImpl implements UploadStrategy {
|
||||
|
||||
private static final String TAG = "UploadQnImpl";
|
||||
private Context mContext;
|
||||
private List<UploadBean> mList;
|
||||
private int mIndex;
|
||||
private boolean mNeedCompress;
|
||||
private UploadCallback mUploadCallback;
|
||||
private HttpCallback mGetUploadTokenCallback;
|
||||
private String mToken;
|
||||
private UploadManager mUploadManager;
|
||||
private UpCompletionHandler mCompletionHandler;//上传回调
|
||||
private Luban.Builder mLubanBuilder;
|
||||
|
||||
public UploadQnImpl(Context context) {
|
||||
mContext = context;
|
||||
mCompletionHandler = new UpCompletionHandler() {
|
||||
@Override
|
||||
public void complete(String key, ResponseInfo info, JSONObject response) {
|
||||
System.out.println("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null));
|
||||
//L.e("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null));
|
||||
try {
|
||||
assert response != null;
|
||||
mList.get(mIndex).setRemoteAccessUrl(response.getString("key"));
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (mList == null || mList.size() == 0) {
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
UploadBean uploadBean = mList.get(mIndex);
|
||||
if (info.isOK()) {
|
||||
uploadBean.setSuccess(true);
|
||||
if (uploadBean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
//上传完成后把 压缩后的图片 删掉
|
||||
File compressedFile = uploadBean.getCompressFile();
|
||||
if (compressedFile != null && compressedFile.exists()) {
|
||||
File originFile = uploadBean.getOriginFile();
|
||||
if (originFile != null && !compressedFile.getAbsolutePath().equals(originFile.getAbsolutePath())) {
|
||||
compressedFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
mIndex++;
|
||||
if (mIndex < mList.size()) {
|
||||
uploadNext();
|
||||
} else {
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
upload(mList.get(mIndex));//上传失败后 重新上传
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback, boolean isImg) {
|
||||
System.err.println("-------upload------>" + list.size());
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
if (list == null || list.size() == 0) {
|
||||
callback.onFinish(list, false);
|
||||
return;
|
||||
}
|
||||
boolean hasFile = false;
|
||||
for (UploadBean bean : list) {
|
||||
if (bean.getOriginFile() != null) {
|
||||
hasFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasFile) {
|
||||
callback.onFinish(list, true);
|
||||
return;
|
||||
}
|
||||
mList = list;
|
||||
mNeedCompress = needCompress;
|
||||
mUploadCallback = callback;
|
||||
mIndex = 0;
|
||||
|
||||
if (mGetUploadTokenCallback == null) {
|
||||
mGetUploadTokenCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
mToken = info[0];
|
||||
System.err.println("-------上传的token------>" + mToken);
|
||||
L.e(TAG, "-------上传的token------>" + mToken);
|
||||
uploadNext();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
CommonHttpUtil.getUploadQiNiuToken(mGetUploadTokenCallback, isImg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelUpload() {
|
||||
CommonHttpUtil.cancel(CommonHttpUtil.GET_UPLOAD_QI_NIU_TOKEN);
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
mUploadCallback = null;
|
||||
}
|
||||
|
||||
private void uploadNext() {
|
||||
UploadBean bean = null;
|
||||
while (mIndex < mList.size() && (bean = mList.get(mIndex)).getOriginFile() == null) {
|
||||
mIndex++;
|
||||
}
|
||||
System.err.println("-------mIndex >= mList.size() mIndex------>" + mIndex);
|
||||
if (mIndex >= mList.size()) {
|
||||
System.err.println("-------mIndex >= mList.size()------>" + mList.size());
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, true);
|
||||
}
|
||||
System.err.println("-------mIndex >= mList.returnreturnreturnreturn------>" + mList.size());
|
||||
return;
|
||||
}
|
||||
if (bean.getType() == UploadBean.IMG) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".jpg"));
|
||||
} else if (bean.getType() == UploadBean.VIDEO) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".mp4"));
|
||||
} else if (bean.getType() == UploadBean.VOICE) {
|
||||
bean.setRemoteFileName(StringUtil.contact(StringUtil.generateFileName(), ".m4a"));
|
||||
}
|
||||
System.err.println("-------mIndex >= bean.getType() == UploadBean.IMG------>" + bean);
|
||||
upload(bean);
|
||||
/*if (bean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
System.err.println("-------UploadBean.IMG && mNeedCompress------>" + bean + "UploadBean.IMG:" + UploadBean.IMG + "__mNeedCompress" + mNeedCompress);
|
||||
if (mLubanBuilder == null) {
|
||||
mLubanBuilder = Luban.with(mContext).ignoreBy(8)//8k以下不压缩
|
||||
.setTargetDir(CommonAppConfig.INNER_PATH).setRenameListener(new OnRenameListener() {
|
||||
@Override
|
||||
public String rename(String filePath) {
|
||||
return mList.get(mIndex).getRemoteFileName();
|
||||
}
|
||||
}).setCompressListener(new OnCompressListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
UploadBean uploadBean = mList.get(mIndex);
|
||||
uploadBean.setCompressFile(file);
|
||||
upload(uploadBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
upload(mList.get(mIndex));
|
||||
}
|
||||
});
|
||||
}
|
||||
mLubanBuilder.load(bean.getOriginFile()).launch();
|
||||
} else {
|
||||
System.err.println("-------bean.getType() == UploadBean.IMG && mNeedCompress else");
|
||||
upload(bean);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void upload(UploadBean bean) {
|
||||
System.err.println("-------upload(UploadBean bean)------>" + bean);
|
||||
if (bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null) {
|
||||
System.err.println("bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null");
|
||||
if (mUploadManager == null) {
|
||||
Zone zone = new Zone(new ServiceAddress("http://upload-z0.qiniup.com"), new ServiceAddress("http://up-z0.qiniup.com"));
|
||||
Configuration configuration = new Configuration.Builder().zone(zone).build();
|
||||
mUploadManager = new UploadManager(configuration);
|
||||
}
|
||||
File uploadFile = bean.getOriginFile();
|
||||
if (bean.getType() == UploadBean.IMG && mNeedCompress) {
|
||||
File compressedFile = bean.getCompressFile();
|
||||
if (compressedFile != null && compressedFile.exists()) {
|
||||
uploadFile = compressedFile;
|
||||
}
|
||||
}
|
||||
mUploadManager.put(uploadFile, bean.getRemoteFileName(), mToken, mCompletionHandler, null);
|
||||
} else {
|
||||
System.err.println("else bean != null && !TextUtils.isEmpty(mToken) && mCompletionHandler != null");
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunbao.common.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/16.
|
||||
*/
|
||||
|
||||
public interface UploadStrategy {
|
||||
|
||||
/**
|
||||
* 执行上传
|
||||
*
|
||||
* @param list 被上传的文件列表
|
||||
* @param needCompress 是否需要压缩
|
||||
* @param callback 上传回调
|
||||
*/
|
||||
void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback,boolean isImg);
|
||||
|
||||
/**
|
||||
* 取消上传
|
||||
*/
|
||||
void cancelUpload();
|
||||
}
|
||||
@@ -11,6 +11,7 @@ public class AppManager {
|
||||
private static Stack<Activity> activityStack;
|
||||
|
||||
public AppManager() {
|
||||
activityStack=new Stack<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,33 @@ public class AppManager {
|
||||
return SingleApp.INSTANCE;
|
||||
}
|
||||
|
||||
public static Activity getActivity(String activityName) {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains(activityName)) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Activity getMainActivity() {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains("MainActivity")) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Activity getLiveActivity() {
|
||||
for (Activity activity : activityStack) {
|
||||
if (activity.getClass().getSimpleName().contains("LiveAudienceActivity")) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class SingleApp {
|
||||
public static AppManager INSTANCE = new AppManager();
|
||||
}
|
||||
@@ -67,7 +95,14 @@ public class AppManager {
|
||||
* 获取当前显示Activity(堆栈中最后一个传入的activity)
|
||||
*/
|
||||
public Activity getLastActivity() {
|
||||
if (activityStack.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Activity activity = activityStack.lastElement();
|
||||
if (activity == null || activity.isFinishing()) {
|
||||
activityStack.remove(activity);
|
||||
return getLastActivity();
|
||||
}
|
||||
return activity;
|
||||
}
|
||||
|
||||
@@ -126,7 +161,7 @@ public class AppManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*仅在debug下运行的代码
|
||||
* 仅在debug下运行的代码
|
||||
*/
|
||||
public static void runDebugCode(Runnable runnable) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
|
||||
@@ -359,6 +359,7 @@ public class DialogUitl {
|
||||
private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景
|
||||
private boolean mInput;//是否是输入框的
|
||||
private boolean isShowCancelButton=true;
|
||||
private boolean isSHowConfirmButton=true;
|
||||
private String mHint;
|
||||
private int mInputType;
|
||||
private int mLength;
|
||||
@@ -460,6 +461,11 @@ public class DialogUitl {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setShowConfirmButton(boolean showConfirmButton) {
|
||||
isSHowConfirmButton = showConfirmButton;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dialog build() {
|
||||
final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2);
|
||||
if (mView != 0) {
|
||||
@@ -499,10 +505,19 @@ public class DialogUitl {
|
||||
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
|
||||
if (!TextUtils.isEmpty(mConfirmString)) {
|
||||
btnConfirm.setText(mConfirmString);
|
||||
btnConfirm.setVisibility(View.VISIBLE);
|
||||
}else if(mConfirmString==null){
|
||||
// btnConfirm.setVisibility(View.GONE);
|
||||
}
|
||||
TextView btnCancel = (TextView) dialog.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(mCancelString)) {
|
||||
btnCancel.setText(mCancelString);
|
||||
btnCancel.setVisibility(View.VISIBLE);
|
||||
}else if(mCancelString==null){
|
||||
//btnCancel.setVisibility(View.GONE);
|
||||
}
|
||||
if(!isSHowConfirmButton){
|
||||
btnConfirm.setVisibility(View.GONE);
|
||||
}
|
||||
if(!isShowCancelButton){
|
||||
btnCancel.setVisibility(View.GONE);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
public class MobclickAgent {
|
||||
public static void onEvent(Context content, String key, Object value){
|
||||
|
||||
}
|
||||
|
||||
public static void setCatchUncaughtExceptions(boolean b) {
|
||||
}
|
||||
public static void setPageCollectionMode(int type){
|
||||
|
||||
}
|
||||
|
||||
public static void onPageStart(String mTag) {
|
||||
|
||||
}
|
||||
|
||||
public static void onPageEnd(String mTag) {
|
||||
}
|
||||
|
||||
public static void onProfileSignOff() {
|
||||
|
||||
}
|
||||
|
||||
public static void onProfileSignIn(String s) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,12 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.yalantis.ucrop.UCrop;
|
||||
import com.yalantis.ucrop.util.FileUtils;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||
@@ -36,6 +38,11 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
private File mCorpResult;//裁剪后得到的图片
|
||||
private ImageResultCallback mResultCallback;
|
||||
private boolean mNeedCrop;//是否需要裁剪
|
||||
private boolean mNeedGif;//允许gif图
|
||||
|
||||
public void setNeedGif(boolean mNeedGif) {
|
||||
this.mNeedGif = mNeedGif;
|
||||
}
|
||||
|
||||
public ProcessImageUtil(FragmentActivity activity) {
|
||||
super(activity);
|
||||
@@ -93,17 +100,41 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_camera_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
mAlumbResultCallback = new ActivityResultCallback() {
|
||||
@Override
|
||||
public void onSuccess(Intent intent) {
|
||||
if (!mNeedCrop) {
|
||||
if (mResultCallback != null) {
|
||||
if (intent.getData() == null) {
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
return;
|
||||
}
|
||||
String path = FileUtils.getPath(mContext, intent.getData());
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
mResultCallback.onSuccess(file);
|
||||
} else {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
crop(intent.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_alumb_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
mCropResultCallback = new ActivityResultCallback() {
|
||||
@@ -117,6 +148,9 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
@Override
|
||||
public void onFailure() {
|
||||
ToastUtil.show(mContext.getString(R.string.img_crop_cancel));
|
||||
if (mResultCallback != null) {
|
||||
mResultCallback.onFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -143,6 +177,11 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||
}
|
||||
|
||||
public void getImageByAlumb(boolean needCrop) {
|
||||
this.mNeedCrop = needCrop;
|
||||
requestPermissions(mAlumbPermissions, mAlumbPermissionCallback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开启摄像头,执行照相
|
||||
@@ -163,7 +202,9 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
}
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
|
||||
startActivityForResult(intent, mCameraResultCallback);
|
||||
}catch (Exception e){e.printStackTrace();}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private File getNewFile() {
|
||||
@@ -180,9 +221,14 @@ public class ProcessImageUtil extends ProcessResultUtil {
|
||||
* 打开相册,选择文件
|
||||
*/
|
||||
private void chooseFile() {
|
||||
String[] mimeTypes = {"image/png", "image/jpg", "image/jpeg"};
|
||||
Intent intent = new Intent();
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("image/*");
|
||||
intent.setType("*/*");
|
||||
if (mNeedGif) {
|
||||
mimeTypes = new String[]{"image/png", "image/jpg", "image/jpeg", "image/gif"};
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
} else {
|
||||
|
||||
@@ -52,6 +52,10 @@ public class RouteUtil {
|
||||
public static final String PATH_SudRyGameActivity = "/live/SudRyGameActivity";
|
||||
|
||||
public static final String PATH_COMMUNITY_Activity = "/main/MainHomeCommunityActivity";
|
||||
public static final String PATH_SudGameActivity="/live/SudGameActivity";
|
||||
public static final String PATH_FEEDBACK_SUCCESS_ACTIVITY = "/main/FeedbackSuccessActivity";
|
||||
public static final String PATH_FEEDBACK_ACTIVITY = "/main/FeedbackActivity";
|
||||
public static final String PATH_FEEDBACK_EDIT_ACTIVITY = "/main/FeedbackEditActivity";
|
||||
|
||||
|
||||
public static void forwardCommunityActivity() {
|
||||
@@ -367,8 +371,12 @@ public class RouteUtil {
|
||||
/**
|
||||
* 战令
|
||||
*/
|
||||
public static void forwardBattlePass() {
|
||||
public static void forwardBattlePass(){
|
||||
ARouter.getInstance().build(PATH_BattlePassActivity)
|
||||
.navigation();
|
||||
}
|
||||
public static void forwardActivity(String path){
|
||||
ARouter.getInstance().build(path)
|
||||
.navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.File;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -160,4 +161,15 @@ public class StringUtil {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机文件名
|
||||
*/
|
||||
public static String generateFileName() {
|
||||
return contact("android_",
|
||||
CommonAppConfig.getInstance().getUid(),
|
||||
"_",
|
||||
DateFormatUtil.getVideoCurTimeString(),
|
||||
UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.FunGamesAdapter;
|
||||
|
||||
@@ -9,7 +9,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.InteractionGamesAdapter;
|
||||
import com.yunbao.common.adapter.LiveNewRoleInteractionGamesAdapter;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yunbao.common.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -9,6 +10,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
@@ -17,16 +19,19 @@ import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.event.HideShowEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.ShowHideEvent;
|
||||
import com.yunbao.common.event.SubGameEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.state.SudMGPAPPState;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -229,7 +234,7 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("貨幣数量不足 ");
|
||||
} else {
|
||||
ToastUtil.show("Shortage of money");
|
||||
ToastUtil.show("Insufficient number of currency");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -240,7 +245,7 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("貨幣数量不足 ");
|
||||
} else {
|
||||
ToastUtil.show("Shortage of money");
|
||||
ToastUtil.show("Insufficient number of currency");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -276,4 +281,16 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameStatus(SubGameEvent event) {
|
||||
if (event.getType() == 0) {
|
||||
Log.i("游戏回调", "onGameStateChange: event :" + event.toString());
|
||||
if (event.getModel().getCode() == 1001 || event.getModel().getCode() == 1002) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("result", 0);
|
||||
gameViewModel.sudFSTAPPDecorator.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_CREATE_ORDER_RESULT, jsonObject.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rootView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -15,6 +16,7 @@
|
||||
android:id="@+id/ft_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
|
||||
android:paddingTop="24dp"
|
||||
android:background="@color/white">
|
||||
|
||||
@@ -67,6 +69,5 @@
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
8
common/src/main/res/layout/item_preview_img.xml
Normal file
8
common/src/main/res/layout/item_preview_img.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitCenter"
|
||||
android:background="#000"
|
||||
/>
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--身份特权-->
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="40dp"
|
||||
|
||||
@@ -46,12 +46,21 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fun_game_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="1"
|
||||
android:text="@string/guard_guard"
|
||||
android:textColor="#9A9A9A"
|
||||
|
||||
app:autoSizeMaxTextSize="14sp"
|
||||
app:autoSizeMinTextSize="5sp"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
78
common/src/main/res/layout/view_preview_image.xml
Normal file
78
common/src/main/res/layout/view_preview_image.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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_height="match_parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:background="#000" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/preview"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="9dp"
|
||||
android:src="@mipmap/icon_back"
|
||||
app:tint="@color/white" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:layout_marginRight="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="40dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#000"
|
||||
android:gravity="center"
|
||||
android:text="@string/delete"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -1373,11 +1373,11 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="sud_in_game_game_game_peer_user">"Paired Users "</string>
|
||||
<string name="sud_in_game_game_game_peer_user_nodata">" Currently No Records~"</string>
|
||||
<string name="sud_in_game_game_game_peer_today">"Today "</string>
|
||||
<string name="sud_in_game_rule_hint1">1. Interactive games are a new section provided by PDLIVE for users, who can participate in the game section on the homepage or in the live room;</string>
|
||||
<string name="sud_in_game_rule_hint2">2. Currently, we have launched \'GoBang\',\' Bumper car \',\' Flying Chess\', \'Minesweeping\', \'Dart Master\', and \'Monster Eliminating\'. We will provide more game types in the future. Stay tuned;</string>
|
||||
<string name="sud_in_game_rule_hint1">1.Interactive games are a new section provided by PDLIVE for users, who can participate in the game section on the homepage or in the live room;</string>
|
||||
<string name="sud_in_game_rule_hint2">2.Currently, [Backgammon], [Flying Chess], [Bumper I’m the Strongest], [Monster Match], [Jump], [Friendly Challenge], [Magic Battle], [American 8 Ball] More game types will be provided in the future, so stay tuned;</string>
|
||||
<string name="sud_in_game_rule_hint3">3.Users can customize the game threshold, which must be between 100 to 50000 gold beans , and the amount must be a multiple of 10;</string>
|
||||
<string name="sud_in_game_rule_hint4">4.At the beginning of the game, chips from participating users will be collected. After the game ends, 10% of the chips will be collected as tickets, and all remaining chips will be given to the winning users.In a draw, the corresponding chips will be deducted from the tickets and returned to the users;</string>
|
||||
<string name="sud_in_game_rule_hint5">5. The final interpretation right of the event belongs to PDLIVE.</string>
|
||||
<string name="sud_in_game_rule_hint5">5.The final interpretation right of the event belongs to PDLIVE.</string>
|
||||
<string name="sud_in_game_game_currency_item">Currency</string>
|
||||
<string name="sud_in_game_game_currency">Currency:</string>
|
||||
<string name="sud_in_game_game_time">Time:</string>
|
||||
@@ -1466,7 +1466,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="six_month">6 month</string>
|
||||
<string name="one_two_month">12 month</string>
|
||||
<string name="guardian_for_your_favorite_anchor">Quickly activate guardian for your favorite anchor!</string>
|
||||
<string name="guardian_task">Guardian Task</string>
|
||||
<string name="guardian_task">Guard tasks</string>
|
||||
<string name="my_graud_grade">My level ></string>
|
||||
<string name="no_one_guarding_the_anchor_yet">No one is guarding the anchor yet, come and guard it now~</string>
|
||||
<string name="this_week_contribution">Contribution/week</string>
|
||||
|
||||
@@ -1371,7 +1371,7 @@
|
||||
<string name="sud_in_game_game_game_peer_user_nodata">暫無記錄~</string>
|
||||
<string name="sud_in_game_game_game_peer_today">今日</string>
|
||||
<string name="sud_in_game_rule_hint1">1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待;</string>
|
||||
<string name="sud_in_game_rule_hint3">3、用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數;</string>
|
||||
<string name="sud_in_game_rule_hint4">4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶;</string>
|
||||
<string name="sud_in_game_rule_hint5">5、活動最終解釋權歸PDLIVE所有。</string>
|
||||
|
||||
@@ -1370,7 +1370,7 @@
|
||||
<string name="sud_in_game_game_game_peer_user_nodata">暫無記錄~</string>
|
||||
<string name="sud_in_game_game_game_peer_today">今日</string>
|
||||
<string name="sud_in_game_rule_hint1">1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待;</string>
|
||||
<string name="sud_in_game_rule_hint3">3、用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數;</string>
|
||||
<string name="sud_in_game_rule_hint4">4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶;</string>
|
||||
<string name="sud_in_game_rule_hint5">5、活動最終解釋權歸PDLIVE所有。</string>
|
||||
|
||||
@@ -1369,7 +1369,7 @@
|
||||
<string name="sud_in_game_game_game_peer_user_nodata">暫無記錄~</string>
|
||||
<string name="sud_in_game_game_game_peer_today">今日</string>
|
||||
<string name="sud_in_game_rule_hint1">1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待;</string>
|
||||
<string name="sud_in_game_rule_hint2">2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待;</string>
|
||||
<string name="sud_in_game_rule_hint3">3、 用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數;</string>
|
||||
<string name="sud_in_game_rule_hint4">4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶;</string>
|
||||
<string name="sud_in_game_rule_hint5">5、活動最終解釋權歸PDLIVE所有。</string>
|
||||
|
||||
@@ -1381,9 +1381,9 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="sud_in_game_game_game_peer_today">"Today "</string>
|
||||
<string name="sud_in_game_game_game_peer_today_7">"≤7 days "</string>
|
||||
<string name="sud_in_game_game_game_peer_today_30">≤ 30 days</string>
|
||||
<string name="sud_in_game_rule_hint1">1. Interactive games are a new section provided by PDLIVE for users, who can participate in the game section on the homepage or in the live room;</string>
|
||||
<string name="sud_in_game_rule_hint2">2.Currently, we have launched \'GoBang\',\' Bumper car \',\' Flying Chess\', \'Minesweeping\', \'Dart Master\', and \'Monster Eliminating\'. We will provide more game types in the future. Stay tuned;</string>
|
||||
<string name="sud_in_game_rule_hint3">3.. Users can customize the game threshold, which must be between 100 to 50000 gold beans , and the amount must be a multiple of 10;</string>
|
||||
<string name="sud_in_game_rule_hint1">1.Interactive games are a new section provided by PDLIVE for users, who can participate in the game section on the homepage or in the live room;</string>
|
||||
<string name="sud_in_game_rule_hint2">2.Currently, [Backgammon], [Flying Chess], [Bumper I’m the Strongest], [Monster Match], [Jump], [Friendly Challenge], [Magic Battle], [American 8 Ball] More game types will be provided in the future, so stay tuned;</string>
|
||||
<string name="sud_in_game_rule_hint3">3. Users can customize the game threshold, which must be between 100 to 50000 gold beans , and the amount must be a multiple of 10;</string>
|
||||
<string name="sud_in_game_rule_hint4">4.At the beginning of the game, chips from participating users will be collected. After the game ends, 10% of the chips will be collected as tickets, and all remaining chips will be given to the winning users.In a draw, the corresponding chips will be deducted from the tickets and returned to the users;</string>
|
||||
<string name="sud_in_game_rule_hint5">5. The final interpretation right of the event belongs to PDLIVE.</string>
|
||||
<string name="room_sill0_100">0-100 coins</string>
|
||||
@@ -1469,7 +1469,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="six_month">6 month</string>
|
||||
<string name="one_two_month">12 month</string>
|
||||
<string name="guardian_for_your_favorite_anchor">Quickly activate guardian for your favorite anchor!</string>
|
||||
<string name="guardian_task">Guardian Task</string>
|
||||
<string name="guardian_task">Guard tasks</string>
|
||||
<string name="my_graud_grade">My level ></string>
|
||||
<string name="no_one_guarding_the_anchor_yet">No one is guarding the anchor yet, come and guard it now~</string>
|
||||
<string name="this_week_contribution">Contribution/week</string>
|
||||
|
||||
Reference in New Issue
Block a user