Commit 6a02bd929f6b4c381e5f6d43d84f8750a4a32a83
1 parent
67043045
添加标题栏
Showing
17 changed files
with
462 additions
and
82 deletions
app/src/main/AndroidManifest.xml
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | <activity | 43 | <activity |
| 44 | android:name=".main.ui.activity.MainActivity" | 44 | android:name=".main.ui.activity.MainActivity" |
| 45 | android:label="@string/app_name" | 45 | android:label="@string/app_name" |
| 46 | - android:configChanges="keyboardHidden|screenSize|orientation"> | 46 | + android:screenOrientation="portrait"> |
| 47 | <intent-filter> | 47 | <intent-filter> |
| 48 | <action android:name="android.intent.action.MAIN" /> | 48 | <action android:name="android.intent.action.MAIN" /> |
| 49 | 49 |
app/src/main/java/com/cnlive/gundam/user/util/InputUtil.java
| @@ -20,6 +20,8 @@ import com.cnlive.gundam.video.model.CNMessageModle; | @@ -20,6 +20,8 @@ import com.cnlive.gundam.video.model.CNMessageModle; | ||
| 20 | import com.cnlive.gundam.video.model.MessageInfo; | 20 | import com.cnlive.gundam.video.model.MessageInfo; |
| 21 | import com.google.gson.Gson; | 21 | import com.google.gson.Gson; |
| 22 | 22 | ||
| 23 | + | ||
| 24 | + | ||
| 23 | /** | 25 | /** |
| 24 | * Created by xiansong on 2017/4/12. | 26 | * Created by xiansong on 2017/4/12. |
| 25 | */ | 27 | */ |
| @@ -34,6 +36,11 @@ public class InputUtil { | @@ -34,6 +36,11 @@ public class InputUtil { | ||
| 34 | private SendCallback mSendCallback; | 36 | private SendCallback mSendCallback; |
| 35 | 37 | ||
| 36 | private Gson mGson; | 38 | private Gson mGson; |
| 39 | + | ||
| 40 | + public InputUtil(Context context) { | ||
| 41 | + mContext = context; | ||
| 42 | + } | ||
| 43 | + | ||
| 37 | public InputUtil(Context context, SendCallback callback) { | 44 | public InputUtil(Context context, SendCallback callback) { |
| 38 | mContext = context; | 45 | mContext = context; |
| 39 | mGson = new Gson(); | 46 | mGson = new Gson(); |
| @@ -66,6 +73,15 @@ public class InputUtil { | @@ -66,6 +73,15 @@ public class InputUtil { | ||
| 66 | if (inputMethodManager.isActive()) { | 73 | if (inputMethodManager.isActive()) { |
| 67 | inputMethodManager.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); | 74 | inputMethodManager.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); |
| 68 | } | 75 | } |
| 76 | + if(sendCommentCallBack!=null){ | ||
| 77 | + if (TextUtils.isEmpty(mMsgEditText.getText())) { | ||
| 78 | + ToastUtil.showToast(mContext, "不能发送空消息呦~"); | ||
| 79 | + } else { | ||
| 80 | + sendCommentCallBack.sendComment(mMsgEditText.getText().toString()); | ||
| 81 | + mMsgEditText.setText(""); | ||
| 82 | + } | ||
| 83 | + if (mInputPopupWindow != null && mInputPopupWindow.isShowing()) mInputPopupWindow.dismiss(); | ||
| 84 | + } | ||
| 69 | sendMessage(); | 85 | sendMessage(); |
| 70 | return true; | 86 | return true; |
| 71 | } | 87 | } |
| @@ -112,11 +128,13 @@ public class InputUtil { | @@ -112,11 +128,13 @@ public class InputUtil { | ||
| 112 | 128 | ||
| 113 | public void sendMessage() { | 129 | public void sendMessage() { |
| 114 | //发送聊天室消息 | 130 | //发送聊天室消息 |
| 115 | - if (TextUtils.isEmpty(mMsgEditText.getText())) { | ||
| 116 | - ToastUtil.showToast(mContext, "不能发送空消息呦~"); | ||
| 117 | - } else { | ||
| 118 | - if(mSendCallback!=null) mSendCallback.sendMessage(mGson.toJson(new CNMessageModle("chatRoom",new MessageInfo("","","","",mMsgEditText.getText().toString())))); | ||
| 119 | - mMsgEditText.setText(""); | 131 | + if(mSendCallback!=null){ |
| 132 | + if (TextUtils.isEmpty(mMsgEditText.getText())) { | ||
| 133 | + ToastUtil.showToast(mContext, "不能发送空消息呦~"); | ||
| 134 | + } else { | ||
| 135 | + mSendCallback.sendMessage(mGson.toJson(new CNMessageModle("chatRoom",new MessageInfo("","","","",mMsgEditText.getText().toString())))); | ||
| 136 | + mMsgEditText.setText(""); | ||
| 137 | + } | ||
| 120 | } | 138 | } |
| 121 | if (mInputPopupWindow != null && mInputPopupWindow.isShowing()) mInputPopupWindow.dismiss(); | 139 | if (mInputPopupWindow != null && mInputPopupWindow.isShowing()) mInputPopupWindow.dismiss(); |
| 122 | } | 140 | } |
| @@ -130,5 +148,13 @@ public class InputUtil { | @@ -130,5 +148,13 @@ public class InputUtil { | ||
| 130 | } | 148 | } |
| 131 | 149 | ||
| 132 | 150 | ||
| 151 | + public interface SendCommentCallBack{ | ||
| 152 | + void sendComment(String s); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + private SendCommentCallBack sendCommentCallBack; | ||
| 156 | + public void setonSendCommentCallBack(SendCommentCallBack sendCommentCallBack){ | ||
| 157 | + this.sendCommentCallBack = sendCommentCallBack; | ||
| 158 | + } | ||
| 133 | 159 | ||
| 134 | } | 160 | } |
app/src/main/java/com/cnlive/gundam/video/adpter/CommentAdapter.java
0 → 100644
| 1 | +package com.cnlive.gundam.video.adpter; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.support.v7.widget.RecyclerView; | ||
| 5 | +import android.view.LayoutInflater; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.view.ViewGroup; | ||
| 8 | +import android.widget.ImageView; | ||
| 9 | +import android.widget.TextView; | ||
| 10 | + | ||
| 11 | +import com.bumptech.glide.Glide; | ||
| 12 | +import com.cnlive.gundam.R; | ||
| 13 | +import com.cnlive.libs.util.model.CommentItem; | ||
| 14 | + | ||
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @author 陈硕 | ||
| 21 | + * @time 2017/6/9 10:56 | ||
| 22 | + * @desc ${TODD} | ||
| 23 | + */ | ||
| 24 | +public class CommentAdapter extends RecyclerView.Adapter<CommentAdapter.CommentHolder> { | ||
| 25 | + | ||
| 26 | + protected List<CommentItem> mItems = new ArrayList<CommentItem>(); | ||
| 27 | + protected OnImageViewClick onImageViewClick; | ||
| 28 | + Context context; | ||
| 29 | + private final LayoutInflater mLayoutInflater; | ||
| 30 | + private CommentHolder commentHolder; | ||
| 31 | + | ||
| 32 | + public CommentAdapter(Context context) { | ||
| 33 | + this.context = context; | ||
| 34 | + mLayoutInflater = LayoutInflater.from(context); | ||
| 35 | + | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void addItems(List<CommentItem> items) { | ||
| 39 | + mItems.addAll(items); | ||
| 40 | + notifyDataSetChanged(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void refreshItems(List<CommentItem> items) { | ||
| 44 | + mItems.clear(); | ||
| 45 | + mItems.addAll(items); | ||
| 46 | + notifyDataSetChanged(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public void clearItems() { | ||
| 50 | + mItems.clear(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public CommentHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 56 | + View view = mLayoutInflater.inflate(R.layout.commet_item, parent, false); | ||
| 57 | + commentHolder = new CommentHolder(view); | ||
| 58 | + return commentHolder; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public void onBindViewHolder(CommentHolder holder, int position) { | ||
| 63 | + | ||
| 64 | + final CommentItem commentItem = mItems.get(position); | ||
| 65 | + Glide.with(context).load(commentItem.getFacepath()).into(commentHolder.img_head); | ||
| 66 | + commentHolder.nick_name.setText(commentItem.getUid()); | ||
| 67 | + commentHolder.comment_message.setText(commentItem.getContent()); | ||
| 68 | + commentHolder.comment_good_count.setText(commentItem.getPraise()); | ||
| 69 | + commentHolder.good_imv1.setOnClickListener(new View.OnClickListener() { | ||
| 70 | + @Override | ||
| 71 | + public void onClick(View v) { | ||
| 72 | + if (onImageViewClick != null) { | ||
| 73 | + onImageViewClick.praiseComment(commentItem); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + }); | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public int getItemCount() { | ||
| 83 | + return mItems.size(); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setOnImageViewClick(OnImageViewClick onImageViewClick) { | ||
| 87 | + this.onImageViewClick = onImageViewClick; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public interface OnImageViewClick { | ||
| 91 | + void praiseComment(CommentItem commentItem); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + class CommentHolder extends RecyclerView.ViewHolder { | ||
| 95 | + | ||
| 96 | + public final TextView nick_name; | ||
| 97 | + public final TextView comment_message; | ||
| 98 | + public final TextView comment_good_count; | ||
| 99 | + public final ImageView good_imv1; | ||
| 100 | + public final ImageView img_head; | ||
| 101 | + | ||
| 102 | + public CommentHolder(View itemView) { | ||
| 103 | + super(itemView); | ||
| 104 | + nick_name = (TextView) itemView.findViewById(R.id.nick_name); | ||
| 105 | + good_imv1 = (ImageView) itemView.findViewById(R.id.good_imv); | ||
| 106 | + comment_message = (TextView) itemView.findViewById(R.id.comment_message); | ||
| 107 | + comment_good_count = (TextView) itemView.findViewById(R.id.comment_good_count); | ||
| 108 | + img_head = (ImageView) itemView.findViewById(R.id.img_head); | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + | ||
| 117 | +} |
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerVodFragment.java
| @@ -46,7 +46,8 @@ public class PlayerVodFragment extends Fragment implements PlayerAccelerometerSe | @@ -46,7 +46,8 @@ public class PlayerVodFragment extends Fragment implements PlayerAccelerometerSe | ||
| 46 | @Override | 46 | @Override |
| 47 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 47 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 48 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_vod, container, false); | 48 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_vod, container, false); |
| 49 | - getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, CommentFragment.newInstance(), "commentFragment").commit(); | 49 | + VideoListProgram program = (VideoListProgram) getArguments().getSerializable("program"); |
| 50 | + getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, CommentFragment.newInstance(program.getvId()+""), "commentFragment").commit(); | ||
| 50 | return binding.getRoot(); | 51 | return binding.getRoot(); |
| 51 | } | 52 | } |
| 52 | 53 |
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.databinding.DataBindingUtil; | ||
| 4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 5 | import android.support.annotation.Nullable; | 4 | import android.support.annotation.Nullable; |
| 6 | import android.support.v4.app.Fragment; | 5 | import android.support.v4.app.Fragment; |
| 7 | -import android.text.TextUtils; | 6 | +import android.support.v7.widget.LinearLayoutManager; |
| 7 | +import android.support.v7.widget.RecyclerView; | ||
| 8 | +import android.util.Log; | ||
| 8 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 10 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 11 | import android.view.ViewGroup; |
| 12 | +import android.widget.TextView; | ||
| 11 | import android.widget.Toast; | 13 | import android.widget.Toast; |
| 12 | 14 | ||
| 13 | import com.cnlive.gundam.R; | 15 | import com.cnlive.gundam.R; |
| 14 | -import com.cnlive.gundam.databinding.FragmentCommentsBinding; | ||
| 15 | import com.cnlive.gundam.user.auth.UserService; | 16 | import com.cnlive.gundam.user.auth.UserService; |
| 17 | +import com.cnlive.gundam.user.util.InputUtil; | ||
| 18 | +import com.cnlive.gundam.video.adpter.CommentAdapter; | ||
| 16 | import com.cnlive.libs.util.chat.model.ErrorMessage; | 19 | import com.cnlive.libs.util.chat.model.ErrorMessage; |
| 17 | import com.cnlive.libs.util.comment.CommentUtil; | 20 | import com.cnlive.libs.util.comment.CommentUtil; |
| 18 | import com.cnlive.libs.util.comment.base.CommentCallback; | 21 | import com.cnlive.libs.util.comment.base.CommentCallback; |
| 22 | +import com.cnlive.libs.util.comment.base.CommentListCallback; | ||
| 23 | +import com.cnlive.libs.util.comment.base.CommentProgramCallback; | ||
| 24 | +import com.cnlive.libs.util.model.CommentItem; | ||
| 25 | +import com.cnlive.libs.util.model.CommentPage; | ||
| 26 | +import com.cnlive.libs.util.model.CommentProgram; | ||
| 27 | + | ||
| 28 | +import java.util.List; | ||
| 19 | 29 | ||
| 20 | /** | 30 | /** |
| 21 | * @author 陈硕 | 31 | * @author 陈硕 |
| 22 | * @time 2017/6/29 19:44 | 32 | * @time 2017/6/29 19:44 |
| 23 | * @desc ${TODD} | 33 | * @desc ${TODD} |
| 24 | */ | 34 | */ |
| 25 | -public class CommentFragment extends Fragment { | 35 | +public class CommentFragment extends Fragment implements View.OnClickListener, CommentAdapter.OnImageViewClick ,InputUtil.SendCommentCallBack{ |
| 26 | 36 | ||
| 27 | 37 | ||
| 28 | - private FragmentCommentsBinding fragmentCommentsBinding; | ||
| 29 | - private CommentUtil commentUtil; | ||
| 30 | - private String programID; | 38 | + private View inflate; |
| 39 | + private InputUtil inputUtil; | ||
| 40 | + | ||
| 41 | + public static CommentFragment newInstance(String programID) { | ||
| 31 | 42 | ||
| 32 | - public static CommentFragment newInstance() { | ||
| 33 | Bundle args = new Bundle(); | 43 | Bundle args = new Bundle(); |
| 34 | CommentFragment fragment = new CommentFragment(); | 44 | CommentFragment fragment = new CommentFragment(); |
| 45 | + args.putString("programID",programID); | ||
| 35 | fragment.setArguments(args); | 46 | fragment.setArguments(args); |
| 36 | return fragment; | 47 | return fragment; |
| 37 | } | 48 | } |
| 38 | 49 | ||
| 39 | - public void setProgramID(String programID) { | ||
| 40 | - this.programID = programID; | ||
| 41 | - } | 50 | + |
| 51 | + private TextView edit_comment; | ||
| 52 | + private CommentUtil commentUtil; | ||
| 53 | + private CommentAdapter commentAdapter; | ||
| 54 | + private RecyclerView recyclerView; | ||
| 55 | + private String programID = "123"; | ||
| 56 | + private String userID; | ||
| 42 | 57 | ||
| 43 | @Nullable | 58 | @Nullable |
| 44 | @Override | 59 | @Override |
| 45 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 60 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 46 | - fragmentCommentsBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_comments, container, false); | ||
| 47 | - return fragmentCommentsBinding.getRoot(); | 61 | + |
| 62 | + inflate = inflater.inflate(R.layout.fragment_comments, container, false); | ||
| 63 | + return inflate; | ||
| 48 | } | 64 | } |
| 49 | 65 | ||
| 50 | @Override | 66 | @Override |
| 51 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 67 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 52 | super.onViewCreated(view, savedInstanceState); | 68 | super.onViewCreated(view, savedInstanceState); |
| 53 | - intUI(); | ||
| 54 | - | 69 | + initDate(); |
| 70 | + initUI(); | ||
| 71 | + } | ||
| 55 | 72 | ||
| 73 | + private void initDate() { | ||
| 74 | + inputUtil = new InputUtil(getActivity()); | ||
| 75 | + inputUtil.setonSendCommentCallBack(this); | ||
| 76 | + int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); | ||
| 77 | + userID=uid +""; | ||
| 56 | } | 78 | } |
| 57 | 79 | ||
| 58 | - private void intUI() { | ||
| 59 | 80 | ||
| 81 | + private void initUI() { | ||
| 82 | + | ||
| 83 | + programID= getArguments().getString("programID"); | ||
| 84 | + commentAdapter = new CommentAdapter(getActivity()); | ||
| 85 | + recyclerView = (RecyclerView) getActivity().findViewById(R.id.comment_content); | ||
| 86 | + recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
| 87 | + edit_comment = (TextView) getActivity().findViewById(R.id.input); | ||
| 88 | + edit_comment.setOnClickListener(this); | ||
| 89 | + | ||
| 90 | + commentAdapter.setOnImageViewClick(this); | ||
| 91 | + intiDate(); | ||
| 92 | + | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + private void intiDate() { | ||
| 60 | if (commentUtil == null) { | 96 | if (commentUtil == null) { |
| 61 | commentUtil = new CommentUtil(); | 97 | commentUtil = new CommentUtil(); |
| 62 | } | 98 | } |
| 63 | - fragmentCommentsBinding.sendBtnComment.setOnClickListener(new View.OnClickListener() { | 99 | + getCommentProgram(); |
| 100 | + getCommentMesaage(); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + @Override | ||
| 105 | + public void onClick(View v) { | ||
| 106 | + switch (v.getId()) { | ||
| 107 | + case R.id.input : | ||
| 108 | + inputUtil.showInput(v); | ||
| 109 | + break; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + public void getCommentMesaage() { | ||
| 117 | + commentUtil.readAllComment(programID, 1, 10, new CommentListCallback() { | ||
| 64 | @Override | 118 | @Override |
| 65 | - public void onClick(View view) { | ||
| 66 | - checkUserInfo(); | 119 | + public void onResponse(CommentPage commentPage) { |
| 120 | + if (commentPage.getData() != null) { | ||
| 121 | + Log.v("commentPage", commentPage.getErrorMessage() + ""); | ||
| 122 | + List<CommentItem> comments = commentPage.getData().getComments(); | ||
| 123 | + if(comments==null)return; | ||
| 124 | + recyclerView.setAdapter(commentAdapter); | ||
| 125 | + commentAdapter.addItems(comments); | ||
| 67 | 126 | ||
| 127 | + | ||
| 128 | + } | ||
| 68 | } | 129 | } |
| 130 | + }); | ||
| 131 | + } | ||
| 69 | 132 | ||
| 133 | + public void getCommentProgram() { | ||
| 134 | + commentUtil.programComment(programID, new CommentProgramCallback() { | ||
| 135 | + @Override | ||
| 136 | + public void onResponse(CommentProgram commentProgram) { | ||
| 137 | + Log.v("commentProgram", commentProgram.getData().getComments().size() + ""); | ||
| 70 | 138 | ||
| 139 | + } | ||
| 71 | }); | 140 | }); |
| 72 | } | 141 | } |
| 73 | 142 | ||
| 143 | + @Override | ||
| 144 | + public void praiseComment(CommentItem commentItem) { | ||
| 145 | + commentUtil.praiseComment(programID, userID, commentItem.getId(), new CommentCallback() { | ||
| 146 | + @Override | ||
| 147 | + public void onResponse(ErrorMessage errorMessage) { | ||
| 148 | + if (errorMessage != null && errorMessage.getErrorCode().equals("0")) { | ||
| 149 | + Toast.makeText(getActivity(), "点赞成功", Toast.LENGTH_SHORT).show(); | ||
| 150 | + commentAdapter.clearItems(); | ||
| 151 | + getCommentMesaage(); | ||
| 152 | + } else Toast.makeText(getActivity(), "点赞失败", Toast.LENGTH_SHORT).show(); | ||
| 74 | 153 | ||
| 75 | - private void checkUserInfo() { | ||
| 76 | - int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); | ||
| 77 | - if (uid == 0) { | ||
| 78 | - Toast.makeText(getActivity(), "请先登录", Toast.LENGTH_SHORT).show(); | ||
| 79 | - | ||
| 80 | - }else commentProgram(); | 154 | + } |
| 155 | + }); | ||
| 81 | } | 156 | } |
| 82 | 157 | ||
| 83 | 158 | ||
| 84 | - private void commentProgram() { | ||
| 85 | - if (TextUtils.isEmpty(fragmentCommentsBinding.commentEdit.getText())) { | ||
| 86 | - Toast.makeText(getActivity(), "输入内容不能为空", Toast.LENGTH_SHORT).show(); | ||
| 87 | - } else { | ||
| 88 | - commentUtil.insertComment(programID, UserService.getInstance(getActivity()).getActiveAccountInfo().getUid() + "", String.valueOf(fragmentCommentsBinding.commentEdit.getText()), new CommentCallback() { | ||
| 89 | - @Override | ||
| 90 | - public void onResponse(ErrorMessage errorMessage) { | ||
| 91 | - if (errorMessage != null && errorMessage.getErrorCode().equals("0")) { | ||
| 92 | - Toast.makeText(getActivity(), "评论成功", Toast.LENGTH_SHORT).show(); | ||
| 93 | - fragmentCommentsBinding.commentEdit.setText(""); | ||
| 94 | - } else Toast.makeText(getActivity(), "评论失败", Toast.LENGTH_SHORT).show(); | 159 | + @Override |
| 160 | + public void sendComment(String s) { | ||
| 161 | + commentUtil.insertComment(programID, userID, s, new CommentCallback() { | ||
| 162 | + @Override | ||
| 163 | + public void onResponse(ErrorMessage errorMessage) { | ||
| 164 | + if (errorMessage != null && errorMessage.getErrorCode().equals("0")) { | ||
| 165 | + Toast.makeText(getActivity(), "评论成功", Toast.LENGTH_SHORT).show(); | ||
| 166 | + edit_comment.setText(""); | ||
| 167 | + commentAdapter.clearItems(); | ||
| 168 | + getCommentMesaage(); | ||
| 169 | + } else Toast.makeText(getActivity(), "评论失败", Toast.LENGTH_SHORT).show(); | ||
| 95 | 170 | ||
| 96 | - } | ||
| 97 | - }); | ||
| 98 | - } | 171 | + } |
| 172 | + }); | ||
| 99 | } | 173 | } |
| 100 | } | 174 | } |
app/src/main/res/layout/commet_item.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:layout_width="match_parent" | ||
| 4 | + android:layout_height="wrap_content" | ||
| 5 | + android:orientation="vertical" | ||
| 6 | + > | ||
| 7 | + | ||
| 8 | + <RelativeLayout | ||
| 9 | + android:layout_width="match_parent" | ||
| 10 | + android:layout_height="wrap_content"> | ||
| 11 | + | ||
| 12 | + <com.cnlive.gundam.user.view.CircleImageView | ||
| 13 | + android:id="@+id/img_head" | ||
| 14 | + android:layout_width="30dp" | ||
| 15 | + android:layout_height="30dp" | ||
| 16 | + android:layout_centerVertical="true" | ||
| 17 | + android:layout_marginLeft="5dp" | ||
| 18 | + android:src="@mipmap/ic_launcher" /> | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + <TextView | ||
| 22 | + android:id="@+id/nick_name" | ||
| 23 | + android:layout_width="wrap_content" | ||
| 24 | + android:layout_height="wrap_content" | ||
| 25 | + android:layout_centerVertical="true" | ||
| 26 | + android:layout_toRightOf="@+id/img_head" | ||
| 27 | + android:layout_marginLeft="10dp" | ||
| 28 | + android:text="游客" /> | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + <ImageView | ||
| 32 | + android:id="@+id/good_imv" | ||
| 33 | + android:layout_width="24dp" | ||
| 34 | + android:layout_height="24dp" | ||
| 35 | + android:layout_centerVertical="true" | ||
| 36 | + android:layout_marginLeft="5dp" | ||
| 37 | + android:layout_toLeftOf="@+id/comment_good_count" | ||
| 38 | + android:clickable="true" | ||
| 39 | + android:src="@drawable/vod_detail_good" /> | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + <TextView | ||
| 43 | + android:id="@+id/comment_good_count" | ||
| 44 | + android:layout_width="wrap_content" | ||
| 45 | + android:layout_height="wrap_content" | ||
| 46 | + android:layout_alignParentRight="true" | ||
| 47 | + android:layout_centerVertical="true" | ||
| 48 | + android:layout_marginLeft="10dp" | ||
| 49 | + android:layout_marginRight="10dp" | ||
| 50 | + android:text="10" /> | ||
| 51 | + | ||
| 52 | + </RelativeLayout> | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + <TextView | ||
| 56 | + android:id="@+id/comment_message" | ||
| 57 | + android:layout_width="wrap_content" | ||
| 58 | + android:layout_height="wrap_content" | ||
| 59 | + android:layout_marginTop="5dp" | ||
| 60 | + android:paddingTop="5dp" | ||
| 61 | + android:layout_marginLeft="10dp" | ||
| 62 | + android:layout_marginRight="10dp" | ||
| 63 | + android:text="我爱大中国" /> | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + <View | ||
| 67 | + android:layout_width="match_parent" | ||
| 68 | + android:layout_height="1px" | ||
| 69 | + android:layout_marginTop="5dp" | ||
| 70 | + android:background="#dcdcdc" /> | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + | ||
| 74 | +</LinearLayout> | ||
| 0 | \ No newline at end of file | 75 | \ No newline at end of file |
app/src/main/res/layout/fragment_active_list.xml
| @@ -2,8 +2,10 @@ | @@ -2,8 +2,10 @@ | ||
| 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> | 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| 3 | 3 | ||
| 4 | <data> | 4 | <data> |
| 5 | - <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter"/> | ||
| 6 | - <import type="android.support.v7.widget.LinearLayoutManager"/> | 5 | + |
| 6 | + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter" /> | ||
| 7 | + | ||
| 8 | + <import type="android.support.v7.widget.LinearLayoutManager" /> | ||
| 7 | 9 | ||
| 8 | <variable | 10 | <variable |
| 9 | name="layoutManager" | 11 | name="layoutManager" |
| @@ -24,12 +26,42 @@ | @@ -24,12 +26,42 @@ | ||
| 24 | android:layout_width="match_parent" | 26 | android:layout_width="match_parent" |
| 25 | android:layout_height="match_parent"> | 27 | android:layout_height="match_parent"> |
| 26 | 28 | ||
| 27 | - <android.support.v7.widget.RecyclerView | ||
| 28 | - android:id="@+id/recyclerView" | 29 | + <RelativeLayout |
| 29 | android:layout_width="match_parent" | 30 | android:layout_width="match_parent" |
| 30 | - android:layout_height="match_parent" | ||
| 31 | - app:adapter="@{listAdapter}" | ||
| 32 | - app:layoutManager="@{layoutManager}"/> | 31 | + android:layout_height="match_parent"> |
| 32 | + | ||
| 33 | + <RelativeLayout | ||
| 34 | + android:id="@+id/toobar" | ||
| 35 | + android:layout_width="match_parent" | ||
| 36 | + android:layout_height="wrap_content"> | ||
| 37 | + | ||
| 38 | + <TextView | ||
| 39 | + android:id="@+id/toobar_tv" | ||
| 40 | + android:layout_width="wrap_content" | ||
| 41 | + android:layout_height="wrap_content" | ||
| 42 | + android:layout_centerInParent="true" | ||
| 43 | + android:singleLine="true" | ||
| 44 | + android:text="直播" | ||
| 45 | + android:textColor="@color/config_black_color" | ||
| 46 | + android:textSize="22sp" /> | ||
| 47 | + | ||
| 48 | + <View | ||
| 49 | + android:layout_width="match_parent" | ||
| 50 | + android:layout_height="1px" | ||
| 51 | + android:layout_marginBottom="@dimen/_20px" | ||
| 52 | + android:background="@color/gray_line_color" /> | ||
| 53 | + </RelativeLayout> | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + <android.support.v7.widget.RecyclerView | ||
| 57 | + android:id="@+id/recyclerView" | ||
| 58 | + android:layout_width="match_parent" | ||
| 59 | + android:layout_height="match_parent" | ||
| 60 | + android:layout_below="@+id/toobar" | ||
| 61 | + app:adapter="@{listAdapter}" | ||
| 62 | + app:layoutManager="@{layoutManager}" /> | ||
| 63 | + </RelativeLayout> | ||
| 64 | + | ||
| 33 | 65 | ||
| 34 | </android.support.v4.widget.SwipeRefreshLayout> | 66 | </android.support.v4.widget.SwipeRefreshLayout> |
| 35 | 67 |
app/src/main/res/layout/fragment_comments.xml
| @@ -11,29 +11,26 @@ | @@ -11,29 +11,26 @@ | ||
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | android:layout_height="wrap_content"> | 12 | android:layout_height="wrap_content"> |
| 13 | 13 | ||
| 14 | - <Button | ||
| 15 | - android:id="@+id/sendBtn_comment" | ||
| 16 | - android:layout_width="wrap_content" | ||
| 17 | - android:layout_height="wrap_content" | ||
| 18 | - android:layout_alignParentRight="true" | ||
| 19 | - android:text="发送" /> | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - <EditText | ||
| 23 | - android:id="@+id/comment_edit" | 14 | + <TextView |
| 15 | + android:id="@+id/input" | ||
| 24 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 25 | - android:layout_height="29dp" | ||
| 26 | - android:layout_centerVertical="true" | ||
| 27 | - android:layout_toLeftOf="@+id/sendBtn_comment" | ||
| 28 | - android:background="@drawable/comment_edittet" | ||
| 29 | - android:drawablePadding="8dp" | ||
| 30 | - android:hint="评论内容" | ||
| 31 | - android:imeOptions="actionGo" | ||
| 32 | - android:singleLine="true" | ||
| 33 | - android:textColor="@android:color/white" | ||
| 34 | - android:textColorHint="@android:color/black" | 17 | + android:layout_height="36dp" |
| 18 | + android:layout_marginLeft="10dp" | ||
| 19 | + android:layout_marginRight="10dp" | ||
| 20 | + android:background="@drawable/btn_input" | ||
| 21 | + android:gravity="center" | ||
| 22 | + android:text="@string/input_button_text" | ||
| 35 | android:textSize="12sp" /> | 23 | android:textSize="12sp" /> |
| 36 | 24 | ||
| 25 | + <android.support.v7.widget.RecyclerView | ||
| 26 | + android:layout_below="@+id/input" | ||
| 27 | + android:layout_marginTop="@dimen/_20px" | ||
| 28 | + android:id="@+id/comment_content" | ||
| 29 | + android:layout_width="match_parent" | ||
| 30 | + android:layout_height="match_parent"> | ||
| 31 | + </android.support.v7.widget.RecyclerView> | ||
| 32 | + | ||
| 33 | + | ||
| 37 | </RelativeLayout> | 34 | </RelativeLayout> |
| 38 | 35 | ||
| 39 | </layout> | 36 | </layout> |
| 40 | \ No newline at end of file | 37 | \ No newline at end of file |
app/src/main/res/layout/fragment_item_bar.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:layout_width="match_parent" | ||
| 4 | + android:layout_height="wrap_content" | ||
| 5 | + android:orientation="vertical"> | ||
| 6 | + | ||
| 7 | + | ||
| 8 | + <RelativeLayout | ||
| 9 | + android:layout_width="match_parent" | ||
| 10 | + android:layout_height="48dp"> | ||
| 11 | + | ||
| 12 | + <TextView | ||
| 13 | + android:id="@+id/toobar_tv" | ||
| 14 | + android:layout_width="wrap_content" | ||
| 15 | + android:layout_height="wrap_content" | ||
| 16 | + android:layout_centerInParent="true" | ||
| 17 | + android:singleLine="true" | ||
| 18 | + android:text="我的" | ||
| 19 | + android:textColor="@color/config_black_color" | ||
| 20 | + android:textSize="22sp" /> | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + </RelativeLayout> | ||
| 24 | + | ||
| 25 | + <View | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="1px" | ||
| 28 | + android:background="@color/gray_line_color" /> | ||
| 29 | + | ||
| 30 | + </LinearLayout> | ||
| 0 | \ No newline at end of file | 31 | \ No newline at end of file |
app/src/main/res/layout/fragment_live.xml
| @@ -21,10 +21,33 @@ | @@ -21,10 +21,33 @@ | ||
| 21 | android:layout_width="match_parent" | 21 | android:layout_width="match_parent" |
| 22 | android:layout_height="match_parent"> | 22 | android:layout_height="match_parent"> |
| 23 | 23 | ||
| 24 | + <RelativeLayout | ||
| 25 | + android:id="@+id/toobar" | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="wrap_content"> | ||
| 28 | + | ||
| 29 | + <TextView | ||
| 30 | + android:id="@+id/toobar_tv" | ||
| 31 | + android:layout_width="wrap_content" | ||
| 32 | + android:layout_height="wrap_content" | ||
| 33 | + android:layout_centerInParent="true" | ||
| 34 | + android:singleLine="true" | ||
| 35 | + android:text="电视台" | ||
| 36 | + android:textColor="@color/config_black_color" | ||
| 37 | + android:textSize="22sp" /> | ||
| 38 | + | ||
| 39 | + <View | ||
| 40 | + android:layout_width="match_parent" | ||
| 41 | + android:layout_height="1px" | ||
| 42 | + android:layout_marginBottom="@dimen/_20px" | ||
| 43 | + android:background="@color/gray_line_color" /> | ||
| 44 | + </RelativeLayout> | ||
| 45 | + | ||
| 24 | <android.support.v7.widget.RecyclerView | 46 | <android.support.v7.widget.RecyclerView |
| 25 | android:id="@+id/recyclerView" | 47 | android:id="@+id/recyclerView" |
| 26 | android:layout_width="match_parent" | 48 | android:layout_width="match_parent" |
| 27 | android:layout_height="match_parent" | 49 | android:layout_height="match_parent" |
| 50 | + android:layout_below="@+id/toobar" | ||
| 28 | app:adapter="@{listAdapter}" | 51 | app:adapter="@{listAdapter}" |
| 29 | app:layoutManager="@{layoutManager}"/> | 52 | app:layoutManager="@{layoutManager}"/> |
| 30 | 53 |
app/src/main/res/layout/fragment_player_vod.xml
| @@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
| 15 | android:layout_height="wrap_content" /> | 15 | android:layout_height="wrap_content" /> |
| 16 | <RelativeLayout | 16 | <RelativeLayout |
| 17 | android:id="@+id/contentLayout" | 17 | android:id="@+id/contentLayout" |
| 18 | + android:layout_below="@+id/videoView" | ||
| 18 | android:background="@android:color/black" | 19 | android:background="@android:color/black" |
| 19 | android:layout_width="match_parent" | 20 | android:layout_width="match_parent" |
| 20 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
app/src/main/res/layout/user_fragment.xml
| @@ -10,10 +10,12 @@ | @@ -10,10 +10,12 @@ | ||
| 10 | android:orientation="vertical"> | 10 | android:orientation="vertical"> |
| 11 | 11 | ||
| 12 | <RelativeLayout | 12 | <RelativeLayout |
| 13 | + android:id="@+id/toobar" | ||
| 13 | android:layout_width="match_parent" | 14 | android:layout_width="match_parent" |
| 14 | - android:layout_height="48dp"> | 15 | + android:layout_height="wrap_content"> |
| 15 | 16 | ||
| 16 | <TextView | 17 | <TextView |
| 18 | + android:id="@+id/toobar_tv" | ||
| 17 | android:layout_width="wrap_content" | 19 | android:layout_width="wrap_content" |
| 18 | android:layout_height="wrap_content" | 20 | android:layout_height="wrap_content" |
| 19 | android:layout_centerInParent="true" | 21 | android:layout_centerInParent="true" |
| @@ -22,15 +24,13 @@ | @@ -22,15 +24,13 @@ | ||
| 22 | android:textColor="@color/config_black_color" | 24 | android:textColor="@color/config_black_color" |
| 23 | android:textSize="22sp" /> | 25 | android:textSize="22sp" /> |
| 24 | 26 | ||
| 25 | - | 27 | + <View |
| 28 | + android:layout_width="match_parent" | ||
| 29 | + android:layout_height="1px" | ||
| 30 | + android:layout_marginBottom="@dimen/_20px" | ||
| 31 | + android:background="@color/gray_line_color" /> | ||
| 26 | </RelativeLayout> | 32 | </RelativeLayout> |
| 27 | 33 | ||
| 28 | - <View | ||
| 29 | - android:layout_width="match_parent" | ||
| 30 | - android:layout_height="1px" | ||
| 31 | - android:layout_marginBottom="@dimen/_20px" | ||
| 32 | - android:background="@color/gray_line_color" /> | ||
| 33 | - | ||
| 34 | 34 | ||
| 35 | <RelativeLayout | 35 | <RelativeLayout |
| 36 | android:id="@+id/config_header" | 36 | android:id="@+id/config_header" |
user/src/main/res/drawable-hdpi/vod_detail_good_off.png
0 → 100644
2.01 KB
user/src/main/res/drawable-hdpi/vod_detail_good_on.png
0 → 100644
1.94 KB
user/src/main/res/drawable-xhdpi/btn_input.png
0 → 100644
1 KB
user/src/main/res/drawable/vod_detail_good.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <item android:state_pressed="true" android:drawable="@drawable/vod_detail_good_on" /> | ||
| 4 | + <item android:state_pressed="false" android:drawable="@drawable/vod_detail_good_off" /> | ||
| 5 | +</selector> | ||
| 0 | \ No newline at end of file | 6 | \ No newline at end of file |
user/src/main/res/values/strings.xml
| @@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
| 39 | <string name="ACCOUNT_TYPE">com.cnlive.gundam.AccountType</string> | 39 | <string name="ACCOUNT_TYPE">com.cnlive.gundam.AccountType</string> |
| 40 | <string name="ACCOUNT_LABEL">@string/app_name</string> | 40 | <string name="ACCOUNT_LABEL">@string/app_name</string> |
| 41 | 41 | ||
| 42 | - | 42 | + <string name="input_button_text">我来说两句.....</string> |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | 45 |