This commit is contained in:
18401019693 2022-07-26 10:43:27 +08:00
parent 8280e43a46
commit 69ad6efb65
4 changed files with 137 additions and 97 deletions

View File

@ -4,11 +4,13 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import com.yunbao.common.utils.ClickUtil; import com.yunbao.common.utils.ClickUtil;
@ -32,7 +34,11 @@ public abstract class AbsDialogFragment extends DialogFragment {
dialog.setContentView(mRootView); dialog.setContentView(mRootView);
dialog.setCancelable(canCancel()); dialog.setCancelable(canCancel());
dialog.setCanceledOnTouchOutside(canCancel()); dialog.setCanceledOnTouchOutside(canCancel());
setWindowAttributes(dialog.getWindow()); Window window = dialog.getWindow();
if (window != null) {
window.setType(WindowManager.LayoutParams.TYPE_APPLICATION);
}
setWindowAttributes(window);
return dialog; return dialog;
} }

View File

@ -12,13 +12,11 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
@ -38,12 +36,10 @@ import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig; import com.tencent.imsdk.v2.V2TIMSDKConfig;
import com.tencent.imsdk.v2.V2TIMSDKListener; import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMUserFullInfo; import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.adapter.ViewPagerAdapter; import com.yunbao.common.adapter.ViewPagerAdapter;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ChatRemarksBean;
import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.LiveSvgGiftBean;
@ -73,12 +69,10 @@ import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.live.LiveConfig; import com.yunbao.live.LiveConfig;
import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.PDLIiveChatActivity;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.utils.LiveStorge; import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.ChatListViewHolder; import com.yunbao.live.views.ChatListViewHolder;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -116,7 +110,6 @@ import java.util.Map;
import cn.rongcloud.rtc.api.RCRTCConfig; import cn.rongcloud.rtc.api.RCRTCConfig;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.message.TextMessage;
import static com.yunbao.common.CommonAppContext.isReady; import static com.yunbao.common.CommonAppContext.isReady;
@ -481,7 +474,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private void showStartDialog() { private void showStartDialog() {
if (isReady == true) { if (isReady == true) {
MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
dialogFragment.setMainStartChooseCallback(mMainStartChooseCallback); dialogFragment.setMainStartChooseCallback(true,this);
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment"); dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
} else { } else {
ToastUtil.show("正在初始化,請稍等...."); ToastUtil.show("正在初始化,請稍等....");
@ -489,87 +482,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
} }
private MainStartChooseCallback mMainStartChooseCallback = new MainStartChooseCallback() {
@Override
public void onLiveClick() {
mProcessResultUtil.requestPermissions(new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO
}, mStartLiveRunnable);
}
@Override
public void onVideoClick() {
if (Constants.isAnchor) {
mProcessResultUtil.requestPermissions(new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO
}, mStartVideoRunnable);
} else {
ToastUtil.show(getString(R.string.only_open_anchor));
}
}
};
private Runnable mStartLiveRunnable = new Runnable() {
@Override
public void run() {
// MainActivity.this.startActivity(new Intent(MainActivity.this, LiveTRTCAnchorActivity.class));
if (CommonAppConfig.LIVE_SDK_CHANGED) {
if (mGetLiveSdkCallback == null) {
mGetLiveSdkCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {
LiveHttpUtil.getisRong(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info1) {
try {
JSONObject obj = JSON.parseObject(info[0]);
JSONObject obj1 = JSON.parseObject(info1[0]);
if (obj1.getString("is_rong").equals("1")) {
LiveRyAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
} else {
LiveAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
}
} catch (Exception e) {
}
}
});
}
}
};
}
LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback);
} else {
LiveAnchorActivity.forward(mContext, CommonAppConfig.LIVE_SDK_USED, LiveConfig.getDefaultKsyConfig());
}
}
};
private Runnable mStartVideoRunnable = new Runnable() {
@Override
public void run() {
String mBeautySdkType = CommonAppConfig.getInstance().getBeautySdkType();
if ("2".equals(mBeautySdkType)) {
Constants.myIntoIndex = 2;
Intent intent = new Intent(mContext, MyWebViewActivity.class);
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1");
startActivity(intent);
} else {
Constants.myIntoIndex = 2;
Intent intent = new Intent(mContext, MyWebViewActivity.class);
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1");
startActivity(intent);
}
}
};
/** /**
* 检查版本更新 * 检查版本更新
@ -1043,6 +958,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onPDLiveConversationListEvent(PDLiveConversationListEvent event) { public void onPDLiveConversationListEvent(PDLiveConversationListEvent event) {
if (event.getPage() == 11) { if (event.getPage() == 11) {
finish(); finish();
} else if (event.getPage() == 17) {
showStartDialog();
} else { } else {
mViewPager.setCurrentItem(event.getPage()); mViewPager.setCurrentItem(event.getPage());
mTabButtonGroup.setCurPosition(event.getPage()); mTabButtonGroup.setCurPosition(event.getPage());

View File

@ -21,11 +21,13 @@ import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.adapter.SystemMessageAdapter; import com.yunbao.main.adapter.SystemMessageAdapter;
import com.yunbao.main.dialog.MainStartDialogFragment;
import com.yunbao.main.event.PDLiveConversationListEvent; import com.yunbao.main.event.PDLiveConversationListEvent;
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager; import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
@ -39,6 +41,8 @@ import java.util.List;
import io.rong.imkit.conversationlist.ConversationListFragment; import io.rong.imkit.conversationlist.ConversationListFragment;
import static com.yunbao.common.CommonAppContext.isReady;
/** /**
* pdlive消息中心 * pdlive消息中心
*/ */
@ -53,6 +57,7 @@ public class PDLiveConversationListActivity extends AbsActivity {
private TextView redPoint; private TextView redPoint;
private View redpointMe; private View redpointMe;
private SystemMessageAdapter messageAdapter; private SystemMessageAdapter messageAdapter;
private ProcessResultUtil mProcessResultUtil;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
@ -79,7 +84,10 @@ public class PDLiveConversationListActivity extends AbsActivity {
redpointMe = findViewById(R.id.v_table_redpoint_me); redpointMe = findViewById(R.id.v_table_redpoint_me);
mTabButtonGroup.setCurPosition(2); mTabButtonGroup.setCurPosition(2);
findViewById(R.id.btn_start).setOnClickListener(v -> {
//防止重新加载多个
showStartDialog();
});
//选中监听 //选中监听
mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> { mTabButtonGroup.addTabButtonGroupChangeListener((view, index) -> {
Log.e(CLASSNAME, "onPageSelected:" + index); Log.e(CLASSNAME, "onPageSelected:" + index);
@ -92,11 +100,21 @@ public class PDLiveConversationListActivity extends AbsActivity {
}); });
} }
private void showStartDialog() {
if (isReady == true) {
MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
dialogFragment.setMainStartChooseCallback(true,this);
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
} else {
ToastUtil.show("正在初始化,請稍等....");
}
}
/** /**
* 初始化数据 * 初始化数据
*/ */
private void initData() { private void initData() {
mProcessResultUtil = new ProcessResultUtil(this);
//获取系统消息列表 //获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() { ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override @Override

View File

@ -1,8 +1,11 @@
package com.yunbao.main.dialog; package com.yunbao.main.dialog;
import android.Manifest;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.view.Gravity; import android.view.Gravity;
@ -12,8 +15,24 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.LiveConfig;
import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MyWebViewActivity;
import com.yunbao.main.interfaces.MainStartChooseCallback; import com.yunbao.main.interfaces.MainStartChooseCallback;
/** /**
@ -62,7 +81,6 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
window.setWindowAnimations(R.style.bottomToTopAnim); window.setWindowAnimations(R.style.bottomToTopAnim);
WindowManager.LayoutParams params = window.getAttributes(); WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT; params.width = WindowManager.LayoutParams.MATCH_PARENT;
// params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM; params.gravity = Gravity.BOTTOM;
window.setAttributes(params); window.setAttributes(params);
@ -124,11 +142,94 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
mRootView.findViewById(R.id.btn_video).setOnClickListener(this); mRootView.findViewById(R.id.btn_video).setOnClickListener(this);
mRootView.findViewById(R.id.btn_close).setOnClickListener(this); mRootView.findViewById(R.id.btn_close).setOnClickListener(this);
} }
private HttpCallback mGetLiveSdkCallback;
public void setMainStartChooseCallback(MainStartChooseCallback callback) { private ProcessResultUtil mProcessResultUtil;
mCallback = callback; public void setMainStartChooseCallback(boolean isCallback, AbsActivity activity) {
mProcessResultUtil = new ProcessResultUtil(activity);
if (isCallback) {
mCallback = mMainStartChooseCallback;
}
} }
private MainStartChooseCallback mMainStartChooseCallback = new MainStartChooseCallback() {
@Override
public void onLiveClick() {
mProcessResultUtil.requestPermissions(new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO
}, mStartLiveRunnable);
}
@Override
public void onVideoClick() {
if (Constants.isAnchor) {
mProcessResultUtil.requestPermissions(new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO
}, mStartVideoRunnable);
} else {
ToastUtil.show(getString(R.string.only_open_anchor));
}
}
};
private Runnable mStartLiveRunnable = new Runnable() {
@Override
public void run() {
if (CommonAppConfig.LIVE_SDK_CHANGED) {
if (mGetLiveSdkCallback == null) {
mGetLiveSdkCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, final String[] info) {
if (code == 0 && info.length > 0) {
LiveHttpUtil.getisRong(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info1) {
try {
JSONObject obj = JSON.parseObject(info[0]);
JSONObject obj1 = JSON.parseObject(info1[0]);
if (obj1.getString("is_rong").equals("1")) {
LiveRyAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
} else {
LiveAnchorActivity.forward(mContext, obj.getIntValue("live_sdk"), JSON.parseObject(obj.getString("android"), LiveKsyConfigBean.class));
}
} catch (Exception e) {
}
}
});
}
}
};
}
LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback);
} else {
LiveAnchorActivity.forward(mContext, CommonAppConfig.LIVE_SDK_USED, LiveConfig.getDefaultKsyConfig());
}
}
};
private Runnable mStartVideoRunnable = new Runnable() {
@Override
public void run() {
String mBeautySdkType = CommonAppConfig.getInstance().getBeautySdkType();
if ("2".equals(mBeautySdkType)) {
Constants.myIntoIndex = 2;
Intent intent = new Intent(mContext, MyWebViewActivity.class);
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1");
startActivity(intent);
} else {
Constants.myIntoIndex = 2;
Intent intent = new Intent(mContext, MyWebViewActivity.class);
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/shequ/index.html#/h5/shequ/release" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isRelease=1");
startActivity(intent);
}
}
};
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!canClick()) { if (!canClick()) {
@ -140,8 +241,6 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
} else if (i == R.id.btn_live) { } else if (i == R.id.btn_live) {
if (mCallback != null) { if (mCallback != null) {
mCallback.onLiveClick(); mCallback.onLiveClick();
// Intent intent = new Intent(mContext, Beauty360Activity3.class);
// mContext.startActivity(intent);
} }
} else if (i == R.id.btn_video) { } else if (i == R.id.btn_video) {
if (mCallback != null) { if (mCallback != null) {