diff --git a/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java new file mode 100644 index 000000000..f74361143 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/FunGamesAdapter.java @@ -0,0 +1,50 @@ +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 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 mActiveModels) { + activeModels.clear(); + activeModels.addAll(mActiveModels); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/ActiveModel.java b/common/src/main/java/com/yunbao/common/bean/ActiveModel.java new file mode 100644 index 000000000..79387f959 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/ActiveModel.java @@ -0,0 +1,72 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +/** + * 活动 + */ +public class ActiveModel extends BaseModel { + /** + * active_id : 3 + * active_name : 闖關熱戀 + * active_img : https://qny.shayucm.com/chuangguan.png + * active_src : h5/activity/PassionateLove/index.html + * show_type : 0 + */ + + @SerializedName("active_id") + private String activeId = ""; + @SerializedName("active_name") + private String activeName = ""; + @SerializedName("active_img") + private String activeImg = ""; + @SerializedName("active_src") + private String activeSrc = ""; + @SerializedName("show_type") + private String showType = ""; + + public String getActiveId() { + return activeId; + } + + public ActiveModel setActiveId(String activeId) { + this.activeId = activeId; + return this; + } + + public String getActiveName() { + return activeName; + } + + public ActiveModel setActiveName(String activeName) { + this.activeName = activeName; + return this; + } + + public String getActiveImg() { + return activeImg; + } + + public ActiveModel setActiveImg(String activeImg) { + this.activeImg = activeImg; + return this; + } + + public String getActiveSrc() { + return activeSrc; + } + + public ActiveModel setActiveSrc(String activeSrc) { + this.activeSrc = activeSrc; + return this; + } + + public String getShowType() { + return showType; + } + + public ActiveModel setShowType(String showType) { + this.showType = showType; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java b/common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java new file mode 100644 index 000000000..38001f978 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiveTotalDialog.java @@ -0,0 +1,75 @@ +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.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.ToastUtil; + +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); + 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>() { + @Override + public void onSuccess(List data) { + if (!isDetached()) + gamesAdapter.addData(data); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + } + + @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); + } + +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 6b1bdb583..7f32922ae 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1,5 +1,6 @@ package com.yunbao.common.http; +import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.FaceBookUpModel; @@ -141,4 +142,10 @@ public interface PDLiveApi { Observable>> getHot( @Query("p") int page ); + + /** + * 获取活动 + */ + @GET("/api/public/?service=Active.getActiveList") + Observable>> getActiveList(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 12e727bbd..2689c995c 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -2,12 +2,12 @@ package com.yunbao.common.http.live; import android.content.Context; +import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.http.API; -import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.HttpCallback; import java.util.List; @@ -136,4 +136,20 @@ public class LiveNetManager { } }).isDisposed(); } + + /** + * 获取活动列表 + */ + public void getActiveList(HttpCallback> callback) { + API.get().pdLiveApi(mContext).getActiveList() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + if (callback != null) + callback.onError(throwable.getMessage()); + }).isDisposed(); + } } diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java new file mode 100644 index 000000000..1db03b551 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -0,0 +1,33 @@ +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.glide.ImgLoader; + +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()); + } +} diff --git a/common/src/main/res/drawable/bg_live_tota.xml b/common/src/main/res/drawable/bg_live_tota.xml new file mode 100644 index 000000000..74ca8bdc9 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_tota.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_fun_games.xml b/common/src/main/res/layout/view_fun_games.xml new file mode 100644 index 000000000..22261996d --- /dev/null +++ b/common/src/main/res/layout/view_fun_games.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_live_total.xml b/common/src/main/res/layout/view_live_total.xml new file mode 100644 index 000000000..aed38e3c2 --- /dev/null +++ b/common/src/main/res/layout/view_live_total.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_aristocrat.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_aristocrat.png new file mode 100644 index 000000000..b2b97683d Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_aristocrat.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_connect.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_connect.png new file mode 100644 index 000000000..f17097d02 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_connect.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_events.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_events.png new file mode 100644 index 000000000..9f30b104a Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_events.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_fans.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_fans.png new file mode 100644 index 000000000..34b4a496e Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_fans.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_guard.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_guard.png new file mode 100644 index 000000000..d4af4da88 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_guard.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_special.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_special.png new file mode 100644 index 000000000..5f2cefbb4 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_special.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/live_more_icon_zhouxinglist.png b/common/src/main/res/mipmap-xxhdpi/live_more_icon_zhouxinglist.png new file mode 100644 index 000000000..3361c8b93 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/live_more_icon_zhouxinglist.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 97983f066..ffdd4c35f 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -872,4 +872,10 @@ 更多 精彩直播 為您推薦 + 趣味游戏 + 增值权益 + 粉絲團 + 活動中心 + 基础工具 + 特效設置 diff --git a/config.gradle b/config.gradle index 492fa93ba..3f66756b1 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //測試 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 1c9eaadac..61b2c877c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -50,6 +50,7 @@ import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.custom.MyViewPager; import com.yunbao.common.dialog.LiveChargeDialogFragment; +import com.yunbao.common.dialog.LiveTotalDialog; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -419,6 +420,8 @@ public class LiveAudienceActivity extends LiveActivity { } }); + + } //定时器 @@ -1381,8 +1384,17 @@ public class LiveAudienceActivity extends LiveActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onOpenDrawer(LiveAudienceEvent event) { - //从右边打开侧边栏 - drawerLayout.openDrawer(GravityCompat.END); + switch (event.getType()) { + case SIDEBAR: + //从右边打开侧边栏 + drawerLayout.openDrawer(GravityCompat.END); + break; + case BOTTOMCOLLECTION: + LiveTotalDialog fragment = new LiveTotalDialog(); + fragment.show(getSupportFragmentManager(), "LiveTotalDialog"); + break; + } + } } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 50eeec712..e3693c53b 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -3,4 +3,28 @@ package com.yunbao.live.event; import com.yunbao.common.bean.BaseModel; public class LiveAudienceEvent extends BaseModel { + private LiveAudienceType type; + + public LiveAudienceType getType() { + return type; + } + + public LiveAudienceEvent setType(LiveAudienceType type) { + this.type = type; + return this; + } + + public enum LiveAudienceType { + SIDEBAR(1, "侧边栏"), + BOTTOMCOLLECTION(2, "底部合集"); + + private int type; + private String name; + + LiveAudienceType(int type, String name) { + this.type = type; + this.name = name; + } + + } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 718057136..77b12a771 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -32,13 +32,16 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.dialog.LiveTotalDialog; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.imrongcloud.MessageIMManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; @@ -46,6 +49,7 @@ import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LivePromotionDialogFragment; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpUtil; import org.greenrobot.eventbus.EventBus; @@ -290,6 +294,15 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } } }); + //底部改造 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.total_image), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.BOTTOMCOLLECTION)); + + } + }); } public static Handler handler = new Handler(); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 327997d48..ab91a90ac 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -8,7 +8,6 @@ import android.os.Message; import android.os.SystemClock; import android.text.TextUtils; import android.util.Log; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -107,7 +106,7 @@ import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer; * Created by cxf on 2018/10/9. * 直播间公共逻辑 */ -public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickListener{ +public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickListener { public static Context Contexts; private int mOffsetY; @@ -792,7 +791,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ft_hot_add = (FrameLayout) findViewById(R.id.ft_hot_add); img_hot_gif = (ImageView) findViewById(R.id.img_hot_gif); findViewById(R.id.ft_hot_add).setOnClickListener(this); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_sidebar), () -> Bus.get().post(new LiveAudienceEvent())); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.open_sidebar), () -> Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SIDEBAR))); } //点击头像 diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index abc802a79..e7cb1f369 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -112,7 +112,7 @@ android:layout_height="80dp" android:layout_gravity="right" android:layout_marginRight="15dp" - android:layout_marginBottom="18dp" + android:layout_marginBottom="45dp" android:gravity="center_horizontal" android:orientation="vertical"> @@ -228,8 +228,8 @@ + android:layout_height="45dp" + android:layout_alignParentBottom="true"> + android:src="@mipmap/zg" + android:visibility="gone" /> + android:layout_toLeftOf="@id/btn_zg" + android:visibility="gone"> + android:src="@mipmap/live_lw" + android:visibility="gone" /> + android:src="@mipmap/live_user_more" + android:visibility="gone" /> + android:src="@mipmap/lianmai" + android:visibility="gone" /> + + + + + + + + + + + + + android:layout_toEndOf="@id/message_layout"> - - - - - - - - - + android:layout_toEndOf="@+id/msg_view" + android:padding="5dp" + android:src="@mipmap/live_icon_more" /> + + + diff --git a/live/src/main/res/mipmap-xxxhdpi/live_icon_more.png b/live/src/main/res/mipmap-xxxhdpi/live_icon_more.png new file mode 100644 index 000000000..33c0b3fc0 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/live_icon_more.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/live_icon_new_people_cn.png b/live/src/main/res/mipmap-xxxhdpi/live_icon_new_people_cn.png new file mode 100644 index 000000000..2b6914ff5 Binary files /dev/null and b/live/src/main/res/mipmap-xxxhdpi/live_icon_new_people_cn.png differ