社区主要UI

This commit is contained in:
hch 2024-03-08 14:34:05 +08:00
parent a02f7b2e22
commit 409e38e304
80 changed files with 4229 additions and 101 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#252525" />
<corners android:radius="26dp" />
</shape>

View File

@ -221,5 +221,7 @@ dependencies {
//samsung插件包
api project(':IAP6Helper')
//
api 'com.wuxiaolong.pullloadmorerecyclerview:library:1.1.2'
}

View File

@ -57,7 +57,6 @@
android:name="com.yunbao.common.activity.SelectImageActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yunbao.common.activity.PreviewImageActivity"
android:screenOrientation="portrait" />
@ -66,6 +65,14 @@
android:name="com.yunbao.common.activity.PreviewVideoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.CommunitySendActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.CommunityDetailsActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -0,0 +1,49 @@
package com.yunbao.common.activity;
import android.content.Intent;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.manager.OpenAdManager;
public class CommunityDetailsActivity extends AbsActivity {
private RecyclerView mRecyclerViewImage;
private LinearLayout imgTextLayout;
private LinearLayout videoLayout;
@Override
protected int getLayoutId() {
return R.layout.activity_community_details;
}
@Override
protected void create() {
super.create();
}
@Override
protected void onPause() {
super.onPause();
OpenAdManager.getInstance().dismiss();
}
@Override
protected void main() {
mRecyclerViewImage = findViewById(R.id.recyclerView);
mRecyclerViewImage.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 15, 15);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRecyclerViewImage.addItemDecoration(decoration);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
}
}

View File

@ -0,0 +1,65 @@
package com.yunbao.common.activity;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
public class CommunitySendActivity extends AbsActivity {
private RecyclerView mRecyclerViewImage;
private LinearLayout imgTextLayout;
private LinearLayout videoLayout;
@Override
protected int getLayoutId() {
return R.layout.activity_community_send;
}
@Override
protected void create() {
super.create();
}
@Override
protected void onPause() {
super.onPause();
OpenAdManager.getInstance().dismiss();
}
@Override
protected void main() {
imgTextLayout = findViewById(R.id.imgTextLayout);
videoLayout = findViewById(R.id.videoLayout);
imgTextLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
videoLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mRecyclerViewImage = findViewById(R.id.recyclerView_image);
mRecyclerViewImage.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 15, 15);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRecyclerViewImage.addItemDecoration(decoration);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
}
}

View File

@ -0,0 +1,30 @@
package com.yunbao.common.activity;
import android.content.Intent;
import android.view.View;
import com.yunbao.common.R;
public class UserHomeActivity extends AbsActivity {
View bodyLayout;
@Override
protected int getLayoutId() {
return R.layout.activity_user_home;
}
@Override
protected void create() {
super.create();
}
@Override
protected void main() {
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
}
}

View File

@ -0,0 +1,492 @@
package com.yunbao.common.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.yunbao.common.R;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ClassicsHeaderNew;
import java.util.List;
/**
* Created by cxf on 2018/6/7.
*/
public class CommonRefreshWaterfallView extends FrameLayout implements View.OnClickListener {
private Context mContext;
private DataHelper mDataHelper;
private int mLayoutRes;
private View mContentView;
private SmartRefreshLayout mSmartRefreshLayout;
private ClassicsHeaderNew mHeader;
private ClassicsFooter mFooter;
public RecyclerView mRecyclerView;
private FrameLayout mEmptyLayout;//没有数据的View
private View mLoadFailureView;//加载失败View
private boolean mRefreshEnable;//下拉刷新是否可用
private boolean mLoadMoreEnable;//上拉加载是否可用
private int mPageCount;//页数
private int mItemCount;//每页的Item个数
public CommonRefreshWaterfallView(Context context) {
this(context, null);
}
public CommonRefreshWaterfallView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CommonRefreshWaterfallView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.CommonRefreshView);
mRefreshEnable = ta.getBoolean(R.styleable.CommonRefreshView_crv_refreshEnable, true);
mLoadMoreEnable = ta.getBoolean(R.styleable.CommonRefreshView_crv_loadMoreEnable, true);
mLayoutRes = ta.getResourceId(R.styleable.CommonRefreshView_crv_layout, R.layout.view_refresh_default);
mItemCount = ta.getInteger(R.styleable.CommonRefreshView_crv_itemCount, 20);
ta.recycle();
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(mLayoutRes, this, false);
mContentView = view;
addView(view);
mSmartRefreshLayout = (SmartRefreshLayout) view.findViewById(R.id.refreshLayout);
mSmartRefreshLayout.setEnableLoadMoreWhenContentNotFull(false);//是否在列表不满一页时候开启上拉加载功能
mSmartRefreshLayout.setEnableFooterFollowWhenLoadFinished(true);//是否在全部加载结束之后Footer跟随内容
mSmartRefreshLayout.setEnableOverScrollBounce(false);//设置是否开启越界回弹功能默认true
mEmptyLayout = (FrameLayout) view.findViewById(R.id.no_data_container);
mLoadFailureView = view.findViewById(R.id.load_failure);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
mRecyclerView.setHasFixedSize(true);
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(staggeredGridLayoutManager);
((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
mSmartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
refresh();
}
});
mSmartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull RefreshLayout refreshlayout) {
Log.i("t2", "来了哦");
loadMore();
}
});
mSmartRefreshLayout.setEnableRefresh(mRefreshEnable);
mSmartRefreshLayout.setEnableLoadMore(mLoadMoreEnable);
View btnReload = view.findViewById(R.id.btn_reload);
if (btnReload != null) {
btnReload.setOnClickListener(this);
}
int textColor = ContextCompat.getColor(mContext, R.color.textColor);
mHeader = findViewById(R.id.header);
mHeader.setAccentColor(textColor);
mFooter = findViewById(R.id.footer);
mFooter.setAccentColor(textColor);
mFooter.setTextSizeTitle(14);
}
/**
* 设置头部字体颜色
*
* @param textColor
*/
public void setHeaderTextColor(int textColor) {
mHeader.setAccentColor(textColor);
}
private HttpCallback mRefreshCallback = new HttpCallback() {
private int mDataCount;
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mDataHelper == null) {
return;
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
RefreshAdapter adapter = null;
RecyclerView.Adapter recyclerViewAdapter = mRecyclerView.getAdapter();
if (recyclerViewAdapter != null && recyclerViewAdapter instanceof RefreshAdapter) {
adapter = (RefreshAdapter) recyclerViewAdapter;
} else {
adapter = mDataHelper.getAdapter();
if (adapter == null) {
return;
}
mRecyclerView.setAdapter(adapter);
}
if (code != 0) {
ToastUtil.show(msg);
return;
}
if (info != null) {
List list = mDataHelper.processData(info);
if (list == null) {
return;
}
mDataCount = list.size();
if (mDataCount > 0) {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
adapter.refreshData(list);
} else {
adapter.clearData();
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != View.VISIBLE) {
mEmptyLayout.setVisibility(View.VISIBLE);
}
}
} else {
if (adapter != null) {
adapter.clearData();
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != View.VISIBLE) {
mEmptyLayout.setVisibility(View.VISIBLE);
}
}
mDataHelper.onRefreshSuccess(adapter.getList(), adapter.getItemCount());
}
@Override
public void onError() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
if (mLoadFailureView != null) {
if (mLoadFailureView.getVisibility() != View.VISIBLE) {
if (mRecyclerView != null) {
RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
if (adapter != null && adapter.getItemCount() > 0) {
ToastUtil.show(mContext.getString(R.string.load_failure));
} else {
mLoadFailureView.setVisibility(View.VISIBLE);
}
} else {
mLoadFailureView.setVisibility(View.VISIBLE);
}
} else {
ToastUtil.show(mContext.getString(R.string.load_failure));
}
}
if (mDataHelper != null) {
mDataHelper.onRefreshFailure();
}
}
@Override
public void onFinish() {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.finishRefresh(true);
if (mDataCount < mItemCount) {
mSmartRefreshLayout.finishLoadMore(true);
}
}
}
};
private HttpCallback mLoadMoreCallback = new HttpCallback() {
private int mDataCount;
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mDataHelper == null) {
mPageCount--;
return;
}
if (code != 0) {
ToastUtil.show(msg);
mPageCount--;
return;
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
if (info != null) {
List list = mDataHelper.processData(info);
if (list == null) {
mPageCount--;
return;
}
mDataCount = list.size();
RefreshAdapter adapter = mDataHelper.getAdapter();
if (mDataCount > 0) {
if (adapter != null) {
adapter.insertList(list);
}
} else {
mPageCount--;
}
mDataHelper.onLoadMoreSuccess(list, mDataCount);
} else {
mPageCount--;
}
}
@Override
public void onError() {
super.onError();
mPageCount--;
if (mDataHelper != null) {
mDataHelper.onLoadMoreFailure();
}
}
@Override
public void onFinish() {
Log.i("t2", "更多");
if (mSmartRefreshLayout != null) {
if (mDataCount <= 0) {
mSmartRefreshLayout.finishLoadMoreWithNoMoreData();
} else {
mSmartRefreshLayout.finishLoadMore(true);
}
}
}
};
public void onFinish() {
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == View.VISIBLE) {
mLoadFailureView.setVisibility(View.INVISIBLE);
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == View.VISIBLE) {
mEmptyLayout.setVisibility(View.INVISIBLE);
}
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.finishRefresh(true);
}
}
public <T> void setDataHelper(DataHelper<T> dataHelper) {
mDataHelper = dataHelper;
}
public void setLayoutManager(RecyclerView.LayoutManager layoutManager) {
mRecyclerView.setLayoutManager(layoutManager);
}
public void setItemDecoration(ItemDecoration itemDecoration) {
mRecyclerView.addItemDecoration(itemDecoration);
}
/**
* 手动设置没有更多数据
* 因为日榜/周榜接口没有分页参数会导致一直读取重复数据
*/
public void setNotLoadMore() {
mSmartRefreshLayout.finishLoadMoreWithNoMoreData();
}
public void showLoading() {
mPageCount = 1;
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.autoRefreshAnimationOnly();
}
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == VISIBLE) {
mEmptyLayout.setVisibility(INVISIBLE);
}
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == VISIBLE) {
mLoadFailureView.setVisibility(INVISIBLE);
}
}
public void showRefreshBar() {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.autoRefresh(100);//延迟400毫秒后自动刷新
}
}
public void showEmpty() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() != VISIBLE) {
mEmptyLayout.setVisibility(VISIBLE);
}
}
public void hideEmpty() {
if (mEmptyLayout != null && mEmptyLayout.getVisibility() == VISIBLE) {
mEmptyLayout.setVisibility(INVISIBLE);
}
}
public void hideLoadFailure() {
if (mLoadFailureView != null && mLoadFailureView.getVisibility() == VISIBLE) {
mLoadFailureView.setVisibility(INVISIBLE);
}
}
public void initData() {
Log.i("t2", "AAAs1212");
refresh();
}
private void refresh() {
if (mDataHelper != null) {
Log.i("t2", "AAAs");
mPageCount = 1;
mDataHelper.loadData(mPageCount, mRefreshCallback);
}
if (dataHelperNew != null) {
dataHelperNew.refresh();
}
}
private void loadMore() {
Log.i("t2", "来了哦111");
if (mDataHelper != null) {
Log.i("t2", "来了哦12121");
mPageCount++;
mDataHelper.loadData(mPageCount, mLoadMoreCallback);
}
if (dataHelperNew != null) {
dataHelperNew.loadData(mPageCount);
}
}
public int getPageCount() {
return mPageCount;
}
public void setPageCount(int pageCount) {
mPageCount = pageCount;
}
public int getItemCount() {
return mItemCount;
}
public void setItemCount(int itemCount) {
mItemCount = itemCount;
}
public void setRefreshEnable(boolean enable) {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.setEnableRefresh(enable);
}
}
public void setLoadMoreEnable(boolean enable) {
if (mSmartRefreshLayout != null) {
mSmartRefreshLayout.setEnableLoadMore(enable);
}
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_reload) {
refresh();
}
}
public interface DataHelperNew {
void loadData(int p);
void refresh();
}
private DataHelperNew dataHelperNew;
public CommonRefreshWaterfallView setDataHelperNew(DataHelperNew dataHelperNew) {
this.dataHelperNew = dataHelperNew;
return this;
}
public interface DataHelper<T> {
RefreshAdapter<T> getAdapter();
void loadData(int p, HttpCallback callback);
List<T> processData(String[] info);
/**
* 下拉刷新成功
*
* @param list Adapter的全部数据的List
* @param listCount Adapter的全部数据的个数
*/
void onRefreshSuccess(List<T> list, int listCount);
/**
* 下拉刷新失败
*/
void onRefreshFailure();
/**
* 上拉加载成功
*
* @param loadItemList 本次加载到的数据
* @param loadItemCount 加载到的数据个数
*/
void onLoadMoreSuccess(List<T> loadItemList, int loadItemCount);
/**
* 加载失败
*/
void onLoadMoreFailure();
}
/**
* 空数据的布局
*/
public void setEmptyLayoutId(int noDataLayoutId) {
if (mEmptyLayout != null) {
mEmptyLayout.removeAllViews();
View v = LayoutInflater.from(mContext).inflate(noDataLayoutId, mEmptyLayout, false);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) v.getLayoutParams();
params.gravity = Gravity.CENTER;
v.setLayoutParams(params);
mEmptyLayout.addView(v);
}
}
public View getContentView() {
return mContentView;
}
public void setRecyclerViewAdapter(RefreshAdapter adapter) {
if (mRecyclerView != null) {
mRecyclerView.setAdapter(adapter);
}
}
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@ -60,7 +61,6 @@ public class ProcessFragment extends Fragment {
mPermissionCallback = null;
}
/**
* 判断申请的权限有没有被允许
*/
@ -119,7 +119,7 @@ public class ProcessFragment extends Fragment {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null);
}catch (Exception e){
} catch (Exception e) {
}
if (mActivityResultCallback != null) {
@ -131,8 +131,8 @@ public class ProcessFragment extends Fragment {
}
}
public void release(){
mPermissionCallback=null;
mActivityResultCallback=null;
public void release() {
mPermissionCallback = null;
mActivityResultCallback = null;
}
}

View File

@ -0,0 +1,12 @@
package com.yunbao.common.interfaces;
import java.util.HashMap;
public abstract class PermissionCallback {
public abstract void onAllGranted();
public void onResult(HashMap<String, Boolean> resultMap) {
}
}

View File

@ -0,0 +1,114 @@
package com.yunbao.common.views;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import com.yunbao.common.R;
import com.yunbao.common.utils.ScreenDimenUtil;
/**
* Created by cxf on 2018/10/15.
*/
public abstract class AbsUserPageViewHolder extends AbsViewHolder implements View.OnClickListener {
protected ObjectAnimator mEnterAnimator;
protected ObjectAnimator mOutAnimator;
protected boolean mLoad;
protected boolean mShowed;
protected boolean mAnimating;
public AbsUserPageViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
public AbsUserPageViewHolder(Context context, ViewGroup parentView, Object... args) {
super(context, parentView, args);
}
@Override
public void init() {
int screenWidth = ScreenDimenUtil.getInstance().getScreenWdith();
Interpolator interpolator = new AccelerateDecelerateInterpolator();
mEnterAnimator = ObjectAnimator.ofFloat(mContentView, "translationX", screenWidth, 0);
mEnterAnimator.setDuration(200);
mEnterAnimator.setInterpolator(interpolator);
mEnterAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimating = false;
mShowed = true;
onShow();
loadData();
}
});
mOutAnimator = ObjectAnimator.ofFloat(mContentView, "translationX", 0, screenWidth);
mOutAnimator.setDuration(200);
mOutAnimator.setInterpolator(interpolator);
mOutAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimating = false;
mShowed = false;
onHide();
}
});
findViewById(R.id.btn_back).setOnClickListener(this);
}
public abstract void loadData();
public void show() {
if (!mAnimating) {
mAnimating = true;
mEnterAnimator.start();
}
}
public void hide() {
if (!mAnimating) {
mAnimating = true;
mOutAnimator.start();
}
}
public void onShow() {
}
public void onHide() {
}
public boolean isShowed() {
return mShowed;
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_back) {
hide();
}
}
public void release() {
if (mEnterAnimator != null) {
mEnterAnimator.cancel();
}
mEnterAnimator = null;
if (mOutAnimator != null) {
mOutAnimator.cancel();
}
mEnterAnimator = null;
}
}

View File

@ -0,0 +1,46 @@
package com.yunbao.common.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.yunbao.common.R;
/**
* Created by cxf on 2018/9/27.
*/
public class MyFrameLayout2 extends FrameLayout {
private float mRatio;
private float mOffestY;
public MyFrameLayout2(@NonNull Context context) {
this(context, null);
}
public MyFrameLayout2(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public MyFrameLayout2(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MyFrameLayout2);
mRatio = ta.getFloat(R.styleable.MyFrameLayout2_mfl_ratio, 1);
mOffestY = ta.getDimension(R.styleable.MyFrameLayout2_mfl_offestY, 0);
ta.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (widthSize * mRatio + mOffestY), MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="45dp" />
<solid android:color="#FEF8F8" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="#F7F9FB"/>
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="-45"
android:endColor="#EB6FFF"
android:startColor="#FF83C6" />
<corners
android:bottomLeftRadius="90dp"
android:bottomRightRadius="90dp"
android:topLeftRadius="90dp"
android:topRightRadius="90dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="35dp"
android:topRightRadius="35dp" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="45dp" />
<solid android:color="#EB6FFF" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
<solid android:color="@color/white" />
</shape>

View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/main_bg"
android:orientation="vertical">
<include layout="@layout/view_title_new" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@mipmap/icon_data_empty" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="栗子栗子🌰zzz"
android:textColor="#333333"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="02 - 11发布"
android:textColor="#AAAAAA" />
</LinearLayout>
<LinearLayout
android:layout_width="80dp"
android:layout_height="40dp"
android:background="@drawable/bg_main_com_type"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like_follow" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="关注"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="哇这里我也太想去了!真是太漂亮了 请问一下路边结冰了吗?会不会封路?"
android:textColor="#333333" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="王多鱼明明青青等105人觉得很赞"
android:textColor="#333333"
android:textSize="12dp" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_share_new" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="15dp"
android:background="#FFE9F6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="评论123"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_comment" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingTop="20dp"
android:paddingRight="20dp"
android:paddingBottom="20dp">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/icon_data_empty" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_weight="1"
android:background="@drawable/bg_community_comment"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/icon_edit_new" />
<EditText
android:id="@+id/comment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/transparent"
android:hint="说点什么..."
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textSize="14dp" />
</LinearLayout>
<ImageView
android:id="@+id/send"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/icon_send" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/view_title2" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/main_community_send_edit_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_community_edit" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请输入200字以内的文字"
android:textColor="#333333" />
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:background="@color/white"
android:gravity="start"
android:hint="写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么写点什么..."
android:maxEms="200"
android:maxLength="200"
android:textSize="14dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/imgTextLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_img_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="图文"
android:textColor="#333333"
android:textSize="16dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/videoLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@mipmap/icon_community_video" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="视频"
android:textColor="#333333"
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="15dp"
android:background="@drawable/main_community_send_edit_bg"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingEnd="15dp"
android:paddingBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_community_talk" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="选择话题"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_right_new" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#FFE9F6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_community_time" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="选择时间"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="立即发表"
android:textColor="#333333"
android:textSize="14dp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@mipmap/icon_right_new" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,393 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/main_bg"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
android:fadingEdge="none"
app:elevation="0dp"
app:layout_behavior="com.yunbao.common.custom.FixAppBarLayoutBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="65dp"
android:orientation="vertical"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="380dp"
android:background="@color/gray1">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/temp" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="35dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-20dp"
android:background="@drawable/bg_user_home_bottom"
android:orientation="vertical"
android:padding="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.makeramen.roundedimageview.RoundedImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:src="@mipmap/temp"
app:riv_corner_radius="20dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="主播昵称"
android:textColor="#333333"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/icon_auth_suc" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="真人认证"
android:textColor="#333333"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10.99w"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="粉丝"
android:textColor="#777777"
android:textSize="12dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10.99w"
android:textColor="#333333"
android:textSize="12dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="获赞"
android:textColor="#777777"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="80dp"
android:layout_height="40dp"
android:background="@drawable/bg_main_com_type"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@mipmap/icon_like_follow" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="关注"
android:textColor="@color/white"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="15dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="ID:123456"
android:textColor="#777777"
android:textSize="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:text="在线"
android:textColor="#777777"
android:textSize="10dp" />
<ImageView
android:layout_width="5dp"
android:layout_height="5dp"
android:layout_marginStart="2dp"
android:src="@mipmap/icon_green" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/user_sex"
android:layout_width="30dp"
android:layout_height="20dp"
android:src="@mipmap/icon_man" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="20dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="56dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_grade" />
<TextView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="25dp"
android:gravity="center_vertical"
android:text="Lv 42"
android:textColor="@color/white"
android:textSize="12dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="20dp"
android:gravity="center_vertical">
<ImageView
android:layout_width="56dp"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_vip_grade" />
<TextView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="27dp"
android:gravity="center_vertical"
android:text="Lv 42"
android:textColor="@color/white"
android:textSize="12dp" />
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="5dp"
android:background="@color/gray1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名个性签名"
android:textColor="#777777"
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查看更多"
android:textColor="#FF4874"
android:textSize="13dp"
android:textStyle="bold" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="5dp"
android:src="@mipmap/icon_down" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="#FFE9F6" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="15dp"
android:src="@mipmap/icon_index_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="个人动态"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_below="@id/appBarLayout"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@android:color/transparent"
android:clickable="true"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingTop="40dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="34dp"
android:layout_height="30dp"
android:src="@mipmap/icon_left" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="用户名称"
android:textColor="#333333"
android:textSize="16dp"
android:textStyle="bold"
android:visibility="invisible" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/icon_right_gray" />
</LinearLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="#000" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/preview"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:padding="9dp"
android:src="@mipmap/icon_back"
android:tint="@color/white" />
<TextView
android:id="@+id/count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:padding="5dp"
android:textColor="@color/white"
android:textSize="14sp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="40dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/btn_delete"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:background="#000"
android:gravity="center"
android:text="@string/delete"
android:textColor="@color/white"
android:textSize="15sp"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="#F5F5F5"
@ -27,7 +28,7 @@
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
android:tint="@color/textColor" />
app:tint="@color/textColor" />
<ImageView
android:id="@+id/img_more"
@ -37,20 +38,38 @@
android:layout_centerVertical="true"
android:padding="9dp"
android:src="@mipmap/btn_more_black"
android:tint="@color/textColor"
android:visibility="gone" />
android:visibility="gone"
app:tint="@color/textColor" />
<TextView
android:id="@+id/rView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="25dp"
android:gravity="center"
android:text="@string/not_received"
android:textColor="@color/textColor"
android:textSize="13sp"
android:layout_marginRight="25dp"
android:text="@string/not_received"
android:visibility="gone"
android:textStyle="bold" />
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@drawable/main_community_send"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:text="发布"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="gone" />
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@android:color/transparent"
android:paddingTop="24dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/titleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/textColor"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_back"
app:tint="@color/textColor" />
<ImageView
android:id="@+id/img_more"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="9dp"
android:src="@mipmap/btn_more_black"
android:visibility="gone"
app:tint="@color/textColor" />
<TextView
android:id="@+id/rView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="25dp"
android:gravity="center"
android:text="@string/not_received"
android:textColor="@color/textColor"
android:textSize="13sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@drawable/main_community_send"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:text="发布"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="gone" />
<ImageView
android:id="@+id/setting"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:background="@mipmap/icon_setting"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingBottom="10dp"
android:text="发布"
android:textColor="@color/white"
android:textSize="16dp"
android:visibility="visible" />
</RelativeLayout>
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 KiB

View File

@ -94,6 +94,7 @@
<string name="edit_profile_right_date">Please select the correct date</string>
<string name="edit_nick_name_price_msg">Warm tip: you can change your nickname once for free, and then 1800 diamonds will be needed</string>
<string name="follow">Follow</string>
<string name="main_type_theater">Theater</string>
<string name="noble">VIP</string>
<string name="rosy">Rosy</string>
<string name="skin">Skin</string>
@ -257,6 +258,7 @@
<string name="login_tip_4">Log in</string>
<string name="shopmall">shopmall</string>
<string name="recomment">Recommend</string>
<string name="main_type_find">Find</string>
<string name="cust_server">CSD</string>
<string name="live_anchor">Anchor</string>
<string name="live_start">Live broadcast</string>

View File

@ -94,6 +94,7 @@
<string name="edit_profile_right_date">請選擇正確的日期</string>
<string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string>
<string name="follow">關注</string>
<string name="main_type_theater">短劇</string>
<string name="unfollow"> 主播哪裡做的不好~\n哥哥確定要取消關注嗎?</string>
<string name="unfollow_confrim">繼續關注</string>
<string name="unfollow_cancel">不再關注</string>
@ -463,6 +464,7 @@
<string name="recommend_enter">點擊進入</string>
<string name="recomment_to_you">為你推薦</string>
<string name="recomment">推薦</string>
<string name="main_type_find">發現</string>
<string name="sex_male"></string>
<string name="sex_female"></string>
<string name="setting">個性設置</string>

View File

@ -94,6 +94,7 @@
<string name="edit_profile_right_date">請選擇正確的日期</string>
<string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string>
<string name="follow">關注</string>
<string name="main_type_theater">短劇</string>
<string name="unfollow"> 主播哪裡做的不好~\n哥哥確定要取消關注嗎?</string>
<string name="unfollow_confrim">繼續關注</string>
<string name="unfollow_cancel">不再關注</string>
@ -463,6 +464,7 @@
<string name="recommend_enter">點擊進入</string>
<string name="recomment_to_you">為你推薦</string>
<string name="recomment">推薦</string>
<string name="main_type_find">發現</string>
<string name="sex_male"></string>
<string name="sex_female"></string>
<string name="setting">個性設置</string>

View File

@ -94,6 +94,7 @@
<string name="edit_profile_right_date">請選擇正確的日期</string>
<string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string>
<string name="follow">關注</string>
<string name="main_type_theater">短劇</string>
<string name="unfollow"> 主播哪裡做的不好~\n哥哥確定要取消關注嗎?</string>
<string name="unfollow_confrim">繼續關注</string>
<string name="unfollow_cancel">不再關注</string>
@ -463,6 +464,7 @@
<string name="recommend_enter">點擊進入</string>
<string name="recomment_to_you">為你推薦</string>
<string name="recomment">推薦</string>
<string name="main_type_find">發現</string>
<string name="sex_male"></string>
<string name="sex_female"></string>
<string name="setting">個性設置</string>

View File

@ -94,6 +94,7 @@
<string name="edit_profile_right_date">Please select the correct date</string>
<string name="edit_nick_name_price_msg">Warm tip: you can change your nickname once for free, and then 1800 diamonds will be needed</string>
<string name="follow">Follow</string>
<string name="main_type_theater">Theater</string>
<string name="noble">VIP</string>
<string name="rosy">Rosy</string>
<string name="skin">Skin</string>
@ -257,6 +258,7 @@
<string name="login_tip_4">Log in</string>
<string name="shopmall">shopmall</string>
<string name="recomment">Recommend</string>
<string name="main_type_find">Find</string>
<string name="cust_server">CSD</string>
<string name="live_anchor">Anchor</string>
<string name="live_start">Live broadcast</string>
@ -1455,4 +1457,22 @@ Limited ride And limited avatar frame</string>
<string name="back_community_sure">Sure</string>
<string name="save_image_album">保存到本地相册</string>
<string name="save_success">保存成功</string>
<string name="done">完成</string>
<string name="add_image">所有照片</string>
<string name="choose_img_max">最多选&#160;%1$s&#160;张图片哦</string>
<string name="take_photo">拍摄</string>
<string name="record_cancel">取消录制</string>
<string name="permission_refused">您拒绝了%1$s的权限请到设置中修改</string>
<string name="permission_camera">使用摄像头</string>
<string name="permission_record_audio">使用麦克风</string>
<string name="permission_location">使用定位</string>
<string name="permission_read_phone_state">读取手机信息</string>
<string name="permission_storage">文件读写</string>
</resources>

View File

@ -9,9 +9,9 @@ ext {
]
manifestPlaceholders = [
//
serverHost : "https://napi.yaoulive.com",
//serverHost : "https://napi.yaoulive.com",
//
// serverHost : " https://ceshi.yaoulive.com",
serverHost : " https://ceshi.yaoulive.com",
//
baiduAppId : "23774720",

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/btn_admin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp">
<LinearLayout
android:id="@+id/imgLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="15dp">
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgLayout"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:maxLines="1"
android:text="标题标题标题标题标题标题标题"
android:textColor="@color/textColor"
android:textSize="14dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.yunbao.common.custom.RatioRoundImageView
android:id="@+id/author"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/user_info_bg"
app:riv_corner_radius="15dp" />
<TextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:text="昵称"
android:textColor="@color/black1"
android:textSize="12dp" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@mipmap/icon_like" />
<TextView
android:id="@+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="10000"
android:textColor="#FF4874"
android:textSize="12dp" />
</LinearLayout>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/icon_play" />
</RelativeLayout>
</androidx.cardview.widget.CardView>

View File

@ -120,9 +120,9 @@ import com.yunbao.main.interfaces.MainAppBarLayoutListener;
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
import com.yunbao.main.utils.GenerateTestUserSig;
import com.yunbao.main.views.FloatBannerView;
import com.yunbao.main.views.MainHomeComViewHolder;
import com.yunbao.main.views.MainHomeCommunityViewHolder;
import com.yunbao.main.views.MainHomeLiveViewHolder;
import com.yunbao.main.views.MainHomeViewHolder;
import com.yunbao.main.views.MainMeViewHolder;
import com.yunbao.main.views.MainMessageViewHolder;
import com.yunbao.video.utils.VideoStorge;
@ -158,8 +158,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private TabButtonGroup mTabButtonGroup;
private ViewPager mViewPager;
private List<FrameLayout> mViewList;
private MainHomeLiveViewHolder mHomeLiveViewHolder;
private MainHomeViewHolder mainHomeViewHolder;
private MainHomeComViewHolder mainHomeComViewHolder;
private MainHomeLiveViewHolder mainHomeLiveViewHolder;
private MainHomeCommunityViewHolder mMainHomeCommunityViewHolder;
private MainMessageViewHolder mainMessageViewHolder;
private MainMeViewHolder mMeViewHolder;
@ -638,9 +638,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
floatBanner.setVisibility(View.VISIBLE);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE);
} else {
if (mainHomeViewHolder!=null&&mainHomeViewHolder.isFloatWarOrder()){
if (mainHomeComViewHolder != null && mainHomeComViewHolder.isFloatWarOrder()) {
floatWarOrder.setVisibility(View.GONE);
}else {
} else {
floatWarOrder.setVisibility(View.VISIBLE);
}
@ -895,9 +895,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
mFristLoad = false;
// getLocation();
loadPageData(0, false);
if (mHomeLiveViewHolder != null) {
mHomeLiveViewHolder.setShowed(true);
}
}
if (Constants.isShowPage != -1) {
mTabButtonGroup.setCurPosition(Constants.isShowPage);
@ -1137,11 +1134,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
return;
}
if (position == 0) {
mainHomeViewHolder = new MainHomeViewHolder(mContext, parent);
vh = mainHomeViewHolder;
mainHomeComViewHolder = new MainHomeComViewHolder(mContext, parent);
vh = mainHomeComViewHolder;
} else if (position == 1) {
mMainHomeCommunityViewHolder = new MainHomeCommunityViewHolder(mContext, parent, this);//社区
mMainHomeCommunityViewHolder = new MainHomeCommunityViewHolder(mContext, parent, this);//直播
vh = mMainHomeCommunityViewHolder;
} else if (position == 2) {
@ -1500,10 +1497,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
floatRedPacket.setOnClickListener(v -> {
MobclickAgent.onEvent(mContext, "home_page_to_redpk", "首页点击右下角去红包专区");
mainHomeViewHolder.setCurPosition(3);
mainHomeComViewHolder.setCurPosition(3);
});
}
}

View File

@ -2,7 +2,6 @@ package com.yunbao.main.activity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@ -10,7 +9,6 @@ import androidx.fragment.app.FragmentTransaction;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.main.R;

View File

@ -0,0 +1,110 @@
package com.yunbao.main.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.main.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cxf on 2018/9/26.
* 首页 直播
*/
public class MainHomeComAdapter extends RefreshAdapter<LiveBean> {
private Context mContext;
private View.OnClickListener mOnClickListener;
public void setmOnClickListener(View.OnClickListener mOnClickListener) {
this.mOnClickListener = mOnClickListener;
}
private List<Integer> heightList = new ArrayList<>();
public MainHomeComAdapter(Context context) {
super(context);
this.mContext = context;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(com.yunbao.live.R.layout.item_main_com, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
((Vh) vh).setData(mList.get(position), position);
}
@Override
public int getItemCount() {
return super.getItemCount();
}
class Vh extends RecyclerView.ViewHolder {
TextView name;
TextView title;
TextView likeCount;
ImageView img;
ImageView author;
LinearLayout heightLayout;
public Vh(View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
title = itemView.findViewById(R.id.title);
img = itemView.findViewById(R.id.img);
author = itemView.findViewById(R.id.author);
likeCount = itemView.findViewById(R.id.like_count);
heightLayout = itemView.findViewById(R.id.imgLayout);
itemView.setOnClickListener(mOnClickListener);
}
void setData(LiveBean bean, int position) {
itemView.setTag(bean);
//name.setText(bean.getCity());
//title.setText(bean.getCity());
likeCount.setText(bean.getNums());
ImgLoader.display(mContext, "https://img2.baidu.com/it/u=1540900496,2036305732&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", img);
ImgLoader.display(mContext, bean.getAvatar(), author);
if (position == 0) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 550;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 550;
img.setLayoutParams(imgPa);
} else {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 750;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 750;
img.setLayoutParams(imgPa);
}
}
}
}

View File

@ -0,0 +1,107 @@
package com.yunbao.main.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.main.R;
import java.util.List;
import java.util.Locale;
public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComClassAdapter.Vh> {
private Context mContext;
private List<LiveClassBean> mList;
private LayoutInflater mInflater;
private View.OnClickListener mOnClickListener;
private OnItemClickListener<LiveClassBean> mOnItemClickListener;
//选中的
public static int choice = 0;
public MainHomeComClassAdapter(Context context, List<LiveClassBean> list, boolean dialog) {
mContext = context;
mList = list;
mInflater = LayoutInflater.from(context);
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag != null) {
int position = (int) tag;
LiveClassBean bean = mList.get(position);
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(bean, position);
}
}
}
};
}
public void setOnItemClickListener(OnItemClickListener<LiveClassBean> onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
@NonNull
@Override
public MainHomeComClassAdapter.Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
int res = R.layout.item_main_home_com_class;
return new MainHomeComClassAdapter.Vh(mInflater.inflate(res, parent, false));
}
@Override
public void onBindViewHolder(@NonNull MainHomeComClassAdapter.Vh vh, int position) {
vh.setData(mList.get(position), position);
}
@Override
public int getItemCount() {
return mList.size();
}
class Vh extends RecyclerView.ViewHolder {
TextView mName;
public Vh(View itemView) {
super(itemView);
mName = (TextView) itemView.findViewById(R.id.tv_class_name);
itemView.setOnClickListener(mOnClickListener);
}
@SuppressLint("NewApi")
void setData(LiveClassBean bean, int position) {
itemView.setTag(position);
Locale locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
locale = mContext.getResources().getConfiguration().getLocales().get(0);
} else {
locale = mContext.getResources().getConfiguration().locale;
}
if (locale.getLanguage().equals("zh")) {
mName.setText(bean.getChinese());
} else {
mName.setText(bean.getEnglish());
}
if (position == choice) {
mName.setBackgroundResource(R.drawable.bg_main_community_type_01);
mName.setTextColor(Color.parseColor("#FFFFFF"));
} else {
mName.setBackgroundResource(R.drawable.bg_main_community_type_02);
mName.setTextColor(Color.parseColor("#777777"));
}
}
}
}

View File

@ -0,0 +1,102 @@
package com.yunbao.main.adapter;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.main.R;
/**
* 关注和推荐的适配器
*/
public class MainHomeRemFindComAdapter extends RefreshAdapter<LiveBean> {
private Context context;
private int Height;
private View.OnClickListener mOnClickListener;
public MainHomeRemFindComAdapter(Context context, int h) {
super(context);
this.context = context;
Log.e("t1", h + "屏1");
this.Height = h;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_main_com, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
if (vh instanceof Vh) {
((Vh) vh).setData(mList.get(position), position);
}
}
class Vh extends RecyclerView.ViewHolder {
TextView name;
TextView title;
TextView likeCount;
ImageView img;
ImageView author;
LinearLayout heightLayout;
public Vh(View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
title = itemView.findViewById(R.id.title);
img = itemView.findViewById(R.id.img);
author = itemView.findViewById(R.id.author);
likeCount = itemView.findViewById(R.id.like_count);
heightLayout = itemView.findViewById(R.id.imgLayout);
itemView.setOnClickListener(mOnClickListener);
}
void setData(LiveBean bean, int position) {
itemView.setTag(bean);
//name.setText(bean.getCity());
//title.setText(bean.getCity());
likeCount.setText(bean.getNums());
ImgLoader.display(mContext, "https://img2.baidu.com/it/u=1540900496,2036305732&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", img);
ImgLoader.display(mContext, bean.getAvatar(), author);
if (position == 0) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 450;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 450;
img.setLayoutParams(imgPa);
} else {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 700;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 700;
img.setLayoutParams(imgPa);
}
}
}
}

View File

@ -0,0 +1,116 @@
package com.yunbao.main.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.jakewharton.rxbinding3.view.RxView;
import com.squareup.picasso.Picasso;
import com.xj.marqueeview.MarqueeView;
import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.main.R;
import com.yunbao.main.utils.MainIconUtil;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import kotlin.Unit;
/**
* 关注和推荐的适配器
*/
public class MainHomeRemFollComAdapter extends RefreshAdapter<LiveBean> {
private Context context;
private int Height;
private View.OnClickListener mOnClickListener;
public MainHomeRemFollComAdapter(Context context, int h) {
super(context);
this.context = context;
Log.e("t1", h + "屏1");
this.Height = h;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_main_com, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
if (vh instanceof Vh) {
((Vh) vh).setData(mList.get(position), position);
}
}
class Vh extends RecyclerView.ViewHolder {
TextView name;
TextView title;
TextView likeCount;
ImageView img;
ImageView author;
LinearLayout heightLayout;
public Vh(View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
title = itemView.findViewById(R.id.title);
img = itemView.findViewById(R.id.img);
author = itemView.findViewById(R.id.author);
likeCount = itemView.findViewById(R.id.like_count);
heightLayout = itemView.findViewById(R.id.imgLayout);
itemView.setOnClickListener(mOnClickListener);
}
void setData(LiveBean bean, int position) {
itemView.setTag(bean);
//name.setText(bean.getCity());
//title.setText(bean.getCity());
likeCount.setText(bean.getNums());
ImgLoader.display(mContext, "https://img2.baidu.com/it/u=1540900496,2036305732&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500", img);
ImgLoader.display(mContext, bean.getAvatar(), author);
if (position == 0) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 450;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 450;
img.setLayoutParams(imgPa);
} else {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) heightLayout.getLayoutParams();
params.height = 700;
heightLayout.setLayoutParams(params);
FrameLayout.LayoutParams imgPa = (FrameLayout.LayoutParams) img.getLayoutParams();
imgPa.height = 700;
img.setLayoutParams(imgPa);
}
}
}
}

View File

@ -0,0 +1,340 @@
package com.yunbao.main.views;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
import com.yunbao.common.adapter.ViewPagerAdapter;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.AbsMainViewHolder;
import com.yunbao.main.R;
import com.yunbao.main.interfaces.AppBarStateListener;
import com.yunbao.main.interfaces.MainAppBarExpandListener;
import com.yunbao.main.interfaces.MainAppBarLayoutListener;
import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.ViewPagerHelper;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.CommonPagerTitleView;
import org.greenrobot.eventbus.EventBus;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cxf on 2019/2/20.
*/
public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
private AppBarLayout mAppBarLayout;
protected ViewPager mViewPager;
public MagicIndicator mIndicator;
private TextView mRedPoint;//显示未读消息数量的红点
protected AbsMainHomeChildViewHolder[] mViewHolders;
private MainAppBarLayoutListener mAppBarLayoutListener;
private MainAppBarExpandListener mAppBarExpandListener;
private boolean mPaused;
protected List<FrameLayout> mViewList;
private int mAppLayoutOffestY;
private List<ImageView> simplePagerTitleViewList;
private List<TextView> textViewList;
public AbsMainHomeParentComViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
public void refreshIndex(int index) {
for (int i = 0; i < simplePagerTitleViewList.size(); i++) {
if (index == i) {
simplePagerTitleViewList.get(i).setVisibility(View.VISIBLE);
textViewList.get(i).setTextSize(20);
} else {
simplePagerTitleViewList.get(i).setVisibility(View.INVISIBLE);
textViewList.get(i).setTextSize(18);
}
}
}
@Override
public void init() {
mAppBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout);
simplePagerTitleViewList = new ArrayList<>();
textViewList = new ArrayList<>();
View mAppBarChildAt = mAppBarLayout.getChildAt(0);
AppBarLayout.LayoutParams mAppBarParams = (AppBarLayout.LayoutParams) mAppBarChildAt.getLayoutParams();
mAppBarParams.setScrollFlags(0);
mAppBarLayout.addOnOffsetChangedListener(new AppBarStateListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, int state) {
switch (state) {
case AppBarStateListener.EXPANDED:
if (mAppBarExpandListener != null) {
mAppBarExpandListener.onExpand(true);
}
break;
case AppBarStateListener.MIDDLE:
case AppBarStateListener.COLLAPSED:
if (mAppBarExpandListener != null) {
mAppBarExpandListener.onExpand(false);
}
break;
}
}
});
mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (mAppBarLayoutListener != null) {
if (verticalOffset > mAppLayoutOffestY) {
mAppBarLayoutListener.onOffsetChanged(false);
} else if (verticalOffset < mAppLayoutOffestY) {
mAppBarLayoutListener.onOffsetChanged(true);
}
mAppLayoutOffestY = verticalOffset;
}
}
});
mViewList = new ArrayList<>();
int pageCount = getPageCount();
for (int i = 0; i < pageCount; i++) {
FrameLayout frameLayout = new FrameLayout(mContext);
frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mViewList.add(frameLayout);
}
mViewHolders = new AbsMainHomeChildViewHolder[pageCount];
mViewPager = (ViewPager) findViewById(R.id.viewPager);
if (pageCount > 1) {
mViewPager.setOffscreenPageLimit(pageCount - 1);
}
mViewPager.setAdapter(new ViewPagerAdapter(mViewList));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//切换ViewPager时给主页面发消息隐藏底部(只针对商城)
EventBus.getDefault().post("DownAnimaiton");
mAppBarLayout.setExpanded(true);
}
@Override
public void onPageSelected(int position) {
loadPageData(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mIndicator = (MagicIndicator) findViewById(R.id.indicator);
final String[] titles = getTitles();
CommonNavigator commonNavigator = new CommonNavigator(mContext);
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
@Override
public int getCount() {
return titles.length;
}
@Override
public IPagerTitleView getTitleView(Context context, final int index) {
CommonPagerTitleView commonPagerTitleView = new CommonPagerTitleView(mContext);
commonPagerTitleView.setContentView(R.layout.simple_pager_title_layout);
// 初始化
final ImageView titleImg = (ImageView) commonPagerTitleView.findViewById(R.id.index);
final TextView titleText = (TextView) commonPagerTitleView.findViewById(R.id.title);
titleText.setText(titles[index]);
commonPagerTitleView.setOnPagerTitleChangeListener(new CommonPagerTitleView.OnPagerTitleChangeListener() {
@Override
public void onSelected(int index, int totalCount) {
if (index == 3) {
return;
}
titleText.setTextSize(20);
}
@Override
public void onDeselected(int index, int totalCount) {
if (index == 3) {
return;
}
titleText.setTextSize(18);
}
@Override
public void onLeave(int index, int totalCount, float leavePercent, boolean leftToRight) {
if (index == 3) {
return;
}
titleImg.setScaleX(1.1f + (0.8f - 1.1f) * leavePercent);
titleImg.setScaleY(1.1f + (0.8f - 1.1f) * leavePercent);
}
@Override
public void onEnter(int index, int totalCount, float enterPercent, boolean leftToRight) {
if (index == 3) {
return;
}
titleImg.setScaleX(0.8f + (1.1f - 0.8f) * enterPercent);
titleImg.setScaleY(0.8f + (1.1f - 0.8f) * enterPercent);
}
});
commonPagerTitleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mViewPager != null) {
mViewPager.setCurrentItem(index);
}
}
});
simplePagerTitleViewList.add(titleImg);
textViewList.add(titleText);
return commonPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
linePagerIndicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
linePagerIndicator.setXOffset(DpUtil.dp2px(5));
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
linePagerIndicator.setColors(Color.parseColor("#7d77fc"));
return null;
}
});
mIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(mIndicator, mViewPager);
mRedPoint = (TextView) findViewById(R.id.red_point);
mIndicator.setNavigator(commonNavigator);
ViewPagerHelper.bind(mIndicator, mViewPager);
//默认选择第几个
mIndicator.onPageSelected(1);
mViewPager.setCurrentItem(1);
unReadMsgHandle();
}
private void unReadMsgHandle() {
String unReadCount = "0";
if (SpUtil.getInstance().getBooleanValue(SpUtil.HAS_SYSTEM_MSG)) {
unReadCount = "1";
}
// String unReadCountIM = ImMessageUtil.getInstance().getAllUnReadMsgCount();
// try {
// int num1=Integer.parseInt(unReadCount);
// int num2=Integer.parseInt(unReadCountIM);
// int num3=num1+num2;
// setUnReadCount(""+num3);
// }catch (Exception e){
// e.printStackTrace();
// }
}
/**
* 设置AppBarLayout滑动监听
*/
public void setAppBarLayoutListener(MainAppBarLayoutListener appBarLayoutListener) {
mAppBarLayoutListener = appBarLayoutListener;
}
/**
* 设置AppBarLayout展开监听
*/
public void setAppBarExpandListener(MainAppBarExpandListener appBarExpandListener) {
mAppBarExpandListener = appBarExpandListener;
}
@Override
public void loadData() {
if (mViewPager != null) {
loadPageData(mViewPager.getCurrentItem());
}
}
@Override
public void onResume() {
super.onResume();
if (isShowed() && mPaused) {
loadData();
}
mPaused = false;
unReadMsgHandle();
}
@Override
public void onPause() {
super.onPause();
mPaused = true;
}
@Override
public void onDestroy() {
super.onDestroy();
mAppBarLayoutListener = null;
mAppBarExpandListener = null;
super.onDestroy();
}
public int getCurrentPage() {
return mViewPager.getCurrentItem();
}
public void setCurrentPage(int position) {
if (mViewPager == null) {
return;
}
if (mViewPager.getCurrentItem() == position) {
loadPageData(position);
} else {
mViewPager.setCurrentItem(position, false);
}
}
/**
* 显示未读消息
*/
public void setUnReadCount(String unReadCount) {
if (mRedPoint != null) {
if ("0".equals(unReadCount)) {
if (mRedPoint.getVisibility() == View.VISIBLE) {
mRedPoint.setVisibility(View.INVISIBLE);
}
} else {
if (mRedPoint.getVisibility() != View.VISIBLE) {
mRedPoint.setVisibility(View.VISIBLE);
}
mRedPoint.setText(unReadCount);
}
}
}
protected abstract void loadPageData(int position);
protected abstract int getPageCount();
protected abstract String[] getTitles();
}

View File

@ -2,9 +2,11 @@ package com.yunbao.main.views;
import android.content.Context;
import android.graphics.Color;
import com.google.android.material.appbar.AppBarLayout;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@ -59,7 +61,7 @@ public abstract class AbsMainHomeParentViewHolder extends AbsMainViewHolder {
public void init() {
mAppBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout);
View mAppBarChildAt = mAppBarLayout.getChildAt(0);
AppBarLayout.LayoutParams mAppBarParams = (AppBarLayout.LayoutParams) mAppBarChildAt.getLayoutParams();
AppBarLayout.LayoutParams mAppBarParams = (AppBarLayout.LayoutParams) mAppBarChildAt.getLayoutParams();
mAppBarParams.setScrollFlags(0);
mAppBarLayout.addOnOffsetChangedListener(new AppBarStateListener() {
@Override
@ -137,7 +139,7 @@ public abstract class AbsMainHomeParentViewHolder extends AbsMainViewHolder {
public IPagerTitleView getTitleView(Context context, final int index) {
SimplePagerTitleView simplePagerTitleView = new ColorTransitionPagerTitleView(context);
simplePagerTitleView.setNormalColor(Color.parseColor("#B1B1B1"));
simplePagerTitleView.setSelectedColor(Color.parseColor("#7d77fc"));
simplePagerTitleView.setSelectedColor(Color.parseColor("#FFC621"));
simplePagerTitleView.setText(titles[index]);
simplePagerTitleView.setTextSize(18);
simplePagerTitleView.getPaint().setFakeBoldText(true);
@ -158,7 +160,7 @@ public abstract class AbsMainHomeParentViewHolder extends AbsMainViewHolder {
linePagerIndicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
linePagerIndicator.setXOffset(DpUtil.dp2px(5));
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
linePagerIndicator.setColors(Color.parseColor("#7d77fc"));
linePagerIndicator.setColors(Color.parseColor("#FFC621"));
return linePagerIndicator;
}
});

View File

@ -0,0 +1,151 @@
package com.yunbao.main.views;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.CommunitySendActivity;
import com.yunbao.common.event.FloatWarOrderEvent;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.main.R;
import org.greenrobot.eventbus.EventBus;
/**
* Created by Martin on 2024/3/6.
* MainActivity 首页-社区
*/
public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder {
private MainHomeFollComViewHolder mainHomeFollLiveViewHolder;
private MainHomeNewViewHolder mainHomeLiveViewHolder;
private MainHomeRecomComViewHolder mainHomeRecomComViewHolder;
private MainHomeGameViewHolder mainHomeGameLiveViewHolder;
private final String mPageName = "home_page";
private ImageView btnSend;
private boolean floatWarOrder;
public boolean isFloatWarOrder() {
return floatWarOrder;
}
public MainHomeComViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_main_home_com;
}
@Override
public void init() {
super.init();
btnSend = (ImageView) findViewById(R.id.btn_send);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, CommunitySendActivity.class);
mContext.startActivity(intent);
}
});
}
public void setCurPosition(int position) {
mViewPager.setCurrentItem(position);
}
int selected = 1;
@Override
protected void loadPageData(int position) {
if (position == 3) {
RouteUtil.forwardCommunityActivity();
mIndicator.onPageSelected(selected);
setCurPosition(selected);
refreshIndex(selected);
return;
}
selected = position;
refreshIndex(position);
switch (position) {
case 0:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_follow", "首页关注列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
break;
case 1:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_hot", "首页热门列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
break;
case 2:
floatWarOrder = false;
MobclickAgent.onEvent(mContext, "home_page_recommend", "首页推荐列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(false));
break;
case 3:
floatWarOrder = true;
MobclickAgent.onEvent(mContext, "home_page_redpk", "首页红包列表按钮");
EventBus.getDefault().post(new FloatWarOrderEvent().setFloatWarOrder(true));
break;
}
if (mViewHolders == null) {
return;
}
AbsMainHomeChildViewHolder vh = mViewHolders[position];
if (vh == null) {
if (mViewList != null && position < mViewList.size()) {
FrameLayout parent = mViewList.get(position);
if (parent == null) {
return;
}
if (position == -1) {
} else if (position == 0) {
mainHomeFollLiveViewHolder = new MainHomeFollComViewHolder(mContext, parent);
vh = mainHomeFollLiveViewHolder;
} else if (position == 1) {
mainHomeLiveViewHolder = new MainHomeNewViewHolder(mContext, parent);
vh = mainHomeLiveViewHolder;
} else if (position == 2) {
mainHomeRecomComViewHolder = new MainHomeRecomComViewHolder(mContext, parent);
vh = mainHomeRecomComViewHolder;
}
if (vh == null) {
return;
}
mViewHolders[position] = vh;
vh.addToParent();
vh.subscribeActivityLifeCycle();
}
}
if (vh != null) {
vh.loadData();
}
}
@Override
public void onResume() {
super.onResume();
}
@Override
protected int getPageCount() {
return 4;
}
@Override
protected String[] getTitles() {
return new String[]{mContext.getString(R.string.follow), mContext.getString(R.string.hot), mContext.getString(R.string.main_type_find), mContext.getString(R.string.main_type_theater),};
}
}

View File

@ -1,92 +1,33 @@
package com.yunbao.main.views;
import static android.content.Context.CLIPBOARD_SERVICE;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lxj.xpopup.XPopup;
import com.momo.mcamera.util.JsonUtil;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig;
import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.NativeCallbackModel;
import com.yunbao.common.dialog.CinemaTicketPopupWindow;
import com.yunbao.common.dialog.WarOrderExchangeDetailsPopupWindow;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfacePlayLetUtils;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.views.LoadingView;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.MyWalletActivity;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.dialog.EncourageDialog;
import com.yunbao.main.fragment.BattlePassRewardFragment;
import com.yunbao.main.fragment.MainHomeCommunityFragment;
import com.yunbao.main.fragment.MainHomeCommunityVideoFragment;
import com.yunbao.main.fragment.SearchResultsFragment;
import com.yunbao.main.utils.BottomBarUtil;
import com.yunbao.share.ui.SharePopDialog;
import com.yunbao.video.activity.VideoPlayActivity;
import com.yunbao.video.utils.VideoStorge;
import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.ViewPagerHelper;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
@ -95,13 +36,8 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.Li
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
/**
* Created by Chen Haoxuan on 2022/3/25.

View File

@ -0,0 +1,165 @@
package com.yunbao.main.views;
import android.content.Context;
import android.util.Log;
import android.view.ViewGroup;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.custom.CommonRefreshWaterfallView;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.WeekWebViewActivity;
import com.yunbao.main.adapter.MainHomeRemFollComAdapter;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MainHomeFollComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
private CommonRefreshWaterfallView mRefreshView;
private MainHomeRemFollComAdapter mAdapter;
public MainHomeFollComViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_main_home_com_recom;
}
public static int pp;
//显示顶部商城tab时显示底部tabGroup
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("Updata".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
mRefreshView.mRecyclerView.scrollToPosition(0);
}
} else if ("blacklist".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
}
}
}
@Override
public void init() {
mRefreshView = (CommonRefreshWaterfallView) findViewById(R.id.refreshView);
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_foll_live);
EventBus.getDefault().register(this);
/*ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 5, 0);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRefreshView.setItemDecoration(decoration);
*/
mRefreshView.setRecyclerViewAdapter(mAdapter);
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
@Override
public RefreshAdapter<LiveBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainHomeRemFollComAdapter(mContext, MainActivity.Height);
mAdapter.setOnItemClickListener(MainHomeFollComViewHolder.this);
}
return mAdapter;
}
@Override
public void loadData(int p, HttpCallback callback) {
Log.i("t2", "aaa" + p);
pp = 1;
MainHttpUtil.getHomeFollow(p, callback);
}
@Override
public List<LiveBean> processData(String[] info) {
return JSON.parseArray(Arrays.toString(info), LiveBean.class);
}
@Override
public void onRefreshSuccess(List<LiveBean> list, int count) {
EventBus.getDefault().post(new AnchorRecommendModel());
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
List<LiveBean> new_data = new ArrayList<>();
for (int j = 0; j < loadItemList.size(); j++) {
if (loadItemList.get(j).getUserNiceName() != null) {
new_data.add(loadItemList.get(j));
}
}
mAdapter.insertList(new_data);
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
}
@Override
public void onItemClick(LiveBean bean, int position) {
if ("1".equals(bean.getIslive())) {
watchLive(bean, Constants.LIVE_HOME, position);
} else if (bean.getIs_week() != null && bean.getIs_week().equals("1")) {
String url = CommonAppConfig.HOST + bean.getUrl() + "?a=1";
WeekWebViewActivity.forward(mContext, url, true);
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
}
@Override
public void loadData() {
// if (mRefreshView != null) {
// mRefreshView.initData();
// }
}
@Override
public void release() {
MainHttpUtil.cancel(MainHttpConsts.GET_HOME_FOLLOW);
}
@Override
public void onDestroy() {
super.onDestroy();
release();
}
@Override
public void onResume() {
super.onResume();
}
}

View File

@ -0,0 +1,440 @@
package com.yunbao.main.views;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.CommunityDetailsActivity;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.custom.CommonRefreshWaterfallView;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.LiveClassManager;
import com.yunbao.common.manager.OpenAdManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.main.R;
import com.yunbao.main.adapter.MainHomeComAdapter;
import com.yunbao.main.adapter.MainHomeComClassAdapter;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Martin on 2024/3/6.
* MainActivity 社区-热门
*/
public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
private View mShadow;
private View mBtnDismiss;
public static CommonRefreshWaterfallView mRefreshView;
private RecyclerView mClassRecyclerViewTop;
private MainHomeComAdapter mAdapter;
private ObjectAnimator mShowAnimator;
private ObjectAnimator mHideAnimator;
private boolean mBannerShowed;
private List<BannerBean> mBannerList;
private List<WeekListBean> mWeekListBean;
public static ImageView btnUseIco;
private int select = 0;
//是否是首頁
private int intoIndex = 0;
private List<LiveBean> new_data;
private boolean isHave = false;
private Map<String, String> gotoRoomKey = new HashMap<>();
private Dialog mShowLoadingDialog;
private String typeHot;
public MainHomeNewViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_main_home_com_hot;
}
public static int pp;
//显示顶部商城tab时显示底部tabGroup
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("Updata".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
mRefreshView.mRecyclerView.scrollToPosition(0);
}
} else if ("blacklist".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
}
}
}
@Override
public void init() {
List<LiveClassBean> list = new LiveClassManager(mContext).getLiveClass();
if (list != null && !list.isEmpty()) {
typeHot = list.get(0).getEnglish();
select = list.get(0).getId();
}
mShadow = findViewById(R.id.shadow);
mBtnDismiss = findViewById(R.id.btn_dismiss);
mBtnDismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (canClick()) {
if (mShowAnimator != null) {
mShowAnimator.cancel();
}
if (mHideAnimator != null) {
mHideAnimator.start();
}
}
}
});
mRefreshView = (CommonRefreshWaterfallView) findViewById(R.id.refreshView);
btnUseIco = (ImageView) findViewById(R.id.btn_use_ico);
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live);
EventBus.getDefault().register(this);
mAdapter = new MainHomeComAdapter(mContext);
mAdapter.setmOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, CommunityDetailsActivity.class);
mContext.startActivity(intent);
}
});
mAdapter.setOnItemClickListener(MainHomeNewViewHolder.this);
mAdapter.setHasStableIds(true);//
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(mAdapter);
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
@Override
public RefreshAdapter<LiveBean> getAdapter() {
return null;
}
@Override
public void loadData(int p, HttpCallback callback) {
Log.i("t2", "aaa" + p);
if (TextUtils.equals(typeHot, "Hot") || TextUtils.equals(typeHot, "hot") || TextUtils.equals(typeHot, "熱門")) {
pp = 1;
LiveHttpUtil.getAnchorLastWeekList(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (mWeekListBean != null) {
mWeekListBean.clear();
}
if (code == 0 && info.length > 0) {
mWeekListBean = JSON.parseArray(Arrays.toString(info), WeekListBean.class);
} else {
mWeekListBean = null;
}
if (mWeekListBean != null && mWeekListBean.size() > 0) {
isHave = true;
} else {
isHave = false;
}
Constants.getWeekIntIndex = Constants.getWeekIntIndex + 1;
MainHttpUtil.getHot(p, callback);
}
});
} else {
pp = 0;
MainHttpUtil.getClassLive(select, p, callback);
}
}
@Override
public List<LiveBean> processData(String[] info) {
new_data = new ArrayList<>();
if (info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
mBannerList = JSON.parseArray(obj.getString("slide"), BannerBean.class);
if (!obj.containsKey("list")) {
return new_data;
}
List<LiveBean> old_data = JSON.parseArray(obj.getString("list"), LiveBean.class);
LiveBean liveModel = null;
if (old_data == null) {
return new_data;
}
for (LiveBean model : old_data) {
//判断周星榜数据
if (TextUtils.equals(model.getIs_week(), "1")) {
if (mWeekListBean != null && mWeekListBean.size() > 0) {
model.setmWeekList(mWeekListBean);
} else {
liveModel = model;
}
}
}
//满足有周星榜字段但是没有周星榜数据的删掉
if (liveModel != null) {
old_data.remove(liveModel);
}
new_data.addAll(old_data);
}
return new_data;
}
@Override
public void onRefreshSuccess(List<LiveBean> list, int count) {
if (CommonAppConfig.LIVE_ROOM_SCROLL) {
LiveStorge.getInstance().put(Constants.LIVE_HOME, list);
}
EventBus.getDefault().post(new AnchorRecommendModel());
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
new_data = new ArrayList<>();
for (int j = 0; j < loadItemList.size(); j++) {
if (loadItemList.get(j).getUserNiceName() != null) {
new_data.add(loadItemList.get(j));
}
}
if (loadItemList.size() > 0) {
mAdapter.insertList(new_data);
}
}
@Override
public void onLoadMoreFailure() {
}
});
mClassRecyclerViewTop = (RecyclerView) findViewById(R.id.classRecyclerView_top);
mClassRecyclerViewTop.setHasFixedSize(true);
mClassRecyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
if (list != null && list.size() > 0) {
List<LiveClassBean> targetList = new ArrayList<>();
if (list.size() <= 6) {
targetList.addAll(list);
} else {
targetList.addAll(list);
}
final MainHomeComClassAdapter topAdapter = new MainHomeComClassAdapter(mContext, targetList, false);
topAdapter.setOnItemClickListener(new OnItemClickListener<LiveClassBean>() {
@Override
public void onItemClick(LiveClassBean bean, int position) {
switch (bean.getEnglish()) {
case "Hot":
MobclickAgent.onEvent(mContext, "home_page_recommend_hot", "热门");
break;
case "New":
MobclickAgent.onEvent(mContext, "home_page_recommend_new", "新秀");
break;
case "Pretty":
MobclickAgent.onEvent(mContext, "home_page_recommend_pretty", "颜值");
break;
case "Dance":
MobclickAgent.onEvent(mContext, "home_page_recommend_dance", "舞蹈");
break;
case "Mr.Right":
MobclickAgent.onEvent(mContext, "home_page_recommend_mr.right", "男神");
break;
case "Music":
MobclickAgent.onEvent(mContext, "home_page_recommend_music", "音乐");
break;
default:
MobclickAgent.onEvent(mContext, "home_page_recommend_other", "其他");
break;
}
if (!canClick()) {
return;
}
select = bean.getId();
typeHot = bean.getEnglish();
mRefreshView.initData();
topAdapter.choice = position;
topAdapter.notifyDataSetChanged();
}
});
if (mClassRecyclerViewTop != null) {
mClassRecyclerViewTop.setAdapter(topAdapter);
}
}
mRefreshView.initData();
}
private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (liveBean == null) {
return;
}
intoIndex = 1;
if (gotoRoomKey != null && gotoRoomKey.isEmpty()) {
gotoRoomKey = null;
}
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
intoIndex = 1;
RouteUtil.forwardUserHome(mContext, live_id, 0);
}
}
});
}
/**
* Banner双击可能会导致进入两次直播间点击Banner后需要展示加载中动画
*/
private void showLoadingDialog() {
mShowLoadingDialog = DialogUitl.loadingDialog(mContext);
mShowLoadingDialog.show();
}
@Override
public void onItemClick(LiveBean bean, int position) {
if ("1".equals(bean.getIslive())) {
intoIndex = 1;
watchLive(bean, Constants.LIVE_HOME, position);
} else if (bean.getIs_week() != null && bean.getIs_week().equals("1")) {
String url = CommonAppConfig.HOST + bean.getUrl() + "?a=1";
LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (liveBean == null) {
return;
}
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
}
if (!"".endsWith(Constants.mStream)) {
if (MicStatusManager.getInstance().isMic(liveUid)) {
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
}
}
@Override
public void onCheckError(String contextError) {
}
});
} else {
ToastUtil.show(msg);
}
}
});
} else {
intoIndex = 1;
RouteUtil.forwardUserHome(mContext, bean.getUid(), 0);
}
}
@Override
public void loadData() {
}
@Override
public void release() {
MainHttpUtil.cancel(MainHttpConsts.GET_HOT);
if (mHideAnimator != null) {
mHideAnimator.cancel();
}
if (mShowAnimator != null) {
mShowAnimator.cancel();
}
mShowAnimator = null;
mHideAnimator = null;
}
@Override
public void onDestroy() {
super.onDestroy();
release();
}
@Override
public void onResume() {
super.onResume();
OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
}
@Override
public void onPause() {
super.onPause();
if (mShowLoadingDialog != null) {
mShowLoadingDialog.dismiss();
mShowLoadingDialog = null;
}
}
}

View File

@ -0,0 +1,166 @@
package com.yunbao.main.views;
import android.content.Context;
import android.view.ViewGroup;
import androidx.recyclerview.widget.GridLayoutManager;
import com.alibaba.fastjson.JSON;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.CommonRefreshWaterfallView;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.WeekWebViewActivity;
import com.yunbao.main.adapter.MainHomeRemFindComAdapter;
import com.yunbao.main.adapter.MainHomeRemFollLiveAdapter;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.Arrays;
import java.util.List;
/**
* 社区-发现
*/
public class MainHomeRecomComViewHolder extends AbsMainHomeChildViewHolder implements OnItemClickListener<LiveBean> {
private CommonRefreshWaterfallView mRefreshView;
private MainHomeRemFindComAdapter mAdapter;
public MainHomeRecomComViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
}
@Override
protected int getLayoutId() {
return R.layout.view_main_home_com_recom;
}
public static int pp;
//显示顶部商城tab时显示底部tabGroup
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("Updata".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
mRefreshView.mRecyclerView.scrollToPosition(0);
}
}else if ("blacklist".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
}
}
}
@Override
public void init() {
mRefreshView = (CommonRefreshWaterfallView) findViewById(R.id.refreshView);
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_live);
EventBus.getDefault().register(this);
mRefreshView.setRecyclerViewAdapter(mAdapter);
mRefreshView.setDataHelper(new CommonRefreshWaterfallView.DataHelper<LiveBean>() {
@Override
public RefreshAdapter<LiveBean> getAdapter() {
if (mAdapter == null) {
mAdapter = new MainHomeRemFindComAdapter(mContext, MainActivity.Height);
mAdapter.setOnItemClickListener(MainHomeRecomComViewHolder.this);
}
return mAdapter;
}
@Override
public void loadData(int p, HttpCallback callback) {
pp = p;
MainHttpUtil.getRandom(p, callback);
}
@Override
public List<LiveBean> processData(String[] info) {
if(pp == 1){
return JSON.parseArray(Arrays.toString(info), LiveBean.class);
}else{
return null;
}
}
@Override
public void onRefreshSuccess(List<LiveBean> list, int count) {
EventBus.getDefault().post(new AnchorRecommendModel());
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<LiveBean> loadItemList, int loadItemCount) {
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
}
@Override
public void onItemClick(LiveBean bean, int position) {
if ("1".equals(bean.getIslive())) {
watchLive(bean, Constants.LIVE_HOME, position);
}else if(bean.getIs_week()!=null&&bean.getIs_week().equals("1")){
String url = CommonAppConfig.HOST + bean.getUrl()+"?a=1";
WeekWebViewActivity.forward(mContext, url, true);
} else {
RouteUtil.forwardUserHome(mContext, bean.getUid(),0);
}
}
@Override
public void loadData() {
// if (mRefreshView != null) {
// mRefreshView.initData();
// }
}
@Override
public void release() {
MainHttpUtil.cancel(MainHttpConsts.GET_RANDOM);
}
@Override
public void onDestroy() {
super.onDestroy();
release();
}
@Override
public void onResume() {
super.onResume();
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#FF83C6"
android:startColor="#EB6FFF" />
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#FF83C6"
android:startColor="#EB6FFF" />
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="@color/white"
android:startColor="@color/white" />
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>

View File

@ -0,0 +1,302 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/live_info_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<com.yunbao.common.custom.MyRelativeLayout5
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:paddingLeft="5dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:riv_corner_radius="10dp" />
<com.yunbao.common.custom.RatioRoundImageView
android:id="@+id/bgs"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:src="@mipmap/bg_main_item_bottom"
app:ri_ratio="0.5"
app:riv_corner_radius="10dp" />
<ImageView
android:id="@+id/view_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:visibility="gone" />
<ImageView
android:id="@+id/live_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:gravity="center" />
<RelativeLayout
android:id="@+id/views"
android:layout_width="46dp"
android:layout_height="16dp"
android:layout_alignParentRight="true"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:background="@mipmap/live_zt">
<ImageView
android:id="@+id/tv_live_ico"
android:layout_width="5dp"
android:layout_height="5dp"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
android:src="@mipmap/icon_main_rest_work" />
<TextView
android:id="@+id/tv_live_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:paddingLeft="8dp"
android:text="休息"
android:textColor="@color/color_white"
android:textSize="10sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageView
android:id="@+id/type"
android:layout_width="50dp"
android:layout_height="16dp"
android:scaleType="fitXY" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="#fff"
android:textSize="13sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#fff"
android:textSize="10sp" />
<com.yunbao.common.custom.DrawableTextView
android:id="@+id/num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawablePadding="4dp"
android:gravity="center"
android:singleLine="true"
android:textColor="#B3ffffff"
android:textSize="10sp"
android:textStyle="bold"
app:dt_left_drawable="@mipmap/icon_main_live_num"
app:dt_left_height="14dp"
app:dt_left_width="14dp" />
</RelativeLayout>
</LinearLayout>
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/pk_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="50dp"
android:scaleType="centerCrop"
app:riv_border_color="@color/color_white"
app:riv_border_width="0.8dp"
app:riv_corner_radius="2dp" />
<ImageView
android:id="@+id/pk_ico"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="33dp"
android:layout_marginBottom="60dp"
android:src="@mipmap/live_pk" />
<ImageView
android:id="@+id/dr_pk_ico"
android:layout_width="100dp"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:src="@mipmap/multiplayerpk" />
</com.yunbao.common.custom.MyRelativeLayout5>
</LinearLayout>
<LinearLayout
android:id="@+id/lt_week_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<com.yunbao.common.custom.MyRelativeLayout5
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:paddingLeft="5dp">
<ViewFlipper
android:id="@+id/viewflipper_banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:flipInterval="1000"
android:inAnimation="@anim/vice_screen_come_in"
android:outAnimation="@anim/vice_screen_come_out"
android:visibility="gone" />
<ImageView
android:id="@+id/img_week_head"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:background="@color/transparent"
android:src="@mipmap/chat_head_mo"
android:visibility="visible" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/week_svga"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:autoPlay="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#fff"
android:textSize="10sp" />
<com.yunbao.common.custom.DrawableTextView
android:id="@+id/num2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:drawablePadding="4dp"
android:gravity="center"
android:singleLine="true"
android:textColor="#B3ffffff"
android:textSize="10sp"
android:textStyle="bold"
app:dt_left_drawable="@mipmap/icon_main_live_num"
app:dt_left_height="14dp"
app:dt_left_width="14dp" />
</RelativeLayout>
</LinearLayout>
</com.yunbao.common.custom.MyRelativeLayout5>
</LinearLayout>
<com.xj.marqueeview.MarqueeView
android:id="@+id/rv_ranking_list"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_gravity="center"
android:layout_marginLeft="4dp"
android:layout_marginBottom="9dp"
android:background="@drawable/border_f1f1f1"
android:visibility="gone"
app:mvDirection="bottom_to_top"
app:mvInterval="3000">
</com.xj.marqueeview.MarqueeView>
<ImageView
android:id="@+id/red_packet"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="20dp"
android:layout_marginTop="25dp"
android:visibility="gone"
app:srcCompat="@mipmap/icon_red_packet"
tools:visibility="visible" />
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp"
android:paddingRight="5dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/tv_class_name"
android:layout_width="65dp"
android:layout_height="30dp"
android:background="@drawable/bg_main_com_type"
android:gravity="center"
android:text="音乐"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center|bottom"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center"
android:text="關注"
android:textColor="@color/black1"
android:textSize="22dp"
android:textStyle="bold" />
<ImageView
android:id="@+id/index"
android:layout_width="30dp"
android:layout_height="15dp"
android:src="@mipmap/icon_index" />
</LinearLayout>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_main"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginTop="10dp"
android:background="@android:color/transparent"
android:fadingEdge="none"
app:elevation="0dp"
app:layout_behavior="com.yunbao.common.custom.FixAppBarLayoutBehavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:layout_toLeftOf="@id/btn_search"
tools:ignore="NotSibling">
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<ImageView
android:id="@+id/btn_send"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:contentDescription="TODO"
android:onClick="mainClick"
android:padding="9dp"
android:src="@mipmap/icon_main_add" />
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/classRecyclerView_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never" />
<com.yunbao.common.custom.CommonRefreshWaterfallView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="55dp" />
<FrameLayout
android:id="@+id/btn_dismiss"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:visibility="invisible">
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="#80000000" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/classRecyclerView_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:overScrollMode="never"
android:paddingBottom="10dp" />
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<com.yunbao.common.custom.CommonRefreshWaterfallView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginBottom="55dp"
android:layout_marginRight="10dp"/>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB