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