房间邀请粉丝
This commit is contained in:
@@ -96,6 +96,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
addGiftValueAction(optAdapter);
|
||||
addRoomSettingAction(optAdapter);
|
||||
addRedPackageSwitch();
|
||||
addInviteFansOptAdapter();
|
||||
//addRoomModuleHallAction(optAdapter);
|
||||
//addRoomManagerAction(optAdapter);
|
||||
addSuperAdminAction(optAdapter);
|
||||
@@ -121,6 +122,8 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PK 模式
|
||||
*
|
||||
@@ -305,6 +308,22 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请粉丝
|
||||
*/
|
||||
private void addInviteFansOptAdapter() {
|
||||
if (!AvRoomDataManager.get().isManager()) {
|
||||
return;
|
||||
}
|
||||
optAdapter.addData(new OptAction(R.drawable.ic_room_invite_fans,
|
||||
"邀请粉丝",
|
||||
() -> {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onInviteFans();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼物值
|
||||
*/
|
||||
@@ -446,6 +465,8 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
|
||||
void onSwitchRedPackage();
|
||||
|
||||
void onInviteFans();
|
||||
|
||||
}
|
||||
|
||||
public void setOnActionListener(OnActionListener onActionListener) {
|
||||
|
@@ -114,6 +114,7 @@ import com.yizhuan.erban.ui.widget.marqueeview.AvRoomNobleWelcomeView;
|
||||
import com.yizhuan.erban.utils.KeyBoardUtils;
|
||||
import com.yizhuan.erban.utils.UserUtils;
|
||||
import com.yizhuan.tutu.music.widget.MusicPlayerView;
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomInviteFansActivity;
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
@@ -2311,6 +2312,12 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
|
||||
});
|
||||
}
|
||||
|
||||
//邀请粉丝
|
||||
@Override
|
||||
public void onInviteFans() {
|
||||
RoomInviteFansActivity.start(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetting() {
|
||||
RoomSettingActivity.start(mContext);
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_room_invite_fans.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_room_invite_fans.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
14
app/src/main/res/drawable/shap_round_room_invite_des.xml
Normal file
14
app/src/main/res/drawable/shap_round_room_invite_des.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid
|
||||
android:color="#ffcac2ff" />
|
||||
|
||||
<corners
|
||||
android:radius="@dimen/dp_100" />
|
||||
<size
|
||||
android:height="5dp"
|
||||
android:width="5dp"/>
|
||||
|
||||
</shape>
|
@@ -0,0 +1,142 @@
|
||||
package com.yizhuan.tutu.room_chat.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.coorchice.library.utils.LogUtils;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.common.ViewPagerAdapter;
|
||||
import com.yizhuan.erban.decoration.view.widgets.CarMagicIndicator;
|
||||
import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
||||
import com.yizhuan.erban.ui.login.CodeDownDescTimer;
|
||||
import com.yizhuan.tutu.room_chat.event.ClickRootViewEvent;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgAttentionFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgFansListFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgFriendListFragment;
|
||||
import com.yizhuan.tutu.room_chat.fragment.RoomMsgRecentListFragment;
|
||||
import com.yizhuan.tutu.room_chat.model.RoomInviteFansModel;
|
||||
import com.yizhuan.tutu.room_chat.utils.InViteFansTimer;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class RoomInviteFansActivity extends BaseActivity {
|
||||
|
||||
private InViteFansTimer timer;
|
||||
@BindView(R.id.tv_invite_fans_count)
|
||||
TextView tvInviteFansCount;
|
||||
@BindView(R.id.tv_invite_fans_times)
|
||||
TextView tvInviteFansTimes;
|
||||
@BindView(R.id.tv_invite_fans_confirm)
|
||||
TextView tvInviteFansConfirm;
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, RoomInviteFansActivity.class);
|
||||
//starter.putExtra();
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void init() {
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo == null){
|
||||
return;
|
||||
}
|
||||
getInviteFans();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void getInviteFans(){
|
||||
RoomInviteFansModel.INSTANCE.getRoomInviteFans(AvRoomDataManager.get().mCurrentRoomInfo.getUid())
|
||||
.doOnError(throwable -> LogUtil.print(throwable.getMessage()))
|
||||
.subscribe(info -> {
|
||||
tvInviteFansCount.setText(Html.fromHtml("确认邀请后会给收藏该房间的"+"<font color=#7154EE font-size=12dp>"+info.getFansNum()+"</font>"+"位用户发送提醒"));
|
||||
tvInviteFansTimes.setText(Html.fromHtml("今日剩余"+"<font color=#7662FE font-size=18dp>"+info.getInviteTimes()+"</font>"+"次"));
|
||||
if (info.getInviteInterval() > 0){
|
||||
tvInviteFansConfirm.setClickable(false);
|
||||
startCountDownTimer(info.getInviteInterval());
|
||||
}else {
|
||||
tvInviteFansConfirm.setClickable(true);
|
||||
tvInviteFansConfirm.setText("确认邀请");
|
||||
tvInviteFansConfirm.setOnClickListener(v -> {
|
||||
RoomInviteFansModel.INSTANCE.setRoomInviteFans(AvRoomDataManager.get().mCurrentRoomInfo.getUid())
|
||||
.doOnSuccess(s -> {getInviteFans();})
|
||||
.subscribe();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_room_invite_fans);
|
||||
ButterKnife.bind(this);
|
||||
init();
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopCountDownTimer();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@OnClick(R.id.root_view)
|
||||
public void onViewClicked() {
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRootViewClicked(ClickRootViewEvent event) {
|
||||
onViewClicked();
|
||||
}
|
||||
|
||||
private void startCountDownTimer(long timeSecond) {
|
||||
stopCountDownTimer();
|
||||
timer = new InViteFansTimer(tvInviteFansConfirm,timeSecond*1000, 1000);
|
||||
timer.start();
|
||||
}
|
||||
|
||||
private void stopCountDownTimer() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.yizhuan.tutu.room_chat.bean
|
||||
|
||||
|
||||
data class RoomInviteFansInfo(
|
||||
var inviteTimes: Int = 0,//剩余邀请次数
|
||||
var inviteInterval:Long = 0,//邀请需要等待多少秒
|
||||
var fansNum:Int = 0//粉丝数
|
||||
)
|
@@ -0,0 +1,55 @@
|
||||
package com.yizhuan.tutu.room_chat.model
|
||||
|
||||
|
||||
|
||||
import com.yizhuan.tutu.room_chat.bean.RoomInviteFansInfo
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.redpackage.RedPackageInfo
|
||||
import com.yizhuan.xchat_android_core.utils.net.handleBeanData
|
||||
import com.yizhuan.xchat_android_core.utils.net.handleStringData
|
||||
import com.yizhuan.xchat_android_core.utils.net.io2main
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.*
|
||||
|
||||
object RoomInviteFansModel {
|
||||
|
||||
|
||||
private val api: Api
|
||||
|
||||
init {
|
||||
api = RxNet.create(Api::class.java)
|
||||
}
|
||||
|
||||
fun setRoomInviteFans(roomUid: Long):Single<String> {
|
||||
return api.setRoomInviteFans(roomUid)
|
||||
.io2main()
|
||||
.handleStringData()
|
||||
}
|
||||
|
||||
|
||||
fun getRoomInviteFans(roomUid: Long):Single<RoomInviteFansInfo> {
|
||||
return api.getRoomInviteFans(roomUid)
|
||||
.io2main()
|
||||
.handleBeanData()
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 房间邀请粉丝
|
||||
*/
|
||||
@POST("/room/inviteFans")
|
||||
fun setRoomInviteFans(@Query("roomUid") uid: Long): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
* 获取房间邀请粉丝
|
||||
*/
|
||||
@GET("/room/inviteFans")
|
||||
fun getRoomInviteFans(@Query("roomUid") uid: Long): Single<ServiceResult<RoomInviteFansInfo>>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.yizhuan.tutu.room_chat.utils;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
/**
|
||||
* Created by zhouxiangfeng on 2017/5/2.
|
||||
*/
|
||||
|
||||
public class InViteFansTimer extends CountDownTimer {
|
||||
private TextView tvInvite;
|
||||
|
||||
/**
|
||||
* @param tvInvite
|
||||
* @param millisInFuture The number of millis in the future from the call
|
||||
* to {@link #start()} until the countdown is done and {@link #onFinish()}
|
||||
* is called.
|
||||
* @param countDownInterval The interval along the way to receiver
|
||||
* {@link #onTick(long)} callbacks.
|
||||
*/
|
||||
public InViteFansTimer(TextView tvInvite, long millisInFuture, long countDownInterval) {
|
||||
super(millisInFuture, countDownInterval);
|
||||
this.tvInvite = tvInvite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
tvInvite.setClickable(false); //设置不可点击
|
||||
tvInvite.setText(inviteInterval((int)millisUntilFinished/1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
tvInvite.setText(Html.fromHtml("确认邀请"));
|
||||
tvInvite.setClickable(true);//重新获得点击
|
||||
|
||||
}
|
||||
|
||||
private String inviteInterval(int timeSecond){
|
||||
return (timeSecond / 60) + "分" + (timeSecond % 60) + "秒后可邀请";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:background="@color/color_666666">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="273dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/shape_white_top_14dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:text="邀请房间粉丝"
|
||||
android:textColor="@color/color_black_333333"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_invite_fans_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认邀请后会给收藏该房间的2384位用户发送提醒"
|
||||
android:drawableStart="@drawable/shap_round_room_invite_des"
|
||||
android:drawablePadding="8dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_23"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="每日发送次数不可超过5次"
|
||||
android:drawableStart="@drawable/shap_round_room_invite_des"
|
||||
android:drawablePadding="8dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_14"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1小时内限发送一次邀请"
|
||||
android:drawableStart="@drawable/shap_round_room_invite_des"
|
||||
android:drawablePadding="8dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:layout_marginTop="@dimen/dp_14"
|
||||
android:textSize="@dimen/dp_12"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_invite_fans_confirm"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="38dp"
|
||||
android:background="@drawable/bg_common_confirm_normal_22r"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="确认邀请"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_invite_fans_times"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="今天剩余5次"
|
||||
android:textSize="13dp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
Reference in New Issue
Block a user