From 5dc6ee197dea552462e5a58d558ee3e1d5be7d5b Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 23 Aug 2022 15:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=88=96=E8=80=85=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=9B=E5=85=A5=E5=AF=86=E7=A0=81=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E8=A6=81=E8=BE=93=E4=B8=A4=E6=AC=A1=E5=AF=86?= =?UTF-8?q?=E7=A0=81=20=E4=B8=BB=E6=92=AD=E5=90=8D=E7=A7=B0=E7=BC=A9?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAudienceActivity.java | 8 ++- .../live/dialog/SidebarLiveAudience.java | 2 +- .../com/yunbao/live/views/LoadingView.java | 61 +++++++++++++++++++ .../main/res/layout/activity_live_detail.xml | 5 ++ 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/views/LoadingView.java diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index c6f57b255..3c3071e54 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -29,7 +29,6 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; import com.yunbao.common.dialog.LiveChargeDialogFragment; -import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; @@ -52,6 +51,7 @@ import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment; +import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.SidebarLiveAudience; import com.yunbao.live.event.LinkMicTxAccEvent; @@ -63,6 +63,7 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.LiveRoomPlayViewHolder; +import com.yunbao.live.views.LoadingView; import com.yunbao.live.views.PortraitLiveManager; import org.greenrobot.eventbus.Subscribe; @@ -119,6 +120,7 @@ public class LiveAudienceActivity extends LiveActivity { private int mLastPosition = -1; private ViewGroup mViewGroup; + private LoadingView loadingView; @Override @@ -160,7 +162,8 @@ public class LiveAudienceActivity extends LiveActivity { private void initView() { // 竖直滑动 ViewPager verticalViewPager = findViewById(R.id.view_pager); - + loadingView = findViewById(R.id.loading); + loadingView.show(); } public void setBackIndex(int backIndex) { @@ -202,6 +205,7 @@ public class LiveAudienceActivity extends LiveActivity { } mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext); verticalViewPager.setAdapter(mPagerAdapter); + loadingView.hide(); } @Override diff --git a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java index df43c3bbd..ec4a699e1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java +++ b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java @@ -134,7 +134,7 @@ public class SidebarLiveAudience extends AbsDialogFragment { @Override protected void setWindowAttributes(Window window) { - + getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setWindowAnimations(com.yunbao.common.R.style.RightLeftToAnim); WindowManager.LayoutParams params = window.getAttributes(); params.width = DeviceUtils.getScreenWidth(getActivity()) / 3 * 2; diff --git a/live/src/main/java/com/yunbao/live/views/LoadingView.java b/live/src/main/java/com/yunbao/live/views/LoadingView.java new file mode 100644 index 000000000..6f8d7209c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/LoadingView.java @@ -0,0 +1,61 @@ +package com.yunbao.live.views; + +import android.content.Context; +import android.graphics.drawable.AnimationDrawable; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.yunbao.live.R; + + +public class LoadingView extends FrameLayout { + + private Context mContext; + private ImageView mIvLoading; + + public LoadingView(@NonNull Context context) { + super(context); + init(context); + } + + public LoadingView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(context); + } + + public LoadingView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(context); + } + + private void init(Context context) { + this.mContext = context; + View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_live_item, this, true); + mIvLoading = view.findViewById(R.id.iv_loading); + } + + + public void show() { + // 加载动画 + ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading); + AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); + frameAnimation.start(); + + setVisibility(VISIBLE); + } + + public void hide() { + // 加载动画 + ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading); + AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); + frameAnimation.stop(); + setVisibility(GONE); + } + +} diff --git a/live/src/main/res/layout/activity_live_detail.xml b/live/src/main/res/layout/activity_live_detail.xml index 4eedf5c79..bf7edf6a4 100644 --- a/live/src/main/res/layout/activity_live_detail.xml +++ b/live/src/main/res/layout/activity_live_detail.xml @@ -9,5 +9,10 @@ android:layout_height="match_parent" android:overScrollMode="never" /> + \ No newline at end of file