diff --git a/FaceUnity/src/androidTest/java/com/yunbao/faceunity/ExampleInstrumentedTest.java b/FaceUnity/src/androidTest/java/com/yunbao/faceunity/ExampleInstrumentedTest.java index d54eb1cba..d1ea2eda2 100644 --- a/FaceUnity/src/androidTest/java/com/yunbao/faceunity/ExampleInstrumentedTest.java +++ b/FaceUnity/src/androidTest/java/com/yunbao/faceunity/ExampleInstrumentedTest.java @@ -2,7 +2,7 @@ package com.yunbao.faceunity; import android.content.Context; -import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.platform.app.Instrimport com.yunbao.common.utils.MobclickAgent;ntationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; diff --git a/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java b/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java deleted file mode 100644 index 633872460..000000000 --- a/Share/src/test/java/com/yunbao/share/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yunbao.share; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index ca93012ac..0a84badf9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,26 @@ android { project.tasks.getByName("tasks").doFirst { } + /* flavorDimensions "packageApk" + productFlavors { + LinkTest { + dimension "packageApk" + manifestPlaceholders = [serverHost: "https://ceshi.yaoulive.com",isGooglePlay:0,isPluginModel:true] + } + LinkOfficial { + dimension "packageApk" + manifestPlaceholders = [serverHost: "https://napi.yaoulive.com",isGooglePlay:0,isPluginModel:true] + } + GoogleTest { + dimension "packageApk" + manifestPlaceholders = [serverHost: "https://ceshi.yaoulive.com",isGooglePlay:1,isPluginModel:false] + } + GoogleOfficial{ + dimension "packageApk" + manifestPlaceholders = [serverHost: "https://napi.yaoulive.com",isGooglePlay:1,isPluginModel:false] + } + + }*/ /* applicationVariants.all { variant -> variant.mergeAssetsProvider.configure { doLast { @@ -119,14 +139,27 @@ android { processManifestTask.doLast { pm -> String manifestPath = "build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml" def isGooglePlay = rootProject.ext.manifestPlaceholders.isGooglePlay - if (file(manifestPath).exists() && isGooglePlay) { + println "谷歌版本:" + isGooglePlay + println "文件存在" + file(manifestPath).exists() + println "" + (isGooglePlay != 0) + println "" + (file(manifestPath).exists() && isGooglePlay != 0) + if (file(manifestPath).exists() && isGooglePlay != 0) { def manifestContent = file(manifestPath).getText() - + println "移除权限" manifestContent = manifestContent.replace('', '') + manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '') file(manifestPath).write(manifestContent) } else { print "not Exists = " + manifestPath } + manifestPath = "build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml" + if (file(manifestPath).exists() && isGooglePlay != 0) { + def manifestContent = file(manifestPath).getText() + println "移除权限2" + manifestContent = manifestContent.replace('', '') + manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '') + file(manifestPath).write(manifestContent) + } } variant.mergeAssetsProvider.configure { doLast { @@ -171,7 +204,7 @@ android { isGoogle = "谷歌" } else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) { isGoogle = "Huawei" - }else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) { + } else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) { isGoogle = "Samsung" } def isPlugin = "完整" @@ -183,7 +216,6 @@ android { isTest = "正式服" } outputFileName = "[${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${isGoogle}-${isPlugin}-${variant.buildType.name}-${isTest}.apk" - } } signingConfigs { diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index bc2809798..10f4ffe34 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -277,6 +277,18 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -keep class tech.sud.mgp.hello.ui.main.settings.model.** {*;} -keep class tech.sud.mgp.hello.ui.main.nft.model.** {*;} -keep class tech.sud.mgp.hello.common.event.model.** {*;} +-keep class tech.sud.mgp.**{*;} + +-keep class bitter.jnibridge.** { *; } +-keep class com.google.androidgamesdk.** { *; } +-keep class com.unity3d.** { *; } +-keep class do.do.do.** { *; } +-keep class do.if.do.** { *; } +-keep class for.do.** { *; } +-keep class if.do.do.do.** { *; } +-keep class org.fmod.** { *; } +-keep class tech.sud.** { *; } +-keep class tech.unity3d.** { *; } -keep class com.yunbao.common.sud.** {*;} diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 4a8c1ec77..37aa91b60 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -30,14 +30,14 @@ import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSimpleMsgListener; import com.tencent.imsdk.v2.V2TIMUserInfo; -import com.umeng.analytics.MobclickAgent; -import com.umeng.commonsdk.UMConfigure; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.CrashSaveBean; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.event.SudGameSocketImEvent; import com.yunbao.common.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; @@ -142,6 +142,7 @@ public class AppContext extends CommonAppContext { registerError(); registerFirebaseCrash(); LogUtils.start(this); + //DebugDialog.getInstance().setParams("初始化","启动"); sInstance = this; L.setDeBug(BuildConfig.DEBUG); AppEventsLogger.activateApp(this); @@ -164,20 +165,20 @@ public class AppContext extends CommonAppContext { OpenInstall.init(this); } //设置LOG开关,默认为false - UMConfigure.setLogEnabled(true); + //UMConfigure.setLogEnabled(true); //友盟正式初始化 - UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96"); + //UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, "64e40ee55488fe7b3afa2c96"); //集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能 MobclickAgent.setCatchUncaughtExceptions(false); //PushSDK初始化(如使用推送SDK,必须调用此方法) //统计SDK是否支持采集在子进程中打点的自定义事件,默认不支持 - UMConfigure.setProcessEvent(true);//支持多进程打点 - MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); - UMConfigure.submitPolicyGrantResult(getApplicationContext(), true); + //UMConfigure.setProcessEvent(true);//支持多进程打点 + //MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); + //UMConfigure.submitPolicyGrantResult(getApplicationContext(), true); registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks()); //初始化 AndroidUtilCode diff --git a/common/build.gradle b/common/build.gradle index def1c55da..9e4efa8e3 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -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') diff --git a/common/src/main/java/com/yunbao/common/HtmlConfig.java b/common/src/main/java/com/yunbao/common/HtmlConfig.java index cc331d026..d128d9001 100644 --- a/common/src/main/java/com/yunbao/common/HtmlConfig.java +++ b/common/src/main/java/com/yunbao/common/HtmlConfig.java @@ -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"; diff --git a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java index 59851d060..d9bc9e968 100644 --- a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java @@ -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"); diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index 32ab753c1..dc238840c 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -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); + } } diff --git a/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java new file mode 100644 index 000000000..420111425 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java @@ -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 { + HashMap paramMap = new HashMap<>(); + private Context mContext; + + public DebugDialogAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setParamMap(HashMap 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 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); + } + } + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/ImagePreviewAdapter.java b/common/src/main/java/com/yunbao/common/adapter/ImagePreviewAdapter.java new file mode 100644 index 000000000..bc22ba76c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/ImagePreviewAdapter.java @@ -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 { + + 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); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java index 9bd25c0d3..bbbc9e328 100644 --- a/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java @@ -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 child = new ArrayList<>(); + private List 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 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(); } diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java index 38a531bce..3d17bf60e 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java @@ -67,13 +67,14 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter { public void updateData(List 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(); } diff --git a/common/src/main/java/com/yunbao/common/bean/AiAutomaticSpeechModel.java b/common/src/main/java/com/yunbao/common/bean/AiAutomaticSpeechModel.java index e9b4d0f06..e912b9ac4 100644 --- a/common/src/main/java/com/yunbao/common/bean/AiAutomaticSpeechModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AiAutomaticSpeechModel.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/bean/AvatarBean.java b/common/src/main/java/com/yunbao/common/bean/AvatarBean.java new file mode 100644 index 000000000..2fec7a998 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/AvatarBean.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java index 7467819fb..fe8b274c2 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBattlePassRewardsBean.java @@ -7,12 +7,21 @@ import java.util.Map; public class LiveBattlePassRewardsBean extends BaseModel{ private int level; + private int is_received; private List live_battle_pass_type; private Map> 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; } diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java index a28783b02..7bb3f8e60 100644 --- a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index 6290b76f2..ea81b93bc 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java index d6f2906ab..6d987d935 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/CinemaTicketPopupWindow.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java index 479746a32..d4abdd05e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -46,6 +46,9 @@ import java.util.List; import java.util.Locale; import java.util.Random; +/** + * 半屏创建游戏房间 + */ public class CreateSudGamePopup extends BottomPopupView { private List 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(); + } + + + } }); } diff --git a/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java new file mode 100644 index 000000000..48131bfbf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java @@ -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 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); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java index 04ebc92ec..25a7e4f61 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsDialog.java @@ -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); diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java index 36b326d0c..1d1fc7334 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java @@ -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")); diff --git a/common/src/main/java/com/yunbao/common/dialog/ImagePreviewDialog.java b/common/src/main/java/com/yunbao/common/dialog/ImagePreviewDialog.java new file mode 100644 index 000000000..a19449066 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/ImagePreviewDialog.java @@ -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); + } + +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java b/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java index 442bc2577..95fd1368d 100644 --- a/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java @@ -21,6 +21,7 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.List; +//游戏弹窗 public class LiveNewRolePopup extends BottomPopupView { private boolean showRed = false; diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java index 40b01008b..fbca07bed 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java index b02143652..e9efbc93a 100644 --- a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java +++ b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index f7ed008c6..50237cf73 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -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) { diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index a2b978554..13a2a4524 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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> participateMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey); + @GET("/api/public/?service=Guard.endSendMoneyLong") Observable> endSendMoneyLong(@Query("liveuid") String liveUid, @Query("send_money_long_key") String sendMoneyLongKey); + @GET("/api/public/?service=Guard.checkUpgrades") Observable> checkUpgrades(@Query("liveuid") String liveUid); + @GET("/api/public/?service=Guard.getRewards") - Observable> guardGetRewards(@Query("guard_level") String guardLevel,@Query("liveuid") String liveUid); + Observable> guardGetRewards(@Query("guard_level") String guardLevel, @Query("liveuid") String liveUid); + + @Multipart + @POST("/api/public/?service=Pdlinfos.updateAvatar") + Observable> updateFile(@Part MultipartBody.Part file, @Query("uid") String uid, @Query("token") String token); + + @GET("/api/public/?service=User.userFeedback") + Observable>> feedback(@Query("problem_description") String content, @Query("problem_image") String images, @Query("contact_information") String ci); + + + @GET("/api/public/?service=User.userFeedbackRestrict") + Observable>> 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>> 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> getSwToken(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 16d7c046c..73966ce7c 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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 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>() { + @Override + public void accept(ResponseModel model) throws Exception { + if (callback != null) { + callback.onSuccess(model.getData().getInfo()); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .feedback(content, images.toString(), ci) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> responseModel) { + if (callback != null) { + HttpCallbackModel model = new HttpCallbackModel(); + model.setCode(responseModel.getData().getCode()); + model.setMsg(responseModel.getData().getMsg()); + callback.onSuccess(model); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .checkFeedback() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> responseModel) { + if (callback != null) { + HttpCallbackModel model = new HttpCallbackModel(); + model.setCode(responseModel.getData().getCode()); + model.setMsg(responseModel.getData().getMsg()); + callback.onSuccess(model); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .createGameOrder(roomId, cmd, value, gameId, fromUid, toUid,payload) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> responseModel) { + if (callback != null) { + HttpCallbackModel model = new HttpCallbackModel(); + model.setCode(responseModel.getData().getCode()); + model.setMsg(responseModel.getData().getMsg()); + callback.onSuccess(model); + } + } + }, new Consumer() { + @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); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java index ed482704e..f3a34309c 100644 --- a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java +++ b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java @@ -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 listener) { + LiveNetManager.get(CommonAppContext.getTopActivity()) + .updateFile(file, new com.yunbao.common.http.base.HttpCallback() { + @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 listener) { + UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext); + List beans = new ArrayList<>(); + beans.add(new UploadBean(file, UploadBean.IMG)); + mUploadStrategy.upload(beans, true, new UploadCallback() { + @Override + public void onFinish(List list, boolean success) { + if (success) { + listener.onItemClick("https://downs.yaoulive.com/" + list.get(0).getRemoteAccessUrl(), 0); + } else { + listener.onItemClick(null, -1); + } + } + }, true); + + } +} \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 28c6fb71f..3a69bb5e5 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index 1a7d1b023..8feb19b11 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java index 141e829f4..780775644 100644 --- a/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java +++ b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java @@ -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) { + + } + } } /** diff --git a/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java index 4a98859bd..e7fa09b58 100644 --- a/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java +++ b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java @@ -59,7 +59,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel { /** * 游戏的语言代码 */ - public String languageCode = "zh-CN"; + public String languageCode = "zh-TW"; public final MutableLiveData 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"; } diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java index a52a68409..1bfba5b82 100644 --- a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java @@ -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; + } } diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java index 8b6da8ba1..2bc23c6e9 100644 --- a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java @@ -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); + } } /** diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java b/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java new file mode 100644 index 000000000..c6a05d011 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java @@ -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() { + @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) { + + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java index 1523a5a16..dc358b332 100644 --- a/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java +++ b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java @@ -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; } /** diff --git a/common/src/main/java/com/yunbao/common/upload/UploadBean.java b/common/src/main/java/com/yunbao/common/upload/UploadBean.java new file mode 100644 index 000000000..920f3a570 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/upload/UploadBean.java @@ -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 + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/upload/UploadCallback.java b/common/src/main/java/com/yunbao/common/upload/UploadCallback.java new file mode 100644 index 000000000..8676964fa --- /dev/null +++ b/common/src/main/java/com/yunbao/common/upload/UploadCallback.java @@ -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 list, boolean success); +} diff --git a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java new file mode 100644 index 000000000..6b1134b26 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java @@ -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 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 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); + } + } + } + +} diff --git a/common/src/main/java/com/yunbao/common/upload/UploadStrategy.java b/common/src/main/java/com/yunbao/common/upload/UploadStrategy.java new file mode 100644 index 000000000..e61427909 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/upload/UploadStrategy.java @@ -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 list, boolean needCompress, UploadCallback callback,boolean isImg); + + /** + * 取消上传 + */ + void cancelUpload(); +} diff --git a/common/src/main/java/com/yunbao/common/utils/AppManager.java b/common/src/main/java/com/yunbao/common/utils/AppManager.java index 44891e250..5b271108a 100644 --- a/common/src/main/java/com/yunbao/common/utils/AppManager.java +++ b/common/src/main/java/com/yunbao/common/utils/AppManager.java @@ -11,6 +11,7 @@ public class AppManager { private static Stack 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) { diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index d7e7582ca..72a88646a 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -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); diff --git a/common/src/main/java/com/yunbao/common/utils/MobclickAgent.java b/common/src/main/java/com/yunbao/common/utils/MobclickAgent.java new file mode 100644 index 000000000..cf7d36ddd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/MobclickAgent.java @@ -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) { + + } +} diff --git a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java index c58ad32ee..0464f9d7c 100644 --- a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java @@ -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 { diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 6e9823dfc..5fef0e982 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -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(); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/StringUtil.java b/common/src/main/java/com/yunbao/common/utils/StringUtil.java index b6bbc577a..c58e8170c 100644 --- a/common/src/main/java/com/yunbao/common/utils/StringUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/StringUtil.java @@ -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()); + } } diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java index e24ddd2db..6e617215d 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java index 98380e2f6..4a30f3397 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java index 01776f158..9bb18cb88 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -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()); + } + } + } } diff --git a/common/src/main/res/layout/activity_webview.xml b/common/src/main/res/layout/activity_webview.xml index ec83eebe4..44c9ef453 100644 --- a/common/src/main/res/layout/activity_webview.xml +++ b/common/src/main/res/layout/activity_webview.xml @@ -1,5 +1,6 @@ @@ -67,6 +69,5 @@ \ No newline at end of file diff --git a/common/src/main/res/layout/item_preview_img.xml b/common/src/main/res/layout/item_preview_img.xml new file mode 100644 index 000000000..5fca97d21 --- /dev/null +++ b/common/src/main/res/layout/item_preview_img.xml @@ -0,0 +1,8 @@ + + diff --git a/common/src/main/res/layout/view_fun_games_child_view.xml b/common/src/main/res/layout/view_fun_games_child_view.xml index 4ac669274..cf798f976 100644 --- a/common/src/main/res/layout/view_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_fun_games_child_view.xml @@ -6,7 +6,7 @@ android:layout_marginTop="12dp" android:gravity="center" android:orientation="vertical"> - + \ No newline at end of file diff --git a/common/src/main/res/layout/view_preview_image.xml b/common/src/main/res/layout/view_preview_image.xml new file mode 100644 index 000000000..997875235 --- /dev/null +++ b/common/src/main/res/layout/view_preview_image.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index b1f00db6d..cf8ac1696 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1373,11 +1373,11 @@ Limited ride And limited avatar frame "Paired Users " " Currently No Records~" "Today " - 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; - 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; + 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; + 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; 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; 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; - 5. The final interpretation right of the event belongs to PDLIVE. + 5.The final interpretation right of the event belongs to PDLIVE. Currency Currency: Time: @@ -1466,7 +1466,7 @@ Limited ride And limited avatar frame 6 month 12 month Quickly activate guardian for your favorite anchor! - Guardian Task + Guard tasks My level > No one is guarding the anchor yet, come and guard it now~ Contribution/week diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 6122bf711..2700ca336 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1371,7 +1371,7 @@ 暫無記錄~ 今日 1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與; - 2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待; + 2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待; 3、用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數; 4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶; 5、活動最終解釋權歸PDLIVE所有。 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 97460c705..788dd6e47 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1370,7 +1370,7 @@ 暫無記錄~ 今日 1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與; - 2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待; + 2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待; 3、用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數; 4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶; 5、活動最終解釋權歸PDLIVE所有。 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 0765a70d7..2a811eb5b 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1369,7 +1369,7 @@ 暫無記錄~ 今日 1、互動遊戲是PDLIVE為用戶提供的全新板塊,用戶可以在首頁【遊戲專區】或直播間內參與; - 2、目前已上線【五子棋】、【碰碰我最強】、【飛行棋】、【扫雷】、【飞镖达人】、【怪兽消消乐】,後續將會提供更多遊戲種類,敬請期待; + 2、目前已上線【五子棋】、【飛行棋】、【碰碰我最強】、【怪物消消樂】、【跳一跳】、【友情闖關】、【魔法大樂鬥】、【美式8球】後續將會提供更多遊戲種類,敬請期期待; 3、 用戶可自定義設定遊戲門檻,要求在100~50000金豆之間,數額必須為10的倍數; 4、 遊戲開始時將會收取參與遊戲用戶的籌碼,在遊戲結束後,將收取10%的籌碼作為門票,剩餘籌碼將全部給予勝利用戶,平局時將會扣除相應籌碼门票後返還給用戶; 5、活動最終解釋權歸PDLIVE所有。 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index f7d9f1a4f..9523697f8 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1381,9 +1381,9 @@ Limited ride And limited avatar frame "Today " "≤7 days " ≤ 30 days - 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; - 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; - 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; + 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; + 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; + 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; 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; 5. The final interpretation right of the event belongs to PDLIVE. 0-100 coins @@ -1469,7 +1469,7 @@ Limited ride And limited avatar frame 6 month 12 month Quickly activate guardian for your favorite anchor! - Guardian Task + Guard tasks My level > No one is guarding the anchor yet, come and guard it now~ Contribution/week diff --git a/config.gradle b/config.gradle index bead9f425..76db80235 100644 --- a/config.gradle +++ b/config.gradle @@ -4,8 +4,8 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 33, - versionCode : 469, - versionName : "6.6.6" + versionCode : 473, + versionName : "6.6.8" ] manifestPlaceholders = [ //正式、 @@ -25,6 +25,6 @@ ext { //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : false, + isPluginModel : true, ] } diff --git a/lib_google/src/test/java/com/shayu/lib_huawei/ExampleUnitTest.java b/lib_google/src/test/java/com/shayu/lib_huawei/ExampleUnitTest.java deleted file mode 100644 index 7e3402cf9..000000000 --- a/lib_google/src/test/java/com/shayu/lib_huawei/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.shayu.lib_huawei; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/libs/umeng-common-9.6.8+000.aar b/libs/umeng-common-9.6.8+000.aar new file mode 100644 index 000000000..5d4c09710 Binary files /dev/null and b/libs/umeng-common-9.6.8+000.aar differ diff --git a/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java b/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java index b49b023bd..7012dc3c8 100644 --- a/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/CompensateActivity.java @@ -18,7 +18,7 @@ import com.blankj.utilcode.util.StringUtils; import com.ms.banner.Banner; import com.ms.banner.BannerConfig; import com.ms.banner.listener.OnBannerClickListener; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 349d88ec0..ec6e0e055 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -21,7 +21,7 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; @@ -535,7 +535,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL mLiveRoomViewHolder.onGuardInfoChanged(bean); LiveChatBean chatBean = new LiveChatBean(); chatBean.setContent(bean.getUserName()); - chatBean.setType(LiveChatBean.SYSTEM); + chatBean.setType(LiveChatBean.SYSTEM2); mLiveRoomViewHolder.insertChat(chatBean, 1); } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 5b27c1498..5ab28a083 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -36,7 +36,7 @@ import com.lxj.xpopup.core.BasePopupView; import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.interfaces.XPopupCallback; import com.lzf.easyfloat.EasyFloat; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; diff --git a/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java index 7ec1b109a..719666c70 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudRyGameActivity.java @@ -43,6 +43,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.imrongcloud.GameRyMicManager; import com.yunbao.common.sud.QuickStartGameViewModel; +import com.yunbao.common.sud.decorator.SudFSMMGDecorator; import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.sud.model.GameViewInfoModel; import com.yunbao.common.sud.state.SudMGPAPPState; diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index b5bff9e8b..923055085 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -29,6 +29,7 @@ import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.manager.MicUserManager; import com.yunbao.common.manager.MicedUserManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; @@ -181,7 +182,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(bean.getId(), conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/bean/ImUserBean.java b/live/src/main/java/com/yunbao/live/bean/ImUserBean.java index d83fea755..9bc4ba7f9 100644 --- a/live/src/main/java/com/yunbao/live/bean/ImUserBean.java +++ b/live/src/main/java/com/yunbao/live/bean/ImUserBean.java @@ -2,8 +2,11 @@ package com.yunbao.live.bean; import android.text.TextUtils; +import com.alibaba.fastjson.annotation.JSONField; import com.google.gson.annotations.SerializedName; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.WordUtil; import java.text.SimpleDateFormat; import java.util.Date; @@ -30,8 +33,21 @@ public class ImUserBean extends BaseModel { String _method_ = "";//融雲消息類型 @SerializedName("new_image") private String newImage; + @JSONField(name = "en_image") + private String newImageEn; + + public String getNewImageEn() { + return newImageEn; + } + + public void setNewImageEn(String newImageEn) { + this.newImageEn = newImageEn; + } public String getNewImage() { + if (!WordUtil.isNewZh() && !StringUtil.isEmpty(newImageEn)) { + return newImageEn; + } return newImage; } diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java index d20aafde1..689d3d344 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.annotation.JSONField; import com.google.gson.annotations.SerializedName; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.WordUtil; /** @@ -28,7 +29,7 @@ public class LiveChatBean { public static final int XYD_COMPLETE = 207;//心愿单完成通知 public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 public static final int BLIND_BOX = 409;//盲盒礼物消息 - public static final int TYPE_TO_USER_MSG=500;//指定信息 + public static final int TYPE_TO_USER_MSG = 500;//指定信息 private String id; @@ -47,6 +48,7 @@ public class LiveChatBean { private String bubble;//气泡 private String medal;//勋章 private String medal_new; + private String medal_new_en; private String medal_honor;//荣誉勋章 private String hot_num; private String good_nub; @@ -65,7 +67,7 @@ public class LiveChatBean { } public String getGiftName() { - return WordUtil.isNewZh()?giftName:giftname_en; + return WordUtil.isNewZh() ? giftName : giftname_en; } public LiveChatBean setGiftName(String giftName) { @@ -225,6 +227,9 @@ public class LiveChatBean { } public String getMedal_new() { + if (!WordUtil.isNewZh() && !StringUtil.isEmpty(medal_new_en)) { + return medal_new_en; + } return medal_new; } @@ -232,6 +237,10 @@ public class LiveChatBean { this.medal_new = medal_new; } + public void setMedal_new_en(String medal_new_en) { + this.medal_new_en = medal_new_en; + } + public String getPrankIcon() { return prankIcon; } diff --git a/live/src/main/java/com/yunbao/live/dialog/BlowkissDialog.java b/live/src/main/java/com/yunbao/live/dialog/BlowkissDialog.java index 97e0459c3..bc621bf8c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/BlowkissDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/BlowkissDialog.java @@ -13,7 +13,7 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.ToastUtil; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java index 4d3ab6ff5..164dbd564 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -30,7 +30,7 @@ import com.lxj.xpopup.XPopup; import com.lxj.xpopup.enums.PopupPosition; import com.makeramen.roundedimageview.RoundedImageView; import com.stx.xhb.androidx.XBanner; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter; import com.yunbao.common.bean.CheckUpgradesModel; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java index a0ea8c6ca..d43169977 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java @@ -18,7 +18,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.lxj.xpopup.XPopup; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.glide.ImgLoader; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java index 17c6e8f27..a60ca04c8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java @@ -23,7 +23,7 @@ import androidx.annotation.Nullable; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.android.material.tabs.TabLayout; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.ActiveModel; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index 718d1f0ee..f1069d325 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -44,7 +44,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.R; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java index 13721933c..656fcc4ae 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGuardDialog.java @@ -17,7 +17,7 @@ import com.alibaba.fastjson.JSON; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; import com.opensource.svgaplayer.SVGAImageView; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.CheckUpgradesModel; @@ -291,11 +291,11 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); htmlUrl.append(CommonAppConfig.HOST) .append("/h5/Guard/mission.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")); @@ -317,11 +317,11 @@ public class LiveGuardDialog extends AbsDialogPopupWindow { IMLoginModel userInfo = IMLoginManager.get(mContext).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")); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java index 810818473..5b07ec822 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java @@ -27,7 +27,7 @@ import android.widget.RadioGroup; import androidx.fragment.app.FragmentActivity; import com.blankj.utilcode.util.GsonUtils; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.Constants; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.NobleTrumpetModel; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java index 0922fa572..d41a0b83c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java @@ -25,6 +25,7 @@ import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; @@ -204,7 +205,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -253,7 +254,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index 4ab67742a..da6d5452b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -22,7 +22,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.FansModel; diff --git a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java index c08778b6b..b871f19cf 100644 --- a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java @@ -4,6 +4,7 @@ import android.content.Context; import android.os.Handler; import android.text.TextUtils; import android.util.TypedValue; +import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; @@ -97,6 +98,12 @@ public class ReceiveRendPacketPopup extends CenterPopupView { .getString(R.string.together_to_achieve_goal), redPacketInfoModel.getUserNicename())); } + if(redPacketInfoModel.getRedPacketType()==2){ + ((ImageView)findViewById(R.id.value_icon)).setImageResource(R.mipmap.gold_coin); + redPacketValue.setText(redPacketInfoModel.getRedPacketMoney()); + findViewById(R.id.red_packet_list).setVisibility(View.INVISIBLE); + findViewById(R.id.tips).setVisibility(View.INVISIBLE); + } userID = redPacketInfoModel.getUserId(); diff --git a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java index 153709be1..47de75da6 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java @@ -2,7 +2,9 @@ package com.yunbao.live.dialog; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Color; import android.text.Editable; import android.text.TextUtils; @@ -16,13 +18,15 @@ import androidx.annotation.NonNull; import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.core.CenterPopupView; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; +import com.yunbao.live.event.LiveAudienceEvent; public class SendRendPacketPopup extends CenterPopupView { private Button thereIsNo, followingAnchor, joinFansGroup; @@ -31,6 +35,8 @@ public class SendRendPacketPopup extends CenterPopupView { private FrameLayout redPacketIllustrate; private ImageView iconInstructions, illustrateClose; private String mLiveID, conditions = "0"; + private DialogInterface onDismissListener; + private boolean sendSuccess; public SendRendPacketPopup(@NonNull Context context, String liveID) { super(context); @@ -51,6 +57,23 @@ public class SendRendPacketPopup extends CenterPopupView { initView(); } + public void setOnDismissListener(DialogInterface onDismissListener) { + this.onDismissListener = onDismissListener; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + + if (sendSuccess) { + // onDismissListener.dismiss(); + } else { + // onDismissListener.cancel(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)); + } + } + private void initView() { thereIsNo = findViewById(R.id.there_is_no); followingAnchor = findViewById(R.id.following_anchor); @@ -222,6 +245,7 @@ public class SendRendPacketPopup extends CenterPopupView { MobclickAgent.onEvent(getContext(), "gif_list_redpk_seed", "用户发送红包"); ToastUtil.show(getContext().getString(R.string.red_envelope_released_successfully)); + sendSuccess = true; dismiss(); } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 30de0e49e..4a8c493d2 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -491,6 +491,7 @@ public class LiveAudienceEvent extends BaseModel { PK_RANK_START(76, "PK排位赛开始"), GuardSpecialEffect(77, "PK排位赛开始"), LIVE_DIALOG_ANCHOR_TIPS(78, "主播公会赛tips"); + private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index 1696e56af..d5eea4f3f 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -39,7 +39,7 @@ import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.utils.SVGARect; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; @@ -101,6 +101,7 @@ import pl.droidsonroids.gif.GifImageView; /** * Created by cxf on 2018/10/13. * 产品让改礼物效果 + * 全服通知效果实现 */ public class LiveGiftAnimPresenter { @@ -382,7 +383,12 @@ public class LiveGiftAnimPresenter { } }, 1000); } else { - changeLiveRoom(); + if (mIvLook.getTag()!=null&&mIvLook.getTag()instanceof LiveReceiveGiftBean){ + changeLiveRoom((LiveReceiveGiftBean) mIvLook.getTag()); + }else { + changeLiveRoom(); + } + } } @@ -430,12 +436,57 @@ public class LiveGiftAnimPresenter { } }); } + private void changeLiveRoom(LiveReceiveGiftBean mTempGifGiftBean) { + if (mTempGifGiftBean != null) { + String uid = mTempGifGiftBean.getUid(); + String userId = CommonAppConfig.getInstance().getUid(); + if (!TextUtils.isEmpty(mLiveUid)) { + userId = mLiveUid; + } + if (userId.equals(uid)) { + ToastUtil.show(WordUtil.isNewZh() ? "已在当前直播间" : "Already in the current studio"); + return; + } + } + if (mTempGifGiftBean.getRoomnum() == null || mTempGifGiftBean.getRoomnum().isEmpty()) { + return; + } + LiveHttpUtil.getLiveInfo(mTempGifGiftBean.getRoomnum(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; + } + if (MicStatusManager.getInstance().isMic(liveUid)) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + } + }); + } private void changeLiveRoom() { if (mTempGifGiftBean != null) { String uid = mTempGifGiftBean.getUid(); String userId = CommonAppConfig.getInstance().getUid(); + if (!TextUtils.isEmpty(mLiveUid)) { + userId = mLiveUid; + } if (userId.equals(uid)) { ToastUtil.show(WordUtil.isNewZh() ? "已在当前直播间" : "Already in the current studio"); return; @@ -1008,11 +1059,13 @@ public class LiveGiftAnimPresenter { superNotice.setBackgroundResource(R.mipmap.super_notice); mIvLook.setText(R.string.live_onlookers); mAncherName = mTempGifGiftBean.getAncherName(); + mRoomNum = bean.getRoomnum(); mGifGiftTipAllServer.setSelected(false); mGifGiftTipGroupAllServer.setAlpha(1f); mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE); textRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, ""); mIvLook.setVisibility(View.VISIBLE); + mIvLook.setTag(bean); mGifGiftTipShowAnimatorAllServer.start(); } @@ -1137,12 +1190,12 @@ public class LiveGiftAnimPresenter { int unameSize = textMsg.length(); builder.setSpan(new ForegroundColorSpan(Color.parseColor(dto.getColour())), unameIndexOf, unameIndexOf + unameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } - if (!showB){ + if (!showB) { iv_look_full_service_notice_new3.setVisibility(View.GONE); - }else { - if (TextUtils.equals(event.getJumpType(),"0")){ + } else { + if (TextUtils.equals(event.getJumpType(), "0")) { iv_look_full_service_notice_new3.setVisibility(View.GONE); - }else { + } else { iv_look_full_service_notice_new3.setVisibility(View.VISIBLE); } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 4811ff0a2..43d7438ef 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -13,6 +13,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -55,7 +56,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -99,6 +100,7 @@ public class SocketRyChatUtil { .param("medal_honor", u.getMedal_no_display_src()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("uid", u.getId()) .param("liangname", u.getGoodName()) .param("vip_type", u.getVip().getType()) @@ -120,7 +122,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -180,6 +182,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) .param("medal_name", u.getMedalName()) .param("medal_level", u.getMedalLevel()) @@ -190,7 +193,7 @@ public class SocketRyChatUtil { Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -254,7 +257,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -307,6 +310,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("medal_name", u.getMedalName()) .param("medal_level", u.getMedalLevel()) .param("guard_type", guard_type + "") @@ -346,6 +350,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("ct", giftToken) .param("ancherName", ancherName) .param("medal_name", u.getMedalName()) @@ -391,7 +396,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -461,7 +466,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -508,7 +513,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -545,7 +550,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -588,7 +593,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -625,7 +630,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -665,7 +670,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -711,6 +716,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("uname", u.getUserNiceName()) .param("uhead", u.getAvatar()) .param("votestotal", votes) @@ -741,6 +747,7 @@ public class SocketRyChatUtil { .param("bubble", u.getDress().getBubble()) .param("medal", u.getDress().getMedal()) .param("medal_new", u.getDress().getMedal_new()) + .param("medal_new_en", u.getDress().getMedal_new_en()) .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()); msg.create(); @@ -769,7 +776,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 26be83560..f6b19583b 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -52,6 +52,7 @@ import com.yunbao.common.manager.MicedUserManager; import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.manager.RandomPkManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; diff --git a/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java b/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java index 4b22131a8..036739a01 100644 --- a/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java @@ -5,7 +5,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; diff --git a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java index 6d1cb9785..10f396bb5 100644 --- a/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FrameGiftViewHolder.java @@ -19,7 +19,7 @@ import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.glide.ImgLoader; diff --git a/live/src/main/java/com/yunbao/live/views/GiftTitleViewHolder.java b/live/src/main/java/com/yunbao/live/views/GiftTitleViewHolder.java index 4e4e54406..854fe4b61 100644 --- a/live/src/main/java/com/yunbao/live/views/GiftTitleViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/GiftTitleViewHolder.java @@ -6,7 +6,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.custom.DrawableTextView; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 508d1aeae..fdf3883ba 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -25,7 +25,7 @@ import android.widget.ViewFlipper; import androidx.fragment.app.FragmentActivity; import com.lxj.xpopup.XPopup; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; diff --git a/live/src/main/java/com/yunbao/live/views/LiveGiftFragment.java b/live/src/main/java/com/yunbao/live/views/LiveGiftFragment.java index 79fa3a667..7d98e4ed6 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveGiftFragment.java +++ b/live/src/main/java/com/yunbao/live/views/LiveGiftFragment.java @@ -16,7 +16,7 @@ import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; import com.alibaba.fastjson.JSON; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.manager.IMLoginManager; diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 7eed8bad4..cb714ade5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -62,7 +62,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; @@ -1644,6 +1644,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private Runnable timeRunnable = new Runnable() { @Override public void run() { + Log.i("红包", "run: 红包倒计时 "+redTimeCountdown); if (redTimeCountdown > 1) { timeHandler.postDelayed(timeRunnable, 1000); redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown))); @@ -1669,6 +1670,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private Runnable anchorTimeRunnable = new Runnable() { @Override public void run() { + Log.i("红包", "anchorTimeRunnable run: "+mCountdown); if (mCountdown > 0) { mCountdown = mCountdown - 1; anchorTimeHandler.postDelayed(anchorTimeRunnable, 1000); @@ -1693,6 +1695,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); layoutParams.topMargin = DpUtil.dp2px(110); dragonImmediateParticipation.setLayoutParams(layoutParams); + } if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); } anchorTimeHandler.removeCallbacks(anchorTimeRunnable); LiveNetManager.get(mContext). @@ -1725,6 +1731,20 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutParams.topMargin = DpUtil.dp2px(190); dragonImmediateParticipation.setLayoutParams(layoutParams); } + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE&&mContext instanceof LiveRyAnchorActivity) { + RelativeLayout.LayoutParams layoutParamsredPacket = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); + layoutParamsredPacket.topMargin = DpUtil.dp2px(110); + redPacket.setLayoutParams(layoutParamsredPacket); + + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipationTime.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } + if (dragonImmediateParticipationTime.getVisibility() == View.GONE&&mContext instanceof LiveRyAnchorActivity){ + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + redPacket.setLayoutParams(layoutParams); + } if (redPacketModel.getCountdown() > 180) { redPacketQueue.setVisibility(View.GONE); redPacketCountdown.setVisibility(View.VISIBLE); @@ -1801,6 +1821,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutParams.topMargin = DpUtil.dp2px(110); dragonImmediateParticipation.setLayoutParams(layoutParams); } + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipationTime.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } } public void setRedPacketInfoModel(RedPacketInfoModel redPacket) { @@ -3207,6 +3232,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis sendMoneyTime = Long.parseLong(sendMoneyLongModel.getCountdown()); participation_time.removeCallbacks(sendMoneyRunnable); dragonImmediateParticipationTime.setVisibility(View.VISIBLE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } String s1 = StringUtil.getDurationText(sendMoneyTime * 1000); participation_time.setText(s1); participation_time.post(sendMoneyRunnable); @@ -3228,6 +3262,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void onSendMoneyLongEndEvent(SendMoneyLongEndEvent moneyLongEndEvent) { if (mLiveUid.contains(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()))) { dragonImmediateParticipationTime.setVisibility(View.GONE); + if (redPacket.getVisibility() == View.VISIBLE) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(190); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } else { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) dragonImmediateParticipation.getLayoutParams(); + layoutParams.topMargin = DpUtil.dp2px(110); + dragonImmediateParticipationTime.setLayoutParams(layoutParams); + } } else { dragonImmediateParticipation.setVisibility(View.GONE); @@ -3983,6 +4026,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (mLiveGiftAnimPresenter == null) { mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); } + mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid,mStream); mLiveGiftAnimPresenter.showGiftAnim(bean, isAncher); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 51769d176..9d0196c0d 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -29,7 +29,8 @@ import com.blankj.utilcode.util.GsonUtils; import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.utils.LifecycleUtils; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; @@ -767,6 +768,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.initPkRank(null); + String pkUid = pkInfo.getString("pkuid"); + if (!StringUtil.isEmpty(pkUid)) { + //初始化天梯赛信息 + mLiveRoomViewHolder.initRankPKInfo(String.valueOf(data.getLiveInfo().getUid()), pkUid); + } } if (mLivePlayViewHolder != null) { JSONArray array = pkInfo.getJSONArray("userlist"); @@ -1110,7 +1116,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(liveID, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java index 380099102..8234d581c 100644 --- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java @@ -59,6 +59,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemLongClickListener; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SpUtil; @@ -589,7 +590,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli messagesList.remove(position); setDellPosition(position); } - RongIMClient.getInstance().sendMessage(inMessage, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(inMessage, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/live/src/main/res/layout/activity_compensate.xml b/live/src/main/res/layout/activity_compensate.xml index 3eec71ab9..f6a09f57a 100644 --- a/live/src/main/res/layout/activity_compensate.xml +++ b/live/src/main/res/layout/activity_compensate.xml @@ -99,7 +99,7 @@ diff --git a/live/src/main/res/layout/item_msg_sys_gift.xml b/live/src/main/res/layout/item_msg_sys_gift.xml index 3b3a8730c..fb67f8078 100644 --- a/live/src/main/res/layout/item_msg_sys_gift.xml +++ b/live/src/main/res/layout/item_msg_sys_gift.xml @@ -2,7 +2,8 @@ - + + android:visibility="invisible"> + + + \ No newline at end of file diff --git a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java index 6eb699604..5f91acbfb 100644 --- a/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/BattlePassActivity.java @@ -6,6 +6,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; import android.os.Bundle; +import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; @@ -21,6 +22,7 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.lxj.xpopup.XPopup; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.BattlePassUserInfoBean; +import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.LiveBattlePassRewardsBean; import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow; import com.yunbao.common.dialog.ActivityEndPopupWindow; @@ -69,6 +71,7 @@ public class BattlePassActivity extends AbsActivity { Button moreIntegralButton; String enjoySpendMoney = ""; String quintessenceSpendMoney = ""; + Button allGet; BattlePassUserInfoBean data; @@ -99,6 +102,7 @@ public class BattlePassActivity extends AbsActivity { tab3 = findViewById(R.id.tab_3); expText = findViewById(R.id.exp_text); viewPager = findViewById(R.id.context_layout); + allGet = findViewById(R.id.all_get); fragments.add(new BattlePassRewardFragment(() -> data)); fragments.add(new BattlePassMissionFragment(() -> data)); fragments.add(new BattlePassExchangeFragment(() -> data)); @@ -171,21 +175,44 @@ public class BattlePassActivity extends AbsActivity { .show(); } }); + ViewClicksAntiShake.clicksAntiShake(allGet, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(mContext) + .getRewards("0", "0", new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + ToastUtil.show(data.getMsg()); + initData(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); } private void clickView(int position) { switch (position) { case 0: + if (allGet.getTag() != null) { + allGet.setVisibility(View.VISIBLE); + } tab1.setImageResource(R.mipmap.ic_zl_tab1); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); break; case 1: + event(new BattlePassTypeEvent(2)); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2); tab3.setImageResource(R.mipmap.ic_zl_tab3_unselect); break; case 2: + event(new BattlePassTypeEvent(2)); tab1.setImageResource(R.mipmap.ic_zl_tab1_unselect); tab2.setImageResource(R.mipmap.ic_zl_tab2_unselect); tab3.setImageResource(R.mipmap.ic_zl_tab3); @@ -210,8 +237,8 @@ public class BattlePassActivity extends AbsActivity { levelView.setText("Lv." + data.getLevel()); expText.setText(data.getBattlePassExp() + "/" + (data.getNextLevelExp() == 0 ? data.getBattlePassExp() : data.getNextLevelExp())); - levelProgressView.setMax(data.getNextLevelExp()-data.getLastLevelExp()); - levelProgressView.setProgress(data.getBattlePassExp()-data.getLastLevelExp()); + levelProgressView.setMax(data.getNextLevelExp() - data.getLastLevelExp()); + levelProgressView.setProgress(data.getBattlePassExp() - data.getLastLevelExp()); integralView.setText(String.format(WordUtil.getNewString(R.string.battlepass_user_my_integral), data.getPoints())); for (LiveBattlePassRewardsBean.BattlePassType passType : data.getLive_battle_pass_type()) { @@ -251,6 +278,11 @@ public class BattlePassActivity extends AbsActivity { public void event(BattlePassTypeEvent event) { if (event.getType() == 0) { initData(); + } else if (event.getType() == 1) { + allGet.setVisibility(View.VISIBLE); + allGet.setTag(event.getBean()); + } else if (event.getType() == 2) { + allGet.setVisibility(View.GONE); } } } diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index e21d251eb..24c1a7060 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -612,7 +612,7 @@ public class EntryActivity extends AppCompatActivity { Contexts.startActivity(new Intent(Contexts, BindUserActivity.class).putExtra("uid", uid).putExtra("token", token)); } } else { - ToastUtil.show(msg + "11212"); + ToastUtil.show(msg); } } diff --git a/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java b/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java new file mode 100644 index 000000000..4b9984982 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java @@ -0,0 +1,82 @@ +package com.yunbao.main.activity; + +import android.app.Dialog; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.main.R; +import com.yunbao.main.http.MainHttpUtil; + +@Route(path = RouteUtil.PATH_FEEDBACK_ACTIVITY) +public class FeedbackActivity extends AbsActivity { + @Override + protected int getLayoutId() { + return R.layout.activity_feedback; + } + + @Override + protected void main() { + super.main(); + setTitle(WordUtil.getNewString(R.string.activity_feedback_top_title)); + setTitleBold(true); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_cs), new ViewClicksAntiShake.ViewClicksCallBack() { + Dialog loading; + @Override + public void onViewClicks() { + //TODO 客服 + loading= DialogUitl.loadingDialog(mContext); + loading.show(); + MainHttpUtil.getCustomerService(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + loading.dismiss(); + loading=null; + if (info.length == 1) { + String url = info[0]; + RouteUtil.forwardCustomerService(url); + } + } + + @Override + public void onError() { + super.onError(); + loading.dismiss(); + loading=null; + } + }); + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_feedback), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + //TODO 意见反馈 + LiveNetManager.get(mContext) + .checkFeedback(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + if (data.getCode() == 0) { + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY); + } else { + ToastUtil.show(R.string.activity_feedback_edit_submit_tip3); + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + } + }); + } +} diff --git a/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java b/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java new file mode 100644 index 000000000..61a3df228 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java @@ -0,0 +1,396 @@ +package com.yunbao.main.activity; + +import android.app.Dialog; +import android.graphics.Color; +import android.text.Editable; +import android.text.InputFilter; +import android.text.Spanned; +import android.text.TextWatcher; +import android.util.SparseArray; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.alibaba.fastjson.JSONArray; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.dialog.ImagePreviewDialog; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.ImageResultCallback; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.ProcessImageUtil; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.main.R; + +import java.io.File; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Route(path = RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY) +public class FeedbackEditActivity extends AbsActivity { + EditText feedbackEdit; + ImageView img1, img2, img3; + EditText ciEdit; + Button submit; + TextView editNumber; + ProcessImageUtil imageUtil; + Dialog loadingDialog = null; + int clickImage = 0; + View img1Layout, img2Layout, img3Layout; + View img1Del, img2Del, img3Del; + + @Override + protected int getLayoutId() { + return R.layout.activity_feedback_edit; + } + + @Override + protected void main() { + super.main(); + setTitle(WordUtil.getNewString(R.string.activity_feedback_edit_feedback_top)); + setTitleBold(true); + initView(); + imageUtil = new ProcessImageUtil(this); + feedbackEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(501)}); + ciEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(30), new InputFilter() { + @Override + public CharSequence filter(CharSequence charSequence, int i, int i1, Spanned spanned, int i2, int i3) { + /* String regex = "[A-Za-z0-9]+"; // 正则表达式 + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(charSequence.toString()); + if (matcher.matches()) { + return null; + } + return "";*/ + return null; + } + }}); + feedbackEdit.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + if (charSequence.length() >= 500) { + editNumber.setTextColor(Color.parseColor("#FF5656")); + } else { + editNumber.setTextColor(Color.parseColor("#333333")); + } + + editNumber.setText(String.format(Locale.getDefault(), "%d", charSequence.length())); + } + + @Override + public void afterTextChanged(Editable editable) { + if (editable.length() > 500) { + ToastUtil.show(R.string.activity_feedback_edit_submit_tip2); + feedbackEdit.setText(editable.toString().substring(0, 500)); + feedbackEdit.setSelection(feedbackEdit.getText().length()); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(img1, () -> { + clickImage = 101; + if (img1.getTag() == null) { + uploadImage(img1); + } else { + showImage(img1); + } + }); + ViewClicksAntiShake.clicksAntiShake(img2, () -> { + clickImage = 201; + if (img2.getTag() == null) { + uploadImage(img2); + } else { + showImage(img2); + } + }); + ViewClicksAntiShake.clicksAntiShake(img3, () -> { + clickImage = 301; + if (img3.getTag() == null) { + uploadImage(img3); + } else { + showImage(img3); + } + }); + ViewClicksAntiShake.clicksAntiShake(img1Del, () -> { + deleteImage(1); + }); + ViewClicksAntiShake.clicksAntiShake(img2Del, () -> { + deleteImage(2); + }); + ViewClicksAntiShake.clicksAntiShake(img3Del, () -> { + deleteImage(3); + }); + ViewClicksAntiShake.clicksAntiShake(submit, () -> { + if (feedbackEdit.getText().length() == 0) { + ToastUtil.show(R.string.activity_feedback_edit_submit_tip1); + return; + } + JSONArray images = new JSONArray(); + if (img1.getTag() != null) { + images.add(((String) img1.getTag()).replace("https://downs.yaoulive.com/" ,"")); + } + if (img2.getTag() != null) { + images.add(((String) img2.getTag()).replace("https://downs.yaoulive.com/" ,"")); + } + if (img3.getTag() != null) { + images.add(((String) img3.getTag()).replace("https://downs.yaoulive.com/" ,"")); + } + LiveNetManager.get(mContext) + .feedback(feedbackEdit.getText().toString(), + images, + ciEdit.getText().toString(), + new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + finish(); + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_SUCCESS_ACTIVITY); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + } + ); + + }); + img1.setOnLongClickListener(view -> { + ToastUtil.showDebug("1"); + return true; + }); + img2.setOnLongClickListener(view -> { + ToastUtil.showDebug("2"); + return true; + }); + img3.setOnLongClickListener(view -> { + ToastUtil.showDebug("3"); + return true; + }); + imageUtil.setImageResultCallback(new ImageResultCallback() { + + + @Override + public void onSuccess(File file) { + ToastUtil.showDebug("图片地址:" + file.getAbsolutePath()); + onSuccessToQiNiuUrl(mContext, file, new OnItemClickListener() { + @Override + public void onItemClick(String bean, int position) { + if (loadingDialog != null) { + loadingDialog.dismiss(); + loadingDialog = null; + } + switch (clickImage) { + case 101: + case 112: + setShowImage(img1, img1Del, bean); + if (img2.getTag() == null) { + setDefImage(img2, img2Del, img2Layout); + } else if (img3.getTag() == null) { + setDefImage(img3, img3Del, img3Layout); + } + break; + case 201: + case 212: + setShowImage(img2, img2Del, bean); + if (img3.getTag() == null) { + setDefImage(img3, img3Del, img3Layout); + } + break; + case 301: + case 312: + setShowImage(img3, img3Del, bean); + break; + } + } + }); + } + + @Override + public void onFailure() { + super.onFailure(); + if (loadingDialog != null) { + loadingDialog.dismiss(); + loadingDialog = null; + } + } + }); + } + + private void showImage(ImageView iv) { + ImagePreviewDialog dialog = new ImagePreviewDialog(); + dialog.setImageInfo(1, 1, false, new ImagePreviewDialog.ActionListener() { + @Override + public void loadImage(ImageView imageView, int position) { + ImgLoader.display(mContext, (String) iv.getTag(), imageView); + } + + @Override + public void onDeleteClick(int position) { + + } + }); + dialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "ImagePreviewDialog"); + + } + + private void showUploadImage(SparseArray list) { + DialogUitl.showStringArrayDialog(mContext, list, new DialogUitl.StringArrayDialogCallback() { + @Override + public void onItemClick(String text, int tag) { + clickImage = tag; + switch (tag) { + case 101: + uploadImage(img1); + break; + case 201: + uploadImage(img2); + break; + case 301: + uploadImage(img3); + break; + case 111: + deleteImage(1); + break; + case 211: + deleteImage(2); + break; + case 311: + deleteImage(3); + break; + case 112: + changeImage(img1); + break; + case 212: + changeImage(img2); + break; + case 312: + changeImage(img3); + break; + } + } + }); + } + + private void uploadImage(ImageView imageView) { + if (loadingDialog != null) { + loadingDialog.dismiss(); + loadingDialog = null; + } + SparseArray array = new SparseArray<>(); + array.put(1, WordUtil.getNewString(R.string.activity_feedback_edit_img_select)); + array.put(2, WordUtil.getNewString(R.string.activity_feedback_edit_img_camera)); + DialogUitl.showStringArrayDialog(mContext, array, new DialogUitl.StringArrayDialogCallback() { + @Override + public void onItemClick(String text, int tag) { + loadingDialog = DialogUitl.loadingDialog(mContext); + loadingDialog.show(); + if (tag == 1) { + imageUtil.getImageByAlumb(false); + } else { + imageUtil.getImageByCamera(false); + } + } + }); + + } + + private void deleteImage(int index) { + if (index == 1) { + if (img2.getTag() != null) { + img1.setTag(img2.getTag()); + ImgLoader.display(mContext, (String) img1.getTag(), img1); + if (img3.getTag() != null) { + img2.setTag(img3.getTag()); + ImgLoader.display(mContext, (String) img2.getTag(), img2); + setDefImage(img3, img3Del, img3Layout); + } else { + setDefImage(img2, img2Del, img2Layout); + setGoneImage(img3, img3Del, img3Layout); + } + } else { + setDefImage(img1, img1Del, img1Layout); + setGoneImage(img2, img2Del, img2Layout); + setGoneImage(img3, img3Del, img3Layout); + } + } else if (index == 2) { + if (img3.getTag() != null) { + img2.setTag(img3.getTag()); + ImgLoader.display(mContext, (String) img2.getTag(), img2); + setDefImage(img3, img3Del, img3Layout); + } else { + setDefImage(img2, img2Del, img2Layout); + setGoneImage(img3, img3Del, img3Layout); + } + } else if (index == 3) { + setDefImage(img3, img3Del, img3Layout); + } + + } + + private void setDefImage(ImageView iv, View ivDel, View ivLayout) { + iv.setTag(null); + ivDel.setVisibility(View.GONE); + iv.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add); + ivLayout.setVisibility(View.VISIBLE); + } + + private void setGoneImage(ImageView iv, View ivDel, View ivLayout) { + iv.setTag(null); + ivDel.setVisibility(View.GONE); + ivLayout.setVisibility(View.GONE); + } + + private void setShowImage(ImageView iv, View ivDel, String url) { + iv.setTag(url); + ImgLoader.display(mContext, url, iv); + ivDel.setVisibility(View.VISIBLE); + } + + private void changeImage(ImageView imageView) { + uploadImage(imageView); + } + + private SparseArray getImageType1(int key) { + SparseArray array = new SparseArray<>(); + array.put(key + 1, WordUtil.getNewString(R.string.activity_feedback_edit_img_type1_upload)); + return array; + } + + private SparseArray getImageType2(int key) { + SparseArray array = new SparseArray<>(); + array.put(key + 1, WordUtil.getNewString(R.string.activity_feedback_edit_img_type2_delete)); + array.put(key + 2, WordUtil.getNewString(R.string.activity_feedback_edit_img_type2_change)); + return array; + } + + private void initView() { + feedbackEdit = findViewById(R.id.tv_feedback); + ciEdit = findViewById(R.id.edit_ci); + img1 = findViewById(R.id.img1); + img2 = findViewById(R.id.img2); + img3 = findViewById(R.id.img3); + img1Layout = findViewById(R.id.img1Layout); + img2Layout = findViewById(R.id.img2Layout); + img3Layout = findViewById(R.id.img3Layout); + img1Del = findViewById(R.id.img1_del); + img2Del = findViewById(R.id.img2_del); + img3Del = findViewById(R.id.img3_del); + submit = findViewById(R.id.btn_sub); + editNumber = findViewById(R.id.tv_number); + editNumber.setTextColor(Color.parseColor("#333333")); + } +} diff --git a/main/src/main/java/com/yunbao/main/activity/FeedbackSuccessActivity.java b/main/src/main/java/com/yunbao/main/activity/FeedbackSuccessActivity.java new file mode 100644 index 000000000..c44e85a2a --- /dev/null +++ b/main/src/main/java/com/yunbao/main/activity/FeedbackSuccessActivity.java @@ -0,0 +1,29 @@ +package com.yunbao.main.activity; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.main.R; + +@Route(path = RouteUtil.PATH_FEEDBACK_SUCCESS_ACTIVITY) +public class FeedbackSuccessActivity extends AbsActivity { + @Override + protected int getLayoutId() { + return R.layout.activity_feedback_success; + } + + @Override + protected void main() { + super.main(); + setTitleBold(true); + setTitle(WordUtil.getNewString(R.string.activity_feedback_edit_feedback_top)); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sub), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + finish(); + } + }); + } +} diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index c035f6c70..377949726 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -49,7 +49,7 @@ import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSDKConfig; import com.tencent.imsdk.v2.V2TIMSDKListener; import com.tencent.imsdk.v2.V2TIMUserFullInfo; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; @@ -652,6 +652,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } if (data.getShowWarOrder() == 0) { floatWarOrder.setVisibility(View.GONE); + floatWarOrder.setTag(null); //战令关闭情况下,在判断一次Banner是否足够 if (data.getListShow() == 1 && data.getList().size() > 2) { floatBanner.setVisibility(View.VISIBLE); @@ -664,8 +665,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } else { if (mainHomeViewHolder != null && mainHomeViewHolder.isFloatWarOrder()) { floatWarOrder.setVisibility(View.GONE); + floatWarOrder.setTag(null); } else { floatWarOrder.setVisibility(View.VISIBLE); + floatWarOrder.setTag(data); } floatBanner.setVisibility(View.GONE); @@ -1513,10 +1516,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Subscribe(threadMode = ThreadMode.MAIN) public void onFloatWarOrderEvent(FloatWarOrderEvent event) { - if (event.isFloatWarOrder()) { + /* if (event.isFloatWarOrder()) { floatWarOrder.setVisibility(View.GONE); } else { floatWarOrder.setVisibility(View.VISIBLE); + }*/ + if(floatWarOrder.getTag()!=null){ + floatWarOrder.setVisibility(View.VISIBLE); + }else{ + floatWarOrder.setVisibility(View.GONE); } } diff --git a/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java b/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java index 3d39a2049..8002a199a 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainHomeCommunityActivity.java @@ -9,7 +9,7 @@ import androidx.fragment.app.FragmentTransaction; import com.alibaba.android.arouter.facade.annotation.Route; import com.lzf.easyfloat.EasyFloat; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.manager.IMLoginManager; diff --git a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java index 528ed24d6..018a7dc60 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainListActivity.java @@ -20,7 +20,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.adapter.ViewPagerAdapter; diff --git a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java index defcce9c1..5d50f0f66 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java @@ -18,7 +18,7 @@ import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.alibaba.android.arouter.facade.annotation.Route; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.fragment.LoadingDialog; diff --git a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java index 6a02c7f26..82104fa30 100644 --- a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java @@ -17,7 +17,7 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import com.alibaba.fastjson.JSON; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.CloseEvent; diff --git a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java index b34529661..b1af4fb45 100644 --- a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java @@ -285,9 +285,9 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< } else { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioRideEffects); } - if(IMLoginManager.get(mContext).isLiveNotifySettings()){ + if (IMLoginManager.get(mContext).isLiveNotifySettings()) { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, liveNotifySettings); - }else{ + } else { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, liveNotifySettings); } } @@ -316,12 +316,16 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< .show(); } + } else if (bean.getId() == 17 || bean.getId() == 26) { + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); } } else { - if (bean.getId() == 17) {//意见反馈要在url上加版本号和设备号 + if (bean.getId() == 17 || bean.getId() == 26) {//意见反馈要在url上加版本号和设备号 href += "&version=" + android.os.Build.VERSION.RELEASE + "&model=" + android.os.Build.MODEL; + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); + } else { + WebViewActivity.forward(mContext, href, false); } - WebViewActivity.forward(mContext, href,false); } } diff --git a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java index 927b5b02c..9b3bc4e02 100644 --- a/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/ZhuangBanActivity.java @@ -34,6 +34,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; +import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.JavascriptInterfaceEvent; @@ -49,6 +50,7 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.main.R; @@ -86,6 +88,7 @@ public class ZhuangBanActivity extends AbsActivity { if (!"".equals(Constants.myPackageUrl)) { url = Constants.myPackageUrl; } + v_spacing = (View) findViewById(R.id.v_spacing); lt_title = (LinearLayout) findViewById(R.id.lt_title); LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView); @@ -102,13 +105,12 @@ public class ZhuangBanActivity extends AbsActivity { } L.e("H5---5>" + url); - mProgressBar = (ProgressBar) findViewById(R.id.progressbar); svga = (SVGAImageView) findViewById(R.id.svga); mWebView = new WebView(mContext); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.topMargin = DpUtil.dp2px(1); - params.bottomMargin = DpUtil.dp2px(15); + //params.bottomMargin = DpUtil.dp2px(15); mWebView.setLayoutParams(params); mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); rootView.addView(mWebView); @@ -194,6 +196,9 @@ public class ZhuangBanActivity extends AbsActivity { } mWebView.loadUrl(url); AndroidBug5497Workaround.assistActivity(this); + if(!StringUtil.isEmpty(url)&&url.startsWith(HtmlConfig.SHOP)){ + lt_title.setVisibility(View.GONE); + } } diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeFollowAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeFollowAdapter.java index d7cbd14fd..33d8d091a 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeFollowAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeFollowAdapter.java @@ -7,11 +7,13 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.RelativeLayout; import android.widget.TextView; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.DpUtil; import com.yunbao.main.R; import com.yunbao.common.bean.LiveBean; import com.yunbao.main.utils.MainIconUtil; @@ -64,6 +66,7 @@ public class MainHomeFollowAdapter extends RefreshAdapter { TextView mTitle; TextView mNum; ImageView mType; + private View redPacket, dragon_money; public Vh(View itemView) { super(itemView); @@ -73,6 +76,8 @@ public class MainHomeFollowAdapter extends RefreshAdapter { mTitle = (TextView) itemView.findViewById(R.id.title); mNum = (TextView) itemView.findViewById(R.id.num); mType = (ImageView) itemView.findViewById(R.id.type); + redPacket = itemView.findViewById(R.id.red_packet); + dragon_money = itemView.findViewById(R.id.dragon_money); itemView.setOnClickListener(mOnClickListener); } @@ -101,6 +106,21 @@ public class MainHomeFollowAdapter extends RefreshAdapter { mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); } // mType.setImageResource(MainIconUtil.getLiveTypeIcon(bean.getType())); + RelativeLayout.LayoutParams dragon_moneyLayoutParams = (RelativeLayout.LayoutParams) dragon_money.getLayoutParams(); + if (bean.getRedPacketStatus() == 1) { + dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(55); + redPacket.setVisibility(View.VISIBLE); + } else { + dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(25); + redPacket.setVisibility(View.GONE); + + } + if (bean.getSendMoneyLongStatus() == 1) { + dragon_money.setLayoutParams(dragon_moneyLayoutParams); + dragon_money.setVisibility(View.VISIBLE); + } else { + dragon_money.setVisibility(View.GONE); + } } } diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java index db8c75f09..62fe73882 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeRemFollLiveAdapter.java @@ -7,6 +7,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; @@ -19,6 +20,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.main.R; import com.yunbao.main.utils.MainIconUtil; @@ -79,11 +81,12 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter { ImageView dr_pk_ico; View views; ImageView bgs; - private View redPacket; + private View redPacket, dragon_money; public Vh(View itemView) { super(itemView); redPacket = itemView.findViewById(R.id.red_packet); + dragon_money = itemView.findViewById(R.id.dragon_money); live_info_view = (LinearLayout) itemView.findViewById(R.id.live_info_view); mCover = (ImageView) itemView.findViewById(R.id.cover); mName = (TextView) itemView.findViewById(R.id.name); @@ -222,10 +225,20 @@ public class MainHomeRemFollLiveAdapter extends RefreshAdapter { if (bean.getIs_week() != null && bean.getIs_week().equals("1")) { views.setVisibility(View.GONE); } + RelativeLayout.LayoutParams dragon_moneyLayoutParams = (RelativeLayout.LayoutParams) dragon_money.getLayoutParams(); if (bean.getRedPacketStatus() == 1) { + dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(55); redPacket.setVisibility(View.VISIBLE); } else { + dragon_moneyLayoutParams.topMargin = DpUtil.dp2px(25); redPacket.setVisibility(View.GONE); + + } + if (bean.getSendMoneyLongStatus() == 1) { + dragon_money.setLayoutParams(dragon_moneyLayoutParams); + dragon_money.setVisibility(View.VISIBLE); + } else { + dragon_money.setVisibility(View.GONE); } } diff --git a/main/src/main/java/com/yunbao/main/dialog/LoginTipsDialog.java b/main/src/main/java/com/yunbao/main/dialog/LoginTipsDialog.java index 6495ec9ba..6d6864be4 100644 --- a/main/src/main/java/com/yunbao/main/dialog/LoginTipsDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/LoginTipsDialog.java @@ -10,7 +10,6 @@ import android.view.Window; import android.view.WindowManager; import android.widget.Button; -import com.umeng.commonsdk.UMConfigure; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.utils.DpUtil; import com.yunbao.main.R; @@ -55,7 +54,7 @@ public class LoginTipsDialog extends AbsDialogFragment{ @Override public void onClick(View view) { //友盟预初始化 - UMConfigure.preInit(mContext,"64e40ee55488fe7b3afa2c96","PDLive"); + //UMConfigure.preInit(mContext,"64e40ee55488fe7b3afa2c96","PDLive"); EntryActivity.ToLogin(); dismiss(); } diff --git a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java index 9523d83af..f12065e51 100644 --- a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java +++ b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java @@ -23,7 +23,6 @@ import android.widget.LinearLayout; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.umeng.analytics.MobclickAgent; -import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; diff --git a/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java b/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java index 577f756c5..98540437a 100644 --- a/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java +++ b/main/src/main/java/com/yunbao/main/event/BattlePassTypeEvent.java @@ -6,6 +6,16 @@ import java.util.List; public class BattlePassTypeEvent { int type; + LiveBattlePassRewardsBean bean; + + public LiveBattlePassRewardsBean getBean() { + return bean; + } + + public BattlePassTypeEvent setBean(LiveBattlePassRewardsBean bean) { + this.bean = bean; + return this; + } public BattlePassTypeEvent(int liveBattlePassType) { this.type=liveBattlePassType; diff --git a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java index 389c7b1b7..11ee058cc 100644 --- a/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java +++ b/main/src/main/java/com/yunbao/main/fragment/BattlePassRewardFragment.java @@ -190,6 +190,11 @@ public class BattlePassRewardFragment extends BaseFragment { } } + if(data.getIs_received()>=2){ + Bus.get().post(new BattlePassTypeEvent(1).setBean(data)); + }else{ + Bus.get().post(new BattlePassTypeEvent(2).setBean(data)); + } Collection> values = data.getLive_battle_pass_rewards().values(); List> list = new ArrayList<>(values); /* list.get(1).get(1).setReceived(2); diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 48ad065a4..eef8e6b27 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -517,6 +517,7 @@ public class MainHttpUtil { .params("mobile", mobile) .params("sign", sign) .params("source", "1") + .params("langue", WordUtil.isNewZh()?"chinese":"english") .execute(callback); } @@ -539,6 +540,7 @@ public class MainHttpUtil { .params("MacAddress", macUitl.getNewMac()) .params("Imei", uuid) .params("source", "1") + .params("langue", WordUtil.isNewZh()?"chinese":"english") .execute(callback); } @@ -647,6 +649,7 @@ public class MainHttpUtil { .params("mobile", mobile) .params("country_code", country_code) .params("source", "1") + .params("langue", WordUtil.isNewZh()?"chinese":"english") .execute(callback); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index 57db2d92b..c5695cfec 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -42,7 +42,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.lxj.xpopup.XPopup; import com.momo.mcamera.util.JsonUtil; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java index 81fe8df52..0a8dc1a9c 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -29,7 +29,7 @@ import com.bumptech.glide.request.target.DrawableImageViewTarget; import com.bumptech.glide.request.target.Target; import com.ms.banner.Banner; import com.ms.banner.listener.OnBannerClickListener; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.WebViewActivity; diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 6086fdb74..39c8120e9 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -9,7 +9,7 @@ import android.widget.ImageView; import android.widget.TextView; import com.lxj.xpopup.XPopup; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.dialog.SkitCheckInWasSuccessfulPopup; import com.yunbao.common.event.FloatWarOrderEvent; diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 2cd1816ed..e2bf2ef92 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -29,7 +29,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; @@ -355,7 +355,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi if (u.getDress().getMedal() != null) { Log.e("tag", u.getDress().getMedal()); - ImgLoader.displayWithError(mContext, u.getDress().getMedal(), user_noble_ico,R.mipmap.icon_vip_gold); + ImgLoader.displayWithError(mContext, u.getDress().getMedal(), user_noble_ico, R.mipmap.icon_vip_gold); } else { user_noble_ico.setImageResource(R.mipmap.icon_vip_gold); } @@ -468,6 +468,10 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi MobclickAgent.onEvent(mContext, "my_room", "个人中心点房间管理"); forwardRoomManage(); break; + case 26: + case 17: + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); + break; } } else { //21 在线客服 @@ -506,7 +510,10 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi if (bean.getId() == 24) { MobclickAgent.onEvent(mContext, "my_pack", "个人中心点包裹"); } - WebViewActivity.forward(mContext, url, false); + if (bean.getId() == 17 || bean.getId() == 26) { + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); + } else + WebViewActivity.forward(mContext, url, false); } } diff --git a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java index f8a17638a..865fda8bf 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -25,7 +25,7 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.umeng.analytics.MobclickAgent; +import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.glide.ImgLoader; diff --git a/main/src/main/res/drawable/bg_btn_feedback_edit_tv_edit.xml b/main/src/main/res/drawable/bg_btn_feedback_edit_tv_edit.xml new file mode 100644 index 000000000..0d58b3038 --- /dev/null +++ b/main/src/main/res/drawable/bg_btn_feedback_edit_tv_edit.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/drawable/bg_btn_feedback_success.xml b/main/src/main/res/drawable/bg_btn_feedback_success.xml new file mode 100644 index 000000000..cb81e4f44 --- /dev/null +++ b/main/src/main/res/drawable/bg_btn_feedback_success.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_battlepass.xml b/main/src/main/res/layout/activity_battlepass.xml index 4639d1bc0..aaad2a686 100644 --- a/main/src/main/res/layout/activity_battlepass.xml +++ b/main/src/main/res/layout/activity_battlepass.xml @@ -2,6 +2,7 @@ @@ -112,6 +113,20 @@ - + +