Explorar el Código

Merge branch 'master' of http://git.ddse.io/cricditadmin/cricdit_android

 Conflicts:
	TMessagesProj/src/main/java/org/telegram/cricdit/net/ApiService.java
huping hace 1 año
padre
commit
d540fe1f20
Se han modificado 20 ficheros con 510 adiciones y 249 borrados
  1. 24 13
      TMessagesProj/src/main/java/org/telegram/cricdit/adapter/CommentAdapter.java
  2. 2 2
      TMessagesProj/src/main/java/org/telegram/cricdit/config/Constants.java
  3. 27 2
      TMessagesProj/src/main/java/org/telegram/cricdit/mvp/SendAnFeedPresenter.java
  4. 2 0
      TMessagesProj/src/main/java/org/telegram/cricdit/mvp/SendAnFeedView.java
  5. 8 2
      TMessagesProj/src/main/java/org/telegram/cricdit/net/ApiService.java
  6. 1 1
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/CommentFragment.java
  7. 29 22
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/NewsDetailCommentFragment.java
  8. 20 14
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/RankDetailCommentFragment.java
  9. 79 120
      TMessagesProj/src/main/java/org/telegram/cricdit/ui/SendAnFeedActivity.java
  10. 6 2
      TMessagesProj/src/main/java/org/telegram/cricdit/utils/Base64Utils.java
  11. 1 16
      TMessagesProj/src/main/java/org/telegram/cricdit/utils/DownloadSaveImg.java
  12. 220 0
      TMessagesProj/src/main/java/org/telegram/cricdit/utils/FileUtils.java
  13. 67 47
      TMessagesProj/src/main/java/org/telegram/cricdit/view/ExpandTextView.java
  14. 1 0
      TMessagesProj/src/main/res/layout/activity_news_detail_comment.xml
  15. 1 0
      TMessagesProj/src/main/res/layout/activity_rank_detail_comment.xml
  16. 10 1
      TMessagesProj/src/main/res/layout/fragment_comment.xml
  17. 6 2
      TMessagesProj/src/main/res/layout/item_news_head.xml
  18. 1 0
      TMessagesProj/src/main/res/values/string-cricdit.xml
  19. 3 3
      TMessagesProj_App/bundleAfat_SDK23/release/output-metadata.json
  20. 2 2
      gradle.properties

+ 24 - 13
TMessagesProj/src/main/java/org/telegram/cricdit/adapter/CommentAdapter.java

@@ -4,6 +4,7 @@ import static org.telegram.cricdit.utils.Base64Utils.base64ToBitmap;
 
 import android.content.Context;
 import android.graphics.drawable.Drawable;
+import android.os.Bundle;
 import android.os.Handler;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -42,6 +43,8 @@ import org.telegram.cricdit.view.AvatarImage;
 import org.telegram.cricdit.view.ExpandTextView;
 import org.telegram.messenger.R;
 import org.telegram.messenger.UserConfig;
+import org.telegram.ui.ActionBar.BaseFragment;
+import org.telegram.ui.ProfileActivity;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -62,9 +65,11 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
     BaseHeadViewHolder headViewHolder;
     private NewsBean.NewsFeedBean mBean;
     private RequestOptions requestOptionsCircle;
+    BaseFragment baseFragment;
 
 
-    public CommentAdapter(List<MultiItemEntity> list, Context context, BaseHeadViewHolder holder) {
+    public CommentAdapter(BaseFragment baseFragment, List<MultiItemEntity> list, Context context, BaseHeadViewHolder holder) {
+        this.baseFragment = baseFragment;
         this.mList = list;
         this.context = context;
         this.headViewHolder = holder;
@@ -328,11 +333,11 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
                 }
 //                viewHolder.avatar.load(mainCommendBean.getUser_avatar());
 //                if (!TextUtils.isEmpty(mainCommendBean.getUser_avatar())) {
-                    Glide.with(context).load(base64ToBitmap(mainCommendBean.getUser_avatar()))
-                            .apply(requestOptionsCircle)
-                            .placeholder(R.drawable.book_user)
-                            .error(R.drawable.book_user)
-                            .into(viewHolder.avatar);
+                Glide.with(context).load(base64ToBitmap(mainCommendBean.getUser_avatar()))
+                        .apply(requestOptionsCircle)
+                        .placeholder(R.drawable.book_user)
+                        .error(R.drawable.book_user)
+                        .into(viewHolder.avatar);
 //                }
                 viewHolder.avatar.setOnClickListener(new View.OnClickListener() {
                     @Override
@@ -341,9 +346,12 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 //                                .build(ARouterPath.PATH_MAIN_PERSON_DETAIL_ACTIVITY)
 //                                .withString(Constants.USER_ID, mainCommendBean.getUser_id())
 //                                .navigation();
+                        Bundle args = new Bundle();
+                        args.putLong("user_id", Long.parseLong(mainCommendBean.getUser_id()));
+                        baseFragment.presentFragment(new ProfileActivity(args));
                     }
                 });
-                viewHolder.content.init(false, mainCommendBean.getContent(), null);
+                viewHolder.content.init(baseFragment, false, mainCommendBean.getContent(), null);
                 viewHolder.content.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
@@ -389,7 +397,7 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 //                int p = holder.getAdapterPosition();
 //                MultiItemEntity multiItemEntity = mList.get(p);
                 ChildCommendBean childCommendBean = (ChildCommendBean) item;
-                viewHolder.content.init(false, childCommendBean.getContent(), null);
+                viewHolder.content.init(baseFragment, false, childCommendBean.getContent(), null);
                 viewHolder.content.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
@@ -399,11 +407,11 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 //                viewHolder.content.setText(childCommendBean.getContent());
 //                viewHolder.avatar.load(childCommendBean.getUser_avatar());
 //                if (!TextUtils.isEmpty(childCommendBean.getUser_avatar())) {
-                    Glide.with(context).load(base64ToBitmap(childCommendBean.getUser_avatar()))
-                            .apply(requestOptionsCircle)
-                            .placeholder(R.drawable.book_user)
-                            .error(R.drawable.book_user)
-                            .into(viewHolder.avatar);
+                Glide.with(context).load(base64ToBitmap(childCommendBean.getUser_avatar()))
+                        .apply(requestOptionsCircle)
+                        .placeholder(R.drawable.book_user)
+                        .error(R.drawable.book_user)
+                        .into(viewHolder.avatar);
 //                }
                 viewHolder.avatar.setOnClickListener(new View.OnClickListener() {
                     @Override
@@ -412,6 +420,9 @@ public class CommentAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 //                                .build(ARouterPath.PATH_MAIN_PERSON_DETAIL_ACTIVITY)
 //                                .withString(Constants.USER_ID, childCommendBean.getUser_id())
 //                                .navigation();
+                        Bundle args = new Bundle();
+                        args.putLong("user_id", Long.parseLong(childCommendBean.getUser_id()));
+                        baseFragment.presentFragment(new ProfileActivity(args));
                     }
                 });
                 viewHolder.name.setText(((ChildCommendBean) item).getUser_name());

+ 2 - 2
TMessagesProj/src/main/java/org/telegram/cricdit/config/Constants.java

@@ -15,9 +15,9 @@ public class Constants {
     public static final String APP_AUTH_URL = BASE_URL + ":10004";
 
     //About Us地址
-    public static final String WEB_URL_ABOUT_US = "https://m.cricdit.com/html/AboutUs.html?flag=app";
+    public static final String WEB_URL_ABOUT_US = "https://m.cricdit.com/About?flag=app";
     //Privacy Policy地址
-    public static final String WEB_URL_PRIVACY_POLICY = "https://m.cricdit.com/html/privacy.html?flag=app";
+    public static final String WEB_URL_PRIVACY_POLICY = "https://m.cricdit.com/agreement?flag=app";
 
     //默认文件大小不超过10M
     public static final long FILE_SPECIFY_SIZE = 10485760;

+ 27 - 2
TMessagesProj/src/main/java/org/telegram/cricdit/mvp/SendAnFeedPresenter.java

@@ -7,11 +7,15 @@ import org.telegram.cricdit.bean.RankListBean;
 import org.telegram.cricdit.net.ApiService;
 import org.telegram.cricdit.net.Parameter;
 import org.telegram.cricdit.utils.ParamsUtil;
-import org.telegram.messenger.R;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.RequestBody;
+
 
 public class SendAnFeedPresenter extends BasePresenter<SendAnFeedView> {
 
@@ -37,7 +41,7 @@ public class SendAnFeedPresenter extends BasePresenter<SendAnFeedView> {
             public void onError(Throwable e) {
                 super.onError(e);
                 if(getView()!=null){
-                    getView().showResult(1);
+                    getView().showErrorImg(e);
                 }
             }
         });
@@ -64,4 +68,25 @@ public class SendAnFeedPresenter extends BasePresenter<SendAnFeedView> {
             }
         });
     }
+
+    public void uploadFile(File file,boolean isVideo){
+        RequestBody body = RequestBody.create(MediaType.parse(isVideo?"image/*":"video/*"), file);
+        MultipartBody.Part part = MultipartBody.Part.createFormData("file", file.getName(), body);
+        addSubscribe(create(ApiService.class).uploadFile(part), new BaseObserver<String>() {
+            @Override
+            protected void onSuccess(String data) {
+                if(getView()!=null){
+                    getView().getImgUrl(data);
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                if(getView()!=null){
+                    getView().showErrorImg(e);
+                }
+                super.onError(e);
+            }
+        });
+    }
 }

+ 2 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/mvp/SendAnFeedView.java

@@ -9,4 +9,6 @@ public interface SendAnFeedView extends IView {
     void showResult(int code);
     void showTagList(List<String> list);
     String getUid();
+    void getImgUrl(String url);
+    void showErrorImg(Throwable e);
 }

+ 8 - 2
TMessagesProj/src/main/java/org/telegram/cricdit/net/ApiService.java

@@ -11,17 +11,18 @@ import org.telegram.cricdit.bean.NewsSearchWordBean;
 import org.telegram.cricdit.bean.NewsTagBean;
 import org.telegram.cricdit.bean.RankListBean;
 import org.telegram.cricdit.bean.RankDetailBean;
-import org.telegram.cricdit.bean.UpdateBean;
 import org.telegram.cricdit.bean.ReplyBean;
 import org.telegram.cricdit.config.Constants;
 
 import io.reactivex.Observable;
+import okhttp3.MultipartBody;
 import okhttp3.RequestBody;
 import okhttp3.ResponseBody;
 import retrofit2.Call;
-import retrofit2.Response;
 import retrofit2.http.Body;
+import retrofit2.http.Multipart;
 import retrofit2.http.POST;
+import retrofit2.http.Part;
 
 /**
  * 所有Cricdit请求接口存放位置
@@ -120,4 +121,9 @@ public interface ApiService {
 
     @POST(Constants.APP_AUTH_URL + "/feed/like")
     Call<ResponseBody> likeToProfile(@Body RequestBody requestBody);
+    //上传文件
+    @Multipart
+    @POST(Constants.APP_AUTH_URL + "/demo/upload")
+    Observable<BaseResponse<String>> uploadFile(@Part MultipartBody.Part body);
+
 }

+ 1 - 1
TMessagesProj/src/main/java/org/telegram/cricdit/ui/CommentFragment.java

@@ -136,7 +136,7 @@ public class CommentFragment extends BaseActivity<CommentPresenter> implements O
         ImageView ivShare = rootView.findViewById(R.id.iv_share);
         rlBottom = rootView.findViewById(R.id.rl_bottom);
         rv.setLayoutManager(new LinearLayoutManager(getContext()));
-        adapter = new CommentAdapter(null, getParentActivity(), mHolder);
+        adapter = new CommentAdapter(null,null, getParentActivity(), mHolder);
         if (bean != null) {
             adapter.setNewsBean(bean);
         }

+ 29 - 22
TMessagesProj/src/main/java/org/telegram/cricdit/ui/NewsDetailCommentFragment.java

@@ -179,7 +179,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
     public void setHeadViewHolder(BaseHeadViewHolder holder) {
         mHolder = holder;
         rv.setLayoutManager(new LinearLayoutManager(getContext()));
-        adapter = new CommentAdapter(null, getParentActivity(), mHolder);
+        adapter = new CommentAdapter(this, null, getParentActivity(), mHolder);
         if (newsBean != null) {
             adapter.setNewsBean(newsBean);
         }
@@ -235,6 +235,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
         tvNumZan = rootView.findViewById(R.id.tv_num_zan);
         ivShare = rootView.findViewById(R.id.iv_share);
         rlBottom = rootView.findViewById(R.id.rl_bottom);
+        statusView = rootView.findViewById(R.id.status_view);
         mTextView.setOnClickListener(this);
         srfl.setEnableRefresh(false);
         srfl.setOnRefreshListener(new OnRefreshListener() {
@@ -327,12 +328,14 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
             BackupImageView backupImageView = new BackupImageView(getContext());
             backupImageView.setForUserOrChat(UserConfig.getInstance(currentAccount).getCurrentUser(), new AvatarDrawable(UserConfig.getInstance(currentAccount).getCurrentUser()));
             Bitmap bitmap = backupImageView.getImageReceiver().getBitmap();
-            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            if (bitmap != null) {
+                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
 //该方法用来压缩图片,第一个参数为图片格式,第二个参数为截取图片的保留率,如当前为90,则保留之前图片90%的区域
-            bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
-            byte[] imagebyte = outputStream.toByteArray();
-            String toBase64 = Base64Utils.toBase64(imagebyte);
-            faceURL = toBase64;
+                bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
+                byte[] imagebyte = outputStream.toByteArray();
+                String toBase64 = Base64Utils.toBase64(imagebyte);
+                faceURL = toBase64;
+            }
         }
         if (multiItem == null) {
             MainCommendBean addMainCommendBean = new MainCommendBean(content);
@@ -681,8 +684,7 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
 ////            } else if (multiItem instanceof ChildCommendBean) {//表示点击子评论的回复
 ////
 ////            }
-//        }
-//        viewDataBinding.mTextView.setText("");
+//     //        }   viewDataBinding.mTextView.setText("");
         //调用后台接口评论回复
         int id = 0;
         if (multiItem != null) {
@@ -794,20 +796,22 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
 
     @Override
     public void onDeleteComment(MultiItemEntity o) {
-        if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
-            // TODO: 2022/9/8   这里给出一个弹窗确定是否删除评论
-            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
-            builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
-            builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
-                if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
-                    presentFragment(new LoginActivity());
-                } else {
-                    long clientUserId = UserConfig.getInstance(currentAccount).getClientUserId();
-                    presenter.recallComment(clientUserId + "", o.getId(), o);
-                }
-            });
-            builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
-            showDialog(builder.create());
+        if (UserConfig.getInstance(currentAccount).isClientActivated()) {
+            if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
+                // TODO: 2022/9/8   这里给出一个弹窗确定是否删除评论
+                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
+                builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
+                builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
+                    if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
+                        presentFragment(new LoginActivity());
+                    } else {
+                        long clientUserId = UserConfig.getInstance(currentAccount).getClientUserId();
+                        presenter.recallComment(clientUserId + "", o.getId(), o);
+                    }
+                });
+                builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
+                showDialog(builder.create());
+            }
         }
     }
 
@@ -890,6 +894,9 @@ public class NewsDetailCommentFragment extends BaseActivity<CommentPresenter> im
 
     @Override
     public void showError(Throwable e) {
+        if (alertDialog != null) {
+            alertDialog.dismiss();
+        }
         nestedScrollview.setVisibility(View.GONE);
         if (!(e instanceof ApiException)) {
             statusView.showNoNetwork(LocaleController.getString(R.string.network_failed));

+ 20 - 14
TMessagesProj/src/main/java/org/telegram/cricdit/ui/RankDetailCommentFragment.java

@@ -147,7 +147,7 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
     public void setHeadViewHolder(BaseHeadViewHolder holder) {
         mHolder = holder;
         rv.setLayoutManager(new LinearLayoutManager(getContext()));
-        adapter = new CommentAdapter(null, getParentActivity(), mHolder);
+        adapter = new CommentAdapter(this, null, getParentActivity(), mHolder);
         if (bean != null) {
             adapter.setNewsBean(bean);
         }
@@ -203,6 +203,7 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
         tvNumZan = rootView.findViewById(R.id.tv_num_zan);
         ivShare = rootView.findViewById(R.id.iv_share);
         rlBottom = rootView.findViewById(R.id.rl_bottom);
+        statusView = rootView.findViewById(R.id.status_view);
         mTextView.setOnClickListener(this);
         srfl.setEnableRefresh(false);
         srfl.setOnRefreshListener(new OnRefreshListener() {
@@ -826,19 +827,21 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
 
     @Override
     public void onDeleteComment(MultiItemEntity o) {
-        if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
-            // TODO: 2022/9/8   这里给出一个弹窗确定是否删除评论
-            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
-            builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
-            builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
-                if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
-                    presentFragment(new LoginActivity());
-                } else {
-                    presenter.recallComment(UserConfig.getInstance(currentAccount).getCurrentUser().id + "", o.getId(), o);
-                }
-            });
-            builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
-            showDialog(builder.create());
+        if (UserConfig.getInstance(currentAccount).isClientActivated()) {
+            if (o.getUser_id().equals((UserConfig.getInstance(currentAccount).getCurrentUser().id + ""))) {
+                // TODO: 2022/9/8   这里给出一个弹窗确定是否删除评论
+                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
+                builder.setMessage(LocaleController.getString(R.string.delete_comment_tip));
+                builder.setPositiveButton(LocaleController.getString(R.string.OK), (dialogInterface, i) -> {
+                    if (!UserConfig.getInstance(currentAccount).isClientActivated()) {
+                        presentFragment(new LoginActivity());
+                    } else {
+                        presenter.recallComment(UserConfig.getInstance(currentAccount).getCurrentUser().id + "", o.getId(), o);
+                    }
+                });
+                builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null);
+                showDialog(builder.create());
+            }
         }
     }
 
@@ -1024,6 +1027,9 @@ public class RankDetailCommentFragment extends BaseActivity<CommentPresenter> im
 
     @Override
     public void showError(Throwable e) {
+        if (alertDialog != null) {
+            alertDialog.dismiss();
+        }
         nestedScrollview.setVisibility(View.GONE);
         if (!(e instanceof ApiException)) {
             statusView.showNoNetwork(LocaleController.getString(R.string.network_failed));

+ 79 - 120
TMessagesProj/src/main/java/org/telegram/cricdit/ui/SendAnFeedActivity.java

@@ -67,6 +67,7 @@ import com.zhy.view.flowlayout.TagFlowLayout;
 
 import org.telegram.cricdit.bean.NewsMsgEvent;
 import org.telegram.cricdit.utils.EventBusHelper;
+import org.telegram.cricdit.utils.FileUtils;
 import org.telegram.cricdit.view.pictureselect.FullyGridLayoutManager;
 import org.telegram.cricdit.adapter.PictureAdapter;
 import org.telegram.cricdit.base.BaseActivity;
@@ -82,8 +83,10 @@ import org.telegram.messenger.UserConfig;
 import org.telegram.ui.ActionBar.ActionBarMenu;
 import org.telegram.ui.ActionBar.ActionBarMenuItem;
 import org.telegram.ui.ActionBar.AlertDialog;
+import org.telegram.ui.ActionBar.BaseFragment;
 
 import java.io.File;
+import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -119,11 +122,9 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
     private int maxSelectNum = 9,maxSelectVideoNum = 1;
     private static final int CHOOSE_REQUEST = 1000;
     private int pageSize = 10,page = 1,offset=0;
-    private final Handler mHandler = new Handler() {
-        @SuppressLint("HandlerLeak")
+    private final Handler mHandler = new Handler(new Handler.Callback() {
         @Override
-        public void handleMessage(@NonNull Message msg) {
-            super.handleMessage(msg);
+        public boolean handleMessage(Message msg) {
             if(msg.what == 1){
                 //发布动态-图片
                 String str = edit.getText().toString();
@@ -132,16 +133,24 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
             }else if(msg.what == 2){
                 //有图片/视频上传失败
                 dialog.dismiss();
-                ToastUtil.show(mContext,LocaleController.getString("please_try_again", R.string.send_news_char_short_info));
+                ToastUtil.show(mContext,LocaleController.getString(R.string.please_try_again));
                 mImages.clear();
+//                finishFragment();
             }else if(msg.what == 3){
                 //发布动态-视频
                 String str = edit.getText().toString();
                 presenter.publicNews(str, mImages, selectTags.toArray(new String[selectTags.size()]),true);
                 mImages.clear();
+            }else if(msg.what == 4){
+                //超过大小
+                if(localMediaList.size() == 0){
+                    dialog.dismiss();
+                }
+                ToastUtil.show(mContext,LocaleController.getString(R.string.post_resource_size_tip));
             }
+            return false;
         }
-    };
+    });
 
     @Override
     protected void initView(View v) {
@@ -300,7 +309,7 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
                 selectionModel.forResult(CHOOSE_REQUEST);
             }
         });
-        //话题
+
         tvChooseTag.setOnClickListener((view -> {
             if(offset<=0){
                 presenter.getTagList(pageSize,page);
@@ -311,14 +320,10 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
 
         edit.addTextChangedListener(new TextWatcher() {
             @Override
-            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
-
-            }
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
 
             @Override
-            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
-
-            }
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
 
             @Override
             public void afterTextChanged(Editable editable) {
@@ -381,65 +386,40 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
         rvTags.setAdapter(tagsArrayAdapter);
         tagPopupView.setBackgroundColor(ColorUtil.COLOR_WHITE);
         smartRefreshLayout.setEnableRefresh(false);
-        smartRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
-            @Override
-            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
-                smartRefreshLayout.finishLoadMore();
-                if (tagsArrayAdapter.getCount() == page * pageSize) {
-                    page++;
-                    presenter.getTagList(pageSize, page);
-                    offset = page * pageSize;
-                }
-            }
-        });
-
-        mTagPopupWindow = new PopupWindow(tagPopupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
-        mTagPopupWindow.setAnimationStyle(R.style.PopupAnimation);
-        mTagPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
-            @Override
-            public void onDismiss() {
-                backgroundAlpha(1.0f);
+        smartRefreshLayout.setOnLoadMoreListener(refreshLayout -> {
+            smartRefreshLayout.finishLoadMore();
+            if (tagsArrayAdapter.getCount() == page * pageSize) {
+                page++;
+                presenter.getTagList(pageSize, page);
+                offset = page * pageSize;
             }
         });
 
-        rvTags.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override
-            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
-                String str = showTags.get(i);
-                if(selectTags.size()>4){
-                    ToastUtil.show(mContext,String.format(LocaleController.getString("news_post_tags_maximum", R.string.news_post_tags_maximum),"5"));
-                }else if(!selectTags.contains(showTags.get(i))){
-                    selectTags.add(0, str);
-                    selTagAdapter.notifyDataChanged();
-                }
-                mTagPopupWindow.dismiss();
-            }
-        });
-
-        mTagPopupWindow.setTouchable(true);
-        mTagPopupWindow.setFocusable(true);
-        mTagPopupWindow.setOutsideTouchable(false);
         if(mTagPopupWindow == null){
             mTagPopupWindow = new PopupWindow(tagPopupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
+            mTagPopupWindow.setAnimationStyle(R.style.PopupAnimation);
+            mTagPopupWindow.setOnDismissListener(() -> backgroundAlpha(1.0f));
+            mTagPopupWindow.setTouchable(true);
+            mTagPopupWindow.setFocusable(true);
+            mTagPopupWindow.setOutsideTouchable(false);
         }
-
-        mTagPopupWindow.setAnimationStyle(R.style.PopupAnimation);
-        mTagPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
-            @Override
-            public void onDismiss() {
-                backgroundAlpha(1.0f);
+        rvTags.setOnItemClickListener((adapterView, view, i, l) -> {
+            String str = showTags.get(i);
+            if(selectTags.size()>4){
+                ToastUtil.show(mContext,String.format(LocaleController.getString(R.string.news_post_tags_maximum),"5"));
+            }else if(!selectTags.contains(showTags.get(i))){
+                selectTags.add(0, str);
+                selTagAdapter.notifyDataChanged();
             }
+            mTagPopupWindow.dismiss();
         });
-        mTagPopupWindow.setTouchable(true);
-        mTagPopupWindow.setFocusable(true);
-        mTagPopupWindow.setOutsideTouchable(false);
     }
 
     @Override
     public void showResult(int result) {
         EventBusHelper.post(new NewsMsgEvent("feed"));
         dialog.dismiss();
-        ToastUtil.show(mContext,(result == 0)?LocaleController.getString("submit_success", R.string.submit_success):LocaleController.getString("submit_success", R.string.submit_error));
+        ToastUtil.show(mContext,(result == 0)?LocaleController.getString(R.string.submit_success):LocaleController.getString(R.string.submit_error));
         finishFragment();
     }
 
@@ -476,91 +456,70 @@ public class SendAnFeedActivity extends BaseActivity<SendAnFeedPresenter> implem
             hideKeyboard(edit);
             String string = edit.getText().toString();
             if (TextUtils.isEmpty(string) || string.length() < 20) {
-                ToastUtil.show(mContext, LocaleController.getString("send_news_char_short_info", R.string.send_news_char_short_info));
+                ToastUtil.show(mContext, LocaleController.getString(R.string.send_news_char_short_info));
                 return;
             }
             if(isFastClick()){
                 dialog.show();
-//                ThreadPoolUtil.execute(() ->{
-                    /*localMediaList = pictureAdapter.getData();
+                    localMediaList = pictureAdapter.getData();
                     if(localMediaList.size() > 0){
-                        String fileVideoPath = localMediaList.get(0).getRealPath();
+                         String fileVideoPath = localMediaList.get(0).getRealPath();
                         if(PictureMimeType.isHasVideo(localMediaList.get(0).getMimeType()) && (!TextUtils.isEmpty(fileVideoPath))){
-                            //fixme ltt 上传文件接口
-                            OpenIMClient.getInstance().uploadFile(new OnFileUploadProgressListener() {
-                                @Override
-                                public void onError(int code, String error) {
-                                    Message message = new Message();
-                                    message.what = 2;
-                                    mHandler.sendMessage(message);
-                                }
-
-                                @Override
-                                public void onProgress(long progress) {}
-
-                                @Override
-                                public void onSuccess(String s) {
-                                    if(!TextUtils.isEmpty(s)){
-                                        mImages.add(s);
-                                    }
-                                    if(mImages.size() == localMediaList.size()){
-                                        Message message = new Message();
-                                        message.what = 3;
-                                        mHandler.sendMessage(message);
-                                    }
+                            if(FileUtils.getAutoFileOrFilesSize(fileVideoPath,FILE_SPECIFY_SIZE)){
+                                localMediaList.remove(0);
+                                Message message = new Message();
+                                message.what = 4;
+                                mHandler.sendMessage(message);
+                            }else{
+                                if (!TextUtils.isEmpty(fileVideoPath)) {
+                                    presenter.uploadFile(new File(fileVideoPath),true);
                                 }
-                            }, fileVideoPath);
+                            }
                         }else{
-                            //上传图片
                             for (LocalMedia media :localMediaList) {
                                 String filePath = media.getRealPath();
-                            if(FileUtils.getAutoFileOrFilesSize(media.getRealPath(),2097152)){
-                                localMediaList.remove(media);
-                                Message message = new Message();
-                                message.what = 3;
-                                mHandler.sendMessage(message);
-                                continue;
-                            }
+                                if(FileUtils.getAutoFileOrFilesSize(filePath,FILE_SPECIFY_SIZE)){
+                                    localMediaList.remove(media);
+                                    Message message = new Message();
+                                    message.what = 4;
+                                    mHandler.sendMessage(message);
+                                    continue;
+                                }
 
                                 if (!TextUtils.isEmpty(filePath)) {
-                                    //上传图片接口
-                                    OpenIMClient.getInstance().uploadFile(new OnFileUploadProgressListener() {
-                                        @Override
-                                        public void onError(int code, String error) {
-                                            Message message = new Message();
-                                            message.what = 2;
-                                            mHandler.sendMessage(message);
-                                        }
-
-                                        @Override
-                                        public void onProgress(long progress) {}
-
-                                        @Override
-                                        public void onSuccess(String s) {
-                                            if(!TextUtils.isEmpty(s)){
-                                                mImages.add(s);
-                                            }
-                                            if(mImages.size() == localMediaList.size()){
-                                                Message message = new Message();
-                                                message.what = 1;
-                                                mHandler.sendMessage(message);
-                                            }
-                                        }
-                                    }, filePath);
+                                    presenter.uploadFile(new File(filePath),false);
                                 }
                             }
                         }
-                    }else{*/
-                        //纯文字
+                    }else{
                         Message message = new Message();
                         message.what = 1;
                         mHandler.sendMessage(message);
-//                    }
+                    }
                 };
         });
     }
 
     @Override
+    public void getImgUrl(String url) {
+        if(!TextUtils.isEmpty(url)){
+            mImages.add(url);
+        }
+        if(mImages.size() == localMediaList.size()){
+            Message message = new Message();
+            message.what = 1;
+            mHandler.sendMessage(message);
+        }
+    }
+
+    @Override
+    public void showErrorImg(Throwable e) {
+        Message message = new Message();
+        message.what = 2;
+        mHandler.sendMessage(message);
+    }
+
+    @Override
     protected int getLayoutResId() {
         return R.layout.activity_send_an_feed;
     }

+ 6 - 2
TMessagesProj/src/main/java/org/telegram/cricdit/utils/Base64Utils.java

@@ -78,6 +78,7 @@ public class Base64Utils {
 //    public static BitmapDrawable base64ToBitmap(String base64) {
 //        return new BitmapDrawable(ImageLoader.getStrippedPhotoBitmap(fromBase64String(base64), "b"));
 //    }
+
     /**
      * 直接将Base64转为BitmapDrawable
      *
@@ -86,8 +87,11 @@ public class Base64Utils {
      */
 
     public static Bitmap base64ToBitmap(String base64) {
-        byte[] imageByte = Base64.decode(base64,Base64.DEFAULT);
-        return BitmapFactory.decodeByteArray(imageByte,0,imageByte.length);
+        if (!TextUtils.isEmpty(base64)) {
+            byte[] imageByte = Base64.decode(base64, Base64.DEFAULT);
+            return BitmapFactory.decodeByteArray(imageByte, 0, imageByte.length);
+        }
+        return null;
     }
 
 }

+ 1 - 16
TMessagesProj/src/main/java/org/telegram/cricdit/utils/DownloadSaveImg.java

@@ -16,21 +16,15 @@ import android.os.Environment;
 import android.os.Handler;
 import android.os.Message;
 import android.provider.MediaStore;
-import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 import android.widget.Toast;
-
-import androidx.fragment.app.Fragment;
-
 import org.telegram.messenger.BuildVars;
 import org.telegram.messenger.LocaleController;
-import org.telegram.messenger.MediaController;
 import org.telegram.messenger.R;
 import org.telegram.ui.ActionBar.AlertDialog;
 import org.telegram.ui.ActionBar.BaseFragment;
-
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -158,17 +152,8 @@ public class DownloadSaveImg {
         if (Build.VERSION.SDK_INT >= 23 && (Build.VERSION.SDK_INT <= 28 || BuildVars.NO_SCOPED_STORAGE) && fragment.getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
             fragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 55);//请求码无含义
             return false;
-        }else{
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-                if (!Environment.isExternalStorageManager()) {
-                    Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
-                    intent.setData(Uri.parse("package:" + context.getPackageName()));
-                    context.startActivity(intent);
-                    return false;
-                }
-            }
-            return true;
         }
+        return true;
     }
 
     /**

+ 220 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/utils/FileUtils.java

@@ -0,0 +1,220 @@
+package org.telegram.cricdit.utils;
+
+import android.os.Environment;
+import android.text.TextUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+
+public class FileUtils {
+
+    public static boolean isSDCardAlive() {
+        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
+    }
+
+    public static void delete(File file, String except) {
+        if (file == null) {
+            return;
+        }
+        if (file.isDirectory()) {
+            String[] children = file.list();
+            for (String c : children) {
+                File childFile = new File(file, c);
+                if (!TextUtils.equals(childFile.getName(), except)) {
+                    delete(childFile);
+                }
+            }
+        } else {
+            if (!TextUtils.equals(file.getName(), except)) {
+                file.delete();
+            }
+        }
+    }
+
+    public static boolean delete(File file) {
+        if (file == null) {
+            return false;
+        }
+        if (file.isDirectory()) {
+            String[] children = file.list();
+            for (String c : children) {
+                boolean success = delete(new File(file, c));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+        return file.delete();
+    }
+
+    public static long getSize(File file) {
+        long size = 0;
+        try {
+            File[] fileList = file.listFiles();
+            for (File f : fileList) {
+                if (f.isDirectory()) {
+                    size = size + getSize(f);
+                } else {
+                    size = size + f.length();
+                }
+            }
+        } catch (Exception ignore) {
+        }
+        return size;
+    }
+
+    /**
+     * 调用此方法自动计算指定文件或指定文件夹的大小
+     *
+     * @param filePath 文件路径
+     * @return 计算好的带B、KB、MB、GB的字符串
+     */
+    public static String getAutoFileOrFilesSize(String filePath) {
+        File file = new File(filePath);
+        long blockSize = 0;
+        try {
+            if (file.isDirectory()) {
+                blockSize = getFileSizes(file);
+            } else {
+                blockSize = getFileSize(file);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return FormetFileSize(blockSize);
+    }
+
+    /**
+     * 调用此方法自动计算指定文件或指定文件夹的大小
+     *
+     * @param filePath 文件路径
+     * @return 计算好的带B、KB、MB、GB的字符串
+     */
+    public static long getAutoFileOrFilesSize(String filePath,boolean is) {
+        File file = new File(filePath);
+        long blockSize = 0;
+        try {
+            if (file.isDirectory()) {
+                blockSize = getFileSizes(file);
+            } else {
+                blockSize = getFileSize(file);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return blockSize;
+    }
+
+    /**
+     * 计算文件是否超过指定大小
+     */
+    public static boolean getAutoFileOrFilesSize(String filePath, long specifySize) {
+        File file = new File(filePath);
+        long blockSize = 0;
+        try {
+            if (file.isDirectory()) {
+                blockSize = getFileSizes(file);
+            } else {
+                blockSize = getFileSize(file);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+        return blockSize > specifySize;
+    }
+
+
+    /**
+     * 获取指定文件大小
+     *
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    private static long getFileSize(File file) throws Exception {
+        long size = 0;
+        if (file.exists()) {
+            FileInputStream fis = null;
+            fis = new FileInputStream(file);
+            size = fis.available();
+        } else {
+            file.createNewFile();
+        }
+        return size;
+    }
+
+    /**
+     * 转换文件大小
+     *
+     * @param fileS
+     * @return
+     */
+    private static String FormetFileSize(long fileS) {
+        DecimalFormat df = new DecimalFormat("#.00");
+        String fileSizeString = "";
+        String wrongSize = "0B";
+        if (fileS == 0) {
+            return wrongSize;
+        }
+        if (fileS < 1024) {
+            fileSizeString = df.format((double) fileS) + "B";
+        } else if (fileS < 1048576) {
+            fileSizeString = df.format((double) fileS / 1024) + "KB";
+        } else if (fileS < 1073741824) {
+            fileSizeString = df.format((double) fileS / 1048576) + "MB";
+        } else {
+            fileSizeString = df.format((double) fileS / 1073741824) + "GB";
+        }
+        return fileSizeString;
+    }
+
+    /**
+     * 获取指定文件夹
+     *
+     * @param f
+     * @return
+     * @throws Exception
+     */
+    private static long getFileSizes(File f) throws Exception {
+        long size = 0;
+        File flist[] = f.listFiles();
+        for (int i = 0; i < flist.length; i++) {
+            if (flist[i].isDirectory()) {
+                size = size + getFileSizes(flist[i]);
+            } else {
+                size = size + getFileSize(flist[i]);
+            }
+        }
+        return size;
+    }
+
+    /**
+     * 格式化单位
+     */
+    public static String formatSize(double size) {
+        double kiloByte = size / 1024;
+        if (kiloByte < 1) {
+            return "0KB";
+        }
+        double megaByte = kiloByte / 1024;
+        if (megaByte < 1) {
+            BigDecimal result1 = new BigDecimal(Double.toString(kiloByte));
+            return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "KB";
+        }
+        double gigaByte = megaByte / 1024;
+        if (gigaByte < 1) {
+            BigDecimal result2 = new BigDecimal(Double.toString(megaByte));
+            return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB";
+        }
+        double teraBytes = gigaByte / 1024;
+        if (teraBytes < 1) {
+            BigDecimal result3 = new BigDecimal(Double.toString(gigaByte));
+            return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "GB";
+        }
+        BigDecimal result4 = new BigDecimal(teraBytes);
+        return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "TB";
+    }
+}

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

@@ -5,6 +5,7 @@ import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.os.Build;
+import android.os.Bundle;
 import android.text.Layout;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -19,12 +20,16 @@ import android.view.View;
 
 import androidx.annotation.Nullable;
 
+import org.telegram.cricdit.bean.GroupInfoBean;
 import org.telegram.cricdit.config.Constants;
+import org.telegram.cricdit.mvp.CommentPresenter;
 import org.telegram.messenger.R;
 
 //import com.alibaba.android.arouter.launcher.ARouter;
 //import com.cricdit.libbase.arouter.ARouterPath;
 import org.telegram.cricdit.base.BaseObserver;
+import org.telegram.ui.ActionBar.BaseFragment;
+import org.telegram.ui.ProfileActivity;
 //import com.cricdit.libbase.constants.Constants;
 //import com.cricdit.module.main.R;
 //import com.cricdit.module.main.bean.GroupInfoBean;
@@ -72,6 +77,8 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
     private int mToExpandImageWidth = 0;
     private int mToCloseImageWidth = 0;
 
+    BaseFragment baseFragment;
+
     /**
      * 提示文字的颜色
      */
@@ -101,7 +108,8 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
     /**
      * 使用前必须调用该方法
      */
-    public void init(boolean toExpand, String text, @Nullable CreateAppenderListener createAppenderListener) {
+    public void init(BaseFragment baseFragment, boolean toExpand, String text, @Nullable CreateAppenderListener createAppenderListener) {
+        this.baseFragment = baseFragment;
         mMaxLines = getMaxLines();
         originText = ToDBC ? ToDBC(text) : toDBC(text);
         if (createAppenderListener != null) {
@@ -255,7 +263,7 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
                 needAppend = true;
             }
         }
-        if (workingText.contains("https://g.cricdit.com/") || workingText.contains("https://u.cricdit.com/")) {
+        if (workingText.contains("https://t.me/")) {
             final SpannableStringBuilder style = new SpannableStringBuilder();
 
             //设置文字
@@ -266,22 +274,31 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
             ClickableSpan clickableSpan = new ClickableSpan() {
                 @Override
                 public void onClick(View widget) {
-                    if (finalWorkingText.contains("https://g.cricdit.com/")) {
-                        int index = finalWorkingText.indexOf("https://g.cricdit.com/");
+                    if (finalWorkingText.contains("https://t.me/")) {
+                        int index = finalWorkingText.indexOf("https://t.me/");
                         int end = finalWorkingText.indexOf(" ", index);
                         String gName;
                         if (end != -1) {
-                            gName = finalWorkingText.substring(index + "https://g.cricdit.com/".length(), end);
+                            gName = finalWorkingText.substring(index + "https://t.me/".length(), end);
                         } else {
-                            gName = finalWorkingText.substring(index + "https://g.cricdit.com/".length());
+                            gName = finalWorkingText.substring(index + "https://t.me/".length());
                         }
+
+                        //跳转到群组聊天界面    todo 这里需要样子跳转到聊天界面是否正确  这里需要看电报的源码  根据gName信息获取个人信息(user_id) 跳转到聊天界面
+                        String user_id = "0";
+                        Bundle args = new Bundle();
+                        args.putLong("user_id", Long.parseLong(user_id));
+                        baseFragment.presentFragment(new ProfileActivity(args));
 //                        new CommentPresenter().groupLinkInfo(gName, new BaseObserver<GroupInfoBean>() {
 //                            @Override
 //                            protected void onSuccess(GroupInfoBean data) {
-//                                ARouter.getInstance().build(ARouterPath.PATH_CHAT_CHAT_ACTIVITY).withString(Constant.K_GROUP_ID, data.getGroup_id()).withString(Constant.K_GROUP_NAME, data.getGroup_name())
-//                                        .withString(Constant.K_GROUP_AVATAR, data.getGroup_image())
-//                                        .navigation();
-//
+////                                ARouter.getInstance().build(ARouterPath.PATH_CHAT_CHAT_ACTIVITY).withString(Constant.K_GROUP_ID, data.getGroup_id()).withString(Constant.K_GROUP_NAME, data.getGroup_name())
+////                                        .withString(Constant.K_GROUP_AVATAR, data.getGroup_image())
+////                                        .navigation();
+//                                //跳转到群组聊天界面
+//                                Bundle args = new Bundle();
+//                                args.putLong("user_id", Long.parseLong(userId));
+//                                baseFragment.presentFragment(new ProfileActivity(args));
 //                            }
 //
 //                            @Override
@@ -289,37 +306,28 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
 //                                super.onError(e);
 //                            }
 //                        });
-                    } else if (finalWorkingText.contains("https://u.cricdit.com/")) {
-                        int index = finalWorkingText.indexOf("https://u.cricdit.com/");
-                        int end = finalWorkingText.indexOf(" ", index);
-                        String userId;
-                        if (end != -1) {
-                            userId = finalWorkingText.substring(index + "https://g.cricdit.com/".length(), end);
-                        } else {
-                            userId = finalWorkingText.substring(index + "https://g.cricdit.com/".length());
-                        }
-//                        ARouter.getInstance().build(ARouterPath.PATH_CHAT_CHAT_ACTIVITY).withString(Constant.K_ID, userId)
-//                                .navigation();
-//                        ARouter.getInstance()
-//                                .build(ARouterPath.PATH_MAIN_PERSON_DETAIL_ACTIVITY)
-//                                .withString(Constants.USER_ID, userId)
-//                                .navigation();
                     }
+//                    else if (finalWorkingText.contains("https://t.me/")) {
+//                        int index = finalWorkingText.indexOf("https://t.me/");
+//                        int end = finalWorkingText.indexOf(" ", index);
+//                        String userId;
+//                        if (end != -1) {
+//                            userId = finalWorkingText.substring(index + "https://t.me/".length(), end);
+//                        } else {
+//                            userId = finalWorkingText.substring(index + "https://t.me/".length());
+//                        }
+////                        ARouter.getInstance().build(ARouterPath.PATH_CHAT_CHAT_ACTIVITY).withString(Constant.K_ID, userId)
+////                                .navigation();
+//                        //跳转到个人聊天界面
+////                        Bundle args = new Bundle();
+////                        args.putLong("user_id", Long.parseLong(userId));
+////                        baseFragment.presentFragment(new ProfileActivity(args));
+//                    }
                 }
             };
 
-            if (workingText.contains("https://g.cricdit.com/")) {
-                int index = workingText.indexOf("https://g.cricdit.com/");
-                int end = workingText.indexOf(" ", index);
-                if (end != -1)
-                    style.setSpan(clickableSpan,
-                            index, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-                else {
-                    style.setSpan(clickableSpan,
-                            index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-                }
-            } else if (workingText.contains("https://u.cricdit.com/")) {
-                int index = workingText.indexOf("https://u.cricdit.com/");
+            if (workingText.contains("https://t.me/")) {
+                int index = workingText.indexOf("https://t.me/");
                 int end = workingText.indexOf(" ", index);
                 if (end != -1)
                     style.setSpan(clickableSpan,
@@ -329,20 +337,23 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
                             index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                 }
             }
+//            else if (workingText.contains("https://u.cricdit.com/")) {
+//                int index = workingText.indexOf("https://u.cricdit.com/");
+//                int end = workingText.indexOf(" ", index);
+//                if (end != -1)
+//                    style.setSpan(clickableSpan,
+//                            index, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+//                else {
+//                    style.setSpan(clickableSpan,
+//                            index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+//                }
+//            }
             setText(style);
 
             //设置部分文字颜色
             ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(Color.parseColor("#0000FF"));
-            if (workingText.contains("https://g.cricdit.com/")) {
-                int index = workingText.indexOf("https://g.cricdit.com/");
-                int end = workingText.indexOf(" ", index);
-                if (end != -1)
-                    style.setSpan(foregroundColorSpan, index, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-                else {
-                    style.setSpan(foregroundColorSpan, index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-                }
-            } else if (workingText.contains("https://u.cricdit.com/")) {
-                int index = workingText.indexOf("https://u.cricdit.com/");
+            if (workingText.contains("https://t.me/")) {
+                int index = workingText.indexOf("https://t.me/");
                 int end = workingText.indexOf(" ", index);
                 if (end != -1)
                     style.setSpan(foregroundColorSpan, index, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -350,6 +361,15 @@ public class ExpandTextView extends androidx.appcompat.widget.AppCompatTextView
                     style.setSpan(foregroundColorSpan, index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                 }
             }
+//            else if (workingText.contains("https://u.cricdit.com/")) {
+//                int index = workingText.indexOf("https://u.cricdit.com/");
+//                int end = workingText.indexOf(" ", index);
+//                if (end != -1)
+//                    style.setSpan(foregroundColorSpan, index, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+//                else {
+//                    style.setSpan(foregroundColorSpan, index, workingText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+//                }
+//            }
             //配置给TextView
             setMovementMethod(LinkMovementMethod.getInstance());
             setText(style);

+ 1 - 0
TMessagesProj/src/main/res/layout/activity_news_detail_comment.xml

@@ -159,6 +159,7 @@
         android:layout_height="match_parent"
         app:emptyView="@layout/layout_no_data"
         app:errorView="@layout/layout_no_data"
+        android:visibility="gone"
         app:noNetworkView="@layout/layout_no_data" />
 
 </RelativeLayout>

+ 1 - 0
TMessagesProj/src/main/res/layout/activity_rank_detail_comment.xml

@@ -131,6 +131,7 @@
         android:id="@+id/status_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:visibility="gone"
         app:emptyView="@layout/layout_no_data"
         app:errorView="@layout/layout_no_data"
         app:noNetworkView="@layout/layout_no_data" />

+ 10 - 1
TMessagesProj/src/main/res/layout/fragment_comment.xml

@@ -62,7 +62,7 @@
             android:paddingTop="9dp"
             android:paddingRight="18dp"
             android:paddingBottom="9dp"
-            android:visibility="visible"
+            android:visibility="gone"
             app:layout_constraintBottom_toBottomOf="parent">
 
 
@@ -133,6 +133,15 @@
                 android:textColor="#ff333333"
                 android:textSize="14sp" />
         </RelativeLayout>
+
+        <com.classic.common.MultipleStatusView
+            android:id="@+id/status_view"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            app:emptyView="@layout/layout_no_data"
+            app:errorView="@layout/layout_no_data"
+            app:noNetworkView="@layout/layout_no_data" />
     </RelativeLayout>
 
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 6 - 2
TMessagesProj/src/main/res/layout/item_news_head.xml

@@ -28,14 +28,18 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="17sp"
-            android:textStyle="bold"/>
+            android:textStyle="bold"
+            android:maxLines="1"
+            android:ellipsize="end"/>
 
         <TextView
             android:id="@+id/tv_user_sign"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:textSize="13sp"
-            android:layout_marginTop="2dp"/>
+            android:layout_marginTop="2dp"
+            android:maxLines="1"
+            android:ellipsize="end"/>
 
     </LinearLayout>
 

+ 1 - 0
TMessagesProj/src/main/res/values/string-cricdit.xml

@@ -120,4 +120,5 @@
     <string name="financial_ranking">Financial ranking</string>
     <string name="send">Send</string>
     <string name="empty_tip">The content cannot be empty</string>
+    <string name="post_resource_size_tip">Description Failed to upload resources exceeding 10MB.</string>
 </resources>

+ 3 - 3
TMessagesProj_App/bundleAfat_SDK23/release/output-metadata.json

@@ -11,9 +11,9 @@
       "type": "SINGLE",
       "filters": [],
       "attributes": [],
-      "versionCode": 1,
-      "versionName": "0.0.1",
-      "outputFile": "app.apk"
+      "versionCode": 5,
+      "versionName": "0.0.4",
+      "outputFile": "Cricdit0.0.4.apk"
     }
   ],
   "elementType": "File"

+ 2 - 2
gradle.properties

@@ -15,8 +15,8 @@
 #Sat Mar 12 05:53:50 MSK 2016
 #APP_VERSION_NAME=9.0.2
 #APP_VERSION_CODE=2808
-APP_VERSION_NAME=0.0.3
-APP_VERSION_CODE=4
+APP_VERSION_NAME=0.0.4
+APP_VERSION_CODE=5
 #APP_PACKAGE=org.telegram.messenger
 APP_PACKAGE=com.cricdit.cricdit
 RELEASE_KEY_PASSWORD=123456