diff --git a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java index 5397f4a20..aae2f578d 100644 --- a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java +++ b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java @@ -1,6 +1,7 @@ package com.yunbao.common.bean; import com.alibaba.fastjson.annotation.JSONField; +import com.google.gson.annotations.SerializedName; import java.util.Arrays; import java.util.List; @@ -9,7 +10,7 @@ import java.util.List; * Created by cxf on 2017/8/5. */ -public class ConfigBean { +public class ConfigBean extends BaseModel { private String version;//Android apk安装包 版本号 private String downloadApkUrl;//Android apk安装包 下载地址 private String updateDes;//版本更新描述 @@ -58,10 +59,63 @@ public class ConfigBean { private String txPlayUgcLicenceUrl;//腾讯短视频鉴权 private String txVideoUgcKey; private String google_isup; + @SerializedName("is_return_user")//是否需要弹窗(0否,1是) + private String isReturnUser; + @SerializedName("popup_img_url")//弹窗图片地址 + private String popupImgUrl; + @SerializedName("popup_img_en_url")//弹窗图片地址 + private String popupImgEnUrl; + @SerializedName("jump_h5_url")//点击跳转H5页面地址 + private String jumpH5Url; + + @JSONField(name = "is_return_user") + public String getIsReturnUser() { + return isReturnUser; + } + + @JSONField(name = "is_return_user") + public ConfigBean setIsReturnUser(String isReturnUser) { + this.isReturnUser = isReturnUser; + return this; + } + @JSONField(name = "popup_img_url") + public String getPopupImgUrl() { + return popupImgUrl; + } + + @JSONField(name = "popup_img_url") + public ConfigBean setPopupImgUrl(String popupImgUrl) { + this.popupImgUrl = popupImgUrl; + return this; + } + + @JSONField(name = "popup_img_en_url") + public String getPopupImgEnUrl() { + return popupImgEnUrl; + } + + @JSONField(name = "popup_img_en_url") + public ConfigBean setPopupImgEnUrl(String popupImgEnUrl) { + this.popupImgEnUrl = popupImgEnUrl; + return this; + } + + @JSONField(name = "jump_h5_url") + public String getJumpH5Url() { + return jumpH5Url; + } + + @JSONField(name = "jump_h5_url") + public ConfigBean setJumpH5Url(String jumpH5Url) { + this.jumpH5Url = jumpH5Url; + return this; + } + @JSONField(name = "google_isup") public String getGoogle_isup() { return google_isup; } + @JSONField(name = "google_isup") public void setGoogle_isup(String google_isup) { this.google_isup = google_isup; @@ -71,6 +125,7 @@ public class ConfigBean { public String getTxPlayUgcLicenceUrl() { return txPlayUgcLicenceUrl; } + @JSONField(name = "tx_play_ugc_licence_url") public void setTxPlayUgcLicenceUrl(String txPlayUgcLicenceUrl) { this.txPlayUgcLicenceUrl = txPlayUgcLicenceUrl; @@ -347,6 +402,7 @@ public class ConfigBean { public void setBeautyFace(int beautyFace) { this.beautyFace = beautyFace; } + @JSONField(name = "sprout_face_narrowing") public int getBeautyFaceNarrowing() { return faceNarrowing; @@ -465,22 +521,27 @@ public class ConfigBean { public String getAdInfo() { return mAdInfo; } + @JSONField(name = "guide") public void setAdInfo(String adInfo) { mAdInfo = adInfo; } + @JSONField(name = "letter_switch") public int getPriMsgSwitch() { return priMsgSwitch; } + @JSONField(name = "letter_switch") public void setPriMsgSwitch(int priMsgSwitch) { this.priMsgSwitch = priMsgSwitch; } + @JSONField(name = "isup") public int getForceUpdate() { return forceUpdate; } + @JSONField(name = "isup") public void setForceUpdate(int forceUpdate) { this.forceUpdate = forceUpdate; @@ -490,6 +551,7 @@ public class ConfigBean { public String getSproutType() { return sproutType; } + @JSONField(name = "sprout_type") public void setSproutType(String sprout_type) { this.sproutType = sprout_type; @@ -499,6 +561,7 @@ public class ConfigBean { public String getTurntableEnable() { return turntableEnable; } + @JSONField(name = "turntable_enable") public void setTurntableEnable(String turntable) { this.turntableEnable = turntable; @@ -529,6 +592,7 @@ public class ConfigBean { public String getPaster360Url() { return paster360Url; } + @JSONField(name = "360_paster_url") public void setPaster360Url(String paster360Url) { this.paster360Url = paster360Url; @@ -538,6 +602,7 @@ public class ConfigBean { public String getPkTime() { return pkTime; } + @JSONField(name = "live_pk_time") public void setPkTime(String time) { this.pkTime = time; @@ -548,6 +613,7 @@ public class ConfigBean { public String getCustomerServerUrl() { return serverUrl; } + @JSONField(name = "service_url") public void setCustomerServerUrl(String serverUrl) { this.serverUrl = serverUrl; diff --git a/live/src/main/res/layout/dialog_live_new_user.xml b/live/src/main/res/layout/dialog_live_new_user.xml index 10ac4c869..5eea87961 100644 --- a/live/src/main/res/layout/dialog_live_new_user.xml +++ b/live/src/main/res/layout/dialog_live_new_user.xml @@ -14,29 +14,29 @@ android:orientation="vertical"> + android:textSize="12sp" /> + android:textStyle="bold" /> - + android:textStyle="bold" /> @@ -63,12 +62,13 @@ android:layout_height="wrap_content" android:orientation="horizontal"> - - + - + - + android:textStyle="bold" /> - + android:textStyle="bold" /> @@ -144,23 +143,24 @@ - + + + android:textSize="13sp" /> 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 3e77de365..c0f3b76f5 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -16,6 +16,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.view.Display; @@ -91,6 +92,7 @@ import com.yunbao.live.utils.LiveStorge; import com.yunbao.live.views.ChatListViewHolder; import com.yunbao.main.R; import com.yunbao.main.dialog.MainStartDialogFragment; +import com.yunbao.main.dialog.ReturnUserDialog; import com.yunbao.main.dialog.SigninDialog; import com.yunbao.main.event.MainHomeCommunityToChatEvent; import com.yunbao.main.event.PDLiveConversationListEvent; @@ -136,7 +138,7 @@ import kotlin.Unit; @Route(path = RouteUtil.PATH_MAIN) public class MainActivity extends AbsActivity implements MainAppBarLayoutListener { - public RelativeLayout rt_main_tab; + public RelativeLayout rt_main_tab; private ViewGroup mRootView; private TabButtonGroup mTabButtonGroup; private ViewPager mViewPager; @@ -184,7 +186,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } - @Override protected void main() { ConversationIMListManager.get(this); @@ -193,7 +194,21 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene CommonHttpUtil.getConfig(mContext, new CommonCallback() { @Override public void callback(ConfigBean bean) { - + //是否需要老用户回归弹窗 + if (TextUtils.equals(bean.getIsReturnUser(), "1")) { + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + ReturnUserDialog fragment1 = new ReturnUserDialog(); + Bundle bundle = new Bundle(); + bundle.putString("popupImgUrl", bean.getPopupImgUrl()); + bundle.putString("popupImgEnUrl", bean.getPopupImgEnUrl()); + bundle.putString("jumpH5Url", bean.getJumpH5Url()); + fragment1.setArguments(bundle); + fragment1.show(getSupportFragmentManager(), "ReturnUserDialog"); + } + }, 1500); + } } }); rt_main_tab = (RelativeLayout) findViewById(R.id.rt_main_tab); @@ -534,7 +549,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override public void onError(int code, String desc) { - Log.i("tx", "登录失败: code = "+code+" desc = "+desc); + Log.i("tx", "登录失败: code = " + code + " desc = " + desc); } }); @@ -565,7 +580,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override public void onError(int code, String desc) { - Log.i("tx", "登录失败: code = "+code+" desc = "+desc); + Log.i("tx", "登录失败: code = " + code + " desc = " + desc); } diff --git a/main/src/main/java/com/yunbao/main/dialog/ReturnUserDialog.java b/main/src/main/java/com/yunbao/main/dialog/ReturnUserDialog.java new file mode 100644 index 000000000..ff40a6366 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/dialog/ReturnUserDialog.java @@ -0,0 +1,86 @@ +package com.yunbao.main.dialog; + +import android.os.Bundle; +import android.text.TextUtils; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; + +import androidx.annotation.Nullable; + +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.live.activity.ZhuangBanActivity; +import com.yunbao.main.R; + +import java.util.Locale; + +/** + * 老用户回归 + */ +public class ReturnUserDialog extends AbsDialogFragment { + + + @Override + protected int getLayoutId() { + return R.layout.popwindow_return_user; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(com.yunbao.live.R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = WindowManager.LayoutParams.MATCH_PARENT; + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.CENTER; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + String popupImgUrl = getArguments().getString("popupImgUrl"); + String popupImgEnUrl = getArguments().getString("popupImgEnUrl"); + String jumpH5Url = getArguments().getString("jumpH5Url"); + ImageView image = (ImageView) findViewById(R.id.image); + Locale locale = mContext.getResources().getConfiguration().locale; + String language = locale.getLanguage(); + if (TextUtils.equals(language, "zh")) { + ImgLoader.display(mContext, popupImgUrl, image); + } else { + ImgLoader.display(mContext, popupImgEnUrl, image); + } + image.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); + StringBuffer htmlUrl = new StringBuffer(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(jumpH5Url) + .append("&uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()); + ZhuangBanActivity.forward(mContext, htmlUrl.toString(), false); + } + }); + + } +} diff --git a/main/src/main/res/layout/popwindow_return_user.xml b/main/src/main/res/layout/popwindow_return_user.xml new file mode 100644 index 000000000..de73df0aa --- /dev/null +++ b/main/src/main/res/layout/popwindow_return_user.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file