Forráskód Böngészése

红包和分享界面的修改

jixionghui 4 éve
szülő
commit
069124c284

+ 3 - 1
jixin/src/main/java/com/jixin/im/bean/RoomMember.java

@@ -4,11 +4,13 @@ import com.j256.ormlite.field.DatabaseField;
 import com.j256.ormlite.table.DatabaseTable;
 import com.jixin.im.db.dao.RoomMemberDaoImpl;
 
+import java.io.Serializable;
+
 /**
  * Created by zq on 2017/6/27 0027.
  */
 @DatabaseTable(daoClass = RoomMemberDaoImpl.class)
-public class RoomMember {
+public class RoomMember  implements Serializable {
     public static final int ROLE_OWNER = 1;
     public static final int ROLE_MANAGER = 2;
     public static final int ROLE_MEMBER = 3;

+ 5 - 4
jixin/src/main/java/com/jixin/im/fragment/MucChatFragment.java

@@ -125,6 +125,7 @@ import com.jixin.im.ui.me.bubble.SidaiCenterActivity;
 import com.jixin.im.ui.me.emot.EmotBean;
 import com.jixin.im.ui.me.redpacket.MucSendRedPacketActivity;
 import com.jixin.im.ui.me.redpacket.RedDetailsActivity;
+import com.jixin.im.ui.message.ChatActivity;
 import com.jixin.im.ui.message.EventMoreSelected;
 import com.jixin.im.ui.message.MucChatActivityTest;
 import com.jixin.im.ui.message.QuickSendPreviewActivity;
@@ -2405,10 +2406,10 @@ public class MucChatFragment extends EasyFragment implements
 
     @Override
     public void clickRedpacket() {
-        Intent intent = new Intent(mContext, MucSendRedPacketActivity.class);
-        intent.putExtra(AppConstant.EXTRA_USER_ID, mUseId);
-        intent.putExtra(AppConstant.EXTRA_MEMBER_NUM, mCurrentMemberNum);
-        startActivityForResult(intent, ChatFragment.REQUEST_CODE_SEND_RED);
+        Intent intent = new Intent(getContext(), MucSendRedPacketActivity.class);
+        intent.putExtra("roomId",roomId);
+        startActivityForResult(intent, ChatActivity.REQUEST_CODE_SEND_RED);
+
     }
 
     @Override

+ 252 - 0
jixin/src/main/java/com/jixin/im/fragment/MucSendPacketFragment.java

@@ -0,0 +1,252 @@
+package com.jixin.im.fragment;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.google.zxing.common.StringUtils;
+import com.jixin.im.R;
+import com.jixin.im.bean.RoomMember;
+import com.jixin.im.ui.base.EasyFragment;
+import com.jixin.im.ui.me.redpacket.PayPasswordVerifyDialog;
+import com.jixin.im.ui.message.ChatActivity;
+import com.jixin.im.ui.message.MucChatActivity;
+import com.jixin.im.ui.message.multi.GroupMoreFeaturesActivity;
+import com.jixin.im.util.MoneyValueFilter;
+import com.jixin.im.util.ToastUtil;
+
+
+import java.util.Objects;
+
+import static android.app.Activity.RESULT_OK;
+
+public class MucSendPacketFragment extends EasyFragment {
+    public static final int CODE_REQUEST_SELECT_RECEIVER = 1108;
+    private static final String TAG = MucSendPacketFragment.class.getSimpleName();
+    private int redPacketType;
+    private String mReceiverId;
+    private String toUserName;
+    private String mRoomId;
+
+    private EditText editRedPacketCount, editMoneyAmount, edtWishText;
+    private Button btnSendRedPacket;
+    private TextView tvRedPacketHint,tvReceiver;
+
+    @Override
+    protected int inflateLayoutId() {
+        return R.layout.fragment_muc_send_red_packet;
+    }
+
+    @Override
+    protected void onActivityCreated(Bundle savedInstanceState, boolean createView) {
+        if (createView){
+            initView();
+        }
+    }
+
+    public void setRoomId(String mRoomId) {
+        this.mRoomId = mRoomId;
+    }
+
+    private void  initView(){
+        editMoneyAmount = findViewById(R.id.edit_money_amount);
+        editMoneyAmount.setFilters(new InputFilter[] {new MoneyValueFilter()});
+        edtWishText = findViewById(R.id.edt_wish_text);
+        tvRedPacketHint = findViewById(R.id.tv_red_packet_hint);
+        editRedPacketCount = findViewById(R.id.edit_red_packet_count);
+        btnSendRedPacket = findViewById(R.id.btn_sendRedPacket);
+        tvReceiver = findViewById(R.id.tv_receiver);
+        btnSendRedPacket.setOnClickListener(view -> {
+
+            sendRedPacket();
+
+        });
+        findViewById(R.id.rlt_select_receiver).setOnClickListener(view -> {
+            Intent intent = new Intent(getContext(), GroupMoreFeaturesActivity.class);
+            intent.putExtra("roomId",mRoomId);
+            intent.putExtra("isSelectReceiver",true);
+            startActivityForResult(intent,CODE_REQUEST_SELECT_RECEIVER);
+
+        });
+
+        if (redPacketType==1){
+            tvRedPacketHint.setText(R.string.hint_money_all_same);
+        }else {
+            tvRedPacketHint.setText(R.string.hint_lucky_red_packet);
+        }
+        editMoneyAmount.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable editable) {
+                checkMoney(editable.toString(),editRedPacketCount.getText().toString(),mReceiverId);
+
+            }
+        });
+
+        editRedPacketCount.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable editable) {
+                checkMoney(editMoneyAmount.getText().toString(),editable.toString(),mReceiverId);
+
+            }
+        });
+
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == CODE_REQUEST_SELECT_RECEIVER){
+            if (resultCode == RESULT_OK){
+                RoomMember roomMember =(RoomMember) data.getSerializableExtra("selectReceiver");
+                tvReceiver.setText(roomMember.getUserName());
+                mReceiverId = roomMember.getUserId();
+                toUserName = roomMember.getUserName();
+                editRedPacketCount.setText("1");
+
+            }
+        }
+    }
+
+    private void checkMoney(String moneyAmount, String memberCount, String receiverId) {
+        double money = 0.00f;
+        int count = 0;
+        try {
+            if (!TextUtils.isEmpty(moneyAmount)) {
+                money = Double.parseDouble(moneyAmount);
+            }
+            if (!TextUtils.isEmpty(memberCount)) {
+                count = Integer.parseInt(memberCount);
+            }
+
+        } catch (NumberFormatException e) {
+            Log.i(TAG, Objects.requireNonNull(e.getMessage()));
+
+        }
+        if (TextUtils.isEmpty(receiverId)){
+            if (money>0.01){
+                setSendButtonStatus(true);
+            }else {
+                setSendButtonStatus(false);
+            }
+
+        }else {
+            if (count <= 0 || money / count < 0.01) {
+                setSendButtonStatus(false);
+            } else {
+                setSendButtonStatus(true);
+            }
+
+        }
+
+
+    }
+    private void setSendButtonStatus(boolean isNormal) {
+        if (isNormal) {
+            btnSendRedPacket.setSelected(false);
+            btnSendRedPacket.setSelected(true);
+        } else {
+            btnSendRedPacket.setSelected(false);
+            btnSendRedPacket.setSelected(true);
+        }
+    }
+    private void sendRedPacket(){
+        String money = editMoneyAmount.getText().toString();
+        String count = editRedPacketCount.getText().toString();
+        String textWish = edtWishText.getText().toString();
+        if (TextUtils.isEmpty(textWish)){
+            textWish = getString(R.string.best_wishes);
+        }
+        if (eqData(money,count,textWish)){
+            PayPasswordVerifyDialog dialog = new PayPasswordVerifyDialog(getContext());
+            dialog.setAction(getString(R.string.chat_redpacket));
+
+            dialog.setMoney(money);
+            final String finalMoney = money;
+            final String finalWords = textWish;
+            final String finalCount = count;
+            dialog.setOnInputFinishListener(password -> {
+                final Bundle bundle = new Bundle();
+                final Intent intent = new Intent(getContext(), MucChatActivity.class);
+
+                bundle.putString("money", finalMoney);
+                bundle.putString("count", finalCount);
+                bundle.putString("words", finalWords);
+                // 拼手气与普通红包位置对调,修改type
+                // bundle.putString("type", (item + 1) + "");
+
+                if (!TextUtils.isEmpty(mReceiverId)){
+                    redPacketType=4;
+                }
+                bundle.putString("type",  redPacketType+"");
+                bundle.putString("receiver",mReceiverId);
+                bundle.putString("payPassword", password);
+                bundle.putString("toUserName",toUserName);
+                int resultCode = ChatActivity. REQUEST_CODE_SEND_RED_PT;
+                if (redPacketType==1){
+                    resultCode =ChatActivity. REQUEST_CODE_SEND_RED_PT;
+                }else if (redPacketType ==2){
+
+                    resultCode =ChatActivity. REQUEST_CODE_SEND_RED_PSQ;
+
+                }
+                intent.putExtras(bundle);
+                getActivity() .setResult(resultCode, intent);
+                getActivity().finish();
+            });
+
+            dialog.show();
+        }
+
+
+    }
+
+    private boolean eqData(String money, String count, String words) {
+        if (TextUtils.isEmpty(money)) {
+            ToastUtil.showToast(getContext(), getString(R.string.need_input_money));
+            return false;
+        } else if (Double.parseDouble(money) > 1800 || Double.parseDouble(money) <= 0) {
+            ToastUtil.showToast(getContext(), getString(R.string.red_packet_range));
+            return false;
+        } else if (Double.parseDouble(money) > coreManager.getSelf().getBalance()) {
+            ToastUtil.showToast(getContext(), getString(R.string.balance_not_enough));
+            return false;
+        } else if (TextUtils.isEmpty(count)) {
+            ToastUtil.showToast(getContext(), getString(R.string.need_red_packet_count));
+            return false;
+        } else if (TextUtils.isEmpty(words)) {
+            return false;
+        }
+        return true;
+    }
+
+    public void setRedPacketType(int type) {
+        this.redPacketType = type;
+    }
+}

+ 10 - 0
jixin/src/main/java/com/jixin/im/ui/base/BaseActivity.java

@@ -2,8 +2,15 @@ package com.jixin.im.ui.base;
 
 import android.content.pm.ActivityInfo;
 import android.os.Bundle;
+import android.text.TextUtils;
 
 import com.jixin.im.util.LocaleHelper;
+import com.jixin.im.util.PreferenceUtils;
+import com.xuan.xuanhttplibrary.okhttp.HttpUtils;
+
+import java.util.HashMap;
+
+import okhttp3.Call;
 
 public abstract class BaseActivity extends BaseLoginActivity {
 
@@ -14,4 +21,7 @@ public abstract class BaseActivity extends BaseLoginActivity {
         setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);// 竖屏
     }
 
+
+
+
 }

+ 44 - 106
jixin/src/main/java/com/jixin/im/ui/me/bubble/ShareFriendsActivity.java

@@ -22,7 +22,6 @@ import com.jixin.im.helper.ShareSdkHelper;
 import com.jixin.im.ui.base.BaseActivity;
 import com.jixin.im.util.FileUtil;
 import com.jixin.im.util.ScreenUtil;
-import com.jixin.im.view.ShareDialog;
 import com.xuan.xuanhttplibrary.okhttp.HttpUtils;
 import com.xuan.xuanhttplibrary.okhttp.callback.ListCallback;
 import com.xuan.xuanhttplibrary.okhttp.result.ArrayResult;
@@ -36,42 +35,12 @@ import okhttp3.Call;
  * 分享赚钱(邀请好友领福利)
  */
 public class ShareFriendsActivity extends BaseActivity {
-    //    private ImageView iv_erweima;
-    private TextView tv_invite;
-    private TextView tv_saveimage;
-    private TextView tv_fengxiang;
-    private Bitmap bitmap;
 
-    private ShareDialog shareDialog;
-    ShareDialog.OnShareDialogClickListener onShareDialogClickListener = new ShareDialog.OnShareDialogClickListener() {
-        @Override
-        public void tv1Click() {
-            ShareSdkHelper.shareWechat(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                    ShareFriendsActivity.this.coreManager.getConfig().website);
-        }
-
-        @Override
-        public void tv2Click() {
-            ShareSdkHelper.shareWechatMoments(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                    ShareFriendsActivity.this.coreManager.getConfig().website);
-        }
+    private TextView tvInviteCode;
+    private ImageView ivShareQrCode;
+    private Bitmap bitmap;
+    private LinearLayout llShareContent;
 
-        @Override
-        public void tv3Click() {
-            shareDialog.cancel();
-        }
-
-        @Override
-        public void tv4Click() {
-            //分享到qq
-            ShareSdkHelper.shareQQ(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                    ShareFriendsActivity.this.coreManager.getConfig().website);
-        }
-    };
-    private ImageView ivShareBg;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -79,87 +48,59 @@ public class ShareFriendsActivity extends BaseActivity {
         setContentView(R.layout.activity_sharefriends);
         initActionBar();
         initView();
-//        getNavData();
+        getNavData();
     }
 
     private void initActionBar() {
         getSupportActionBar().hide();
+        findViewById(R.id.mergerStatus).setBackgroundColor(getResources().getColor(R.color.transparent));
         findViewById(R.id.iv_title_left).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                 finish();
             }
         });
-        TextView tvTitle = (TextView) findViewById(R.id.tv_title_center);
+        TextView tvTitle = findViewById(R.id.tv_title_center);
         tvTitle.setText("分享赚钱");
+        tvTitle.setTextColor(getResources().getColor(R.color.white));
     }
 
     private void initView() {
-//        iv_erweima = findViewById(R.id.iv_erweima);
-        tv_invite = findViewById(R.id.tv_invite);
-//        tv_saveimage = findViewById(R.id.tv_saveimage);
-//        tv_fengxiang = findViewById(R.id.tv_fengxiang);
-        tv_invite.setText("邀请码:" + getIntent().getStringExtra("invite"));
-//        iv_erweima.setOnLongClickListener(new View.OnLongClickListener() {
-//            @Override
-//            public boolean onLongClick(View view) {
-//                FileUtil.saveImageToGallery2(mContext, bitmap);
-//                return false;
-//            }
-//        });
-//        tv_saveimage.setOnClickListener(new View.OnClickListener() {
-//            @Override
-//            public void onClick(View view) {
-//                FileUtil.saveImageToGallery2(mContext, bitmap);
-//            }
-//        });
-//        tv_fengxiang.setOnClickListener(new View.OnClickListener() {
-//            @Override
-//            public void onClick(View view) {
-//                shareDialog = new ShareDialog(ShareFriendsActivity.this, onShareDialogClickListener);
-//                shareDialog.show();
-//            }
-//        });
-
-
-        findViewById(R.id.tv2).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                ShareSdkHelper.shareWechatMoments(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                        "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                        ShareFriendsActivity.this.coreManager.getConfig().website);
-            }
+        ivShareQrCode = findViewById(R.id.iv_share_qr_code);
+
+        tvInviteCode = findViewById(R.id.tv_invite_code);
+
+        llShareContent = findViewById(R.id.ll_share_content);
+
+        tvInviteCode.setText("邀请码:" + getIntent().getStringExtra("invite"));
+        findViewById(R.id.tv_share_wechat_discover).setOnClickListener(v -> {
+            ShareSdkHelper.shareWechatMoments(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
+                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
+                    ShareFriendsActivity.this.coreManager.getConfig().website);
+
         });
-        findViewById(R.id.tv1).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                ShareSdkHelper.shareWechat(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                        "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                        ShareFriendsActivity.this.coreManager.getConfig().website);
-            }
+        findViewById(R.id.tv_share_wechat_friend).setOnClickListener(v -> {
+            ShareSdkHelper.shareWechat(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
+                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
+                    ShareFriendsActivity.this.coreManager.getConfig().website);
+
         });
-        findViewById(R.id.tv4).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                //分享到qq
-                ShareSdkHelper.shareQQ(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
-                        "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
-                        ShareFriendsActivity.this.coreManager.getConfig().website);
-            }
+
+        findViewById(R.id.tv_share_qq).setOnClickListener(v -> {
+            //分享到qq
+            ShareSdkHelper.shareQQ(ShareFriendsActivity.this, MyApplication.getContext().getString(R.string.app_name) + "-安全稳定的赚钱平台",
+                    "给你推荐一款可以赚钱的APP。我今天又收入了999元,现在还有3个名额,快进来下载一起赚钱吧!",
+                    ShareFriendsActivity.this.coreManager.getConfig().website);
         });
-        LinearLayout llRoot = findViewById(R.id.llRoot);
-        findViewById(R.id.tv_erweima).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                Bitmap bitmap = getBitmapByView(llRoot);
-                FileUtil.saveImageToGalleryForShare(mContext, bitmap);
-//                int h = 0;
-//                for (int i = 0; i < llRoot.getChildCount(); i++) {
-//                    h += llRoot.getChildAt(i).getHeight();
-//                    llRoot.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
-//                }
+
+        findViewById(R.id.tv_save_share_img).setOnClickListener(v -> {
+            if (bitmap!=null){
+                FileUtil.saveBitmap(bitmap);
             }
+
+
         });
+
     }
 
     public void getNavData() {
@@ -172,16 +113,13 @@ public class ShareFriendsActivity extends BaseActivity {
                     @Override
                     public void onResponse(ArrayResult<NavBean> result) {
                         if (result.getResultCode() == 1 && result.getData() != null && result.getData().size() > 0) {
-                            runOnUiThread(new Runnable() {
-                                @Override
-                                public void run() {
-                                    String str = result.getData().get(0).getLink();
-                                    int sizePix = ScreenUtil.getScreenWidth(mContext) - 200;
-                                    bitmap = CommonUtils.createQRCode(str, sizePix, sizePix);
-//                                    iv_erweima.setImageBitmap(bitmap);
-                                }
-                            });
+                            String str = result.getData().get(0).getLink();
+                            int sizePix = ScreenUtil.getScreenWidth(mContext) - 200;
+                            bitmap = CommonUtils.createQRCode(str, sizePix, sizePix);
+                            if (bitmap!=null){
 
+                                ivShareQrCode.setImageBitmap(bitmap);
+                            }
                         }
                     }
 

+ 69 - 379
jixin/src/main/java/com/jixin/im/ui/me/redpacket/MucSendRedPacketActivity.java

@@ -18,16 +18,22 @@ import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
 import androidx.viewpager.widget.ViewPager;
 
+import com.google.android.material.tabs.TabLayout;
 import com.jixin.im.AppConstant;
 import com.jixin.im.R;
 import com.jixin.im.bean.message.ChatMessage;
 import com.jixin.im.bean.message.XmppMessage;
 import com.jixin.im.bean.redpacket.RedPacket;
+import com.jixin.im.db.InternationalizationHelper;
+import com.jixin.im.fragment.MucSendPacketFragment;
 import com.jixin.im.helper.DialogHelper;
 import com.jixin.im.helper.PaySecureHelper;
 import com.jixin.im.ui.base.BaseActivity;
+import com.jixin.im.ui.base.EasyFragment;
 import com.jixin.im.ui.message.ChatActivity;
 import com.jixin.im.ui.message.MucChatActivity;
 import com.jixin.im.ui.smarttab.SmartTabLayout;
@@ -52,42 +58,24 @@ import okhttp3.Call;
 /**
  * Created by 魏正旺 on 2016/9/8.
  */
-public class MucSendRedPacketActivity extends BaseActivity implements View.OnClickListener {
-    LayoutInflater inflater;
-    private SmartTabLayout smartTabLayout;
+
+public class MucSendRedPacketActivity extends BaseActivity  {
+
+    private TabLayout mTabRedPacket;
     private ViewPager viewPager;
-    private List<View> views;
-    private List<String> mTitleList;
-    private EditText edit_count_pt;
-    private EditText edit_money_pt;
-    private EditText edit_words_pt;
-
-    private EditText edit_count_psq;
-    private EditText edit_money_psq;
-    private EditText edit_words_psq;
-
-    private EditText edit_count_kl;
-    private EditText edit_money_kl;
-    private EditText edit_words_kl;
-
-    private TextView hbgs, ge, zje, yuan, xhb;
-    private Button pt;
-    private Button bkl;
-    private Button sq;
-    //    private Button sq, pt, bkl;
-
-    private String toUserId;
-    private int mCurrentItem;
-    private int memberNum;
+    private String roomId;
+
+
+    private List<EasyFragment> mFragmentList;
+    private TabFragmentPagerAdapter mPagerAdapter;
+
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+
         setContentView(R.layout.activity_muc_redpacket);
-        toUserId = getIntent().getStringExtra(AppConstant.EXTRA_USER_ID);
-        memberNum = getIntent().getIntExtra(AppConstant.EXTRA_MEMBER_NUM, 0);
-        inflater = LayoutInflater.from(this);
-        initActionBar();
+        roomId = getIntent().getStringExtra("roomId");
         initView();
 
         checkHasPayPassword();
@@ -103,386 +91,88 @@ public class MucSendRedPacketActivity extends BaseActivity implements View.OnCli
         }
     }
 
-    private void initActionBar() {
+    private void initView() {
         getSupportActionBar().hide();
-        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
-        findViewById(R.id.tv_title_left).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                finish();
-            }
-        });
+        findViewById(R.id.mergerStatus).setBackgroundColor(getResources().getColor(R.color.redpacket_bg_new));
+        findViewById(R.id.iv_title_left).setOnClickListener(view -> finish());
         TextView tvTitle = (TextView) findViewById(R.id.tv_title_center);
-        tvTitle.setText(getString(R.string.send_red_packet));
+        tvTitle.setText(InternationalizationHelper.getString("JX_SendGift"));
+        tvTitle.setTextColor(getResources().getColor(R.color.white));
+        mFragmentList = new ArrayList<>();
+        mTabRedPacket = findViewById(R.id.tab_red_packet);
+        viewPager =  findViewById(R.id.muc_viewpager);
+        initTabLayout();
+
     }
 
-    private void initView() {
-        smartTabLayout = (SmartTabLayout) findViewById(R.id.muc_smarttablayout_redpacket);
-        viewPager = (ViewPager) findViewById(R.id.muc_viewpagert_redpacket);
-        views = new ArrayList<View>();
-        mTitleList = new ArrayList<String>();
-        mTitleList.add(getString(R.string.red_envelope));
-        mTitleList.add(getString(R.string.Usual_Gift));
-//        mTitleList.add(getString(R.string.mes_gift));
-
-        views.add(inflater.inflate(R.layout.muc_redpacket_pager_sq, null));
-        views.add(inflater.inflate(R.layout.muc_redpacket_pager_pt, null));
-//        views.add(inflater.inflate(R.layout.muc_redpacket_pager_kl, null));
-
-        View temp_view = views.get(0);
-        edit_count_pt = (EditText) temp_view.findViewById(R.id.edit_redcount);
-        edit_count_pt.addTextChangedListener(new RemoveZeroTextWatcher(edit_count_pt));
-        edit_money_pt = (EditText) temp_view.findViewById(R.id.edit_money);
-        edit_words_pt = (EditText) temp_view.findViewById(R.id.edit_blessing);
-        TextView tv_scan1 = temp_view.findViewById(R.id.tv_amount_of_money);
-        hbgs = (TextView) temp_view.findViewById(R.id.hbgs);
-        ge = (TextView) temp_view.findViewById(R.id.ge);
-        zje = (TextView) temp_view.findViewById(R.id.zje);
-        yuan = (TextView) temp_view.findViewById(R.id.yuan);
-        xhb = (TextView) temp_view.findViewById(R.id.textviewtishi);
-        sq = (Button) temp_view.findViewById(R.id.btn_sendRed);
-        hbgs.setText(getString(R.string.number_of_envelopes));
-        ge.setText(getString(R.string.individual));
-        zje.setText(getString(R.string.total_amount));
-        edit_money_pt.setHint(getString(R.string.input_amount));
-        yuan.setText(getString(R.string.yuan));
-        xhb.setText(getString(R.string.rondom_amount));
-        edit_words_pt.setHint(getString(R.string.auspicious));
-        sq.setAlpha(0.6f);
-        sq.setOnClickListener(this);
-
-        temp_view = views.get(1);
-        edit_count_psq = (EditText) temp_view.findViewById(R.id.edit_redcount);
-        TextView tv_scan2 = temp_view.findViewById(R.id.tv_amount_of_money);
-
-        edit_count_psq.addTextChangedListener(new RemoveZeroTextWatcher(edit_count_psq));
-        edit_money_psq = (EditText) temp_view.findViewById(R.id.edit_money);
-        edit_words_psq = (EditText) temp_view.findViewById(R.id.edit_blessing);
-        hbgs = (TextView) temp_view.findViewById(R.id.hbgs);
-        ge = (TextView) temp_view.findViewById(R.id.ge);
-        zje = (TextView) temp_view.findViewById(R.id.zje);
-        yuan = (TextView) temp_view.findViewById(R.id.yuan);
-        xhb = (TextView) temp_view.findViewById(R.id.textviewtishi);
-        pt = (Button) temp_view.findViewById(R.id.btn_sendRed);
-        hbgs.setText(getString(R.string.number_of_envelopes));
-        ge.setText(getString(R.string.individual));
-        zje.setText(getString(R.string.total_amount));
-        edit_money_psq.setHint(getString(R.string.input_amount));
-        yuan.setText(getString(R.string.yuan));
-        xhb.setText(getString(R.string.same_amount));
-        edit_words_psq.setHint(getString(R.string.auspicious));
-        pt.setAlpha(0.6f);
-        pt.setOnClickListener(this);
-
-//        temp_view = views.get(2);
-//        edit_count_kl = (EditText) temp_view.findViewById(R.id.edit_redcount);
-//        TextView tv_scan3 = temp_view.findViewById(R.id.tv_amount_of_money);
-//        edit_count_kl.addTextChangedListener(new RemoveZeroTextWatcher(edit_count_kl));
-//        edit_money_kl = (EditText) temp_view.findViewById(R.id.edit_money);
-//        edit_words_kl = (EditText) temp_view.findViewById(R.id.edit_password);
-//        edit_words_kl.addTextChangedListener(new TextWatcher() {
-//            @Override
-//            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-//
-//            }
-//
-//            @Override
-//            public void onTextChanged(CharSequence s, int start, int before, int count) {
-//
-//            }
-//
-//            @Override
-//            public void afterTextChanged(Editable s) {
-//                String t = s.toString().trim();
-//                if (s.length() != t.length()) {
-//                    s.replace(0, s.length(), t);
-//                }
-//            }
-//        });
-//        EditText edit_compatible = (EditText) temp_view.findViewById(R.id.edit_compatible);
-//        edit_compatible.requestFocus();
-//
-//        hbgs = (TextView) temp_view.findViewById(R.id.hbgs);
-//        ge = (TextView) temp_view.findViewById(R.id.ge);
-//        zje = (TextView) temp_view.findViewById(R.id.zje);
-//        yuan = (TextView) temp_view.findViewById(R.id.yuan);
-//        xhb = (TextView) temp_view.findViewById(R.id.textviewtishi);
-//        bkl = (Button) temp_view.findViewById(R.id.btn_sendRed);
-//        TextView kl = (TextView) temp_view.findViewById(R.id.kl);
-//        kl.setText(getString(R.string.message_red));
-//        hbgs.setText(getString(R.string.number_of_envelopes));
-//        ge.setText(getString(R.string.individual));
-//        zje.setText(getString(R.string.total_amount));
-//        edit_money_kl.setHint(R.string.need_input_money);
-//        yuan.setText(getString(R.string.yuan));
-//        xhb.setText(getString(R.string.reply_grab));
-//        edit_words_kl.setHint(getString(R.string.big_envelope));
-//        bkl.setAlpha(0.6f);
-//        bkl.setOnClickListener(this);
-        InputChangeListener inputChangeListenerPt = new InputChangeListener(edit_money_pt, tv_scan1, sq);
-        InputChangeListener inputChangeListenerPsq = new InputChangeListener(edit_money_psq, tv_scan2, pt);
-//        InputChangeListener inputChangeListenerKl = new InputChangeListener(edit_money_kl, tv_scan3, bkl);
-
-        // 添加输入监听
-        edit_money_pt.addTextChangedListener(inputChangeListenerPt);
-        edit_money_psq.addTextChangedListener(inputChangeListenerPsq);
-//        edit_money_kl.addTextChangedListener(inputChangeListenerKl);
-        // 只允许输入小数点和数字
-        edit_money_pt.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
-        edit_money_psq.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
-//        edit_money_kl.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
-
-        viewPager.setAdapter(new PagerAdapter());
-        smartTabLayout.setViewPager(viewPager);
-
-        /**
-         * 为了实现点击Tab栏切换的时候不出现动画
-         * 为每个Tab重新设置点击事件
-         */
-        for (int i = 0; i < mTitleList.size(); i++) {
-            View view = smartTabLayout.getTabAt(i);
-            view.setTag(i + "");
-            view.setOnClickListener(this);
-        }
+    private void initFragment(){
+        MucSendPacketFragment luckFragment = new MucSendPacketFragment();
+        luckFragment.setRedPacketType(2);
+        luckFragment.setRoomId(roomId);
+        mFragmentList.add(luckFragment);
+        MucSendPacketFragment normalFragment = new MucSendPacketFragment();
+        normalFragment.setRedPacketType(1);
+        normalFragment.setRoomId(roomId);
+        mFragmentList.add(normalFragment);
+        mPagerAdapter = new TabFragmentPagerAdapter(getSupportFragmentManager(),mFragmentList);
+        viewPager.setAdapter(mPagerAdapter);
+        viewPager.setOffscreenPageLimit(mFragmentList.size());
+
     }
 
-    @Override
-    public void onClick(View v) {
-        if (v.getId() == R.id.btn_sendRed) {
-            final int item = viewPager.getCurrentItem();
-            final Bundle bundle = new Bundle();
-            final Intent intent = new Intent(this, MucChatActivity.class);
-            String money = null, words = null, count = null;
-            int resultCode = 0;
-            switch (item) {
-                case 0: {
-                    //手气红包
-                    money = edit_money_pt.getText().toString();
-                    words = TextUtils.isEmpty(edit_words_pt.getText().toString()) ?
-                            edit_words_pt.getHint().toString() : edit_words_pt.getText().toString();
-                    count = edit_count_pt.getText().toString();
-                    // 拼手气与普通红包位置对调  修改resultCode
-                    resultCode = ChatActivity.REQUEST_CODE_SEND_RED_PSQ;
-                }
-                break;
-
-                case 1: {
-                    //普通红包
-                    money = edit_money_psq.getText().toString();
-                    words = TextUtils.isEmpty(edit_words_psq.getText().toString()) ?
-                            edit_words_psq.getHint().toString() : edit_words_psq.getText().toString();
-                    count = edit_count_psq.getText().toString();
-                    resultCode = ChatActivity.REQUEST_CODE_SEND_RED_PT;
-                }
-                break;
-
-                case 2: {
-                    money = edit_money_kl.getText().toString();
-                    words = TextUtils.isEmpty(edit_words_kl.getText().toString()) ?
-                            edit_words_kl.getHint().toString() : edit_words_kl.getText().toString();
-                    count = edit_count_kl.getText().toString();
-                    resultCode = ChatActivity.REQUEST_CODE_SEND_RED_KL;
-                }
-                break;
-            }
+    private void initTabLayout(){
+        initFragment();
 
-            if (!TextUtils.isEmpty(count) && Integer.parseInt(count) == 0) {
-                Toast.makeText(this, R.string.tip_red_packet_too_slow, Toast.LENGTH_SHORT).show();
-                return;
-            }
+        mTabRedPacket.setupWithViewPager(viewPager);
+        mTabRedPacket.removeAllTabs();
 
-            if (!TextUtils.isEmpty(count) && Integer.parseInt(count) > memberNum) {
-                Toast.makeText(this, R.string.tip_red_packet_than_member, Toast.LENGTH_SHORT).show();
-                return;
-            }
+        mTabRedPacket.addTab(  mTabRedPacket.newTab().setText(InternationalizationHelper.getString("JX_LuckGift")));//手气红包
+        mTabRedPacket.addTab(  mTabRedPacket.newTab().setText(InternationalizationHelper.getString("JX_UsualGift")));//普通红包
+        mTabRedPacket.setTabIndicatorFullWidth(false);
+        mTabRedPacket.setInlineLabel(true);
+        mTabRedPacket.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
+            @Override
+            public void onTabSelected(TabLayout.Tab tab) {
 
-            if (!TextUtils.isEmpty(money) &&
-                    !TextUtils.isEmpty(count) &&
-                    Double.parseDouble(money) / Integer.parseInt(count) < 0.01) {
-                Toast.makeText(this, R.string.tip_money_too_less, Toast.LENGTH_SHORT).show();
-                return;
             }
 
-            if (!TextUtils.isEmpty(money) &&
-                    !TextUtils.isEmpty(count) &&
-                    item == 1 && Double.parseDouble(money) * 100 % Integer.parseInt(count) != 0) {
-                Toast.makeText(this, R.string.normal_red_money_need_peace, Toast.LENGTH_SHORT).show();
-                return;
-            }
+            @Override
+            public void onTabUnselected(TabLayout.Tab tab) {
 
-            if (eqData(money, count, words)) {
-                money = Money.fromYuan(money);
-                final String finalMoney = money;
-                final String finalWords = words;
-                final String finalCount = count;
-                PaySecureHelper.inputPayPassword(this, getString(R.string.chat_redpacket), money, password -> {
-                    String type;
-                    if (item == 0) {
-                        type = String.valueOf(2);
-                    } else if (item == 1) {
-                        type = String.valueOf(1);
-                    } else {
-                        type = String.valueOf((item + 1));
-                    }
-                    sendRed(type, finalMoney, finalCount, finalWords, password);
-                });
-            }
-        } else {
-            int index = Integer.parseInt(v.getTag().toString());
-            if (mCurrentItem != index) {
-                mCurrentItem = index;
-                hideKeyboard();
             }
-            viewPager.setCurrentItem(index, false);
-        }
-    }
 
-    private void hideKeyboard() {
-        InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
-        if (imm != null && imm.isActive() && this.getCurrentFocus() != null) {
-            if (this.getCurrentFocus().getWindowToken() != null) {
-                imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
+            @Override
+            public void onTabReselected(TabLayout.Tab tab) {
+
             }
-        }
-    }
+        });
 
-    private boolean eqData(String money, String count, String words) {
-        if (TextUtils.isEmpty(money)) {
-            ToastUtil.showToast(mContext, getString(R.string.need_input_money));
-            return false;
-        } else if (Double.parseDouble(money) > 500 || Double.parseDouble(money) <= 0) {
-            ToastUtil.showToast(mContext, getString(R.string.red_packet_range));
-            return false;
-        } else if (TextUtils.isEmpty(count)) {
-            ToastUtil.showToast(mContext, getString(R.string.need_red_packet_count));
-            return false;
-        } else if (TextUtils.isEmpty(words)) {
-            return false;
-        }
-        return true;
     }
 
-    public void sendRed(String type, String pMoney, String count, String words, String payPassword) {
-        if (!coreManager.isLogin()) {
-            return;
-        }
-        DialogHelper.showDefaulteMessageProgressDialog(mContext);
-
-        String money = Money.fromYuan(pMoney);
-        Map<String, String> params = new HashMap<>();
-        params.put("type", type);
-        params.put("moneyStr", money);
-        params.put("count", count);
-        params.put("greetings", words);
-        params.put("roomJid", toUserId);
-
-        PaySecureHelper.generateParam(
-                this, payPassword, params,
-                "" + type + money + count + words + toUserId,
-                t -> {
-                    DialogHelper.dismissProgressDialog();
-                    ToastUtil.showToast(this, this.getString(R.string.tip_pay_secure_place_holder, t.getMessage()));
-                }, (p, code) -> {
-                    HttpUtils.get().url(coreManager.getConfig().REDPACKET_SEND)
-                            .params(p)
-                            .build()
-                            .execute(new BaseCallback<RedPacket>(RedPacket.class) {
-                                @Override
-                                public void onResponse(ObjectResult<RedPacket> result) {
-                                    DialogHelper.dismissProgressDialog();
-                                    if (Result.checkSuccess(mContext, result)) {
-                                        RedPacket redPacket = result.getData();
-                                        String objectId = redPacket.getId();
-                                        ChatMessage message = new ChatMessage();
-                                        message.setType(XmppMessage.TYPE_RED);
-                                        message.setFromUserId(coreManager.getSelf().getUserId());
-                                        message.setFromUserName(coreManager.getSelf().getNickName());
-                                        message.setTimeSend(TimeUtils.sk_time_current_time());
-                                        message.setContent(redPacket.getGreetings()); // 祝福语
-                                        message.setFilePath(redPacket.getType() + "");// 用FilePath来储存红包类型
-                                        // 群组发送普通红包
-                                        message.setFileSize(redPacket.getStatus());   // 用filesize来储存红包状态
-                                        message.setObjectId(objectId); // 红包id
-                                        Intent intent = new Intent();
-                                        intent.putExtra(AppConstant.EXTRA_CHAT_MESSAGE, message.toJsonString());
-                                        setResult(viewPager.getCurrentItem() == 0 ? ChatActivity.REQUEST_CODE_SEND_RED_PSQ : ChatActivity.REQUEST_CODE_SEND_RED_KL, intent);
-                                        finish();
-                                    }
-                                }
-
-                                @Override
-                                public void onError(Call call, Exception e) {
-                                    DialogHelper.dismissProgressDialog();
-                                }
-                            });
-                });
-    }
 
-    private static class RemoveZeroTextWatcher implements TextWatcher {
-        private EditText editText;
 
-        RemoveZeroTextWatcher(EditText editText) {
-            this.editText = editText;
-        }
+    private class TabFragmentPagerAdapter extends FragmentPagerAdapter {
 
-        @Override
-        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+        private List<EasyFragment> mFragmentList;
+        public TabFragmentPagerAdapter(FragmentManager fm, List<EasyFragment> list) {
+            super(fm);
+            this.mFragmentList = list;
         }
 
         @Override
-        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+        public void setPrimaryItem(ViewGroup container, int position, Object object) {
+            super.setPrimaryItem(container, position, object);
         }
 
         @Override
-        public void afterTextChanged(Editable editable) {
-            // 删除开头的0,
-            int end = 0;
-            for (int i = 0; i < editable.length(); i++) {
-                char ch = editable.charAt(i);
-                if (ch == '0') {
-                    end = i + 1;
-                } else {
-                    break;
-                }
-            }
-            if (end > 0) {
-                editable.delete(0, end);
-                editText.setText(editable);
-            }
+        public EasyFragment getItem(int position) {
+            return mFragmentList.get(position);//显示第几个页面
         }
-    }
-
-    private class PagerAdapter extends androidx.viewpager.widget.PagerAdapter {
 
         @Override
         public int getCount() {
-            return views.size();
-        }
-
-        @Override
-        public boolean isViewFromObject(View view, Object object) {
-            return view == object;
+            return mFragmentList.size();//有几个页面
         }
 
-        @Override
-        public void destroyItem(View container, int position, Object object) {
-            ((ViewPager) container).removeView(views.get(position));
-        }
-
-        @Override
-        public Object instantiateItem(View container, int position) {
-            ((ViewGroup) container).addView(views.get(position));
-            return views.get(position);
-        }
-
-        @Override
-        public Parcelable saveState() {
-            return null;
-        }
-
-        @Override
-        public CharSequence getPageTitle(int position) {
-            return mTitleList.get(position);
-        }
     }
-}
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
jixin/src/main/java/com/jixin/im/ui/message/MucChatActivity.java


+ 11 - 0
jixin/src/main/java/com/jixin/im/ui/message/multi/GroupMoreFeaturesActivity.java

@@ -1,5 +1,6 @@
 package com.jixin.im.ui.message.multi;
 
+import android.content.Intent;
 import android.content.res.ColorStateList;
 import android.os.Bundle;
 import android.text.Editable;
@@ -84,6 +85,7 @@ public class GroupMoreFeaturesActivity extends BaseActivity {
     private boolean isBanned;
     private boolean isDelete;
     private boolean isSetRemark;
+    private boolean isSelectReceiver;
 
     private RoomMember mRoomMember;
     private Map<String, String> mRemarksMap = new HashMap<>();
@@ -98,6 +100,8 @@ public class GroupMoreFeaturesActivity extends BaseActivity {
         isDelete = getIntent().getBooleanExtra("isDelete", false);
         isSetRemark = getIntent().getBooleanExtra("isSetRemark", false);
 
+        isSelectReceiver = getIntent().getBooleanExtra("isSelectReceiver",false);
+
         initActionBar();
         initData();
         initView();
@@ -218,6 +222,13 @@ public class GroupMoreFeaturesActivity extends BaseActivity {
                     roomMember = mSortRoomMember.get((int) id);
                 }
 
+                if (isSelectReceiver){
+                    Intent intent = new Intent();
+                    intent.putExtra("selectReceiver",roomMember);
+                    setResult(RESULT_OK,intent);
+                    finish();
+                    return;
+                }
                 if (isDelete) {// 踢人
                     if (roomMember.getUserId().equals(coreManager.getSelf().getUserId())) {
                         ToastUtil.showToast(mContext, R.string.can_not_remove_self);

+ 91 - 0
jixin/src/main/java/com/jixin/im/util/MoneyValueFilter.java

@@ -0,0 +1,91 @@
+package com.jixin.im.util;
+
+
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.method.DigitsKeyListener;
+
+
+/**
+ * 描述   :金额输入过滤器,限制小数点后输入位数
+ */
+
+public class MoneyValueFilter extends DigitsKeyListener {
+
+    private static final String TAG = MoneyValueFilter.class.getSimpleName();
+
+    public MoneyValueFilter() {
+        super(false, true);
+    }
+
+    private int digits = 2;
+
+    public MoneyValueFilter setDigits(int d) {
+        digits = d;
+        return this;
+    }
+
+    @Override
+    public CharSequence filter(CharSequence source, int start, int end,
+                               Spanned dest, int dstart, int dend) {
+        CharSequence out = super.filter(source, start, end, dest, dstart, dend);
+
+
+        // if changed, replace the source
+        if (out != null) {
+            source = out;
+            start = 0;
+            end = out.length();
+        }
+
+        int len = end - start;
+
+        // if deleting, source is empty
+        // and deleting can't break anything
+        if (len == 0) {
+            return source;
+        }
+
+        //以点开始的时候,自动在前面添加0
+        if (source.toString().equals(".") && dstart == 0) {
+            return "0.";
+        }
+        //如果起始位置为0,且第二位跟的不是".",则无法后续输入
+        if (!source.toString().equals(".") && dest.toString().equals("0")) {
+            return "";
+        }
+
+
+        int dlen = dest.length();
+
+        // Find the position of the decimal .
+        for (int i = 0; i < dstart; i++) {
+            if (dest.charAt(i) == '.') {
+                // being here means, that a number has
+                // been inserted after the dot
+                // check if the amount of digits is right
+                return (dlen - (i + 1) + len > digits) ?
+                        "" :
+                        new SpannableStringBuilder(source, start, end);
+            }
+        }
+
+        for (int i = start; i < end; ++i) {
+            if (source.charAt(i) == '.') {
+                // being here means, dot has been inserted
+                // check if the amount of digits is right
+                if ((dlen - dend) + (end - (i + 1)) > digits){
+                    return "";
+                }
+
+                else
+                    break;  // return new SpannableStringBuilder(source, start, end);
+            }
+        }
+
+
+        // if the dot is after the inserted part,
+        // nothing can break
+        return new SpannableStringBuilder(source, start, end);
+    }
+}

+ 6 - 0
jixin/src/main/res/drawable/shape_bg_white_radius_12.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="12dp"/>
+    <solid android:color="@color/white"/>
+
+</shape>

+ 6 - 0
jixin/src/main/res/drawable/shape_invite_code_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#ff991e"/>
+    <corners android:radius="16dp"/>
+
+</shape>

+ 6 - 0
jixin/src/main/res/drawable/shape_send_red_packet.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="6dp"/>
+    <solid android:color="#1aa8ff"/>
+
+</shape>

+ 3 - 0
jixin/src/main/res/drawable/shape_table_bg_frame_white.xml

@@ -0,0 +1,3 @@
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+    <stroke android:color="@color/white" android:width="1px"/>
+</shape>

+ 1 - 2
jixin/src/main/res/layout/a_view_actionbar.xml

@@ -2,8 +2,7 @@
 <com.jixin.im.view.MergerStatus xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/mergerStatus"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@color/main_color">
+    android:layout_height="wrap_content">
 
     <RelativeLayout
         android:layout_width="match_parent"

+ 19 - 61
jixin/src/main/res/layout/activity_muc_redpacket.xml

@@ -5,77 +5,35 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="70dp"
-        android:background="@color/redpacket_bg_new">
-
-        <RelativeLayout
-            android:layout_width="match_parent"
-            android:layout_height="50dp"
-            android:layout_marginTop="20dp">
-
-            <ImageView
-                android:id="@+id/tv_title_left"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="15dp"
-                android:gravity="center"
-                android:src="@mipmap/return_icon"
-                android:tint="@color/white" />
-
-            <TextView
-                android:id="@+id/tv_title_center"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_centerInParent="true"
-                android:layout_marginLeft="10dp"
-                android:text="@string/send_red_packet"
-                android:textColor="@color/white"
-                android:textSize="18sp" />
-
-        </RelativeLayout>
-
-    </FrameLayout>
+    <include layout="@layout/a_view_actionbar"
+        />
 
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.jixin.im.ui.smarttab.SmartTabLayout
-            android:id="@+id/muc_smarttablayout_redpacket"
+        <com.google.android.material.tabs.TabLayout
+            android:id="@+id/tab_red_packet"
             android:layout_width="match_parent"
-            android:layout_height="40dp"
-            android:background="@color/redpacket_bg_new"
-            app:stl_customTabTextLayoutId="@layout/a_custom_tab"
-            app:stl_defaultTabTextAllCaps="true"
-            app:stl_defaultTabTextColor="@color/replay_text_color_normal"
-            app:stl_defaultTabTextHorizontalPadding="10dp"
-            app:stl_defaultTabTextMinWidth="0dp"
-            app:stl_defaultTabTextSize="@dimen/redpacket_text_size_tab"
-            app:stl_distributeEvenly="true"
-            app:stl_dividerColor="#00000000"
-            app:stl_dividerThickness="1dp"
-            app:stl_drawDecorationAfterTab="false"
-            app:stl_indicatorAlwaysInCenter="false"
-            app:stl_indicatorColor="@color/transparent"
-            app:stl_indicatorCornerRadius="2dp"
-            app:stl_indicatorGravity="bottom"
-            app:stl_indicatorInFront="false"
-            app:stl_indicatorInterpolation="linear"
-            app:stl_indicatorThickness="1dp"
-            app:stl_indicatorWithoutPadding="true"
-            app:stl_overlineColor="#ffffff"
-            app:stl_overlineThickness="0dp"
-            app:stl_titleOffset="24dp"
-            app:stl_underlineColor="#ffffff"
-            app:stl_underlineThickness="0dp" />
+            android:layout_height="wrap_content"
+            app:tabIndicatorColor="@color/redpacket_bg_new"
+            app:tabMode="fixed"
+            app:tabBackground="@color/redpacket_bg_new"
+
+            app:tabRippleColor="@android:color/transparent"
+            app:tabSelectedTextColor="@color/white"
+            app:tabTextColor="@color/replay_text_color_normal" />
 
         <androidx.viewpager.widget.ViewPager
-            android:id="@+id/muc_viewpagert_redpacket"
+            android:id="@+id/muc_viewpager"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_below="@+id/muc_smarttablayout_redpacket" />
+            android:layout_below="@+id/tab_red_packet">
+            <FrameLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:id="@+id/fragment_content"/>
+        </androidx.viewpager.widget.ViewPager>
 
     </RelativeLayout>
 

+ 195 - 31
jixin/src/main/res/layout/activity_sharefriends.xml

@@ -1,63 +1,227 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:background="@mipmap/bg_share"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:orientation="vertical">
 
     <include layout="@layout/a_view_actionbar" />
 
-    <LinearLayout
-        android:id="@+id/llRoot"
+    <FrameLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:background="@drawable/bg111"
-        android:orientation="vertical">
+        android:orientation="vertical"
+
+
+        android:layout_height="match_parent">
 
         <ScrollView
-            android:id="@+id/sv_all"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            android:id="@+id/sv_share"
             android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:layout_weight="1"
+            android:layout_height="match_parent"
+            android:overScrollMode="never"
             android:fillViewport="true"
             android:scrollbars="none">
 
             <LinearLayout
+                android:id="@+id/ll_share_content"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
                 android:orientation="vertical">
 
                 <ImageView
-                    android:id="@+id/ivShareBg"
+                    android:id="@+id/iv_share_qr_code"
+                    android:layout_width="84dp"
+                    android:layout_height="84dp"
+                    android:layout_marginTop="20dp" />
+
+
+                <TextView
+                    android:id="@+id/tv_share_content_tips"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="15dp"
+                    android:gravity="center"
+
+
+                    android:text="@string/share_content_tips"
+                    android:textColor="#FE8B00"
+                    android:textSize="15sp" />
+
+                <TableLayout
+                    android:layout_width="180dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="36dp"
+                    android:background="@drawable/shape_table_bg_frame_white">
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="25dp">
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="分佣"
+
+                            android:textColor="@color/white" />
+
+                        <View
+                            android:layout_width="1px"
+                            android:layout_height="25dp"
+                            android:background="@color/white" />
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="比例"
+                            android:textColor="@color/white" />
+
+                    </TableRow>
+
+                    <View
+                        android:layout_height="1px"
+                        android:background="@color/white" />
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="25dp">
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="一级:"
+
+                            android:textColor="@color/white" />
+
+                        <View
+                            android:layout_width="1px"
+                            android:layout_height="25dp"
+                            android:background="@color/white" />
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="5%"
+                            android:textColor="@color/white" />
+
+                    </TableRow>
+
+                    <View
+                        android:layout_height="1px"
+                        android:background="@color/white" />
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="25dp">
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="二级:"
+
+                            android:textColor="@color/white" />
+
+                        <View
+                            android:layout_width="1px"
+                            android:layout_height="25dp"
+                            android:background="@color/white" />
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="3%"
+                            android:textColor="@color/white" />
+
+                    </TableRow>
+
+                    <View
+                        android:layout_height="1px"
+                        android:background="@color/white" />
+
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="25dp">
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="三级:"
+
+                            android:textColor="@color/white" />
+
+                        <View
+                            android:layout_width="1px"
+                            android:layout_height="25dp"
+                            android:background="@color/white" />
+
+                        <TextView
+                            android:layout_width="90dp"
+                            android:layout_height="match_parent"
+                            android:gravity="center"
+                            android:text="1.5%"
+                            android:textColor="@color/white" />
+
+                    </TableRow>
+
+                </TableLayout>
+
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="22dp"
+                    android:layout_marginTop="30dp"
+                    android:layout_marginEnd="22dp"
+                    android:text="@string/share_content"
+                    android:textColor="#f5f5f5"
+                    android:textSize="13sp" />
+
+                <TextView
                     android:layout_width="wrap_content"
+
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginLeft="@dimen/dp5"
-                    android:layout_marginTop="@dimen/dp25"
-                    android:layout_marginRight="@dimen/dp5"
-                    android:adjustViewBounds="true"
-                    android:scaleType="fitXY"
-                    android:src="@drawable/fenxiang_bg2" />
+                    android:layout_marginTop="35dp"
+                    android:text="@string/my_invite_code"
+                    android:textColor="@color/white"
+                    android:textSize="18sp" />
 
                 <TextView
-                    android:id="@+id/tv_invite"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="@dimen/dp15"
-                    android:background="@drawable/my_bg_red2"
+                    android:layout_marginTop="10dp"
+                    android:text="@string/register_code"
+                    android:textColor="@color/white"
+                    android:textSize="15sp" />
+
+                <TextView
+                    android:id="@+id/tv_invite_code"
+                    android:layout_width="wrap_content"
+                    android:layout_height="32dp"
+                    android:layout_marginTop="24dp"
+                    android:background="@drawable/shape_invite_code_bg"
                     android:gravity="center"
-                    android:paddingLeft="20dp"
-                    android:paddingTop="5dp"
-                    android:paddingRight="20dp"
-                    android:paddingBottom="5dp"
-                    android:text="邀请码:22123213"
+                    android:minWidth="120dp"
+                    android:paddingStart="16dp"
+                    android:paddingEnd="16dp"
+                    android:text="1122222222"
                     android:textColor="@color/white"
-                    android:textSize="14sp" />
+                    android:textSize="18sp" />
+
 
             </LinearLayout>
 
         </ScrollView>
 
         <LinearLayout
+            android:layout_gravity="bottom"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_margin="20dp"
@@ -65,7 +229,7 @@
             android:orientation="horizontal">
 
             <TextView
-                android:id="@+id/tv2"
+                android:id="@+id/tv_share_wechat_discover"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
@@ -78,7 +242,7 @@
                 android:textSize="12sp" />
 
             <TextView
-                android:id="@+id/tv1"
+                android:id="@+id/tv_share_wechat_friend"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
@@ -89,7 +253,7 @@
                 android:textColor="@color/white" />
 
             <TextView
-                android:id="@+id/tv4"
+                android:id="@+id/tv_share_qq"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
@@ -101,7 +265,7 @@
 
 
             <TextView
-                android:id="@+id/tv_erweima"
+                android:id="@+id/tv_save_share_img"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
@@ -114,7 +278,7 @@
 
         </LinearLayout>
 
-    </LinearLayout>
+    </FrameLayout>
 
 
 </LinearLayout>

+ 236 - 0
jixin/src/main/res/layout/fragment_muc_send_red_packet.xml

@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#e1e1e1"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="12dp"
+        android:background="@drawable/shape_bg_white_radius_12"
+        android:orientation="vertical"
+        android:paddingTop="12dp"
+        android:paddingBottom="12dp">
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:orientation="horizontal"
+            android:weightSum="2">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_marginLeft="20dp"
+                android:layout_weight="1"
+                android:gravity="center_vertical"
+                android:text="@string/red_packet_count"
+                android:textColor="@color/text_black"
+                android:textSize="@dimen/redpacket_text_size_label" />
+
+            <RelativeLayout
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1">
+
+                <EditText
+                    android:id="@+id/edit_red_packet_count"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_toLeftOf="@+id/tv_count"
+                    android:background="#0000"
+                    android:digits="@string/digits_number"
+                    android:gravity="center_vertical|right"
+                    android:inputType="number"
+                    android:maxLength="6"
+                    android:singleLine="true"
+                    android:textSize="13sp" />
+
+                <TextView
+                    android:id="@+id/tv_count"
+                    android:layout_width="wrap_content"
+                    android:layout_height="match_parent"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="10dp"
+                    android:gravity="center_vertical"
+                    android:singleLine="true"
+                    android:text="@string/individual"
+                    android:textColor="@color/text_black"
+                    android:textSize="@dimen/redpacket_text_size_label" />
+
+            </RelativeLayout>
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="#bdbdbd" />
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:background="@color/white"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_marginLeft="20dp"
+                android:layout_weight="1"
+                android:gravity="center_vertical"
+                android:text="@string/total_money"
+                android:textColor="@color/text_black"
+                android:textSize="@dimen/redpacket_text_size_label" />
+
+            <RelativeLayout
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1">
+
+                <EditText
+                    android:id="@+id/edit_money_amount"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_marginRight="35dp"
+                    android:background="#0000"
+                    android:gravity="center_vertical|right"
+                    android:hint="@string/input_money"
+                    android:inputType="numberDecimal"
+                    android:maxLength="6"
+                    android:singleLine="true"
+                    android:textSize="@dimen/redpacket_text_size_label" />
+
+                <TextView
+                    android:layout_width="15dp"
+                    android:layout_height="match_parent"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginRight="10dp"
+                    android:gravity="center_vertical"
+                    android:text="@string/rmb"
+                    android:textColor="@color/text_black"
+                    android:textSize="@dimen/redpacket_text_size_label" />
+
+            </RelativeLayout>
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="#bdbdbd" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:background="@color/white"
+            android:orientation="horizontal"
+            android:weightSum="2">
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_marginLeft="20dp"
+                android:layout_weight="1"
+                android:gravity="center_vertical"
+                android:text="@string/receiver"
+                android:textColor="@color/text_black"
+                android:textSize="@dimen/redpacket_text_size_label" />
+
+            <RelativeLayout
+                android:id="@+id/rlt_select_receiver"
+
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1">
+
+                <ImageView
+                    android:id="@+id/iv_right"
+                    android:layout_width="14dp"
+                    android:layout_height="14dp"
+                    android:layout_alignParentRight="true"
+                    android:layout_centerVertical="true"
+                    android:layout_marginRight="10dp"
+                    android:src="@drawable/me_chevron_right" />
+
+                <TextView
+                    android:id="@+id/tv_receiver"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_toLeftOf="@+id/iv_right"
+                    android:ellipsize="end"
+
+                    android:gravity="center|end"
+                    android:hint="@string/select_receiver_hint"
+                    android:paddingRight="4dp"
+                    android:singleLine="true"
+                    android:textSize="@dimen/redpacket_text_size_label" />
+
+
+            </RelativeLayout>
+
+
+        </LinearLayout>
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1px"
+            android:background="#bdbdbd" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:background="@color/white"
+            android:orientation="horizontal">
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:layout_marginLeft="20dp"
+                android:layout_marginRight="10dp"
+                android:gravity="center_vertical"
+                android:text="@string/text_wish"
+                android:textColor="@color/text_black"
+                android:textSize="@dimen/redpacket_text_size_label" />
+
+            <EditText
+                android:id="@+id/edt_wish_text"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginRight="35dp"
+                android:background="#0000"
+                android:ellipsize="end"
+                android:gravity="center_vertical|right"
+                android:hint="@string/best_wishes"
+                android:singleLine="true"
+                android:textSize="@dimen/redpacket_text_size_label" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/btn_sendRedPacket"
+        style="@style/BossGreenBtn"
+        android:layout_marginLeft="20dp"
+        android:layout_marginTop="20dp"
+        android:layout_marginRight="20dp"
+        android:background="@drawable/bg_btn_red"
+        android:text="@string/btn_send_red_packet" />
+
+    <TextView
+        android:id="@+id/tv_red_packet_hint"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="20dp"
+        android:layout_marginTop="2dp"
+        android:gravity="center"
+        android:hint="@string/hint_money_all_same"
+        android:singleLine="true"
+        android:textSize="@dimen/redpacket_text_size_label" />
+</LinearLayout>

BIN
jixin/src/main/res/mipmap-xhdpi/bg_share.png


+ 8 - 1
jixin/src/main/res/values/strings.xml

@@ -1735,6 +1735,10 @@
     <string name="tip_sync_chat_history_clean_to">对方进行了双向清空聊天记录的操作</string>
     <string name="tip_no_local_browser">本地浏览器打开失败</string>
     <string name="group_assistant">群助手</string>
+
+    <string name="receiver">领取人</string>
+    <string name="select_receiver_hint">请选择领取人</string>
+    <string name="text_wish">祝福语</string>
     <string name="group_assistant_not_open_by_owner">群主还没有开通群助手功能</string>
     <string name="group_assistant_not_has_keyword">还没有关键字哦</string>
     <string name="auto_reply_assistant">自动回复助手</string>
@@ -2340,7 +2344,10 @@
 
     <string name="guanfang">官方彩</string>
     <string name="chuantong">传统彩</string>
-
+    <string name="share_content_tips">分享二维码给您的朋友\n让您的朋友也赚钱</string>
+    <string name="share_content">&#160;&#160;一款赚钱的聊天软件,邀请朋友加入,享受三级分佣,下级用户所消费金额,您将获得七级相应的分润。快邀请朋友们加入吧!!!</string>
+    <string name="my_invite_code">我的邀请码</string>
+    <string name="register_code">注册时输入此邀请码</string>
     <string-array name="icons">
         <item>iphone</item>
         <item>iphone</item>