Browse Source

增加学生端首页直播中动画效果

Pq 2 years ago
parent
commit
4488409a7e

+ 1 - 0
BaseLibrary/src/main/res/values/colors.xml

@@ -152,5 +152,6 @@
     <color name="color_fb5e32">#FB5E32</color>
     <color name="color_cccccc">#CCCCCC</color>
     <color name="color_fef9f4">#fef9f4</color>
+    <color name="color_33000000">#33000000</color>
 
 </resources>

+ 8 - 0
student/src/main/java/com/cooleshow/student/adapter/HomeRecommendTalentAdapter.java

@@ -2,8 +2,10 @@ package com.cooleshow.student.adapter;
 
 import android.text.TextUtils;
 import android.view.View;
+import android.view.animation.Animation;
 import android.widget.ImageView;
 
+import com.airbnb.lottie.LottieAnimationView;
 import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.viewholder.BaseViewHolder;
 import com.cooleshow.base.utils.GlideUtils;
@@ -32,10 +34,16 @@ public class HomeRecommendTalentAdapter extends BaseQuickAdapter<RecommendTalent
         holder.setText(R.id.tv_tip, TextUtils.isEmpty(data.graduateSchool) ? "认证达人" : data.graduateSchool);
         //是否直播中
         View tv_live_tip = holder.getView(R.id.tv_live_tip);
+        LottieAnimationView view_live_anim = holder.getView(R.id.view_live_anim);
         if (data.living) {
+            view_live_anim.setVisibility(View.VISIBLE);
+            view_live_anim.playAnimation();
             tv_live_tip.setVisibility(View.VISIBLE);
         } else {
+            view_live_anim.pauseAnimation();
+            view_live_anim.setVisibility(View.GONE);
             tv_live_tip.setVisibility(View.GONE);
         }
+
     }
 }

+ 11 - 0
student/src/main/java/com/cooleshow/student/adapter/HomeTalentStyleAdapter.java

@@ -6,6 +6,7 @@ import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.airbnb.lottie.LottieAnimationView;
 import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.viewholder.BaseViewHolder;
 import com.cooleshow.base.utils.GlideUtils;
@@ -56,10 +57,20 @@ public class HomeTalentStyleAdapter extends BaseQuickAdapter<HomeStyleBean.RowsB
         //昵称
         holder.setText(R.id.tv_name, data.username);
         TextView tv_tip = holder.getView(R.id.tv_tip);
+        View tv_live_anim_tip = holder.getView(R.id.tv_live_anim_tip);
+        LottieAnimationView iv_live_anim = holder.getView(R.id.iv_live_anim);
         if (isLiving) {
+            tv_tip.setVisibility(View.VISIBLE);
+            tv_live_anim_tip.setVisibility(View.VISIBLE);
+            iv_live_anim.setVisibility(View.VISIBLE);
+            iv_live_anim.playAnimation();
             tv_tip.setText("正在直播");
             tv_tip.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_ff0000));
         } else {
+            tv_tip.setVisibility(View.GONE);
+            tv_live_anim_tip.setVisibility(View.GONE);
+            iv_live_anim.pauseAnimation();
+            iv_live_anim.setVisibility(View.GONE);
             tv_tip.setText(String.format("%d人观看", data.browse));
             tv_tip.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
         }

+ 4 - 3
student/src/main/java/com/cooleshow/student/ui/main/NewHomeFragment.java

@@ -219,9 +219,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         presenter.userAccountPage();
         //获取热门曲目
         presenter.getHotMusicSheetList();
-        //获取推荐达人列表
-        presenter.getRecommendTalentList();
-
     }
 
     private void initListener() {
@@ -359,8 +356,12 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         super.onResume();
         if (presenter != null) {
             presenter.appHome();
+            //获取课程信息
             presenter.queryLiveAndVideo();
+            //获取达人风采
             presenter.getTalentStyle();
+            //获取推荐达人列表
+            presenter.getRecommendTalentList();
         }
     }
 

+ 18 - 4
student/src/main/res/layout/item_home_recommend_talent_layot.xml

@@ -4,8 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="110dp"
     android:layout_height="wrap_content"
-    android:paddingBottom="16dp"
-    android:background="@drawable/shape_10dp_white">
+    android:background="@drawable/shape_10dp_white"
+    android:paddingBottom="16dp">
 
     <de.hdodenhof.circleimageview.CircleImageView
         android:id="@+id/iv_avatar"
@@ -70,12 +70,26 @@
         android:ellipsize="end"
         android:includeFontPadding="false"
         android:maxLines="1"
-        android:textColor="@color/color_999999"
-        android:textSize="@dimen/sp_12"
         android:paddingStart="5dp"
         android:paddingEnd="5dp"
+        android:textColor="@color/color_999999"
+        android:textSize="@dimen/sp_12"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_name"
         tools:text="中国音乐学院中国音乐学院" />
+
+    <com.airbnb.lottie.LottieAnimationView
+        android:id="@+id/view_live_anim"
+        android:layout_width="14dp"
+        android:layout_height="14dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="8dp"
+        android:visibility="gone"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:lottie_autoPlay="false"
+        app:lottie_loop="true"
+        app:lottie_rawRes="@raw/home_recommend_talent_anim" />
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 34 - 1
student/src/main/res/layout/item_home_talent_style_layout.xml

@@ -4,8 +4,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_marginTop="5dp"
     android:layout_marginStart="6dp"
+    android:layout_marginTop="5dp"
     android:layout_marginEnd="6dp"
     android:layout_marginBottom="7dp"
     android:background="@drawable/bg_white_10dp"
@@ -75,4 +75,37 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="@+id/iv_avatar"
         tools:text="1112人观看" />
+
+    <View
+        android:id="@+id/view_live_bg"
+        android:layout_width="60dp"
+        android:layout_height="24dp"
+        android:layout_marginTop="15dp"
+        android:background="@color/color_33000000"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_live_anim_tip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="直播中"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintBottom_toBottomOf="@+id/view_live_bg"
+        app:layout_constraintLeft_toRightOf="@+id/iv_live_anim"
+        app:layout_constraintRight_toRightOf="@+id/view_live_bg"
+        app:layout_constraintTop_toTopOf="@+id/view_live_bg" />
+
+    <com.airbnb.lottie.LottieAnimationView
+        android:id="@+id/iv_live_anim"
+        android:layout_width="24dp"
+        android:layout_height="24dp"
+        android:layout_marginEnd="48dp"
+        app:layout_constraintBottom_toBottomOf="@+id/view_live_bg"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/view_live_bg"
+        app:lottie_autoPlay="false"
+        app:lottie_loop="true"
+        app:lottie_rawRes="@raw/home_talent_style_live_anim" />
 </androidx.constraintlayout.widget.ConstraintLayout>

File diff suppressed because it is too large
+ 0 - 0
student/src/main/res/raw/home_recommend_talent_anim.json


File diff suppressed because it is too large
+ 0 - 0
student/src/main/res/raw/home_talent_style_live_anim.json


BIN
teacher/src/main/res/drawable-xhdpi/icon_main_reverse_camera.png


BIN
teacher/src/main/res/drawable-xxhdpi/icon_main_reverse_camera.png


+ 1 - 1
teacher/src/main/res/layout/activity_create_live.xml

@@ -245,7 +245,7 @@
                 android:drawableTop="@drawable/icon_upload_cover_tip"
                 android:drawablePadding="14dp"
                 android:includeFontPadding="false"
-                android:text="上传直播封面"
+                android:text="点击上传直播封面"
                 android:textColor="@color/color_999999"
                 android:textSize="@dimen/sp_14" />
 

+ 2 - 2
teacher/src/main/res/layout/view_live_room_main_layout.xml

@@ -90,11 +90,11 @@
 
         <ImageView
             android:id="@+id/main_iv_reverse_camera"
-            android:layout_marginEnd="5dp"
+            android:layout_marginEnd="10dp"
             app:layout_constraintRight_toLeftOf="@+id/ll_member_num_bg"
             app:layout_constraintBottom_toBottomOf="@+id/ll_member_num_bg"
             app:layout_constraintTop_toTopOf="@+id/ll_member_num_bg"
-            android:src="@drawable/icon_live_reverse_camera"
+            android:src="@drawable/icon_main_reverse_camera"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"/>
 

Some files were not shown because too many files changed in this diff