Commit 8d0f048728203877e30f8185bdba63878cad1d72
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/CNLiveApp
Showing
26 changed files
with
495 additions
and
105 deletions
app/src/main/AndroidManifest.xml
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | <activity |
| 44 | 44 | android:name=".main.ui.activity.MainActivity" |
| 45 | 45 | android:label="@string/app_name" |
| 46 | - android:configChanges="keyboardHidden|screenSize|orientation"> | |
| 46 | + android:screenOrientation="portrait"> | |
| 47 | 47 | <intent-filter> |
| 48 | 48 | <action android:name="android.intent.action.MAIN" /> |
| 49 | 49 | ... | ... |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
| ... | ... | @@ -8,6 +8,7 @@ import android.support.v4.app.Fragment; |
| 8 | 8 | import android.view.LayoutInflater; |
| 9 | 9 | import android.view.View; |
| 10 | 10 | import android.view.ViewGroup; |
| 11 | +import android.widget.TextView; | |
| 11 | 12 | |
| 12 | 13 | import com.bumptech.glide.Glide; |
| 13 | 14 | import com.cnlive.gundam.R; |
| ... | ... | @@ -19,6 +20,7 @@ import com.cnlive.gundam.user.auth.UserService; |
| 19 | 20 | import com.cnlive.gundam.user.model.User; |
| 20 | 21 | |
| 21 | 22 | |
| 23 | + | |
| 22 | 24 | /** |
| 23 | 25 | * Created by xiansong on 2017/6/27. |
| 24 | 26 | */ |
| ... | ... | @@ -47,6 +49,8 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | private void initUI() { |
| 52 | + TextView titleText = binding.getRoot().findViewById(R.id.toobar_tv); | |
| 53 | + if (titleText != null) titleText.setText("我 的"); | |
| 50 | 54 | binding.configHeader.setOnClickListener(this); |
| 51 | 55 | binding.message.setOnClickListener(this); |
| 52 | 56 | } | ... | ... |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/HomeFragment.java
| ... | ... | @@ -9,6 +9,7 @@ import android.support.v7.widget.LinearLayoutManager; |
| 9 | 9 | import android.view.LayoutInflater; |
| 10 | 10 | import android.view.View; |
| 11 | 11 | import android.view.ViewGroup; |
| 12 | +import android.widget.TextView; | |
| 12 | 13 | import android.widget.Toast; |
| 13 | 14 | |
| 14 | 15 | import com.cnlive.gundam.BR; |
| ... | ... | @@ -60,6 +61,8 @@ public class HomeFragment extends Fragment implements SwipeRefreshLayout.OnRefre |
| 60 | 61 | @Override |
| 61 | 62 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 62 | 63 | super.onViewCreated(view, savedInstanceState); |
| 64 | + TextView titleText = binding.getRoot().findViewById(R.id.toobar_tv); | |
| 65 | + if (titleText != null) titleText.setText("点播列表"); | |
| 63 | 66 | loadData(); |
| 64 | 67 | } |
| 65 | 68 | ... | ... |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/LiveFragment.java
| ... | ... | @@ -8,6 +8,7 @@ import android.support.v7.widget.LinearLayoutManager; |
| 8 | 8 | import android.view.LayoutInflater; |
| 9 | 9 | import android.view.View; |
| 10 | 10 | import android.view.ViewGroup; |
| 11 | +import android.widget.TextView; | |
| 11 | 12 | |
| 12 | 13 | import com.cnlive.gundam.BR; |
| 13 | 14 | import com.cnlive.gundam.R; |
| ... | ... | @@ -42,6 +43,8 @@ public class LiveFragment extends Fragment implements DataBindingAdapter.OnAdapt |
| 42 | 43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 43 | 44 | super.onViewCreated(view, savedInstanceState); |
| 44 | 45 | initData(); |
| 46 | + TextView titleText = binding.getRoot().findViewById(R.id.toobar_tv); | |
| 47 | + if (titleText != null) titleText.setText("直播列表"); | |
| 45 | 48 | binding.setListAdapter(adapter = new DataBindingAdapter(getActivity(), R.layout.layout_item_video_list, BR.program)); |
| 46 | 49 | binding.setLayoutManager(new LinearLayoutManager(getActivity())); |
| 47 | 50 | adapter.updateItems(programs); | ... | ... |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/UGCListFragment.java
| ... | ... | @@ -9,6 +9,7 @@ import android.support.v7.widget.LinearLayoutManager; |
| 9 | 9 | import android.view.LayoutInflater; |
| 10 | 10 | import android.view.View; |
| 11 | 11 | import android.view.ViewGroup; |
| 12 | +import android.widget.TextView; | |
| 12 | 13 | import android.widget.Toast; |
| 13 | 14 | |
| 14 | 15 | import com.cnlive.gundam.BR; |
| ... | ... | @@ -60,6 +61,8 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe |
| 60 | 61 | @Override |
| 61 | 62 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 62 | 63 | super.onViewCreated(view, savedInstanceState); |
| 64 | + TextView titleText = binding.getRoot().findViewById(R.id.toobar_tv); | |
| 65 | + if (titleText != null) titleText.setText("ugc列表"); | |
| 63 | 66 | loadData(); |
| 64 | 67 | } |
| 65 | 68 | ... | ... |
app/src/main/java/com/cnlive/gundam/user/util/InputUtil.java
| ... | ... | @@ -20,6 +20,8 @@ import com.cnlive.gundam.video.model.CNMessageModle; |
| 20 | 20 | import com.cnlive.gundam.video.model.MessageInfo; |
| 21 | 21 | import com.google.gson.Gson; |
| 22 | 22 | |
| 23 | + | |
| 24 | + | |
| 23 | 25 | /** |
| 24 | 26 | * Created by xiansong on 2017/4/12. |
| 25 | 27 | */ |
| ... | ... | @@ -34,6 +36,11 @@ public class InputUtil { |
| 34 | 36 | private SendCallback mSendCallback; |
| 35 | 37 | |
| 36 | 38 | private Gson mGson; |
| 39 | + | |
| 40 | + public InputUtil(Context context) { | |
| 41 | + mContext = context; | |
| 42 | + } | |
| 43 | + | |
| 37 | 44 | public InputUtil(Context context, SendCallback callback) { |
| 38 | 45 | mContext = context; |
| 39 | 46 | mGson = new Gson(); |
| ... | ... | @@ -66,6 +73,15 @@ public class InputUtil { |
| 66 | 73 | if (inputMethodManager.isActive()) { |
| 67 | 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 | 85 | sendMessage(); |
| 70 | 86 | return true; |
| 71 | 87 | } |
| ... | ... | @@ -112,11 +128,13 @@ public class InputUtil { |
| 112 | 128 | |
| 113 | 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 | 139 | if (mInputPopupWindow != null && mInputPopupWindow.isShowing()) mInputPopupWindow.dismiss(); |
| 122 | 140 | } |
| ... | ... | @@ -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 | 46 | @Override |
| 47 | 47 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 48 | 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 | 51 | return binding.getRoot(); |
| 51 | 52 | } |
| 52 | 53 | ... | ... |
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.databinding.DataBindingUtil; | |
| 4 | 3 | import android.os.Bundle; |
| 5 | 4 | import android.support.annotation.Nullable; |
| 6 | 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 | 9 | import android.view.LayoutInflater; |
| 9 | 10 | import android.view.View; |
| 10 | 11 | import android.view.ViewGroup; |
| 12 | +import android.widget.TextView; | |
| 11 | 13 | import android.widget.Toast; |
| 12 | 14 | |
| 13 | 15 | import com.cnlive.gundam.R; |
| 14 | -import com.cnlive.gundam.databinding.FragmentCommentsBinding; | |
| 15 | 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 | 19 | import com.cnlive.libs.util.chat.model.ErrorMessage; |
| 17 | 20 | import com.cnlive.libs.util.comment.CommentUtil; |
| 18 | 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 | 31 | * @author 陈硕 |
| 22 | 32 | * @time 2017/6/29 19:44 |
| 23 | 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 | 43 | Bundle args = new Bundle(); |
| 34 | 44 | CommentFragment fragment = new CommentFragment(); |
| 45 | + args.putString("programID",programID); | |
| 35 | 46 | fragment.setArguments(args); |
| 36 | 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 | 58 | @Nullable |
| 44 | 59 | @Override |
| 45 | 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 | 66 | @Override |
| 51 | 67 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 52 | 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 | 96 | if (commentUtil == null) { |
| 61 | 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 | 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/java/com/cnlive/gundam/video/view/BaseVideoView.java
| ... | ... | @@ -49,7 +49,7 @@ public abstract class BaseVideoView extends RelativeLayout implements |
| 49 | 49 | protected static boolean isLive; |
| 50 | 50 | //记录当前视频是否能播 |
| 51 | 51 | protected boolean canPlay = true; |
| 52 | - //记录当前视频状态是否结束 | |
| 52 | + //记录当前视频状态是否结束,结束后就不再播 | |
| 53 | 53 | protected boolean isStatusEnd = false; |
| 54 | 54 | //本地缓存数据工具类 |
| 55 | 55 | private SharedPreferencesHelper sharedPreferencesHelper; |
| ... | ... | @@ -328,11 +328,13 @@ public abstract class BaseVideoView extends RelativeLayout implements |
| 328 | 328 | break; |
| 329 | 329 | case IVideoStatus.MEDIA_STATUS_END: |
| 330 | 330 | //直播结束 |
| 331 | - canPlay = false; | |
| 332 | - isPlay = false; | |
| 333 | - isStatusEnd = true; | |
| 334 | - binding.videoView.release(); | |
| 335 | - binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_end)); | |
| 331 | + if (!isStatusEnd) { | |
| 332 | + canPlay = false; | |
| 333 | + isPlay = false; | |
| 334 | + isStatusEnd = true; | |
| 335 | + binding.videoView.release(); | |
| 336 | + binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_end)); | |
| 337 | + } | |
| 336 | 338 | break; |
| 337 | 339 | } |
| 338 | 340 | ... | ... |
app/src/main/res/drawable-xxhdpi/toolbar_bg.9.png
0 → 100644
94 Bytes
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 | 75 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_active_list.xml
| ... | ... | @@ -2,8 +2,10 @@ |
| 2 | 2 | xmlns:app="http://schemas.android.com/apk/res-auto"> |
| 3 | 3 | |
| 4 | 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 | 10 | <variable |
| 9 | 11 | name="layoutManager" |
| ... | ... | @@ -19,17 +21,29 @@ |
| 19 | 21 | android:layout_height="match_parent" |
| 20 | 22 | android:fitsSystemWindows="true"> |
| 21 | 23 | |
| 24 | + | |
| 22 | 25 | <android.support.v4.widget.SwipeRefreshLayout |
| 23 | 26 | android:id="@+id/contentView" |
| 24 | 27 | android:layout_width="match_parent" |
| 25 | 28 | android:layout_height="match_parent"> |
| 26 | 29 | |
| 27 | - <android.support.v7.widget.RecyclerView | |
| 28 | - android:id="@+id/recyclerView" | |
| 30 | + <RelativeLayout | |
| 29 | 31 | android:layout_width="match_parent" |
| 30 | - android:layout_height="match_parent" | |
| 31 | - app:adapter="@{listAdapter}" | |
| 32 | - app:layoutManager="@{layoutManager}"/> | |
| 32 | + android:layout_height="match_parent"> | |
| 33 | + | |
| 34 | + <include | |
| 35 | + android:id="@+id/toobar" | |
| 36 | + layout="@layout/item_toolbar" /> | |
| 37 | + | |
| 38 | + <android.support.v7.widget.RecyclerView | |
| 39 | + android:id="@+id/recyclerView" | |
| 40 | + android:layout_width="match_parent" | |
| 41 | + android:layout_height="match_parent" | |
| 42 | + android:layout_below="@+id/toobar" | |
| 43 | + app:adapter="@{listAdapter}" | |
| 44 | + app:layoutManager="@{layoutManager}" /> | |
| 45 | + </RelativeLayout> | |
| 46 | + | |
| 33 | 47 | |
| 34 | 48 | </android.support.v4.widget.SwipeRefreshLayout> |
| 35 | 49 | ... | ... |
app/src/main/res/layout/fragment_comments.xml
| ... | ... | @@ -11,29 +11,26 @@ |
| 11 | 11 | android:layout_width="match_parent" |
| 12 | 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 | 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 | 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 | 34 | </RelativeLayout> |
| 38 | 35 | |
| 39 | 36 | </layout> |
| 40 | 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 | 31 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/fragment_live.xml
| ... | ... | @@ -21,10 +21,15 @@ |
| 21 | 21 | android:layout_width="match_parent" |
| 22 | 22 | android:layout_height="match_parent"> |
| 23 | 23 | |
| 24 | + <include | |
| 25 | + android:id="@+id/toobar" | |
| 26 | + layout="@layout/item_toolbar" /> | |
| 27 | + | |
| 24 | 28 | <android.support.v7.widget.RecyclerView |
| 25 | 29 | android:id="@+id/recyclerView" |
| 26 | 30 | android:layout_width="match_parent" |
| 27 | 31 | android:layout_height="match_parent" |
| 32 | + android:layout_below="@+id/toobar" | |
| 28 | 33 | app:adapter="@{listAdapter}" |
| 29 | 34 | app:layoutManager="@{layoutManager}"/> |
| 30 | 35 | ... | ... |
app/src/main/res/layout/fragment_player_vod.xml
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | android:layout_height="wrap_content" /> |
| 16 | 16 | <RelativeLayout |
| 17 | 17 | android:id="@+id/contentLayout" |
| 18 | + android:layout_below="@+id/videoView" | |
| 18 | 19 | android:background="@android:color/black" |
| 19 | 20 | android:layout_width="match_parent" |
| 20 | 21 | android:layout_height="wrap_content" | ... | ... |
app/src/main/res/layout/item_toolbar.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + > | |
| 4 | + | |
| 5 | + <RelativeLayout | |
| 6 | + android:id="@+id/toobar" | |
| 7 | + android:layout_width="match_parent" | |
| 8 | + android:layout_height="50dp"> | |
| 9 | + | |
| 10 | + <TextView | |
| 11 | + android:id="@+id/toobar_tv" | |
| 12 | + android:layout_width="wrap_content" | |
| 13 | + android:layout_height="wrap_content" | |
| 14 | + android:layout_centerInParent="true" | |
| 15 | + android:singleLine="true" | |
| 16 | + android:text="我的" | |
| 17 | + android:textColor="@color/config_black_color" | |
| 18 | + android:textSize="22sp" /> | |
| 19 | + | |
| 20 | + <View | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="1px" | |
| 23 | + android:paddingTop="@dimen/_20px" | |
| 24 | + android:background="@color/gray_line_color" /> | |
| 25 | + </RelativeLayout> | |
| 26 | + | |
| 27 | +</layout> | |
| 0 | 28 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/layout_actionbar.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | |
| 3 | +<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | + android:id="@+id/toolbar" | |
| 5 | + xmlns:tools="http://schemas.android.com/tools" | |
| 6 | + android:layout_width="match_parent" | |
| 7 | + android:layout_height="?attr/actionBarSize" | |
| 8 | + android:theme="@style/ThemeOverlay.AppCompat.Light" | |
| 9 | + android:background="@drawable/toolbar_bg" | |
| 10 | + tools:visibility="visible"> | |
| 11 | + | |
| 12 | + | |
| 13 | + <TextView | |
| 14 | + android:id="@+id/toolbarTitle" | |
| 15 | + style="@style/ActionbarTitleStyle" | |
| 16 | + android:layout_width="wrap_content" | |
| 17 | + android:layout_height="wrap_content" | |
| 18 | + android:layout_gravity="center" | |
| 19 | + android:lines="1" | |
| 20 | + tools:text="here is title"/> | |
| 21 | + | |
| 22 | +</android.support.v7.widget.Toolbar> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/layout_actionbar_back.xml
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | android:layout_height="?attr/actionBarSize" |
| 9 | 9 | android:theme="@style/ThemeOverlay.AppCompat.Light" |
| 10 | 10 | app:contentInsetEnd="?attr/actionBarSize" |
| 11 | - android:background="@android:color/white" | |
| 11 | + android:background="@drawable/toolbar_bg" | |
| 12 | 12 | android:visibility="gone" |
| 13 | 13 | tools:visibility="visible"> |
| 14 | 14 | ... | ... |
app/src/main/res/layout/user_fragment.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | |
| 3 | 3 | <layout xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | - xmlns:cn="http://schemas.android.com/apk/res-auto" | |
| 5 | - > | |
| 4 | + xmlns:cn="http://schemas.android.com/apk/res-auto"> | |
| 6 | 5 | |
| 7 | 6 | <LinearLayout |
| 8 | 7 | android:layout_width="match_parent" |
| 9 | 8 | android:layout_height="match_parent" |
| 10 | 9 | android:orientation="vertical"> |
| 11 | 10 | |
| 12 | - <RelativeLayout | |
| 13 | - android:layout_width="match_parent" | |
| 14 | - android:layout_height="48dp"> | |
| 15 | - | |
| 16 | - <TextView | |
| 17 | - android:layout_width="wrap_content" | |
| 18 | - android:layout_height="wrap_content" | |
| 19 | - android:layout_centerInParent="true" | |
| 20 | - android:singleLine="true" | |
| 21 | - android:text="我的" | |
| 22 | - android:textColor="@color/config_black_color" | |
| 23 | - android:textSize="22sp" /> | |
| 11 | + <include | |
| 12 | + android:id="@+id/toobar" | |
| 13 | + layout="@layout/item_toolbar" /> | |
| 24 | 14 | |
| 25 | 15 | |
| 26 | - </RelativeLayout> | |
| 27 | - | |
| 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 | 16 | |
| 35 | 17 | <RelativeLayout |
| 36 | 18 | android:id="@+id/config_header" |
| ... | ... | @@ -46,8 +28,8 @@ |
| 46 | 28 | android:layout_centerVertical="true" |
| 47 | 29 | android:layout_marginLeft="11dp" |
| 48 | 30 | android:layout_marginRight="16dp" |
| 49 | - cn:border_color="@android:color/transparent" | |
| 50 | - android:src="@drawable/cnlive_user_header" /> | |
| 31 | + android:src="@drawable/cnlive_user_header" | |
| 32 | + cn:border_color="@android:color/transparent" /> | |
| 51 | 33 | |
| 52 | 34 | <LinearLayout |
| 53 | 35 | android:layout_width="wrap_content" | ... | ... |
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 | 6 | \ No newline at end of file | ... | ... |
user/src/main/res/values/strings.xml