老用户回归
This commit is contained in:
@@ -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<ConfigBean>() {
|
||||
@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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
14
main/src/main/res/layout/popwindow_return_user.xml
Normal file
14
main/src/main/res/layout/popwindow_return_user.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="332.5dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_height="359.5dp" />
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user