5 Commity ae4bbc2020 ... 83fd1261de

Autor SHA1 Wiadomość Data
  DESKTOP-JJ6HLMB 83fd1261de Merge remote-tracking branch 'origin/master' 1 rok temu
  DESKTOP-JJ6HLMB 65ade6ad9e 评论昵称提交 1 rok temu
  DESKTOP-JJ6HLMB b56f273ee5 评论链接功能提交 1 rok temu
  DESKTOP-JJ6HLMB b41a143df5 评论链接功能提交 1 rok temu
  DESKTOP-JJ6HLMB 47939ed44a 评论链接功能提交 1 rok temu

+ 10 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/bean/MoreCommendBean.java

@@ -95,4 +95,14 @@ public class MoreCommendBean implements MultiItemEntity {
     public String getReply_user_name() {
         return "";
     }
+
+    @Override
+    public String getFirst_name() {
+        return null;
+    }
+
+    @Override
+    public String getLast_name() {
+        return null;
+    }
 }

+ 4 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/bean/MultiItemEntity.java

@@ -8,4 +8,8 @@ public interface MultiItemEntity {
     String getUser_id();
 
     String getReply_user_name();
+
+    String getFirst_name();
+
+    String getLast_name();
 }

+ 31 - 26
TMessagesProj/src/main/java/org/telegram/cricdit/ui/NewsDetailCommentFragment.java

@@ -360,7 +360,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
         }
         mHolder.tv_comments_num.setText(totalRecords + " " + getString(R.string.comments));
         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;
         if ((UserConfig.getInstance(currentAccount).getCurrentUser() != null)) {
             BackupImageView backupImageView = new BackupImageView(getContext());
@@ -400,7 +401,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
             childCommendBean.setCreated_at(l);
 //            adapter.addData(index, childCommendBean);
             if (multiItem instanceof MainCommendBean) {
-                childCommendBean.setReply_user_name(multiItem.getReply_user_name());
+//                childCommendBean.setReply_user_name(multiItem.getReply_user_name());
+                childCommendBean.setReply_user_name(StringUtils.nameJudge(((MainCommendBean) multiItem).getFirst_name(), ((MainCommendBean) multiItem).getLast_name()));
                 MainCommendBean mainCommendBean = (MainCommendBean) multiItem;
                 if (mainCommendBean.getMoreCommendBean() != null) {
                     childCommendBean.setMoreCommendBean(mainCommendBean.getMoreCommendBean());
@@ -414,7 +416,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
                     bean.setMainCommendBean(mainCommendBean);
                 }
             } else if (multiItem instanceof ChildCommendBean) {
-                childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
+//                childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
+                childCommendBean.setReply_user_name(StringUtils.nameJudge(((ChildCommendBean) multiItem).getFirst_name(), ((ChildCommendBean) multiItem).getLast_name()));
                 ChildCommendBean childBean = (ChildCommendBean) multiItem;
                 if (childBean.getMoreCommendBean() != null) {
                     childCommendBean.setMoreCommendBean(childBean.getMoreCommendBean());
@@ -1006,7 +1009,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
 
         GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_WHITE, ColorUtil.COLOR_WHITE});
         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));
 
         followNormalBg = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_BLACK, ColorUtil.COLOR_BLACK});
@@ -1017,7 +1020,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
         llFollow.setVisibility(View.GONE);
         if (UserConfig.getInstance(currentAccount).isClientActivated()) {
             if (!newsBean.getUserId().equals(UserConfig.getInstance(currentAccount).getCurrentUser().id + "")) {
-                  llFollow.setVisibility(View.VISIBLE);
+                llFollow.setVisibility(View.VISIBLE);
                 if (newsBean.getIsFollow()) {
                     tvFollow.setTextColor(ColorUtil.COLOR_BLACK);
                     tvFollow.setText(R.string.following);
@@ -1068,7 +1071,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
             }
         });
 
-        if(TextUtils.isEmpty(newsBean.getVideo())) {
+        if (TextUtils.isEmpty(newsBean.getVideo())) {
             String url = newsBean.getMedium();
             if (!TextUtils.isEmpty(url)) {
                 String[] splitList = url.split(",");
@@ -1176,8 +1179,8 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
         super.onStop();
     }
 
-    public void prepareVideo(){
-        if(!TextUtils.isEmpty(newsBean.getVideo())){
+    public void prepareVideo() {
+        if (!TextUtils.isEmpty(newsBean.getVideo())) {
             videoPlayer.getTitleTextView().setVisibility(View.GONE);
             videoPlayer.getBackButton().setVisibility(View.GONE);
             videoPlayer.getFullscreenButton().setOnClickListener(v -> {
@@ -1191,7 +1194,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
             GSYVideoManager.instance().clearAllDefaultCache(getContext());//清理缓存
             thumbImageView = new ImageView(getContext());
             //增加封面
-            threadPool.execute(() ->{
+            threadPool.execute(() -> {
                 Looper.prepare();
                 //外部辅助的旋转,帮助全屏,不打开外部的旋转
                 orientationUtils = new OrientationUtils(getParentActivity(), videoPlayer);
@@ -1200,7 +1203,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
                 header.put("ee", "33");
                 header.put("allowCrossProtocolRedirects", "true");
                 gsyVideoOption = new GSYVideoOptionBuilder();
-                Bitmap firstBitmap = getFirstBitmap(getContext(),newsBean.getVideo(),false);
+                Bitmap firstBitmap = getFirstBitmap(getContext(), newsBean.getVideo(), false);
                 thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                 thumbImageView.setImageBitmap(firstBitmap);
                 gsyVideoOption
@@ -1218,7 +1221,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
                         .setVideoAllCallBack(new GSYSampleCallBack() {
                             @Override
                             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);
                                 //开始播放了才能旋转和全屏
                                 orientationUtils.setEnable(videoPlayer.isRotateWithSystem());
@@ -1268,7 +1271,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
     }
 
     //开启悬浮窗
-    private void openFloatVideo(){
+    private void openFloatVideo() {
         // 不需要旋转屏幕可不调用,还需设置 setNeedOrientationUtils(false)
         if (orientationUtils != null) {
             orientationUtils.backToProtVideo();
@@ -1280,10 +1283,10 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
                 FloatWindow.newsId = newsId;
                 long position = videoPlayer.getGSYVideoManager().getCurrentPosition();
                 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
                         .with(getParentActivity().getApplicationContext())
                         .setView(floatPlayerView)
@@ -1315,7 +1318,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
     @Override
     public void onPause() {
         //视频播放完、暂停
-        switch (videoPlayer.getCurrentPlayer().getCurrentState()){
+        switch (videoPlayer.getCurrentPlayer().getCurrentState()) {
             case CURRENT_STATE_PLAYING:
                 isPlay = true;
                 openFloatVideo();
@@ -1336,18 +1339,20 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
         getCurPlay().onVideoResume(false);
         super.onResume();
         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();
-                    if(floatProgress>0 && floatProgress<99){
+                    if (floatProgress > 0 && floatProgress < 99) {
                         videoPlayer.setSeekOnStart(floatProgress);
                     }
                 }
                 FloatWindow.destroy();
-            }else{
+            } else {
                 //和小窗不同新闻 -> 关小窗
                 FloatWindow.destroy();
             }
@@ -1375,13 +1380,13 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
     private final Handler mHandler = new Handler(new Handler.Callback() {
         @Override
         public boolean handleMessage(@NonNull Message msg) {
-            if(msg.what == 1){
+            if (msg.what == 1) {
                 gsyVideoOption.build(videoPlayer);
                 videoPlayer.setVisibility(View.VISIBLE);
-                if(floatPlayerView != null && floatPlayerView.getVideoPlayer() != null){
+                if (floatPlayerView != null && floatPlayerView.getVideoPlayer() != null) {
                     floatProgress = floatPlayerView.getVideoPlayer().getGSYVideoManager().getCurrentPosition();
                 }
-                if(floatProgress > 0 && floatProgress<99){
+                if (floatProgress > 0 && floatProgress < 99) {
                     videoPlayer.setSeekOnStart(floatProgress);
                 }
                 videoPlayer.startPlayLogic();

+ 7 - 3
TMessagesProj/src/main/java/org/telegram/cricdit/ui/RankDetailCommentFragment.java

@@ -69,6 +69,7 @@ import org.telegram.cricdit.share.ShareBuilder;
 import org.telegram.cricdit.utils.Base64Utils;
 import org.telegram.cricdit.utils.ColorUtil;
 import org.telegram.cricdit.utils.EventBusHelper;
+import org.telegram.cricdit.utils.StringUtils;
 import org.telegram.cricdit.utils.ToastUtil;
 import org.telegram.cricdit.utils.UIUtil;
 import org.telegram.cricdit.view.CommendInputDialogFragment;
@@ -331,7 +332,8 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
         }
         mHolder.tv_comments_num.setText(totalRecords + " " + getString(R.string.comments));
         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;
         if ((UserConfig.getInstance(currentAccount).getCurrentUser() != null)) {
             BackupImageView backupImageView = new BackupImageView(getContext());
@@ -369,7 +371,8 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
             childCommendBean.setCreated_at(l);
 //            adapter.addData(index, childCommendBean);
             if (multiItem instanceof MainCommendBean) {
-                childCommendBean.setReply_user_name(multiItem.getReply_user_name());
+//                childCommendBean.setReply_user_name(multiItem.getReply_user_name());
+                childCommendBean.setReply_user_name(StringUtils.nameJudge(((MainCommendBean) multiItem).getFirst_name(), ((MainCommendBean) multiItem).getLast_name()));
                 MainCommendBean mainCommendBean = (MainCommendBean) multiItem;
                 if (mainCommendBean.getMoreCommendBean() != null) {
                     childCommendBean.setMoreCommendBean(mainCommendBean.getMoreCommendBean());
@@ -383,7 +386,8 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
                     bean.setMainCommendBean(mainCommendBean);
                 }
             } else if (multiItem instanceof ChildCommendBean) {
-                childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
+//                childCommendBean.setReply_user_name(((ChildCommendBean) multiItem).getUser_name());
+                childCommendBean.setReply_user_name(StringUtils.nameJudge(((ChildCommendBean) multiItem).getFirst_name(), ((ChildCommendBean) multiItem).getLast_name()));
                 ChildCommendBean childBean = (ChildCommendBean) multiItem;
                 if (childBean.getMoreCommendBean() != null) {
                     childCommendBean.setMoreCommendBean(childBean.getMoreCommendBean());

+ 6 - 6
TMessagesProj/src/main/java/org/telegram/cricdit/view/ExpandTextView.java

@@ -312,7 +312,7 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
                                 resolveUsername.username = gName;
                                 req = resolveUsername;
                             }
-                            // TODO: 2022/11/16  群组跳转未实现
+                            // TODO: 2022/11/16  群组跳转带+号的现在仍然跳转失败
                             requestId[0] = ConnectionsManager.getInstance(intentAccount[0]).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                                 TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                                 if (error == null && res != null && res.users != null) {
@@ -332,11 +332,11 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
                                     ChatActivity fragment = new ChatActivity(args);
                                     baseFragment.presentFragment(fragment);
                                 } else {
-                                    if (res != null && res.chats != null) {
-                                        if (res.chats.isEmpty()) {
-                                            ToastUtil.show(baseFragment.getParentActivity(), "Username not found");
-                                        }
-                                    }
+//                                    if (res != null && res.chats != null) {
+//                                        if (res.chats.isEmpty()) {
+//                                            ToastUtil.show(baseFragment.getParentActivity(), "Username not found");
+//                                        }
+//                                    }
                                 }
                             }));
                         }

+ 1 - 1
TMessagesProj/src/main/res/layout/more_commend_layout.xml

@@ -36,7 +36,7 @@
         android:id="@+id/fold"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginEnd="120dp"
+        android:layout_marginEnd="110dp"
         android:drawablePadding="4dp"
         android:gravity="center"
         android:paddingTop="6dp"