|
@@ -360,7 +360,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
}
|
|
}
|
|
mHolder.tv_comments_num.setText(totalRecords + " " + getString(R.string.comments));
|
|
mHolder.tv_comments_num.setText(totalRecords + " " + getString(R.string.comments));
|
|
String userID = UserConfig.getInstance(currentAccount).getCurrentUser().id + "";
|
|
String userID = UserConfig.getInstance(currentAccount).getCurrentUser().id + "";
|
|
- String nickname = UserConfig.getInstance(currentAccount).getCurrentUser().username;
|
|
|
|
|
|
+// String nickname = UserConfig.getInstance(currentAccount).getCurrentUser().username;
|
|
|
|
+ String nickname = StringUtils.nameJudge(UserConfig.getInstance(currentAccount).getCurrentUser().first_name, UserConfig.getInstance(currentAccount).getCurrentUser().last_name);
|
|
String faceURL = null;
|
|
String faceURL = null;
|
|
if ((UserConfig.getInstance(currentAccount).getCurrentUser() != null)) {
|
|
if ((UserConfig.getInstance(currentAccount).getCurrentUser() != null)) {
|
|
BackupImageView backupImageView = new BackupImageView(getContext());
|
|
BackupImageView backupImageView = new BackupImageView(getContext());
|
|
@@ -394,13 +395,14 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
childCommendBean.setUser_name(nickname);
|
|
childCommendBean.setUser_name(nickname);
|
|
childCommendBean.setUser_avatar(faceURL);
|
|
childCommendBean.setUser_avatar(faceURL);
|
|
childCommendBean.setId(o.getId());
|
|
childCommendBean.setId(o.getId());
|
|
-// childCommendBean.setReply_user_name(multiItem.getReply_user_name());
|
|
|
|
|
|
+ String replyName = StringUtils.nameJudge(multiItem.getFirst_name(), (multiItem.getLast_name()));
|
|
|
|
+ childCommendBean.setReply_user_name(replyName);
|
|
long timeMillis = System.currentTimeMillis();
|
|
long timeMillis = System.currentTimeMillis();
|
|
long l = timeMillis / 1000;
|
|
long l = timeMillis / 1000;
|
|
childCommendBean.setCreated_at(l);
|
|
childCommendBean.setCreated_at(l);
|
|
// adapter.addData(index, childCommendBean);
|
|
// adapter.addData(index, childCommendBean);
|
|
if (multiItem instanceof MainCommendBean) {
|
|
if (multiItem instanceof MainCommendBean) {
|
|
- childCommendBean.setReply_user_name(multiItem.getReply_user_name());
|
|
|
|
|
|
+// childCommendBean.setReply_user_name(multiItem.getReply_user_name());
|
|
MainCommendBean mainCommendBean = (MainCommendBean) multiItem;
|
|
MainCommendBean mainCommendBean = (MainCommendBean) multiItem;
|
|
if (mainCommendBean.getMoreCommendBean() != null) {
|
|
if (mainCommendBean.getMoreCommendBean() != null) {
|
|
childCommendBean.setMoreCommendBean(mainCommendBean.getMoreCommendBean());
|
|
childCommendBean.setMoreCommendBean(mainCommendBean.getMoreCommendBean());
|
|
@@ -414,7 +416,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
bean.setMainCommendBean(mainCommendBean);
|
|
bean.setMainCommendBean(mainCommendBean);
|
|
}
|
|
}
|
|
} else if (multiItem instanceof ChildCommendBean) {
|
|
} else if (multiItem instanceof ChildCommendBean) {
|
|
- childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
|
|
|
|
|
|
+// childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
|
|
ChildCommendBean childBean = (ChildCommendBean) multiItem;
|
|
ChildCommendBean childBean = (ChildCommendBean) multiItem;
|
|
if (childBean.getMoreCommendBean() != null) {
|
|
if (childBean.getMoreCommendBean() != null) {
|
|
childCommendBean.setMoreCommendBean(childBean.getMoreCommendBean());
|
|
childCommendBean.setMoreCommendBean(childBean.getMoreCommendBean());
|
|
@@ -1006,7 +1008,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
|
|
|
|
GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_WHITE, ColorUtil.COLOR_WHITE});
|
|
GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_WHITE, ColorUtil.COLOR_WHITE});
|
|
gd.setShape(GradientDrawable.RECTANGLE);
|
|
gd.setShape(GradientDrawable.RECTANGLE);
|
|
- gd.setStroke(UIUtil.dip2px(getContext(), 1),ColorUtil.COLOR_LINE_GRAY);
|
|
|
|
|
|
+ gd.setStroke(UIUtil.dip2px(getContext(), 1), ColorUtil.COLOR_LINE_GRAY);
|
|
gd.setCornerRadius(UIUtil.dip2px(getContext(), 15));
|
|
gd.setCornerRadius(UIUtil.dip2px(getContext(), 15));
|
|
|
|
|
|
followNormalBg = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_BLACK, ColorUtil.COLOR_BLACK});
|
|
followNormalBg = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_BLACK, ColorUtil.COLOR_BLACK});
|
|
@@ -1017,7 +1019,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
llFollow.setVisibility(View.GONE);
|
|
llFollow.setVisibility(View.GONE);
|
|
if (UserConfig.getInstance(currentAccount).isClientActivated()) {
|
|
if (UserConfig.getInstance(currentAccount).isClientActivated()) {
|
|
if (!newsBean.getUserId().equals(UserConfig.getInstance(currentAccount).getCurrentUser().id + "")) {
|
|
if (!newsBean.getUserId().equals(UserConfig.getInstance(currentAccount).getCurrentUser().id + "")) {
|
|
- llFollow.setVisibility(View.VISIBLE);
|
|
|
|
|
|
+ llFollow.setVisibility(View.VISIBLE);
|
|
if (newsBean.getIsFollow()) {
|
|
if (newsBean.getIsFollow()) {
|
|
tvFollow.setTextColor(ColorUtil.COLOR_BLACK);
|
|
tvFollow.setTextColor(ColorUtil.COLOR_BLACK);
|
|
tvFollow.setText(R.string.following);
|
|
tvFollow.setText(R.string.following);
|
|
@@ -1068,7 +1070,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- if(TextUtils.isEmpty(newsBean.getVideo())) {
|
|
|
|
|
|
+ if (TextUtils.isEmpty(newsBean.getVideo())) {
|
|
String url = newsBean.getMedium();
|
|
String url = newsBean.getMedium();
|
|
if (!TextUtils.isEmpty(url)) {
|
|
if (!TextUtils.isEmpty(url)) {
|
|
String[] splitList = url.split(",");
|
|
String[] splitList = url.split(",");
|
|
@@ -1176,8 +1178,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
super.onStop();
|
|
super.onStop();
|
|
}
|
|
}
|
|
|
|
|
|
- public void prepareVideo(){
|
|
|
|
- if(!TextUtils.isEmpty(newsBean.getVideo())){
|
|
|
|
|
|
+ public void prepareVideo() {
|
|
|
|
+ if (!TextUtils.isEmpty(newsBean.getVideo())) {
|
|
videoPlayer.getTitleTextView().setVisibility(View.GONE);
|
|
videoPlayer.getTitleTextView().setVisibility(View.GONE);
|
|
videoPlayer.getBackButton().setVisibility(View.GONE);
|
|
videoPlayer.getBackButton().setVisibility(View.GONE);
|
|
videoPlayer.getFullscreenButton().setOnClickListener(v -> {
|
|
videoPlayer.getFullscreenButton().setOnClickListener(v -> {
|
|
@@ -1191,7 +1193,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
GSYVideoManager.instance().clearAllDefaultCache(getContext());//清理缓存
|
|
GSYVideoManager.instance().clearAllDefaultCache(getContext());//清理缓存
|
|
thumbImageView = new ImageView(getContext());
|
|
thumbImageView = new ImageView(getContext());
|
|
//增加封面
|
|
//增加封面
|
|
- threadPool.execute(() ->{
|
|
|
|
|
|
+ threadPool.execute(() -> {
|
|
Looper.prepare();
|
|
Looper.prepare();
|
|
//外部辅助的旋转,帮助全屏,不打开外部的旋转
|
|
//外部辅助的旋转,帮助全屏,不打开外部的旋转
|
|
orientationUtils = new OrientationUtils(getParentActivity(), videoPlayer);
|
|
orientationUtils = new OrientationUtils(getParentActivity(), videoPlayer);
|
|
@@ -1200,7 +1202,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
header.put("ee", "33");
|
|
header.put("ee", "33");
|
|
header.put("allowCrossProtocolRedirects", "true");
|
|
header.put("allowCrossProtocolRedirects", "true");
|
|
gsyVideoOption = new GSYVideoOptionBuilder();
|
|
gsyVideoOption = new GSYVideoOptionBuilder();
|
|
- Bitmap firstBitmap = getFirstBitmap(getContext(),newsBean.getVideo(),false);
|
|
|
|
|
|
+ Bitmap firstBitmap = getFirstBitmap(getContext(), newsBean.getVideo(), false);
|
|
thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
thumbImageView.setImageBitmap(firstBitmap);
|
|
thumbImageView.setImageBitmap(firstBitmap);
|
|
gsyVideoOption
|
|
gsyVideoOption
|
|
@@ -1218,7 +1220,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
.setVideoAllCallBack(new GSYSampleCallBack() {
|
|
.setVideoAllCallBack(new GSYSampleCallBack() {
|
|
@Override
|
|
@Override
|
|
public void onPrepared(String url, Object... objects) {
|
|
public void onPrepared(String url, Object... objects) {
|
|
- Debuger.printfError("***** onPrepared **** " + objects[0]+"***** onPrepared **** " + objects[1]);
|
|
|
|
|
|
+ Debuger.printfError("***** onPrepared **** " + objects[0] + "***** onPrepared **** " + objects[1]);
|
|
super.onPrepared(url, objects);
|
|
super.onPrepared(url, objects);
|
|
//开始播放了才能旋转和全屏
|
|
//开始播放了才能旋转和全屏
|
|
orientationUtils.setEnable(videoPlayer.isRotateWithSystem());
|
|
orientationUtils.setEnable(videoPlayer.isRotateWithSystem());
|
|
@@ -1268,7 +1270,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
}
|
|
}
|
|
|
|
|
|
//开启悬浮窗
|
|
//开启悬浮窗
|
|
- private void openFloatVideo(){
|
|
|
|
|
|
+ private void openFloatVideo() {
|
|
// 不需要旋转屏幕可不调用,还需设置 setNeedOrientationUtils(false)
|
|
// 不需要旋转屏幕可不调用,还需设置 setNeedOrientationUtils(false)
|
|
if (orientationUtils != null) {
|
|
if (orientationUtils != null) {
|
|
orientationUtils.backToProtVideo();
|
|
orientationUtils.backToProtVideo();
|
|
@@ -1280,10 +1282,10 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
FloatWindow.newsId = newsId;
|
|
FloatWindow.newsId = newsId;
|
|
long position = videoPlayer.getGSYVideoManager().getCurrentPosition();
|
|
long position = videoPlayer.getGSYVideoManager().getCurrentPosition();
|
|
Bundle bundle = new Bundle();
|
|
Bundle bundle = new Bundle();
|
|
- bundle.putString("vSource",newsBean.getVideo());
|
|
|
|
- bundle.putLong("vPosition",position);
|
|
|
|
- bundle.putInt("vNewsId",newsBean.getId());
|
|
|
|
- floatPlayerView = new FloatPlayerView(getParentActivity().getApplicationContext(),bundle, (LaunchActivity) getParentActivity());
|
|
|
|
|
|
+ bundle.putString("vSource", newsBean.getVideo());
|
|
|
|
+ bundle.putLong("vPosition", position);
|
|
|
|
+ bundle.putInt("vNewsId", newsBean.getId());
|
|
|
|
+ floatPlayerView = new FloatPlayerView(getParentActivity().getApplicationContext(), bundle, (LaunchActivity) getParentActivity());
|
|
FloatWindow
|
|
FloatWindow
|
|
.with(getParentActivity().getApplicationContext())
|
|
.with(getParentActivity().getApplicationContext())
|
|
.setView(floatPlayerView)
|
|
.setView(floatPlayerView)
|
|
@@ -1315,7 +1317,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
@Override
|
|
@Override
|
|
public void onPause() {
|
|
public void onPause() {
|
|
//视频播放完、暂停
|
|
//视频播放完、暂停
|
|
- switch (videoPlayer.getCurrentPlayer().getCurrentState()){
|
|
|
|
|
|
+ switch (videoPlayer.getCurrentPlayer().getCurrentState()) {
|
|
case CURRENT_STATE_PLAYING:
|
|
case CURRENT_STATE_PLAYING:
|
|
isPlay = true;
|
|
isPlay = true;
|
|
openFloatVideo();
|
|
openFloatVideo();
|
|
@@ -1336,18 +1338,20 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
getCurPlay().onVideoResume(false);
|
|
getCurPlay().onVideoResume(false);
|
|
super.onResume();
|
|
super.onResume();
|
|
isPause = false;
|
|
isPause = false;
|
|
- if(newsBean == null){return;}
|
|
|
|
- if(FloatWindow.get() != null && !TextUtils.isEmpty(newsBean.getVideo()) && FloatWindow.newsId != 0){
|
|
|
|
- if(FloatWindow.newsId == newsBean.getId()){
|
|
|
|
|
|
+ if (newsBean == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (FloatWindow.get() != null && !TextUtils.isEmpty(newsBean.getVideo()) && FloatWindow.newsId != 0) {
|
|
|
|
+ if (FloatWindow.newsId == newsBean.getId()) {
|
|
//和小窗同一条新闻 -> 读取进度
|
|
//和小窗同一条新闻 -> 读取进度
|
|
- if(floatPlayerView!=null && floatPlayerView.getVideoPlayer() != null){
|
|
|
|
|
|
+ if (floatPlayerView != null && floatPlayerView.getVideoPlayer() != null) {
|
|
floatProgress = floatPlayerView.getVideoPlayer().getGSYVideoManager().getCurrentPosition();
|
|
floatProgress = floatPlayerView.getVideoPlayer().getGSYVideoManager().getCurrentPosition();
|
|
- if(floatProgress>0 && floatProgress<99){
|
|
|
|
|
|
+ if (floatProgress > 0 && floatProgress < 99) {
|
|
videoPlayer.setSeekOnStart(floatProgress);
|
|
videoPlayer.setSeekOnStart(floatProgress);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
FloatWindow.destroy();
|
|
FloatWindow.destroy();
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
//和小窗不同新闻 -> 关小窗
|
|
//和小窗不同新闻 -> 关小窗
|
|
FloatWindow.destroy();
|
|
FloatWindow.destroy();
|
|
}
|
|
}
|
|
@@ -1375,13 +1379,13 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
|
|
private final Handler mHandler = new Handler(new Handler.Callback() {
|
|
private final Handler mHandler = new Handler(new Handler.Callback() {
|
|
@Override
|
|
@Override
|
|
public boolean handleMessage(@NonNull Message msg) {
|
|
public boolean handleMessage(@NonNull Message msg) {
|
|
- if(msg.what == 1){
|
|
|
|
|
|
+ if (msg.what == 1) {
|
|
gsyVideoOption.build(videoPlayer);
|
|
gsyVideoOption.build(videoPlayer);
|
|
videoPlayer.setVisibility(View.VISIBLE);
|
|
videoPlayer.setVisibility(View.VISIBLE);
|
|
- if(floatPlayerView != null && floatPlayerView.getVideoPlayer() != null){
|
|
|
|
|
|
+ if (floatPlayerView != null && floatPlayerView.getVideoPlayer() != null) {
|
|
floatProgress = floatPlayerView.getVideoPlayer().getGSYVideoManager().getCurrentPosition();
|
|
floatProgress = floatPlayerView.getVideoPlayer().getGSYVideoManager().getCurrentPosition();
|
|
}
|
|
}
|
|
- if(floatProgress > 0 && floatProgress<99){
|
|
|
|
|
|
+ if (floatProgress > 0 && floatProgress < 99) {
|
|
videoPlayer.setSeekOnStart(floatProgress);
|
|
videoPlayer.setSeekOnStart(floatProgress);
|
|
}
|
|
}
|
|
videoPlayer.startPlayLogic();
|
|
videoPlayer.startPlayLogic();
|