个播滑动切换房间接口对接
This commit is contained in:
@@ -31,7 +31,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -110,6 +109,8 @@ import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.dragonball.DragonBallModel;
|
||||
import com.yizhuan.xchat_android_core.room.event.FinishAvRoomEvent;
|
||||
import com.yizhuan.xchat_android_core.room.event.RoomClearScreenEvent;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.room.model.RoomBaseModel;
|
||||
import com.yizhuan.xchat_android_core.room.pk.event.PKStateEvent;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
@@ -120,6 +121,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
||||
|
||||
@@ -204,7 +206,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
public static void start(Context context, @NonNull RoomInfo roomInfo) {
|
||||
Intent intent = new Intent(context, AVRoomActivity.class);
|
||||
intent.putExtra(Constants.ROOM_INFO, (Parcelable) roomInfo);
|
||||
intent.putExtra(Constants.ROOM_UID, roomInfo.getRoomUid());
|
||||
intent.putExtra(Constants.ROOM_UID, roomInfo.getUid());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_INTO_ROOM_CLICK, "进入房间");
|
||||
@@ -278,16 +280,21 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bgPicture[0] = "";
|
||||
if (roomInfo.getType() == RoomInfo.ROOMTYPE_CP) {
|
||||
bgPicture[0] = "";
|
||||
if (roomInfo.isOpenGame) {
|
||||
svgaRoomBg.setImageResource(R.drawable.room_cp_game_bg);
|
||||
} else {
|
||||
svgaRoomBg.setImageResource(R.drawable.bg_room_cp);
|
||||
}
|
||||
} else if (roomInfo.getType() == RoomInfo.ROOM_TYPE_SINGLE) {
|
||||
playSvgaBg(svgaRoomBg, "svga/single_back.svga");
|
||||
String singleSvgaPath = "svga/single_back.svga";
|
||||
if (!singleSvgaPath.equals(bgPicture[0])) {
|
||||
playSvgaBg(svgaRoomBg, singleSvgaPath);
|
||||
bgPicture[0] = singleSvgaPath;
|
||||
}
|
||||
} else {
|
||||
bgPicture[0] = "";
|
||||
if (roomInfo.getRoomModeType() == RoomModeType.OPEN_PK_MODE) {
|
||||
svgaRoomBg.setImageResource(R.drawable.bg_room_pk);
|
||||
} else {
|
||||
@@ -299,13 +306,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
|
||||
private static void playSvgaBg(SVGAImageView svgaRoomBg, String asstets) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
SVGAParser mSVGAParser = new SVGAParser(svgaRoomBg.getContext());
|
||||
mSVGAParser.decodeFromAssets(asstets, new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity svgaVideoEntity) {
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
|
||||
svgaRoomBg.setImageDrawable(drawable);
|
||||
svgaRoomBg.startAnimation();
|
||||
@@ -313,20 +317,16 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
svgaRoomBg.setVisibility(View.GONE);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
private static void playSvgaUrlBg(SVGAImageView svgaRoomBg, String url) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
SVGAParser mSVGAParser = new SVGAParser(svgaRoomBg.getContext());
|
||||
try {
|
||||
mSVGAParser.decodeFromURL(new URL(url), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity svgaVideoEntity) {
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
SVGADrawable drawable = new SVGADrawable(svgaVideoEntity);
|
||||
svgaRoomBg.setImageDrawable(drawable);
|
||||
svgaRoomBg.startAnimation();
|
||||
@@ -334,7 +334,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
svgaRoomBg.setVisibility(View.GONE);
|
||||
}
|
||||
}, null);
|
||||
} catch (MalformedURLException e) {
|
||||
@@ -352,7 +351,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
fromType = intent.getIntExtra("fromType", 0);
|
||||
fromNick = intent.getStringExtra("fromNick");
|
||||
fromUid = intent.getStringExtra("fromUid");
|
||||
mRoomInfo = (RoomInfo) intent.getParcelableExtra(Constants.ROOM_INFO);
|
||||
mRoomInfo = intent.getParcelableExtra(Constants.ROOM_INFO);
|
||||
if (newRoomUid != 0 && newRoomUid == roomUid) {
|
||||
updateRoomInfo();
|
||||
//updateRoomInfo之后进入云信进房逻辑后直接return了,不会再次调用addRoomFragment()
|
||||
@@ -364,14 +363,22 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
roomUid = newRoomUid;
|
||||
// 相同类型的房间,但是是不同人的房间
|
||||
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
|
||||
dismissRedPackageDialog();
|
||||
EventBus.getDefault().post(new RoomClearScreenEvent());
|
||||
showLoadingDialog();
|
||||
dismissRedPackageDialog();
|
||||
if (mRoomInfo == null) {
|
||||
updateRoomInfo();
|
||||
} else {
|
||||
requestRoomInfoSuccessView(mRoomInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentItem(int item) {
|
||||
dismissLoadingDialog();
|
||||
if (viewpager != null) {
|
||||
viewpager.setUserInputEnabled(true);
|
||||
viewpager.setCurrentItem(item, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,14 +413,17 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (mAdapter == null) {
|
||||
mAdapter = new VerticalViewPagerAdapter(this);
|
||||
mAdapter = new VerticalViewPagerAdapter(this, !AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid));
|
||||
viewpager.setOffscreenPageLimit(2);
|
||||
viewpager.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
|
||||
((RecyclerView) viewpager.getChildAt(0)).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
viewpager.getChildAt(0).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
viewpager.setUserInputEnabled(false);
|
||||
viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
((FakeSingleRoomFragment) mAdapter.getItem(1)).requestPreRoomInfo();
|
||||
if (positionOffsetPixels != 0) {
|
||||
((FakeSingleRoomFragment) mAdapter.getItem(1)).requestPreRoomInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -921,9 +931,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
@Override
|
||||
public void requestRoomInfoSuccessView(RoomInfo roomInfo) {
|
||||
mRoomInfo = roomInfo;
|
||||
if (roomInfo.getType() != RoomInfo.ROOM_TYPE_SINGLE) {
|
||||
viewpager.setUserInputEnabled(false);
|
||||
}
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.setRoomBg(roomInfo);
|
||||
}
|
||||
|
@@ -398,13 +398,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
AvRoomDataManager.get().mCurrentRoomInfo?.isServerRedEnvelopeSwitch == true
|
||||
}
|
||||
|
||||
/**
|
||||
* 嗨聊房切换清屏方法
|
||||
*/
|
||||
private fun clearScreen() {
|
||||
messageView.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* 嗨聊房切换重置公屏消息(绿色公告)
|
||||
*/
|
||||
@@ -638,9 +631,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onClearScreenEvent(event: RoomClearScreenEvent?) {
|
||||
clearScreen()
|
||||
val firstMsg = IMNetEaseManager.get().firstMessageContent
|
||||
addMessage(firstMsg)
|
||||
AvRoomDataManager.get().chatRoomDataRelease(false)
|
||||
messageView.clear()
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
@@ -25,7 +25,6 @@ class FakeSingleRoomFragment : BaseViewBindingFragment<FragmentFakeSingleRoomBin
|
||||
|
||||
override fun init() {
|
||||
playSvgaBg(binding.svgaImageViewBg, "svga/single_back.svga")
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -37,7 +36,7 @@ class FakeSingleRoomFragment : BaseViewBindingFragment<FragmentFakeSingleRoomBin
|
||||
lastRequestTime = CurrentTimeUtils.getCurrentTime()
|
||||
index++
|
||||
AvRoomModel.get()
|
||||
.requestRoomInfo(if (index % 2 == 0) "1000429" else "1003696")
|
||||
.nextSingleRoomInfo
|
||||
.subscribe({
|
||||
if (needJump) {
|
||||
AVRoomActivity.start(mContext, it)
|
||||
@@ -49,7 +48,9 @@ class FakeSingleRoomFragment : BaseViewBindingFragment<FragmentFakeSingleRoomBin
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
||||
toast("获取下一个房间信息失败,自动为您返回当前房间")
|
||||
reSet()
|
||||
(activity as AVRoomActivity).setCurrentItem(0)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,7 +85,6 @@ class FakeSingleRoomFragment : BaseViewBindingFragment<FragmentFakeSingleRoomBin
|
||||
svgaRoomBg.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
}, null)
|
||||
}
|
||||
}
|
@@ -179,17 +179,6 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
|
||||
super.onReceiveRoomEvent(roomEvent)
|
||||
if (roomEvent == null) return
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.ENTER_ROOM -> {
|
||||
//个播模式房主进房自动上麦
|
||||
if (AvRoomDataManager.get().isSingleRoom && AvRoomDataManager.get().isRoomOwner) {
|
||||
AvRoomDataManager.get().mIsNeedOpenMic = true
|
||||
mvpPresenter?.upMicroPhone(
|
||||
-1,
|
||||
AuthModel.get().currentUid.toString(),
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
RoomEvent.REQUEST_UP_MIC -> {
|
||||
(roomEvent.chatRoomMessage?.attachment as? RequestUpmicAttachment)?.userInfo?.let {
|
||||
showInviteDialog(it)
|
||||
|
@@ -21,10 +21,12 @@ import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
|
||||
public class VerticalViewPagerAdapter extends FragmentStateAdapter {
|
||||
private final SparseArray<Fragment> fragmentList;
|
||||
private final boolean isRoomMin;
|
||||
|
||||
public VerticalViewPagerAdapter(FragmentActivity fm) {
|
||||
public VerticalViewPagerAdapter(FragmentActivity fm, boolean isRoomMin) {
|
||||
super(fm);
|
||||
fragmentList = new SparseArray<>();
|
||||
this.isRoomMin = isRoomMin;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +36,7 @@ public class VerticalViewPagerAdapter extends FragmentStateAdapter {
|
||||
Fragment fragment = fragmentList.get(position);
|
||||
if (fragment == null) {
|
||||
if (position == 0) {
|
||||
fragment = HomePartyFragment.newInstance(false);
|
||||
fragment = HomePartyFragment.newInstance(isRoomMin);
|
||||
} else {
|
||||
fragment = new FakeSingleRoomFragment();
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Build;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
@@ -53,6 +54,8 @@ public class DialogManager {
|
||||
* 新增的一种弹框类型,支持只弹一次
|
||||
*/
|
||||
private Switch switchTips;
|
||||
private int mProgressMax = 0;
|
||||
private String mTip;
|
||||
|
||||
public DialogManager(Context context) {
|
||||
mContext = context;
|
||||
@@ -76,6 +79,180 @@ public class DialogManager {
|
||||
mCanceledOnClickOutside = canceledOnClickOutside;
|
||||
}
|
||||
|
||||
public static boolean isHtmlAlertDialog(String html) {
|
||||
try {
|
||||
return html.matches(".*<([^>]*)>.*");
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注释 见 {@link DialogManager#showOkCancelDialog(
|
||||
*CharSequence, CharSequence, CharSequence, CharSequence, boolean,
|
||||
* boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)}
|
||||
*/
|
||||
public static void setDialog(Dialog dialog, CharSequence title, CharSequence message, CharSequence okLabel,
|
||||
CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside,
|
||||
final boolean isAutoHide, final OkCancelDialogListener l,
|
||||
final OnKeyBackListener backListener, boolean dismissAfterBack) {
|
||||
dialog.setCancelable(isCanCancel);
|
||||
dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
window.setContentView(R.layout.layout_common_ok_cancel_dialog);
|
||||
//标题
|
||||
TextView tvTilte = window.findViewById(R.id.tv_title);
|
||||
if (tvTilte != null) {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTilte.setVisibility(View.VISIBLE);
|
||||
tvTilte.setText(title);
|
||||
} else {
|
||||
tvTilte.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//内容
|
||||
TextView tip = window.findViewById(R.id.message);
|
||||
tip.setText(message);
|
||||
|
||||
TextView ok = window.findViewById(R.id.btn_ok);
|
||||
if (!TextUtils.isEmpty(okLabel)) {
|
||||
ok.setText(okLabel);
|
||||
}
|
||||
ok.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onOk();
|
||||
}
|
||||
});
|
||||
|
||||
TextView cancel = window.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(cancelLabel)) {
|
||||
cancel.setText(cancelLabel);
|
||||
cancel.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onCancel();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (backListener != null) {
|
||||
dialog.setOnKeyListener((dialog1, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (dismissAfterBack) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
backListener.onBack();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注释 见 {@link DialogManager#showOkCancelDialog(
|
||||
*CharSequence, CharSequence, CharSequence, CharSequence, boolean,
|
||||
* boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)}
|
||||
*/
|
||||
public static void setHelloDialog(Dialog dialog, String avatar, int gender, CharSequence title, CharSequence message, CharSequence okLabel,
|
||||
CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside,
|
||||
final boolean isAutoHide, final OkCancelDialogListener l,
|
||||
final OnKeyBackListener backListener, boolean dismissAfterBack, Context context) {
|
||||
dialog.setCancelable(isCanCancel);
|
||||
dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
window.setContentView(R.layout.layout_newbie_hello_dialog);
|
||||
//头像
|
||||
RoundedImageView ivAvatar = window.findViewById(R.id.iv_avatar);
|
||||
if (ivAvatar != null) {
|
||||
if (!TextUtils.isEmpty(avatar)) {
|
||||
ivAvatar.setVisibility(View.VISIBLE);
|
||||
GlideApp.with(context)
|
||||
.load(avatar)
|
||||
// .diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
// .transforms(new CenterCrop(),
|
||||
// new RoundedCorners(context.getResources().getDimensionPixelOffset(R.dimen.dp_6)))
|
||||
.into(ivAvatar);
|
||||
} else {
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
//性别
|
||||
ImageView ivGender = window.findViewById(R.id.iv_gender);
|
||||
ivGender.setImageDrawable(gender == 1 ? context.getResources().getDrawable(R.drawable.ic_gender_male) : context.getResources().getDrawable(R.drawable.ic_gender_female));
|
||||
//标题
|
||||
TextView tvTilte = window.findViewById(R.id.tv_title);
|
||||
if (tvTilte != null) {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTilte.setVisibility(View.VISIBLE);
|
||||
tvTilte.setText(title);
|
||||
} else {
|
||||
tvTilte.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//内容
|
||||
TextView tip = window.findViewById(R.id.message);
|
||||
tip.setText(message);
|
||||
|
||||
TextView ok = window.findViewById(R.id.btn_ok);
|
||||
if (!TextUtils.isEmpty(okLabel)) {
|
||||
ok.setText(okLabel);
|
||||
}
|
||||
ok.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onOk();
|
||||
}
|
||||
});
|
||||
|
||||
TextView cancel = window.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(cancelLabel)) {
|
||||
cancel.setText(cancelLabel);
|
||||
cancel.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onCancel();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (backListener != null) {
|
||||
dialog.setOnKeyListener((dialog1, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (dismissAfterBack) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
backListener.onBack();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static Dialog createDialog(Context context) {
|
||||
AlertDialog.Builder builder = new BaseAlertDialogBuilder(context, R.style.MyAlertDialogStyle);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
@@ -296,35 +473,6 @@ public class DialogManager {
|
||||
return mDialog;
|
||||
}
|
||||
|
||||
public interface DynamicTokenLoginDialogListener {
|
||||
public void onOK(String token);
|
||||
|
||||
public void onCancle();
|
||||
}
|
||||
|
||||
public interface InputPwdDialogListener {
|
||||
public void onConfirm();
|
||||
|
||||
public void onCancel();
|
||||
}
|
||||
|
||||
public interface OkCancelDialogListener {
|
||||
|
||||
default void onCancel() {
|
||||
//默认空实现
|
||||
}
|
||||
|
||||
void onOk();
|
||||
}
|
||||
|
||||
public static abstract class AbsOkDialogListener implements OkCancelDialogListener {
|
||||
public void onCancel() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public abstract void onOk();
|
||||
}
|
||||
|
||||
public void showNewbieHelloDialog(String avatar, int gender, CharSequence titleStr, CharSequence message, CharSequence okLabel, CharSequence cancelLabel, boolean cancelable, final OkCancelDialogListener l, Context context) {
|
||||
showHelloDialog(avatar, gender, titleStr, message, okLabel, cancelLabel, cancelable, mCanceledOnClickOutside, true, l, null, false, context);
|
||||
}
|
||||
@@ -389,7 +537,6 @@ public class DialogManager {
|
||||
showOkCancelDialog(titleStr, message, okLabel, cancelLabel, l);
|
||||
}
|
||||
|
||||
|
||||
public void showOkCancelWithTitleDialog(CharSequence titleStr, CharSequence message,
|
||||
CharSequence okLabel, CharSequence cancelLabel,
|
||||
boolean isCanCancel,
|
||||
@@ -479,7 +626,6 @@ public class DialogManager {
|
||||
showOkCancelDialog(null, message, okLabel, cancelLabel, cancelable, l);
|
||||
}
|
||||
|
||||
|
||||
public void showOkCancelDialog(CharSequence title, CharSequence[] messages,
|
||||
final OkCancelDialogListener l) {
|
||||
showOkCancelDialog(title, messages, getContext().getString(R.string.text_ok),
|
||||
@@ -678,13 +824,11 @@ public class DialogManager {
|
||||
showOkCancelCustomDialog(contentView, okLabel, cancelLabel, isCanCancel, l);
|
||||
}
|
||||
|
||||
|
||||
public void showOkCancelCustomDialog(View customView, boolean isCanCancel, OkCancelDialogListener l) {
|
||||
showOkCancelCustomDialog(customView, getContext().getString(R.string.text_ok),
|
||||
getContext().getString(R.string.text_canle), isCanCancel, true, l);
|
||||
}
|
||||
|
||||
|
||||
public void showOkCancelCustomDialog(View customView, CharSequence okLabel, CharSequence cancelLabel,
|
||||
boolean isCanCancel, OkCancelDialogListener l) {
|
||||
showOkCancelCustomDialog(customView, okLabel, cancelLabel, isCanCancel, true, l);
|
||||
@@ -741,7 +885,6 @@ public class DialogManager {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setReCreate(boolean reCreate) {
|
||||
mReCreate = reCreate;
|
||||
}
|
||||
@@ -798,9 +941,8 @@ public class DialogManager {
|
||||
mDialog.show();
|
||||
}
|
||||
mDialog.setContentView(R.layout.layout_progress_dialog);
|
||||
TextView tvTip = (TextView) mDialog.findViewById(R.id.tv_tip);
|
||||
//tvTip.setText(msg);
|
||||
//叶彬说统一文案,用loading...
|
||||
((AnimationDrawable) ((ImageView) mDialog.findViewById(R.id.iv_loading_icon)).getDrawable()).start();
|
||||
TextView tvTip = mDialog.findViewById(R.id.tv_tip);
|
||||
tvTip.setText(R.string.common_loading_tips);
|
||||
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
@@ -810,9 +952,6 @@ public class DialogManager {
|
||||
});
|
||||
}
|
||||
|
||||
private int mProgressMax = 0;
|
||||
private String mTip;
|
||||
|
||||
public void setText(String text) {
|
||||
mTip = text;
|
||||
}
|
||||
@@ -892,10 +1031,6 @@ public class DialogManager {
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
public void onClick(View view, int btnIndex);
|
||||
}
|
||||
|
||||
private String getTicketProtcol(long channelId, long subChannelId, String title) {
|
||||
return "yy://pd-[sid=" + channelId + "&subid=" + subChannelId + "]\n" + title;
|
||||
}
|
||||
@@ -904,202 +1039,61 @@ public class DialogManager {
|
||||
return "yy://pd-[sid=" + channelId + "&subid=" + subChannelId + "]";
|
||||
}
|
||||
|
||||
public AlertDialog.Builder getBuilder() {
|
||||
return mBuilder;
|
||||
}
|
||||
|
||||
public boolean isOpenSwitch() {
|
||||
return switchTips != null && switchTips.isChecked();
|
||||
}
|
||||
|
||||
public interface DynamicTokenLoginDialogListener {
|
||||
public void onOK(String token);
|
||||
|
||||
public void onCancle();
|
||||
}
|
||||
|
||||
public interface InputPwdDialogListener {
|
||||
public void onConfirm();
|
||||
|
||||
public void onCancel();
|
||||
}
|
||||
|
||||
public interface OkCancelDialogListener {
|
||||
|
||||
default void onCancel() {
|
||||
//默认空实现
|
||||
}
|
||||
|
||||
void onOk();
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
public void onClick(View view, int btnIndex);
|
||||
}
|
||||
|
||||
public interface OnInputPasswordClickListener {
|
||||
void onOk(String password);
|
||||
|
||||
void onCancel();
|
||||
}
|
||||
|
||||
public static boolean isHtmlAlertDialog(String html) {
|
||||
try {
|
||||
return html.matches(".*<([^>]*)>.*");
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public AlertDialog.Builder getBuilder() {
|
||||
return mBuilder;
|
||||
}
|
||||
|
||||
public interface LambdaOkDialogListener extends OkCancelDialogListener {
|
||||
default void onCancel() {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOpenSwitch() {
|
||||
return switchTips != null && switchTips.isChecked();
|
||||
}
|
||||
|
||||
public interface OnKeyBackListener {
|
||||
void onBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注释 见 {@link DialogManager#showOkCancelDialog(
|
||||
*CharSequence, CharSequence, CharSequence, CharSequence, boolean,
|
||||
* boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)}
|
||||
*/
|
||||
public static void setDialog(Dialog dialog, CharSequence title, CharSequence message, CharSequence okLabel,
|
||||
CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside,
|
||||
final boolean isAutoHide, final OkCancelDialogListener l,
|
||||
final OnKeyBackListener backListener, boolean dismissAfterBack) {
|
||||
dialog.setCancelable(isCanCancel);
|
||||
dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
window.setContentView(R.layout.layout_common_ok_cancel_dialog);
|
||||
//标题
|
||||
TextView tvTilte = window.findViewById(R.id.tv_title);
|
||||
if (tvTilte != null) {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTilte.setVisibility(View.VISIBLE);
|
||||
tvTilte.setText(title);
|
||||
} else {
|
||||
tvTilte.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//内容
|
||||
TextView tip = window.findViewById(R.id.message);
|
||||
tip.setText(message);
|
||||
|
||||
TextView ok = window.findViewById(R.id.btn_ok);
|
||||
if (!TextUtils.isEmpty(okLabel)) {
|
||||
ok.setText(okLabel);
|
||||
}
|
||||
ok.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onOk();
|
||||
}
|
||||
});
|
||||
|
||||
TextView cancel = window.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(cancelLabel)) {
|
||||
cancel.setText(cancelLabel);
|
||||
cancel.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onCancel();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cancel.setVisibility(View.GONE);
|
||||
public static abstract class AbsOkDialogListener implements OkCancelDialogListener {
|
||||
public void onCancel() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
if (backListener != null) {
|
||||
dialog.setOnKeyListener((dialog1, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (dismissAfterBack) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
backListener.onBack();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注释 见 {@link DialogManager#showOkCancelDialog(
|
||||
*CharSequence, CharSequence, CharSequence, CharSequence, boolean,
|
||||
* boolean, boolean, OkCancelDialogListener, OnKeyBackListener, boolean)}
|
||||
*/
|
||||
public static void setHelloDialog(Dialog dialog, String avatar, int gender, CharSequence title, CharSequence message, CharSequence okLabel,
|
||||
CharSequence cancelLabel, boolean isCanCancel, boolean canceledOnTouchOutside,
|
||||
final boolean isAutoHide, final OkCancelDialogListener l,
|
||||
final OnKeyBackListener backListener, boolean dismissAfterBack, Context context) {
|
||||
dialog.setCancelable(isCanCancel);
|
||||
dialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
window.setContentView(R.layout.layout_newbie_hello_dialog);
|
||||
//头像
|
||||
RoundedImageView ivAvatar = window.findViewById(R.id.iv_avatar);
|
||||
if (ivAvatar != null) {
|
||||
if (!TextUtils.isEmpty(avatar)) {
|
||||
ivAvatar.setVisibility(View.VISIBLE);
|
||||
GlideApp.with(context)
|
||||
.load(avatar)
|
||||
// .diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
// .transforms(new CenterCrop(),
|
||||
// new RoundedCorners(context.getResources().getDimensionPixelOffset(R.dimen.dp_6)))
|
||||
.into(ivAvatar);
|
||||
} else {
|
||||
ivAvatar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
//性别
|
||||
ImageView ivGender = window.findViewById(R.id.iv_gender);
|
||||
ivGender.setImageDrawable(gender == 1 ? context.getResources().getDrawable(R.drawable.ic_gender_male) : context.getResources().getDrawable(R.drawable.ic_gender_female));
|
||||
//标题
|
||||
TextView tvTilte = window.findViewById(R.id.tv_title);
|
||||
if (tvTilte != null) {
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTilte.setVisibility(View.VISIBLE);
|
||||
tvTilte.setText(title);
|
||||
} else {
|
||||
tvTilte.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//内容
|
||||
TextView tip = window.findViewById(R.id.message);
|
||||
tip.setText(message);
|
||||
|
||||
TextView ok = window.findViewById(R.id.btn_ok);
|
||||
if (!TextUtils.isEmpty(okLabel)) {
|
||||
ok.setText(okLabel);
|
||||
}
|
||||
ok.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onOk();
|
||||
}
|
||||
});
|
||||
|
||||
TextView cancel = window.findViewById(R.id.btn_cancel);
|
||||
if (!TextUtils.isEmpty(cancelLabel)) {
|
||||
cancel.setText(cancelLabel);
|
||||
cancel.setOnClickListener(v -> {
|
||||
if (isAutoHide) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (l != null) {
|
||||
l.onCancel();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cancel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (backListener != null) {
|
||||
dialog.setOnKeyListener((dialog1, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (dismissAfterBack) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
backListener.onBack();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static Dialog createDialog(Context context) {
|
||||
AlertDialog.Builder builder = new BaseAlertDialogBuilder(context, R.style.MyAlertDialogStyle);
|
||||
return builder.create();
|
||||
public abstract void onOk();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_room_normal_default_pic">
|
||||
android:background="#150153">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/fragment_container"
|
||||
|
@@ -644,7 +644,7 @@
|
||||
<string name="my_recommend_position_text">我的推荐位</string>
|
||||
<string name="label_room_hall_manage">厅管理</string>
|
||||
<string name="KTV_ing">KTV中...</string>
|
||||
<string name="common_loading_tips">loading…</string>
|
||||
<string name="common_loading_tips">加载中…</string>
|
||||
|
||||
<string name="text_default_nick">我是一只小萌新</string>
|
||||
<string name="text_default_code">(选填)</string>
|
||||
|
@@ -1693,7 +1693,27 @@ public final class IMNetEaseManager {
|
||||
RoomInfo curRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (curRoomInfo == null) return;
|
||||
noticeEnterMessages();
|
||||
//个播模式房主进房自动上麦
|
||||
if (AvRoomDataManager.get().isSingleRoom() && AvRoomDataManager.get().isRoomOwner()) {
|
||||
AvRoomDataManager.get().mIsNeedOpenMic = true;
|
||||
AvRoomModel.get().upMicroPhone(
|
||||
-1,
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
String.valueOf(curRoomInfo.getRoomId()),
|
||||
false,
|
||||
new CallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String error) {
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
long uid = AuthModel.get().getCurrentUid();
|
||||
if (curRoomInfo.getUid() == uid) {
|
||||
StatisticManager.Instance().onEventStart(BasicConfig.INSTANCE.getAppContext(),
|
||||
|
@@ -611,4 +611,11 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<RoomInfo> getNextSingleRoomInfo() {
|
||||
return mRoomService.getNextSingleRoomInfo(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
}
|
||||
|
@@ -1137,6 +1137,15 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
|
||||
@GET("/roominsiderecommend/recommendRoomList")
|
||||
Single<ServiceResult<List<HomeRoomInfo>>> getRecommendRoomList(@Query("roomId") String roomId);
|
||||
|
||||
/**
|
||||
* 获取个播随机下一个房间信息
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@GET("/single/broadcast/room/page")
|
||||
Single<RoomResult> getNextSingleRoomInfo(@Query("roomUid") long roomUid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -177,4 +177,6 @@ public interface IAvRoomModel extends IModel {
|
||||
Single<String> cleanScreen(long roomUid, long uid);
|
||||
|
||||
Single<List<HomeRoomInfo>> getRecommendRoomList(String roomId);
|
||||
|
||||
Single<RoomInfo> getNextSingleRoomInfo();
|
||||
}
|
||||
|
Reference in New Issue
Block a user