热门顶部菜单UI调整完成

This commit is contained in:
ningwenqiang 2024-10-29 17:01:27 +08:00
parent 1e72c08ccc
commit 0f0ede4040
36 changed files with 172 additions and 86 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

View File

@ -78,4 +78,9 @@
<color name="gray_f6f7fb">#F6F7FB</color>
<color name="gray_F4F4F4">#F4F4F4</color>
<color name="color_111111">#111111</color>
<color name="color_8a8a8a">#8A8A8A</color>
<color name="color_3d3d3d">#3D3D3D</color>
</resources>

View File

@ -133,6 +133,7 @@ import com.yunbao.main.utils.UserInfoManager;
import com.yunbao.main.views.FloatBannerView;
import com.yunbao.main.views.MainHomeComViewHolder;
import com.yunbao.main.views.MainHomeCommunityViewHolder;
import com.yunbao.main.views.MainHomeGameViewHolder;
import com.yunbao.main.views.MainHomeLiveViewHolder;
import com.yunbao.main.views.MainHomeViewHolder;
import com.yunbao.main.views.MainMeViewHolder;
@ -181,6 +182,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private MainHomeComViewHolder mainHomeComViewHolder;
private MainHomeViewHolder mainHomeViewHolder;
private MainHomeCommunityViewHolder mMainHomeCommunityViewHolder;
private MainHomeGameViewHolder mainHomeGameLiveViewHolder;
private MainMessageViewHolder mainMessageViewHolder;
private MainMeViewHolder mMeViewHolder;
private AbsMainViewHolder[] mViewHolders;
@ -352,7 +354,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
waitingTip = findViewById(R.id.waiting_tip);
mViewPager.setOffscreenPageLimit(4);
mViewList = new ArrayList<>();
for (int i = 0; i < 4; i++) {
for (int i = 0; i < 5; i++) {
FrameLayout frameLayout = new FrameLayout(mContext);
frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mViewList.add(frameLayout);
@ -389,13 +391,22 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
break;
case 2:
MobclickAgent.onEvent(mContext, "game", "游戏");
if (mMainHomeCommunityViewHolder != null) {
mMainHomeCommunityViewHolder.onPauseVideo();
}
if (anchorRecommendModel != null && anchorRecommendModel.getList().size() > 2) {
floatBanner.setVisibility(View.GONE);
}
break;
case 3:
MobclickAgent.onEvent(mContext, "information", "消息");
if (mMainHomeCommunityViewHolder != null) {
mMainHomeCommunityViewHolder.onPauseVideo();
}
floatBanner.setVisibility(View.GONE);
break;
case 3:
case 4:
MobclickAgent.onEvent(mContext, "my", "我的");
if (mMainHomeCommunityViewHolder != null) {
mMainHomeCommunityViewHolder.onPauseVideo();
@ -439,7 +450,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
});
mTabButtonGroup.setViewPager(mViewPager);
mViewHolders = new AbsMainViewHolder[4];
mViewHolders = new AbsMainViewHolder[5];
mDp70 = DpUtil.dp2px(70);
mBottom = findViewById(R.id.bottom);
mUpAnimator = ObjectAnimator.ofFloat(mBottom, "translationY", mDp70, 0);
@ -561,7 +572,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (index == 1) {
isfloatBannernet = true;
initAnchorRecommendBanner();
} else if (index == 2) {
} else if (index == 3) {
floatBanner.setVisibility(View.GONE);
floatRedPacket.setVisibility(View.GONE);
floatWarOrder.setVisibility(View.GONE);
@ -1296,13 +1307,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
/* mMainHomeCommunityViewHolder = new MainHomeCommunityViewHolder(mContext, parent, this);//直播
vh = mMainHomeCommunityViewHolder;*/
} else if (position == 2) {
mainHomeGameLiveViewHolder = new MainHomeGameViewHolder(this, parent);
vh = mainHomeGameLiveViewHolder;
}else if (position == 3) {
mainMessageViewHolder = new MainMessageViewHolder(this, parent);
vh = mainMessageViewHolder;
} else if (position == 3) {
} else if (position == 4) {
mMeViewHolder = new MainMeViewHolder(mContext, parent);
vh = mMeViewHolder;
}
if (vh == null) {
return;
@ -1563,8 +1576,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onInstructorOperationEvent(InstructorOperationEvent event) {
//跳转消息列表
if (mViewPager != null) {
mViewPager.setCurrentItem(2);
mTabButtonGroup.setCurPosition(2);
mViewPager.setCurrentItem(3);
mTabButtonGroup.setCurPosition(3);
mainMessageViewHolder.setHomeZdyPop(NoviceInstructorManager.get(this).getHomeZdyPop());
}
}

View File

@ -3,6 +3,7 @@ package com.yunbao.main.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
@ -10,6 +11,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.NewCommunityType;
@ -96,11 +98,13 @@ public class MainHomeComClassAdapter extends RecyclerView.Adapter<MainHomeComCla
}
if (position == choice) {
mName.setBackgroundResource(R.drawable.bg_main_community_type_01);
mName.setTextColor(Color.parseColor("#FFFFFF"));
//mName.setBackgroundResource(R.drawable.bg_main_community_type_01);
mName.setTextColor(ContextCompat.getColor(mContext, R.color.color_3d3d3d));
mName.setTypeface(null, Typeface.BOLD);
} else {
mName.setBackgroundResource(R.drawable.bg_main_community_type_02);
mName.setTextColor(Color.parseColor("#777777"));
//mName.setBackgroundResource(R.drawable.bg_main_community_type_02);
mName.setTextColor(ContextCompat.getColor(mContext, R.color.color_8a8a8a));
mName.setTypeface(null, Typeface.NORMAL);
}
}
}

View File

@ -2,12 +2,14 @@ package com.yunbao.main.views;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
@ -52,7 +54,7 @@ public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
private boolean mPaused;
protected List<FrameLayout> mViewList;
private int mAppLayoutOffestY;
private List<ImageView> simplePagerTitleViewList;
private List<View> simplePagerTitleViewList;
private List<TextView> textViewList;
public AbsMainHomeParentComViewHolder(Context context, ViewGroup parentView) {
@ -63,10 +65,14 @@ public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
for (int i = 0; i < simplePagerTitleViewList.size(); i++) {
if (index == i) {
simplePagerTitleViewList.get(i).setVisibility(View.VISIBLE);
textViewList.get(i).setTextSize(22);
textViewList.get(i).setTextColor(ContextCompat.getColor(mContext,R.color.color_111111));
//设置 android:textStyle="bold"
textViewList.get(i).setTypeface(null, Typeface.BOLD);
} else {
simplePagerTitleViewList.get(i).setVisibility(View.INVISIBLE);
textViewList.get(i).setTextSize(16);
textViewList.get(i).setTextColor(ContextCompat.getColor(mContext,R.color.color_8a8a8a));
//设置为正常字体
textViewList.get(i).setTypeface(null, Typeface.NORMAL);
}
}
}
@ -157,7 +163,7 @@ public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
CommonPagerTitleView commonPagerTitleView = new CommonPagerTitleView(mContext);
commonPagerTitleView.setContentView(R.layout.simple_pager_title_layout);
// 初始化
final ImageView titleImg = (ImageView) commonPagerTitleView.findViewById(R.id.index);
final View titleImg = commonPagerTitleView.findViewById(R.id.index);
final TextView titleText = (TextView) commonPagerTitleView.findViewById(R.id.title);
titleText.setText(titles[index]);
@ -168,7 +174,7 @@ public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
if (index == 3) {
return;
}
titleText.setTextSize(22);
// titleText.setTextSize(22);
}
@Override
@ -176,7 +182,7 @@ public abstract class AbsMainHomeParentComViewHolder extends AbsMainViewHolder {
if (index == 3) {
return;
}
titleText.setTextSize(16);
//titleText.setTextSize(16);
}
@Override

View File

@ -35,6 +35,7 @@ public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder {
private MainHomeNewViewHolder mainHomeLiveViewHolder;
private MainHomeRecomComViewHolder mainHomeRecomComViewHolder;
private MainHomeGameViewHolder mainHomeGameLiveViewHolder;
private final String mPageName = "home_page";
private TextView tvPlay;
private ImageView btnSend;
@ -59,7 +60,7 @@ public class MainHomeComViewHolder extends AbsMainHomeParentComViewHolder {
@Override
public void init() {
super.init();
btnSend = (ImageView) findViewById(R.id.btn_send);
btnSend = (ImageView) findViewById(R.id.cameraImg);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp"
android:paddingBottom="10dp">
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_class_name"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="@drawable/bg_main_com_type"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="音乐"
android:textColor="@color/white"
android:textSize="13sp" />
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:textColor="@color/color_3d3d3d"
android:textSize="14sp" />
</LinearLayout>
</FrameLayout>

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_height="44dp"
android:gravity="center|bottom"
android:orientation="vertical">
@ -13,15 +14,16 @@
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center"
android:text="關注"
tools:text="關注"
android:textColor="@color/black1"
android:textSize="22dp"
android:textSize="16dp"
android:textStyle="bold" />
<ImageView
android:layout_marginBottom="4dp"
android:id="@+id/index"
android:layout_width="30dp"
android:layout_height="15dp"
android:src="@mipmap/icon_index" />
android:layout_width="12dp"
android:layout_height="6dp"
android:src="@mipmap/ic_yola_item_select" />
</LinearLayout>

View File

@ -10,63 +10,115 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_height="44dp"
android:layout_marginTop="20dp"
android:background="@android:color/transparent"
android:fadingEdge="none"
app:elevation="0dp"
app:layout_behavior="com.yunbao.common.custom.FixAppBarLayoutBehavior">
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways">
android:layout_height="match_parent">
<RelativeLayout
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="wrap_content"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tvPlay"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_toRightOf="@+id/indicator"
android:gravity="center"
android:paddingTop="1dp"
android:text="@string/main_type_theater"
android:textColor="@color/black1"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="@+id/indicator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<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>
android:id="@+id/searchImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:padding="7dp"
android:src="@mipmap/ic_yola_search"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/cameraImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:padding="7dp"
android:src="@mipmap/ic_yola_camera"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="@string/main_type_theater"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/indicator"
app:layout_constraintTop_toTopOf="parent"
tools:textColor="#8A8A8A" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:layout_scrollFlags="scroll|enterAlways">-->
<!-- <RelativeLayout-->
<!-- 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">-->
<!--&lt;!&ndash; <net.lucode.hackware.magicindicator.MagicIndicator&ndash;&gt;-->
<!--&lt;!&ndash; android:id="@+id/indicator"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_width="wrap_content"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_height="match_parent" />&ndash;&gt;-->
<!-- <TextView-->
<!-- android:id="@+id/tvPlay"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginLeft="10dp"-->
<!-- android:layout_marginTop="6dp"-->
<!-- android:layout_toRightOf="@+id/indicator"-->
<!-- android:gravity="center"-->
<!-- android:paddingTop="1dp"-->
<!-- android:text="@string/main_type_theater"-->
<!-- android:textColor="@color/black1"-->
<!-- android:textSize="16dp"-->
<!-- android:textStyle="bold" />-->
<!-- </RelativeLayout>-->
<!-- <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>

View File

@ -2,12 +2,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/classRecyclerView_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_height="40dp"
tools:itemCount="1"
tools:listitem="@layout/item_main_home_com_class"
android:overScrollMode="never" />
<com.yunbao.common.custom.CommonRefreshWaterfallView

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB