Commit ded909ab54be49c933866576e8445caaf6cbb680

Authored by 陈硕
1 parent abfdfe1a

添加游客评论

app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
@@ -8,7 +8,6 @@ import android.support.v4.app.Fragment; @@ -8,7 +8,6 @@ import android.support.v4.app.Fragment;
8 import android.support.v7.widget.GridLayoutManager; 8 import android.support.v7.widget.GridLayoutManager;
9 import android.support.v7.widget.OrientationHelper; 9 import android.support.v7.widget.OrientationHelper;
10 import android.support.v7.widget.SwitchCompat; 10 import android.support.v7.widget.SwitchCompat;
11 -import android.util.Log;  
12 import android.view.LayoutInflater; 11 import android.view.LayoutInflater;
13 import android.view.View; 12 import android.view.View;
14 import android.view.ViewGroup; 13 import android.view.ViewGroup;
@@ -57,9 +56,9 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -57,9 +56,9 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
57 private String[] gitName; 56 private String[] gitName;
58 57
59 58
60 - public static ChatRoomFragment newInstance(String id ) { 59 + public static ChatRoomFragment newInstance(String id) {
61 Bundle args = new Bundle(); 60 Bundle args = new Bundle();
62 - args.putString("roomID",id); 61 + args.putString("roomID", id);
63 ChatRoomFragment fragment = new ChatRoomFragment(); 62 ChatRoomFragment fragment = new ChatRoomFragment();
64 fragment.setArguments(args); 63 fragment.setArguments(args);
65 return fragment; 64 return fragment;
@@ -87,7 +86,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -87,7 +86,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
87 } 86 }
88 87
89 88
90 -  
91 private void barrageBottom() { 89 private void barrageBottom() {
92 switchCompatBottom = fragmentChatBinding.barrage; 90 switchCompatBottom = fragmentChatBinding.barrage;
93 switchCompatBottom.setChecked(false); 91 switchCompatBottom.setChecked(false);
@@ -219,18 +217,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -219,18 +217,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
219 } 217 }
220 218
221 219
222 -  
223 -  
224 -  
225 - public void doBarrage(){ 220 + public void doBarrage() {
226 boolean isPortrait = PlayerUtils.isPortrait(getActivity()); 221 boolean isPortrait = PlayerUtils.isPortrait(getActivity());
227 final BarrageLayout barrageLayout = getActivity().findViewById(R.id.private_message); 222 final BarrageLayout barrageLayout = getActivity().findViewById(R.id.private_message);
228 barrageLayout.pause(); 223 barrageLayout.pause();
229 SwitchCompat switchCompat = getActivity().findViewById(R.id.barrage); 224 SwitchCompat switchCompat = getActivity().findViewById(R.id.barrage);
230 switchCompat.setChecked(false); 225 switchCompat.setChecked(false);
231 - if (!isPortrait ) { 226 + if (!isPortrait) {
232 PlayerControllerView viewById = getActivity().findViewById(R.id.controllerView); 227 PlayerControllerView viewById = getActivity().findViewById(R.id.controllerView);
233 - viewById.setonswitchCompatChangeListene( switchCompatChangeListener = new PlayerControllerView.SwitchCompatChangeListener() { 228 + viewById.setonswitchCompatChangeListene(switchCompatChangeListener = new PlayerControllerView.SwitchCompatChangeListener() {
234 @Override 229 @Override
235 public void onSwitchCompatChange(SwitchCompat barrageTop) { 230 public void onSwitchCompatChange(SwitchCompat barrageTop) {
236 barrageTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 231 barrageTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@@ -253,14 +248,8 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback @@ -253,14 +248,8 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback
253 } 248 }
254 249
255 250
256 - public void giftItem(int postion){  
257 - Toast.makeText(getActivity(),gitName[postion],Toast.LENGTH_SHORT).show();  
258 - Log.d("giftItem", "giftItem: " +gitName[postion]);  
259 - int i = imaSource[postion];  
260 -  
261 -  
262 -  
263 - 251 + public void giftItem(int postion) {
  252 + Toast.makeText(getActivity(), gitName[postion], Toast.LENGTH_SHORT).show();
264 } 253 }
265 254
266 255
app/src/main/java/com/cnlive/gundam/video/fragment/chat/CommentFragment.java
1 package com.cnlive.gundam.video.fragment.chat; 1 package com.cnlive.gundam.video.fragment.chat;
2 2
  3 +import android.content.Context;
3 import android.os.Bundle; 4 import android.os.Bundle;
4 import android.support.annotation.Nullable; 5 import android.support.annotation.Nullable;
5 import android.support.v4.app.Fragment; 6 import android.support.v4.app.Fragment;
6 import android.support.v7.widget.LinearLayoutManager; 7 import android.support.v7.widget.LinearLayoutManager;
7 import android.support.v7.widget.RecyclerView; 8 import android.support.v7.widget.RecyclerView;
  9 +import android.telephony.TelephonyManager;
8 import android.util.Log; 10 import android.util.Log;
9 import android.view.LayoutInflater; 11 import android.view.LayoutInflater;
10 import android.view.View; 12 import android.view.View;
@@ -16,6 +18,7 @@ import com.cnlive.gundam.R; @@ -16,6 +18,7 @@ import com.cnlive.gundam.R;
16 import com.cnlive.gundam.user.auth.UserService; 18 import com.cnlive.gundam.user.auth.UserService;
17 import com.cnlive.gundam.user.util.InputUtil; 19 import com.cnlive.gundam.user.util.InputUtil;
18 import com.cnlive.gundam.video.adpter.CommentAdapter; 20 import com.cnlive.gundam.video.adpter.CommentAdapter;
  21 +import com.cnlive.libs.util.Config;
19 import com.cnlive.libs.util.chat.model.ErrorMessage; 22 import com.cnlive.libs.util.chat.model.ErrorMessage;
20 import com.cnlive.libs.util.comment.CommentUtil; 23 import com.cnlive.libs.util.comment.CommentUtil;
21 import com.cnlive.libs.util.comment.base.CommentCallback; 24 import com.cnlive.libs.util.comment.base.CommentCallback;
@@ -74,7 +77,12 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C @@ -74,7 +77,12 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C
74 inputUtil = new InputUtil(getActivity()); 77 inputUtil = new InputUtil(getActivity());
75 inputUtil.setonSendCommentCallBack(this); 78 inputUtil.setonSendCommentCallBack(this);
76 int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); 79 int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid();
77 - userID=uid +""; 80 + if(uid!=0){
  81 + userID=uid+"";
  82 + }else {
  83 + TelephonyManager telephonyManager = (TelephonyManager) Config.getContext().getSystemService(Context.TELEPHONY_SERVICE);
  84 + userID=telephonyManager.getDeviceId();}
  85 +
78 } 86 }
79 87
80 88
@@ -162,6 +170,7 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C @@ -162,6 +170,7 @@ public class CommentFragment extends Fragment implements View.OnClickListener, C
162 @Override 170 @Override
163 public void onResponse(ErrorMessage errorMessage) { 171 public void onResponse(ErrorMessage errorMessage) {
164 if (errorMessage != null && errorMessage.getErrorCode().equals("0")) { 172 if (errorMessage != null && errorMessage.getErrorCode().equals("0")) {
  173 +
165 Toast.makeText(getActivity(), "评论成功", Toast.LENGTH_SHORT).show(); 174 Toast.makeText(getActivity(), "评论成功", Toast.LENGTH_SHORT).show();
166 edit_comment.setText(""); 175 edit_comment.setText("");
167 commentAdapter.clearItems(); 176 commentAdapter.clearItems();
app/src/main/res/layout/fragment_player_vod.xml
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <RelativeLayout 16 <RelativeLayout
17 android:id="@+id/contentLayout" 17 android:id="@+id/contentLayout"
18 android:layout_below="@+id/videoView" 18 android:layout_below="@+id/videoView"
19 - android:background="@android:color/black" 19 + android:background="@android:color/white"
20 android:layout_width="match_parent" 20 android:layout_width="match_parent"
21 android:layout_height="wrap_content" 21 android:layout_height="wrap_content"
22 android:layout_alignParentBottom="true"> 22 android:layout_alignParentBottom="true">