Skip to content

Commit 87c7b80

Browse files
guangyaoguangyao
authored andcommitted
2 parents eeb4e62 + 091e015 commit 87c7b80

File tree

23 files changed

+177
-74
lines changed

23 files changed

+177
-74
lines changed

android/chatinput/src/main/java/cn/jiguang/imui/chatinput/record/RecordHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class RecordHelper {
2626

2727
private static final int MIN_INTERVAL_TIME = 1000;// 1s
2828

29-
private static final int MAX_INTERVAL_TIME = 120;// 1s
29+
private static final int MAX_INTERVAL_TIME = 60;// 1s
3030

3131
private MediaRecorder recorder;
3232
private RecordVoiceListener mListener;

android/messagelist/src/main/java/cn/jiguang/imui/messages/MessageListStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static MessageListStyle parse(Context context, AttributeSet attrs) {
143143
R.drawable.aurora_anim_receive_voice);
144144

145145
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
146-
style.bubbleMaxWidth = typedArray.getFloat(R.styleable.MessageList_bubbleMaxWidth, 0.7f);
146+
style.bubbleMaxWidth = typedArray.getFloat(R.styleable.MessageList_bubbleMaxWidth, 0.65f);
147147
style.windowWidth = wm.getDefaultDisplay().getWidth();
148148

149149
style.sendPhotoMsgBg = typedArray.getDrawable(R.styleable.MessageList_sendPhotoMsgBg);

android/messagelist/src/main/java/cn/jiguang/imui/messages/viewholder/BankTransferViewHolder.java

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package cn.jiguang.imui.messages.viewholder;
22

33
import android.support.v7.widget.RecyclerView;
4+
import android.text.TextUtils;
5+
import android.util.Log;
46
import android.view.View;
57
import android.widget.TextView;
68

9+
import java.text.DecimalFormat;
10+
11+
import cn.jiguang.imui.BuildConfig;
712
import cn.jiguang.imui.R;
813
import cn.jiguang.imui.commons.models.IBankTransfer;
914
import cn.jiguang.imui.commons.models.IMessage;
@@ -17,27 +22,66 @@ public class BankTransferViewHolder<MESSAGE extends IMessage> extends AvatarView
1722

1823
private TextView value;
1924
private TextView comments;
20-
25+
private View layoutTop;
2126

2227
public BankTransferViewHolder(RecyclerView.Adapter adapter, View itemView, boolean isSender) {
2328
super(adapter, itemView, isSender);
2429
value = (TextView) itemView.findViewById(R.id.bank_transfer_value);
2530
comments = (TextView) itemView.findViewById(R.id.bank_transfer_comments);
26-
31+
layoutTop = itemView.findViewById(R.id.layout_top);
2732
}
2833

2934
@Override
3035
public void onBind(final MESSAGE message) {
3136
super.onBind(message);
3237
IBankTransfer extend = getExtend(message);
3338
if (extend != null) {
34-
value.setText(extend.getAmount());
35-
comments.setText(extend.getComments());
39+
value.setText(formatAmount(extend.getAmount()));
40+
if (TextUtils.isEmpty(extend.getComments())) {
41+
comments.setText("飞马转账");
42+
} else {
43+
comments.setText(extend.getComments());
44+
}
45+
}
46+
layoutTop.setOnClickListener(new View.OnClickListener() {
47+
@Override
48+
public void onClick(View v) {
49+
if (mMsgClickListener != null) {
50+
mMsgClickListener.onMessageClick(message);
51+
}
52+
}
53+
});
54+
layoutTop.setOnLongClickListener(new View.OnLongClickListener() {
55+
@Override
56+
public boolean onLongClick(View v) {
57+
if (mMsgLongClickListener != null) {
58+
mMsgLongClickListener.onMessageLongClick(message);
59+
} else {
60+
if (BuildConfig.DEBUG) {
61+
Log.w("MsgListAdapter", "Didn't set long click listener! Drop event.");
62+
}
63+
}
64+
return true;
65+
}
66+
});
67+
}
68+
69+
final DecimalFormat format = new DecimalFormat("#.00");
70+
71+
String formatAmount(String amount) {
72+
73+
try {
74+
return format.format(Integer.valueOf(amount)) + "元";
75+
} catch (NumberFormatException e) {
76+
e.printStackTrace();
77+
return amount + "元";
3678
}
3779
}
3880

3981
@Override
4082
public void applyStyle(MessageListStyle style) {
4183
super.applyStyle(style);
84+
// layout.getLayoutParams().width = (int) (style.getWindowWidth() * 0.65);
85+
layoutTop.setBackground(style.getRedPacketTopDrawable());
4286
}
4387
}

android/messagelist/src/main/java/cn/jiguang/imui/messages/viewholder/RedPacketOpenViewHolder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void onBind(MESSAGE message) {
4444

4545
IRedPacketOpen extend = getExtend(message);
4646
if (extend != null) {
47-
String mText = "icon" + extend.getTipMsg();
47+
String mText = extend.getTipMsg();
4848
Matcher m = pattern.matcher(mText);
4949
SpannableString spann = new SpannableString(mText);
5050
// if (imageSpan == null) {

android/messagelist/src/main/java/cn/jiguang/imui/messages/viewholder/RedPacketViewHolder.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package cn.jiguang.imui.messages.viewholder;
22

33
import android.support.v7.widget.RecyclerView;
4+
import android.util.Log;
45
import android.view.View;
56
import android.widget.TextView;
67

8+
import cn.jiguang.imui.BuildConfig;
79
import cn.jiguang.imui.R;
810
import cn.jiguang.imui.commons.models.IMessage;
911
import cn.jiguang.imui.commons.models.IRedPacket;
@@ -26,18 +28,39 @@ public RedPacketViewHolder(RecyclerView.Adapter adapter, View itemView, boolean
2628
}
2729

2830
@Override
29-
public void onBind(MESSAGE message) {
31+
public void onBind(final MESSAGE message) {
3032
super.onBind(message);
3133
IRedPacket extend = getExtend(message);
3234
if (extend != null) {
3335
comments.setText(extend.getComments());
3436
}
35-
37+
layoutTop.setOnClickListener(new View.OnClickListener() {
38+
@Override
39+
public void onClick(View v) {
40+
if (mMsgClickListener != null) {
41+
mMsgClickListener.onMessageClick(message);
42+
}
43+
}
44+
});
45+
layoutTop.setOnLongClickListener(new View.OnLongClickListener() {
46+
@Override
47+
public boolean onLongClick(View v) {
48+
if (mMsgLongClickListener != null) {
49+
mMsgLongClickListener.onMessageLongClick(message);
50+
} else {
51+
if (BuildConfig.DEBUG) {
52+
Log.w("MsgListAdapter", "Didn't set long click listener! Drop event.");
53+
}
54+
}
55+
return true;
56+
}
57+
});
3658
}
3759

3860
@Override
3961
public void applyStyle(MessageListStyle style) {
4062
super.applyStyle(style);
63+
// layout.getLayoutParams().width = (int) (style.getWindowWidth() * 0.65);
4164
layoutTop.setBackground(style.getRedPacketTopDrawable());
4265
}
4366
}
6.76 KB
Loading
2.78 KB
Loading

android/messagelist/src/main/res/layout/item_receive_bank_transfer.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,33 @@
3434
android:orientation="vertical">
3535

3636
<RelativeLayout
37+
android:id="@+id/layout_top"
3738
android:layout_width="match_parent"
3839
android:layout_height="match_parent"
3940
android:background="@drawable/red_packet_top">
4041

4142
<ImageView
43+
android:padding="3dp"
4244
android:id="@+id/icon"
4345
android:layout_margin="@dimen/red_packet_image_margin"
44-
android:src="@drawable/icon_packet"
46+
android:src="@drawable/transfer"
4547
android:layout_width="wrap_content"
4648
android:layout_height="wrap_content" />
4749
<TextView
48-
android:id="@+id/bank_transfer_value"
50+
android:id="@+id/bank_transfer_comments"
4951
android:layout_toRightOf="@+id/icon"
5052
android:layout_marginTop="@dimen/red_packet_top"
5153
android:textSize="@dimen/red_packet_comments_size"
52-
android:text="100.00¥"
5354
android:lines="1"
5455
android:ellipsize="end"
5556
android:textColor="@color/red_packet_comments"
5657
android:layout_width="match_parent"
5758
android:layout_height="wrap_content" />
5859
<TextView
59-
android:id="@+id/bank_transfer_comments"
60+
android:id="@+id/bank_transfer_value"
6061
android:layout_marginTop="6dp"
6162
android:layout_toRightOf="@+id/icon"
62-
android:layout_below="@+id/bank_transfer_value"
63-
android:text="备注"
63+
android:layout_below="@+id/bank_transfer_comments"
6464
android:textColor="@color/red_packet_text"
6565
android:textSize="@dimen/red_packet_text_size"
6666
android:layout_width="match_parent"

android/messagelist/src/main/res/layout/item_send_bank_transfer.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,37 @@
5050
android:orientation="vertical">
5151

5252
<RelativeLayout
53+
android:id="@+id/layout_top"
5354
android:layout_width="match_parent"
5455
android:layout_height="match_parent"
5556
android:background="@drawable/red_packet_top">
5657

5758
<ImageView
59+
android:padding="3dp"
5860
android:id="@+id/icon"
5961
android:layout_width="wrap_content"
6062
android:layout_height="wrap_content"
6163
android:layout_margin="@dimen/red_packet_image_margin"
62-
android:src="@drawable/icon_packet" />
64+
android:src="@drawable/transfer" />
6365

6466
<TextView
65-
android:id="@+id/bank_transfer_value"
67+
android:id="@+id/bank_transfer_comments"
6668
android:layout_width="match_parent"
6769
android:layout_height="wrap_content"
6870
android:layout_marginTop="@dimen/red_packet_top"
6971
android:layout_toRightOf="@+id/icon"
7072
android:ellipsize="end"
7173
android:lines="1"
72-
android:text="100.00¥"
7374
android:textColor="@color/red_packet_comments"
7475
android:textSize="@dimen/red_packet_comments_size" />
7576

7677
<TextView
77-
android:id="@+id/bank_transfer_comments"
78+
android:id="@+id/bank_transfer_value"
7879
android:layout_width="match_parent"
7980
android:layout_height="wrap_content"
80-
android:layout_below="@+id/bank_transfer_value"
81+
android:layout_below="@+id/bank_transfer_comments"
8182
android:layout_marginTop="6dp"
8283
android:layout_toRightOf="@+id/icon"
83-
android:text="备注"
8484
android:textColor="@color/red_packet_text"
8585
android:textSize="@dimen/red_packet_text_size" />
8686
</RelativeLayout>

android/messagelist/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<dimen name="red_packet_comments_size">16sp</dimen>
3535
<dimen name="red_packet_text_size">14sp</dimen>
3636
<dimen name="red_packet_tag_size">10sp</dimen>
37+
<dimen name="message_padding">48dp</dimen>
3738

3839

3940
</resources>

0 commit comments

Comments
 (0)