Commit 146e255704bcac2753cbd2eac34a4b84bad9c871

Authored by 陈硕
2 parents 45f55014 b5c673a5

合并代码

app/src/main/java/com/cnlive/gundam/user/util/InputUtil.java
... ... @@ -75,7 +75,7 @@ public class InputUtil {
75 75 }
76 76 if(sendCommentCallBack!=null){
77 77 if (TextUtils.isEmpty(mMsgEditText.getText())) {
78   - ToastUtil.showToast(mContext, "不能发送空消息呦~");
  78 + ToastUtil.show(mContext, "不能发送空消息呦~");
79 79 } else {
80 80 sendCommentCallBack.sendComment(mMsgEditText.getText().toString());
81 81 mMsgEditText.setText("");
... ... @@ -130,7 +130,7 @@ public class InputUtil {
130 130 //发送聊天室消息
131 131 if(mSendCallback!=null){
132 132 if (TextUtils.isEmpty(mMsgEditText.getText())) {
133   - ToastUtil.showToast(mContext, "不能发送空消息呦~");
  133 + ToastUtil.show(mContext, "不能发送空消息呦~");
134 134 } else {
135 135 mSendCallback.sendMessage(mGson.toJson(new CNMessageModle("chatRoom",new MessageInfo("","","","",mMsgEditText.getText().toString()))));
136 136 mMsgEditText.setText("");
... ...
app/src/main/java/com/cnlive/gundam/user/util/ToastUtil.java
... ... @@ -11,15 +11,12 @@ import android.widget.Toast;
11 11 import com.cnlive.gundam.R;
12 12  
13 13  
14   -
15 14 /**
16 15 * Created by xiansong on 2016/12/12.
17 16 */
18 17  
19 18 public class ToastUtil {
20   - private static Toast toast;
21   -
22   - private static long back_pressed;
  19 + private static long showTime;
23 20 private static String show_msg = "";
24 21 private static Toast current_toast;
25 22 private static final int TOAST_LAYOUT_ID = R.layout.test_layout_toast;
... ... @@ -29,45 +26,29 @@ public class ToastUtil {
29 26 }
30 27  
31 28 public static Toast show(Context context, String msg) {
32   -// if (!ShockwaveApplication.appOnline)
33   -// return;
34   - hide();
35 29 if (null == context || TextUtils.isEmpty(msg))
36 30 return null;
37   - if (back_pressed + 2000 < System.currentTimeMillis() || !show_msg.equals(msg)) {
  31 + if (showTime + 2000 < System.currentTimeMillis() || !show_msg.equals(msg)) {
38 32 hideToast();
39   - show_msg = msg;
40   - toast = new Toast(context);
  33 +
41 34 View view = LayoutInflater.from(context).inflate(TOAST_LAYOUT_ID, null, false);
  35 +
42 36 ImageView imageView = view.findViewById(R.id.image);
43   - TextView textView = view.findViewById(R.id.text);
44 37 imageView.setVisibility(View.GONE);
45 38  
  39 + TextView textView = view.findViewById(R.id.text);
46 40 textView.setText(msg);
  41 +
  42 + Toast toast = new Toast(context);
47 43 toast.setDuration(Toast.LENGTH_SHORT);
48 44 toast.setView(view);
49 45 toast.show();
50   - current_toast = toast;
51   - }
52   - back_pressed = System.currentTimeMillis();
53   - return toast;
54   - }
55   -
56   - public static boolean checkNetwork(Context context) {
57   - if (context == null) return false;
58   - if (NetworkUtil.isConnectInternet(context.getApplicationContext())) {
59   - return true;
60   - } else {
61   - show(context.getApplicationContext(), context.getString(R.string.net_connect_toast));
62   - return false;
63   - }
64   - }
65 46  
66   - public static void showToast(Context context, String text) {
67   - show(context,text);
  47 + show_msg = msg;
  48 + current_toast = toast;
  49 + showTime = System.currentTimeMillis();
  50 + return toast;
  51 + } else return null;
68 52 }
69 53  
70   - public static void hide() {
71   - if (toast != null) toast.cancel();
72   - }
73 54 }
... ...
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
... ... @@ -6,7 +6,6 @@ import android.os.Bundle;
6 6 import android.support.annotation.Nullable;
7 7 import android.support.v4.app.Fragment;
8 8 import android.support.v7.widget.GridLayoutManager;
9   -import android.support.v7.widget.OrientationHelper;
10 9 import android.support.v7.widget.SwitchCompat;
11 10 import android.view.LayoutInflater;
12 11 import android.view.View;
... ... @@ -80,8 +79,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
80 79 initDate();
81 80 initGift();
82 81 initChat();
83   -
84   -
85 82 }
86 83  
87 84  
... ... @@ -167,8 +164,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
167 164 fragmentChatBinding.rlGift.setVisibility(i);
168 165 }
169 166 });
170   - GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
171   - gridLayoutManager.setOrientation(OrientationHelper.HORIZONTAL);
  167 + GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 6);
172 168 fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager);
173 169 fragmentChatBinding.setGiftAdapter(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean));
174 170 }
... ...
app/src/main/java/com/cnlive/gundam/video/fragment/chat/CommentFragment.java
... ... @@ -53,7 +53,7 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C
53 53 private CommentUtil commentUtil;
54 54 private CommentAdapter commentAdapter;
55 55 private RecyclerView recyclerView;
56   - private String programID = "123";
  56 + private String programID ;
57 57 private String userID;
58 58  
59 59 @Nullable
... ...
app/src/main/res/drawable-hdpi/tab_bar_bg.9.png

2.75 KB | W: | H:

1.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-mdpi/tab_bar_bg.9.png

1.68 KB | W: | H:

1.03 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/tab_bar_bg.9.png

4.29 KB | W: | H:

2.27 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxhdpi/tab_bar_bg.9.png

7.34 KB | W: | H:

3.47 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxxhdpi/tab_bar_bg.9.png

13.4 KB | W: | H:

6.91 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxhdpi/toolbar_bg.9.png renamed to app/src/main/res/drawable/toolbar_bg.9.png

94 Bytes

app/src/main/res/layout/fragment_chat.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <layout xmlns:android="http://schemas.android.com/apk/res/android"
3   - xmlns:app="http://schemas.android.com/apk/res-auto"
4   - >
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
5 4  
6 5 <data>
7 6  
8 7 <variable
9 8 name="messageAdapter"
10 9 type="com.cnlive.gundam.video.adpter.CommonAdapter" />
11   -
  10 +
12 11 <variable
13 12 name="giftAdapter"
14 13 type="com.cnlive.gundam.video.adpter.GiftAdapter" />
... ... @@ -25,14 +24,14 @@
25 24 android:id="@+id/list_message"
26 25 android:layout_width="match_parent"
27 26 android:layout_height="match_parent"
  27 + android:layout_above="@+id/edit_layout"
28 28 android:layout_alignParentLeft="true"
29 29 android:layout_alignParentStart="true"
30 30 android:divider="@null"
31 31 android:scrollbars="none"
32 32 android:stackFromBottom="true"
33 33 android:transcriptMode="alwaysScroll"
34   - app:Adapter="@{messageAdapter}"
35   - android:layout_above="@+id/edit_layout"/>
  34 + app:Adapter="@{messageAdapter}" />
36 35  
37 36  
38 37 <RelativeLayout
... ... @@ -87,8 +86,7 @@
87 86 android:id="@+id/recycler_gift"
88 87 android:layout_width="match_parent"
89 88 android:layout_height="wrap_content"
90   - app:adapter="@{giftAdapter}"
91   - />
  89 + app:adapter="@{giftAdapter}" />
92 90  
93 91 </RelativeLayout>
94 92  
... ...
app/src/main/res/layout/fragment_gift_receycel.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<layout xmlns:android="http://schemas.android.com/apk/res/android"
3   - >
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android">
4 3  
5 4  
6 5 <data>
... ... @@ -10,40 +9,27 @@
10 9 type="com.cnlive.gundam.video.model.GiftModle" />
11 10 </data>
12 11  
13   - <LinearLayout
  12 + <RelativeLayout
14 13 android:id="@+id/ll_item"
15   - android:layout_width="wrap_content"
16   - android:layout_height="wrap_content"
17   - android:padding="5dp"
18   -
19   - android:orientation="vertical">
  14 + android:layout_width="match_parent"
  15 + android:layout_height="wrap_content">
20 16  
21 17 <ImageView
22 18 android:id="@+id/avaimg"
23 19 android:layout_width="40dp"
24 20 android:layout_height="40dp"
25 21 android:src="@{dataBean.imgSource}"
26   - />
  22 + android:layout_centerHorizontal="true"/>
27 23  
28   - <RelativeLayout
  24 + <TextView
29 25 android:layout_width="wrap_content"
30   - android:layout_height="wrap_content">
31   -
32   -
33   - <TextView
34   - android:layout_width="wrap_content"
35   - android:layout_height="wrap_content"
36   - android:textColor="@android:color/white"
37   - android:layout_centerInParent="true"
38   - android:text="@{dataBean.giftMessage}"/>
39   -
40   - </RelativeLayout>
41   -
42   -
43   -
44   -
  26 + android:layout_height="wrap_content"
  27 + android:layout_centerHorizontal="true"
  28 + android:layout_below="@+id/avaimg"
  29 + android:text="@{dataBean.giftMessage}"
  30 + android:textColor="@android:color/white" />
45 31  
46   - </LinearLayout>
  32 + </RelativeLayout>
47 33  
48 34  
49 35 </layout>
50 36 \ No newline at end of file
... ...