Commit fa3b3f03c5f1e173aa1f1c02aa9a4ed389e3b66d
1 parent
87fb84bd
优化代码
Showing
8 changed files
with
55 additions
and
129 deletions
app/src/main/java/com/cnlive/gundam/video/adpter/GiftAdapter.java
| ... | ... | @@ -33,12 +33,15 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 33 | 33 | private int mLayoutId; // 条目布局文件ID |
| 34 | 34 | private int mVariableId; // DataBinding变量ID |
| 35 | 35 | private String roomId; |
| 36 | + private final Gson gson2; | |
| 37 | + | |
| 36 | 38 | public GiftAdapter(String roomId,Context context, List<GiftModle> list, int layoutId, int variableId) { |
| 37 | 39 | this.mContext = context; |
| 38 | 40 | this.mDataList = list; |
| 39 | 41 | this.mLayoutId = layoutId; |
| 40 | 42 | mVariableId = variableId; |
| 41 | 43 | this.roomId=roomId; |
| 44 | + gson2 = new Gson(); | |
| 42 | 45 | |
| 43 | 46 | |
| 44 | 47 | } |
| ... | ... | @@ -59,7 +62,6 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 59 | 62 | @Override |
| 60 | 63 | public void onClick(View v) { |
| 61 | 64 | CNMessageModle cnMessageModle = new CNMessageModle("giftType",new MessageInfo("0",mDataList.get(position).getGiftMessage(),"1","0",mDataList.get(position).getGiftMessage())); |
| 62 | - Gson gson2=new Gson(); | |
| 63 | 65 | String obj2=gson2.toJson(cnMessageModle); |
| 64 | 66 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, new IChat.OnSendMessageListener() { |
| 65 | 67 | @Override |
| ... | ... | @@ -70,7 +72,6 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 70 | 72 | @Override |
| 71 | 73 | public void onSuccess(CNMessage message) { |
| 72 | 74 | PlayerActivity context = (PlayerActivity) GiftAdapter.this.mContext; |
| 73 | - | |
| 74 | 75 | ChatRoomFragment chatRoomFragment = (ChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment"); |
| 75 | 76 | chatRoomFragment.giftItem(position); |
| 76 | 77 | ... | ... |
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerLiveFragment.java
| ... | ... | @@ -107,9 +107,6 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS |
| 107 | 107 | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - ChatRoomFragment chatRoomFragment = (ChatRoomFragment) getActivity().getSupportFragmentManager().findFragmentByTag("chatRoomFragment"); | |
| 111 | - chatRoomFragment.doBarrage(); | |
| 112 | - | |
| 113 | 110 | } |
| 114 | 111 | |
| 115 | 112 | ... | ... |
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerUgcLiveFragment.java
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
| ... | ... | @@ -24,11 +24,10 @@ import com.cnlive.gundam.user.model.User; |
| 24 | 24 | import com.cnlive.gundam.user.util.InputUtil; |
| 25 | 25 | import com.cnlive.gundam.video.adpter.CommonAdapter; |
| 26 | 26 | import com.cnlive.gundam.video.adpter.GiftAdapter; |
| 27 | +import com.cnlive.gundam.video.barrage.BarrageBaseMessage; | |
| 27 | 28 | import com.cnlive.gundam.video.barrage.BarrageBaseView; |
| 28 | 29 | import com.cnlive.gundam.video.model.GiftModle; |
| 29 | 30 | import com.cnlive.gundam.video.model.MessageContent; |
| 30 | -import com.cnlive.gundam.video.utils.PlayerUtils; | |
| 31 | -import com.cnlive.gundam.video.view.PlayerControllerView; | |
| 32 | 31 | import com.cnlive.libs.util.chat.ChatUtil; |
| 33 | 32 | import com.cnlive.libs.util.chat.base.IChat; |
| 34 | 33 | import com.cnlive.libs.util.chat.model.CNUserInfo; |
| ... | ... | @@ -37,14 +36,14 @@ import com.cnlive.libs.video.barrage.BarrageLayout; |
| 37 | 36 | import java.util.ArrayList; |
| 38 | 37 | |
| 39 | 38 | |
| 39 | + | |
| 40 | 40 | /** |
| 41 | 41 | * @author 陈硕 |
| 42 | 42 | * @time 2017/5/27 13:57 |
| 43 | 43 | * @desc ${TODD} |
| 44 | 44 | */ |
| 45 | -public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.SendAndRecevieSucessCall { | |
| 45 | +public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.OnChatListener { | |
| 46 | 46 | |
| 47 | - PlayerControllerView.SwitchCompatChangeListener switchCompatChangeListener; | |
| 48 | 47 | private FragmentChatBinding fragmentChatBinding; |
| 49 | 48 | private ArrayList<GiftModle> giftArray; |
| 50 | 49 | private CommonAdapter<MessageContent> messageContentCommonAdapter; |
| ... | ... | @@ -125,15 +124,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 125 | 124 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, message, messageContentInfo.onSendMessageListener); |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | - @Override | |
| 129 | - public void sentSucess(ArrayList<MessageContent> messageContents) { | |
| 130 | - messageContentCommonAdapter.addItems((messageContents)); | |
| 131 | - } | |
| 132 | - | |
| 133 | - @Override | |
| 134 | - public void receaviceSucess(ArrayList<MessageContent> messageContents) { | |
| 135 | - messageContentCommonAdapter.addItems((messageContents)); | |
| 136 | - } | |
| 137 | 127 | |
| 138 | 128 | |
| 139 | 129 | @Override |
| ... | ... | @@ -144,14 +134,20 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 144 | 134 | |
| 145 | 135 | private void initChat() { |
| 146 | 136 | User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); |
| 147 | - String faceurl = activeAccountInfo.getFaceurl(); | |
| 148 | - String nickname = activeAccountInfo.getNickname(); | |
| 149 | - int uid = activeAccountInfo.getUid(); | |
| 137 | + final String faceurl = activeAccountInfo.getFaceurl(); | |
| 138 | + final String nickname = activeAccountInfo.getNickname(); | |
| 139 | + final int uid = activeAccountInfo.getUid(); | |
| 140 | + | |
| 150 | 141 | if (uid != 0) { |
| 142 | + | |
| 151 | 143 | ChatUtil.connect(new CNUserInfo(uid + "", nickname, faceurl), messageContentInfo.onConnectListener); |
| 152 | 144 | } else { |
| 145 | + | |
| 153 | 146 | ChatUtil.connect(messageContentInfo.onConnectListener); |
| 147 | + | |
| 154 | 148 | } |
| 149 | + | |
| 150 | + | |
| 155 | 151 | ChatUtil.setOnReceiveMessageListener(messageContentInfo.onReceiveMessageListener); |
| 156 | 152 | |
| 157 | 153 | } |
| ... | ... | @@ -213,38 +209,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 213 | 209 | barrageBottom(); |
| 214 | 210 | initMessageAdapter(); |
| 215 | 211 | messageContentInfo = new MessageContentInfo(); |
| 216 | - messageContentInfo.setOnReceiveAndSendListener(barrageLayout, roomId, getActivity(), ChatRoomFragment.this); | |
| 217 | - } | |
| 218 | - | |
| 219 | - | |
| 220 | - public void doBarrage() { | |
| 221 | - boolean isPortrait = PlayerUtils.isPortrait(getActivity()); | |
| 222 | - final BarrageLayout barrageLayout = getActivity().findViewById(R.id.private_message); | |
| 223 | - barrageLayout.pause(); | |
| 224 | - SwitchCompat switchCompat = getActivity().findViewById(R.id.barrage); | |
| 225 | - switchCompat.setChecked(false); | |
| 226 | - if (!isPortrait) { | |
| 227 | - PlayerControllerView viewById = getActivity().findViewById(R.id.controllerView); | |
| 228 | - viewById.setonswitchCompatChangeListene(switchCompatChangeListener = new PlayerControllerView.SwitchCompatChangeListener() { | |
| 229 | - @Override | |
| 230 | - public void onSwitchCompatChange(SwitchCompat barrageTop) { | |
| 231 | - barrageTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | |
| 232 | - @Override | |
| 233 | - public void onCheckedChanged(CompoundButton compoundButton, boolean b) { | |
| 234 | - if (b) { | |
| 235 | - barrageLayout.resume(); | |
| 236 | - | |
| 237 | - } else { | |
| 238 | - barrageLayout.pause(); | |
| 239 | - | |
| 240 | - } | |
| 241 | - } | |
| 242 | - }); | |
| 243 | - } | |
| 244 | - }); | |
| 245 | - | |
| 246 | - | |
| 247 | - } | |
| 212 | + messageContentInfo.setOnReceiveAndSendListener( roomId, getActivity(), ChatRoomFragment.this); | |
| 248 | 213 | } |
| 249 | 214 | |
| 250 | 215 | |
| ... | ... | @@ -253,4 +218,14 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 253 | 218 | } |
| 254 | 219 | |
| 255 | 220 | |
| 221 | + @Override | |
| 222 | + public void onchat(ArrayList<MessageContent> messageContents) { | |
| 223 | + messageContentCommonAdapter.addItems((messageContents)); | |
| 224 | + | |
| 225 | + } | |
| 226 | + | |
| 227 | + @Override | |
| 228 | + public void onbarrage(BarrageBaseMessage barrageBaseMessage) { | |
| 229 | + barrageLayout.addMessage(barrageBaseMessage); | |
| 230 | + } | |
| 256 | 231 | } | ... | ... |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/CommentFragment.java
| 1 | 1 | package com.cnlive.gundam.video.fragment.chat; |
| 2 | 2 | |
| 3 | -import android.content.Context; | |
| 4 | 3 | import android.os.Bundle; |
| 5 | 4 | import android.support.annotation.Nullable; |
| 6 | 5 | import android.support.v4.app.Fragment; |
| 7 | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 8 | 7 | import android.support.v7.widget.RecyclerView; |
| 9 | -import android.telephony.TelephonyManager; | |
| 10 | 8 | import android.util.Log; |
| 11 | 9 | import android.view.LayoutInflater; |
| 12 | 10 | import android.view.View; |
| ... | ... | @@ -18,7 +16,6 @@ import com.cnlive.gundam.R; |
| 18 | 16 | import com.cnlive.gundam.user.auth.UserService; |
| 19 | 17 | import com.cnlive.gundam.user.util.InputUtil; |
| 20 | 18 | import com.cnlive.gundam.video.adpter.CommentAdapter; |
| 21 | -import com.cnlive.libs.util.Config; | |
| 22 | 19 | import com.cnlive.libs.util.chat.model.ErrorMessage; |
| 23 | 20 | import com.cnlive.libs.util.comment.CommentUtil; |
| 24 | 21 | import com.cnlive.libs.util.comment.base.CommentCallback; |
| ... | ... | @@ -29,6 +26,7 @@ import com.cnlive.libs.util.model.CommentPage; |
| 29 | 26 | import com.cnlive.libs.util.model.CommentProgram; |
| 30 | 27 | |
| 31 | 28 | import java.util.List; |
| 29 | +import java.util.Random; | |
| 32 | 30 | |
| 33 | 31 | /** |
| 34 | 32 | * @author 陈硕 |
| ... | ... | @@ -78,10 +76,9 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C |
| 78 | 76 | inputUtil.setonSendCommentCallBack(this); |
| 79 | 77 | int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); |
| 80 | 78 | if(uid!=0){ |
| 81 | - userID=uid+""; | |
| 79 | + userID=String.valueOf(uid); | |
| 82 | 80 | }else { |
| 83 | - TelephonyManager telephonyManager = (TelephonyManager) Config.getContext().getSystemService(Context.TELEPHONY_SERVICE); | |
| 84 | - userID=telephonyManager.getDeviceId();} | |
| 81 | + userID=String.valueOf(new Random().nextInt(100));} | |
| 85 | 82 | |
| 86 | 83 | } |
| 87 | 84 | |
| ... | ... | @@ -172,7 +169,7 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C |
| 172 | 169 | if (errorMessage != null && errorMessage.getErrorCode().equals("0")) { |
| 173 | 170 | |
| 174 | 171 | Toast.makeText(getActivity(), "评论成功", Toast.LENGTH_SHORT).show(); |
| 175 | - edit_comment.setText(""); | |
| 172 | + edit_comment.setText("我来说两句....."); | |
| 176 | 173 | commentAdapter.clearItems(); |
| 177 | 174 | getCommentMesaage(); |
| 178 | 175 | } else Toast.makeText(getActivity(), "评论失败", Toast.LENGTH_SHORT).show(); | ... | ... |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/MessageContentInfo.java
| ... | ... | @@ -12,7 +12,6 @@ import com.cnlive.gundam.video.model.MessageInfo; |
| 12 | 12 | import com.cnlive.libs.util.chat.ChatUtil; |
| 13 | 13 | import com.cnlive.libs.util.chat.base.IChat; |
| 14 | 14 | import com.cnlive.libs.util.chat.model.CNMessage; |
| 15 | -import com.cnlive.libs.video.barrage.BarrageLayout; | |
| 16 | 15 | import com.google.gson.Gson; |
| 17 | 16 | |
| 18 | 17 | import java.util.ArrayList; |
| ... | ... | @@ -31,46 +30,40 @@ public class MessageContentInfo { |
| 31 | 30 | private Handler mHandler; |
| 32 | 31 | private ArrayList<com.cnlive.gundam.video.model.MessageContent> messageContentArrayList; |
| 33 | 32 | private Context mContext; |
| 34 | - private SendAndRecevieSucessCall mSendAndRecevieSucessCall; | |
| 33 | + private OnChatListener onChatListener; | |
| 35 | 34 | private String roomId; |
| 36 | - private BarrageLayout barrageLayout; | |
| 37 | 35 | private String JoinType = "joinType"; |
| 38 | 36 | private String ChatRoom = "chatRoom"; |
| 39 | 37 | private String giftType = "giftType"; |
| 40 | 38 | private Gson gson; |
| 41 | 39 | |
| 42 | 40 | |
| 43 | - public void setOnReceiveAndSendListener(BarrageLayout barrageLayout, String roomID, Context context, SendAndRecevieSucessCall sendAndRecevieSucessCall) { | |
| 41 | + public void setOnReceiveAndSendListener(String roomID, Context context, OnChatListener sendAndRecevieSucessCall) { | |
| 44 | 42 | this.roomId = roomID; |
| 45 | 43 | this.mContext = context; |
| 46 | 44 | gson = new Gson(); |
| 47 | - this.mSendAndRecevieSucessCall = sendAndRecevieSucessCall; | |
| 45 | + this.onChatListener = sendAndRecevieSucessCall; | |
| 48 | 46 | mHandler = new Handler(); |
| 49 | 47 | messageContentArrayList = new ArrayList<>(); |
| 50 | - this.barrageLayout = barrageLayout; | |
| 51 | 48 | initListener(); |
| 52 | 49 | |
| 53 | 50 | } |
| 54 | 51 | |
| 55 | - | |
| 56 | 52 | private void initListener() { |
| 57 | - | |
| 58 | - | |
| 59 | 53 | onReceiveMessageListener = new IChat.OnReceiveMessageListener() { |
| 60 | 54 | @Override |
| 61 | 55 | public void processMessage(final CNMessage message) { |
| 62 | - | |
| 63 | 56 | mHandler.post(new Runnable() { |
| 64 | 57 | @Override |
| 65 | 58 | public void run() { |
| 66 | 59 | try { |
| 67 | - | |
| 68 | - | |
| 69 | 60 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); |
| 70 | 61 | String messagecontent = cnMessageModle.getMessage().getContent(); |
| 71 | 62 | String messageType = cnMessageModle.getType(); |
| 72 | 63 | if (messageType.equals(giftType)) { |
| 73 | - barrageLayout.addMessage(new BarrageBaseMessage(message.getUserInfo().getUserName(), "送了" + messagecontent, "")); | |
| 64 | + if (onChatListener != null) { | |
| 65 | + onChatListener.onbarrage(new BarrageBaseMessage(message.getUserInfo().getUserName(), "送了" + messagecontent, "")); | |
| 66 | + } | |
| 74 | 67 | messageContentArrayList.add(new MessageContent(message.getUserInfo().getUserName(), ": 送了" + messagecontent, message.getUserInfo().getHeadUrl(), true)); |
| 75 | 68 | } else if (messageType.equals(ChatRoom)) { |
| 76 | 69 | if (message.getUserInfo().getUserId().equals(ChatUtil.getCurrentUserInfo().getUserId())) { |
| ... | ... | @@ -78,8 +71,9 @@ public class MessageContentInfo { |
| 78 | 71 | } else { |
| 79 | 72 | messageContentArrayList.add(new MessageContent(message.getUserInfo().getUserName(), " :" + messagecontent, message.getUserInfo().getHeadUrl(), true)); |
| 80 | 73 | } |
| 81 | - barrageLayout.addMessage(new BarrageBaseMessage(message.getUserInfo().getUserName(), messagecontent, "")); | |
| 82 | - | |
| 74 | + if (onChatListener != null) { | |
| 75 | + onChatListener.onbarrage(new BarrageBaseMessage(message.getUserInfo().getUserName(), messagecontent, "")); | |
| 76 | + } | |
| 83 | 77 | } else if (messageType.equals(JoinType)) { |
| 84 | 78 | String userName = message.getUserInfo().getUserName(); |
| 85 | 79 | if (TextUtils.isEmpty(userName)) { |
| ... | ... | @@ -88,15 +82,15 @@ public class MessageContentInfo { |
| 88 | 82 | if (userName.equals(UserService.getInstance(mContext).getActiveAccountInfo().getNickname())) { |
| 89 | 83 | return; |
| 90 | 84 | } |
| 91 | - barrageLayout.addMessage(new BarrageBaseMessage(message.getUserInfo().getUserName(), "来了", "")); | |
| 92 | - | |
| 85 | + if (onChatListener != null) { | |
| 86 | + onChatListener.onbarrage(new BarrageBaseMessage(message.getUserInfo().getUserName(), "来了", "")); | |
| 87 | + } | |
| 93 | 88 | messageContentArrayList.add(new MessageContent(message.getUserInfo().getUserName(), ": " + "来了", message.getUserInfo().getHeadUrl(), true)); |
| 94 | - | |
| 95 | 89 | } |
| 96 | - | |
| 97 | - mSendAndRecevieSucessCall.receaviceSucess(messageContentArrayList); | |
| 98 | - | |
| 99 | - } catch (Exception e) { | |
| 90 | + if (onChatListener != null) { | |
| 91 | + onChatListener.onchat(messageContentArrayList); | |
| 92 | + } | |
| 93 | + } catch (Exception e) { | |
| 100 | 94 | e.printStackTrace(); |
| 101 | 95 | } |
| 102 | 96 | } |
| ... | ... | @@ -109,37 +103,24 @@ public class MessageContentInfo { |
| 109 | 103 | onSendMessageListener = new IChat.OnSendMessageListener() { |
| 110 | 104 | @Override |
| 111 | 105 | public void onAttached(CNMessage message) { |
| 112 | - | |
| 113 | 106 | } |
| 114 | - | |
| 115 | 107 | @Override |
| 116 | 108 | public void onSuccess(CNMessage message) { |
| 117 | - | |
| 118 | 109 | try { |
| 119 | - | |
| 120 | 110 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); |
| 121 | 111 | String messagecontent = cnMessageModle.getMessage().getContent(); |
| 122 | 112 | String messageType = cnMessageModle.getType(); |
| 123 | - | |
| 124 | - | |
| 125 | - if (messageType.equals(ChatRoom)) { | |
| 126 | - barrageLayout.addMessage(new BarrageBaseMessage(message.getUserInfo().getUserName(), messagecontent, "")); | |
| 127 | - | |
| 113 | + if (messageType.equals(ChatRoom)) { | |
| 114 | + onChatListener.onbarrage(new BarrageBaseMessage(message.getUserInfo().getUserName(), messagecontent, "")); | |
| 128 | 115 | messageContentArrayList.add(new MessageContent(message.getUserInfo().getUserName(), messagecontent + " :", message.getUserInfo().getHeadUrl(), false)); |
| 129 | - | |
| 130 | - mSendAndRecevieSucessCall.sentSucess(messageContentArrayList); | |
| 116 | + onChatListener.onchat(messageContentArrayList); | |
| 131 | 117 | } |
| 132 | - | |
| 133 | 118 | } catch (Exception e) { |
| 134 | 119 | e.printStackTrace(); |
| 135 | 120 | } |
| 136 | - | |
| 137 | - | |
| 138 | 121 | } |
| 139 | - | |
| 140 | 122 | @Override |
| 141 | 123 | public void onError(CNMessage message, int what, String extra) { |
| 142 | - | |
| 143 | 124 | } |
| 144 | 125 | }; |
| 145 | 126 | |
| ... | ... | @@ -148,14 +129,10 @@ public class MessageContentInfo { |
| 148 | 129 | @Override |
| 149 | 130 | public void onTokenIncorrect(String s) { |
| 150 | 131 | } |
| 151 | - | |
| 152 | 132 | @Override |
| 153 | 133 | public void onSuccess(String s) { |
| 154 | 134 | joinChatRoom(); |
| 155 | - | |
| 156 | 135 | } |
| 157 | - | |
| 158 | - | |
| 159 | 136 | @Override |
| 160 | 137 | public void onError(int i, String s) { |
| 161 | 138 | |
| ... | ... | @@ -165,7 +142,7 @@ public class MessageContentInfo { |
| 165 | 142 | } |
| 166 | 143 | |
| 167 | 144 | |
| 168 | - private void joinChatRoom() { | |
| 145 | + public void joinChatRoom() { | |
| 169 | 146 | ChatUtil.joinChatRoom(roomId, 0, new IChat.OnOperationListener() { |
| 170 | 147 | @Override |
| 171 | 148 | public void onSuccess(int what, String extra) { |
| ... | ... | @@ -181,10 +158,11 @@ public class MessageContentInfo { |
| 181 | 158 | }); |
| 182 | 159 | } |
| 183 | 160 | |
| 184 | - public interface SendAndRecevieSucessCall { | |
| 185 | - void sentSucess(ArrayList<com.cnlive.gundam.video.model.MessageContent> messageContents); | |
| 161 | + public interface OnChatListener { | |
| 162 | + void onchat(ArrayList<com.cnlive.gundam.video.model.MessageContent> messageContents); | |
| 163 | + | |
| 164 | + void onbarrage(BarrageBaseMessage barrageBaseMessage); | |
| 186 | 165 | |
| 187 | - void receaviceSucess(ArrayList<com.cnlive.gundam.video.model.MessageContent> messageContents); | |
| 188 | 166 | } |
| 189 | 167 | |
| 190 | 168 | ... | ... |
app/src/main/java/com/cnlive/gundam/video/view/PlayerControllerView.java
| ... | ... | @@ -11,7 +11,6 @@ import android.databinding.ObservableLong; |
| 11 | 11 | import android.databinding.ViewDataBinding; |
| 12 | 12 | import android.os.Handler; |
| 13 | 13 | import android.os.Message; |
| 14 | -import android.support.v7.widget.SwitchCompat; | |
| 15 | 14 | import android.text.TextUtils; |
| 16 | 15 | import android.util.AttributeSet; |
| 17 | 16 | import android.view.LayoutInflater; |
| ... | ... | @@ -21,7 +20,6 @@ import android.widget.SeekBar; |
| 21 | 20 | |
| 22 | 21 | import com.cnlive.gundam.BR; |
| 23 | 22 | import com.cnlive.gundam.R; |
| 24 | -import com.cnlive.gundam.databinding.LayoutPlayerControllerLiveLBinding; | |
| 25 | 23 | import com.cnlive.gundam.video.utils.PlayerUtils; |
| 26 | 24 | import com.cnlive.gundam.video.utils.VideoRateUtil; |
| 27 | 25 | import com.cnlive.libs.util.Config; |
| ... | ... | @@ -186,7 +184,6 @@ public class PlayerControllerView extends RelativeLayout implements SeekBar.OnSe |
| 186 | 184 | binding.setVariable(BR.title, observableTitle); |
| 187 | 185 | binding.setVariable(BR.showController, observableShow); |
| 188 | 186 | binding.setVariable(BR.isPlay, observableIsPlay); |
| 189 | - if(switchCompatChangeListener!=null)switchCompatChangeListener.onSwitchCompatChange(((LayoutPlayerControllerLiveLBinding) this.binding).barrageTop); | |
| 190 | 187 | isUgc = false; |
| 191 | 188 | break; |
| 192 | 189 | case UGC_VOD_P: |
| ... | ... | @@ -406,14 +403,6 @@ public class PlayerControllerView extends RelativeLayout implements SeekBar.OnSe |
| 406 | 403 | void onSwitchRate(String rate); |
| 407 | 404 | } |
| 408 | 405 | |
| 409 | - public interface SwitchCompatChangeListener{ | |
| 410 | - void onSwitchCompatChange(SwitchCompat barrageTop); | |
| 411 | - } | |
| 412 | - private SwitchCompatChangeListener switchCompatChangeListener; | |
| 413 | - public void setonswitchCompatChangeListene(SwitchCompatChangeListener switchCompatChangeListener){ | |
| 414 | - this.switchCompatChangeListener=switchCompatChangeListener; | |
| 415 | - } | |
| 416 | - | |
| 417 | 406 | |
| 418 | 407 | |
| 419 | 408 | } | ... | ... |
app/src/main/res/layout/layout_player_controller_live_l.xml
| ... | ... | @@ -175,18 +175,6 @@ |
| 175 | 175 | android:textColor="@android:color/white" |
| 176 | 176 | android:visibility="@{hasRate.get() ? View.VISIBLE : View.GONE}" /> |
| 177 | 177 | |
| 178 | - <android.support.v7.widget.SwitchCompat | |
| 179 | - android:id="@+id/barrage_top" | |
| 180 | - android:layout_width="wrap_content" | |
| 181 | - android:layout_height="wrap_content" | |
| 182 | - android:layout_centerVertical="true" | |
| 183 | - android:background="@null" | |
| 184 | - android:textIsSelectable="false" | |
| 185 | - android:layout_marginRight="10dp" | |
| 186 | - android:layout_toLeftOf="@+id/rate" | |
| 187 | - android:thumb="@drawable/switch_thumb" | |
| 188 | - app:switchMinWidth="15dp" | |
| 189 | - app:track="@drawable/switch_track" /> | |
| 190 | 178 | |
| 191 | 179 | </RelativeLayout> |
| 192 | 180 | ... | ... |