Commit 2f7e48bc16997e6762dd06f6c77112b1ff68d657

Authored by 陈硕
1 parent c6e316a1

ios联调

app/src/main/java/com/cnlive/gundam/video/fragment/PlayerLiveFragment.java
@@ -50,7 +50,8 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS @@ -50,7 +50,8 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS
50 @Override 50 @Override
51 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 51 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
52 binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_live, container, false); 52 binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_live, container, false);
53 - getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, ChatRoomFragment.newInstance(), "chatRoomFragment").commit(); 53 + program = (VideoListProgram) getArguments().getSerializable("program");
  54 + getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, ChatRoomFragment.newInstance(program.getChannelId()), "chatRoomFragment").commit();
54 return binding.getRoot(); 55 return binding.getRoot();
55 } 56 }
56 57
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerUgcLiveFragment.java
@@ -16,7 +16,7 @@ import android.widget.Toast; @@ -16,7 +16,7 @@ import android.widget.Toast;
16 import com.cnlive.gundam.R; 16 import com.cnlive.gundam.R;
17 import com.cnlive.gundam.databinding.FragmentPlayerUgcLiveBinding; 17 import com.cnlive.gundam.databinding.FragmentPlayerUgcLiveBinding;
18 import com.cnlive.gundam.main.model.VideoListProgram; 18 import com.cnlive.gundam.main.model.VideoListProgram;
19 -import com.cnlive.gundam.video.fragment.chat.UgcLiveChatFragment; 19 +import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment;
20 import com.cnlive.gundam.video.model.VideoModel; 20 import com.cnlive.gundam.video.model.VideoModel;
21 import com.cnlive.gundam.video.utils.PlayerUtils; 21 import com.cnlive.gundam.video.utils.PlayerUtils;
22 import com.cnlive.gundam.video.view.BaseVideoView; 22 import com.cnlive.gundam.video.view.BaseVideoView;
@@ -57,8 +57,8 @@ public class PlayerUgcLiveFragment extends Fragment implements BaseVideoView.OnU @@ -57,8 +57,8 @@ public class PlayerUgcLiveFragment extends Fragment implements BaseVideoView.OnU
57 @Override 57 @Override
58 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 58 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
59 binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_ugc_live, container, false); 59 binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_ugc_live, container, false);
60 - getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, UgcLiveChatFragment.newInstance(), "ugcLiveChatFragment").commit();  
61 initData(); 60 initData();
  61 + getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, ChatRoomFragment.newInstance(id), "chatRoomFragment").commit();
62 return binding.getRoot(); 62 return binding.getRoot();
63 } 63 }
64 64
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
@@ -48,14 +48,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -48,14 +48,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
48 private FragmentChatBinding fragmentChatBinding; 48 private FragmentChatBinding fragmentChatBinding;
49 private ArrayList<GiftModle> giftArray; 49 private ArrayList<GiftModle> giftArray;
50 private CommonAdapter<MessageContent> messageContentCommonAdapter; 50 private CommonAdapter<MessageContent> messageContentCommonAdapter;
51 - private String roomId = "ChatRoom06";  
52 private MessageContentInfo messageContentInfo; 51 private MessageContentInfo messageContentInfo;
53 public SwitchCompat switchCompatBottom; 52 public SwitchCompat switchCompatBottom;
54 private BarrageLayout barrageLayout; 53 private BarrageLayout barrageLayout;
  54 + private String roomId;
55 55
56 56
57 - public static ChatRoomFragment newInstance() { 57 + public static ChatRoomFragment newInstance(String id ) {
58 Bundle args = new Bundle(); 58 Bundle args = new Bundle();
  59 + args.putString("roomID",id);
59 ChatRoomFragment fragment = new ChatRoomFragment(); 60 ChatRoomFragment fragment = new ChatRoomFragment();
60 fragment.setArguments(args); 61 fragment.setArguments(args);
61 return fragment; 62 return fragment;
@@ -66,6 +67,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -66,6 +67,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
66 @Override 67 @Override
67 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 68 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
68 fragmentChatBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_chat, container, false); 69 fragmentChatBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_chat, container, false);
  70 + roomId = getArguments().getString("roomID");
69 return fragmentChatBinding.getRoot(); 71 return fragmentChatBinding.getRoot();
70 72
71 } 73 }
app/src/main/java/com/cnlive/gundam/video/fragment/chat/MessageContentInfo.java
@@ -34,19 +34,19 @@ public class MessageContentInfo { @@ -34,19 +34,19 @@ public class MessageContentInfo {
34 private Context mContext; 34 private Context mContext;
35 private SendAndRecevieSucessCall mSendAndRecevieSucessCall; 35 private SendAndRecevieSucessCall mSendAndRecevieSucessCall;
36 private String roomId; 36 private String roomId;
37 - private BarrageLayout barrageLayout; 37 + private BarrageLayout barrageLayout;
38 private String JoinType = "joinType"; 38 private String JoinType = "joinType";
39 - private String ChatRoom ="chatRoom";  
40 - private String giftType = "giftType"; 39 + private String ChatRoom = "chatRoom";
  40 + private String giftType = "giftType";
41 41
42 42
43 - public void setOnReceiveAndSendListener(BarrageLayout barrageLayout,String roomID, Context context, SendAndRecevieSucessCall sendAndRecevieSucessCall) { 43 + public void setOnReceiveAndSendListener(BarrageLayout barrageLayout, String roomID, Context context, SendAndRecevieSucessCall sendAndRecevieSucessCall) {
44 this.roomId = roomID; 44 this.roomId = roomID;
45 this.mContext = context; 45 this.mContext = context;
46 this.mSendAndRecevieSucessCall = sendAndRecevieSucessCall; 46 this.mSendAndRecevieSucessCall = sendAndRecevieSucessCall;
47 mHandler = new Handler(); 47 mHandler = new Handler();
48 messageContentArrayList = new ArrayList<>(); 48 messageContentArrayList = new ArrayList<>();
49 - this.barrageLayout =barrageLayout; 49 + this.barrageLayout = barrageLayout;
50 initListener(); 50 initListener();
51 51
52 } 52 }
@@ -66,7 +66,7 @@ public class MessageContentInfo { @@ -66,7 +66,7 @@ public class MessageContentInfo {
66 66
67 Gson gson = new Gson(); 67 Gson gson = new Gson();
68 CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); 68 CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class);
69 - String messagecontent =cnMessageModle.getMessage().getContent(); 69 + String messagecontent = cnMessageModle.getMessage().getContent();
70 String messageType = cnMessageModle.getType(); 70 String messageType = cnMessageModle.getType();
71 71
72 72
@@ -123,7 +123,7 @@ public class MessageContentInfo { @@ -123,7 +123,7 @@ public class MessageContentInfo {
123 123
124 Gson gson = new Gson(); 124 Gson gson = new Gson();
125 CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); 125 CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class);
126 - String messagecontent =cnMessageModle.getMessage().getContent(); 126 + String messagecontent = cnMessageModle.getMessage().getContent();
127 String messageType = cnMessageModle.getType(); 127 String messageType = cnMessageModle.getType();
128 128
129 129
@@ -152,18 +152,19 @@ public class MessageContentInfo { @@ -152,18 +152,19 @@ public class MessageContentInfo {
152 onConnectListener = new IChat.OnConnectListener() { 152 onConnectListener = new IChat.OnConnectListener() {
153 @Override 153 @Override
154 public void onTokenIncorrect(String s) { 154 public void onTokenIncorrect(String s) {
155 - 155 + Log.v("dfasdfasd", "onTokenIncorrect");
156 } 156 }
157 157
158 @Override 158 @Override
159 public void onSuccess(String s) { 159 public void onSuccess(String s) {
160 joinChatRoom(); 160 joinChatRoom();
161 161
162 - } 162 + }
163 163
164 164
165 @Override 165 @Override
166 public void onError(int i, String s) { 166 public void onError(int i, String s) {
  167 + Log.v("dfasdfasd", "onError");
167 168
168 } 169 }
169 }; 170 };
@@ -175,15 +176,16 @@ public class MessageContentInfo { @@ -175,15 +176,16 @@ public class MessageContentInfo {
175 ChatUtil.joinChatRoom(roomId, 0, new IChat.OnOperationListener() { 176 ChatUtil.joinChatRoom(roomId, 0, new IChat.OnOperationListener() {
176 @Override 177 @Override
177 public void onSuccess(int what, String extra) { 178 public void onSuccess(int what, String extra) {
178 - CNMessageModle cnMessageModle = new CNMessageModle(JoinType,new MessageInfo("","","","",""));  
179 - Gson gson2=new Gson();  
180 - String obj2=gson2.toJson(cnMessageModle);  
181 - Log.v("dfsd",obj2); 179 + CNMessageModle cnMessageModle = new CNMessageModle(JoinType, new MessageInfo("", "", "", "", ""));
  180 + Gson gson2 = new Gson();
  181 + String obj2 = gson2.toJson(cnMessageModle);
  182 + Log.v("dfsd", obj2);
182 ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, onSendMessageListener); 183 ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, onSendMessageListener);
183 } 184 }
184 185
185 @Override 186 @Override
186 public void onError(int what, String extra) { 187 public void onError(int what, String extra) {
  188 + Log.v("dfsd", "onError");
187 189
188 } 190 }
189 }); 191 });
@@ -196,5 +198,4 @@ public class MessageContentInfo { @@ -196,5 +198,4 @@ public class MessageContentInfo {
196 } 198 }
197 199
198 200
199 -  
200 } 201 }
app/src/main/java/com/cnlive/gundam/video/fragment/chat/UgcLiveChatFragment.java deleted 100644 → 0
1 -package com.cnlive.gundam.video.fragment.chat;  
2 -  
3 -import android.os.Bundle;  
4 -import android.support.annotation.Nullable;  
5 -import android.support.v7.widget.SwitchCompat;  
6 -import android.view.LayoutInflater;  
7 -import android.view.View;  
8 -import android.view.ViewGroup;  
9 -  
10 -import com.cnlive.gundam.R;  
11 -import com.cnlive.gundam.video.view.PlayerControllerView;  
12 -  
13 -/**  
14 - * @author 陈硕  
15 - * @time 2017/6/29 19:36  
16 - * @desc ${TODD}  
17 - */  
18 -public class UgcLiveChatFragment extends ChatRoomFragment {  
19 -  
20 - public static UgcLiveChatFragment newInstance() {  
21 - Bundle args = new Bundle();  
22 - UgcLiveChatFragment fragment = new UgcLiveChatFragment();  
23 - fragment.setArguments(args);  
24 - return fragment;  
25 - }  
26 -  
27 - @Nullable  
28 - @Override  
29 - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {  
30 - return super.onCreateView(inflater, container, savedInstanceState);  
31 - }  
32 -  
33 -  
34 - @Override  
35 - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {  
36 - super.onViewCreated(view, savedInstanceState);  
37 - PlayerControllerView viewById = getActivity().findViewById(R.id.controllerView);  
38 - viewById.setonswitchCompatChangeListene(new PlayerControllerView.SwitchCompatChangeListener() {  
39 - @Override  
40 - public void onSwitchCompatChange(SwitchCompat barrageTop) {  
41 - barrageTop.setVisibility(View.INVISIBLE);  
42 - }  
43 - });  
44 - }  
45 -}