소스 검색

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

Huping 1 년 전
부모
커밋
15f78eaf62

+ 3 - 9
TMessagesProj/src/main/java/org/telegram/cricdit/adapter/PublishRankingAdapter.java

@@ -1,15 +1,11 @@
 package org.telegram.cricdit.adapter;
 
-import android.app.Activity;
 import android.content.Context;
 import android.widget.ImageView;
-import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.RecyclerView;
 
-import com.airbnb.lottie.animation.content.Content;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.resource.bitmap.CenterCrop;
 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
@@ -20,8 +16,6 @@ import com.chad.library.adapter.base.BaseViewHolder;
 import org.telegram.cricdit.bean.PublishRankBean;
 import org.telegram.cricdit.utils.UIUtil;
 import org.telegram.messenger.R;
-import org.telegram.onecric.base.BaseActivity;
-import org.telegram.tgnet.TLRPC;
 
 import java.util.List;
 
@@ -29,15 +23,15 @@ public class PublishRankingAdapter extends BaseQuickAdapter<PublishRankBean, Bas
     private RequestOptions options;
     public PublishRankingAdapter(Context context, int layoutResId, @Nullable List<PublishRankBean> data) {
         super(layoutResId, data);
-        options = new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(UIUtil.dip2px(context, 5)));
+        options = new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(UIUtil.dip2px(context, 7)));
     }
 
     @Override
     protected void convert(@NonNull BaseViewHolder helper, PublishRankBean item) {
         helper.setText(R.id.tv_name,item.name);
-        helper.setText(R.id.tv_info,item.info);
+        helper.setText(R.id.tv_info,item.introduce);
         Glide.with(helper.itemView)
-                .load(item.phoneUrl)
+                .load(item.img)
                 .placeholder(R.drawable.img_placeholder_short)
                 .apply(options)
                 .into((ImageView) helper.getView(R.id.iv_img));

+ 8 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/bean/BaseCodeBean.java

@@ -0,0 +1,8 @@
+package org.telegram.cricdit.bean;
+
+public class BaseCodeBean {
+    public int code;
+    public String msg;
+    public String time;
+    public String data;
+}

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

@@ -3,12 +3,12 @@ package org.telegram.cricdit.bean;
 public class PublishRankBean {
     public int position = -1;
     public String name;
-    public String info;
-    public String phoneUrl;
+    public String introduce;
+    public String img;
     public PublishRankBean(int position,String name,String info,String phoneUrl){
         this.position = position;
         this.name = name;
-        this.info = info;
-        this.phoneUrl = phoneUrl;
+        this.introduce = info;
+        this.img = phoneUrl;
     }
 }

+ 57 - 1
TMessagesProj/src/main/java/org/telegram/cricdit/mvp/PublishRankingPresenter.java

@@ -1,15 +1,35 @@
 package org.telegram.cricdit.mvp;
 
+import android.text.TextUtils;
+
 import org.telegram.cricdit.base.BaseObserver;
 import org.telegram.cricdit.base.BasePresenter;
+import org.telegram.cricdit.bean.BaseBean;
+import org.telegram.cricdit.bean.BaseCodeBean;
+import org.telegram.cricdit.bean.PersonFollowingBean;
+import org.telegram.cricdit.bean.PublishRankBean;
+import org.telegram.cricdit.config.Constants;
 import org.telegram.cricdit.net.ApiService;
+import org.telegram.cricdit.net.Parameter;
+import org.telegram.cricdit.net.RetrofitClient;
+import org.telegram.cricdit.utils.AESUtil;
+import org.telegram.cricdit.utils.GsonHel;
+import org.telegram.cricdit.utils.ParamsUtil;
+import org.telegram.cricdit.utils.SPUtils;
 import org.telegram.cricdit.utils.ToastUtil;
+import org.telegram.messenger.LocaleController;
+import org.telegram.messenger.R;
+import org.telegram.messenger.UserConfig;
 
 import java.io.File;
+import java.io.IOException;
+import java.util.List;
 
 import okhttp3.MediaType;
 import okhttp3.MultipartBody;
 import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
 
 public class PublishRankingPresenter extends BasePresenter<PublishRankingView> {
 
@@ -34,8 +54,44 @@ public class PublishRankingPresenter extends BasePresenter<PublishRankingView> {
         });
     }
 
-    public void publishRanking(){
+    public void publishRanking(String title, List<PublishRankBean> list){
+        Parameter parameter = new Parameter();
+        parameter.add("operationID", ParamsUtil.buildOperationID());
+        parameter.add("data", list);
+        parameter.add("title", title);
+        parameter.add("user_id", UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser().id + "");
+        ApiService apiService = RetrofitClient.getInstance().getRetrofit().create(ApiService.class);
+        Call<ResponseBody> responseCall = apiService.publicRanking(parameter.buildJsonBody());
+        responseCall.enqueue(new retrofit2.Callback<ResponseBody>() {
+            @Override
+            public void onResponse(Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {
+                try {
+                    if (response.body() == null) {
+                        return;
+                    }
+                    String string = response.body().string();
+                    if (TextUtils.isEmpty(string)) {
+                        return;
+                    }
+                    BaseCodeBean baseBean = GsonHel.fromJson(string, BaseCodeBean.class);
+                    if(getView()==null){
+                        return;
+                    }
+                    if (baseBean.code == 1) {
+                        getView().showSuccess(LocaleController.getString(R.string.publish_success));
+                    }else{
+                        getView().showSuccess(LocaleController.getString(R.string.publish_fail));
+                    }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
 
+            @Override
+            public void onFailure(Call<ResponseBody> call, Throwable t) {
+                if(getView()!=null){getView().showError(t);}
+            }
+        });
     }
 
 }

+ 3 - 0
TMessagesProj/src/main/java/org/telegram/cricdit/net/ApiService.java

@@ -173,4 +173,7 @@ public interface ApiService {
     @POST(Constants.APP_AUTH_URL + "/demo/video_limit")
     Observable<BaseResponse<VideoLimitBean>> getVideoLimit(@Body RequestBody requestBody);
 
+    @POST("https://pf.cricdit.com/index.php/api/Rank/GetCategories")
+    Call<ResponseBody> publicRanking(@Body RequestBody requestBody);
+
 }

+ 67 - 46
TMessagesProj/src/main/java/org/telegram/cricdit/ui/PublishRankingActivity.java

@@ -1,7 +1,9 @@
 package org.telegram.cricdit.ui;
 
+import android.content.Context;
 import android.graphics.drawable.GradientDrawable;
 import android.os.Build;
+import android.os.Vibrator;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.TextUtils;
@@ -9,6 +11,7 @@ import android.text.TextWatcher;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.inputmethod.EditorInfo;
@@ -33,6 +36,7 @@ import org.telegram.cricdit.bean.RankVoteEvent;
 import org.telegram.cricdit.config.Config;
 import org.telegram.cricdit.mvp.PublishRankingPresenter;
 import org.telegram.cricdit.mvp.PublishRankingView;
+import org.telegram.cricdit.net.ApiException;
 import org.telegram.cricdit.utils.ColorUtil;
 import org.telegram.cricdit.utils.EventBusHelper;
 import org.telegram.cricdit.utils.ToastUtil;
@@ -40,11 +44,13 @@ import org.telegram.cricdit.utils.UIUtil;
 import org.telegram.messenger.AndroidUtilities;
 import org.telegram.messenger.LocaleController;
 import org.telegram.messenger.R;
+import org.telegram.messenger.UserConfig;
 import org.telegram.ui.ActionBar.ActionBarMenu;
 import org.telegram.ui.ActionBar.ActionBarMenuItem;
 import org.telegram.ui.ActionBar.Theme;
 import org.telegram.ui.Components.EditTextBoldCursor;
 import org.telegram.ui.Components.LayoutHelper;
+import org.telegram.ui.Components.NumberTextView;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -52,15 +58,18 @@ import java.util.List;
 public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter> implements PublishRankingView {
 
     private RecyclerView mRecyclerView;
+    private View view;
 //    private EditTextBoldCursor firstNameField;
 //    private FrameLayout mHeadContainer;
     private PublishRankingAdapter mAdapter;
     private List<PublishRankBean> mPublishRankBeanList;
     private EditText et_title;
-    private TextView tv_title_length;
+    private NumberTextView tv_title_length;
     private TextView tv_2;
     private View view_add;
+    private LinearLayout ll_title;
     private ActionBarMenuItem actionBarMenuItem;
+    private final int maxTitleLength = 50;
     @Override
     protected int getLayoutResId() {
         return R.layout.activity_publish_ranking;
@@ -78,17 +87,32 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
 
     @Override
     protected void initView(View view) {
+        this.view = view;
         mRecyclerView = view.findViewById(R.id.publish_ranking_recyclerview);
         et_title = view.findViewById(R.id.et_title);
-        tv_title_length = view.findViewById(R.id.tv_title_length);
         tv_2 = view.findViewById(R.id.tv_2);
         view_add = view.findViewById(R.id.view_add);
-
+        ll_title = view.findViewById(R.id.ll_title);
+
+        tv_title_length = new NumberTextView(getContext());
+        tv_title_length.setCenterAlign(true);
+        tv_title_length.setTextSize(15);
+        tv_title_length.setNumber(maxTitleLength, false);
+        tv_title_length.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
+        tv_title_length.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+        ll_title.addView(tv_title_length, LayoutHelper.createFrame(26, 20, LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT, 0, 0, 0, 0));
+        et_title.setHorizontallyScrolling(false);
         EventBusHelper.register(this);
 
         mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
         mPublishRankBeanList = new ArrayList<>();
         mAdapter = new PublishRankingAdapter(getContext(),R.layout.item_publish_rank, mPublishRankBeanList);
+        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.layout_empty_view, null, false);
+        inflate.setPadding(0,UIUtil.dip2px(getContext(),50),0,0);
+
+        TextView tvTip = inflate.findViewById(R.id.empty_view_title);
+        tvTip.setText(LocaleController.getString(R.string.no_options));
+        mAdapter.setEmptyView(inflate);
         mRecyclerView.setAdapter(mAdapter);
 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
@@ -98,11 +122,6 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
         }
 
         initListener();
-
-/*        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.head_publish_rank, null, false);
-        mHeadContainer = inflate.findViewById(R.id.head_publish_ranking_container);
-        initEdit();
-        mAdapter.addHeaderView(inflate);*/
     }
 
     private void initListener(){
@@ -117,9 +136,10 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
                 return;
             }
             if(mPublishRankBeanList.size() > 1){
-                //fixme ltt 请求接口,发布排行榜
-                ToastUtil.show(getContext(),LocaleController.getString(R.string.publish_success));
-                finishFragment();
+                AndroidUtilities.hideKeyboard(et_title);
+                if (UserConfig.getInstance(UserConfig.selectedAccount).isClientActivated()) {
+                    presenter.publishRanking(title,mPublishRankBeanList);
+                }
             }
         });
 
@@ -133,21 +153,35 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
 
         et_title.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 s, int i, int i1, int i2) {
+                int remainLength = maxTitleLength - Character.codePointCount(s, 0, s.length());
+                if(remainLength < 0){
+                    et_title.setText(s.subSequence(0,maxTitleLength));
+                    et_title.setSelection(s.subSequence(0,maxTitleLength).length());
+                    Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
+                    if (v != null) {
+                        v.vibrate(200);
+                    }
+                    AndroidUtilities.shakeView(tv_title_length, 2, 0);
+                }else{
+                    tv_title_length.setNumber(remainLength,true);
+                }
             }
 
             @Override
-            public void afterTextChanged(Editable editable) {
-                tv_title_length.setText(editable.length()+"/50");
-                //fixme ltt 加晃动动画
+            public void afterTextChanged(Editable s) {}
+        });
 
+        et_title.setOnEditorActionListener((v, actionId, event) -> {
+            if(actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_UNSPECIFIED){
+                et_title.clearFocus();
+                AndroidUtilities.hideKeyboard(et_title);
+                return true;
             }
+            return false;
         });
 
     }
@@ -168,10 +202,8 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
         //<2条时隐藏发布按钮,>9条隐藏添加按钮
         if(mPublishRankBeanList.size() > 1){
             actionBarMenuItem.setVisibility(View.VISIBLE);
-            tv_2.setVisibility(View.VISIBLE);
         }else{
             actionBarMenuItem.setVisibility(View.GONE);
-            tv_2.setVisibility(View.GONE);
         }
         actionBarMenuItem.setVisibility(mPublishRankBeanList.size() > 1 ? View.VISIBLE : View.GONE);
         view_add.setVisibility(mPublishRankBeanList.size() >9 ? View.GONE : View.VISIBLE);
@@ -183,37 +215,26 @@ public class PublishRankingActivity extends BaseActivity<PublishRankingPresenter
         EventBusHelper.unregister(this);
     }
 
-    private void initEdit() {
-/*
-        firstNameField = new EditTextBoldCursor(getContext());
-        firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
-        firstNameField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
-        firstNameField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
-        firstNameField.setBackgroundDrawable(null);
-        firstNameField.setLineColors(getThemedColor(Theme.key_windowBackgroundWhiteInputField), getThemedColor(Theme.key_windowBackgroundWhiteInputFieldActivated), getThemedColor(Theme.key_windowBackgroundWhiteRedText3));
-        firstNameField.setMaxLines(1);
-        firstNameField.setLines(1);
-        firstNameField.setPadding(0, 0, 0, 0);
-        firstNameField.setSingleLine(true);
-        firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
-        firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
-        firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
-        firstNameField.setHint(LocaleController.getString("UsernamePlaceholder", R.string.UsernamePlaceholder));
-        firstNameField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
-        firstNameField.setCursorSize(AndroidUtilities.dp(20));
-        firstNameField.setCursorWidth(1.5f);
-        mHeadContainer.addView(firstNameField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 24, 24, 24, 0));
-*/
-
+    @Override
+    public void onResume() {
+        super.onResume();
+        view.requestLayout();
     }
 
     @Override
-    public void showSuccess(String url) {
-        //pass
+    public void showSuccess(String info) {
+        ToastUtil.show(getContext(),info);
+        finishFragment();
     }
 
     @Override
     public void showError(Throwable e) {
-        //pass
+        if (!(e instanceof ApiException)) {
+            ToastUtil.show(getContext(),LocaleController.getString(R.string.network_failed));
+        } else {
+            ToastUtil.show(getContext(),e.getMessage());
+        }
     }
+
+
 }

+ 83 - 29
TMessagesProj/src/main/java/org/telegram/cricdit/ui/PublishRankingEditActivity.java

@@ -3,20 +3,23 @@ package org.telegram.cricdit.ui;
 import static android.app.Activity.RESULT_OK;
 import static com.luck.picture.lib.config.PictureConfig.CHOOSE_REQUEST;
 import static org.telegram.cricdit.config.Constants.FILE_SPECIFY_SIZE;
-import static org.telegram.cricdit.utils.Common.hideKeyboard;
 import static org.telegram.cricdit.view.pictureselect.ImageFileCompressEngine.getCompressFileEngine;
 import static org.telegram.cricdit.view.pictureselect.PictureGlideEngine.getPictureSelectorStyle;
 
+import android.content.Context;
 import android.content.Intent;
 import android.graphics.drawable.GradientDrawable;
 import android.os.Build;
+import android.os.Vibrator;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.TextWatcher;
+import android.view.Gravity;
 import android.view.View;
+import android.view.inputmethod.EditorInfo;
 import android.widget.EditText;
 import android.widget.ImageView;
-import android.widget.TextView;
+import android.widget.LinearLayout;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.resource.bitmap.CenterCrop;
 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
@@ -46,6 +49,9 @@ import org.telegram.messenger.R;
 import org.telegram.ui.ActionBar.ActionBarMenu;
 import org.telegram.ui.ActionBar.ActionBarMenuItem;
 import org.telegram.ui.ActionBar.AlertDialog;
+import org.telegram.ui.ActionBar.Theme;
+import org.telegram.ui.Components.LayoutHelper;
+import org.telegram.ui.Components.NumberTextView;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -54,15 +60,19 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
     private View view;
     private EditText et_name;
     private EditText et_info;
-    private TextView tv_name_length;
-    private TextView tv_info_length;
+    private NumberTextView tv_name_length;
+    private NumberTextView tv_info_length;
     private ImageView iv_select;
     private String photoUrl;
     private PublishRankBean optionBean;
     private AlertDialog dialog;
     private ImageEngine imageEngine;
+    private LinearLayout ll_name;
+    private LinearLayout ll_info;
     private ArrayList<LocalMedia> localMediaList;
     private PictureSelectorStyle selectorStyle;
+    private final int maxNameLength = 50;
+    private final int maxInfoLength = 1000;
 
     public PublishRankingEditActivity(){}
     public PublishRankingEditActivity(PublishRankBean bean){
@@ -88,10 +98,27 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
         this.view = view;
         et_name = view.findViewById(R.id.et_name);
         et_info = view.findViewById(R.id.et_info);
-        tv_name_length = view.findViewById(R.id.tv_name_length);
-        tv_info_length = view.findViewById(R.id.tv_info_length);
         iv_select = view.findViewById(R.id.iv_select);
+        ll_name = view.findViewById(R.id.ll_name);
+        ll_info = view.findViewById(R.id.ll_info);
         dialog = new AlertDialog(getContext(), 3);
+
+        tv_name_length = new NumberTextView(getContext());
+        tv_name_length.setCenterAlign(false);
+        tv_name_length.setTextSize(15);
+        tv_name_length.setNumber(maxNameLength, false);
+        tv_name_length.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
+        tv_name_length.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+        ll_name.addView(tv_name_length, LayoutHelper.createFrame(26, 20, Gravity.NO_GRAVITY, 0, 0, 0, 0));
+        et_name.setHorizontallyScrolling(false);
+        tv_info_length = new NumberTextView(getContext());
+        tv_info_length.setCenterAlign(true);
+        tv_info_length.setTextSize(15);
+        tv_info_length.setNumber(maxInfoLength, false);
+        tv_info_length.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
+        tv_info_length.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+        ll_info.addView(tv_info_length, LayoutHelper.createFrame(40, 20, Gravity.NO_GRAVITY, UIUtil.dip2px(getContext(),10), 0, 0, 0));
+
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
             GradientDrawable gd = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ColorUtil.COLOR_CHECKED, ColorUtil.COLOR_CHECKED});
             gd.setSize(UIUtil.dip2px(getContext(), 1.5), UIUtil.dip2px(getContext(), et_name.getTextCursorDrawable().getIntrinsicHeight()));
@@ -155,41 +182,62 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
             selectionModel.forResult(CHOOSE_REQUEST);
         });
 
-        et_name.addTextChangedListener(new TextWatcher() {
+        et_info.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 afterTextChanged(Editable s) {}
 
             @Override
-            public void afterTextChanged(Editable editable) {
-                tv_name_length.setText(editable.length()+"/50");
-                //fixme ltt 加晃动动画
-
+            public void onTextChanged(CharSequence s, int i, int i1, int i2) {
+                int remainLength = maxInfoLength - Character.codePointCount(s, 0, s.length());
+                if(remainLength < 0){
+                    et_info.setText(s.subSequence(0,maxInfoLength));
+                    et_info.setSelection(s.subSequence(0,maxInfoLength).length());
+                    Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
+                    if (v != null) {
+                        v.vibrate(200);
+                    }
+                    AndroidUtilities.shakeView(tv_info_length, 2, 0);
+                }else{
+                    tv_info_length.setNumber(remainLength,true);
+                }
             }
         });
 
-        et_info.addTextChangedListener(new TextWatcher() {
+        et_name.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 afterTextChanged(Editable s) {}
 
+            @Override
+            public void onTextChanged(CharSequence s, int i, int i1, int i2) {
+                int remainLength = maxNameLength - Character.codePointCount(s, 0, s.length());
+                if(remainLength < 0){
+                    et_name.setText(s.subSequence(0,maxNameLength));
+                    et_name.setSelection(s.subSequence(0,maxNameLength).length());
+                    Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
+                    if (v != null) {
+                        v.vibrate(200);
+                    }
+                    AndroidUtilities.shakeView(tv_name_length, 2, 0);
+                }else{
+                    tv_name_length.setNumber(remainLength,true);
+                }
             }
 
-            @Override
-            public void afterTextChanged(Editable editable) {
-                tv_info_length.setText(editable.length()+"/1000");
 
+        });
+
+        et_name.setOnEditorActionListener((v, actionId, event) -> {
+            if(actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_UNSPECIFIED){
+                et_info.requestFocus();
+                return true;
             }
+            return false;
         });
 
         initData();
@@ -197,10 +245,10 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
 
     private void initData(){
         if(optionBean!=null){
-            photoUrl = optionBean.phoneUrl;
-            Glide.with(getContext()).load(photoUrl).placeholder(R.mipmap.img_select_add).into(iv_select);
+            photoUrl = optionBean.img;
+            Glide.with(getContext()).load(photoUrl).placeholder(R.mipmap.img_select_add).apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(UIUtil.dip2px(getContext(), 7)))).into(iv_select);
             et_name.setText(optionBean.name);
-            et_info.setText(optionBean.info);
+            et_info.setText(optionBean.introduce);
         }
     }
 
@@ -211,7 +259,7 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
         Glide.with(getContext())
                 .load(photoUrl)
                 .placeholder(R.mipmap.img_select_add)
-                .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(UIUtil.dip2px(getContext(), 5))))
+                .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(UIUtil.dip2px(getContext(), 7))))
                 .into(iv_select);
     }
 
@@ -240,4 +288,10 @@ public class PublishRankingEditActivity extends BaseActivity<PublishRankingPrese
             }
         }
     }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        view.requestLayout();
+    }
 }

+ 9 - 16
TMessagesProj/src/main/res/layout/activity_publish_ranking.xml

@@ -21,36 +21,30 @@
         android:id="@+id/ll_title"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:minHeight="45dp"
         android:orientation="horizontal"
         android:background="@drawable/shape_cccccc_5dp_stroke_rec"
         android:layout_margin="13dp"
-        android:padding="9dp"
+        android:paddingLeft="9dp"
+        android:paddingRight="9dp"
+        android:paddingTop="3dp"
+        android:paddingBottom="3dp"
         android:gravity="center_vertical"
         android:layout_below="@id/tv_1">
         
         <EditText
             android:id="@+id/et_title"
             android:layout_width="0dp"
-            android:layout_height="wrap_content"
+            android:layout_height="55dp"
             android:layout_weight="1"
             android:background="@null"
             android:hint="@string/please_enter_a_title"
             android:textColorHint="@color/c_A0A4A7"
-            android:maxLength="50"
             android:textSize="@dimen/sp_16"
-            android:inputType="text"
-            android:imeOptions="actionDone"/>
+            android:maxLength="51"
+            android:inputType="textMultiLine"
+            android:imeOptions="actionDone"
+            android:layout_marginRight="@dimen/dp_10" />
 
-        <TextView
-            android:id="@+id/tv_title_length"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/c_A0A4A7"
-            android:textSize="@dimen/sp_16"
-            android:text="0/50"
-            android:layout_marginLeft="@dimen/dp_10"/>
-        
     </LinearLayout>
 
     <View
@@ -71,7 +65,6 @@
         android:textColor="@color/c_111111"
         android:text="@string/voting_options"
         android:layout_below="@id/view_line"
-        android:visibility="invisible"
         android:textStyle="bold"/>
 
     <androidx.recyclerview.widget.RecyclerView

+ 18 - 30
TMessagesProj/src/main/res/layout/activity_publish_ranking_edit.xml

@@ -12,46 +12,41 @@
         android:src="@mipmap/img_select_add"
         android:scaleType="centerCrop"
         android:layout_gravity="center_horizontal"
-        android:layout_marginBottom="23dp"/>
+        android:layout_marginBottom="25dp"/>
 
     <LinearLayout
+        android:id="@+id/ll_name"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:minHeight="45dp"
         android:orientation="horizontal"
         android:background="@drawable/shape_cccccc_5dp_stroke_rec"
         android:layout_margin="13dp"
-        android:padding="9dp"
+        android:paddingLeft="9dp"
+        android:paddingTop="3dp"
+        android:paddingBottom="3dp"
+        android:paddingRight="9dp"
         android:gravity="center_vertical"
         android:layout_below="@id/tv_1">
 
         <EditText
             android:id="@+id/et_name"
             android:layout_width="0dp"
-            android:layout_height="wrap_content"
+            android:layout_height="55dp"
             android:layout_weight="1"
-            android:maxLength="50"
-            android:maxLines="1"
+            android:maxLength="51"
             android:background="@null"
             android:hint="@string/please_enter_name"
             android:textColorHint="@color/c_A0A4A7"
             android:textSize="@dimen/sp_16"
-            android:inputType="text"
-            android:imeOptions="actionNext"/>
-
-        <TextView
-            android:id="@+id/tv_name_length"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/c_A0A4A7"
-            android:textSize="@dimen/sp_16"
-            android:text="0/50"
-            android:layout_marginLeft="@dimen/dp_10"
-            android:layout_marginTop="2.5dp"/>
+            android:inputType="textMultiLine"
+            android:imeOptions="actionNext"
+            android:layout_marginRight="@dimen/dp_10"
+            android:paddingRight="9dp"/>
 
     </LinearLayout>
 
     <LinearLayout
+        android:id="@+id/ll_info"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:minHeight="45dp"
@@ -59,7 +54,9 @@
         android:background="@drawable/shape_cccccc_5dp_stroke_rec"
         android:layout_marginLeft="13dp"
         android:layout_marginRight="13dp"
-        android:padding="9dp">
+        android:layout_marginTop="2.5dp"
+        android:padding="9dp"
+        android:gravity="right">
 
         <EditText
             android:id="@+id/et_info"
@@ -70,17 +67,8 @@
             android:textSize="@dimen/sp_16"
             android:hint="@string/please_enter_introduction"
             android:textColorHint="@color/c_A0A4A7"
-            android:maxLength="1000"/>
-
-        <TextView
-            android:id="@+id/tv_info_length"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/c_A0A4A7"
-            android:textSize="@dimen/sp_16"
-            android:text="0/1000"
-            android:layout_gravity="right"
-            android:layout_marginTop="5dp"/>
+            android:maxLength="1001"
+            android:layout_marginBottom="5dp"/>
 
     </LinearLayout>
 

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

@@ -139,6 +139,8 @@
     <string name="please_enter_name">Please enter a name</string>
     <string name="please_enter_introduction">Please enter a brief introduction</string>
     <string name="please_upload_image">Please upload a image.</string>
-    <string name="publish_success">Successful release</string>
+    <string name="publish_success">Submitted for review</string>
+    <string name="publish_fail">Submit failure</string>
+    <string name="no_options">No more</string>
 
 </resources>

+ 20 - 0
TMessagesProj_App/bundleAfat/release/output-metadata.json

@@ -0,0 +1,20 @@
+{
+  "version": 3,
+  "artifactType": {
+    "type": "APK",
+    "kind": "Directory"
+  },
+  "applicationId": "com.cricdit.cricdit",
+  "variantName": "bundleAfatRelease",
+  "elements": [
+    {
+      "type": "SINGLE",
+      "filters": [],
+      "attributes": [],
+      "versionCode": 13,
+      "versionName": "0.1.2",
+      "outputFile": "Cricdit0.1.2.apk"
+    }
+  ],
+  "elementType": "File"
+}

BIN
TMessagesProj_App/bundleAfat_SDK23/release/icon_select_tournament_true.png