Skip to content

Commit 70b5e6a

Browse files
committed
fix ui
1 parent 28ee95b commit 70b5e6a

File tree

21 files changed

+112
-60
lines changed

21 files changed

+112
-60
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: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package cn.jiguang.imui.messages.viewholder;
22

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

8+
import java.text.DecimalFormat;
9+
710
import cn.jiguang.imui.R;
811
import cn.jiguang.imui.commons.models.IBankTransfer;
912
import cn.jiguang.imui.commons.models.IMessage;
@@ -17,27 +20,53 @@ public class BankTransferViewHolder<MESSAGE extends IMessage> extends AvatarView
1720

1821
private TextView value;
1922
private TextView comments;
20-
23+
private View layoutTop;
2124

2225
public BankTransferViewHolder(RecyclerView.Adapter adapter, View itemView, boolean isSender) {
2326
super(adapter, itemView, isSender);
2427
value = (TextView) itemView.findViewById(R.id.bank_transfer_value);
2528
comments = (TextView) itemView.findViewById(R.id.bank_transfer_comments);
26-
29+
layoutTop = itemView.findViewById(R.id.layout_top);
2730
}
2831

2932
@Override
3033
public void onBind(final MESSAGE message) {
3134
super.onBind(message);
3235
IBankTransfer extend = getExtend(message);
3336
if (extend != null) {
34-
value.setText(extend.getAmount());
35-
comments.setText(extend.getComments());
37+
value.setText(formatAmount(extend.getAmount()));
38+
if (TextUtils.isEmpty(extend.getComments())) {
39+
comments.setText("飞马转账");
40+
} else {
41+
comments.setText(extend.getComments());
42+
}
43+
}
44+
layoutTop.setOnClickListener(new View.OnClickListener() {
45+
@Override
46+
public void onClick(View v) {
47+
if (mMsgClickListener != null) {
48+
mMsgClickListener.onMessageClick(message);
49+
}
50+
}
51+
});
52+
}
53+
54+
final DecimalFormat format = new DecimalFormat("#.00");
55+
56+
String formatAmount(String amount) {
57+
58+
try {
59+
return format.format(Integer.valueOf(amount)) + "元";
60+
} catch (NumberFormatException e) {
61+
e.printStackTrace();
62+
return amount + "元";
3663
}
3764
}
3865

3966
@Override
4067
public void applyStyle(MessageListStyle style) {
4168
super.applyStyle(style);
69+
// layout.getLayoutParams().width = (int) (style.getWindowWidth() * 0.65);
70+
layoutTop.setBackground(style.getRedPacketTopDrawable());
4271
}
4372
}

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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,26 @@ public RedPacketViewHolder(RecyclerView.Adapter adapter, View itemView, boolean
2626
}
2727

2828
@Override
29-
public void onBind(MESSAGE message) {
29+
public void onBind(final MESSAGE message) {
3030
super.onBind(message);
3131
IRedPacket extend = getExtend(message);
3232
if (extend != null) {
3333
comments.setText(extend.getComments());
3434
}
35-
35+
layoutTop.setOnClickListener(new View.OnClickListener() {
36+
@Override
37+
public void onClick(View v) {
38+
if (mMsgClickListener != null) {
39+
mMsgClickListener.onMessageClick(message);
40+
}
41+
}
42+
});
3643
}
3744

3845
@Override
3946
public void applyStyle(MessageListStyle style) {
4047
super.applyStyle(style);
48+
// layout.getLayoutParams().width = (int) (style.getWindowWidth() * 0.65);
4149
layoutTop.setBackground(style.getRedPacketTopDrawable());
4250
}
4351
}
6.76 KB
Loading
2.78 KB
Loading

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,32 @@
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
4243
android:id="@+id/icon"
4344
android:layout_margin="@dimen/red_packet_image_margin"
44-
android:src="@drawable/icon_packet"
45+
android:src="@drawable/transfer"
4546
android:layout_width="wrap_content"
4647
android:layout_height="wrap_content" />
4748
<TextView
48-
android:id="@+id/bank_transfer_value"
49+
android:id="@+id/bank_transfer_comments"
4950
android:layout_toRightOf="@+id/icon"
5051
android:layout_marginTop="@dimen/red_packet_top"
5152
android:textSize="@dimen/red_packet_comments_size"
52-
android:text="100.00¥"
5353
android:lines="1"
5454
android:ellipsize="end"
5555
android:textColor="@color/red_packet_comments"
5656
android:layout_width="match_parent"
5757
android:layout_height="wrap_content" />
5858
<TextView
59-
android:id="@+id/bank_transfer_comments"
59+
android:id="@+id/bank_transfer_value"
6060
android:layout_marginTop="6dp"
6161
android:layout_toRightOf="@+id/icon"
62-
android:layout_below="@+id/bank_transfer_value"
63-
android:text="备注"
62+
android:layout_below="@+id/bank_transfer_comments"
6463
android:textColor="@color/red_packet_text"
6564
android:textSize="@dimen/red_packet_text_size"
6665
android:layout_width="match_parent"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
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">
@@ -59,7 +60,7 @@
5960
android:layout_width="wrap_content"
6061
android:layout_height="wrap_content"
6162
android:layout_margin="@dimen/red_packet_image_margin"
62-
android:src="@drawable/icon_packet" />
63+
android:src="@drawable/transfer" />
6364

6465
<TextView
6566
android:id="@+id/bank_transfer_value"

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)