Merge remote-tracking branch 'origin/dev_改版主分支-升级融云SDK&AGP8' into dev_改版主分支-升级融云SDK&AGP8

This commit is contained in:
zlzw 2024-04-03 13:45:28 +08:00
commit 47a3ba6b78
28 changed files with 469 additions and 238 deletions

View File

@ -31,6 +31,16 @@ public class ShareAppAdapter extends RecyclerView.Adapter<ShareAppAdapter.AppVie
private List<ShareBean> 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<ShareAppAdapter.AppVie
@Override
public void onBindViewHolder(@NonNull AppViewHolder holder, int position) {
ShareBean builder = list.get(position);
System.out.println("------type------>"+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<ShareAppAdapter.AppVie
new Internal(itemView.getContext()).share(bean, shareCallback);
break;
}
if (onShareListener != null) {
onShareListener.onAddShareCount();
}
});
}
}
public interface onShareListener {
void onAddShareCount();
}
public static class ShareCallback implements ICallback {
@Override

View File

@ -40,21 +40,26 @@ public class SharePopDialog extends AbsDialogPopupWindow {
private String shareLink;
private int type;
private ShareBean bean;
public onShareListener onShareListener;
public void setOnShareListener(SharePopDialog.onShareListener onShareListener) {
this.onShareListener = onShareListener;
}
public SharePopDialog(@NonNull Context context) {
super(context);
}
public SharePopDialog setShareType(int type) {
this.type = type;
return this;
}
public SharePopDialog setShareData(ShareBean build) {
this.bean=build;
this.bean = build;
return this;
}
public SharePopDialog setShareLink(String link) {
this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
return this;
@ -87,6 +92,14 @@ public class SharePopDialog extends AbsDialogPopupWindow {
dismiss();
}
});
adapter.setOnShareListener(new ShareAppAdapter.onShareListener() {
@Override
public void onAddShareCount() {
if (onShareListener != null) {
onShareListener.onShareAddCount();
}
}
});
list.setLayoutManager(new GridLayoutManager(getContext(), 3));
list.setAdapter(adapter);
initData();
@ -114,7 +127,7 @@ public class SharePopDialog extends AbsDialogPopupWindow {
url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
link.setText(url);
info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(bean.getAnchorName()) ? "" : bean.getAnchorName()));
ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar);
ImgLoader.display(getContext(), bean.getAnchorAvatar(), avatar);
}
private ShareBean builder(int type) {
@ -137,4 +150,8 @@ public class SharePopDialog extends AbsDialogPopupWindow {
ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success));
}
public interface onShareListener {
void onShareAddCount();
}
}

View File

@ -7,8 +7,7 @@
<application
android:allowBackup="true"
tools:replace="allowBackup"
>
tools:replace="allowBackup">
<!-- <meta-data-->
<!-- android:name="com.google.ar.core"-->
@ -68,6 +67,9 @@
android:name="com.yunbao.common.activity.PreviewVideoActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yunbao.common.activity.VideoPlayActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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<ShareBean> CREATOR = new Creator<ShareBean>() {
@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);
}
}

View File

@ -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<ResponseModel<List<Integer>>> getUserLiveStatus(
@Query("ids")String ids
);
@GET("/api/public/?service=Pdlcommunity.userClickDynamicShare")
Observable<ResponseModel<ShareBean>> shareCount(@Query("dynamic_id") String dynamic_id);
}

View File

@ -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<ShareBean> callback) {
API.get().pdLiveApi(mContext)
.shareCount(dynamic_id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<ShareBean>>() {
@Override
public void accept(ResponseModel<ShareBean> messageUserInfoBeanResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(messageUserInfoBeanResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@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);

View File

@ -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();

View File

@ -72,10 +72,11 @@
android:layout_marginBottom="20dp"
android:visibility="gone">
<VideoView
<ImageView
android:id="@+id/videoView"
android:layout_width="200dp"
android:layout_height="200dp" />
android:layout_height="200dp"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/delVideo"

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<VideoView
android:id="@+id/videoPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/back"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:padding="10dp"
android:src="@mipmap/icon_left" />
</RelativeLayout>

View File

@ -282,15 +282,50 @@
android:layout_height="20dp"
android:src="@mipmap/icon_wumen" />
<ImageView
android:id="@+id/authorlIcon"
<RelativeLayout
android:id="@+id/authorIconLayout"
android:layout_width="50dp"
android:layout_height="20dp" />
android:layout_height="20dp"
android:layout_marginLeft="10dp">
<ImageView
android:id="@+id/levelIcon"
<ImageView
android:id="@+id/authorlIcon"
android:layout_width="50dp"
android:layout_height="20dp" />
<TextView
android:id="@+id/authorlNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="25dp"
android:text="1"
android:textColor="@color/white"
android:textSize="11dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/levelIconLayout"
android:layout_width="50dp"
android:layout_height="20dp" />
android:layout_height="20dp"
android:layout_marginLeft="10dp">
<ImageView
android:id="@+id/levelIcon"
android:layout_width="50dp"
android:layout_height="20dp" />
<TextView
android:id="@+id/levelNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="25dp"
android:text="1"
android:textColor="@color/white"
android:textSize="11dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/userPresidentLayout"

View File

@ -124,9 +124,6 @@
android:name=".activity.CompensateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.VideoPlayActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -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);
}
}

View File

@ -1,12 +0,0 @@
<?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"
android:background="@drawable/background_gift_wall_shape"
android:orientation="vertical">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/placeholderView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@ -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" />

View File

@ -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<Uri> 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<String> talkList = new ArrayList<>();
private TextView submit;
private boolean isImage;
UploadQnImpl mUploadStrategy;
private List<String> imgUrlList = new ArrayList<>();
private String videoUrl;
List<NewCommunityType> 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<UploadBean> uploadBeans;
private void uploadFile(List<UploadBean> 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<UploadBean> 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<UploadBean> tempList = new ArrayList<>();
tempList.add(uploadBean);
mUploadStrategy.upload(tempList, true, new UploadCallback() {
@Override
public void onFinish(List<UploadBean> 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<UploadBean> tempList = new ArrayList<>();
tempList.add(uploadBeans.get(uplaodIndex));
mUploadStrategy.upload(tempList, true, new UploadCallback() {
@Override
public void onFinish(List<UploadBean> 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

View File

@ -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<ActiveBean> beanList = new ArrayList<>();
private UserHomeImgsViewHolder userHomeImgsViewHolder;
private Map<String, String> 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<NewLevelModel> 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<NewLevelModel> 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("");
}
});
}

View File

@ -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);*/
}

View File

@ -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">
<com.yunbao.common.custom.TabButton
android:layout_width="0dp"
@ -110,19 +111,20 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:gravity="right">
<TextView
android:id="@+id/v_table_redpoint"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="18dp"
android:layout_height="18dp"
android:background="@drawable/background_ff5075"
android:gravity="center"
android:textColor="@color/white"
android:textSize="10dp"
android:visibility="gone" />
android:visibility="visible" />
</LinearLayout>
<LinearLayout

View File

@ -3,16 +3,19 @@ package com.yunbao.video.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.custom.ItemSlideHelper;
import com.yunbao.common.utils.ClickUtil;
@ -324,20 +327,20 @@ public class VideoScrollAdapter extends RecyclerView.Adapter<VideoScrollAdapter.
* 关注发生变化
*/
public void onFollowChanged(boolean needExclude, String excludeVideoId, String toUid, int isAttention) {
// if (mList != null && !TextUtils.isEmpty(toUid) && !TextUtils.isEmpty(excludeVideoId)) {
// for (int i = 0, size = mList.size(); i < size; i++) {
// VideoBean videoBean = mList.get(i);
// if (videoBean != null) {
// if (needExclude && excludeVideoId.equals(videoBean.getId())) {
// continue;
// }
// if (toUid.equals(videoBean.getUid())) {
// videoBean.setAttent(isAttention);
// notifyItemChanged(i, Constants.PAYLOAD);
// }
// }
// }
// }
if (mList != null && !TextUtils.isEmpty(toUid) && !TextUtils.isEmpty(excludeVideoId)) {
for (int i = 0, size = mList.size(); i < size; i++) {
ActiveBean videoBean = mList.get(i);
if (videoBean != null) {
if (needExclude && excludeVideoId.equals(videoBean.getId())) {
continue;
}
if (toUid.equals(videoBean.getUser_id())) {
videoBean.setIs_attention(String.valueOf(isAttention));
notifyItemChanged(i, Constants.PAYLOAD);
}
}
}
}
}
/**
@ -377,16 +380,16 @@ public class VideoScrollAdapter extends RecyclerView.Adapter<VideoScrollAdapter.
* 分享数发生变化
*/
public void onShareChanged(String videoId, String shareNum) {
// if (mList != null && !TextUtils.isEmpty(videoId)) {
// for (int i = 0, size = mList.size(); i < size; i++) {
// VideoBean videoBean = mList.get(i);
// if (videoBean != null && videoId.equals(videoBean.getId())) {
// videoBean.setShareNum(shareNum);
// notifyItemChanged(i, Constants.PAYLOAD);
// break;
// }
// }
// }
if (mList != null && !TextUtils.isEmpty(videoId)) {
for (int i = 0, size = mList.size(); i < size; i++) {
ActiveBean videoBean = mList.get(i);
if (videoBean != null && videoId.equals(videoBean.getId())) {
videoBean.setShare_num(String.valueOf(Integer.parseInt(videoBean.getShare_num()) + Integer.parseInt(shareNum)));
notifyItemChanged(i, Constants.PAYLOAD);
break;
}
}
}
}
public void release() {

View File

@ -0,0 +1,31 @@
package com.yunbao.video.event;
/**
* Created by cxf on 2018/12/17.
*/
public class VideoFollowEvent {
private String videoId;
private int isLike;
public VideoFollowEvent(String videoId, int isLike) {
this.videoId = videoId;
this.isLike = isLike;
}
public String getVideoId() {
return videoId;
}
public void setVideoId(String videoId) {
this.videoId = videoId;
}
public int getIsLike() {
return isLike;
}
public void setIsLike(int isLike) {
this.isLike = isLike;
}
}

View File

@ -228,7 +228,7 @@ public class VideoHttpUtil {
String uid = CommonAppConfig.getInstance().getUid();
String s = MD5Util.getMD5(uid + "-" + videoid + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.addShare", VideoHttpConsts.SET_VIDEO_SHARE)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoid)
.params("random_str", s)
.execute(callback);
@ -246,7 +246,7 @@ public class VideoHttpUtil {
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_START);
String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.addView", VideoHttpConsts.VIDEO_WATCH_START)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoId)
.params("random_str", s)
.execute(CommonHttpUtil.NO_CALLBACK);
@ -263,12 +263,21 @@ public class VideoHttpUtil {
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_END);
String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.setConversion", VideoHttpConsts.VIDEO_WATCH_END)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoId)
.params("random_str", s)
.execute(CommonHttpUtil.NO_CALLBACK);
}
/**
*
*/
public static void addShareCount(String dynamic_id, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.userClickDynamicShare", "Pdlcommunity.userClickDynamicShare")
.params("dynamic_id", dynamic_id)
.execute(callback);
}
}

View File

@ -105,8 +105,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements View.OnClickLi
ToastUtil.show(mContext.getResources().getString(R.string.live_play_error));
}
});
placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH);
//placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH);
placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
placeholderView.requestLayout();
placeholderView.setKeepContentOnPlayerReset(false);
placeholderView.setPlayer(mPlayer);

View File

@ -31,6 +31,7 @@ import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
@ -42,8 +43,8 @@ import com.yunbao.share.bean.ShareBean;
import com.yunbao.share.ui.SharePopDialog;
import com.yunbao.video.R;
import com.yunbao.video.activity.AbsVideoPlayActivity;
import com.yunbao.video.dialog.VideoShareDialogFragment;
import com.yunbao.video.event.VideoLikeEvent;
import com.yunbao.video.event.VideoShareEvent;
import com.yunbao.video.http.VideoHttpUtil;
import org.greenrobot.eventbus.EventBus;
@ -305,8 +306,8 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
mCover.requestLayout();
}
mCover.setImageDrawable(drawable);
L.e("setCoverImage————Height----"+mCover.getHeight());
L.e("setCoverImage————Width----"+mCover.getWidth());
L.e("setCoverImage————Height----" + mCover.getHeight());
L.e("setCoverImage————Width----" + mCover.getWidth());
}
}
@ -531,7 +532,26 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
} else {
image = mVideoBean.getVideo() + "?vframe/jpg/offset/0";
}
new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_VIDEO).setShareData(ShareBean.ShareBuilder.create().setShareType(SharePopDialog.TYPE_VIDEO).setUid(CommonAppConfig.getInstance().getUid()).setCover(StringUtil.isEmpty(image) ? mVideoBean.getUser_avatar() : image).setTitle(StringUtil.isEmpty(mVideoBean.getContent()) ? mVideoBean.getUser_name() : JSONObject.parseObject(mVideoBean.getContent()).getString("msg")).setAnchorId(mVideoBean.getUser_id()).setAnchorName(mVideoBean.getUser_name()).setAnchorAvatar(mVideoBean.getUser_avatar()).setExtraData(mVideoBean.getId()).build()).showDialog();
SharePopDialog sharePopDialog = new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_VIDEO).setShareData(ShareBean.ShareBuilder.create().setShareType(SharePopDialog.TYPE_VIDEO).setUid(CommonAppConfig.getInstance().getUid()).setCover(StringUtil.isEmpty(image) ? mVideoBean.getUser_avatar() : image).setTitle(StringUtil.isEmpty(mVideoBean.getContent()) ? mVideoBean.getUser_name() : JSONObject.parseObject(mVideoBean.getContent()).getString("msg")).setAnchorId(mVideoBean.getUser_id()).setAnchorName(mVideoBean.getUser_name()).setAnchorAvatar(mVideoBean.getUser_avatar()).setExtraData(mVideoBean.getId()).build());
sharePopDialog.showDialog();
sharePopDialog.setOnShareListener(new SharePopDialog.onShareListener() {
@Override
public void onShareAddCount() {
LiveNetManager.get(mContext).shreCount(mVideoBean.getId(), new com.yunbao.common.http.base.HttpCallback<com.yunbao.common.bean.ShareBean>() {
@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() {

View File

@ -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() {
}
/**
* 分享数发生变化
*/

View File

@ -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" />