Skip to content

Commit 0639513

Browse files
author
o-kui.xiao
committed
显示样式
1 parent 5db1511 commit 0639513

File tree

5 files changed

+39
-28
lines changed

5 files changed

+39
-28
lines changed

src/com/xk/ui/items/ConvItem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ public void draw(GC gc, int start, int width, int index) {
7474
gc.drawImage(silenceImage, width - MyList.BAR_WIDTH - 35, start + 37);
7575
}
7676
if(null != lastMsg){
77-
path.addString(FileUtils.getLimitString(FileUtils.getLimitString(lastMsg, 7), 10), 15 + 58f, start + 37F, font);
77+
Color fg = gc.getForeground();
78+
gc.setForeground(SWTResourceManager.getColor(0xBD, 0xBD, 0xBD));
79+
Path temp = new Path(null);
80+
temp.addString(FileUtils.getLimitString(FileUtils.getLimitString(lastMsg, 7), 10), 15 + 58f, start + 37F, font);
81+
gc.drawPath(temp);
82+
gc.setForeground(fg);
83+
temp.dispose();
7884
}
7985
if(null != lastTime) {
8086
path.addString(DateUtil.getChatTime(lastTime), width - MyList.BAR_WIDTH - 50f, start + 15f, font);

src/com/xk/ui/main/MainWindow.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -450,18 +450,18 @@ public void run() {
450450
String sender = ContactsStruct.getGroupMember(splt[0], Constant.contacts.get(FromUserName));
451451
String ctt = splt[1].replace("<br/>", "\n");
452452
System.out.println(sender + " 在群里说:" + ctt);
453-
if(ctt.contains("@" + Constant.user.NickName)) {
454-
String detail = ctt.replace("@" + Constant.user.NickName, "");
455-
String reply = "什么情况?";
456-
if(!detail.trim().isEmpty()) {
457-
reply = AutoReply.call(detail, sender);
458-
}
459-
460-
ChatLog replyLog = WeChatUtil.sendMsg(reply, FromUserName);
461-
if(null != replyLog) {
462-
ChatLogCache.saveLogs(FromUserName, replyLog);
463-
}
464-
}
453+
// if(ctt.contains("@" + Constant.user.NickName)) {
454+
// String detail = ctt.replace("@" + Constant.user.NickName, "");
455+
// String reply = "什么情况?";
456+
// if(!detail.trim().isEmpty()) {
457+
// reply = AutoReply.call(detail, sender);
458+
// }
459+
//
460+
// ChatLog replyLog = WeChatUtil.sendMsg(reply, FromUserName);
461+
// if(null != replyLog) {
462+
// ChatLogCache.saveLogs(FromUserName, replyLog);
463+
// }
464+
// }
465465
flushChatView(FromUserName);
466466

467467
}else {
@@ -470,14 +470,14 @@ public void run() {
470470
String sender = ContactsStruct.getContactName(Constant.contacts.get(FromUserName));
471471
String ctt = Content.replace("<br/>", "\n");
472472
System.out.println(sender + " 说:" + ctt);
473-
if(!Constant.noReply.contains(FromUserName)) {
474-
String reply = AutoReply.call(ctt, sender);
475-
ChatLog replyLog = WeChatUtil.sendMsg(reply, FromUserName);
476-
if(null != replyLog) {
477-
ChatLogCache.saveLogs(FromUserName, replyLog);
478-
}
479-
480-
}
473+
// if(!Constant.noReply.contains(FromUserName)) {
474+
// String reply = AutoReply.call(ctt, sender);
475+
// ChatLog replyLog = WeChatUtil.sendMsg(reply, FromUserName);
476+
// if(null != replyLog) {
477+
// ChatLogCache.saveLogs(FromUserName, replyLog);
478+
// }
479+
//
480+
// }
481481
flushChatView(FromUserName);
482482

483483
}

src/com/xk/ui/main/chat/ChatComp.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.xk.uiLib.MyList;
1111
import com.xk.utils.Constant;
1212
import com.xk.utils.ImageCache;
13+
import com.xk.utils.SWTTools;
1314
import com.xk.utils.WeChatUtil;
1415

1516
import org.eclipse.swt.widgets.Label;
@@ -36,7 +37,7 @@
3637

3738
public class ChatComp extends Composite {
3839

39-
private Label nameL;
40+
private CLabel nameL;
4041
private MyList<ChatItem> chatList;
4142
private Text text;
4243
private ConvItem item;
@@ -55,24 +56,28 @@ public ChatComp(Composite parent, int style) {
5556
setSize(550, 590);
5657
setBackground(SWTResourceManager.getColor(245, 245, 245));
5758

58-
nameL = new Label(this, SWT.NONE);
59+
nameL = new CLabel(this, SWT.CENTER);
60+
nameL.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
5961
nameL.setBackground(getBackground());
6062
nameL.setAlignment(SWT.CENTER);
61-
nameL.setBounds(0, 0, 470, 17);
63+
nameL.setBounds(0, 0, 470, 24);
64+
SWTTools.enableTrag(nameL);
6265

6366
chatList = new MyList<ChatItem>(this, 550, 375);
6467
chatList.setLocation(0, 25);
6568

66-
CLabel emojL = new CLabel(this, SWT.BORDER);
69+
Image temp = SWTResourceManager.getImage(ChatComp.class, "/images/emoj.png");
70+
71+
CLabel emojL = new CLabel(this, SWT.CENTER);
6772
emojL.setBounds(0, 400, 30, 30);
68-
emojL.setBackground(SWTResourceManager.getImage(ChatComp.class, "/images/emoj.png"));
73+
emojL.setBackground(SWTTools.scaleImage(temp.getImageData(), 30, 30));
6974

7075
text = new Text(this, SWT.MULTI);
7176
text.setBounds(0, 430, 549, 115);
7277
text.addKeyListener(new KeyAdapter() {
7378

7479
@Override
75-
public void keyReleased(KeyEvent e) {
80+
public void keyPressed(KeyEvent e) {
7681
if(e.keyCode == SWT.CR || e.keyCode == 16777296) {
7782
sendMsg();
7883
e.doit = false;

src/com/xk/ui/main/chat/ChatItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void draw(GC gc, int start, int width, int index) {
132132
gc.fillPath(namePath);
133133
gc.drawPath(namePath);
134134
gc.drawImage(head,width - ( HEAD_IMG_HEIGHT + LINE_SPACE_HEIGHT * 2 + MyList.BAR_WIDTH), start + LINE_SPACE_HEIGHT);
135-
gc.setBackground(SWTResourceManager.getColor(0xff, 0xff, 0xff));
135+
gc.setBackground(SWTResourceManager.getColor(0x9E, 0xEE, 0x6B));
136136
gc.setForeground(SWTResourceManager.getColor(0xff, 0xff, 0xff));
137137
gc.fillRoundRectangle(width - (HEAD_IMG_HEIGHT + LINE_SPACE_HEIGHT * 2 + maxWidth + MyList.BAR_WIDTH + MARGIN), start + nameHeight + LINE_SPACE_HEIGHT * 2, maxWidth, allHeight, 3, 3);
138138
gc.setForeground(SWTResourceManager.getColor(0xe1, 0xe1, 0xe1));

src/images/emoj.png

16.5 KB
Loading

0 commit comments

Comments
 (0)