Skip to content

Commit 877bd79

Browse files
committed
fix record && text color
1 parent 17a8dfa commit 877bd79

31 files changed

+64
-22
lines changed

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

Lines changed: 8 additions & 5 deletions
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 = 120000;// 1s
29+
private static final int MAX_INTERVAL_TIME = 120;// 1s
3030

3131
private MediaRecorder recorder;
3232
private RecordVoiceListener mListener;
@@ -166,10 +166,11 @@ public int getAmplitude() {
166166
return 0;
167167
}
168168
try {
169-
int x = recorder.getMaxAmplitude();
170-
if (x != 0) {
171-
int f = (int) (10 * Math.log(x) / Math.log(10));
172-
return f;
169+
int db = recorder.getMaxAmplitude() / 1;
170+
if (db > 1) {
171+
// int f = (int) (10 * Math.log(x) / Math.log(10));
172+
db = (int) (20 * Math.log10(db));
173+
return db;
173174
}
174175
} catch (RuntimeException e) {
175176
e.printStackTrace();
@@ -237,6 +238,8 @@ public void run() {
237238
public void handleMessage(Message msg) {
238239
switch (msg.what) {
239240
case START_RECORD:
241+
242+
Log.w(getClass().getName(), cancelAble + "" + db + "" + intervalTime);
240243
if (intervalTime >= MAX_INTERVAL_TIME) {
241244
finishRecord();
242245
} else {

android/chatinput/src/main/res/drawable/aurora_menuitem_send_btn_bg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<item>
1010
<shape >
1111
<corners android:radius="@dimen/aurora_radius_btn_default"/>
12-
<solid android:color="@color/aurora_jpush_blue"/>
12+
<solid android:color="@color/aurora_send_blue"/>
1313
</shape>
1414
</item>
1515

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<item android:drawable="@drawable/aurora_menuitem_send" android:state_pressed="true"/>
5+
<item android:drawable="@drawable/aurora_menuitem_send_pres" android:state_focused="true"/>
6+
<item android:drawable="@drawable/aurora_menuitem_send_pres"/>
7+
8+
</selector>

android/chatinput/src/main/res/drawable/voice_bg.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
<shape android:shape="rectangle">
55
<corners android:radius="5dp" />
66
<solid android:color="@color/aurora_bg_edittext_default" />
7+
<stroke android:width="1dp" android:color="@color/line_bg" />
78
</shape>
89
</item>
910
<item android:state_pressed="true">
1011
<shape android:shape="rectangle">
1112
<corners android:radius="5dp" />
1213
<solid android:color="@color/aurora_hint_color_input" />
14+
<stroke android:width="1dp" android:color="@color/line_bg" />
1315
</shape>
1416
</item>
1517
<item android:state_focused="true">
1618
<shape android:shape="rectangle">
1719
<corners android:radius="8dp" />
1820
<solid android:color="@color/aurora_hint_color_input" />
21+
<stroke android:width="1dp" android:color="@color/line_bg" />
1922
</shape>
2023
</item>
2124
</selector>

android/chatinput/src/main/res/values/colors.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<color name="white">#ffffff</color>
4+
<color name="line_bg">#a9a3a3</color>
45

56
<!-->chat input<-->
67
<color name="aurora_bg_input_default">#f3f3f3</color>
78
<color name="aurora_bg_input_container">#e5e5e5</color>
89
<color name="aurora_bg_edittext_default">#e5e5e5</color>
910
<color name="aurora_bg_edittext_focus">#3f80dc</color>
1011
<color name="aurora_cursor_color_default">#8db4eb</color>
11-
<color name="aurora_jpush_blue">#3f80dc</color>
12+
<color name="aurora_send_blue">#3f80dc</color>
1213
<color name="aurora_bg_voice_btn_default">#3f80dc</color>
1314
<color name="aurora_bg_voice_btn_pressed">#3773cb</color>
1415
<color name="aurora_text_color_input">#000000</color>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<dimen name="aurora_textsize_chronometer">20sp</dimen>
2020
<dimen name="aurora_size_record_button">70dp</dimen>
2121
<dimen name="aurora_size_album_button">60dp</dimen>
22+
2223
<!-- chat input end -->
24+
<dimen name="imui_chat_space">8dp</dimen>
25+
<dimen name="imui_chat_width">36dp</dimen>
2326

2427
</resources>

android/chatinput/src/main/res/values/styles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
</style>
2929

3030
<style name="ChatInputIcon">
31-
<item name="android:layout_width">32dp</item>
32-
<item name="android:layout_height">32dp</item>
31+
<item name="android:layout_width">@dimen/imui_chat_width</item>
32+
<item name="android:layout_height">@dimen/imui_chat_width</item>
3333
<item name="android:scaleType">fitCenter</item>
3434
</style>
3535
</resources>

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

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

3+
import android.graphics.Color;
34
import android.support.v7.widget.RecyclerView;
45
import android.util.Log;
56
import android.view.View;
@@ -41,6 +42,7 @@ public AvatarViewHolder(RecyclerView.Adapter adapter, View itemView, boolean isS
4142
mSendingPb = (ProgressBar) itemView.findViewById(R.id.aurora_pb_msgitem_sending);
4243

4344
layout = itemView.findViewById(R.id.item_layout);
45+
4446
}
4547

4648

@@ -63,6 +65,7 @@ public void onBind(final MESSAGE message) {
6365
}
6466
if (!mIsSender) {
6567
if (mDisplayNameTv.getVisibility() == View.VISIBLE) {
68+
mDisplayNameTv.setMaxEms(8);
6669
mDisplayNameTv.setText(message.getFromUser().getDisplayName());
6770
}
6871
} else {
@@ -133,6 +136,12 @@ public void applyStyle(MessageListStyle style) {
133136
if (layout != null && mAvatarIv.getVisibility() == View.VISIBLE) {
134137
layout.getLayoutParams().width = (int) (style.getWindowWidth() * style.getBubbleMaxWidth());
135138
}
139+
if (!mIsSender) {
140+
if (mDisplayNameTv.getVisibility() == View.VISIBLE) {
141+
mDisplayNameTv.setMaxEms(8);
142+
mDisplayNameTv.setTextColor(Color.rgb(157,157,158));
143+
}
144+
}
136145
}
137146

138147
public ImageView getAvatar() {

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

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

3+
import android.graphics.Color;
34
import android.support.v7.widget.RecyclerView;
45
import android.view.View;
56
import android.widget.TextView;
@@ -28,7 +29,7 @@ public void onBind(MESSAGE message) {
2829

2930
@Override
3031
public void applyStyle(MessageListStyle style) {
31-
mEvent.setTextColor(style.getEventTextColor());
32+
mEvent.setTextColor(Color.WHITE);
3233
mEvent.setTextSize(style.getEventTextSize());
3334
mEvent.setPadding(style.getEventPadding(), style.getEventPadding(), style.getEventPadding(), style.getEventPadding());
3435
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.jiguang.imui.messages.viewholder;
22

3+
import android.graphics.Color;
34
import android.support.v7.widget.RecyclerView;
45
import android.view.View;
56
import android.widget.TextView;
@@ -30,7 +31,8 @@ public void onBind(MESSAGE message) {
3031

3132
@Override
3233
public void applyStyle(MessageListStyle style) {
33-
mEvent.setTextColor(style.getEventTextColor());
34+
35+
mEvent.setTextColor(Color.rgb(157, 157, 158));
3436
mEvent.setTextSize(style.getEventTextSize());
3537
mEvent.setPadding(style.getEventPadding(), style.getEventPadding(), style.getEventPadding(), style.getEventPadding());
3638
}

0 commit comments

Comments
 (0)