From 04bc9af501a6abfa7a6a287a2ba30a7806ae5f5d Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Wed, 3 Apr 2024 13:11:10 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E4=BF=AE=E5=A4=8D-bug]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/adapters/ShareAppAdapter.java | 22 +++- .../com/yunbao/share/ui/SharePopDialog.java | 23 +++- common/src/main/AndroidManifest.xml | 6 +- .../com/yunbao/common/CommonAppConfig.java | 10 +- .../common/activity/VideoPlayActivity.java | 40 ++++++ .../com/yunbao/common/bean/ShareBean.java | 47 +++++++ .../com/yunbao/common/http/PDLiveApi.java | 5 + .../common/http/live/LiveNetManager.java | 27 ++++ .../utils/MessageSayHiNotifyManager.java | 6 +- .../background_gift_wall_shape.xml | 0 .../res/layout/activity_community_send.xml | 5 +- .../main/res/layout/activity_google_play.xml | 22 ++++ .../main/res/layout/activity_user_home.xml | 47 ++++++- live/src/main/AndroidManifest.xml | 3 - .../live/activity/VideoPlayActivity.java | 121 ------------------ .../main/res/layout/activity_google_play.xml | 12 -- live/src/main/res/layout/item_main_com.xml | 1 + .../main/activity/CommunitySendActivity.java | 91 +++++++++---- .../main/activity/UserHomeActivity.java | 69 ++++++++-- .../main/views/MainHomeNewViewHolder.java | 2 +- main/src/main/res/layout/view_homemain.xml | 10 +- .../video/adapter/VideoScrollAdapter.java | 51 ++++---- .../yunbao/video/event/VideoFollowEvent.java | 31 +++++ .../com/yunbao/video/http/VideoHttpUtil.java | 15 ++- .../video/views/VideoPlayViewHolder.java | 4 +- .../video/views/VideoPlayWrapViewHolder.java | 28 +++- .../video/views/VideoScrollViewHolder.java | 7 +- .../main/res/layout/view_video_play_wrap.xml | 2 +- 28 files changed, 469 insertions(+), 238 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/activity/VideoPlayActivity.java create mode 100644 common/src/main/java/com/yunbao/common/bean/ShareBean.java rename {live/src/main/res/drawable => common/src/main/res/drawable-xhdpi}/background_gift_wall_shape.xml (100%) create mode 100644 common/src/main/res/layout/activity_google_play.xml delete mode 100644 live/src/main/java/com/yunbao/live/activity/VideoPlayActivity.java delete mode 100644 live/src/main/res/layout/activity_google_play.xml create mode 100644 video/src/main/java/com/yunbao/video/event/VideoFollowEvent.java diff --git a/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java b/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java index 2ec55c8..23fd0aa 100644 --- a/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java +++ b/Share/src/main/java/com/yunbao/share/adapters/ShareAppAdapter.java @@ -31,6 +31,16 @@ public class ShareAppAdapter extends RecyclerView.Adapter list; ShareCallback shareCallback; + private onShareListener onShareListener; + + public ShareAppAdapter.onShareListener getOnShareListener() { + return onShareListener; + } + + public void setOnShareListener(ShareAppAdapter.onShareListener onShareListener) { + this.onShareListener = onShareListener; + } + public ShareAppAdapter(Context mContext) { list = new ArrayList<>(); this.mContext = mContext; @@ -50,7 +60,7 @@ public class ShareAppAdapter extends RecyclerView.Adapter"+builder.getType()); + System.out.println("------type------>" + builder.getType()); switch (builder.getType()) { case ShareBean.APP_FACEBOOK: holder.setData(builder, R.mipmap.icon_share_facebook, R.string.dialog_share_app_facebook); @@ -125,11 +135,17 @@ public class ShareAppAdapter extends RecyclerView.Adapter + tools:replace="allowBackup"> @@ -68,6 +67,9 @@ android:name="com.yunbao.common.activity.PreviewVideoActivity" android:screenOrientation="portrait" /> + diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index 809d5fa..3183184 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -128,23 +128,23 @@ public class CommonAppConfig { newCommunityTypeList.add(type0); } NewCommunityType type17 = new NewCommunityType(); - type17.setId(17); + type17.setId(5); type17.setTalk_name(mContext.getResources().getString(R.string.main_active_type_01)); NewCommunityType type16 = new NewCommunityType(); - type16.setId(16); + type16.setId(4); type16.setTalk_name(mContext.getResources().getString(R.string.main_active_type_02)); NewCommunityType type15 = new NewCommunityType(); - type15.setId(15); + type15.setId(3); type15.setTalk_name(mContext.getResources().getString(R.string.main_active_type_03)); NewCommunityType type14 = new NewCommunityType(); - type14.setId(14); + type14.setId(2); type14.setTalk_name(mContext.getResources().getString(R.string.main_active_type_04)); NewCommunityType type13 = new NewCommunityType(); - type13.setId(13); + type13.setId(1); type13.setTalk_name(mContext.getResources().getString(R.string.main_active_type_05)); newCommunityTypeList.add(type17); diff --git a/common/src/main/java/com/yunbao/common/activity/VideoPlayActivity.java b/common/src/main/java/com/yunbao/common/activity/VideoPlayActivity.java new file mode 100644 index 0000000..98ae3e4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/activity/VideoPlayActivity.java @@ -0,0 +1,40 @@ +package com.yunbao.common.activity; + +import android.net.Uri; +import android.os.Bundle; +import android.view.View; +import android.widget.VideoView; + +import androidx.annotation.Nullable; + +import com.yunbao.common.R; + +public class VideoPlayActivity extends AbsActivity { + private VideoView videoPlay; + + @Override + protected int getLayoutId() { + return R.layout.activity_google_play; + } + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + Uri url = getIntent().getParcelableExtra("videoUri"); + super.onCreate(savedInstanceState); + videoPlay = findViewById(R.id.videoPlay); + videoPlay.setVideoURI(url); + videoPlay.start(); + + findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + } +} \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/bean/ShareBean.java b/common/src/main/java/com/yunbao/common/bean/ShareBean.java new file mode 100644 index 0000000..81362a4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/ShareBean.java @@ -0,0 +1,47 @@ +package com.yunbao.common.bean; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +/** + * 社區动态 + */ +public class ShareBean extends BaseModel implements Parcelable { + private int num; + + public int getNum() { + return num; + } + + public void setNum(int num) { + this.num = num; + } + + protected ShareBean(Parcel in) { + num = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public ShareBean createFromParcel(Parcel in) { + return new ShareBean(in); + } + + @Override + public ShareBean[] newArray(int size) { + return new ShareBean[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + dest.writeInt(num); + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index de489d0..46cb51c 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -73,6 +73,7 @@ import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; +import com.yunbao.common.bean.ShareBean; import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameUserModel; @@ -1302,4 +1303,8 @@ public interface PDLiveApi { Observable>> getUserLiveStatus( @Query("ids")String ids ); + + @GET("/api/public/?service=Pdlcommunity.userClickDynamicShare") + Observable> shareCount(@Query("dynamic_id") String dynamic_id); + } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 70479bf..405c40a 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -73,6 +73,7 @@ import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SetAttentsModel; +import com.yunbao.common.bean.ShareBean; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudRoomListModel; @@ -3541,6 +3542,32 @@ public class LiveNetManager { } }).isDisposed(); } + + public void shreCount(String dynamic_id, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .shareCount(dynamic_id) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel messageUserInfoBeanResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(messageUserInfoBeanResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + + + private MultipartBody.Part createUploadFile(File file) { RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); return MultipartBody.Part.createFormData("file", file.getName(), requestBody); diff --git a/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java b/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java index 484ad14..0eb1813 100644 --- a/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java +++ b/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java @@ -91,7 +91,7 @@ public class MessageSayHiNotifyManager { @Override public void onError(String error) { - Log.e(TAG, "onError: "+error ); + Log.e(TAG, "onError: " + error); } @@ -177,7 +177,9 @@ public class MessageSayHiNotifyManager { return new TimerTask() { @Override public void run() { - timer.cancel(); + if (timer != null) { + timer.cancel(); + } cancel(); Log.i(TAG, "run: 定时器到点,启动下一轮"); next(); diff --git a/live/src/main/res/drawable/background_gift_wall_shape.xml b/common/src/main/res/drawable-xhdpi/background_gift_wall_shape.xml similarity index 100% rename from live/src/main/res/drawable/background_gift_wall_shape.xml rename to common/src/main/res/drawable-xhdpi/background_gift_wall_shape.xml diff --git a/common/src/main/res/layout/activity_community_send.xml b/common/src/main/res/layout/activity_community_send.xml index 0221414..cc0a0df 100644 --- a/common/src/main/res/layout/activity_community_send.xml +++ b/common/src/main/res/layout/activity_community_send.xml @@ -72,10 +72,11 @@ android:layout_marginBottom="20dp" android:visibility="gone"> - + android:layout_height="200dp" + android:scaleType="centerCrop" /> + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activity_user_home.xml b/common/src/main/res/layout/activity_user_home.xml index d5c5050..b7e9ea4 100644 --- a/common/src/main/res/layout/activity_user_home.xml +++ b/common/src/main/res/layout/activity_user_home.xml @@ -282,15 +282,50 @@ android:layout_height="20dp" android:src="@mipmap/icon_wumen" /> - + android:layout_height="20dp" + android:layout_marginLeft="10dp"> - + + + + + + android:layout_height="20dp" + android:layout_marginLeft="10dp"> + + + + + + - \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/activity/VideoPlayActivity.java b/live/src/main/java/com/yunbao/live/activity/VideoPlayActivity.java deleted file mode 100644 index e6b43ed..0000000 --- a/live/src/main/java/com/yunbao/live/activity/VideoPlayActivity.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.yunbao.live.activity; - -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentTransaction; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.google.android.exoplayer2.C; -import com.google.android.exoplayer2.DefaultLoadControl; -import com.google.android.exoplayer2.ExoPlayer; -import com.google.android.exoplayer2.MediaItem; -import com.google.android.exoplayer2.Player; -import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; -import com.google.android.exoplayer2.ui.PlayerView; -import com.google.android.exoplayer2.ui.StyledPlayerView; -import com.lxj.xpopup.XPopup; -import com.makeramen.roundedimageview.RoundedImageView; -import com.yunbao.common.Constants; -import com.yunbao.common.activity.AbsActivity; -import com.yunbao.common.event.GiftWallItemEvent; -import com.yunbao.common.event.LiveGiftDialogEvent; -import com.yunbao.common.fragment.AllServiceChampionFragment; -import com.yunbao.common.fragment.GiftWithoutWallFragment; -import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.utils.Bus; -import com.yunbao.common.utils.L; -import com.yunbao.common.utils.RouteUtil; -import com.yunbao.common.utils.StringUtil; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.views.weight.ViewClicksAntiShake; -import com.yunbao.live.R; -import com.yunbao.live.dialog.CodexDialog; -import com.yunbao.live.dialog.GiftWallItemPopup; -import com.yunbao.live.dialog.MedalAchievementPopup; -import com.yunbao.live.views.GiftAlreadyWallFragment; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.ArrayList; -import java.util.List; - -public class VideoPlayActivity extends AbsActivity { - private PlayerView placeholderView; - private ExoPlayer player1; - - @Override - protected int getLayoutId() { - return R.layout.activity_google_play; - } - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - DefaultLoadControl control = new DefaultLoadControl.Builder() - .setPrioritizeTimeOverSizeThresholds(false) - .setBackBuffer(10_000, true) - .setBufferDurationsMs(500, - 5_000, - 150, - 200) - .build(); - placeholderView = findViewById(R.id.placeholderView); - player1 = new ExoPlayer.Builder(mContext).setLoadControl(control).build(); - player1.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); - placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL); - placeholderView.requestLayout(); - placeholderView.setKeepContentOnPlayerReset(true); - placeholderView.setPlayer(player1); - - placeholderView.setShowRewindButton(false); - placeholderView.setShowFastForwardButton(false); - placeholderView.setShowPreviousButton(false); - placeholderView.setShowNextButton(false); - placeholderView.setShowShuffleButton(false); - placeholderView.setShowMultiWindowTimeBar(false); - placeholderView.setControllerAutoShow(false); - placeholderView.setUseController(false); - - player1.addListener(new Player.Listener() { - @Override - public void onPlaybackStateChanged(int playbackState) { - Player.Listener.super.onPlaybackStateChanged(playbackState); - switch (playbackState) { - case ExoPlayer.STATE_IDLE: - L.e("ExoPlayer.STATE_IDLE-播放器已实例化,但尚未准备就绪。"); - break; - case ExoPlayer.STATE_BUFFERING: - L.e("ExoPlayer.STATE_BUFFERING-播放器无法从当前位置开始播放,因为已缓冲的数据不足。"); - break; - case ExoPlayer.STATE_READY: - L.e("ExoPlayer.STATE_READY-播放器可以立即从当前位置开始播放。这意味着如果播放器的 playWhenReady 属性为 true,播放器将自动开始播放媒体。如果该属性为 false,播放器会暂停播放。"); - break; - case ExoPlayer.STATE_ENDED: - L.e("ExoPlayer.STATE_ENDED-播放器已完成媒体播放。"); - break; - } - } - }); - - player1.setMediaItem(createMediaItem("https://downs.yaoulive.com/userhome/2024-03-29/98918_r3a5urihjf7qmlnkhdr5ak5ir1.MP4")); - player1.prepare(); - player1.play(); - } - - private MediaItem createMediaItem(String url) { - return MediaItem.fromUri(url); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - Bus.getOff(this); - } - -} \ No newline at end of file diff --git a/live/src/main/res/layout/activity_google_play.xml b/live/src/main/res/layout/activity_google_play.xml deleted file mode 100644 index 517f6a5..0000000 --- a/live/src/main/res/layout/activity_google_play.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - \ No newline at end of file diff --git a/live/src/main/res/layout/item_main_com.xml b/live/src/main/res/layout/item_main_com.xml index 9be3fef..3968580 100644 --- a/live/src/main/res/layout/item_main_com.xml +++ b/live/src/main/res/layout/item_main_com.xml @@ -64,6 +64,7 @@ android:id="@+id/author" android:layout_width="30dp" android:layout_height="30dp" + android:scaleType="centerCrop" android:src="@mipmap/user_info_bg" app:riv_corner_radius="15dp" /> diff --git a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java index a7c2883..1ed4772 100644 --- a/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CommunitySendActivity.java @@ -35,6 +35,7 @@ import com.google.gson.Gson; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.activity.VideoPlayActivity; import com.yunbao.common.bean.NewCommunityType; import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.http.CommonHttpUtil; @@ -74,21 +75,20 @@ public class CommunitySendActivity extends AbsActivity { private List uriList = new ArrayList<>(); private File videoFile; private ActiveImageAdapter activeImageAdapter; - private VideoView videoView; + private ImageView videoView; private RelativeLayout videoViewLayout; private ImageView delVideo; private TextView talkContent; private List talkList = new ArrayList<>(); private TextView submit; private boolean isImage; - UploadQnImpl mUploadStrategy; private List imgUrlList = new ArrayList<>(); private String videoUrl; List newCommunityTypeList = new ArrayList<>(); int talkId; - Dialog dialog; + private Uri videoUri; @Override protected int getLayoutId() { @@ -150,7 +150,6 @@ public class CommunitySendActivity extends AbsActivity { @Override public void onClick(View v) { videoFile = null; - videoView.stopPlayback(); videoViewLayout.setVisibility(View.GONE); } }); @@ -242,6 +241,14 @@ public class CommunitySendActivity extends AbsActivity { activeImageAdapter.deleteItem(position); } }); + videoView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(CommunitySendActivity.this, VideoPlayActivity.class); + intent.putExtra("videoUri", videoUri); + startActivity(intent); + } + }); } private void submit() { @@ -388,40 +395,68 @@ public class CommunitySendActivity extends AbsActivity { } isImage = true; } else if (requestCode == CHOOSE_VIDEO && resultCode == RESULT_OK && data != null) { - Uri uri = data.getData(); - videoFile = new File(Objects.requireNonNull(FilesUtils.getPath(mContext, uri))); - videoView.setVideoURI(uri); - videoView.start(); + videoUri = data.getData(); + videoFile = new File(Objects.requireNonNull(FilesUtils.getPath(mContext, videoUri))); + videoView.setImageBitmap(FilesUtils.getVideoThumbnail(videoFile.getPath())); videoViewLayout.setVisibility(View.VISIBLE); isImage = false; } } + int uplaodIndex = 0; + + List uploadBeans; + private void uploadFile(List uploadBeans, boolean isImg) { - if (mUploadStrategy == null) { - mUploadStrategy = new UploadQnImpl(mContext); - } dialog = DialogUitl.loadingDialog(mContext, mContext.getResources().getString(com.yunbao.main.R.string.uploading)); dialog.show(); - mUploadStrategy.upload(uploadBeans, true, new UploadCallback() { - @Override - public void onFinish(List list, boolean success) { - if (!success) { - dialog.dismiss(); - ToastUtil.show(mContext.getResources().getString(com.yunbao.main.R.string.upload_fail)); - return; - } - if (isImage) { - for (int i = 0; i < list.size(); i++) { - imgUrlList.add(list.get(i).getRemoteAccessUrl()); + this.uploadBeans = uploadBeans; + if (uploadBeans != null && !uploadBeans.isEmpty()) { + uploadFile(uploadBeans.get(0), isImg); + } + } + + private void uploadFile(UploadBean uploadBean, boolean isImg) { + if (isImg) { + UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext); + List tempList = new ArrayList<>(); + tempList.add(uploadBean); + mUploadStrategy.upload(tempList, true, new UploadCallback() { + @Override + public void onFinish(List list, boolean success) { + if (!success) { + dialog.dismiss(); + ToastUtil.show(mContext.getResources().getString(com.yunbao.main.R.string.upload_fail)); + return; } - } else { - videoUrl = list.get(0).getRemoteAccessUrl(); + uplaodIndex++; + imgUrlList.add(list.get(0).getRemoteAccessUrl()); + if (uplaodIndex != uploadBeans.size()) { + uploadFile(uploadBeans.get(uplaodIndex), isImg); + } else { + submit(); + } + L.e(new Gson().toJson(list)); } - submit(); - L.e(new Gson().toJson(list)); - } - }, isImg); + }, isImg); + } else { + UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext); + List tempList = new ArrayList<>(); + tempList.add(uploadBeans.get(uplaodIndex)); + mUploadStrategy.upload(tempList, true, new UploadCallback() { + @Override + public void onFinish(List list, boolean success) { + if (!success) { + dialog.dismiss(); + ToastUtil.show(mContext.getResources().getString(com.yunbao.main.R.string.upload_fail)); + return; + } + videoUrl = list.get(0).getRemoteAccessUrl(); + submit(); + L.e(new Gson().toJson(list)); + } + }, isImg); + } } @Override diff --git a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java index 5114747..ef81183 100644 --- a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java @@ -48,6 +48,7 @@ import com.yunbao.common.bean.HomeUserExhibitInfoBean; import com.yunbao.common.bean.HomeUserInfoBean; import com.yunbao.common.bean.LabelBean; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserHomeImgBean; import com.yunbao.common.dialog.ImagePreviewDialog; import com.yunbao.common.glide.ImgLoader; @@ -56,6 +57,7 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.upload.UploadBean; import com.yunbao.common.upload.UploadCallback; import com.yunbao.common.upload.UploadQnImpl; @@ -74,6 +76,8 @@ import com.yunbao.live.views.ShowBigPhoto; import com.yunbao.video.activity.VideoPlayActivity; import com.yunbao.video.utils.VideoStorge; +import org.greenrobot.eventbus.EventBus; + import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -157,6 +161,8 @@ public class UserHomeActivity extends AbsActivity { List beanList = new ArrayList<>(); private UserHomeImgsViewHolder userHomeImgsViewHolder; private Map gotoRoomKey = new HashMap<>(); + private TextView authorNum; + private TextView levelNum; @Override protected int getLayoutId() { @@ -272,8 +278,31 @@ public class UserHomeActivity extends AbsActivity { avatar.setBackground(getResources().getDrawable(R.drawable.bg_live_1)); } ImgLoader.display(UserHomeActivity.this, Integer.parseInt(String.valueOf(userInfo.getUserHomeTopInfo().getUser_sex())) == 0 ? R.mipmap.icon_man_new : R.mipmap.icon_wumen, user_sex); - ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_anchor_img(), authorIcon); - ImgLoader.display(UserHomeActivity.this, userInfo.getUserHomeTopInfo().getUser_level_img(), levelIcon); + + //主播等级 + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + anchorLevel = Integer.parseInt(userInfo.getUserHomeTopInfo().getUser_level_anchor()); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } + } + ImgLoader.display(UserHomeActivity.this, imgUrl, authorIcon); + //用户等级 + List models1 = new NewLevelManager(mContext).getNewLevelModels(); + int anchorLevel1 = 0; + anchorLevel1 = Integer.parseInt(userInfo.getUserHomeTopInfo().getUser_level()); + String imgUrl1 = ""; + for (NewLevelModel newLevelModel : models1) { + if (newLevelModel.getLeveMin() <= anchorLevel1 && anchorLevel1 <= newLevelModel.getLeveMax()) { + imgUrl1 = newLevelModel.getThumb(); + } + } + authorNum.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_level_anchor())); + levelNum.setText(String.valueOf(userInfo.getUserHomeTopInfo().getUser_level())); + ImgLoader.display(UserHomeActivity.this, imgUrl1, levelIcon); if (isAnchor) {//是否是主播 authorIcon.setVisibility(View.VISIBLE); @@ -311,18 +340,35 @@ public class UserHomeActivity extends AbsActivity { tagList.add(userInfo.getUserHomeTopInfo().getHeight() + "cm"); } if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCareer())) { - tagList.add(userInfo.getUserHomeTopInfo().getCareer()); + if (WordUtil.isNewZh()) { + tagList.add(userInfo.getUserHomeTopInfo().getCareer()); + } else { + tagList.add(userInfo.getUserHomeTopInfo().getEn_career()); + } } if (userInfo.getUserHomeTopInfo().getCn_label() != null) { - if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) { - for (int i = 0; i < userInfo.getUserHomeTopInfo().getCn_label().size(); i++) { - if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCn_label().get(i))) { - tagList.add(userInfo.getUserHomeTopInfo().getCn_label().get(i)); + if (WordUtil.isNewZh()) { + if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) { + for (int i = 0; i < userInfo.getUserHomeTopInfo().getCn_label().size(); i++) { + if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getCn_label().get(i))) { + tagList.add(userInfo.getUserHomeTopInfo().getCn_label().get(i)); + } } + myFlowTag.setAdapter(myAdapter); + myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE); + myAdapter.setData(tagList); + } + }else{ + if (userInfo.getUserHomeTopInfo().getCn_label().size() > 0) { + for (int i = 0; i < userInfo.getUserHomeTopInfo().getEn_label().size(); i++) { + if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getEn_label().get(i))) { + tagList.add(userInfo.getUserHomeTopInfo().getEn_label().get(i)); + } + } + myFlowTag.setAdapter(myAdapter); + myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE); + myAdapter.setData(tagList); } - myFlowTag.setAdapter(myAdapter); - myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE); - myAdapter.setData(tagList); } } if (!StringUtil.isEmpty(userInfo.getUserHomeTopInfo().getFans_name())) { @@ -450,6 +496,8 @@ public class UserHomeActivity extends AbsActivity { } private void initView() { + authorNum = findViewById(R.id.authorlNum); + levelNum = findViewById(R.id.levelNum); fanName = findViewById(R.id.fanName); bottomEditLayout = findViewById(R.id.bottomEditLayout); imgUp = findViewById(R.id.imgUp); @@ -554,6 +602,7 @@ public class UserHomeActivity extends AbsActivity { followName.setTextColor(getResources().getColor(R.color.white)); followLayout.setBackground(getResources().getDrawable(R.drawable.bg_main_com_type)); } + EventBus.getDefault().post(""); } }); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeNewViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeNewViewHolder.java index 4985bd0..b5a99ff 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeNewViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeNewViewHolder.java @@ -255,7 +255,7 @@ public class MainHomeNewViewHolder extends AbsMainHomeChildViewHolder implements VideoPlayActivity.forward(mContext, playPosition, Constants.VIDEO_HOME, 1); } - /*Intent intent = new Intent(mContext, com.yunbao.live.activity.VideoPlayActivity.class); + /*Intent intent = new Intent(mContext, com.yunbao.common.activity.VideoPlayActivity.class); mContext.startActivity(intent);*/ } diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index f3feeeb..49e06c8 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -38,7 +38,8 @@ android:id="@+id/tab_group" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="horizontal"> + android:orientation="horizontal" + android:paddingTop="5dp"> + android:visibility="visible" /> () { + @Override + public void onSuccess(com.yunbao.common.bean.ShareBean data) { + if (data.getNum() != 0) { + EventBus.getDefault().post(new VideoShareEvent(mVideoBean.getId(), String.valueOf(data.getNum()))); + } + } + + @Override + public void onError(String error) { + + } + }); + } + }); } public void release() { diff --git a/video/src/main/java/com/yunbao/video/views/VideoScrollViewHolder.java b/video/src/main/java/com/yunbao/video/views/VideoScrollViewHolder.java index 60d8010..6e001a4 100644 --- a/video/src/main/java/com/yunbao/video/views/VideoScrollViewHolder.java +++ b/video/src/main/java/com/yunbao/video/views/VideoScrollViewHolder.java @@ -11,14 +11,12 @@ import android.view.ViewGroup; import com.umeng.analytics.MobclickAgent; import com.yunbao.common.bean.ActiveBean; -import com.yunbao.common.bean.CommentBean; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.video.R; import com.yunbao.video.activity.AbsVideoPlayActivity; import com.yunbao.video.adapter.VideoScrollAdapter; import com.yunbao.common.bean.VideoBean; -import com.yunbao.video.bean.VideoCommentBean; import com.yunbao.video.custom.VideoLoadingBar; import com.yunbao.video.event.VideoCommentEvent; import com.yunbao.video.event.VideoLikeEvent; @@ -279,6 +277,11 @@ public class VideoScrollViewHolder extends AbsViewHolder implements VideoScrollA } } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onVideoUserFollow() { + + } + /** * 分享数发生变化 */ diff --git a/video/src/main/res/layout/view_video_play_wrap.xml b/video/src/main/res/layout/view_video_play_wrap.xml index 5f753e0..541e352 100644 --- a/video/src/main/res/layout/view_video_play_wrap.xml +++ b/video/src/main/res/layout/view_video_play_wrap.xml @@ -42,7 +42,7 @@ android:layout_width="20dp" android:layout_height="20dp" android:layout_centerHorizontal="true" - android:layout_marginTop="36dp" + android:layout_marginTop="38dp" android:padding="3dp" android:visibility="visible" />