Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.views.FunGamesViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FunGamesAdapter extends RecyclerView.Adapter {
|
||||
private List<ActiveModel> activeModels = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View funGameView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_fun_games, parent, false);
|
||||
return new FunGamesViewHolder(funGameView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof FunGamesViewHolder) {
|
||||
FunGamesViewHolder funGamesViewHolder = (FunGamesViewHolder) holder;
|
||||
funGamesViewHolder.showView(activeModels.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return activeModels.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据源
|
||||
*
|
||||
* @param mActiveModels
|
||||
*/
|
||||
public void addData(List<ActiveModel> mActiveModels) {
|
||||
activeModels.clear();
|
||||
activeModels.addAll(mActiveModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.FunGamesAdapter;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直播间合计弹窗
|
||||
*/
|
||||
public class LiveTotalDialog extends AbsDialogFragment {
|
||||
private RecyclerView funGamesList;
|
||||
private FunGamesAdapter gamesAdapter;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_live_total;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Bus.getOn(this);
|
||||
funGamesList = (RecyclerView) findViewById(R.id.fun_games_list);
|
||||
gamesAdapter = new FunGamesAdapter();
|
||||
funGamesList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
funGamesList.setAdapter(gamesAdapter);
|
||||
LiveNetManager.get(getContext())
|
||||
.getActiveList(new HttpCallback<List<ActiveModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ActiveModel> data) {
|
||||
if (!isDetached())
|
||||
gamesAdapter.addData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
//粉丝团
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.fan_club), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//守护
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.GUARD));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//周星榜
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_wks_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//贵族
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.noble_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.NOBLE));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//连麦
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_link_mic), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//特效设置
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.effects_settings_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.EFFECTS_SETTINGS));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onOpenDrawer(LiveAudienceEvent event) {
|
||||
switch (event.getType()) {
|
||||
case CURRENT_ACTIVITY:
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveAudienceEvent extends BaseModel {
|
||||
private LiveAudienceType type;
|
||||
private ActiveModel model = new ActiveModel();
|
||||
|
||||
public ActiveModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setModel(ActiveModel model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveAudienceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setType(LiveAudienceType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public enum LiveAudienceType {
|
||||
SIDEBAR(1, "侧边栏"),
|
||||
BOTTOM_COLLECTION(2, "底部合集"),
|
||||
GIFT_POPUP(3, "礼物弹窗"),
|
||||
CURRENT_ACTIVITY(4, "当前活动"),
|
||||
FAN_CLUB(5, "粉絲團"),
|
||||
GUARD(6, "守護"),
|
||||
LIVE_WKS(7, "周星榜"),
|
||||
NOBLE(8, "贵族"),
|
||||
LIAN_MAI(9, "连麦"),
|
||||
EFFECTS_SETTINGS(10, "特效設置"),
|
||||
WISH_LIST(11,"心愿单");
|
||||
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
LiveAudienceType(int type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView funGamePic;
|
||||
private TextView funGameName;
|
||||
|
||||
public FunGamesViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
funGamePic = itemView.findViewById(R.id.fun_game_pic);
|
||||
funGameName = itemView.findViewById(R.id.fun_game_name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据
|
||||
*
|
||||
* @param model 数据模型
|
||||
*/
|
||||
public void showView(ActiveModel model) {
|
||||
ImgLoader.display(itemView.getContext(), model.getActiveImg(), funGamePic);
|
||||
funGameName.setText(model.getActiveName());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.CURRENT_ACTIVITY)
|
||||
.setModel(model));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
10
common/src/main/res/anim/right_anim_enter.xml
Normal file
10
common/src/main/res/anim/right_anim_enter.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
|
||||
<translate
|
||||
android:duration="200"
|
||||
android:fromXDelta="100%p"
|
||||
android:toXDelta="0"
|
||||
/>
|
||||
</set>
|
||||
9
common/src/main/res/anim/right_anim_exit.xml
Normal file
9
common/src/main/res/anim/right_anim_exit.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:duration="200"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="100%p"
|
||||
/>
|
||||
</set>
|
||||
@@ -66,7 +66,10 @@
|
||||
<item name="android:windowEnterAnimation">@anim/left_anim_enter</item>
|
||||
<item name="android:windowExitAnimation">@anim/left_anim_exit</item>
|
||||
</style>
|
||||
|
||||
<style name="RightLeftToAnim" parent="android:Animation">
|
||||
<item name="android:windowEnterAnimation">@anim/right_anim_enter</item>
|
||||
<item name="android:windowExitAnimation">@anim/right_anim_exit</item>
|
||||
</style>
|
||||
<style name="groupLast" parent="AppTheme">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">1dp</item>
|
||||
|
||||
Reference in New Issue
Block a user