Commit 07b31ccc by Dell

1、修改直播间状态

2、修改直播间样式和布局
3、修改赛事样式和布局
4、修改主页样式和布局
parent 814b47f7
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
//apply plugin: 'com.github.dcendents.android-maven' //apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'com.jfrog.bintray' //apply plugin: 'com.jfrog.bintray'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def config = rootProject.ext.ver def config = rootProject.ext.ver
def library = rootProject.ext.library def library = rootProject.ext.library
...@@ -25,4 +27,5 @@ android { ...@@ -25,4 +27,5 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.1.0' compile 'com.android.support:support-v4:25.1.0'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
} }
...@@ -2,16 +2,21 @@ package com.flyco.tablayout; ...@@ -2,16 +2,21 @@ package com.flyco.tablayout;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
...@@ -25,10 +30,13 @@ import androidx.fragment.app.Fragment; ...@@ -25,10 +30,13 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.flyco.tablayout.listener.OnTabSelectListener; import com.flyco.tablayout.listener.OnTabSelectListener;
import com.flyco.tablayout.utils.FragmentBasePager2Adapter;
import com.flyco.tablayout.utils.UnreadMsgUtils; import com.flyco.tablayout.utils.UnreadMsgUtils;
import com.flyco.tablayout.widget.MsgView; import com.flyco.tablayout.widget.MsgView;
...@@ -39,31 +47,33 @@ import java.util.Collections; ...@@ -39,31 +47,33 @@ import java.util.Collections;
* 滑动TabLayout,对于ViewPager的依赖性强 * 滑动TabLayout,对于ViewPager的依赖性强
*/ */
public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.OnPageChangeListener { public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.OnPageChangeListener {
private Context mContext; private final Context mContext;
private ViewPager mViewPager; private ViewPager mViewPager;
private ViewPager2 mVp2;
private ArrayList<String> mTitles; private ArrayList<String> mTitles;
private LinearLayout mTabsContainer; private final LinearLayout mTabsContainer;
private int mCurrentTab; private int mCurrentTab;
private float mCurrentPositionOffset; private float mCurrentPositionOffset;
private int mTabCount; private int mTabCount;
private int rectArc = 5; private final int rectArc = 5;
/** /**
* 用于绘制显示器 * 用于绘制显示器
*/ */
private Rect mIndicatorRect = new Rect(); private final Rect mIndicatorRect = new Rect();
/** /**
* 用于实现滚动居中 * 用于实现滚动居中
*/ */
private Rect mTabRect = new Rect(); private final Rect mTabRect = new Rect();
private GradientDrawable mIndicatorDrawable = new GradientDrawable(); private final GradientDrawable mIndicatorDrawable = new GradientDrawable();
private Paint mRectPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mRectPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mDividerPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mDividerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mTrianglePaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mTrianglePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Path mTrianglePath = new Path(); private final Path mTrianglePath = new Path();
private static final int STYLE_NORMAL = 0; private static final int STYLE_NORMAL = 0;
private static final int STYLE_TRIANGLE = 1; private static final int STYLE_TRIANGLE = 1;
private static final int STYLE_BLOCK = 2; private static final int STYLE_BLOCK = 2;
private static final int STYLE_CUSTOM = 3;
private int mIndicatorStyle = STYLE_NORMAL; private int mIndicatorStyle = STYLE_NORMAL;
//左对齐 //左对齐
...@@ -116,6 +126,8 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -116,6 +126,8 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
private int mLastScrollX; private int mLastScrollX;
private int mHeight; private int mHeight;
private boolean mSnapOnTabClick; private boolean mSnapOnTabClick;
private Bitmap mBitmap;
private Paint mSelectedIndicatorPaint;
public SlidingTabLayout(Context context) { public SlidingTabLayout(Context context) {
this(context, null, 0); this(context, null, 0);
...@@ -187,6 +199,12 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -187,6 +199,12 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
mTabWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_width, dp2px(-1)); mTabWidth = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_width, dp2px(-1));
mTabPadding = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_padding, mTabSpaceEqual || mTabWidth > 0 ? dp2px(0) : dp2px(19)); mTabPadding = ta.getDimension(R.styleable.SlidingTabLayout_tl_tab_padding, mTabSpaceEqual || mTabWidth > 0 ? dp2px(0) : dp2px(19));
mFirstNonePadding = ta.getBoolean(R.styleable.SlidingTabLayout_tl_tab_padding_none_first, false); mFirstNonePadding = ta.getBoolean(R.styleable.SlidingTabLayout_tl_tab_padding_none_first, false);
Drawable drawable = ta.getDrawable(R.styleable.SlidingTabLayout_tl_tab_drawable);
if (drawable != null) {
BitmapDrawable bd = (BitmapDrawable) drawable;
mBitmap = bd.getBitmap();
mSelectedIndicatorPaint = new Paint();
}
ta.recycle(); ta.recycle();
} }
...@@ -206,6 +224,40 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -206,6 +224,40 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void setViewPager2(ViewPager2 vp) {
if (vp == null || vp.getAdapter() == null) {
throw new IllegalStateException("ViewPager or ViewPager adapter can not be NULL !");
}
this.mVp2 = vp;
this.mVp2.unregisterOnPageChangeCallback(onPageChangeCallback);
this.mVp2.registerOnPageChangeCallback(onPageChangeCallback);
notifyDataSetChanged();
}
private final ViewPager2.OnPageChangeCallback onPageChangeCallback = new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
mCurrentTab = position;
mCurrentPositionOffset = positionOffset;
scrollToCurrentTab();
invalidate();
}
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
updateTabSelection(position);
}
@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
}
};
/** /**
* 关联ViewPager,用于不想在ViewPager适配器中设置titles数据的情况 * 关联ViewPager,用于不想在ViewPager适配器中设置titles数据的情况
*/ */
...@@ -255,18 +307,38 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -255,18 +307,38 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
* 更新数据 * 更新数据
*/ */
public void notifyDataSetChanged() { public void notifyDataSetChanged() {
FragmentBasePager2Adapter adapter = null;
if (mVp2 != null) {
adapter = (FragmentBasePager2Adapter) mVp2.getAdapter();
}
mTabsContainer.removeAllViews(); mTabsContainer.removeAllViews();
if (mVp2 != null) {
this.mTabCount = mTitles == null ? mVp2.getAdapter().getItemCount() : mTitles.size();
} else {
this.mTabCount = mTitles == null ? mViewPager.getAdapter().getCount() : mTitles.size(); this.mTabCount = mTitles == null ? mViewPager.getAdapter().getCount() : mTitles.size();
}
View tabView; View tabView;
for (int i = 0; i < mTabCount; i++) { for (int i = 0; i < mTabCount; i++) {
tabView = View.inflate(mContext, R.layout.layout_tab, null); tabView = View.inflate(mContext, R.layout.layout_tab, null);
CharSequence pageTitle = mTitles == null ? mViewPager.getAdapter().getPageTitle(i) : mTitles.get(i); CharSequence pageTitle = "";
if (mVp2 != null) {
pageTitle = mTitles == null ? adapter.getPageTitle(i) : mTitles.get(i);
} else {
pageTitle = mTitles == null ? mViewPager.getAdapter().getPageTitle(i) : mTitles.get(i);
}
addTab(i, pageTitle.toString(), tabView); addTab(i, pageTitle.toString(), tabView);
} }
updateTabStyles(); updateTabStyles();
} }
public void addNewTab(String title) { public void addNewTab(String title) {
View tabView = View.inflate(mContext, R.layout.layout_tab, null); View tabView = View.inflate(mContext, R.layout.layout_tab, null);
if (mTitles != null) { if (mTitles != null) {
...@@ -294,6 +366,23 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -294,6 +366,23 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
public void onClick(View v) { public void onClick(View v) {
int position = mTabsContainer.indexOfChild(v); int position = mTabsContainer.indexOfChild(v);
if (position != -1) { if (position != -1) {
if (mVp2 != null) {
if (mVp2.getCurrentItem() != position) {
if (mSnapOnTabClick) {
mVp2.setCurrentItem(position, false);
} else {
mVp2.setCurrentItem(position);
}
if (mListener != null) {
mListener.onTabSelect(position);
}
} else {
if (mListener != null) {
mListener.onTabReselect(position);
}
}
} else {
if (mViewPager.getCurrentItem() != position) { if (mViewPager.getCurrentItem() != position) {
if (mSnapOnTabClick) { if (mSnapOnTabClick) {
mViewPager.setCurrentItem(position, false); mViewPager.setCurrentItem(position, false);
...@@ -311,9 +400,12 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -311,9 +400,12 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
} }
} }
} }
}
}); });
/** 每一个Tab的布局参数 */ /**
* 每一个Tab的布局参数
*/
LinearLayout.LayoutParams lp_tab = mTabSpaceEqual ? LinearLayout.LayoutParams lp_tab = mTabSpaceEqual ?
new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) :
new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
...@@ -373,6 +465,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -373,6 +465,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
public void onPageScrollStateChanged(int state) { public void onPageScrollStateChanged(int state) {
} }
/** /**
* HorizontalScrollView滚到当前tab,并且居中显示 * HorizontalScrollView滚到当前tab,并且居中显示
*/ */
...@@ -461,11 +554,19 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -461,11 +554,19 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
mTabRect.left = (int) left; mTabRect.left = (int) left;
mTabRect.right = (int) right; mTabRect.right = (int) right;
if (mIndicatorWidth >= 0) {//indicatorWidth大于0时,圆角矩形以及三角形
float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2;
if (mIndicatorWidth < 0) { //indicatorWidth小于0时,原jpardogo's PagerSlidingTabStrip if (this.mCurrentTab < mTabCount - 1) {
View nextTab = mTabsContainer.getChildAt(this.mCurrentTab + 1);
indicatorLeft = indicatorLeft + mCurrentPositionOffset * (currentTabView.getWidth() / 2 + nextTab.getWidth() / 2);
}
} else {//indicatorWidth大于0时,圆角矩形以及三角形 mIndicatorRect.left = (int) indicatorLeft;
float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2; mIndicatorRect.right = (int) (mIndicatorRect.left + mIndicatorWidth);
}
if (mIndicatorStyle == STYLE_CUSTOM) {
float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2 - mBitmap.getWidth() / 2;
if (this.mCurrentTab < mTabCount - 1) { if (this.mCurrentTab < mTabCount - 1) {
View nextTab = mTabsContainer.getChildAt(this.mCurrentTab + 1); View nextTab = mTabsContainer.getChildAt(this.mCurrentTab + 1);
...@@ -544,17 +645,20 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -544,17 +645,20 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
mIndicatorDrawable.setCornerRadius(mIndicatorCornerRadius); mIndicatorDrawable.setCornerRadius(mIndicatorCornerRadius);
mIndicatorDrawable.draw(canvas); mIndicatorDrawable.draw(canvas);
} }
} else if (mIndicatorStyle == STYLE_CUSTOM) {
if (mIndicatorHeight > 0) {
Log.e("indicator", "paddingLeft = " + paddingLeft + "mIndicatorRect.left = " + mIndicatorRect.left + "mIndicatorRect.right = " + mIndicatorRect.right);
canvas.drawBitmap(mBitmap, paddingLeft + (int) mIndicatorMarginLeft + mIndicatorRect.left + 5, getHeight() - mBitmap.getHeight() - 30, mSelectedIndicatorPaint);
}
} else { } else {
/* mRectPaint.setColor(mIndicatorColor); /* mRectPaint.setColor(mIndicatorColor);
calcIndicatorRect(); calcIndicatorRect();
canvas.drawRect(getPaddingLeft() + mIndicatorRect.left, getHeight() - mIndicatorHeight, canvas.drawRect(getPaddingLeft() + mIndicatorRect.left, getHeight() - mIndicatorHeight,
mIndicatorRect.right + getPaddingLeft(), getHeight(), mRectPaint);*/ mIndicatorRect.right + getPaddingLeft(), getHeight(), mRectPaint);*/
if (mIndicatorHeight > 0) { if (mIndicatorHeight > 0) {
mIndicatorDrawable.setColor(mIndicatorColor); mIndicatorDrawable.setColor(mIndicatorColor);
mIndicatorCornerRadius = mIndicatorHeight / 2;
if (mIndicatorGravity == Gravity.BOTTOM) { if (mIndicatorGravity == Gravity.BOTTOM) {
mIndicatorDrawable.setBounds(paddingLeft + (int) mIndicatorMarginLeft + mIndicatorRect.left, mIndicatorDrawable.setBounds(paddingLeft + (int) mIndicatorMarginLeft + mIndicatorRect.left,
...@@ -576,10 +680,16 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -576,10 +680,16 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
//setter and getter //setter and getter
public void setCurrentTab(int currentTab) { public void setCurrentTab(int currentTab) {
this.mCurrentTab = currentTab; this.mCurrentTab = currentTab;
if (mVp2!=null){
mVp2.setCurrentItem(currentTab);
}else {
mViewPager.setCurrentItem(currentTab); mViewPager.setCurrentItem(currentTab);
}
} }
public void setCurrentTab(int currentTab, boolean smoothScroll) { public void setCurrentTab(int currentTab, boolean smoothScroll) {
this.mCurrentTab = currentTab; this.mCurrentTab = currentTab;
mViewPager.setCurrentItem(currentTab, smoothScroll); mViewPager.setCurrentItem(currentTab, smoothScroll);
...@@ -809,8 +919,8 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -809,8 +919,8 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
//setter and getter //setter and getter
// show MsgTipView // show MsgTipView
private Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private SparseArray<Boolean> mInitSetMap = new SparseArray<>(); private final SparseArray<Boolean> mInitSetMap = new SparseArray<>();
/** /**
* 显示未读消息 * 显示未读消息
...@@ -905,7 +1015,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -905,7 +1015,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
class InnerPagerAdapter extends FragmentPagerAdapter { class InnerPagerAdapter extends FragmentPagerAdapter {
private ArrayList<Fragment> fragments = new ArrayList<>(); private ArrayList<Fragment> fragments = new ArrayList<>();
private String[] titles; private final String[] titles;
public InnerPagerAdapter(FragmentManager fm, ArrayList<Fragment> fragments, String[] titles) { public InnerPagerAdapter(FragmentManager fm, ArrayList<Fragment> fragments, String[] titles) {
super(fm); super(fm);
...@@ -938,6 +1048,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager. ...@@ -938,6 +1048,7 @@ public class SlidingTabLayout extends HorizontalScrollView implements ViewPager.
public int getItemPosition(Object object) { public int getItemPosition(Object object) {
return PagerAdapter.POSITION_NONE; return PagerAdapter.POSITION_NONE;
} }
} }
@Override @Override
......
package com.flyco.tablayout.utils
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import java.util.ArrayList
/**
* @author by Dell
* @date on 2021/8/18
* @describe
*/
public class FragmentBasePager2Adapter(fm: FragmentManager?, fragments: ArrayList<Fragment>?, titles: Array<String?>,lifecycle: Lifecycle) : FragmentStateAdapter(fm!!, lifecycle) {
private var mFragments: ArrayList<Fragment>? = arrayListOf()
private var mTitles: Array<String?>? = null
override fun getItemCount(): Int {
return mFragments?.size ?: 0
}
override fun createFragment(position: Int): Fragment {
return mFragments!![position]
}
fun getPageTitle(position: Int): CharSequence? {
return mTitles!![position]
}
fun getItem(position: Int): Fragment {
return mFragments!![position]
}
init {
titles.isNotEmpty().let {
if (it) {
mTitles = titles
}
}
fragments?.isNotEmpty()?.let {
if (it) {
mFragments = fragments
}
}
}
}
\ No newline at end of file
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
<attr name="tl_textSelectColor" format="color"/> <attr name="tl_textSelectColor" format="color"/>
<!-- 设置字体未选中颜色 --> <!-- 设置字体未选中颜色 -->
<attr name="tl_textUnselectColor" format="color"/> <attr name="tl_textUnselectColor" format="color"/>
<!-- 自定义图片 配合Style = Custom使用-->
<attr name="tl_tab_drawable" format="reference"/>
<!-- 设置字体加粗 --> <!-- 设置字体加粗 -->
<attr name="tl_textBold" format="enum"> <attr name="tl_textBold" format="enum">
<enum name="NONE" value="0"/> <enum name="NONE" value="0"/>
...@@ -109,6 +112,7 @@ ...@@ -109,6 +112,7 @@
<attr name="tl_tab_padding_none_first"/> <attr name="tl_tab_padding_none_first"/>
<attr name="tl_tab_space_equal"/> <attr name="tl_tab_space_equal"/>
<attr name="tl_tab_width"/> <attr name="tl_tab_width"/>
<attr name="tl_tab_drawable"/>
<!-- title --> <!-- title -->
<attr name="tl_textsize"/> <attr name="tl_textsize"/>
......
...@@ -178,6 +178,8 @@ dependencies { ...@@ -178,6 +178,8 @@ dependencies {
implementation 'com.github.zhpanvip:bannerviewpager:3.5.4' implementation 'com.github.zhpanvip:bannerviewpager:3.5.4'
// implementation 'com.github.xiaweizi:MarqueeTextView:1.0'
} }
repositories { repositories {
mavenCentral() mavenCentral()
......
...@@ -432,6 +432,7 @@ object Constants { ...@@ -432,6 +432,7 @@ object Constants {
const val USER_NICK = "user_nick" const val USER_NICK = "user_nick"
const val LIVE_ROOM_USER_NAME = "live_room_user_name" const val LIVE_ROOM_USER_NAME = "live_room_user_name"
const val LIVE_ROOM_NAME = "live_room_name"
const val USER_LEVEL = "user_level" const val USER_LEVEL = "user_level"
const val MESSAGE_USER_ID = "user_id" const val MESSAGE_USER_ID = "user_id"
const val MESSAGE_USER_RID = "user_rid" const val MESSAGE_USER_RID = "user_rid"
...@@ -474,6 +475,7 @@ object Constants { ...@@ -474,6 +475,7 @@ object Constants {
const val ROOM_COVER = "room_cover" const val ROOM_COVER = "room_cover"
const val INDEX_DATA = "index_data" const val INDEX_DATA = "index_data"
const val POSITION = "POSITION"
const val INDEX_TYPE = "index_type" const val INDEX_TYPE = "index_type"
const val INDEX_MATCH_TYPE = "index_match_type" const val INDEX_MATCH_TYPE = "index_match_type"
...@@ -481,6 +483,9 @@ object Constants { ...@@ -481,6 +483,9 @@ object Constants {
const val IS_AGREE = "IS_AGREE" const val IS_AGREE = "IS_AGREE"
const val SUBSCRIBE_MATCH = "SUBSCRIBE_MATCH"
const val SUBSCRIBE_FOLLOW = "SUBSCRIBE_FOLLOW"
const val SWITCH_MESSAGE= "SWITCH_MESSAGE" const val SWITCH_MESSAGE= "SWITCH_MESSAGE"
const val SWITCH_START_BACK= "SWITCH_START_BACK" const val SWITCH_START_BACK= "SWITCH_START_BACK"
const val SWITCH_START_MATCH= "SWITCH_START_MATCH" const val SWITCH_START_MATCH= "SWITCH_START_MATCH"
......
package com.hupu.tv.player.app.base
import android.graphics.Color
import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.OrientationHelper
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter.RequestLoadMoreListener
import com.scwang.smartrefresh.layout.SmartRefreshLayout
import com.softgarden.baselibrary.base.IBasePresenter
import com.softgarden.baselibrary.utils.DisplayUtil
import com.softgarden.baselibrary.utils.EmptyUtil
import com.softgarden.baselibrary.utils.ScreenUtil
import com.softgarden.baselibrary.widget.ColorDividerDecoration
import com.softgarden.baselibrary.widget.GridDividerDecoration
import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.ui.activity.MainActivity
import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.EmptyConfig
import com.softgarden.baselibrary.base.BaseVP2LazyFragment
import kotlin.math.log
/**
* @author by DELL
* @date on 2020/06/11
* @describe 通用的列表刷新Fragment
* 上拉刷新用的是 SmartRefreshLayout
* 下拉加载用的是 BaseAdapter带的
* 注意事项:
* 刷新控件 id必须为:mRefreshLayout
* RecyclerView id必须为:mRecyclerView
* 当然也可以自己调整
*/
abstract class RefreshVP2Fragment<P : IBasePresenter?> : BaseVP2LazyFragment<P>(), RequestLoadMoreListener {
/*** 每页请求数量 */
var PAGE_COUNT = 10
/*** 页码,默认从1开始 */
protected var PageStart = 1
var mPage = 1
protected var isRefresh = false
/*** 空布局类型 可以在这里设置默认值 */
protected var mEmptyType = 0
/*** 是否启用空布局 */
private var enableEmptyView = true
protected var mRefreshLayout: SmartRefreshLayout? = null
protected var mRecyclerView: RecyclerView? = null
private var mAdapter: BaseQuickAdapter<*, *>? = null
// public var headerView: CustomClassicsHeader? = null
/**
* 设置刷新框架,需要时调用即可
*/
protected fun initRefreshLayout() {
mRefreshLayout = view?.findViewById(R.id.mRefreshLayout)
mRefreshLayout?.let {
// headerView = CustomClassicsHeader(context)
it.isEnabled = true
it.setEnableLoadMore(false)
it.setEnableRefresh(true)
// it.setRefreshHeader(headerView!!)
it.setDisableContentWhenLoading(true)
it.setDisableContentWhenRefresh(true)
it.setOnRefreshListener { onRefresh() }
}
// headerView?.setDrawableSize(10f)
}
fun setPageCount(pageCount: Int) {
PAGE_COUNT = pageCount
}
override fun onFirstUserVisible() {
mPage = PageStart
super.onFirstUserVisible()
}
/**
* 开关刷新
*
* @param enableRefresh
*/
fun setEnableRefresh(enableRefresh: Boolean) {
mRefreshLayout?.setEnableRefresh(enableRefresh)
}
/**
* 初始化列表控件
*/
protected fun initRecyclerView() {
mRecyclerView = requireView().findViewById<View>(R.id.mRecyclerView) as RecyclerView
(mRecyclerView!!.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
}
/**
* 设置分割线
*
* @param id
*/
protected fun addItemDecoration(@ColorRes id: Int) {
mRecyclerView?.addItemDecoration(ColorDividerDecoration(ContextCompat.getColor(requireActivity(), id)))
}
protected fun addItemDecoration(@ColorRes id: Int, dp: Int) {
mRecyclerView?.addItemDecoration(ColorDividerDecoration(ContextCompat.getColor(requireActivity(), id), DisplayUtil.dip2px(requireActivity(), dp.toFloat())))
}
protected fun addItemDecoration(recyclerView: RecyclerView?, @ColorRes id: Int, dp: Int, mOrientation: Int = OrientationHelper.VERTICAL) {
recyclerView?.addItemDecoration(ColorDividerDecoration(mOrientation, ContextCompat.getColor(requireActivity(), id), DisplayUtil.dip2px(requireActivity(), dp.toFloat())))
}
protected fun addGridItemDecoration(@ColorRes id: Int, dp: Int) {
mRecyclerView?.addItemDecoration(GridDividerDecoration(DisplayUtil.dip2px(requireActivity(), dp.toFloat()), ContextCompat.getColor(requireActivity(), id)))
}
protected fun addGridItemDecoration(recyclerView: RecyclerView?, @ColorRes id: Int, dp: Int) {
recyclerView?.addItemDecoration(GridDividerDecoration(DisplayUtil.dip2px(requireActivity(), dp.toFloat()), ContextCompat.getColor(requireActivity(), id)))
}
protected fun addItemDecoration() {
//设置默认分割线
mRecyclerView?.addItemDecoration(ColorDividerDecoration(Color.parseColor("#CCCCCC")))
}
/**
* 自动刷新
*/
fun autoRefresh() {
if (mRefreshLayout != null) mRefreshLayout!!.autoRefresh(0)
}
/**
* 结束刷新
*/
fun finishRefresh() {
if (mRefreshLayout != null) mRefreshLayout!!.finishRefresh(0)
}
/***
* 是否启用空布局
* @param enableEmptyView
*/
fun setEnableEmptyView(enableEmptyView: Boolean) {
this.enableEmptyView = enableEmptyView
}
fun setEnableEmptyView(enableEmptyView: Boolean, emptyType: Int) {
this.enableEmptyView = enableEmptyView
this.mEmptyType = emptyType
}
fun setLoadData(adapter: BaseQuickAdapter<*, *>, list: List<*>?, showEmptyView: Boolean = true) {
setLoadData(adapter, list, mEmptyType, showEmptyView) //emptyType 可以给一个默认值,作为统一设置
}
fun setLoadData(adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int) {
setLoadData(adapter, list, emptyType, true) //emptyType 可以给一个默认值,作为统一设置
}
fun setLocalMore(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int = mEmptyType, showEmptyView: Boolean = true) {
mAdapter = adapter
this.mEmptyType = emptyType
adapter.setHeaderFooterEmpty(true, true) //是否显示头部和底部
finishRefresh() //结束刷新
Log.e("local:parentList",list?.size.toString())
val arrayListOf = arrayListOf<Any?>()
for (index in (mPage - 1) * 10..((mPage - 1) * 10 + 9)) {
if (index < list?.size ?: 0) {
arrayListOf.add(list?.get(index))
}
}
Log.e("local:arrayListSize",arrayListOf.size.toString())
if (mPage == PageStart) {
adapter.setNewData(arrayListOf as List<Nothing>)
if (EmptyUtil.isEmpty(arrayListOf)) {
setEmptyView(adapter, showEmptyView)
}
} else {
arrayListOf.run {
adapter.addData(this as List<Nothing>)
}
}
handleLocalLoadMore(recyclerView, adapter, arrayListOf, list)
}
/**
* 不分页的 设置数据
*
* @param adapter
* @param list
* @param emptyType
*/
fun setLoadData(adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int, showEmptyView: Boolean) {
mAdapter = adapter
this.mEmptyType = emptyType
adapter.setHeaderFooterEmpty(true, true) //是否显示头部和底部
finishRefresh()
adapter.setNewData(list as List<Nothing>?)
if (EmptyUtil.isEmpty(list)) {
setEmptyView(adapter, showEmptyView)
}
}
fun setLoadMore(adapter: BaseQuickAdapter<*, *>, list: List<*>?) {
setLoadMore(adapter, list, mEmptyType, true)
}
/**
* 如果使用的是当前的 mRecyclerView
*
* @param adapter
* @param list
* @param emptyType
*/
fun setLoadMore(adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int, showEmptyView: Boolean = true) {
if (mRecyclerView != null) {
setLoadMore(mRecyclerView, adapter, list, emptyType, showEmptyView)
}
}
fun setLoadMore(adapter: BaseQuickAdapter<*, *>, list: List<*>?, showEmptyView: Boolean = true) {
if (mRecyclerView != null) {
setLoadMore(mRecyclerView, adapter, list, mEmptyType, showEmptyView)
}
}
/**
* 结束刷新
* 自动设置上拉更多
*
* @param adapter
* @param list
*/
fun setLoadMore(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int = mEmptyType, showEmptyView: Boolean = true, isIncludeRecyclerView: Boolean = false) {
mAdapter = adapter
this.mEmptyType = emptyType
adapter.setHeaderFooterEmpty(true, true) //是否显示头部和底部
finishRefresh() //结束刷新
if (mPage == PageStart) {
adapter.setNewData(list as List<Nothing>?)
if (EmptyUtil.isEmpty(list)) {
setEmptyView(adapter, showEmptyView)
}
} else {
list?.run {
adapter.addData(this as List<Nothing>)
}
}
if (isIncludeRecyclerView) {
handleLoadMoreInclude(recyclerView, adapter, list)
} else {
handleLoadMore(recyclerView, adapter, list)
}
}
fun setLoadMoreRefreshData(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?, emptyType: Int = mEmptyType, showEmptyView: Boolean = true, isIncludeRecyclerView: Boolean = false) {
mAdapter = adapter
this.mEmptyType = emptyType
adapter.setHeaderFooterEmpty(true, true) //是否显示头部和底部
finishRefresh() //结束刷新
if (mPage == PageStart) {
adapter.setNewData(list as List<Nothing>?)
if (EmptyUtil.isEmpty(list)) {
setEmptyView(adapter, showEmptyView)
}
} else {
list?.run {
if (adapter.data.size >= (mPage * PAGE_COUNT)) {
adapter.data.forEachIndexed { index, any ->
if (index >= ((mPage - 1) * PAGE_COUNT)) {
adapter.remove(index)
}
}
adapter.addData(this as List<Nothing>)
}
}
}
handleLoadMoreRefresh(recyclerView, adapter, list)
}
fun handleLoadMore(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?) {
if (list == null || list.size < PAGE_COUNT) {
adapter.loadMoreEnd()
} else {
adapter.setEnableLoadMore(true)
adapter.setOnLoadMoreListener(this, recyclerView)
adapter.loadMoreComplete()
}
}
fun handleLocalLoadMore(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?, parentList: List<*>?) {
if (list == null || list.size < PAGE_COUNT) {
adapter.loadMoreEnd()
} else {
adapter.setEnableLoadMore(true)
adapter.setOnLoadMoreListener({
mPage++
Log.e("local:page",mPage.toString())
setLocalMore(recyclerView, adapter, parentList)
}, recyclerView)
adapter.loadMoreComplete()
}
}
fun handleLoadMoreRefresh(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?) {
if (list == null || list.isEmpty()) {
adapter.loadMoreEnd()
} else {
adapter.setEnableLoadMore(true)
adapter.setOnLoadMoreListener({ mPage++ }, recyclerView)
adapter.loadMoreComplete()
}
}
fun handleLoadMoreInclude(recyclerView: RecyclerView?, adapter: BaseQuickAdapter<*, *>, list: List<*>?) {
if (list == null || list.isEmpty()) {
adapter.loadMoreEnd()
} else {
adapter.setEnableLoadMore(true)
adapter.setOnLoadMoreListener(this, recyclerView)
adapter.loadMoreComplete()
}
}
/**
* 设置空状态
*
*
* 根据项目情况 自由定制
* @param adapter
*/
protected fun setEmptyView(adapter: BaseQuickAdapter<*, *>?, showEmptyView: Boolean = true) {
if (showEmptyView) {
val emptyView = View.inflate(activity, R.layout.layout_empty, null) as LinearLayout
val ivEmpty = emptyView.findViewById<ImageView>(R.id.iv_empty)
val tvEmpty = emptyView.findViewById<TextView>(R.id.tv_empty)
val tvEmptyHint = emptyView.findViewById<TextView>(R.id.tv_empty_hint)
var hintDef = "暂无数据"
var hintDefDescribe = "暂无数据"
var imgResId = R.mipmap.empty_data
when (mEmptyType) {
EmptyConfig.NO_HISTORY_DATA -> {
hintDef = EmptyConfig.NO_HISTORY_DATA_TEXT
hintDefDescribe = EmptyConfig.NO_HISTORY_DATA_TEXT_HINT
// var params = tvEmptyHint.layoutParams as RelativeLayout.LayoutParams
// params.bottomMargin = ((ScreenUtil.getScreenRealHeight(activity as AppCompatActivity) - emptyView.height) / 2f).toInt()
}
EmptyConfig.NO_DOWNLOAD_DATA -> {
hintDef = EmptyConfig.NO_DOWNLOAD_DATA_TEXT
hintDefDescribe = EmptyConfig.NO_DOWNLOAD_DATA_TEXT_HINT
// var params = tvEmptyHint.layoutParams as RelativeLayout.LayoutParams
// params.bottomMargin = ((ScreenUtil.getScreenRealHeight(activity as AppCompatActivity) - emptyView.height) / 2f).toInt()
}
EmptyConfig.NO_COLLECTION -> {
imgResId = R.mipmap.empty_data
hintDefDescribe = EmptyConfig.NO_COLLECTION_TEXT_HINT
}
EmptyConfig.NO_TIK_TOK -> {
imgResId = R.mipmap.empty_data
hintDefDescribe = EmptyConfig.NO_TIK_TOK_TEXT_HINT
}
EmptyConfig.NO_FOLLOW_ANCHOR -> {
imgResId = R.mipmap.empty_data_follow
hintDef = EmptyConfig.NO_FOLLOW_ANCHOR_TEXT
hintDefDescribe = EmptyConfig.NO_FOLLOW_ANCHOR_HINT
}
EmptyConfig.NO_FOLLOW_MATCH -> {
imgResId = R.mipmap.empty_data_follow
hintDef = EmptyConfig.NO_FOLLOW_MATCH_TEXT
hintDefDescribe = EmptyConfig.NO_FOLLOW_MATCH_HINT
}
EmptyConfig.NO_DETAIL_LIVE -> {
imgResId = R.mipmap.empty_live_data
hintDef = EmptyConfig.NO_DETAIL_LIVE_TEXT
hintDefDescribe = EmptyConfig.NO_DETAIL_LIVE_HINT
}
EmptyConfig.NO_DETAIL_RED -> {
imgResId = R.mipmap.empty_coming_soon
hintDef = EmptyConfig.NO_DETAIL_RED_TEXT
hintDefDescribe = EmptyConfig.NO_DETAIL_RED_HINT
}
else -> {
//这里是其他布局,主页等
// setEmptyLayouParams(emptyView)
}
}
setEmptyLayoutParams(emptyView)
ivEmpty.setImageResource(imgResId)
tvEmpty.text = hintDef
tvEmptyHint.text = hintDefDescribe
adapter?.emptyView = emptyView
}
}
private fun setEmptyLayoutParams(emptyView: LinearLayout) {
emptyView.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)
val layoutParams = emptyView.layoutParams as LinearLayout.LayoutParams
//获取不到父布局的padding,默认设置的是18dp(左右),转换为px,所以固定写死
val paddingStart = mRecyclerView?.paddingStart ?: 0
val paddingEnd = mRecyclerView?.paddingEnd ?: 0
layoutParams.width = ScreenUtil.getScreenWidth(activity as AppCompatActivity) - paddingStart - paddingEnd
// layoutParams.width = ScreenUtil.getScreenWidth(activity as AppCompatActivity)
emptyView.requestLayout()
}
/**
* 结束刷新
*/
override fun onRequestFinish() {
super.onRequestFinish()
finishRefresh()
}
open fun onRefresh() {
isRefresh = true
mPage = 1
lazyLoad()
}
/**
* 如需上拉更多 请重写该方法
*/
override fun onLoadMoreRequested() {
mPage++
lazyLoad()
}
}
\ No newline at end of file
...@@ -72,6 +72,15 @@ public class LiveBean { ...@@ -72,6 +72,15 @@ public class LiveBean {
private String matchCutImg; private String matchCutImg;
private int roomStatus; private int roomStatus;
private int recommend; private int recommend;
private int sportsId;
public int getSportsId() {
return sportsId;
}
public void setSportsId(int sportsId) {
this.sportsId = sportsId;
}
public String getAnchorName() { public String getAnchorName() {
return anchorName; return anchorName;
......
...@@ -63,6 +63,7 @@ public class MatchContentBean implements Serializable { ...@@ -63,6 +63,7 @@ public class MatchContentBean implements Serializable {
private int status; private int status;
private String matchTime; private String matchTime;
private String matchName; private String matchName;
private String matchDate;
private String matchShortName; private String matchShortName;
private int sportsType; private int sportsType;
private boolean subscribe; private boolean subscribe;
...@@ -73,6 +74,14 @@ public class MatchContentBean implements Serializable { ...@@ -73,6 +74,14 @@ public class MatchContentBean implements Serializable {
return matchDays; return matchDays;
} }
public String getMatchDate() {
return matchDate;
}
public void setMatchDate(String matchDate) {
this.matchDate = matchDate;
}
public int getHomeScore() { public int getHomeScore() {
return homeScore; return homeScore;
} }
......
...@@ -34,6 +34,8 @@ public class RoomInfoBean { ...@@ -34,6 +34,8 @@ public class RoomInfoBean {
private String roomAnnouncement; private String roomAnnouncement;
private boolean follow; private boolean follow;
private int userGold; private int userGold;
private int userLevel;
private String follows;
private String userId; private String userId;
private String wxNum; private String wxNum;
private String qqNum; private String qqNum;
...@@ -41,6 +43,22 @@ public class RoomInfoBean { ...@@ -41,6 +43,22 @@ public class RoomInfoBean {
private String huanXinUserId; private String huanXinUserId;
private int roomStatus; private int roomStatus;
public int getUserLevel() {
return userLevel;
}
public void setUserLevel(int userLevel) {
this.userLevel = userLevel;
}
public String getFollows() {
return follows;
}
public void setFollows(String follows) {
this.follows = follows;
}
public String getMatchId() { public String getMatchId() {
return matchId; return matchId;
} }
......
package com.hupu.tv.player.app.event
/**
* @author by Dell
* @date on 2022/2/18
* @describe
*/
class SubscribeMatchEvent(val id: String, val subsribe: Boolean, val fragmentPosition:Int,val parentPostion: Int, val position: Int, val tag: String) {
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import android.widget.TextView ...@@ -9,6 +9,7 @@ import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.flyco.tablayout.listener.OnTabSelectListener import com.flyco.tablayout.listener.OnTabSelectListener
import com.flyco.tablayout.utils.FragmentBasePager2Adapter
import com.hyphenate.EMCallBack import com.hyphenate.EMCallBack
import com.hyphenate.chat.EMClient import com.hyphenate.chat.EMClient
import com.kongzue.dialog.util.BaseDialog import com.kongzue.dialog.util.BaseDialog
...@@ -19,15 +20,16 @@ import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack ...@@ -19,15 +20,16 @@ import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import com.shuyu.gsyvideoplayer.utils.OrientationUtils import com.shuyu.gsyvideoplayer.utils.OrientationUtils
import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer
import com.softgarden.baselibrary.base.BaseActivity import com.softgarden.baselibrary.base.BaseActivity
import com.softgarden.baselibrary.base.FragmentBaseStatePagerAdapter
import com.softgarden.baselibrary.utils.SPUtil import com.softgarden.baselibrary.utils.SPUtil
import com.softgarden.baselibrary.utils.ToastUtil import com.softgarden.baselibrary.utils.ToastUtil
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshActivity import com.hupu.tv.player.app.base.RefreshActivity
import com.hupu.tv.player.app.bean.GiftBean import com.hupu.tv.player.app.bean.GiftBean
import com.hupu.tv.player.app.bean.LiveBean
import com.hupu.tv.player.app.bean.RoomInfoBean import com.hupu.tv.player.app.bean.RoomInfoBean
import com.hupu.tv.player.app.event.* import com.hupu.tv.player.app.event.*
import com.hupu.tv.player.app.ui.adapter.LiveRecommendAdapter
import com.hupu.tv.player.app.ui.contact.LiveActivityContact import com.hupu.tv.player.app.ui.contact.LiveActivityContact
import com.hupu.tv.player.app.ui.fragment.* import com.hupu.tv.player.app.ui.fragment.*
import com.hupu.tv.player.app.ui.presenter.LiveActivityPresenter import com.hupu.tv.player.app.ui.presenter.LiveActivityPresenter
...@@ -35,6 +37,7 @@ import com.hupu.tv.player.app.utils.CommonUtils ...@@ -35,6 +37,7 @@ import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.DialogUtils import com.hupu.tv.player.app.utils.DialogUtils
import com.hupu.tv.player.app.utils.GlideUtils import com.hupu.tv.player.app.utils.GlideUtils
import com.hupu.tv.player.app.widget.danmuku.DanmakuVideoPlayer import com.hupu.tv.player.app.widget.danmuku.DanmakuVideoPlayer
import com.softgarden.baselibrary.utils.RecyclerViewUtil
import kotlinx.android.synthetic.main.activity_live.* import kotlinx.android.synthetic.main.activity_live.*
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.Subscribe
...@@ -51,6 +54,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -51,6 +54,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
private var customDialog: CustomDialog? = null private var customDialog: CustomDialog? = null
private var orientationUtils: OrientationUtils? = null private var orientationUtils: OrientationUtils? = null
private var mFragment: ArrayList<Fragment> = arrayListOf() private var mFragment: ArrayList<Fragment> = arrayListOf()
private lateinit var liveAdapter:LiveRecommendAdapter
private var notice = "" private var notice = ""
private var isPlay = false private var isPlay = false
private var isPause = false private var isPause = false
...@@ -59,10 +63,13 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -59,10 +63,13 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
private var LiveRoomUserName = "" private var LiveRoomUserName = ""
private var liveUserHxId = "" private var liveUserHxId = ""
private var roomCover = "" private var roomCover = ""
private var anchorName = ""
private var matchId = "" private var matchId = ""
private var followNum = ""
override fun loadData() { override fun loadData() {
presenter?.getFakeMessage() presenter?.getFakeMessage()
presenter?.getRoomInfo(roomId) presenter?.getRoomInfo(roomId)
presenter?.getRecommend(roomId,mPage)
} }
override fun setToolbar(builder: BaseToolbar.Builder): BaseToolbar.Builder? { override fun setToolbar(builder: BaseToolbar.Builder): BaseToolbar.Builder? {
...@@ -78,9 +85,30 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -78,9 +85,30 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
roomId = intent.getStringExtra(Constants.ROOM_ID) ?: "" roomId = intent.getStringExtra(Constants.ROOM_ID) ?: ""
roomCover = intent.getStringExtra(Constants.ROOM_COVER) ?: "" roomCover = intent.getStringExtra(Constants.ROOM_COVER) ?: ""
initView() initView()
initAdapter()
// showCustomDialog() // showCustomDialog()
} }
private fun initAdapter() {
liveAdapter = LiveRecommendAdapter()
recycler_recommend.adapter = liveAdapter
if (recycler_recommend.itemDecorationCount == 0){
RecyclerViewUtil.addGridItemDecoration(
this,
recycler_recommend,
R.color.transparent,
19
)
}
liveAdapter.setOnItemClickListener { adapter, view, position ->
val item: LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean
val intent = Intent(activity, LiveActivity::class.java)
intent.putExtra(Constants.ROOM_ID,item.roomId)
intent.putExtra(Constants.ROOM_COVER,item.matchCutImg)
startActivity(intent)
}
}
private fun showCustomDialog() { private fun showCustomDialog() {
customDialog = CustomDialog.show(this, R.layout.transient_notification) { dialog, v -> customDialog = CustomDialog.show(this, R.layout.transient_notification) { dialog, v ->
tvMessage = v.findViewById(R.id.message) tvMessage = v.findViewById(R.id.message)
...@@ -104,13 +132,14 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -104,13 +132,14 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
} }
} }
private fun initPlayer(fire: String, title: String, url: String) { private fun initPlayer(fire: String, num: String?, title: String, url: String) {
//使用自定义的全屏切换图片,!!!注意xml布局中也需要设置为一样的 //使用自定义的全屏切换图片,!!!注意xml布局中也需要设置为一样的
//必须在setUp之前设置 //必须在setUp之前设置
player.setCover(roomCover) player.setCover(roomCover)
player.shrinkImageRes = R.mipmap.icon_custom_shrink player.shrinkImageRes = R.mipmap.icon_custom_shrink
player.enlargeImageRes = R.mipmap.icon_custom_enlarge player.enlargeImageRes = R.mipmap.icon_custom_enlarge
player.setNumAndFire(num, fire)
// player.setUp(url, false, null, null) // player.setUp(url, false, null, null)
...@@ -155,12 +184,18 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -155,12 +184,18 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
isPlay = true isPlay = true
} }
override fun onPlayError(url: String?, vararg objects: Any?) {
super.onPlayError(url, *objects)
iv_live_empty.visibility = View.VISIBLE
}
override fun onQuitFullscreen(url: String, vararg objects: Any) { override fun onQuitFullscreen(url: String, vararg objects: Any) {
super.onQuitFullscreen(url, *objects) super.onQuitFullscreen(url, *objects)
orientationUtils?.backToProtVideo() orientationUtils?.backToProtVideo()
} }
}) })
player.setLockClickListener { view, lock -> player.setLockClickListener { view, lock ->
orientationUtils?.isEnable = !lock orientationUtils?.isEnable = !lock
} }
...@@ -199,7 +234,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -199,7 +234,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
} }
} }
}) })
player.showCopy(showCopy) player.showCopy(false)
} }
fun sendDanmu(text: String, isMine: Boolean) { fun sendDanmu(text: String, isMine: Boolean) {
...@@ -238,21 +273,21 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -238,21 +273,21 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
private fun initTabLayout() { private fun initTabLayout() {
mFragment.add(LiveConversationFragment.newInstance(roomId, notice, LiveRoomUserName,liveUserHxId)) mFragment.add(LiveConversationFragment.newInstance(roomId, notice, LiveRoomUserName, liveUserHxId,anchorName))
mFragment.add(LiveAnchorFragment.newInstance(roomId)) mFragment.add(LiveAnchorFragment.newInstance(roomId))
mFragment.add(LiveRankFragment.newInstance(roomId)) // mFragment.add(LiveRankFragment.newInstance(roomId))
mFragment.add(LiveRedListFragment.newInstance(matchId)) mFragment.add(LiveRedListFragment.newInstance(matchId))
// mFragment.add(LiveMatchFragment.newInstance(roomId)) // mFragment.add(LiveMatchFragment.newInstance(roomId))
val mTitles: Array<String?> = arrayOf( val mTitles: Array<String?> = arrayOf(
getString(R.string.string_live_conversation), getString(R.string.string_live_conversation),
getString(R.string.string_live_actor), getString(R.string.string_live_actor),
getString(R.string.string_live_rank), // getString(R.string.string_live_rank),
getString(R.string.string_live_red_list) getString(R.string.string_live_red_list)
) )
val mAdapter = FragmentBaseStatePagerAdapter(supportFragmentManager, mFragment, mTitles) val mAdapter = FragmentBasePager2Adapter(supportFragmentManager, mFragment, mTitles, lifecycle)
vp_live.adapter = mAdapter vp_live.adapter = mAdapter
vp_live.offscreenPageLimit = mFragment.size vp_live.offscreenPageLimit = mFragment.size
mTabLayout.setViewPager(vp_live) mTabLayout.setViewPager2(vp_live)
mTabLayout.setOnTabSelectListener(object : OnTabSelectListener { mTabLayout.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) { override fun onTabSelect(position: Int) {
vp_live.currentItem = position vp_live.currentItem = position
...@@ -262,29 +297,6 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -262,29 +297,6 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
}) })
} }
private fun initTabLayoutNoConversation() {
// mFragment.add(LiveConversationFragment.newInstance(roomId, notice, LiveRoomUserName))
mFragment.add(LiveAnchorFragment.newInstance(roomId))
mFragment.add(LiveRankFragment.newInstance(roomId))
mFragment.add(LiveMatchFragment.newInstance(roomId))
val mTitles: Array<String?> = arrayOf(
getString(R.string.string_live_actor),
getString(R.string.string_live_rank),
getString(R.string.string_live_match)
)
val mAdapter = FragmentBaseStatePagerAdapter(supportFragmentManager, mFragment, mTitles)
vp_live.adapter = mAdapter
vp_live.offscreenPageLimit = mFragment.size
mTabLayout.setViewPager(vp_live)
mTabLayout.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) {
vp_live.currentItem = position
}
override fun onTabReselect(position: Int) {}
})
}
private fun addMessage(message: String) { private fun addMessage(message: String) {
tvMessage?.text = tvMessage?.text.toString() + "\n" + message tvMessage?.text = tvMessage?.text.toString() + "\n" + message
...@@ -292,6 +304,15 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -292,6 +304,15 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
override fun onRequestRoomInfo(bean: RoomInfoBean?) { override fun onRequestRoomInfo(bean: RoomInfoBean?) {
bean?.let {
setAnchorLevel(bean.userLevel)
anchorName = bean.anchorName
tv_name.text = bean.anchorName
followNum = bean.follows
tv_follow_num.text = "粉丝:${bean.follows}"
GlideUtils.loadAvatar(this, bean.anchorAvatar, iv_avatar)
}
matchId = bean?.matchId ?: "" matchId = bean?.matchId ?: ""
addMessage("请求房间信息成功 直播间 IM userId = ${bean?.huanXinUserId}") addMessage("请求房间信息成功 直播间 IM userId = ${bean?.huanXinUserId}")
bean?.let { bean?.let {
...@@ -306,7 +327,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -306,7 +327,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
isFollow = false isFollow = false
iv_follow.visibility = View.VISIBLE iv_follow.visibility = View.VISIBLE
tv_follow.text = "关注" tv_follow.text = "关注"
ll_follow.background = getDrawable(R.drawable.shape_main_color) ll_follow.background = getDrawable(R.drawable.shape_follow_color)
} }
if (!TextUtils.isEmpty(it.wxNum)) { if (!TextUtils.isEmpty(it.wxNum)) {
showCopy = true showCopy = true
...@@ -343,10 +364,11 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -343,10 +364,11 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
} }
if (bean?.roomStatus == 0) { if (bean?.roomStatus == 0) {
iv_live_empty.visibility = View.VISIBLE ll_anchor_finish.visibility = View.VISIBLE
// iv_live_empty.visibility = View.VISIBLE
} else { } else {
iv_live_empty.visibility = View.GONE iv_live_empty.visibility = View.GONE
initPlayer(bean?.hotNum.toString(), bean?.roomName ?: "", bean?.liveUrl ?: "") initPlayer(bean?.hotNum.toString(), bean?.roomNum, bean?.roomName ?: "", bean?.liveUrl ?: "")
} }
LiveRoomUserName = bean?.userName ?: "" LiveRoomUserName = bean?.userName ?: ""
liveUserHxId = bean?.huanXinUserId.orEmpty() liveUserHxId = bean?.huanXinUserId.orEmpty()
...@@ -354,14 +376,46 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -354,14 +376,46 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
// initTabLayoutNoConversation() // initTabLayoutNoConversation()
} }
private fun setAnchorLevel(level: Int) {
iv_anchor_level.setImageResource(
when (level) {
1 -> R.mipmap.icon_anchor_level_1
2 -> R.mipmap.icon_anchor_level_2
3 -> R.mipmap.icon_anchor_level_3
4 -> R.mipmap.icon_anchor_level_4
5 -> R.mipmap.icon_anchor_level_5
6 -> R.mipmap.icon_anchor_level_6
7 -> R.mipmap.icon_anchor_level_7
8 -> R.mipmap.icon_anchor_level_8
9 -> R.mipmap.icon_anchor_level_9
10 -> R.mipmap.icon_anchor_level_10
11 -> R.mipmap.icon_anchor_level_11
12 -> R.mipmap.icon_anchor_level_12
13 -> R.mipmap.icon_anchor_level_13
14 -> R.mipmap.icon_anchor_level_14
15 -> R.mipmap.icon_anchor_level_15
16 -> R.mipmap.icon_anchor_level_16
else -> R.mipmap.icon_anchor_level_1
}
)
}
override fun onFollowAnchor(msg: String, status: Boolean) { override fun onFollowAnchor(msg: String, status: Boolean) {
ToastUtil.s(msg) ToastUtil.s(msg)
if (status) { if (status) {
isFollow = true isFollow = true
followNum.toIntOrNull()?.let {
followNum = it.plus(1).toString()
tv_follow_num.text = "粉丝:$followNum"
}
iv_follow.visibility = View.GONE iv_follow.visibility = View.GONE
tv_follow.text = "已关注" tv_follow.text = "已关注"
ll_follow.background = getDrawable(R.drawable.shape_bg_already_follow) ll_follow.background = getDrawable(R.drawable.shape_bg_already_follow)
} else { } else {
followNum.toIntOrNull()?.let {
followNum = it.minus(1).toString()
tv_follow_num.text = "粉丝:$followNum"
}
isFollow = false isFollow = false
iv_follow.visibility = View.VISIBLE iv_follow.visibility = View.VISIBLE
tv_follow.text = "关注" tv_follow.text = "关注"
...@@ -380,6 +434,10 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -380,6 +434,10 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
iv_anim.postDelayed({ iv_anim.visibility = View.GONE }, 2000) iv_anim.postDelayed({ iv_anim.visibility = View.GONE }, 2000)
} }
override fun onRecommend(data: LiveBean?) {
liveAdapter.setNewData(data?.dataList)
}
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1)
fun onEventDamMu(event: MessageEvent) { fun onEventDamMu(event: MessageEvent) {
sendDanmu(event.message, false) sendDanmu(event.message, false)
...@@ -396,7 +454,6 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta ...@@ -396,7 +454,6 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
} }
override fun onBackPressed() { override fun onBackPressed() {
orientationUtils?.backToProtVideo() orientationUtils?.backToProtVideo()
if (GSYVideoManager.backFromWindowFull(this)) { if (GSYVideoManager.backFromWindowFull(this)) {
......
...@@ -66,7 +66,7 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta ...@@ -66,7 +66,7 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta
override fun initialize() { override fun initialize() {
setStatus() setStatus()
setStatusColor(R.color.white) setStatusColor(R.color.color_F8F8F7)
StatusBarUtil.setStatusBarLightMode(this, 3) StatusBarUtil.setStatusBarLightMode(this, 3)
// isMineFragment(false) // isMineFragment(false)
showAdDialog() showAdDialog()
...@@ -85,12 +85,17 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta ...@@ -85,12 +85,17 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta
} }
} }
private fun isMineFragment(isMineFragment: Boolean) { private fun isMineFragment(position: Int) {
val top = if (isMineFragment) { val top = if (position == 4) {
setStatusColor(R.color.transparent) setStatusColor(R.color.transparent)
-DisplayUtil.px2dip(this, StatusBarUtil.getStatusBarHeight().toFloat()).toFloat() - 0.3f -DisplayUtil.px2dip(this, StatusBarUtil.getStatusBarHeight().toFloat()).toFloat() - 0.3f
} else { } else {
if (position == 0) {
setStatusColor(R.color.color_F8F8F7)
} else {
setStatusColor(R.color.white) setStatusColor(R.color.white)
}
0f 0f
} }
...@@ -146,7 +151,7 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta ...@@ -146,7 +151,7 @@ class MainActivity : RefreshActivity<MainActivityPresenter>(), MainActivityConta
mTabLayout.setOnTabSelectListener(object : OnTabSelectListener { mTabLayout.setOnTabSelectListener(object : OnTabSelectListener {
override fun onTabSelect(position: Int) { override fun onTabSelect(position: Int) {
mViewPager.currentItem = position mViewPager.currentItem = position
isMineFragment(position == 4) isMineFragment(position)
} }
override fun onTabReselect(position: Int) {} override fun onTabReselect(position: Int) {}
......
package com.hupu.tv.player.app.ui.adapter
import android.content.Intent
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter.OnItemClickListener
import com.chad.library.adapter.base.BaseViewHolder
import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.LiveBean
import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.bean.MatchContentBean.MatchListsBean.MatchInfosBean.GuidesBean
import com.hupu.tv.player.app.event.SubscribeEvent
import com.hupu.tv.player.app.event.SubscribeMatchEvent
import com.hupu.tv.player.app.ui.activity.LiveActivity
import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.DialogUtils
import com.hupu.tv.player.app.utils.GlideUtils
import com.softgarden.baselibrary.base.BaseFragment
import com.softgarden.baselibrary.utils.RecyclerViewUtil.nestedScrollNoFluent
import com.softgarden.baselibrary.utils.SPUtil
import org.greenrobot.eventbus.EventBus
/**
* @author by Dell
* @date on 2020/6/15
* @describe
*/
class FollowContentIncludeAdapter(
layoutResId: Int,
private val baseFragment: BaseFragment<*>,
val fragmentPosition: Int,
val parentPosition: Int
) :
BaseQuickAdapter<MatchContentBean.MatchListsBean.MatchInfosBean, BaseViewHolder>(layoutResId) {
override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean.MatchInfosBean) {
val homeTeam = item.homeTeam
val awayTeam = item.awayTeam
GlideUtils.loadImage(baseFragment, homeTeam.teamIcon, helper.getView(R.id.iv_home), 0)
GlideUtils.loadImage(baseFragment, awayTeam.teamIcon, helper.getView(R.id.iv_away), 0)
helper.apply {
setVisible(R.id.iv_win_home, homeTeam.score > awayTeam.score && item.status != Constants.MATCH_STATUS_UNSTART)
setVisible(R.id.iv_win_away, awayTeam.score > homeTeam.score && item.status != Constants.MATCH_STATUS_UNSTART)
setGone(R.id.ll_time, item.status != Constants.MATCH_STATUS_END)
setGone(R.id.tv_status, item.status == Constants.MATCH_STATUS_END)
setText(R.id.tv_time, item.matchTime)
setText(R.id.tv_name, item.matchShortName)
setText(R.id.tv_status, "已结束")
setText(R.id.tv_home, homeTeam.teamName)
setText(R.id.tv_away, awayTeam.teamName)
getView<ImageView>(R.id.iv_subscribe).isSelected = item.isSubscribe
getView<TextView>(R.id.tv_score_home).apply {
setTextColor(
if (homeTeam.score > awayTeam.score) {
mContext.getColor(R.color.black)
} else {
mContext.getColor(R.color.color_999999)
}
)
visibility = if (item.status != Constants.MATCH_STATUS_UNSTART) {
View.VISIBLE
} else {
View.GONE
}
text = when (item.status) {
Constants.MATCH_STATUS_UNSTART -> "-"
Constants.MATCH_STATUS_END -> if (homeTeam.score == 0) {
"-"
} else {
homeTeam.score.toString()
}
else -> homeTeam.score.toString()
}
}
getView<TextView>(R.id.tv_score_away).apply {
setTextColor(
if (awayTeam.score > homeTeam.score) {
mContext.getColor(R.color.black)
} else {
mContext.getColor(R.color.color_999999)
}
)
visibility = if (item.status != Constants.MATCH_STATUS_UNSTART) {
View.VISIBLE
} else {
View.GONE
}
text = when (item.status) {
Constants.MATCH_STATUS_UNSTART -> "-"
Constants.MATCH_STATUS_END -> if (awayTeam.score == 0) {
"-"
} else {
awayTeam.score.toString()
}
else -> awayTeam.score.toString()
}
}
getView<ImageView>(R.id.iv_subscribe).apply {
visibility = if (item.status == Constants.MATCH_STATUS_UNSTART) {
View.VISIBLE
} else {
View.GONE
}
setOnClickListener {
if (SPUtil[Constants.USER_LOGIN, false] == true) {
EventBus.getDefault().post(
SubscribeMatchEvent(
item.id,
item.isSubscribe,
fragmentPosition,
parentPosition,
helper.layoutPosition,
Constants.SUBSCRIBE_FOLLOW
)
)
} else {
CommonUtils.toLogin(mContext)
}
}
}
getView<TextView>(R.id.tv_status_play).apply {
setTextColor(
when (item.status) {
Constants.MATCH_STATUS_LIVE -> mContext.getColor(R.color.color_FF5655)
else -> mContext.getColor(R.color.color_6D6D6D)
}
)
}
getView<RecyclerView>(R.id.recycler_content).apply {
layoutManager = nestedScrollNoFluent(
this,
LinearLayoutManager(baseFragment.activity, RecyclerView.HORIZONTAL, false)
)
adapter = GuidesAdapter(R.layout.item_guides_image, baseFragment).apply {
setNewData(item.guides)
setOnItemClickListener { adapter, view, position ->
baseFragment.startActivity(Intent(baseFragment.activity, LiveActivity::class.java).apply {
putExtra(Constants.ROOM_ID, (adapter.getItem(position) as GuidesBean).roomId)
putExtra(Constants.ROOM_COVER, (adapter.getItem(position) as GuidesBean).matchCutImg)
})
}
}
}
}
// ivSubscribe.setOnClickListener(v -> {
//
//
// });
}
}
\ No newline at end of file
package com.hupu.tv.player.app.ui.adapter
import android.content.Intent
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.OrientationHelper
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter.OnItemClickListener
import com.chad.library.adapter.base.BaseViewHolder
import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.ui.activity.NewMatchDetailActivity
import com.hupu.tv.player.app.ui.activity.UserInfoActivity
import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.DialogUtils
import com.softgarden.baselibrary.base.BaseFragment
import com.softgarden.baselibrary.utils.RecyclerViewUtil.addItemDecoration
import com.softgarden.baselibrary.utils.RecyclerViewUtil.nestedScrollNoFluent
import com.softgarden.baselibrary.utils.SPUtil
/**
* @author by Dell
* @date on 2020/6/15
* @describe
*/
class FollowMatchContentAdapter(layoutResId: Int, private val baseFragment: BaseFragment<*>, val fragmentPosition:Int) : BaseQuickAdapter<MatchContentBean.MatchListsBean, BaseViewHolder>(layoutResId) {
override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean) {
val time = when (CommonUtils.getWithCurrentDayDifferent(item.matchTime)) {
0 -> {
"今天 ${item.matchTime}"
}
else -> {
item.matchTime
}
}
helper.setText(R.id.tv_title, time)
val recyclerView = helper.getView<RecyclerView>(R.id.recycler_content)
val matchContentIncludeAdapter = FollowContentIncludeAdapter(R.layout.item_match_include_content_new, baseFragment,fragmentPosition,helper.layoutPosition)
val linearLayoutManager = nestedScrollNoFluent(recyclerView, LinearLayoutManager(baseFragment.activity))
if (recyclerView.itemDecorationCount == 0) {
addItemDecoration(baseFragment.activity!!, recyclerView, R.color.view_color, 0.5f, OrientationHelper.VERTICAL)
}
recyclerView.layoutManager = linearLayoutManager
recyclerView.adapter = matchContentIncludeAdapter
matchContentIncludeAdapter.setNewData(item.matchInfos)
matchContentIncludeAdapter.onItemClickListener = OnItemClickListener { adapter: BaseQuickAdapter<*, *>, view: View?, position: Int ->
if (SPUtil[Constants.USER_LOGIN, false] as Boolean) {
val adapterItem = adapter.getItem(position) as MatchContentBean.MatchListsBean.MatchInfosBean?
// Intent intent = new Intent(baseFragment.getActivity(), MatchDetailActivity.class);
val intent = Intent(baseFragment.activity, NewMatchDetailActivity::class.java)
intent.putExtra(Constants.MATCH_BEAN_ID, adapterItem!!.id)
intent.putExtra(Constants.SPORT_TYPE, adapterItem.sportsType)
baseFragment.startActivity(intent)
} else {
DialogUtils.showLogin(mContext as AppCompatActivity)
// startActivity(LoginActivity::class.java)
}
}
}
}
\ No newline at end of file
...@@ -23,7 +23,7 @@ public class GuidesAdapter extends BaseQuickAdapter<MatchContentBean.MatchListsB ...@@ -23,7 +23,7 @@ public class GuidesAdapter extends BaseQuickAdapter<MatchContentBean.MatchListsB
protected void convert(BaseViewHolder helper, MatchContentBean.MatchListsBean.MatchInfosBean.GuidesBean item) { protected void convert(BaseViewHolder helper, MatchContentBean.MatchListsBean.MatchInfosBean.GuidesBean item) {
// GlideUtils.loadAvatar(basefragment, SPUtil.Companion.get(Constants.AVATAR_URL,"")+item.getAvatar(), helper.getView(R.id.iv_actor)); // GlideUtils.loadAvatar(basefragment, SPUtil.Companion.get(Constants.AVATAR_URL,"")+item.getAvatar(), helper.getView(R.id.iv_actor));
GlideUtils.loadAvatar(basefragment, item.getAvatar(), helper.getView(R.id.iv_actor)); GlideUtils.loadAvatar(basefragment, item.getAvatar(), helper.getView(R.id.iv_actor));
GlideUtils.loadImage(basefragment, R.mipmap.icon_live_living_guest, helper.getView(R.id.iv_live)); // GlideUtils.loadImage(basefragment, R.mipmap.icon_live_living_guest, helper.getView(R.id.iv_live));
helper.setText(R.id.tv_name, item.getName()); // helper.setText(R.id.tv_name, item.getName());
} }
} }
...@@ -14,24 +14,24 @@ import com.softgarden.baselibrary.base.BaseFragment ...@@ -14,24 +14,24 @@ import com.softgarden.baselibrary.base.BaseFragment
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class LiveItemAdapter(layoutResId: Int, private val fragment: BaseFragment<*>) : BaseQuickAdapter<LiveBean.DataListBean, BaseViewHolder>(layoutResId) { class LiveItemAdapter(layoutResId: Int, private val fragment: BaseFragment<*>) :
BaseQuickAdapter<LiveBean.DataListBean, BaseViewHolder>(layoutResId) {
override fun convert(helper: BaseViewHolder, item: LiveBean.DataListBean) { override fun convert(helper: BaseViewHolder, item: LiveBean.DataListBean) {
val ivLive = helper.getView<ImageView>(R.id.iv_live) GlideUtils.loadImageNoCenter(
val ivRecommend = helper.getView<View>(R.id.iv_recommend) fragment,
GlideUtils.loadImageGif(fragment, R.mipmap.icon_live_living_gif, ivLive) item.matchCutImg,
if (item.recommend == 1) { helper.getView(R.id.iv_cover),
ivRecommend.visibility = View.VISIBLE R.mipmap.bg_live_place_holder
} else { )
ivRecommend.visibility = View.GONE
}
if (item.roomStatus == 1) {
ivLive.visibility = View.VISIBLE
} else {
ivLive.visibility = View.GONE
}
GlideUtils.loadRoundCircleImageCenterCrop(fragment, item.matchCutImg, helper.getView(R.id.iv_cover), 4, R.mipmap.bg_live_place_holder)
helper.setText(R.id.tv_title, item.roomName) helper.setText(R.id.tv_title, item.roomName)
.setText(R.id.tv_name, item.anchorName) .setText(R.id.tv_name, item.anchorName)
.setText(R.id.tv_hot_num, item.hotNum.toString()) .setText(R.id.tv_hot_num, item.hotNum.toString())
.setText(
R.id.tv_type, when (item.sportsId) {
0 -> "足球"
1 -> "篮球"
else -> "其他"
}
)
} }
} }
\ No newline at end of file
package com.hupu.tv.player.app.ui.adapter
import android.view.View
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.bean.LiveBean
import com.hupu.tv.player.app.utils.GlideUtils
import com.softgarden.baselibrary.base.BaseFragment
/**
* @author by Dell
* @date on 2020/6/15
* @describe
*/
class LiveRecommendAdapter :
BaseQuickAdapter<LiveBean.DataListBean, BaseViewHolder>(R.layout.item_live_recommend) {
override fun convert(helper: BaseViewHolder, item: LiveBean.DataListBean) {
GlideUtils.loadImage(
helper.itemView,
item.matchCutImg,
helper.getView(R.id.iv_cover),
R.mipmap.bg_live_place_holder
)
helper
.setText(R.id.tv_name, item.anchorName)
.setText(R.id.tv_hot_num, item.hotNum.toString())
}
}
\ No newline at end of file
...@@ -2,35 +2,25 @@ package com.hupu.tv.player.app.ui.adapter ...@@ -2,35 +2,25 @@ package com.hupu.tv.player.app.ui.adapter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.view.View import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder import com.chad.library.adapter.base.BaseViewHolder
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.MatchContentBean import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.event.SubscribeEvent
import com.hupu.tv.player.app.ui.activity.UserInfoActivity
import com.hupu.tv.player.app.utils.CommonUtils import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.DialogUtils
import com.hupu.tv.player.app.utils.GlideUtils import com.hupu.tv.player.app.utils.GlideUtils
import com.softgarden.baselibrary.base.BaseFragment import com.softgarden.baselibrary.base.BaseFragment
import com.softgarden.baselibrary.utils.SPUtil
import org.greenrobot.eventbus.EventBus
/** /**
* @author by Dell * @author by Dell
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class LiveTopAdapter(layoutResId: Int, private val basefragment: BaseFragment<*>) : BaseQuickAdapter<MatchContentBean.MatchListsBean.MatchInfosBean, BaseViewHolder>(layoutResId) { class LiveTopAdapter(layoutResId: Int, private val basefragment: BaseFragment<*>) :
BaseQuickAdapter<MatchContentBean.MatchListsBean.MatchInfosBean, BaseViewHolder>(layoutResId) {
@SuppressLint("UseCompatLoadingForDrawables") @SuppressLint("UseCompatLoadingForDrawables")
override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean.MatchInfosBean) { override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean.MatchInfosBean) {
var maxLength = 4 val date = if (CommonUtils.time == item.matchDate) {
val time = if (CommonUtils.time == item.matchTime) {
"今天" "今天"
} else { } else {
"明天" "明天"
...@@ -38,119 +28,31 @@ class LiveTopAdapter(layoutResId: Int, private val basefragment: BaseFragment<*> ...@@ -38,119 +28,31 @@ class LiveTopAdapter(layoutResId: Int, private val basefragment: BaseFragment<*>
val awayTeam = item.awayTeam val awayTeam = item.awayTeam
val homeTeam = item.homeTeam val homeTeam = item.homeTeam
GlideUtils.loadCirclePic(basefragment, homeTeam.teamIcon, helper.getView(R.id.iv_team_icon)) GlideUtils.loadCirclePic(basefragment, homeTeam.teamIcon, helper.getView(R.id.iv_team_icon))
GlideUtils.loadCirclePic(basefragment, awayTeam.teamIcon, helper.getView(R.id.iv_team_icon_away)) GlideUtils.loadCirclePic(basefragment, awayTeam.teamIcon, helper.getView(R.id.iv_team_icon_away))
//tvSubscribe 未开始时显示 status 2 //2 未开始 1直播中
// val tvSubscribe = helper.getView<TextView>(R.id.tv_subscribe)
val ivSubscribe = helper.getView<ImageView>(R.id.iv_subscribe)
//ll_subscribe 未开始 status 2
val llSubscribe = helper.getView<LinearLayout>(R.id.ll_subscribe)
//llLive 直播中 status 1 helper
val llLive = helper.getView<LinearLayout>(R.id.ll_live) .setGone(R.id.ll_time, item.status == 2)
//2个分数 status = 1 .setGone(R.id.tv_live, item.status == 1)
val tvAwayScore = helper.getView<TextView>(R.id.tv_away_score) .setText(R.id.tv_date, date)
val tvHomeScore = helper.getView<TextView>(R.id.tv_home_score) .setText(R.id.tv_time, item.matchTime)
.setText(R.id.tv_name, item.matchShortName)
llLive.visibility = View.GONE .setText(R.id.tv_team_name, homeTeam.teamName)
.setText(R.id.tv_team_name_away, awayTeam.teamName)
tvAwayScore.visibility = View.GONE .setText(
tvHomeScore.visibility = View.GONE R.id.tv_home_score, when (item.status) {
llSubscribe.visibility = View.VISIBLE 1 -> homeTeam.score.toString()
// tvSubscribe.visibility = View.VISIBLE else -> "-"
ivSubscribe.visibility = View.VISIBLE
when (item.status) {
//未开始
2 -> {
maxLength = 4
llSubscribe.visibility = View.VISIBLE
// tvSubscribe.visibility = View.VISIBLE
ivSubscribe.visibility = View.VISIBLE
ivSubscribe.apply {
setImageResource(if (item.isSubscribe) {
R.mipmap.icon_subscribe_selected
} else {
R.mipmap.icon_subscribe_normal
})
setOnClickListener {
if (SPUtil[Constants.USER_LOGIN, false] as Boolean) {
setImageResource(if (item.isSubscribe) {
R.mipmap.icon_subscribe_normal
} else {
R.mipmap.icon_subscribe_selected
})
item.isSubscribe = !item.isSubscribe
EventBus.getDefault().post(SubscribeEvent(item.id, item.isSubscribe,
"liveTop"))
} else {
DialogUtils.showLogin(mContext as AppCompatActivity)
}
} }
)
.setText(
R.id.tv_away_score, when (item.status) {
1 -> homeTeam.score.toString()
else -> "-"
} }
)
}
//直播中
1 -> {
maxLength = 6
ivSubscribe.visibility = View.GONE
llSubscribe.visibility = View.GONE
llLive.visibility = View.VISIBLE
tvAwayScore.visibility = View.VISIBLE
tvHomeScore.visibility = View.VISIBLE
tvHomeScore.text = item.homeScore.toString()
tvAwayScore.text = item.awayScore.toString()
val iv1 = helper.getView<ImageView>(R.id.iv_1)
val iv2 = helper.getView<ImageView>(R.id.iv_2)
val iv3 = helper.getView<ImageView>(R.id.iv_3)
iv1.visibility = View.VISIBLE
iv2.visibility = View.VISIBLE
iv3.visibility = View.VISIBLE
if (!item.guides.isNullOrEmpty()) {
when (item.guides.size) {
1 -> {
GlideUtils.loadAvatar(basefragment, item.guides[0].avatar, iv1)
iv2.visibility = View.INVISIBLE
iv3.visibility = View.INVISIBLE
}
2 -> {
GlideUtils.loadAvatar(basefragment, item.guides[0].avatar, iv1)
GlideUtils.loadAvatar(basefragment, item.guides[0].avatar, iv2)
iv3.visibility = View.INVISIBLE
}
3 -> {
GlideUtils.loadAvatar(basefragment, item.guides[0].avatar, iv1)
GlideUtils.loadAvatar(basefragment, item.guides[1].avatar, iv2)
GlideUtils.loadAvatar(basefragment, item.guides[2].avatar, iv3)
}
}
} else {
iv1.visibility = View.INVISIBLE
iv2.visibility = View.INVISIBLE
iv3.visibility = View.INVISIBLE
}
}
//已结束
}
val homeTeamName = if (homeTeam.teamName.length > maxLength) {
val subSequence = homeTeam.teamName.subSequence(0, maxLength)
"$subSequence..."
} else {
homeTeam.teamName
}
val awayTeamName = if (awayTeam.teamName.length > maxLength) {
val subSequence = awayTeam.teamName.subSequence(0, maxLength)
"$subSequence..."
} else {
awayTeam.teamName
}
helper.setText(R.id.tv_day, time)
.setText(R.id.tv_time, item.matchTime)
.setText(R.id.tv_name, item.matchShortName)
.setText(R.id.tv_team_name, homeTeamName)
.setText(R.id.tv_team_name_away, awayTeamName)
} }
} }
\ No newline at end of file
...@@ -26,36 +26,24 @@ import com.softgarden.baselibrary.utils.SPUtil ...@@ -26,36 +26,24 @@ import com.softgarden.baselibrary.utils.SPUtil
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class MatchContentAdapter(layoutResId: Int, private val baseFragment: BaseFragment<*>) : BaseQuickAdapter<MatchContentBean.MatchListsBean, BaseViewHolder>(layoutResId) { class MatchContentAdapter(layoutResId: Int, private val baseFragment: BaseFragment<*>,val fragmentPosition:Int) : BaseQuickAdapter<MatchContentBean.MatchListsBean, BaseViewHolder>(layoutResId) {
override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean) { override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean) {
val time = when (CommonUtils.getWithCurrentDayDifferent(item.matchTime)) { val time = when (CommonUtils.getWithCurrentDayDifferent(item.matchTime)) {
-1 -> {
"昨天"
}
0 -> { 0 -> {
"今天" "今天 ${item.matchTime}"
}
1 -> {
"明天"
}
2 -> {
"后天"
}
3 -> {
"大后天"
} }
else -> { else -> {
"前天" item.matchTime
} }
} }
helper.setText(R.id.tv_title, time) helper.setText(R.id.tv_title, time)
val recyclerView = helper.getView<RecyclerView>(R.id.recycler_content) val recyclerView = helper.getView<RecyclerView>(R.id.recycler_content)
val matchContentIncludeAdapter = MatchContentIncludeAdapter(R.layout.item_match_include_content_new, baseFragment) val matchContentIncludeAdapter = MatchContentIncludeAdapter(R.layout.item_match_include_content_new, baseFragment,fragmentPosition,helper.layoutPosition)
val linearLayoutManager = nestedScrollNoFluent(recyclerView, LinearLayoutManager(baseFragment.activity)) val linearLayoutManager = nestedScrollNoFluent(recyclerView, LinearLayoutManager(baseFragment.activity))
if (recyclerView.itemDecorationCount == 0) { if (recyclerView.itemDecorationCount == 0) {
addItemDecoration(baseFragment.activity!!, recyclerView, R.color.view_color, 1, OrientationHelper.VERTICAL) addItemDecoration(baseFragment.activity!!, recyclerView, R.color.view_color, 0.5f, OrientationHelper.VERTICAL)
} }
recyclerView.layoutManager = linearLayoutManager recyclerView.layoutManager = linearLayoutManager
recyclerView.adapter = matchContentIncludeAdapter recyclerView.adapter = matchContentIncludeAdapter
......
...@@ -4,6 +4,7 @@ import android.content.Intent ...@@ -4,6 +4,7 @@ import android.content.Intent
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
...@@ -15,79 +16,145 @@ import com.hupu.tv.player.app.app.Constants ...@@ -15,79 +16,145 @@ import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.LiveBean import com.hupu.tv.player.app.bean.LiveBean
import com.hupu.tv.player.app.bean.MatchContentBean import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.bean.MatchContentBean.MatchListsBean.MatchInfosBean.GuidesBean import com.hupu.tv.player.app.bean.MatchContentBean.MatchListsBean.MatchInfosBean.GuidesBean
import com.hupu.tv.player.app.event.SubscribeEvent
import com.hupu.tv.player.app.event.SubscribeMatchEvent
import com.hupu.tv.player.app.ui.activity.LiveActivity import com.hupu.tv.player.app.ui.activity.LiveActivity
import com.hupu.tv.player.app.utils.CommonUtils
import com.hupu.tv.player.app.utils.DialogUtils import com.hupu.tv.player.app.utils.DialogUtils
import com.hupu.tv.player.app.utils.GlideUtils import com.hupu.tv.player.app.utils.GlideUtils
import com.softgarden.baselibrary.base.BaseFragment import com.softgarden.baselibrary.base.BaseFragment
import com.softgarden.baselibrary.utils.RecyclerViewUtil.nestedScrollNoFluent import com.softgarden.baselibrary.utils.RecyclerViewUtil.nestedScrollNoFluent
import com.softgarden.baselibrary.utils.SPUtil import com.softgarden.baselibrary.utils.SPUtil
import org.greenrobot.eventbus.EventBus
/** /**
* @author by Dell * @author by Dell
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class MatchContentIncludeAdapter(layoutResId: Int, private val baseFragment: BaseFragment<*>) : BaseQuickAdapter<MatchContentBean.MatchListsBean.MatchInfosBean, BaseViewHolder>(layoutResId) { class MatchContentIncludeAdapter(
layoutResId: Int,
private val baseFragment: BaseFragment<*>,
val fragmentPosition: Int,
val parentPosition: Int
) :
BaseQuickAdapter<MatchContentBean.MatchListsBean.MatchInfosBean, BaseViewHolder>(layoutResId) {
override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean.MatchInfosBean) { override fun convert(helper: BaseViewHolder, item: MatchContentBean.MatchListsBean.MatchInfosBean) {
helper.setText(R.id.tv_time, item.matchTime).setText(R.id.tv_name, item.matchShortName)
val ivStatus = helper.getView<ImageView>(R.id.iv_status)
val llScore = helper.getView<LinearLayout>(R.id.ll_score)
llScore.visibility = View.GONE
when (item.status) {
Constants.MATCH_STATUS_LIVE -> {
llScore.visibility = View.VISIBLE
ivStatus.setImageResource(R.mipmap.icon_match_staus_live)
}
Constants.MATCH_STATUS_UNSTART -> ivStatus.setImageResource(R.mipmap.icon_match_status_unstart)
Constants.MATCH_STATUS_END -> ivStatus.setImageResource(R.mipmap.icon_match_status_end)
}
val homeTeam = item.homeTeam val homeTeam = item.homeTeam
val awayTeam = item.awayTeam val awayTeam = item.awayTeam
helper.setText(R.id.tv_home, homeTeam.teamName).setText(R.id.tv_away, awayTeam.teamName)
GlideUtils.loadImage(baseFragment, homeTeam.teamIcon, helper.getView(R.id.iv_home), 0) GlideUtils.loadImage(baseFragment, homeTeam.teamIcon, helper.getView(R.id.iv_home), 0)
GlideUtils.loadImage(baseFragment, awayTeam.teamIcon, helper.getView(R.id.iv_away), 0) GlideUtils.loadImage(baseFragment, awayTeam.teamIcon, helper.getView(R.id.iv_away), 0)
helper.setText(R.id.tv_score_home, homeTeam.score.toString()) helper.apply {
.setText(R.id.tv_score_away, awayTeam.score.toString()) setVisible(R.id.iv_win_home, homeTeam.score > awayTeam.score && item.status != Constants.MATCH_STATUS_UNSTART)
val recyclerView = helper.getView<RecyclerView>(R.id.recycler_content) setVisible(R.id.iv_win_away, awayTeam.score > homeTeam.score && item.status != Constants.MATCH_STATUS_UNSTART)
val linearLayoutManager = nestedScrollNoFluent(recyclerView, LinearLayoutManager(baseFragment.activity, RecyclerView.HORIZONTAL, false)) setGone(R.id.ll_time, item.status != Constants.MATCH_STATUS_END)
recyclerView.layoutManager = linearLayoutManager setGone(R.id.tv_status, item.status == Constants.MATCH_STATUS_END)
val guidesAdapter = GuidesAdapter(R.layout.item_guides_image, baseFragment) setText(R.id.tv_time, item.matchTime)
recyclerView.adapter = guidesAdapter setText(R.id.tv_name, item.matchShortName)
guidesAdapter.setNewData(item.guides) setText(R.id.tv_status, "已结束")
// ivSubscribe.setOnClickListener(v -> { setText(R.id.tv_home, homeTeam.teamName)
// if ((Boolean) SPUtil.Companion.get(Constants.USER_LOGIN, false)) { setText(R.id.tv_away, awayTeam.teamName)
// if (item.isSubscribe()) { getView<ImageView>(R.id.iv_subscribe).isSelected = item.isSubscribe
// ivSubscribe.setImageResource(R.mipmap.match_unsubscribed); getView<TextView>(R.id.tv_score_home).apply {
// item.setSubscribe(false); setTextColor(
// } else { if (homeTeam.score > awayTeam.score) {
// ivSubscribe.setImageResource(R.mipmap.match_subscribe); mContext.getColor(R.color.black)
// item.setSubscribe(true); } else {
// } mContext.getColor(R.color.color_999999)
// } }
// LogUtils.e("event-post-match"); )
// EventBus.getDefault().post(new SubscribeEvent(item.getId(), item.isSubscribe(), "match")); visibility = if (item.status != Constants.MATCH_STATUS_UNSTART) {
// View.VISIBLE
// }); } else {
guidesAdapter.onItemClickListener = OnItemClickListener { adapter: BaseQuickAdapter<*, *>, view: View?, position: Int -> View.GONE
}
text = when (item.status) {
Constants.MATCH_STATUS_UNSTART -> "-"
Constants.MATCH_STATUS_END -> if (homeTeam.score == 0) {
"-"
} else {
homeTeam.score.toString()
}
else -> homeTeam.score.toString()
}
}
val guidesBean = adapter.getItem(position) as GuidesBean? getView<TextView>(R.id.tv_score_away).apply {
val intent = Intent(baseFragment.activity, LiveActivity::class.java) setTextColor(
intent.putExtra(Constants.ROOM_ID, guidesBean!!.roomId) if (awayTeam.score > homeTeam.score) {
intent.putExtra(Constants.ROOM_COVER, guidesBean.matchCutImg) mContext.getColor(R.color.black)
baseFragment.startActivity(intent) } else {
// if (SPUtil[Constants.USER_LOGIN, false] as Boolean) { mContext.getColor(R.color.color_999999)
// val guidesBean = adapter.getItem(position) as GuidesBean? }
// val intent = Intent(baseFragment.activity, LiveActivity::class.java) )
// intent.putExtra(Constants.ROOM_ID, guidesBean!!.roomId) visibility = if (item.status != Constants.MATCH_STATUS_UNSTART) {
// intent.putExtra(Constants.ROOM_COVER, guidesBean.matchCutImg) View.VISIBLE
// baseFragment.startActivity(intent) } else {
// } else { View.GONE
// DialogUtils.showLogin(mContext as AppCompatActivity) }
//// startActivity(LoginActivity::class.java)
// }
text = when (item.status) {
Constants.MATCH_STATUS_UNSTART -> "-"
Constants.MATCH_STATUS_END -> if (awayTeam.score == 0) {
"-"
} else {
awayTeam.score.toString()
}
else -> awayTeam.score.toString()
}
}
getView<ImageView>(R.id.iv_subscribe).apply {
visibility = if (item.status == Constants.MATCH_STATUS_UNSTART) {
View.VISIBLE
} else {
View.GONE
}
setOnClickListener {
if (SPUtil[Constants.USER_LOGIN, false] == true) {
EventBus.getDefault().post(
SubscribeMatchEvent(
item.id,
item.isSubscribe,
fragmentPosition,
parentPosition,
helper.layoutPosition,
Constants.SUBSCRIBE_MATCH
)
)
} else {
CommonUtils.toLogin(mContext)
}
}
}
getView<TextView>(R.id.tv_status_play).apply {
setTextColor(
when (item.status) {
Constants.MATCH_STATUS_LIVE -> mContext.getColor(R.color.color_FF5655)
else -> mContext.getColor(R.color.color_6D6D6D)
}
)
}
getView<RecyclerView>(R.id.recycler_content).apply {
layoutManager = nestedScrollNoFluent(
this,
LinearLayoutManager(baseFragment.activity, RecyclerView.HORIZONTAL, false)
)
adapter = GuidesAdapter(R.layout.item_guides_image, baseFragment).apply {
setNewData(item.guides)
setOnItemClickListener { adapter, view, position ->
baseFragment.startActivity(Intent(baseFragment.activity, LiveActivity::class.java).apply {
putExtra(Constants.ROOM_ID, (adapter.getItem(position) as GuidesBean).roomId)
putExtra(Constants.ROOM_COVER, (adapter.getItem(position) as GuidesBean).matchCutImg)
})
} }
} }
}
}
// ivSubscribe.setOnClickListener(v -> {
//
//
// });
}
} }
\ No newline at end of file
...@@ -11,14 +11,14 @@ import com.hupu.tv.player.app.bean.MatchContentBean ...@@ -11,14 +11,14 @@ import com.hupu.tv.player.app.bean.MatchContentBean
interface FollowMatchContract { interface FollowMatchContract {
interface Display : IBaseDisplay { interface Display : IBaseDisplay {
fun onMatchList(list: List<MatchContentBean.MatchListsBean>) fun onMatchList(list: List<MatchContentBean.MatchListsBean>)
fun onSubscribeMatch(message:String) fun onSubscribeMatch(message: String, parentPosition: Int, position: Int)
} }
interface Presenter { interface Presenter {
fun getMatchOrder() fun getMatchOrder()
fun reserveMatch(id: String) fun reserveMatch(id: String, parentPosition: Int, position: Int)
fun cancelReserveMatch(id: String) fun cancelReserveMatch(id: String, parentPosition: Int, position: Int)
fun reserveMatch(id:String,status:Boolean) fun reserveMatch(id: String, status: Boolean, parentPosition: Int, position: Int)
} }
......
package com.hupu.tv.player.app.ui.contact package com.hupu.tv.player.app.ui.contact
import com.hupu.tv.player.app.bean.FakeMessageEntity import com.hupu.tv.player.app.bean.LiveBean
import com.softgarden.baselibrary.base.IBaseDisplay import com.softgarden.baselibrary.base.IBaseDisplay
import com.hupu.tv.player.app.bean.RoomInfoBean import com.hupu.tv.player.app.bean.RoomInfoBean
...@@ -14,6 +14,7 @@ interface LiveActivityContact { ...@@ -14,6 +14,7 @@ interface LiveActivityContact {
fun onRequestRoomInfo(bean: RoomInfoBean?) fun onRequestRoomInfo(bean: RoomInfoBean?)
fun onFollowAnchor(msg:String,status:Boolean) fun onFollowAnchor(msg:String,status:Boolean)
fun onSendGift(id:Int,position:Int) fun onSendGift(id:Int,position:Int)
fun onRecommend(data: LiveBean?)
} }
...@@ -22,6 +23,7 @@ interface LiveActivityContact { ...@@ -22,6 +23,7 @@ interface LiveActivityContact {
fun getRoomInfo(id: String) fun getRoomInfo(id: String)
fun followAnchor(id:String) fun followAnchor(id:String)
fun unFollowAnchor(id:String) fun unFollowAnchor(id:String)
fun getRecommend(id:String,pageNum:Int)
fun sendGift (giftId:Int,roomId:String,giftPosition:Int) fun sendGift (giftId:Int,roomId:String,giftPosition:Int)
} }
} }
\ No newline at end of file
...@@ -11,14 +11,14 @@ import com.hupu.tv.player.app.bean.MatchContentBean ...@@ -11,14 +11,14 @@ import com.hupu.tv.player.app.bean.MatchContentBean
interface MatchContentFragmentContract { interface MatchContentFragmentContract {
interface Display : IBaseDisplay { interface Display : IBaseDisplay {
fun onMatchList(list: List<MatchContentBean.MatchListsBean>) fun onMatchList(list: List<MatchContentBean.MatchListsBean>)
fun onSubscribeMatch(message:String) fun onSubscribeMatch(message:String,parentPosition:Int,position:Int)
} }
interface Presenter { interface Presenter {
fun getMatchList(id: String, pageNo: Int) fun getMatchList(id: String, pageNo: Int)
fun reserveMatch(id: String) fun reserveMatch(id: String,parentPosition:Int,position:Int)
fun cancelReserveMatch(id: String) fun cancelReserveMatch(id: String,parentPosition:Int,position:Int)
fun reserveMatch(id:String,status:Boolean) fun reserveMatch(id:String,status:Boolean,parentPosition:Int,position:Int)
} }
......
...@@ -44,6 +44,7 @@ import java.util.Random; ...@@ -44,6 +44,7 @@ import java.util.Random;
public class ChatFragment extends CustomEaseChatFragment implements OnRecallMessageResultListener { public class ChatFragment extends CustomEaseChatFragment implements OnRecallMessageResultListener {
private static final String TAG = ChatFragment.class.getSimpleName(); private static final String TAG = ChatFragment.class.getSimpleName();
private String liveUserName = ""; private String liveUserName = "";
private String liveRoomName = "";
protected ClipboardManager clipboard; protected ClipboardManager clipboard;
private boolean isSend = false; private boolean isSend = false;
private static final int REQUEST_CODE_SELECT_AT_USER = 15; private static final int REQUEST_CODE_SELECT_AT_USER = 15;
...@@ -60,7 +61,10 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess ...@@ -60,7 +61,10 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
super.initView(); super.initView();
userHxId = getArguments().getString(Constants.USER_HX_ID,""); userHxId = getArguments().getString(Constants.USER_HX_ID,"");
liveUserName = getArguments().getString(Constants.LIVE_ROOM_USER_NAME); liveUserName = getArguments().getString(Constants.LIVE_ROOM_USER_NAME);
liveRoomName = getArguments().getString(Constants.LIVE_ROOM_NAME);
chatLayout.getChatMessageListLayout().setItemShowType(EaseChatMessageListLayout.ShowType.LEFT); chatLayout.getChatMessageListLayout().setItemShowType(EaseChatMessageListLayout.ShowType.LEFT);
chatLayout.getChatMessageListLayout().setBackgroundColor(getContext().getColor(R.color.background_f5));
chatLayout.getChatMessageListLayout().setLiveName("欢迎来到"+liveRoomName+"直播间");
customChatPrimaryMenu = new CustomChatPrimaryMenu(getContext()); customChatPrimaryMenu = new CustomChatPrimaryMenu(getContext());
chatLayout.getChatInputMenu().setCustomPrimaryMenu(customChatPrimaryMenu); chatLayout.getChatInputMenu().setCustomPrimaryMenu(customChatPrimaryMenu);
clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
...@@ -130,6 +134,7 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess ...@@ -130,6 +134,7 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
} }
public void sendJoinRoomData() { public void sendJoinRoomData() {
if (!isSend) { if (!isSend) {
boolean isLogin = (boolean) SPUtil.Companion.get(Constants.USER_LOGIN, false); boolean isLogin = (boolean) SPUtil.Companion.get(Constants.USER_LOGIN, false);
if (isLogin) { if (isLogin) {
......
...@@ -86,8 +86,19 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc ...@@ -86,8 +86,19 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc
private fun initDownRecyclerView() { private fun initDownRecyclerView() {
liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this) liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this)
mRecyclerView_down?.layoutManager = RecyclerViewUtil.nestedScrollNoFluent(mRecyclerView_down, GridLayoutManager(activity, 2)) mRecyclerView_down?.layoutManager =
activity?.let { RecyclerViewUtil.addGridItemDecoration(it, mRecyclerView_down!!, R.color.transparent, 2 * Constants.item_divider) } RecyclerViewUtil.nestedScrollNoFluent(mRecyclerView_down, GridLayoutManager(activity, 2))
if (mRecyclerView_down.itemDecorationCount == 0) {
activity?.let {
RecyclerViewUtil.addGridItemDecoration(
it,
mRecyclerView_down!!,
R.color.transparent,
2 * Constants.item_divider
)
}
}
mRecyclerView_down?.adapter = liveItemAdapter mRecyclerView_down?.adapter = liveItemAdapter
liveItemAdapter?.setOnItemClickListener { adapter, view, position -> liveItemAdapter?.setOnItemClickListener { adapter, view, position ->
// if (!(SPUtil[Constants.USER_LOGIN, false] as Boolean)) { // if (!(SPUtil[Constants.USER_LOGIN, false] as Boolean)) {
...@@ -98,7 +109,7 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc ...@@ -98,7 +109,7 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc
val item: LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean val item: LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean
val intent = Intent(activity, LiveActivity::class.java) val intent = Intent(activity, LiveActivity::class.java)
intent.putExtra(Constants.ROOM_ID, item.roomId) intent.putExtra(Constants.ROOM_ID, item.roomId)
intent.putExtra(Constants.ROOM_COVER,item.matchCutImg) intent.putExtra(Constants.ROOM_COVER, item.matchCutImg)
startActivity(intent) startActivity(intent)
} }
} }
...@@ -106,20 +117,23 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc ...@@ -106,20 +117,23 @@ class FollowAnchorFragment : ToolbarFragment<FollowAnchorPresenter>(), FollowAnc
private fun initTopRecyclerView() { private fun initTopRecyclerView() {
anchorAdapter = AnchorAdapter(R.layout.item_anchor, this) anchorAdapter = AnchorAdapter(R.layout.item_anchor, this)
mRecyclerView?.adapter = anchorAdapter mRecyclerView?.adapter = anchorAdapter
mRecyclerView?.layoutManager = RecyclerViewUtil.nestedScrollNoFluent(mRecyclerView!!, LinearLayoutManager(activity, RecyclerView.VERTICAL, false)) mRecyclerView?.layoutManager = RecyclerViewUtil.nestedScrollNoFluent(
mRecyclerView!!,
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
)
if (mRecyclerView?.itemDecorationCount == 0) { if (mRecyclerView?.itemDecorationCount == 0) {
activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) } activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) }
} }
anchorAdapter?.setOnItemClickListener { adapter, view, position -> anchorAdapter?.setOnItemClickListener { adapter, view, position ->
val anchorEntity = adapter.getItem(position) as AnchorEntity val anchorEntity = adapter.getItem(position) as AnchorEntity
if (anchorEntity.liveStatus == 0){ if (anchorEntity.liveStatus == 0) {
ToastUtil.s("您关注的主播未开播") ToastUtil.s("您关注的主播未开播")
return@setOnItemClickListener return@setOnItemClickListener
} }
val intent = Intent(activity, LiveActivity::class.java) val intent = Intent(activity, LiveActivity::class.java)
intent.putExtra(Constants.ROOM_ID, anchorEntity.roomId) intent.putExtra(Constants.ROOM_ID, anchorEntity.roomId)
intent.putExtra(Constants.ROOM_COVER,anchorEntity.matchCutImg) intent.putExtra(Constants.ROOM_COVER, anchorEntity.matchCutImg)
startActivity(intent) startActivity(intent)
} }
} }
......
...@@ -4,6 +4,7 @@ import android.os.Bundle ...@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mirkowu.basetoolbar.BaseToolbar import com.mirkowu.basetoolbar.BaseToolbar
import com.softgarden.baselibrary.utils.RecyclerViewUtil import com.softgarden.baselibrary.utils.RecyclerViewUtil
...@@ -17,7 +18,11 @@ import com.hupu.tv.player.app.bean.MatchContentBean ...@@ -17,7 +18,11 @@ import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.event.FollowMatchEvent import com.hupu.tv.player.app.event.FollowMatchEvent
import com.hupu.tv.player.app.event.RefreshUserEvent import com.hupu.tv.player.app.event.RefreshUserEvent
import com.hupu.tv.player.app.event.SubscribeEvent import com.hupu.tv.player.app.event.SubscribeEvent
import com.hupu.tv.player.app.event.SubscribeMatchEvent
import com.hupu.tv.player.app.ui.adapter.FollowContentIncludeAdapter
import com.hupu.tv.player.app.ui.adapter.FollowMatchContentAdapter
import com.hupu.tv.player.app.ui.adapter.MatchContentAdapter import com.hupu.tv.player.app.ui.adapter.MatchContentAdapter
import com.hupu.tv.player.app.ui.adapter.MatchContentIncludeAdapter
import com.hupu.tv.player.app.ui.contact.FollowMatchContract import com.hupu.tv.player.app.ui.contact.FollowMatchContract
import com.hupu.tv.player.app.ui.presenter.FollowMatchPresenter import com.hupu.tv.player.app.ui.presenter.FollowMatchPresenter
import com.hupu.tv.player.app.utils.DialogUtils import com.hupu.tv.player.app.utils.DialogUtils
...@@ -36,7 +41,7 @@ import org.greenrobot.eventbus.ThreadMode ...@@ -36,7 +41,7 @@ import org.greenrobot.eventbus.ThreadMode
* @describe * @describe
*/ */
class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatchContract.Display { class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatchContract.Display {
private var matchContentAdapter: MatchContentAdapter? = null private var matchContentAdapter: FollowMatchContentAdapter? = null
private var sportId: String = "" private var sportId: String = ""
override val layoutId: Int override val layoutId: Int
get() = R.layout.fragment_follow_order_content get() = R.layout.fragment_follow_order_content
...@@ -69,7 +74,6 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch ...@@ -69,7 +74,6 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch
} }
private fun initView() { private fun initView() {
initRecyclerView() initRecyclerView()
initRefreshLayout() initRefreshLayout()
...@@ -80,12 +84,9 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch ...@@ -80,12 +84,9 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch
} }
private fun initAdapter() { private fun initAdapter() {
matchContentAdapter = MatchContentAdapter(R.layout.item_match_content, this) matchContentAdapter = FollowMatchContentAdapter(R.layout.item_match_content, this, 0)
mRecyclerView?.adapter = matchContentAdapter mRecyclerView?.adapter = matchContentAdapter
mRecyclerView?.layoutManager = LinearLayoutManager(activity) mRecyclerView?.layoutManager = LinearLayoutManager(activity)
if (mRecyclerView?.itemDecorationCount == 0) {
activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 2 * Constants.item_divider_4) }
}
} }
...@@ -110,18 +111,15 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch ...@@ -110,18 +111,15 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1)
fun onEventFollow(event: SubscribeEvent) { fun onSubcribe(event: SubscribeMatchEvent) {
if (event.className != "order"){ if (event.tag != Constants.SUBSCRIBE_FOLLOW) {
return return
} }
LogUtils.e("event") if (SPUtil[Constants.USER_LOGIN, false] == true) {
if (SPUtil[Constants.USER_LOGIN,false] == true){ presenter?.reserveMatch(event.id, event.subsribe, event.parentPostion, event.position)
presenter?.reserveMatch(event.id, event.isStatus)
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1)
fun onEventRefreshUser(event: RefreshUserEvent) { fun onEventRefreshUser(event: RefreshUserEvent) {
isLogin() isLogin()
...@@ -135,7 +133,6 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch ...@@ -135,7 +133,6 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
EventBus.getDefault().unregister(this) EventBus.getDefault().unregister(this)
...@@ -144,11 +141,19 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch ...@@ -144,11 +141,19 @@ class FollowMatchFragment : ToolbarFragment<FollowMatchPresenter>(), FollowMatch
override fun onMatchList(list: List<MatchContentBean.MatchListsBean>) { override fun onMatchList(list: List<MatchContentBean.MatchListsBean>) {
matchContentAdapter?.let { matchContentAdapter?.let {
setLoadData(it, list,EmptyConfig.NO_FOLLOW_MATCH) setLoadData(it, list, EmptyConfig.NO_FOLLOW_MATCH)
} }
} }
override fun onSubscribeMatch(message: String) {
override fun onSubscribeMatch(message: String, parentPosition: Int, position: Int) {
ToastUtil.s(message) ToastUtil.s(message)
val recyclerView = matchContentAdapter?.getViewByPosition(parentPosition, R.id.recycler_content) as RecyclerView
val matchContentIncludeAdapter = recyclerView.adapter as? FollowContentIncludeAdapter
val item = matchContentIncludeAdapter?.getItem(position)
item?.let {
it.isSubscribe = !it.isSubscribe
}
matchContentIncludeAdapter?.notifyItemChanged(position)
lazyLoad() lazyLoad()
} }
......
...@@ -6,6 +6,7 @@ import com.softgarden.baselibrary.base.BaseActivity ...@@ -6,6 +6,7 @@ import com.softgarden.baselibrary.base.BaseActivity
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshFragment import com.hupu.tv.player.app.base.RefreshFragment
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.bean.RoomInfoBean import com.hupu.tv.player.app.bean.RoomInfoBean
import com.hupu.tv.player.app.ui.contact.LiveAnchorFragmentContact import com.hupu.tv.player.app.ui.contact.LiveAnchorFragmentContact
import com.hupu.tv.player.app.ui.presenter.LiveAnchorFragmentPresenter import com.hupu.tv.player.app.ui.presenter.LiveAnchorFragmentPresenter
...@@ -18,7 +19,7 @@ import kotlinx.android.synthetic.main.fragment_anchor.* ...@@ -18,7 +19,7 @@ import kotlinx.android.synthetic.main.fragment_anchor.*
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class LiveAnchorFragment : RefreshFragment<LiveAnchorFragmentPresenter>(), LiveAnchorFragmentContact.Display { class LiveAnchorFragment : RefreshVP2Fragment<LiveAnchorFragmentPresenter>(), LiveAnchorFragmentContact.Display {
private var roomid = "" private var roomid = ""
override val layoutId: Int override val layoutId: Int
get() = R.layout.fragment_anchor get() = R.layout.fragment_anchor
......
...@@ -2,6 +2,7 @@ package com.hupu.tv.player.app.ui.fragment ...@@ -2,6 +2,7 @@ package com.hupu.tv.player.app.ui.fragment
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
...@@ -10,6 +11,7 @@ import com.softgarden.baselibrary.utils.SPUtil ...@@ -10,6 +11,7 @@ import com.softgarden.baselibrary.utils.SPUtil
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshFragment import com.hupu.tv.player.app.base.RefreshFragment
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.bean.GiftBean import com.hupu.tv.player.app.bean.GiftBean
import com.hupu.tv.player.app.bean.LiveUserBean import com.hupu.tv.player.app.bean.LiveUserBean
import com.hupu.tv.player.app.event.RefreshUserEvent import com.hupu.tv.player.app.event.RefreshUserEvent
...@@ -21,6 +23,7 @@ import com.hupu.tv.player.app.ui.contact.LiveConversationFragmentContact ...@@ -21,6 +23,7 @@ import com.hupu.tv.player.app.ui.contact.LiveConversationFragmentContact
import com.hupu.tv.player.app.ui.presenter.LiveConversationFragmentPresenter import com.hupu.tv.player.app.ui.presenter.LiveConversationFragmentPresenter
import com.hupu.tv.player.app.utils.DialogUtils import com.hupu.tv.player.app.utils.DialogUtils
import kotlinx.android.synthetic.main.fragment_live_conversation.* import kotlinx.android.synthetic.main.fragment_live_conversation.*
import kotlinx.android.synthetic.main.layout_marquee.*
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode import org.greenrobot.eventbus.ThreadMode
...@@ -31,20 +34,21 @@ import org.greenrobot.eventbus.ThreadMode ...@@ -31,20 +34,21 @@ import org.greenrobot.eventbus.ThreadMode
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresenter>(), LiveConversationFragmentContact.IDisplay { class LiveConversationFragment : RefreshVP2Fragment<LiveConversationFragmentPresenter>(), LiveConversationFragmentContact.IDisplay {
var chatFragment: ChatFragment? = null var chatFragment: ChatFragment? = null
var liveUserName = "" var liveUserName = ""
companion object { companion object {
@JvmStatic @JvmStatic
fun newInstance(conversationId: String, notice: String,userName:String,userHxId:String): LiveConversationFragment { fun newInstance(conversationId: String, notice: String,userName:String,userHxId:String,roomName:String): LiveConversationFragment {
val args = Bundle() val args = Bundle()
args.putString(EaseConstant.EXTRA_CONVERSATION_ID, conversationId) args.putString(EaseConstant.EXTRA_CONVERSATION_ID, conversationId)
args.putString(Constants.USER_HX_ID, userHxId) args.putString(Constants.USER_HX_ID, userHxId)
args.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_CHATROOM) args.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_CHATROOM)
args.putBoolean(EaseConstant.EXTRA_IS_ROAM, false) args.putBoolean(EaseConstant.EXTRA_IS_ROAM, true)
args.putString(Constants.LIVE_NOTICE, notice) args.putString(Constants.LIVE_NOTICE, notice)
args.putString(Constants.LIVE_ROOM_USER_NAME, userName) args.putString(Constants.LIVE_ROOM_USER_NAME, userName)
args.putString(Constants.LIVE_ROOM_NAME, roomName)
val fragment = LiveConversationFragment() val fragment = LiveConversationFragment()
fragment.arguments = args fragment.arguments = args
return fragment return fragment
...@@ -55,7 +59,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent ...@@ -55,7 +59,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent
liveUserName = arguments?.getString(Constants.LIVE_ROOM_USER_NAME,"游客50234")?:"游客50234" liveUserName = arguments?.getString(Constants.LIVE_ROOM_USER_NAME,"游客50234")?:"游客50234"
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
initChatFragment() initChatFragment()
tv_notice.text = getString(R.string.string_live_notice, arguments?.getString(Constants.LIVE_NOTICE)) tv_notice.text = "公告:${getString(R.string.string_live_notice, arguments?.getString(Constants.LIVE_NOTICE))}"
needLogin() needLogin()
tv_report.setOnClickListener { tv_report.setOnClickListener {
startActivity(Intent(requireContext(), ReportActivity::class.java)) startActivity(Intent(requireContext(), ReportActivity::class.java))
...@@ -98,9 +102,10 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent ...@@ -98,9 +102,10 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent
val bundle = Bundle() val bundle = Bundle()
bundle.putString(EaseConstant.EXTRA_CONVERSATION_ID, arguments?.getString(EaseConstant.EXTRA_CONVERSATION_ID)) bundle.putString(EaseConstant.EXTRA_CONVERSATION_ID, arguments?.getString(EaseConstant.EXTRA_CONVERSATION_ID))
bundle.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_CHATROOM) bundle.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_CHATROOM)
bundle.putBoolean(EaseConstant.EXTRA_IS_ROAM, false) bundle.putBoolean(EaseConstant.EXTRA_IS_ROAM, true)
bundle.putString(Constants.LIVE_ROOM_USER_NAME, liveUserName) bundle.putString(Constants.LIVE_ROOM_USER_NAME, liveUserName)
bundle.putString(Constants.USER_HX_ID, arguments?.getString(Constants.USER_HX_ID)) bundle.putString(Constants.USER_HX_ID, arguments?.getString(Constants.USER_HX_ID))
bundle.putString(Constants.LIVE_ROOM_NAME, arguments?.getString(Constants.LIVE_ROOM_NAME))
chatFragment = ChatFragment() chatFragment = ChatFragment()
chatFragment?.arguments = bundle chatFragment?.arguments = bundle
childFragmentManager.beginTransaction().replace(R.id.fl_fragment, chatFragment!!, "chat").commit() childFragmentManager.beginTransaction().replace(R.id.fl_fragment, chatFragment!!, "chat").commit()
...@@ -108,6 +113,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent ...@@ -108,6 +113,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent
} }
override fun lazyLoad() { override fun lazyLoad() {
presenter?.getGiftList() presenter?.getGiftList()
} }
...@@ -119,6 +125,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent ...@@ -119,6 +125,7 @@ class LiveConversationFragment : RefreshFragment<LiveConversationFragmentPresent
SPUtil.putSerializableObject(Constants.GIFT_BEAN,list) SPUtil.putSerializableObject(Constants.GIFT_BEAN,list)
} }
override fun onMemberJoinRoom(list: ArrayList<LiveUserBean>?) { override fun onMemberJoinRoom(list: ArrayList<LiveUserBean>?) {
} }
......
...@@ -8,6 +8,7 @@ import com.softgarden.baselibrary.base.BaseActivity ...@@ -8,6 +8,7 @@ import com.softgarden.baselibrary.base.BaseActivity
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshFragment import com.hupu.tv.player.app.base.RefreshFragment
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.bean.RedListData import com.hupu.tv.player.app.bean.RedListData
import com.hupu.tv.player.app.ui.activity.RedDetailActivity import com.hupu.tv.player.app.ui.activity.RedDetailActivity
import com.hupu.tv.player.app.ui.adapter.RedListAdapter import com.hupu.tv.player.app.ui.adapter.RedListAdapter
...@@ -22,7 +23,7 @@ import com.softgarden.baselibrary.utils.RecyclerViewUtil ...@@ -22,7 +23,7 @@ import com.softgarden.baselibrary.utils.RecyclerViewUtil
* @date on 2020/6/15 * @date on 2020/6/15
* @describe * @describe
*/ */
class LiveRedListFragment : RefreshFragment<LiveRedListPresenter>(), LiveRedListContact.Display { class LiveRedListFragment : RefreshVP2Fragment<LiveRedListPresenter>(), LiveRedListContact.Display {
private var sportId = "" private var sportId = ""
private lateinit var adapter: RedListAdapter private lateinit var adapter: RedListAdapter
......
...@@ -15,6 +15,7 @@ import com.softgarden.baselibrary.utils.RecyclerViewUtil ...@@ -15,6 +15,7 @@ import com.softgarden.baselibrary.utils.RecyclerViewUtil
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.base.ToolbarFragment import com.hupu.tv.player.app.base.ToolbarFragment
import com.hupu.tv.player.app.bean.* import com.hupu.tv.player.app.bean.*
import com.hupu.tv.player.app.bean.MatchContentBean.MatchListsBean.MatchInfosBean import com.hupu.tv.player.app.bean.MatchContentBean.MatchListsBean.MatchInfosBean
...@@ -47,16 +48,13 @@ import org.greenrobot.eventbus.ThreadMode ...@@ -47,16 +48,13 @@ import org.greenrobot.eventbus.ThreadMode
* @date on 2020/6/14 * @date on 2020/6/14
* @describe * @describe
*/ */
class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainContentAllContract.Display { class MainContentAllFragment : RefreshVP2Fragment<MainContentAllPresenter>(), MainContentAllContract.Display {
private var sportId: String = "" private var sportId: String = ""
private var liveItemAdapter: LiveItemAdapter? = null private var liveItemAdapter: LiveItemAdapter? = null
private var liveTopAdapter: LiveTopAdapter? = null private var liveTopAdapter: LiveTopAdapter? = null
override val layoutId: Int override val layoutId: Int
get() = R.layout.fragment_match_all get() = R.layout.fragment_match_all
override fun setToolbar(builder: BaseToolbar.Builder): BaseToolbar.Builder? {
return null
}
override fun initEventAndData() { override fun initEventAndData() {
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
...@@ -69,7 +67,17 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC ...@@ -69,7 +67,17 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC
initBanner() initBanner()
liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this) liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this)
mRecyclerView?.layoutManager = GridLayoutManager(activity, 2) mRecyclerView?.layoutManager = GridLayoutManager(activity, 2)
activity?.let { RecyclerViewUtil.addGridItemDecoration(it, mRecyclerView!!, R.color.transparent, 2 * Constants.item_divider_4) } if (mRecyclerView?.itemDecorationCount == 0) {
activity?.let {
RecyclerViewUtil.addGridItemDecoration(
it,
mRecyclerView!!,
R.color.transparent,
Constants.item_divider_4 * 2
)
}
}
mRecyclerView?.adapter = liveItemAdapter mRecyclerView?.adapter = liveItemAdapter
liveItemAdapter?.setOnItemClickListener { adapter, view, position -> liveItemAdapter?.setOnItemClickListener { adapter, view, position ->
val item: LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean val item: LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean
...@@ -79,26 +87,30 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC ...@@ -79,26 +87,30 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC
startActivity(intent) startActivity(intent)
} }
liveTopAdapter = LiveTopAdapter(R.layout.item_match_topl_live_new, this) liveTopAdapter = LiveTopAdapter(R.layout.item_match_topl_live_new, this)
mRecyclerView_top.layoutManager = RecyclerViewUtil.nestedScrollNoFluent(mRecyclerView_top, LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)) mRecyclerView_top.layoutManager = RecyclerViewUtil.nestedScrollNoFluent(
mRecyclerView_top,
LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)
)
mRecyclerView_top.adapter = liveTopAdapter mRecyclerView_top.adapter = liveTopAdapter
RecyclerViewUtil.addItemDecoration(requireActivity(), mRecyclerView_top, R.color.transparent, Constants.item_divider_4 * 2, RecyclerView.HORIZONTAL) if (mRecyclerView_top.itemDecorationCount == 0) {
liveTopAdapter?.setOnItemClickListener { adapter, view, position -> RecyclerViewUtil.addItemDecoration(
requireActivity(),
mRecyclerView_top,
R.color.transparent,
Constants.item_divider,
RecyclerView.HORIZONTAL
)
}
if (SPUtil[Constants.USER_LOGIN, false] as Boolean) { liveTopAdapter?.setOnItemClickListener { adapter, view, position ->
val adapterItem = adapter.getItem(position) as MatchInfosBean? val adapterItem = adapter.getItem(position) as MatchInfosBean?
// val intent = Intent(activity, MatchDetailActivity::class.java)
val intent = Intent(activity, NewMatchDetailActivity::class.java) val intent = Intent(activity, NewMatchDetailActivity::class.java)
intent.putExtra(Constants.MATCH_BEAN_ID, adapterItem?.id) intent.putExtra(Constants.MATCH_BEAN_ID, adapterItem?.id)
intent.putExtra(Constants.SPORT_TYPE, adapterItem?.sportsType) intent.putExtra(Constants.SPORT_TYPE, adapterItem?.sportsType)
startActivity(intent) startActivity(intent)
} else {
DialogUtils.showLogin(requireActivity() as AppCompatActivity)
// startActivity(LoginActivity::class.java)
}
} }
...@@ -125,8 +137,6 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC ...@@ -125,8 +137,6 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC
} }
override fun lazyLoad() { override fun lazyLoad() {
presenter?.getMatchData(mPage) presenter?.getMatchData(mPage)
presenter?.getTopLive(mPage) presenter?.getTopLive(mPage)
...@@ -155,7 +165,6 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC ...@@ -155,7 +165,6 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC
} }
override fun onRequestLiveData(data: List<LiveBean.DataListBean>?) { override fun onRequestLiveData(data: List<LiveBean.DataListBean>?) {
liveItemAdapter?.let { liveItemAdapter?.let {
setLoadMore(it, data) setLoadMore(it, data)
...@@ -174,12 +183,12 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC ...@@ -174,12 +183,12 @@ class MainContentAllFragment : ToolbarFragment<MainContentAllPresenter>(), MainC
} }
override fun onMessage(data: List<MessageBean.DataListBean>?) { override fun onMessage(data: List<MessageBean.DataListBean>?) {
data?.let {list-> data?.let { list ->
if (list.isNotEmpty()){ if (list.isNotEmpty()) {
ll_message.visibility = View.GONE ll_message.visibility = View.GONE
tv_message.text =list[0].title tv_message.text = list[0].title
ll_message.setOnClickListener { ll_message.setOnClickListener {
DialogUtils.showMessage(requireActivity() as AppCompatActivity,list[0].content) DialogUtils.showMessage(requireActivity() as AppCompatActivity, list[0].content)
} }
} }
} }
......
...@@ -10,6 +10,7 @@ import com.softgarden.baselibrary.utils.L ...@@ -10,6 +10,7 @@ import com.softgarden.baselibrary.utils.L
import com.softgarden.baselibrary.utils.RecyclerViewUtil import com.softgarden.baselibrary.utils.RecyclerViewUtil
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.base.ToolbarFragment import com.hupu.tv.player.app.base.ToolbarFragment
import com.hupu.tv.player.app.bean.CategoryBean import com.hupu.tv.player.app.bean.CategoryBean
import com.hupu.tv.player.app.bean.LiveBean import com.hupu.tv.player.app.bean.LiveBean
...@@ -35,16 +36,13 @@ import org.greenrobot.eventbus.ThreadMode ...@@ -35,16 +36,13 @@ import org.greenrobot.eventbus.ThreadMode
* @date on 2020/6/14 * @date on 2020/6/14
* @describe * @describe
*/ */
class MainContentNormalFragment : ToolbarFragment<MainContentNormalPresenter>(), MainContentNormalContract.Display { class MainContentNormalFragment : RefreshVP2Fragment<MainContentNormalPresenter>(), MainContentNormalContract.Display {
private var imageCarousel: ImageCarousel? = null private var imageCarousel: ImageCarousel? = null
private var liveItemAdapter: LiveItemAdapter? = null private var liveItemAdapter: LiveItemAdapter? = null
private var sportId: String = "" private var sportId: String = ""
override val layoutId: Int override val layoutId: Int
get() = R.layout.fragment_match_content_normal get() = R.layout.fragment_match_content_normal
override fun setToolbar(builder: BaseToolbar.Builder): BaseToolbar.Builder? {
return null
}
override fun initEventAndData() { override fun initEventAndData() {
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
...@@ -58,7 +56,16 @@ class MainContentNormalFragment : ToolbarFragment<MainContentNormalPresenter>(), ...@@ -58,7 +56,16 @@ class MainContentNormalFragment : ToolbarFragment<MainContentNormalPresenter>(),
liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this) liveItemAdapter = LiveItemAdapter(R.layout.item_match_normal_live, this)
mRecyclerView?.adapter = liveItemAdapter mRecyclerView?.adapter = liveItemAdapter
mRecyclerView?.layoutManager = GridLayoutManager(activity, 2) mRecyclerView?.layoutManager = GridLayoutManager(activity, 2)
activity?.let { RecyclerViewUtil.addGridItemDecoration(it, mRecyclerView!!, R.color.transparent, 2 * Constants.item_divider) } if (mRecyclerView?.itemDecorationCount == 0){
activity?.let {
RecyclerViewUtil.addGridItemDecoration(
it,
mRecyclerView!!,
R.color.transparent,
Constants.item_divider_4 * 2
)
}
}
liveItemAdapter?.setOnItemClickListener { adapter, view, position -> liveItemAdapter?.setOnItemClickListener { adapter, view, position ->
val item:LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean val item:LiveBean.DataListBean = adapter.getItem(position) as LiveBean.DataListBean
val intent = Intent(activity, LiveActivity::class.java) val intent = Intent(activity, LiveActivity::class.java)
......
...@@ -5,6 +5,7 @@ import android.os.Bundle ...@@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.flyco.tablayout.utils.FragmentBasePager2Adapter
import com.kongzue.dialog.v3.WaitDialog import com.kongzue.dialog.v3.WaitDialog
import com.softgarden.baselibrary.base.FragmentBaseStatePagerAdapter import com.softgarden.baselibrary.base.FragmentBaseStatePagerAdapter
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
...@@ -13,8 +14,8 @@ import com.hupu.tv.player.app.base.RefreshFragment ...@@ -13,8 +14,8 @@ import com.hupu.tv.player.app.base.RefreshFragment
import com.hupu.tv.player.app.bean.TitleSortBean import com.hupu.tv.player.app.bean.TitleSortBean
import com.hupu.tv.player.app.ui.contact.MainFragmentContact import com.hupu.tv.player.app.ui.contact.MainFragmentContact
import com.hupu.tv.player.app.ui.presenter.MainFragmentPresenter import com.hupu.tv.player.app.ui.presenter.MainFragmentPresenter
import kotlinx.android.synthetic.main.fragment_main.tabLayout_main import com.softgarden.baselibrary.utils.ToastUtil
import kotlinx.android.synthetic.main.fragment_main.vp_main import kotlinx.android.synthetic.main.fragment_main.*
import kotlinx.android.synthetic.main.layout_empty_no_data.* import kotlinx.android.synthetic.main.layout_empty_no_data.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
...@@ -33,9 +34,14 @@ class MainFragment : RefreshFragment<MainFragmentPresenter>(), MainFragmentConta ...@@ -33,9 +34,14 @@ class MainFragment : RefreshFragment<MainFragmentPresenter>(), MainFragmentConta
presenter?.getCategory() presenter?.getCategory()
} }
private fun initView() { private fun initView() {
ll_empty.visibility = View.GONE ll_empty.visibility = View.GONE
iv_message.setOnClickListener {
ToastUtil.s("敬请期待")
}
iv_category.setOnClickListener {
ToastUtil.s("敬请期待")
}
} }
private fun initViewPager() { private fun initViewPager() {
val list = addDefaultData() val list = addDefaultData()
...@@ -49,10 +55,10 @@ class MainFragment : RefreshFragment<MainFragmentPresenter>(), MainFragmentConta ...@@ -49,10 +55,10 @@ class MainFragment : RefreshFragment<MainFragmentPresenter>(), MainFragmentConta
} }
} }
val mAdapter = FragmentBaseStatePagerAdapter(childFragmentManager, mFragments, mTitles) val mAdapter = FragmentBasePager2Adapter(childFragmentManager, mFragments, mTitles,lifecycle)
vp_main.offscreenPageLimit = list.size vp_main.offscreenPageLimit = list.size
vp_main.adapter = mAdapter vp_main.adapter = mAdapter
tabLayout_main.setViewPager(vp_main) tabLayout_main.setViewPager2(vp_main)
} }
......
...@@ -57,7 +57,9 @@ class MainNewsContentAllFragment : ToolbarFragment<MainNewsContentAllPresenter>( ...@@ -57,7 +57,9 @@ class MainNewsContentAllFragment : ToolbarFragment<MainNewsContentAllPresenter>(
newsAdapter = NewsListAdapter(R.layout.item_news, this) newsAdapter = NewsListAdapter(R.layout.item_news, this)
mRecyclerView?.layoutManager = LinearLayoutManager(requireContext()) mRecyclerView?.layoutManager = LinearLayoutManager(requireContext())
if (mRecyclerView?.itemDecorationCount == 0){
activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) } activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) }
}
mRecyclerView?.adapter = newsAdapter mRecyclerView?.adapter = newsAdapter
newsAdapter.setOnItemClickListener { adapter, view, position -> newsAdapter.setOnItemClickListener { adapter, view, position ->
val intent = Intent(requireActivity(), NewsDetailActivity::class.java) val intent = Intent(requireActivity(), NewsDetailActivity::class.java)
......
...@@ -40,7 +40,10 @@ class MainNewsContentNormalFragment : ToolbarFragment<MainNewsContentNormalPrese ...@@ -40,7 +40,10 @@ class MainNewsContentNormalFragment : ToolbarFragment<MainNewsContentNormalPrese
private fun initView() { private fun initView() {
newsAdapter = NewsListAdapter(R.layout.item_news, this) newsAdapter = NewsListAdapter(R.layout.item_news, this)
mRecyclerView?.layoutManager = LinearLayoutManager(requireContext()) mRecyclerView?.layoutManager = LinearLayoutManager(requireContext())
if (mRecyclerView?.itemDecorationCount == 0){
activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) } activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) }
}
mRecyclerView?.adapter = newsAdapter mRecyclerView?.adapter = newsAdapter
newsAdapter.setOnItemClickListener { adapter, view, position -> newsAdapter.setOnItemClickListener { adapter, view, position ->
val intent = Intent(requireActivity(), NewsDetailActivity::class.java) val intent = Intent(requireActivity(), NewsDetailActivity::class.java)
......
...@@ -12,8 +12,7 @@ import com.hupu.tv.player.app.base.RefreshFragment ...@@ -12,8 +12,7 @@ import com.hupu.tv.player.app.base.RefreshFragment
import com.hupu.tv.player.app.bean.NewsTagItemEntity import com.hupu.tv.player.app.bean.NewsTagItemEntity
import com.hupu.tv.player.app.ui.contact.MainNewsFragmentContact import com.hupu.tv.player.app.ui.contact.MainNewsFragmentContact
import com.hupu.tv.player.app.ui.presenter.MainNewsFragmentPresenter import com.hupu.tv.player.app.ui.presenter.MainNewsFragmentPresenter
import kotlinx.android.synthetic.main.fragment_main.tabLayout_main import kotlinx.android.synthetic.main.fragment_main_news.*
import kotlinx.android.synthetic.main.fragment_main.vp_main
import kotlinx.android.synthetic.main.layout_empty_no_data.* import kotlinx.android.synthetic.main.layout_empty_no_data.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
......
...@@ -2,16 +2,20 @@ package com.hupu.tv.player.app.ui.fragment ...@@ -2,16 +2,20 @@ package com.hupu.tv.player.app.ui.fragment
import android.os.Bundle import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mirkowu.basetoolbar.BaseToolbar import com.mirkowu.basetoolbar.BaseToolbar
import com.softgarden.baselibrary.utils.RecyclerViewUtil import com.softgarden.baselibrary.utils.RecyclerViewUtil
import com.softgarden.baselibrary.utils.ToastUtil import com.softgarden.baselibrary.utils.ToastUtil
import com.hupu.tv.player.app.R import com.hupu.tv.player.app.R
import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.RefreshVP2Fragment
import com.hupu.tv.player.app.base.ToolbarFragment import com.hupu.tv.player.app.base.ToolbarFragment
import com.hupu.tv.player.app.bean.CategoryBean import com.hupu.tv.player.app.bean.CategoryBean
import com.hupu.tv.player.app.bean.MatchContentBean import com.hupu.tv.player.app.bean.MatchContentBean
import com.hupu.tv.player.app.event.FollowMatchEvent import com.hupu.tv.player.app.event.FollowMatchEvent
import com.hupu.tv.player.app.ui.adapter.MatchContentAdapter import com.hupu.tv.player.app.ui.adapter.MatchContentAdapter
import com.hupu.tv.player.app.ui.adapter.MatchContentIncludeAdapter
import com.hupu.tv.player.app.ui.contact.MatchContentFragmentContract import com.hupu.tv.player.app.ui.contact.MatchContentFragmentContract
import com.hupu.tv.player.app.ui.presenter.MatchContentPresenter import com.hupu.tv.player.app.ui.presenter.MatchContentPresenter
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
...@@ -22,16 +26,13 @@ import org.greenrobot.eventbus.EventBus ...@@ -22,16 +26,13 @@ import org.greenrobot.eventbus.EventBus
* @date on 2020/6/14 * @date on 2020/6/14
* @describe * @describe
*/ */
class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchContentFragmentContract.Display { class MatchContentFragment : RefreshVP2Fragment<MatchContentPresenter>(), MatchContentFragmentContract.Display {
private var matchContentAdapter: MatchContentAdapter? = null private var matchContentAdapter: MatchContentAdapter? = null
private var sportId: String = "" private var sportId: String = ""
override val layoutId: Int override val layoutId: Int
get() = R.layout.fragment_match_content get() = R.layout.fragment_match_content
override fun setToolbar(builder: BaseToolbar.Builder): BaseToolbar.Builder? {
return null
}
override fun initEventAndData() { override fun initEventAndData() {
initRecyclerView() initRecyclerView()
...@@ -39,19 +40,21 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont ...@@ -39,19 +40,21 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont
initView() initView()
} }
public fun requestFollow(id: String, status: Boolean) { fun requestFollow(id: String, status: Boolean, parentPosition: Int, position: Int) {
presenter?.reserveMatch(id, status) presenter?.reserveMatch(id, status, parentPosition, position)
} }
private fun initView() { private fun initView() {
matchContentAdapter = MatchContentAdapter(R.layout.item_match_content, this) matchContentAdapter =
MatchContentAdapter(R.layout.item_match_content, this, arguments?.getInt(Constants.POSITION) ?: 0)
mRecyclerView?.adapter = matchContentAdapter mRecyclerView?.adapter = matchContentAdapter
mRecyclerView?.layoutManager = LinearLayoutManager(activity) mRecyclerView?.layoutManager = LinearLayoutManager(activity)
if (mRecyclerView?.itemDecorationCount == 0) { if (mRecyclerView?.itemDecorationCount == 0) {
activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) } activity?.let { RecyclerViewUtil.addItemDecoration(it, mRecyclerView!!, R.color.view_color, 1) }
} }
matchContentAdapter?.bindToRecyclerView(mRecyclerView!!)
arguments?.getString(CategoryBean.ID)?.let { arguments?.getString(CategoryBean.ID)?.let {
sportId = it sportId = it
} }
...@@ -63,11 +66,12 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont ...@@ -63,11 +66,12 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont
} }
companion object { companion object {
fun newInstance(id: String, title: String): MatchContentFragment { fun newInstance(id: String, title: String, index: Int): MatchContentFragment {
val args = Bundle() val args = Bundle()
val fragment = MatchContentFragment() val fragment = MatchContentFragment()
args.putString(CategoryBean.ID, id) args.putString(CategoryBean.ID, id)
args.putString(CategoryBean.TITLE, title) args.putString(CategoryBean.TITLE, title)
args.putInt(Constants.POSITION, index)
fragment.arguments = args fragment.arguments = args
return fragment return fragment
} }
...@@ -80,8 +84,15 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont ...@@ -80,8 +84,15 @@ class MatchContentFragment : ToolbarFragment<MatchContentPresenter>(), MatchCont
} }
} }
override fun onSubscribeMatch(message: String) { override fun onSubscribeMatch(message: String, parentPosition: Int, position: Int) {
ToastUtil.s(message) ToastUtil.s(message)
val recyclerView = matchContentAdapter?.getViewByPosition(parentPosition, R.id.recycler_content) as RecyclerView
val matchContentIncludeAdapter = recyclerView.adapter as? MatchContentIncludeAdapter
val item = matchContentIncludeAdapter?.getItem(position)
item?.let {
it.isSubscribe = !it.isSubscribe
}
matchContentIncludeAdapter?.notifyItemChanged(position)
EventBus.getDefault().post(FollowMatchEvent()) EventBus.getDefault().post(FollowMatchEvent())
} }
......
...@@ -6,6 +6,8 @@ import android.view.View ...@@ -6,6 +6,8 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import androidx.viewpager2.widget.ViewPager2
import com.flyco.tablayout.utils.FragmentBasePager2Adapter
import com.kongzue.dialog.v3.WaitDialog import com.kongzue.dialog.v3.WaitDialog
import com.mirkowu.basetoolbar.BaseToolbar import com.mirkowu.basetoolbar.BaseToolbar
import com.softgarden.baselibrary.base.FragmentBaseStatePagerAdapter import com.softgarden.baselibrary.base.FragmentBaseStatePagerAdapter
...@@ -15,12 +17,13 @@ import com.hupu.tv.player.app.app.Constants ...@@ -15,12 +17,13 @@ import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.base.ToolbarFragment import com.hupu.tv.player.app.base.ToolbarFragment
import com.hupu.tv.player.app.bean.TitleSortBean import com.hupu.tv.player.app.bean.TitleSortBean
import com.hupu.tv.player.app.event.SubscribeEvent import com.hupu.tv.player.app.event.SubscribeEvent
import com.hupu.tv.player.app.event.SubscribeMatchEvent
import com.hupu.tv.player.app.event.VisibleEvent import com.hupu.tv.player.app.event.VisibleEvent
import com.hupu.tv.player.app.ui.contact.MatchFragmentContact import com.hupu.tv.player.app.ui.contact.MatchFragmentContact
import com.hupu.tv.player.app.ui.presenter.MatchFragmentPresenter import com.hupu.tv.player.app.ui.presenter.MatchFragmentPresenter
import com.hupu.tv.player.app.utils.DialogUtils import com.hupu.tv.player.app.utils.DialogUtils
import kotlinx.android.synthetic.main.fragment_match_main.tabLayout_main import com.softgarden.baselibrary.utils.ToastUtil
import kotlinx.android.synthetic.main.fragment_match_main.vp_main import kotlinx.android.synthetic.main.fragment_match_main.*
import kotlinx.android.synthetic.main.layout_empty_no_data.* import kotlinx.android.synthetic.main.layout_empty_no_data.*
import me.jessyan.autosize.utils.LogUtils import me.jessyan.autosize.utils.LogUtils
import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.EventBus
...@@ -58,22 +61,14 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo ...@@ -58,22 +61,14 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo
val mTitles = arrayOfNulls<String>(list.size) val mTitles = arrayOfNulls<String>(list.size)
list.forEachIndexed { index, titleSortBean -> list.forEachIndexed { index, titleSortBean ->
mTitles[index] = titleSortBean.sportsName mTitles[index] = titleSortBean.sportsName
mFragments.add(MatchContentFragment.newInstance(titleSortBean.sportsId, titleSortBean.sportsName)) mFragments.add(MatchContentFragment.newInstance(titleSortBean.sportsId, titleSortBean.sportsName,index))
} }
val mAdapter = FragmentBaseStatePagerAdapter(childFragmentManager, mFragments, mTitles) val mAdapter = FragmentBasePager2Adapter(childFragmentManager, mFragments, mTitles,lifecycle)
vp_main.offscreenPageLimit = list.size vp_main.offscreenPageLimit = list.size
vp_main.adapter = mAdapter vp_main.adapter = mAdapter
tabLayout_main.setViewPager(vp_main) tabLayout_main.setViewPager2(vp_main)
vp_main.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { vp_main.registerOnPageChangeCallback(object :ViewPager2.OnPageChangeCallback(){
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
currentFragment = position currentFragment = position
} }
...@@ -89,17 +84,12 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo ...@@ -89,17 +84,12 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo
} }
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1) @Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1)
fun onEventContent(event: SubscribeEvent) { fun onSubcribe(event: SubscribeMatchEvent) {
if (event.className != "match") { if (event.tag != Constants.SUBSCRIBE_MATCH) {
return return
} }
LogUtils.e("event") val matchContentFragment = mFragments[event.fragmentPosition] as MatchContentFragment
if (SPUtil[Constants.USER_LOGIN, false] == true) { matchContentFragment.requestFollow(event.id, event.subsribe,event.parentPostion,event.position)
val matchContentFragment = mFragments[currentFragment] as MatchContentFragment
matchContentFragment.requestFollow(event.id, event.isStatus)
} else {
DialogUtils.showLogin(activity as AppCompatActivity)
}
} }
...@@ -129,6 +119,9 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo ...@@ -129,6 +119,9 @@ class MatchFragment : ToolbarFragment<MatchFragmentPresenter>(), MatchFragmentCo
override fun initEventAndData() { override fun initEventAndData() {
hideToolbar() hideToolbar()
iv_message.setOnClickListener {
ToastUtil.s("敬请期待")
}
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
} }
......
...@@ -2,6 +2,7 @@ package com.hupu.tv.player.app.ui.im; ...@@ -2,6 +2,7 @@ package com.hupu.tv.player.app.ui.im;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.hyphenate.chat.EMClient; import com.hyphenate.chat.EMClient;
...@@ -22,6 +23,7 @@ import com.hupu.tv.player.app.app.Constants; ...@@ -22,6 +23,7 @@ import com.hupu.tv.player.app.app.Constants;
*/ */
public class CustomTextRow extends EaseChatRowText { public class CustomTextRow extends EaseChatRowText {
private TextView tvLevel; private TextView tvLevel;
private ImageView ivLevel;
public CustomTextRow(Context context, boolean isSender) { public CustomTextRow(Context context, boolean isSender) {
super(context, isSender); super(context, isSender);
...@@ -35,6 +37,7 @@ public class CustomTextRow extends EaseChatRowText { ...@@ -35,6 +37,7 @@ public class CustomTextRow extends EaseChatRowText {
protected void onFindViewById() { protected void onFindViewById() {
super.onFindViewById(); super.onFindViewById();
tvLevel = findViewById(R.id.tv_level); tvLevel = findViewById(R.id.tv_level);
ivLevel = findViewById(R.id.iv_level);
} }
@Override @Override
...@@ -66,18 +69,104 @@ public class CustomTextRow extends EaseChatRowText { ...@@ -66,18 +69,104 @@ public class CustomTextRow extends EaseChatRowText {
EaseUserUtils.setUserAvatar(context, EMClient.getInstance().getCurrentUser(), userAvatarView); EaseUserUtils.setUserAvatar(context, EMClient.getInstance().getCurrentUser(), userAvatarView);
//只要不是常规布局形式,就展示昵称 //只要不是常规布局形式,就展示昵称
if (EaseChatItemStyleHelper.getInstance().getStyle().getItemShowType() != EaseChatMessageListLayout.ShowType.NORMAL.ordinal()) { if (EaseChatItemStyleHelper.getInstance().getStyle().getItemShowType() != EaseChatMessageListLayout.ShowType.NORMAL.ordinal()) {
EaseUserUtils.setUserNick(userNick+":", usernickView); EaseUserUtils.setUserNick(userNick + ":", usernickView);
tvLevel.setText("LV." +level); setLevel(level);
tvLevel.setText("LV." + level);
} }
} else { } else {
//todo 接受来的昵称 //todo 接受来的昵称
EaseUserUtils.setUserAvatar(context, message.getFrom(), userAvatarView); EaseUserUtils.setUserAvatar(context, message.getFrom(), userAvatarView);
EaseUserUtils.setUserNick(userNick+":", usernickView); EaseUserUtils.setUserNick(userNick + ":", usernickView);
setLevel(level);
tvLevel.setText("LV." + level); tvLevel.setText("LV." + level);
} }
} }
private void setLevel(int level) {
int levelIcon = 0;
switch (level) {
case 1:
levelIcon = R.mipmap.icon_user_level_1;
break;
case 2:
levelIcon = R.mipmap.icon_user_level_2;
break;
case 3:
levelIcon = R.mipmap.icon_user_level_3;
break;
case 4:
levelIcon = R.mipmap.icon_user_level_4;
break;
case 5:
levelIcon = R.mipmap.icon_user_level_5;
break;
case 6:
levelIcon = R.mipmap.icon_user_level_6;
break;
case 7:
levelIcon = R.mipmap.icon_user_level_7;
break;
case 8:
levelIcon = R.mipmap.icon_user_level_8;
break;
case 9:
levelIcon = R.mipmap.icon_user_level_9;
break;
case 10:
levelIcon = R.mipmap.icon_user_level_10;
break;
case 11:
levelIcon = R.mipmap.icon_user_level_11;
break;
case 12:
levelIcon = R.mipmap.icon_user_level_12;
break;
case 13:
levelIcon = R.mipmap.icon_user_level_13;
break;
case 14:
levelIcon = R.mipmap.icon_user_level_14;
break;
case 15:
levelIcon = R.mipmap.icon_user_level_15;
break;
case 16:
levelIcon = R.mipmap.icon_user_level_16;
break;
case 17:
levelIcon = R.mipmap.icon_user_level_17;
break;
case 18:
levelIcon = R.mipmap.icon_user_level_18;
break;
case 19:
levelIcon = R.mipmap.icon_user_level_19;
break;
case 20:
levelIcon = R.mipmap.icon_user_level_20;
break;
case 21:
levelIcon = R.mipmap.icon_user_level_21;
break;
case 22:
levelIcon = R.mipmap.icon_user_level_22;
break;
case 23:
levelIcon = R.mipmap.icon_user_level_23;
break;
case 24:
levelIcon = R.mipmap.icon_user_level_24;
break;
case 25:
levelIcon = R.mipmap.icon_user_level_25;
break;
}
ivLevel.setImageResource(levelIcon);
}
// @Override // @Override
// public void onSetUpView() { // public void onSetUpView() {
// EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody(); // EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
......
...@@ -38,37 +38,36 @@ class FollowMatchPresenter : IBasePresenter, FollowMatchContract.Presenter { ...@@ -38,37 +38,36 @@ class FollowMatchPresenter : IBasePresenter, FollowMatchContract.Presenter {
} }
override fun reserveMatch(id: String,parentPosition:Int,position:Int) {
override fun reserveMatch(id: String) {
val hashMap = HashMap<String, Any>() val hashMap = HashMap<String, Any>()
hashMap["id"] =id hashMap["id"] =id
RetrofitClient.retrofitService RetrofitClient.retrofitService
.reserveMatch(JsonUtils.toRequestBody(hashMap)) .reserveMatch(JsonUtils.toRequestBody(hashMap))
.compose(NetworkTransformer(mView,false)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<String>() { .subscribe(object : RxCallback<String>() {
override fun onSuccess(data: String?) { override fun onSuccess(data: String?) {
mView?.onSubscribeMatch("预约成功") mView?.onSubscribeMatch("预约成功",parentPosition, position)
} }
}) })
} }
override fun reserveMatch(id: String, status: Boolean) { override fun reserveMatch(id: String, status: Boolean, parentPosition: Int, position: Int) {
if (status){ if (status){
reserveMatch(id) cancelReserveMatch(id,parentPosition, position)
}else{ }else{
cancelReserveMatch(id) reserveMatch(id,parentPosition, position)
} }
} }
override fun cancelReserveMatch(id: String) { override fun cancelReserveMatch(id: String,parentPosition:Int,position:Int) {
val hashMap = HashMap<String, Any>() val hashMap = HashMap<String, Any>()
hashMap["id"] =id hashMap["id"] =id
RetrofitClient.retrofitService RetrofitClient.retrofitService
.cancelReserve(JsonUtils.toRequestBody(hashMap)) .cancelReserve(JsonUtils.toRequestBody(hashMap))
.compose(NetworkTransformer(mView,false)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<String>() { .subscribe(object : RxCallback<String>() {
override fun onSuccess(data: String?) { override fun onSuccess(data: String?) {
mView?.onSubscribeMatch("取消成功") mView?.onSubscribeMatch("取消成功",parentPosition, position)
} }
}) })
} }
......
...@@ -7,6 +7,7 @@ import com.softgarden.baselibrary.network.RxCallback ...@@ -7,6 +7,7 @@ import com.softgarden.baselibrary.network.RxCallback
import com.hupu.tv.player.app.api.RetrofitClient import com.hupu.tv.player.app.api.RetrofitClient
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.FakeMessageEntity import com.hupu.tv.player.app.bean.FakeMessageEntity
import com.hupu.tv.player.app.bean.LiveBean
import com.hupu.tv.player.app.bean.RoomInfoBean import com.hupu.tv.player.app.bean.RoomInfoBean
import com.hupu.tv.player.app.ui.contact.LiveActivityContact import com.hupu.tv.player.app.ui.contact.LiveActivityContact
import com.hupu.tv.player.app.utils.JsonUtils import com.hupu.tv.player.app.utils.JsonUtils
...@@ -34,7 +35,7 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter { ...@@ -34,7 +35,7 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter {
.compose(NetworkTransformer(mView)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<FakeMessageEntity>() { .subscribe(object : RxCallback<FakeMessageEntity>() {
override fun onSuccess(data: FakeMessageEntity?) { override fun onSuccess(data: FakeMessageEntity?) {
SPUtil.putSerializableObject(Constants.FAKE_MESSAGE,data) SPUtil.putSerializableObject(Constants.FAKE_MESSAGE, data)
} }
}) })
} }
...@@ -80,7 +81,22 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter { ...@@ -80,7 +81,22 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter {
}) })
} }
override fun sendGift(giftId: Int, roomId: String,position:Int) { override fun getRecommend(id: String, pageNum: Int) {
val hashMap = HashMap<String, Any>()
hashMap["pageNum"] = pageNum
hashMap["pageSize"] = 10
hashMap["roomId"] = id
RetrofitClient.retrofitService
.getRecommendList(JsonUtils.toRequestBody(hashMap))
.compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<LiveBean>() {
override fun onSuccess(data: LiveBean?) {
mView?.onRecommend(data)
}
})
}
override fun sendGift(giftId: Int, roomId: String, position: Int) {
val hashMap = HashMap<String, Any>() val hashMap = HashMap<String, Any>()
hashMap["giftId"] = giftId hashMap["giftId"] = giftId
hashMap["roomId"] = roomId hashMap["roomId"] = roomId
...@@ -89,7 +105,7 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter { ...@@ -89,7 +105,7 @@ class LiveActivityPresenter : IBasePresenter, LiveActivityContact.Presenter {
.compose(NetworkTransformer(mView)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<String>() { .subscribe(object : RxCallback<String>() {
override fun onSuccess(data: String?) { override fun onSuccess(data: String?) {
mView?.onSendGift(giftId,position) mView?.onSendGift(giftId, position)
} }
// override fun onError(t: Throwable) { // override fun onError(t: Throwable) {
......
...@@ -41,7 +41,7 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese ...@@ -41,7 +41,7 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese
} }
override fun reserveMatch(id: String) { override fun reserveMatch(id: String,parentPosition:Int,position:Int) {
val hashMap = HashMap<String, Any>() val hashMap = HashMap<String, Any>()
hashMap["id"] =id hashMap["id"] =id
RetrofitClient.retrofitService RetrofitClient.retrofitService
...@@ -49,20 +49,20 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese ...@@ -49,20 +49,20 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese
.compose(NetworkTransformer(mView)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<String>() { .subscribe(object : RxCallback<String>() {
override fun onSuccess(data: String?) { override fun onSuccess(data: String?) {
mView?.onSubscribeMatch("预约成功") mView?.onSubscribeMatch("预约成功",parentPosition, position)
} }
}) })
} }
override fun reserveMatch(id: String, status: Boolean) { override fun reserveMatch(id: String, status: Boolean, parentPosition: Int, position: Int) {
if (status){ if (status){
reserveMatch(id) cancelReserveMatch(id,parentPosition, position)
}else{ }else{
cancelReserveMatch(id) reserveMatch(id,parentPosition, position)
} }
} }
override fun cancelReserveMatch(id: String) { override fun cancelReserveMatch(id: String,parentPosition:Int,position:Int) {
val hashMap = HashMap<String, Any>() val hashMap = HashMap<String, Any>()
hashMap["id"] =id hashMap["id"] =id
RetrofitClient.retrofitService RetrofitClient.retrofitService
...@@ -70,7 +70,7 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese ...@@ -70,7 +70,7 @@ class MatchContentPresenter : IBasePresenter, MatchContentFragmentContract.Prese
.compose(NetworkTransformer(mView)) .compose(NetworkTransformer(mView))
.subscribe(object : RxCallback<String>() { .subscribe(object : RxCallback<String>() {
override fun onSuccess(data: String?) { override fun onSuccess(data: String?) {
mView?.onSubscribeMatch("取消成功") mView?.onSubscribeMatch("取消成功",parentPosition, position)
} }
}) })
} }
......
...@@ -22,6 +22,7 @@ import com.hupu.tv.player.app.app.App.Companion.instance ...@@ -22,6 +22,7 @@ import com.hupu.tv.player.app.app.App.Companion.instance
import com.hupu.tv.player.app.app.Constants import com.hupu.tv.player.app.app.Constants
import com.hupu.tv.player.app.bean.MovieBean.RecordsBean import com.hupu.tv.player.app.bean.MovieBean.RecordsBean
import com.hupu.tv.player.app.event.RefreshUserEvent import com.hupu.tv.player.app.event.RefreshUserEvent
import com.hupu.tv.player.app.ui.activity.LoginActivity
import com.hupu.tv.player.app.utils.DateUtil.unitFormat import com.hupu.tv.player.app.utils.DateUtil.unitFormat
import com.hupu.tv.player.app.widget.LinkTextView import com.hupu.tv.player.app.widget.LinkTextView
import com.hyphenate.util.UriUtils.* import com.hyphenate.util.UriUtils.*
...@@ -263,8 +264,10 @@ object CommonUtils { ...@@ -263,8 +264,10 @@ object CommonUtils {
val intent = Intent(Intent.ACTION_MAIN) val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_LAUNCHER) intent.addCategory(Intent.CATEGORY_LAUNCHER)
intent.flags = Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED or Intent.FLAG_ACTIVITY_NEW_TASK intent.flags = Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED or Intent.FLAG_ACTIVITY_NEW_TASK
@SuppressLint("WrongConstant") val list = pkgMag.queryIntentActivities(intent, @SuppressLint("WrongConstant") val list = pkgMag.queryIntentActivities(
PackageManager.GET_ACTIVITIES) intent,
PackageManager.GET_ACTIVITIES
)
for (i in list.indices) { for (i in list.indices) {
val info = list[i] val info = list[i]
if (info.activityInfo.packageName == packageName) { if (info.activityInfo.packageName == packageName) {
...@@ -286,8 +289,10 @@ object CommonUtils { ...@@ -286,8 +289,10 @@ object CommonUtils {
} else { } else {
// 创建第三方应用的上下文环境 // 创建第三方应用的上下文环境
try { try {
pkgContext = context.createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY pkgContext = context.createPackageContext(
or Context.CONTEXT_INCLUDE_CODE) packageName, Context.CONTEXT_IGNORE_SECURITY
or Context.CONTEXT_INCLUDE_CODE
)
} catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace() e.printStackTrace()
} }
...@@ -435,8 +440,10 @@ object CommonUtils { ...@@ -435,8 +440,10 @@ object CommonUtils {
val minutes = totalSeconds / 60 % 60 val minutes = totalSeconds / 60 % 60
val hours = totalSeconds / 3600 val hours = totalSeconds / 3600
return if (hours > 0) { return if (hours > 0) {
String.format(Locale.US, "%02d:%02d:%02d", hours, minutes, String.format(
seconds) Locale.US, "%02d:%02d:%02d", hours, minutes,
seconds
)
} else { } else {
String.format(Locale.US, "%02d:%02d", minutes, seconds) String.format(Locale.US, "%02d:%02d", minutes, seconds)
} }
...@@ -448,8 +455,10 @@ object CommonUtils { ...@@ -448,8 +455,10 @@ object CommonUtils {
val minutes = totalSeconds / 60 % 60 val minutes = totalSeconds / 60 % 60
val hours = totalSeconds / 3600 val hours = totalSeconds / 3600
return if (hours > 0) { return if (hours > 0) {
String.format(Locale.US, "%02d:%02d:%02d", hours, minutes, String.format(
seconds) Locale.US, "%02d:%02d:%02d", hours, minutes,
seconds
)
} else { } else {
String.format(Locale.US, "%02d:%02d", minutes, seconds) String.format(Locale.US, "%02d:%02d", minutes, seconds)
} }
...@@ -561,7 +570,12 @@ object CommonUtils { ...@@ -561,7 +570,12 @@ object CommonUtils {
//这里可以用过循环处理就可以动态实现文本颜色的差别化了 //这里可以用过循环处理就可以动态实现文本颜色的差别化了
//设置高亮样式一 //设置高亮样式一
for (span in spans) { for (span in spans) {
sp.setSpan(ForegroundColorSpan(instance!!.resources.getColor(R.color.web_blue)), sp.getSpanStart(span), sp.getSpanEnd(span), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) sp.setSpan(
ForegroundColorSpan(instance!!.resources.getColor(R.color.web_blue)),
sp.getSpanStart(span),
sp.getSpanEnd(span),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
} }
textView.movementMethod = LinkTextView.LocalLinkMovementMethod.getInstance() textView.movementMethod = LinkTextView.LocalLinkMovementMethod.getInstance()
return sp return sp
...@@ -579,7 +593,10 @@ object CommonUtils { ...@@ -579,7 +593,10 @@ object CommonUtils {
val selectionArgs = arrayOf(id) val selectionArgs = arrayOf(id)
filePath = getDataColumn(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection, selectionArgs) filePath = getDataColumn(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection, selectionArgs)
} else if (isDownloadsDocument(uri)) { } else if (isDownloadsDocument(uri)) {
val contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(documentId)) val contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"),
java.lang.Long.valueOf(documentId)
)
filePath = getDataColumn(context, contentUri, null, null) filePath = getDataColumn(context, contentUri, null, null)
} }
} else if ("content".equals(uri.scheme, ignoreCase = true)) { } else if ("content".equals(uri.scheme, ignoreCase = true)) {
...@@ -613,13 +630,17 @@ object CommonUtils { ...@@ -613,13 +630,17 @@ object CommonUtils {
MobclickAgent.onProfileSignOff() MobclickAgent.onProfileSignOff()
} }
fun exitLogOut(){ fun exitLogOut() {
SPUtil.put(Constants.TOKEN, "") SPUtil.put(Constants.TOKEN, "")
SPUtil.put(Constants.USER_LOGIN, false) SPUtil.put(Constants.USER_LOGIN, false)
EventBus.getDefault().post(RefreshUserEvent()) EventBus.getDefault().post(RefreshUserEvent())
CommonUtils.umengLoginOut() CommonUtils.umengLoginOut()
} }
fun toLogin(context: Context) {
context.startActivity(Intent(context, LoginActivity::class.java))
}
// fun getTestDeviceInfo(context: Context?): Array<String?>? { // fun getTestDeviceInfo(context: Context?): Array<String?>? {
// val deviceInfo = arrayOfNulls<String>(2) // val deviceInfo = arrayOfNulls<String>(2)
......
...@@ -440,6 +440,8 @@ object DialogUtils { ...@@ -440,6 +440,8 @@ object DialogUtils {
} }
fun showLogin(activity: AppCompatActivity?) { fun showLogin(activity: AppCompatActivity?) {
activity?.startActivity(Intent(activity,LoginActivity::class.java)) activity?.startActivity(Intent(activity,LoginActivity::class.java))
// CustomDialog.show(activity, R.layout.dialog_login) { dialog: CustomDialog, v: View -> // CustomDialog.show(activity, R.layout.dialog_login) { dialog: CustomDialog, v: View ->
......
...@@ -10,6 +10,7 @@ import android.view.LayoutInflater; ...@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -73,6 +74,7 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I ...@@ -73,6 +74,7 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I
/** /**
* 另一侧的环信id * 另一侧的环信id
*/ */
public TextView tvLive;
private String username; private String username;
private boolean canUseRefresh = true; private boolean canUseRefresh = true;
private EaseChatMessageListLayout.LoadMoreStatus loadMoreStatus; private EaseChatMessageListLayout.LoadMoreStatus loadMoreStatus;
...@@ -98,7 +100,7 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I ...@@ -98,7 +100,7 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I
public CustomEaseChatMessageListLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public CustomEaseChatMessageListLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.ease_chat_message_list, this); LayoutInflater.from(context).inflate(R.layout.custom_ease_chat_message_list, this);
EaseChatItemStyleHelper.getInstance().clear(); EaseChatItemStyleHelper.getInstance().clear();
chatSetHelper = EaseChatItemStyleHelper.getInstance(); chatSetHelper = EaseChatItemStyleHelper.getInstance();
presenter = new EaseChatMessagePresenterImpl(); presenter = new EaseChatMessagePresenterImpl();
...@@ -170,10 +172,14 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I ...@@ -170,10 +172,14 @@ public class CustomEaseChatMessageListLayout extends RelativeLayout implements I
} }
} }
public void setLiveName(String liveName){
tvLive.setText(liveName);
}
private void initViews() { private void initViews() {
presenter.attachView(this); presenter.attachView(this);
tvLive = findViewById(R.id.tv_live_name);
rvList = findViewById(R.id.message_list); rvList = findViewById(R.id.message_list);
srlRefresh = findViewById(R.id.srl_refresh); srlRefresh = findViewById(R.id.srl_refresh);
......
...@@ -136,7 +136,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar ...@@ -136,7 +136,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
@Override @Override
public void showNormalStatus() { public void showNormalStatus() {
hideSoftKeyboard(); hideSoftKeyboard();
buttonSetModeVoice.setVisibility(VISIBLE); // buttonSetModeVoice.setVisibility(VISIBLE);
setGiftShowImage(); setGiftShowImage();
buttonSetModeKeyboard.setVisibility(GONE); buttonSetModeKeyboard.setVisibility(GONE);
edittext_layout.setVisibility(VISIBLE); edittext_layout.setVisibility(VISIBLE);
...@@ -168,7 +168,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar ...@@ -168,7 +168,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
@Override @Override
public void showTextStatus() { public void showTextStatus() {
buttonSetModeVoice.setVisibility(VISIBLE); // buttonSetModeVoice.setVisibility(VISIBLE);
buttonSetModeKeyboard.setVisibility(GONE); buttonSetModeKeyboard.setVisibility(GONE);
edittext_layout.setVisibility(VISIBLE); edittext_layout.setVisibility(VISIBLE);
buttonPressToSpeak.setVisibility(GONE); buttonPressToSpeak.setVisibility(GONE);
...@@ -197,7 +197,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar ...@@ -197,7 +197,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
@Override @Override
public void showEmojiconStatus() { public void showEmojiconStatus() {
buttonSetModeVoice.setVisibility(VISIBLE); // buttonSetModeVoice.setVisibility(VISIBLE);
buttonSetModeKeyboard.setVisibility(GONE); buttonSetModeKeyboard.setVisibility(GONE);
edittext_layout.setVisibility(VISIBLE); edittext_layout.setVisibility(VISIBLE);
buttonPressToSpeak.setVisibility(GONE); buttonPressToSpeak.setVisibility(GONE);
...@@ -219,7 +219,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar ...@@ -219,7 +219,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
public void showMoreStatus() { public void showMoreStatus() {
if (buttonMore.isChecked()) { if (buttonMore.isChecked()) {
hideSoftKeyboard(); hideSoftKeyboard();
buttonSetModeVoice.setVisibility(VISIBLE); // buttonSetModeVoice.setVisibility(VISIBLE);
buttonSetModeKeyboard.setVisibility(GONE); buttonSetModeKeyboard.setVisibility(GONE);
edittext_layout.setVisibility(VISIBLE); edittext_layout.setVisibility(VISIBLE);
buttonPressToSpeak.setVisibility(GONE); buttonPressToSpeak.setVisibility(GONE);
......
...@@ -86,6 +86,11 @@ class DanmakuVideoPlayer : StandardGSYVideoPlayer { ...@@ -86,6 +86,11 @@ class DanmakuVideoPlayer : StandardGSYVideoPlayer {
GlideUtils.loadImage(activityContext,cover,iv_cover,R.mipmap.icon_video_place_holder) GlideUtils.loadImage(activityContext,cover,iv_cover,R.mipmap.icon_video_place_holder)
} }
fun setNumAndFire(num:String?,fire: String?){
tv_room_num?.text = "房间号:$num"
tv_fire_num?.text = "热度:$fire"
}
override fun touchSurfaceMoveFullLogic(absDeltaX: Float, absDeltaY: Float) { override fun touchSurfaceMoveFullLogic(absDeltaX: Float, absDeltaY: Float) {
super.touchSurfaceMoveFullLogic(absDeltaX, absDeltaY) super.touchSurfaceMoveFullLogic(absDeltaX, absDeltaY)
//不给触摸快进,如果需要,屏蔽下方代码即可 //不给触摸快进,如果需要,屏蔽下方代码即可
...@@ -204,6 +209,7 @@ class DanmakuVideoPlayer : StandardGSYVideoPlayer { ...@@ -204,6 +209,7 @@ class DanmakuVideoPlayer : StandardGSYVideoPlayer {
gsyVideoPlayer.danmakuStartSeekPosition = currentPositionWhenPlaying.toLong() gsyVideoPlayer.danmakuStartSeekPosition = currentPositionWhenPlaying.toLong()
gsyVideoPlayer.danmaKuShow = danmaKuShow gsyVideoPlayer.danmaKuShow = danmaKuShow
onPrepareDanmaku(gsyVideoPlayer) onPrepareDanmaku(gsyVideoPlayer)
setNumAndFire(tv_room_num.text.toString(),tv_fire_num.text.toString())
} }
return gsyBaseVideoPlayer return gsyBaseVideoPlayer
} }
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/match_subscribe"/>
<item android:state_selected="false" android:drawable="@mipmap/match_unsubscribed"/>
<item android:drawable="@mipmap/match_unsubscribed"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="#FF4A64" />
<corners android:radius="@dimen/dp_14" />
<padding android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="#FF4A64" />
<padding android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp" />
<corners android:radius="@dimen/dp_14" />
</shape></item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<gradient <solid android:color="#A4A6BD" />
android:angle="135" <corners android:radius="@dimen/dp_13" />
android:endColor="#A4A6BD"
android:startColor="#D1D2E1" />
</shape> </shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FF5261" />
<corners android:radius="@dimen/dp_13" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/white"/>
<corners android:radius="@dimen/dp_16"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white" />
<corners android:radius="@dimen/dp_10" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/background_f5"/>
<corners android:radius="@dimen/dp_9"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/color_F8F8F7"/>
<corners android:radius="@dimen/dp_16"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<solid android:color="@color/color_FF5655"/>
<size android:width="@dimen/dp_5" android:height="@dimen/dp_5"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#00000000"
android:startColor="#99000000"/>
</shape>
...@@ -13,65 +13,129 @@ ...@@ -13,65 +13,129 @@
android:layout_height="@dimen/dp_200" /> android:layout_height="@dimen/dp_200" />
<LinearLayout
android:visibility="gone"
android:orientation="vertical"
android:id="@+id/ll_anchor_finish"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_200">
<TextView
android:layout_marginStart="@dimen/dp_10"
android:textColor="@color/white"
android:textSize="@dimen/sp_13"
android:text="主播正在训练中,看看其他主播吧"
android:layout_marginTop="@dimen/dp_24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:paddingHorizontal="@dimen/sp_19"
tools:listitem="@layout/item_live_recommend"
android:id="@+id/recycler_recommend"
android:layout_marginTop="@dimen/dp_8"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
<RelativeLayout <RelativeLayout
tools:visibility="visible"
android:visibility="gone"
android:id="@+id/iv_live_empty" android:id="@+id/iv_live_empty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_200" android:layout_height="@dimen/dp_200"
android:background="@color/grey_normal"> android:background="@color/grey_normal"
android:visibility="gone"
tools:visibility="gone">
<ImageView <ImageView
android:layout_centerInParent="true"
android:id="@+id/iv_img" android:id="@+id/iv_img"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scaleType="centerInside" android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@mipmap/live_empty" /> android:src="@mipmap/live_empty" />
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_img" android:layout_below="@id/iv_img"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:textColor="@color/white" tools:text="主播正在赶来的路上......"
android:text="主播正在赶来的路上......" android:textColor="@color/white" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_top" android:id="@+id/ll_anchor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="54dp"
android:layout_below="@+id/player" android:layout_below="@id/player"
android:gravity="center" android:background="@color/background_f5"
android:minHeight="@dimen/dp_40" android:orientation="horizontal"
android:orientation="horizontal"> android:paddingHorizontal="@dimen/dp_14"
android:paddingVertical="@dimen/dp_8">
<com.flyco.tablayout.SlidingTabLayout <RelativeLayout
android:id="@+id/mTabLayout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_weight="1">
<com.hupu.tv.player.app.widget.CircleImageView
android:id="@+id/iv_avatar"
android:layout_width="36dp"
android:layout_height="36dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:layout_weight="1" android:layout_toRightOf="@id/iv_avatar"
android:background="@color/transparent" android:orientation="vertical">
app:tl_indicator_color="@color/main_select"
app:tl_indicator_width="@dimen/dp_25" <LinearLayout
app:tl_select_textsize="@dimen/sp_15" android:gravity="center_vertical"
app:tl_tab_width="@dimen/dp_65" android:layout_width="wrap_content"
app:tl_textBold="SELECT" android:layout_height="wrap_content"
app:tl_textSelectColor="@color/main_select" android:orientation="horizontal">
app:tl_textUnselectColor="@color/black"
app:tl_textsize="@dimen/sp_15" <TextView
app:tl_underline_color="@color/transparent" /> android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="@dimen/sp_13"
tools:text="蟑螂恶霸" />
<ImageView
android:layout_marginStart="@dimen/dp_7"
tools:src="@mipmap/icon_anchor_level_1"
android:id="@+id/iv_anchor_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/tv_follow_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:textColor="@color/color_9D9D9D"
android:textSize="@dimen/sp_12"
tools:text="粉丝:6.3万" />
</LinearLayout>
</RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_follow" android:id="@+id/ll_follow"
android:layout_width="81dp" android:layout_width="@dimen/dp_60"
android:layout_height="match_parent" android:layout_height="@dimen/dp_26"
android:background="@drawable/shape_main_color" android:layout_gravity="center_vertical"
android:background="@drawable/shape_follow_color"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -90,25 +154,42 @@ ...@@ -90,25 +154,42 @@
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_12"
tools:text="关注" /> tools:text="关注" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<androidx.viewpager.widget.ViewPager
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/mTabLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_35"
android:layout_below="@id/ll_anchor"
android:layout_gravity="center"
android:background="@color/transparent"
app:tl_indicator_color="@color/main_select"
app:tl_indicator_width="@dimen/dp_25"
app:tl_select_textsize="@dimen/sp_13"
app:tl_tab_width="120dp"
app:tl_textBold="SELECT"
app:tl_textSelectColor="@color/black"
app:tl_textUnselectColor="@color/color_999999"
app:tl_textsize="@dimen/sp_13"
app:tl_underline_color="@color/transparent" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_live" android:id="@+id/vp_live"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/ll_top" /> android:layout_below="@id/mTabLayout" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/ll_top" android:layout_below="@id/mTabLayout"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="55dp" android:layout_marginTop="330dp"
android:layout_marginEnd="@dimen/dp_12" android:layout_marginEnd="@dimen/dp_12"
android:orientation="vertical"> android:orientation="vertical">
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/srl_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_live_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingHorizontal="@dimen/dp_10"
android:textColor="#7FB2D4"
android:textSize="@dimen/sp_13"
tools:text="欢迎来到大表哥说球直播间" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9"
android:paddingHorizontal="@dimen/dp_10"
android:text="平台提醒:直播间内严禁出现违规、赌球、低俗色情、抽 烟酗酒等行为。若有违规,请及时向平台举报。如主播在 直播过程中诱导用户打赏、私下交易,请谨慎判断,严防 电信诈骗。让我们共同营造美好和谐的直播环境!"
android:textColor="#7FB2D4"
android:textSize="@dimen/sp_13" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
\ No newline at end of file
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
style="@style/ease_row_receive_iv_userhead_style" /> style="@style/ease_row_receive_iv_userhead_style" />
<LinearLayout <LinearLayout
android:gravity="center_vertical"
android:id="@+id/bubble" android:id="@+id/bubble"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -34,7 +35,14 @@ ...@@ -34,7 +35,14 @@
android:layout_toRightOf="@id/iv_userhead" android:layout_toRightOf="@id/iv_userhead"
android:layout_marginTop="2dp"> android:layout_marginTop="2dp">
<ImageView
android:src="@mipmap/icon_user_level_1"
android:id="@+id/iv_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView <TextView
android:visibility="gone"
android:layout_marginLeft="@dimen/chat_nick_margin_left" android:layout_marginLeft="@dimen/chat_nick_margin_left"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
android:textColor="@color/white" android:textColor="@color/white"
...@@ -48,12 +56,14 @@ ...@@ -48,12 +56,14 @@
<TextView <TextView
android:id="@+id/tv_userid" android:id="@+id/tv_userid"
android:layout_toEndOf="@id/tv_level" android:layout_toEndOf="@id/tv_level"
style="@style/chat_text_name_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_13"
android:textColor="#6FA9D0"
tools:text="无敌猪猪:" tools:text="无敌猪猪:"
tools:visibility="visible"
android:visibility="gone" /> android:visibility="gone" />
<TextView <TextView
...@@ -64,10 +74,9 @@ ...@@ -64,10 +74,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:gravity="center|left"
android:lineSpacingExtra="2dp" android:lineSpacingExtra="2dp"
android:textColor="#ff000000" android:textColor="#ff000000"
android:textSize="15sp" android:textSize="@dimen/sp_13"
tools:text="文案文案"/> tools:text="文案文案"/>
</LinearLayout> </LinearLayout>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<ImageView <ImageView
android:id="@+id/iv_cover" android:id="@+id/iv_cover"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
<master.flame.danmaku.ui.widget.DanmakuView <master.flame.danmaku.ui.widget.DanmakuView
android:id="@+id/danmaku_view" android:id="@+id/danmaku_view"
...@@ -27,63 +27,103 @@ ...@@ -27,63 +27,103 @@
android:id="@+id/thumb" android:id="@+id/thumb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="#000000" android:background="#000000"
android:scaleType="fitCenter" /> android:scaleType="fitCenter" />
<LinearLayout <LinearLayout
android:paddingStart="@dimen/dp_12"
android:id="@+id/layout_bottom" android:id="@+id/layout_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="#99000000"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/video_bottom_bg"
android:visibility="invisible"> android:visibility="invisible">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/layout_bottom"
android:layout_marginBottom="@dimen/dp_2"
android:ellipsize="end"
android:gravity="center_horizontal"
android:maxEms="17"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_13"
tools:text="皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里" />
<LinearLayout <LinearLayout
android:paddingBottom="@dimen/dp_8" android:paddingBottom="@dimen/dp_5"
android:paddingTop="@dimen/dp_8"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
<TextView
android:id="@+id/tv_room_num"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_20"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
tools:text="房间号:10023432" />
<TextView
android:id="@+id/tv_fire_num"
android:layout_width="0dp"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_20"
android:layout_weight="1"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
tools:text="热度:2.1万" />
<ImageView
android:id="@+id/iv_reload" android:id="@+id/iv_reload"
android:scaleType="centerInside" android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_20"
android:scaleType="centerInside"
android:src="@mipmap/icon_live_reload" android:src="@mipmap/icon_live_reload"
android:layout_width="@dimen/dp_20" android:visibility="gone" />
android:layout_height="@dimen/dp_20"/>
<TextView <TextView
android:id="@+id/tv_fire" android:id="@+id/tv_fire"
android:layout_width="0dp"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_20"
android:gravity="center_vertical"
android:drawablePadding="@dimen/dp_10"
android:layout_weight="1" android:layout_weight="1"
tools:text="22330"
android:textSize="@dimen/sp_12"
android:drawableStart="@mipmap/icon_live_fire" android:drawableStart="@mipmap/icon_live_fire"
android:drawablePadding="@dimen/dp_10"
android:gravity="center_vertical"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_width="0dp" android:textSize="@dimen/sp_12"
android:layout_height="@dimen/dp_20"/>
<TextView
android:visibility="gone" android:visibility="gone"
tools:text="22330" />
<TextView
android:id="@+id/current" android:id="@+id/current"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:text="00:00" android:text="00:00"
android:textColor="#ffffff" /> android:textColor="#ffffff"
android:visibility="gone" />
<SeekBar <SeekBar
android:visibility="gone"
android:id="@+id/progress" android:id="@+id/progress"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -93,44 +133,45 @@ ...@@ -93,44 +133,45 @@
android:max="100" android:max="100"
android:maxHeight="4dp" android:maxHeight="4dp"
android:minHeight="4dp" android:minHeight="4dp"
android:paddingBottom="8dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingBottom="8dp"
android:progressDrawable="@drawable/video_seek_progress" android:progressDrawable="@drawable/video_seek_progress"
android:thumb="@drawable/video_seek_thumb" /> android:thumb="@drawable/video_seek_thumb"
android:visibility="gone" />
<TextView <TextView
android:visibility="gone"
android:id="@+id/total" android:id="@+id/total"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:text="00:00" android:text="00:00"
android:textColor="#ffffff" /> android:textColor="#ffffff"
android:visibility="gone" />
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/toogle_danmaku" android:id="@+id/toogle_danmaku"
android:scaleType="centerInside"
android:layout_width="@dimen/dp_20" android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:src="@mipmap/icon_live_danmu_on" android:scaleType="centerInside"
/> android:src="@mipmap/icon_live_danmu_on" />
<ImageView <ImageView
android:id="@+id/iv_start" android:id="@+id/iv_start"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30" android:layout_marginStart="@dimen/dp_30"
android:src="@mipmap/icon_live_play"
android:scaleType="centerInside" android:scaleType="centerInside"
android:layout_width="@dimen/dp_20" android:src="@mipmap/icon_live_play" />
android:layout_height="@dimen/dp_20"/>
<ImageView <ImageView
android:layout_marginEnd="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"
android:id="@+id/fullscreen" android:id="@+id/fullscreen"
android:scaleType="centerInside"
android:layout_width="@dimen/dp_20" android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_20"
android:scaleType="centerInside"
android:src="@mipmap/icon_custom_enlarge" /> android:src="@mipmap/icon_custom_enlarge" />
</LinearLayout> </LinearLayout>
...@@ -139,7 +180,6 @@ ...@@ -139,7 +180,6 @@
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/back_tiny" android:id="@+id/back_tiny"
android:layout_width="24dp" android:layout_width="24dp"
...@@ -163,42 +203,30 @@ ...@@ -163,42 +203,30 @@
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/video_back" /> android:src="@drawable/video_back" />
<TextView
android:gravity="center_horizontal"
android:maxWidth="@dimen/dp_200"
android:singleLine="true"
android:ellipsize="end"
tools:text="皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里皇家马德里VS皇家马德里"
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_25"
android:paddingLeft="10dp"
android:textColor="@android:color/white"
android:textSize="@dimen/sp_16" />
<TextView <TextView
android:visibility="gone"
android:id="@+id/tv_copy_link" android:id="@+id/tv_copy_link"
android:gravity="center" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_25"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:background="@drawable/shape_play_title"
android:gravity="center"
android:paddingStart="@dimen/dp_8" android:paddingStart="@dimen/dp_8"
android:paddingEnd="@dimen/dp_8" android:paddingEnd="@dimen/dp_8"
android:background="@drawable/shape_play_title"
android:text="复制" android:text="复制"
android:textSize="@dimen/sp_14"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_width="wrap_content" android:textSize="@dimen/sp_14"
android:layout_height="@dimen/dp_25"/> android:visibility="gone" />
<ImageView <ImageView
android:visibility="invisible"
android:paddingEnd="@dimen/dp_10"
android:src="@mipmap/icon_live_more"
android:id="@+id/iv_live_more" android:id="@+id/iv_live_more"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:scaleType="centerInside"/> android:paddingEnd="@dimen/dp_10"
android:scaleType="centerInside"
android:src="@mipmap/icon_live_more"
android:visibility="invisible" />
</LinearLayout> </LinearLayout>
...@@ -217,20 +245,20 @@ ...@@ -217,20 +245,20 @@
android:layout_gravity="center" /> android:layout_gravity="center" />
<ImageView <ImageView
android:src="@mipmap/icon_buffer"
android:layout_width="18dp" android:layout_width="18dp"
android:layout_height="18dp" android:layout_height="18dp"
android:layout_centerInParent="true" /> android:layout_centerInParent="true"
android:src="@mipmap/icon_buffer" />
</RelativeLayout> </RelativeLayout>
<moe.codeest.enviews.ENPlayView <moe.codeest.enviews.ENPlayView
android:visibility="gone"
android:id="@+id/start" android:id="@+id/start"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_gravity="center_vertical" /> android:layout_gravity="center_vertical"
android:visibility="gone" />
<ImageView <ImageView
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
tools:visibility="gone"
android:id="@+id/ll_not_login" android:id="@+id/ll_not_login"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
tools:visibility="visible"
android:id="@+id/ll_data" android:id="@+id/ll_data"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -53,10 +55,11 @@ ...@@ -53,10 +55,11 @@
android:visibility="gone"> android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
tools:listitem="@layout/item_match_content"
android:background="@drawable/shape_match_content"
android:id="@+id/mRecyclerView" android:id="@+id/mRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:layout_marginTop="@dimen/dp_20" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:id="@+id/ll_notice" android:id="@+id/ll_notice"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/background_f5" android:background="@color/color_4_FC5057"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:visibility="gone"
android:id="@+id/iv_notice" android:id="@+id/iv_notice"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -23,28 +23,19 @@ ...@@ -23,28 +23,19 @@
android:layout_marginTop="@dimen/dp_7" android:layout_marginTop="@dimen/dp_7"
android:src="@mipmap/icon_live_notice" /> android:src="@mipmap/icon_live_notice" />
<include layout="@layout/layout_marquee" />
<TextView <TextView
android:layout_weight="1" android:id="@+id/tv_report"
android:id="@+id/tv_notice" android:layout_width="48dp"
android:layout_width="0dp" android:layout_height="@dimen/dp_20"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@id/iv_notice"
android:padding="@dimen/dp_7"
android:textColor="@color/black"
android:textSize="@dimen/sp_14"
tools:text="@string/string_movie_detail" />
<TextView
android:visibility="gone"
android:background="@drawable/shape_first_confrim"
android:layout_marginEnd="@dimen/dp_5" android:layout_marginEnd="@dimen/dp_5"
android:text="举报" android:background="@drawable/shape_first_confrim"
android:gravity="center" android:gravity="center"
android:text="举报"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_13"
android:id="@+id/tv_report" android:visibility="gone" />
android:layout_width="48dp"
android:layout_height="@dimen/dp_20"/>
</LinearLayout> </LinearLayout>
...@@ -53,66 +44,67 @@ ...@@ -53,66 +44,67 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/ll_notice" /> android:layout_below="@id/ll_notice" />
<LinearLayout <LinearLayout
android:background="@color/white"
android:layout_alignParentBottom="true"
android:id="@+id/ll_need_login" android:id="@+id/ll_need_login"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:gravity="bottom"
android:minHeight="52dp" android:minHeight="52dp"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="bottom"
android:paddingTop="4dp" android:paddingTop="4dp"
android:paddingBottom="4dp"> android:paddingBottom="4dp">
<ImageView <ImageView
style="@style/ease_chat_input_button_size" style="@style/ease_chat_input_button_size"
android:layout_marginBottom="5dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginBottom="5dp"
android:src="@mipmap/icon_block_show" android:src="@mipmap/icon_block_show"
android:visibility="visible" /> android:visibility="gone" />
<TextView <TextView
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:textSize="@dimen/sp_14"
android:text="期待你的神评论"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/ease_send_message_et_bg" android:layout_gravity="center_vertical"
android:focusableInTouchMode="true"
android:layout_marginLeft="6dp" android:layout_marginLeft="6dp"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:layout_weight="1"
android:drawablePadding="@dimen/dp_10"
android:background="@drawable/ease_send_message_et_bg"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:maxLines="4" android:maxLines="4"
android:minHeight="32dp" android:minHeight="32dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="3dp" android:paddingTop="3dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingBottom="3dp" android:paddingBottom="3dp"
/> android:text="说点有爱的评论~"
android:textSize="@dimen/sp_14"
app:drawableStartCompat="@mipmap/icon_comment_left" />
<ImageView <ImageView
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical"
android:layout_width="@dimen/ease_chat_primary_menu_icon_size" android:layout_width="@dimen/ease_chat_primary_menu_icon_size"
android:layout_height="@dimen/ease_chat_primary_menu_icon_size" android:layout_height="@dimen/ease_chat_primary_menu_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="6dp"
android:padding="5dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@mipmap/icon_emoji" android:src="@mipmap/icon_emoji"
android:padding="5dp"
android:visibility="visible" /> android:visibility="visible" />
<ImageView <ImageView
android:layout_gravity="center_vertical"
android:layout_width="@dimen/ease_chat_primary_menu_more_icon_size" android:layout_width="@dimen/ease_chat_primary_menu_more_icon_size"
android:layout_height="@dimen/ease_chat_primary_menu_more_icon_size" android:layout_height="@dimen/ease_chat_primary_menu_more_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/ease_chat_primary_margin_right" android:layout_marginRight="@dimen/ease_chat_primary_margin_right"
android:background="@drawable/type_select_gift_btn" android:background="@drawable/type_select_gift_btn"
android:button="@null" android:button="@null"
android:visibility="visible" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -5,40 +5,101 @@ ...@@ -5,40 +5,101 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:background="@color/red"> tools:background="@color/color_F8F8F7">
<include <include
layout="@layout/layout_empty_no_data" layout="@layout/layout_empty_no_data"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_marginTop="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/icon_app_logo" />
<EditText
android:imeOptions="actionSearch"
android:maxLines="1"
android:id="@+id/rl_search"
android:layout_width="0dp"
android:layout_height="@dimen/dp_29"
android:layout_marginStart="@dimen/dp_7"
android:layout_weight="1"
android:background="@drawable/shape_main_search_live"
android:drawableStart="@mipmap/icon_main_search_icon"
android:drawablePadding="@dimen/dp_10"
android:hint="房间号/房间名/主播名"
android:textColorHint="@color/color_999999"
android:textColor="@color/black"
android:paddingStart="@dimen/dp_11"
android:paddingEnd="@dimen/dp_11"
android:textSize="@dimen/sp_12" />
<ImageView
android:id="@+id/iv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_13"
android:layout_marginEnd="@dimen/dp_12"
android:src="@mipmap/icon_sign" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/dp_10"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.flyco.tablayout.SlidingTabLayout <com.flyco.tablayout.SlidingTabLayout
android:paddingTop="@dimen/dp_5"
android:layout_weight="1"
android:id="@+id/tabLayout_main" android:id="@+id/tabLayout_main"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/white" android:background="@color/transparent"
android:minHeight="@dimen/dp_50" android:minHeight="37dp"
android:paddingTop="@dimen/dp_15"
android:paddingEnd="@dimen/dp_10" android:paddingEnd="@dimen/dp_10"
app:tl_indicator_width="@dimen/dp_28" app:tl_indicator_color="@color/main_select"
app:tl_indicator_height="@dimen/dp_3"
app:tl_indicator_margin_bottom="@dimen/dp_2"
app:tl_indicator_style="NORMAL"
app:tl_indicator_width="@dimen/dp_14"
app:tl_select_textsize="@dimen/sp_20" app:tl_select_textsize="@dimen/sp_20"
app:tl_textBold="SELECT" app:tl_textBold="SELECT"
app:tl_textSelectColor="@color/black" app:tl_textSelectColor="@color/black"
app:tl_textUnselectColor="@color/black" app:tl_textUnselectColor="@color/black"
app:tl_textsize="@dimen/sp_17" app:tl_textsize="@dimen/sp_15"
app:tl_indicator_color="@color/main_select"
app:tl_indicator_height="@dimen/dp_3"
app:tl_indicator_style="NORMAL"
app:tl_indicator_margin_bottom="@dimen/dp_2"
app:tl_underline_color="@color/transparent" /> app:tl_underline_color="@color/transparent" />
<ImageView
android:id="@+id/iv_category"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_12"
android:src="@mipmap/icon_main_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<androidx.viewpager.widget.ViewPager <androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_main" android:id="@+id/vp_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
app:layout_scrollFlags="scroll"> app:layout_scrollFlags="scroll">
<LinearLayout <LinearLayout
android:paddingTop="@dimen/dp_15" android:paddingTop="@dimen/dp_12"
android:paddingStart="@dimen/dp_15" android:paddingStart="@dimen/dp_12"
android:paddingEnd="@dimen/dp_15" android:paddingEnd="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12" android:paddingBottom="@dimen/dp_10"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
<com.zhpan.bannerview.BannerViewPager <com.zhpan.bannerview.BannerViewPager
android:id="@+id/banner_view" android:id="@+id/banner_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="165dp" /> android:layout_height="125dp" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_marginTop="@dimen/dp_20" android:orientation="horizontal"
tools:listitem="@layout/item_match_topl_live_new"
android:layout_marginTop="@dimen/dp_17"
android:id="@+id/mRecyclerView_top" android:id="@+id/mRecyclerView_top"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
...@@ -82,7 +84,7 @@ ...@@ -82,7 +84,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_marginTop="@dimen/dp_12" android:layout_marginTop="19dp"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
...@@ -96,11 +98,11 @@ ...@@ -96,11 +98,11 @@
<TextView <TextView
android:textStyle="bold" android:textStyle="bold"
android:textSize="@dimen/sp_16" android:textSize="@dimen/sp_15"
android:textColor="@color/black" android:textColor="@color/black"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="正在热播" /> android:text="热门直播" />
</LinearLayout> </LinearLayout>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
app:srlEnableScrollContentWhenLoaded="true"> app:srlEnableScrollContentWhenLoaded="true">
<!-- elevation 高版本自带一个阴影,不需要去掉即可 --> <!-- elevation 高版本自带一个阴影,不需要去掉即可 -->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
tools:itemCount="2"
tools:listitem="@layout/item_match_content"
android:id="@+id/mRecyclerView" android:id="@+id/mRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
...@@ -3,18 +3,61 @@ ...@@ -3,18 +3,61 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical">
>
<include layout="@layout/layout_empty_no_data" <include
android:visibility="gone"/> layout="@layout/layout_empty_no_data"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:background="@color/main_color_new"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/dp_9"
android:paddingTop="@dimen/dp_10"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/icon_app_logo" />
<EditText
android:id="@+id/rl_search"
android:layout_width="0dp"
android:layout_height="@dimen/dp_29"
android:layout_marginStart="@dimen/dp_7"
android:layout_weight="1"
android:background="@drawable/shape_match_search_live"
android:drawableStart="@mipmap/icon_main_search_icon"
android:drawablePadding="@dimen/dp_10"
android:hint="房间号/房间名/主播名"
android:imeOptions="actionSearch"
android:maxLines="1"
android:paddingStart="@dimen/dp_11"
android:paddingEnd="@dimen/dp_11"
android:textColor="@color/black"
android:textColorHint="@color/color_999999"
android:textSize="@dimen/sp_12" />
<ImageView
android:id="@+id/iv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_13"
android:layout_marginEnd="@dimen/dp_12"
android:src="@mipmap/icon_sign" />
</LinearLayout>
<com.flyco.tablayout.SlidingTabLayout <com.flyco.tablayout.SlidingTabLayout
android:id="@+id/tabLayout_main" android:id="@+id/tabLayout_main"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -22,21 +65,23 @@ ...@@ -22,21 +65,23 @@
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/white" android:background="@color/white"
android:minHeight="@dimen/dp_50" android:minHeight="@dimen/dp_50"
android:paddingStart="@dimen/dp_12"
android:paddingTop="@dimen/dp_15" android:paddingTop="@dimen/dp_15"
android:paddingEnd="@dimen/dp_10" android:paddingEnd="@dimen/dp_10"
app:tl_indicator_width="@dimen/dp_28" app:tl_indicator_color="@color/main_select"
app:tl_indicator_height="@dimen/dp_3"
app:tl_indicator_margin_bottom="@dimen/dp_2"
app:tl_indicator_style="NORMAL"
app:tl_indicator_width="@dimen/dp_14"
app:tl_select_textsize="@dimen/sp_20" app:tl_select_textsize="@dimen/sp_20"
app:tl_tab_width="55dp"
app:tl_textBold="SELECT" app:tl_textBold="SELECT"
app:tl_textSelectColor="@color/black" app:tl_textSelectColor="@color/black"
app:tl_textUnselectColor="@color/black" app:tl_textUnselectColor="@color/black"
app:tl_textsize="@dimen/sp_17" app:tl_textsize="@dimen/sp_15"
app:tl_indicator_color="@color/main_select"
app:tl_indicator_height="@dimen/dp_3"
app:tl_indicator_style="NORMAL"
app:tl_indicator_margin_bottom="@dimen/dp_2"
app:tl_underline_color="@color/transparent" /> app:tl_underline_color="@color/transparent" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_main" android:id="@+id/vp_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
tools:background="@color/cardview_dark_background"> tools:background="@color/cardview_dark_background">
...@@ -9,34 +9,9 @@ ...@@ -9,34 +9,9 @@
<ImageView <ImageView
android:id="@+id/iv_actor" android:id="@+id/iv_actor"
android:layout_width="@dimen/dp_42" android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_42" android:layout_height="@dimen/dp_15"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_10"
android:src="@mipmap/icon_default_avatar" /> android:src="@mipmap/icon_default_avatar" />
<ImageView
android:layout_marginTop="-10dp"
android:layout_centerInParent="true"
android:id="@+id/iv_live"
android:layout_below="@id/iv_actor"
android:src="@mipmap/icon_live_living_guest"
android:layout_width="27dp"
android:layout_height="@dimen/dp_12"/>
<TextView
android:layout_centerHorizontal="true"
android:layout_below="@id/iv_actor"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_6"
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="true"
android:maxWidth="@dimen/dp_42"
android:textColor="@color/movie_text"
android:textSize="@dimen/sp_10"
tools:text="乔曼乔曼乔曼乔曼乔曼" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="221dp"
android:layout_height="125dp"
android:orientation="vertical"
tools:background="@color/red">
<androidx.cardview.widget.CardView
android:layout_width="221dp"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/dp_6"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_cover"
android:layout_width="match_parent"
android:layout_height="125dp"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_alignBottom="@id/iv_cover">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/bg_video_shadow" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginBottom="4dp"
android:textColor="@color/white"
android:textSize="@dimen/sp_11"
tools:text="虎子聊球" />
<TextView
android:id="@+id/tv_hot_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="4dp"
android:drawablePadding="@dimen/dp_8"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
app:drawableStartCompat="@mipmap/icon_live_fire"
tools:text="69239" />
</RelativeLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
tools:background="@color/white"> android:background="@color/color_F8F8F7">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:paddingStart="@dimen/dp_15"
android:background="#F6F7F8"
android:gravity="center"
android:orientation="horizontal"
android:id="@+id/ll_more"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp"> android:layout_height="match_parent"
android:orientation="vertical">
<TextView <TextView
android:paddingStart="@dimen/dp_12"
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:textStyle="bold" android:layout_width="match_parent"
android:textSize="@dimen/sp_20" android:layout_height="@dimen/dp_32"
android:textColor="@color/normal_text_3"
android:layout_weight="1"
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
tools:text="今天" android:textColor="@color/normal_text_3"
android:layout_width="0dp" android:textSize="@dimen/sp_12"
android:layout_height="48dp"/> android:textStyle="bold"
</LinearLayout> tools:text="今天 02月 07日 星期一 " />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
tools:listitem="@layout/item_match_include_content_new"
android:layout_marginHorizontal="@dimen/dp_12"
android:background="@drawable/shape_match_content"
android:id="@+id/recycler_content" android:id="@+id/recycler_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:layout_marginTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5" />
<View
android:layout_marginTop="@dimen/dp_5"
android:background="@color/bg_normal"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_4"/>
</LinearLayout> </LinearLayout>
......
...@@ -3,208 +3,236 @@ ...@@ -3,208 +3,236 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="83dp"
android:orientation="vertical" android:gravity="center_vertical"
android:paddingStart="@dimen/dp_15" android:orientation="horizontal"
android:paddingTop="@dimen/dp_15" android:paddingStart="19dp"
android:paddingEnd="@dimen/dp_15" android:paddingEnd="@dimen/dp_10"
tools:background="@color/white"> tools:background="@color/white">
<RelativeLayout
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="vertical"
> >
<LinearLayout <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_home"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_gravity="center"
tools:src="@mipmap/match_subscribe" />
<TextView
android:id="@+id/tv_home"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginEnd="@dimen/dp_5"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="start"
android:maxLines="1"
android:textColor="@color/text_normal"
android:textSize="@dimen/sp_13"
tools:text="Academic普罗夫迪夫" />
<TextView <TextView
android:id="@+id/tv_time"
android:id="@+id/tv_score_home"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_15"
android:textStyle="bold" />
tools:text="16:15" />
<TextView <ImageView
android:id="@+id/tv_name" android:id="@+id/iv_win_home"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_10"
android:textColor="@color/black" android:src="@mipmap/icon_socre_win"
android:textSize="@dimen/sp_12" android:visibility="invisible" />
android:maxLines="1"
android:ellipsize="end"
tools:text="球会友谊" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_score" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.6" android:layout_marginTop="@dimen/dp_11"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView
android:id="@+id/iv_away"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_gravity="center"
tools:src="@mipmap/match_subscribe" />
<TextView <TextView
android:id="@+id/tv_score_home" android:id="@+id/tv_away"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_14"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:ellipsize="end"
android:text="0" android:maxEms="7"
android:textColor="@color/black" android:maxLines="1"
android:textSize="@dimen/sp_17" android:textColor="@color/text_normal"
android:textStyle="bold" /> android:textSize="@dimen/sp_13"
tools:text="佩斯克" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:text=":"
android:textSize="@dimen/sp_17" />
<TextView <TextView
android:id="@+id/tv_score_away" android:id="@+id/tv_score_away"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:text="0" android:text="0"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_17" android:textSize="@dimen/sp_15"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout>
<LinearLayout <ImageView
android:layout_width="0dp" android:id="@+id/iv_win_away"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginStart="@dimen/dp_10"
android:gravity="end"> android:src="@mipmap/icon_socre_win"
android:visibility="invisible" />
<ImageView
android:id="@+id/iv_status"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_20"
tools:src="@mipmap/match_status_live" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
>
<ImageView
android:id="@+id/iv_subscribe"
android:visibility="gone"
android:layout_marginEnd="@dimen/dp_14"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:src="@drawable/selected_subcribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout <View
android:id="@+id/ll_left" android:layout_width="@dimen/dp_1"
app:layout_constraintTop_toTopOf="parent" android:layout_height="53dp"
app:layout_constraintStart_toStartOf="parent" android:background="#F8F8F6" />
app:layout_constraintEnd_toStartOf="@id/tv_center"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="end">
<TextView <RelativeLayout
android:id="@+id/tv_home"
android:maxEms="7" android:layout_width="115dp"
android:maxLines="1" android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="end" android:gravity="end"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_gravity="center" android:layout_gravity="center"
android:textColor="@color/text_normal" android:layout_marginTop="@dimen/dp_7"
android:textSize="@dimen/sp_13" android:orientation="horizontal"
android:layout_marginEnd="@dimen/dp_5" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:text="Academic普罗夫迪夫" /> tools:itemCount="2"
tools:listitem="@layout/item_guides_image" />
<ImageView <RelativeLayout
android:id="@+id/iv_home" android:id="@+id/ll_info"
android:layout_width="@dimen/dp_20" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_20" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:orientation="vertical">
tools:src="@mipmap/match_subscribe" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_center" android:id="@+id/tv_status"
app:layout_constraintStart_toEndOf="@id/ll_left"
app:layout_constraintEnd_toStartOf="@id/ll_right"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_8" android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_8" android:textColor="@color/color_6D6D6D"
android:layout_weight="0.3" android:textSize="@dimen/sp_12"
android:gravity="center" tools:text="已结束" />
android:text="VS"
android:textColor="@color/match_vs"
android:textSize="@dimen/sp_17"
android:textStyle="bold" />
<LinearLayout <LinearLayout
app:layout_constraintStart_toEndOf="@id/tv_center" android:id="@+id/ll_time"
app:layout_constraintEnd_toEndOf="parent" android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/ll_right"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"> android:layout_below="@id/tv_status"
android:layout_alignParentEnd="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/iv_away" android:layout_width="wrap_content"
android:layout_width="@dimen/dp_20" android:layout_height="wrap_content"
android:layout_height="@dimen/dp_20" android:src="@mipmap/icon_match_play" />
android:layout_gravity="center"
tools:src="@mipmap/match_subscribe" />
<TextView <TextView
android:layout_marginStart="@dimen/dp_5" android:id="@+id/tv_status_play"
android:id="@+id/tv_away"
android:maxEms="7"
android:ellipsize="end"
android:maxLines="1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginStart="@dimen/dp_4"
android:textColor="@color/text_normal" android:text="视频直播"
android:textSize="@dimen/sp_13" android:textColor="@color/color_6D6D6D"
tools:text="佩斯克" /> android:textSize="@dimen/sp_12" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_3"
android:textColor="@color/black"
android:textSize="@dimen/sp_12"
tools:text="16:15" />
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout> </RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_content" <TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_below="@id/ll_info"
android:layout_marginTop="@dimen/dp_10" android:layout_alignParentEnd="true"
android:paddingBottom="@dimen/dp_5" /> android:layout_marginStart="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_5"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_9E9E9E"
android:textSize="@dimen/sp_10"
tools:text="球会友谊" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -6,76 +6,116 @@ ...@@ -6,76 +6,116 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
tools:background="@color/red"> tools:background="@color/red">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/dp_6"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView <ImageView
android:scaleType="centerCrop"
android:id="@+id/iv_cover" android:id="@+id/iv_cover"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="90dp" /> android:layout_height="90dp"
android:scaleType="centerCrop" />
<RelativeLayout <RelativeLayout
android:layout_alignBottom="@id/iv_cover"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="25dp"> android:layout_height="25dp"
android:layout_alignBottom="@id/iv_cover">
<ImageView <ImageView
android:scaleType="fitXY"
android:src="@mipmap/bg_video_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/bg_video_shadow" />
<TextView <TextView
android:layout_marginStart="@dimen/dp_5"
android:layout_alignParentBottom="true"
android:layout_marginBottom="2dp"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
android:layout_alignParentStart="true"
android:id="@+id/tv_name" android:id="@+id/tv_name"
tools:text="虎子聊球"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
<TextView android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginBottom="2dp" android:layout_marginStart="@dimen/dp_10"
android:layout_centerVertical="true" android:layout_marginBottom="4dp"
android:layout_marginEnd="@dimen/dp_5"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_10" android:textSize="@dimen/sp_11"
android:layout_alignParentEnd="true" tools:text="虎子聊球" />
android:drawablePadding="@dimen/dp_5"
<TextView
android:id="@+id/tv_hot_num" android:id="@+id/tv_hot_num"
tools:text="69239"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:drawableStartCompat="@mipmap/icon_live_fire" /> android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="4dp"
android:drawablePadding="@dimen/dp_8"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
app:drawableStartCompat="@mipmap/icon_live_fire"
tools:text="69239" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
android:id="@+id/iv_live"
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:id="@+id/iv_live"
android:src="@mipmap/icon_live_living_gif" android:src="@mipmap/icon_live_living_gif"
android:layout_width="@dimen/dp_35" android:visibility="gone" />
android:layout_height="@dimen/dp_12"/>
<ImageView <ImageView
android:id="@+id/iv_recommend"
android:layout_width="38dp"
android:layout_height="@dimen/dp_15"
android:layout_marginStart="@dimen/dp_3" android:layout_marginStart="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:layout_toEndOf="@id/iv_live" android:layout_toEndOf="@id/iv_live"
android:id="@+id/iv_recommend"
android:src="@mipmap/icon_live_recommend" android:src="@mipmap/icon_live_recommend"
android:layout_width="38dp" android:visibility="gone" />
android:layout_height="@dimen/dp_15"/>
<TextView <TextView
android:layout_below="@id/iv_cover"
android:id="@+id/tv_title" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/iv_cover"
android:layout_marginHorizontal="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="1"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_13"
tools:text="月上重火·透芝夫妇" /> tools:text="月上重火·透芝夫妇" />
<TextView
android:id="@+id/tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_title"
android:layout_marginHorizontal="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginBottom="@dimen/sp_11"
android:background="@drawable/shape_match_item"
android:paddingHorizontal="@dimen/dp_7"
android:paddingVertical="@dimen/dp_1"
android:textColor="#666666"
android:textSize="@dimen/sp_11"
tools:text="篮球" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:background="@drawable/shape_live_bg_main"
android:background="@drawable/shape_live_bg_main"> android:orientation="horizontal">
<RelativeLayout <RelativeLayout
android:layout_width="158dp"
android:layout_height="96dp"
android:orientation="vertical"
android:paddingStart="@dimen/dp_10" android:paddingStart="@dimen/dp_10"
android:layout_width="150dp" android:paddingTop="@dimen/dp_10">
android:layout_height="90dp"
android:orientation="vertical">
<LinearLayout <TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_2"
android:textColor="@color/text_normal3"
android:textSize="@dimen/sp_11"
tools:text="CBA" />
android:id="@+id/ll_subscribe" <TextView
android:id="@+id/tv_live"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/home"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:background="@drawable/shape_bg_live_top" android:drawablePadding="@dimen/dp_3"
android:gravity="center" android:text="直播中"
android:orientation="vertical" android:textColor="@color/black"
android:paddingStart="@dimen/dp_8" android:textSize="@dimen/sp_10"
android:paddingTop="@dimen/dp_6" android:visibility="gone"
android:paddingEnd="@dimen/dp_8" app:drawableStartCompat="@drawable/shape_match_top_circle" />
android:paddingBottom="@dimen/dp_6">
<LinearLayout
android:id="@+id/ll_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_10"
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_day" android:id="@+id/tv_date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/mine_recycler_text" android:textColor="@color/color_999999"
android:textSize="@dimen/sp_9" android:textSize="@dimen/sp_10"
tools:text="天" /> tools:text="天" />
<TextView <TextView
android:id="@+id/tv_time" android:id="@+id/tv_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginStart="@dimen/dp_7"
android:textColor="@color/text_normal3" android:textColor="@color/black"
android:textSize="@dimen/sp_9" android:textSize="@dimen/sp_10"
tools:text="15:00" /> tools:text="17:30" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/home" android:id="@+id/home"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"> android:layout_below="@id/tv_name"
android:layout_marginTop="@dimen/dp_16">
<ImageView <ImageView
android:id="@+id/iv_team_icon" android:id="@+id/iv_team_icon"
android:layout_width="@dimen/dp_20" android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_15"
android:layout_gravity="center" /> android:layout_gravity="center"
tools:src="@mipmap/match_subscribe" />
<TextView <TextView
android:id="@+id/tv_team_name" android:id="@+id/tv_team_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_12"
android:ellipsize="end"
android:maxEms="5"
android:maxLines="1"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_12"
android:textStyle="bold"
tools:text="青岛国信海天" /> tools:text="青岛国信海天" />
<TextView <TextView
...@@ -74,10 +94,10 @@ ...@@ -74,10 +94,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:gravity="end" android:gravity="end"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_12"
android:textStyle="bold" tools:text="-" />
tools:text="44" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -85,23 +105,26 @@ ...@@ -85,23 +105,26 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/home" android:layout_below="@id/home"
android:layout_marginTop="@dimen/dp_10"> android:layout_marginTop="@dimen/dp_12">
<ImageView <ImageView
android:id="@+id/iv_team_icon_away" android:id="@+id/iv_team_icon_away"
android:layout_width="@dimen/dp_20" android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_15"
android:layout_gravity="center" /> android:layout_gravity="center"
tools:src="@mipmap/match_subscribe" />
<TextView <TextView
android:id="@+id/tv_team_name_away" android:id="@+id/tv_team_name_away"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_12"
android:ellipsize="end"
android:maxEms="5"
android:maxLines="1"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_13" android:textSize="@dimen/sp_12"
android:textStyle="bold" tools:text="青岛国信海天青岛国信海天" />
tools:text="青岛国信海天" />
<TextView <TextView
android:id="@+id/tv_away_score" android:id="@+id/tv_away_score"
...@@ -109,101 +132,11 @@ ...@@ -109,101 +132,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:gravity="end" android:gravity="end"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_12"
android:textStyle="bold" android:textStyle="bold"
tools:text="44" /> tools:text="-" />
</LinearLayout>
<RelativeLayout
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/away"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_2"
android:textColor="@color/text_normal3"
android:textSize="@dimen/sp_11"
tools:text="CBA" />
<!-- <TextView-->
<!-- android:id="@+id/tv_subscribe"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:layout_marginEnd="@dimen/dp_10"-->
<!-- tools:background="@drawable/shape_live_already_subsribe"-->
<!-- android:gravity="center"-->
<!-- android:paddingStart="@dimen/dp_12"-->
<!-- android:paddingTop="@dimen/dp_2"-->
<!-- android:paddingEnd="@dimen/dp_12"-->
<!-- android:paddingBottom="@dimen/dp_2"-->
<!-- tools:text="预约"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="@dimen/sp_9" />-->
<ImageView
android:layout_marginEnd="@dimen/dp_10"
android:id="@+id/iv_subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
tools:src="@mipmap/icon_subscribe_normal" />
<LinearLayout
android:visibility="gone"
android:id="@+id/ll_live"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/dp_28"
android:layout_toEndOf="@id/tv_name"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_live"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="直播中"
android:textColor="#DF3B3B"
android:textSize="@dimen/sp_9" />
<ImageView
android:id="@+id/iv_1"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_6"
tools:src="@mipmap/icon_default_avatar" />
<ImageView
android:id="@+id/iv_2"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginStart="-5dp"
tools:src="@mipmap/icon_default_avatar" />
<ImageView
android:id="@+id/iv_3"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_marginStart="-5dp"
tools:src="@mipmap/icon_default_avatar" />
</LinearLayout> </LinearLayout>
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
app:cardCornerRadius="@dimen/dp_4" app:cardCornerRadius="@dimen/dp_4"
app:cardPreventCornerOverlap="true" app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="false">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tv_notice"
android:marqueeRepeatLimit="marquee_forever"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/dp_7"
android:textColor="@color/color_FC5057"
android:textSize="@dimen/sp_12"
tools:text="@string/string_movie_detail"
tools:showIn="@layout/fragment_live_conversation">
<requestFocus />
</TextView >
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/main_background"> >
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:paddingTop="2dip"> android:paddingTop="2dip">
<View <View
...@@ -22,12 +23,13 @@ ...@@ -22,12 +23,13 @@
android:paddingBottom="4dp"> android:paddingBottom="4dp">
<ImageView <ImageView
android:id="@+id/btn_set_mode_voice" android:id="@+id/btn_set_mode_voice"
style="@style/ease_chat_input_button_size" style="@style/ease_chat_input_button_size"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:src="@mipmap/icon_block_show" android:src="@mipmap/icon_block_show"
android:visibility="visible" /> android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/btn_set_mode_keyboard" android:id="@+id/btn_set_mode_keyboard"
...@@ -68,7 +70,7 @@ ...@@ -68,7 +70,7 @@
android:id="@+id/edittext_layout" android:id="@+id/edittext_layout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6dp" android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
android:layout_weight="1" android:layout_weight="1"
...@@ -83,7 +85,7 @@ ...@@ -83,7 +85,7 @@
android:background="@drawable/ease_send_message_et_bg" android:background="@drawable/ease_send_message_et_bg"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:hint="期待你的神评论" android:hint="说点有爱的评论~"
android:imeOptions="actionSend" android:imeOptions="actionSend"
android:maxLines="4" android:maxLines="4"
android:minHeight="32dp" android:minHeight="32dp"
...@@ -142,10 +144,11 @@ ...@@ -142,10 +144,11 @@
android:layout_marginEnd="@dimen/ease_chat_primary_margin_right" android:layout_marginEnd="@dimen/ease_chat_primary_margin_right"
android:layout_marginRight="@dimen/ease_chat_primary_margin_right" android:layout_marginRight="@dimen/ease_chat_primary_margin_right"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
android:background="@drawable/ease_chat_send_btn_selector" android:background="@drawable/send_btn_selector"
android:text="@string/button_send" android:text="@string/button_send"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="13sp"
tools:visibility="visible"
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> </FrameLayout>
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
<color name="blue_match">#1045DB</color> <color name="blue_match">#1045DB</color>
<color name="green_match">#19D151</color> <color name="green_match">#19D151</color>
<color name="web_blue">#7DB7C1</color> <color name="web_blue">#7DB7C1</color>
<color name="view_color">#EEEEEE</color> <color name="view_color">#F8F8F6</color>
<color name="view_color2">#F1F1F1</color> <color name="view_color2">#F1F1F1</color>
<color name="view_color3">#E9E9E9</color> <color name="view_color3">#E9E9E9</color>
<color name="blue_news_tag">#FFE3E2</color> <color name="blue_news_tag">#FFE3E2</color>
...@@ -148,6 +148,14 @@ ...@@ -148,6 +148,14 @@
<color name="label_color_2">#387AD8</color> <color name="label_color_2">#387AD8</color>
<color name="label_color_3">#785ABA</color> <color name="label_color_3">#785ABA</color>
<color name="level_color">#39B1FD</color> <color name="level_color">#39B1FD</color>
<color name="color_9D9D9D">#9D9D9D</color>
<color name="color_999999">#999999</color>
<color name="color_4_FC5057">#0AFC5057</color>
<color name="color_FC5057">#FC5057</color>
<color name="color_F8F8F7">#F8F8F7</color>
<color name="color_6D6D6D">#6D6D6D</color>
<color name="color_9E9E9E">#9E9E9E</color>
<color name="color_FF5655">#FF5655</color>
<!-- <color name="main_background">#091D37 </color>--> <!-- <color name="main_background">#091D37 </color>-->
<color name="main_background">#FFFFFF</color> <color name="main_background">#FFFFFF</color>
......
...@@ -17,10 +17,10 @@ abstract class BaseLazyFragment<P : IBasePresenter?> : BaseFragment<P>() { ...@@ -17,10 +17,10 @@ abstract class BaseLazyFragment<P : IBasePresenter?> : BaseFragment<P>() {
/** /**
* 第一次onResume中的调用onUserVisible避免操作与onFirstUserVisible操作重复 * 第一次onResume中的调用onUserVisible避免操作与onFirstUserVisible操作重复
*/ */
private var isFirstResume = true protected var isFirstResume = true
private var isFirstVisible = true protected var isFirstVisible = true
private var isFirstInvisible = true var isFirstInvisible = true
private var isPrepared = false protected var isPrepared = false
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (isCanLazyLoad) { if (isCanLazyLoad) {
......
package com.softgarden.baselibrary.base
import android.util.Log
/**
* @author by DELL
* @date on 2020/06/11
* @describe Fragment基类 支持 预加载
*/
abstract class BaseVP2LazyFragment<P : IBasePresenter?> : BaseLazyFragment<P>() {
override fun onResume() {
super.onResume()
if (isFirstVisible) {
isFirstVisible = false
initPrepare()
}else{
onUserVisible()
}
}
override fun onPause() {
super.onPause()
if (isCanLazyLoad) {
if (userVisibleHint) {
onUserInvisible()
}
}
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isCanLazyLoad) {
if (isVisibleToUser) {
if (isFirstVisible) {
isFirstVisible = false
initPrepare()
}else{
onUserVisible()
}
} else {
if (isFirstInvisible) {
isFirstInvisible = false
onFirstUserInvisible()
} else {
onUserInvisible()
}
}
}
}
override fun initialize() {
Log.e("fragment_initialize",this.javaClass.simpleName)
initEventAndData()
initPrepare()
}
override fun onDestroyView() {
super.onDestroyView()
isPrepared = false
isFirstVisible = true
isFirstResume = true
isFirstVisible = true
isFirstInvisible = true
}
companion object {
private val TAG = BaseVP2LazyFragment::class.java.simpleName
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment