Commit 5ca52b5beb69c09b2b1f452cd6e28a1721237143
1 parent
204c4c04
处理 评论页面刷新问题 以及 聊天页面的 bug处理
Showing
20 changed files
with
783 additions
and
31 deletions
app/src/main/java/com/cnlive/gundam/main/presenter/VodDetailPresenter.java
| @@ -12,11 +12,13 @@ import com.cnlive.libs.util.chat.model.ErrorMessage; | @@ -12,11 +12,13 @@ import com.cnlive.libs.util.chat.model.ErrorMessage; | ||
| 12 | import com.cnlive.libs.util.comment.CommentUtil; | 12 | import com.cnlive.libs.util.comment.CommentUtil; |
| 13 | import com.cnlive.libs.util.comment.base.CommentCallback; | 13 | import com.cnlive.libs.util.comment.base.CommentCallback; |
| 14 | import com.cnlive.libs.util.comment.base.CommentListCallback; | 14 | import com.cnlive.libs.util.comment.base.CommentListCallback; |
| 15 | +import com.cnlive.libs.util.data.okhttpUtil.utils.L; | ||
| 15 | import com.cnlive.libs.util.model.CommentItem; | 16 | import com.cnlive.libs.util.model.CommentItem; |
| 16 | import com.cnlive.libs.util.model.CommentPage; | 17 | import com.cnlive.libs.util.model.CommentPage; |
| 17 | 18 | ||
| 18 | import java.util.ArrayList; | 19 | import java.util.ArrayList; |
| 19 | import java.util.List; | 20 | import java.util.List; |
| 21 | + | ||
| 20 | /** | 22 | /** |
| 21 | * 创建:wukuiqing | 23 | * 创建:wukuiqing |
| 22 | * <p> | 24 | * <p> |
| @@ -38,14 +40,14 @@ public class VodDetailPresenter { | @@ -38,14 +40,14 @@ public class VodDetailPresenter { | ||
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | 42 | ||
| 41 | - public void getData() | ||
| 42 | - { | 43 | + public void getData() { |
| 43 | mDatas.add(new CommentTitleViewModel("0")); | 44 | mDatas.add(new CommentTitleViewModel("0")); |
| 44 | - commentFragment.onLoadDataComplete(null,mDatas); | 45 | + commentFragment.onLoadDataComplete(null, mDatas); |
| 45 | } | 46 | } |
| 46 | - public void getComment(final boolean scrollState, String mContentId, int page) { | ||
| 47 | 47 | ||
| 48 | + public void getComment(final boolean scrollState, String mContentId, int page) { | ||
| 48 | 49 | ||
| 50 | + L.e("data:" + page); | ||
| 49 | 51 | ||
| 50 | commentUtil.readAllComment(mContentId, page, pageCount, new CommentListCallback() { | 52 | commentUtil.readAllComment(mContentId, page, pageCount, new CommentListCallback() { |
| 51 | @Override | 53 | @Override |
app/src/main/java/com/cnlive/gundam/main/ui/adapter/LoadImgAdapter.java
| @@ -7,8 +7,8 @@ import android.widget.Toast; | @@ -7,8 +7,8 @@ import android.widget.Toast; | ||
| 7 | 7 | ||
| 8 | import com.bumptech.glide.Glide; | 8 | import com.bumptech.glide.Glide; |
| 9 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 9 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| 10 | - | ||
| 11 | - | 10 | +import com.bumptech.glide.load.resource.bitmap.CenterCrop; |
| 11 | +import com.cnlive.gundam.main.ui.widget.GlideCircleTransform; | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| @@ -20,7 +20,7 @@ public class LoadImgAdapter { | @@ -20,7 +20,7 @@ public class LoadImgAdapter { | ||
| 20 | 20 | ||
| 21 | @BindingAdapter({"circleUrl"}) | 21 | @BindingAdapter({"circleUrl"}) |
| 22 | public static void loadCircleImage(ImageView iv, String url) { | 22 | public static void loadCircleImage(ImageView iv, String url) { |
| 23 | - Glide.with(iv.getContext()).load(url).into(iv); | 23 | + Glide.with(iv.getContext()).load(url).bitmapTransform(new GlideCircleTransform(iv.getContext())).into(iv); |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | } | 26 | } |
app/src/main/java/com/cnlive/gundam/main/ui/adapter/mul/BaseBindingAdapter.java
| @@ -182,6 +182,12 @@ public class BaseBindingAdapter<D, B extends ViewDataBinding> extends RecyclerVi | @@ -182,6 +182,12 @@ public class BaseBindingAdapter<D, B extends ViewDataBinding> extends RecyclerVi | ||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | 184 | ||
| 185 | + public void clear(){ | ||
| 186 | + if( mDatas!=null){ | ||
| 187 | + mDatas.clear(); | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + | ||
| 185 | public List<D> getDatas() { | 191 | public List<D> getDatas() { |
| 186 | return mDatas; | 192 | return mDatas; |
| 187 | } | 193 | } |
app/src/main/java/com/cnlive/gundam/main/ui/widget/CustomGiftPopupWindow.java
0 → 100644
| 1 | +package com.cnlive.gundam.main.ui.widget; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.databinding.DataBindingUtil; | ||
| 5 | +import android.graphics.drawable.ColorDrawable; | ||
| 6 | +import android.support.v7.widget.GridLayoutManager; | ||
| 7 | +import android.support.v7.widget.RecyclerView; | ||
| 8 | +import android.view.LayoutInflater; | ||
| 9 | +import android.view.MotionEvent; | ||
| 10 | +import android.view.View; | ||
| 11 | +import android.view.ViewGroup; | ||
| 12 | +import android.widget.LinearLayout; | ||
| 13 | +import android.widget.PopupWindow; | ||
| 14 | + | ||
| 15 | +import com.cnlive.gundam.R; | ||
| 16 | +import com.cnlive.gundam.databinding.LayoutPopupwindowGiftBinding; | ||
| 17 | +import com.cnlive.gundam.video.adpter.GiftAdapter; | ||
| 18 | +import com.cnlive.gundam.video.fragment.chat.UGCChatRoomFragment; | ||
| 19 | +import com.cnlive.gundam.video.model.GiftModle; | ||
| 20 | + | ||
| 21 | +import java.util.ArrayList; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 创建:wukuiqing | ||
| 25 | + * <p> | ||
| 26 | + * 时间:2017/7/14 | ||
| 27 | + * <p> | ||
| 28 | + * 描述: | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +public class CustomGiftPopupWindow extends PopupWindow { | ||
| 32 | + Context mContext; | ||
| 33 | + RecyclerView popRecycle; | ||
| 34 | + ArrayList<GiftModle> giftArray; | ||
| 35 | + LayoutPopupwindowGiftBinding binding; | ||
| 36 | + | ||
| 37 | + public CustomGiftPopupWindow(Context context) { | ||
| 38 | + super(context); | ||
| 39 | + mContext = context; | ||
| 40 | + | ||
| 41 | + //初始化 | ||
| 42 | +// initPop(); | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + private void initPop() { | ||
| 49 | + giftArray = new ArrayList<>(); | ||
| 50 | +// view = LayoutInflater.from(mContext).inflate(R.layout.layout_popupwindow_gift, null); | ||
| 51 | + binding= DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.layout_popupwindow_gift, null, false); | ||
| 52 | + | ||
| 53 | + popRecycle = binding.popRecycle; | ||
| 54 | + GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 6); | ||
| 55 | + popRecycle.setLayoutManager(gridLayoutManager); | ||
| 56 | + popRecycle.addItemDecoration(new RecyclerSpace(10)); | ||
| 57 | + this.setContentView(binding.getRoot());// 设置View | ||
| 58 | + this.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);// 设置弹出窗口的宽 | ||
| 59 | + this.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);// 设置弹出窗口的高 | ||
| 60 | + | ||
| 61 | + this.setFocusable(true);// 设置弹出窗口可 | ||
| 62 | + this.setAnimationStyle(R.style.gift_popwindow_anim_style);// 设置动画 | ||
| 63 | + this.setBackgroundDrawable(new ColorDrawable(0x22000000));// 设置背景透明 | ||
| 64 | + binding.getRoot().setOnTouchListener(new View.OnTouchListener() {// 如果触摸位置在窗口外面则销毁 | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public boolean onTouch(View v, MotionEvent event) { | ||
| 68 | + // TODO Auto-generated method stub | ||
| 69 | + int height = binding.popRl.getTop(); | ||
| 70 | + int y = (int) event.getY(); | ||
| 71 | + if (event.getAction() == MotionEvent.ACTION_UP) { | ||
| 72 | + if (y < height) { | ||
| 73 | + dismiss(); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + return true; | ||
| 77 | + } | ||
| 78 | + }); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + public void setData(GiftAdapter adapter) { | ||
| 83 | + initPop(); | ||
| 84 | + binding.setGiftAdapter(adapter); | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + | ||
| 91 | +} |
app/src/main/java/com/cnlive/gundam/main/ui/widget/GlideCircleTransform.java
| @@ -23,7 +23,8 @@ public class GlideCircleTransform extends BitmapTransformation { | @@ -23,7 +23,8 @@ public class GlideCircleTransform extends BitmapTransformation { | ||
| 23 | super(context); | 23 | super(context); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | - @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { | 26 | + @Override |
| 27 | + protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { | ||
| 27 | return circleCrop(pool, toTransform); | 28 | return circleCrop(pool, toTransform); |
| 28 | } | 29 | } |
| 29 | 30 | ||
| @@ -51,7 +52,8 @@ public class GlideCircleTransform extends BitmapTransformation { | @@ -51,7 +52,8 @@ public class GlideCircleTransform extends BitmapTransformation { | ||
| 51 | return result; | 52 | return result; |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | - @Override public String getId() { | 55 | + @Override |
| 56 | + public String getId() { | ||
| 55 | return getClass().getName(); | 57 | return getClass().getName(); |
| 56 | } | 58 | } |
| 57 | } | 59 | } |
app/src/main/java/com/cnlive/gundam/user/util/InputUtil.java
| @@ -2,6 +2,7 @@ package com.cnlive.gundam.user.util; | @@ -2,6 +2,7 @@ package com.cnlive.gundam.user.util; | ||
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.drawable.BitmapDrawable; | 4 | import android.graphics.drawable.BitmapDrawable; |
| 5 | +import android.inputmethodservice.InputMethodService; | ||
| 5 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 6 | import android.view.Gravity; | 7 | import android.view.Gravity; |
| 7 | import android.view.KeyEvent; | 8 | import android.view.KeyEvent; |
| @@ -12,6 +13,7 @@ import android.view.ViewGroup; | @@ -12,6 +13,7 @@ import android.view.ViewGroup; | ||
| 12 | import android.view.WindowManager; | 13 | import android.view.WindowManager; |
| 13 | import android.view.inputmethod.InputMethodManager; | 14 | import android.view.inputmethod.InputMethodManager; |
| 14 | import android.widget.EditText; | 15 | import android.widget.EditText; |
| 16 | +import android.widget.ImageView; | ||
| 15 | import android.widget.LinearLayout; | 17 | import android.widget.LinearLayout; |
| 16 | import android.widget.PopupWindow; | 18 | import android.widget.PopupWindow; |
| 17 | 19 | ||
| @@ -65,6 +67,8 @@ public class InputUtil { | @@ -65,6 +67,8 @@ public class InputUtil { | ||
| 65 | } | 67 | } |
| 66 | }); | 68 | }); |
| 67 | mMsgEditText = (EditText) contentView.findViewById(R.id.chat_content); | 69 | mMsgEditText = (EditText) contentView.findViewById(R.id.chat_content); |
| 70 | +// ImageView mEmoticonsutton = (ImageView) contentView.findViewById(R.id.emoticons_button); | ||
| 71 | + | ||
| 68 | mMsgEditText.setOnKeyListener(new View.OnKeyListener() { | 72 | mMsgEditText.setOnKeyListener(new View.OnKeyListener() { |
| 69 | @Override | 73 | @Override |
| 70 | public boolean onKey(View v, int keyCode, KeyEvent event) { | 74 | public boolean onKey(View v, int keyCode, KeyEvent event) { |
| @@ -121,8 +125,17 @@ public class InputUtil { | @@ -121,8 +125,17 @@ public class InputUtil { | ||
| 121 | mMsgEditText.requestFocus(); | 125 | mMsgEditText.requestFocus(); |
| 122 | mInputPopupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED); | 126 | mInputPopupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED); |
| 123 | mInputPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); | 127 | mInputPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); |
| 124 | - InputMethodManager imm = (InputMethodManager) mContext.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); | 128 | + final InputMethodManager imm = (InputMethodManager) mContext.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); |
| 125 | imm.toggleSoftInput(1000, InputMethodManager.HIDE_NOT_ALWAYS); | 129 | imm.toggleSoftInput(1000, InputMethodManager.HIDE_NOT_ALWAYS); |
| 130 | + | ||
| 131 | +// mEmoticonsutton.setOnClickListener(new View.OnClickListener() { | ||
| 132 | +// @Override | ||
| 133 | +// public void onClick(View view) { | ||
| 134 | +// | ||
| 135 | +// imm.showSoftInput(mMsgEditText, 0); | ||
| 136 | +// } | ||
| 137 | +// }); | ||
| 138 | + | ||
| 126 | } | 139 | } |
| 127 | 140 | ||
| 128 | 141 |
app/src/main/java/com/cnlive/gundam/video/activity/PlayerActivity.java
| @@ -93,7 +93,7 @@ public class PlayerActivity extends AppCompatActivity { | @@ -93,7 +93,7 @@ public class PlayerActivity extends AppCompatActivity { | ||
| 93 | 93 | ||
| 94 | if (!(PlayerUtils.isPortrait(this)) && (fragment instanceof PlayerLiveFragment || fragment instanceof PlayerVodFragment)) { | 94 | if (!(PlayerUtils.isPortrait(this)) && (fragment instanceof PlayerLiveFragment || fragment instanceof PlayerVodFragment)) { |
| 95 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | 95 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| 96 | - } else if (SharedPreferencesHelper.getInstance(this).getIntValue("ishow") == 0) { | 96 | + } else if (SharedPreferencesHelper.getInstance(this).getIntValue("ishow",-1) == 0) { |
| 97 | EventBus.getDefault().post(new MsgEvent()); | 97 | EventBus.getDefault().post(new MsgEvent()); |
| 98 | } else { | 98 | } else { |
| 99 | super.onBackPressed(); | 99 | super.onBackPressed(); |
app/src/main/java/com/cnlive/gundam/video/adpter/GiftAdapter.java
| @@ -11,6 +11,7 @@ import android.view.ViewGroup; | @@ -11,6 +11,7 @@ import android.view.ViewGroup; | ||
| 11 | import com.cnlive.gundam.R; | 11 | import com.cnlive.gundam.R; |
| 12 | import com.cnlive.gundam.video.activity.PlayerActivity; | 12 | import com.cnlive.gundam.video.activity.PlayerActivity; |
| 13 | import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; | 13 | import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; |
| 14 | +import com.cnlive.gundam.video.fragment.chat.UGCChatRoomFragment; | ||
| 14 | import com.cnlive.gundam.video.model.CNMessageModle; | 15 | import com.cnlive.gundam.video.model.CNMessageModle; |
| 15 | import com.cnlive.gundam.video.model.GiftModle; | 16 | import com.cnlive.gundam.video.model.GiftModle; |
| 16 | import com.cnlive.gundam.video.model.MessageInfo; | 17 | import com.cnlive.gundam.video.model.MessageInfo; |
| @@ -32,15 +33,15 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | @@ -32,15 +33,15 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | ||
| 32 | private List<GiftModle> mDataList; | 33 | private List<GiftModle> mDataList; |
| 33 | private int mLayoutId; // 条目布局文件ID | 34 | private int mLayoutId; // 条目布局文件ID |
| 34 | private int mVariableId; // DataBinding变量ID | 35 | private int mVariableId; // DataBinding变量ID |
| 35 | - private String roomId; | 36 | + private String roomId; |
| 36 | private final Gson gson2; | 37 | private final Gson gson2; |
| 37 | 38 | ||
| 38 | - public GiftAdapter(String roomId,Context context, List<GiftModle> list, int layoutId, int variableId) { | 39 | + public GiftAdapter(String roomId, Context context, List<GiftModle> list, int layoutId, int variableId) { |
| 39 | this.mContext = context; | 40 | this.mContext = context; |
| 40 | this.mDataList = list; | 41 | this.mDataList = list; |
| 41 | this.mLayoutId = layoutId; | 42 | this.mLayoutId = layoutId; |
| 42 | mVariableId = variableId; | 43 | mVariableId = variableId; |
| 43 | - this.roomId=roomId; | 44 | + this.roomId = roomId; |
| 44 | gson2 = new Gson(); | 45 | gson2 = new Gson(); |
| 45 | 46 | ||
| 46 | 47 | ||
| @@ -61,8 +62,8 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | @@ -61,8 +62,8 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | ||
| 61 | holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { | 62 | holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { |
| 62 | @Override | 63 | @Override |
| 63 | public void onClick(View v) { | 64 | public void onClick(View v) { |
| 64 | - CNMessageModle cnMessageModle = new CNMessageModle("giftType",new MessageInfo("0",mDataList.get(position).getGiftMessage(),"1","0",mDataList.get(position).getGiftMessage())); | ||
| 65 | - String obj2=gson2.toJson(cnMessageModle); | 65 | + CNMessageModle cnMessageModle = new CNMessageModle("giftType", new MessageInfo("0", mDataList.get(position).getGiftMessage(), "1", "0", mDataList.get(position).getGiftMessage())); |
| 66 | + String obj2 = gson2.toJson(cnMessageModle); | ||
| 66 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, new IChat.OnSendMessageListener() { | 67 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, new IChat.OnSendMessageListener() { |
| 67 | @Override | 68 | @Override |
| 68 | public void onAttached(CNMessage message) { | 69 | public void onAttached(CNMessage message) { |
| @@ -72,8 +73,19 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | @@ -72,8 +73,19 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | ||
| 72 | @Override | 73 | @Override |
| 73 | public void onSuccess(CNMessage message) { | 74 | public void onSuccess(CNMessage message) { |
| 74 | PlayerActivity context = (PlayerActivity) GiftAdapter.this.mContext; | 75 | PlayerActivity context = (PlayerActivity) GiftAdapter.this.mContext; |
| 75 | - ChatRoomFragment chatRoomFragment = (ChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment"); | ||
| 76 | - chatRoomFragment.giftItem(position); | 76 | + if (context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment") != null) { |
| 77 | + if (context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment").getClass() == ChatRoomFragment.class) { | ||
| 78 | + ChatRoomFragment chatRoomFragment = (ChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment"); | ||
| 79 | + chatRoomFragment.giftItem(position); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + if (context.getSupportFragmentManager().findFragmentByTag("UGCChatRoomFragment") != null ) { | ||
| 83 | + if (context.getSupportFragmentManager().findFragmentByTag("UGCChatRoomFragment").getClass() == UGCChatRoomFragment.class) { | ||
| 84 | + UGCChatRoomFragment chatRoomFragment = (UGCChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("UGCChatRoomFragment"); | ||
| 85 | + chatRoomFragment.giftItem(position); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 77 | 89 | ||
| 78 | } | 90 | } |
| 79 | 91 |
app/src/main/java/com/cnlive/gundam/video/adpter/UGCGiftAdapter.java
0 → 100644
| 1 | +package com.cnlive.gundam.video.adpter; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.databinding.DataBindingUtil; | ||
| 5 | +import android.databinding.ViewDataBinding; | ||
| 6 | +import android.support.v7.widget.RecyclerView; | ||
| 7 | +import android.view.LayoutInflater; | ||
| 8 | +import android.view.View; | ||
| 9 | +import android.view.ViewGroup; | ||
| 10 | + | ||
| 11 | +import com.cnlive.gundam.R; | ||
| 12 | +import com.cnlive.gundam.video.activity.PlayerActivity; | ||
| 13 | +import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; | ||
| 14 | +import com.cnlive.gundam.video.fragment.chat.UGCChatRoomFragment; | ||
| 15 | +import com.cnlive.gundam.video.model.CNMessageModle; | ||
| 16 | +import com.cnlive.gundam.video.model.GiftModle; | ||
| 17 | +import com.cnlive.gundam.video.model.MessageInfo; | ||
| 18 | +import com.cnlive.libs.util.chat.ChatUtil; | ||
| 19 | +import com.cnlive.libs.util.chat.base.IChat; | ||
| 20 | +import com.cnlive.libs.util.chat.model.CNMessage; | ||
| 21 | +import com.google.gson.Gson; | ||
| 22 | + | ||
| 23 | +import java.util.List; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * @author 陈硕 | ||
| 27 | + * @time 2017/5/27 16:04 | ||
| 28 | + * @desc ${TODD} | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +public class UGCGiftAdapter extends RecyclerView.Adapter<UGCGiftAdapter.RVHolder> { | ||
| 32 | + private Context mContext; | ||
| 33 | + private List<GiftModle> mDataList; | ||
| 34 | + private int mLayoutId; // 条目布局文件ID | ||
| 35 | + private int mVariableId; // DataBinding变量ID | ||
| 36 | + private String roomId; | ||
| 37 | + private final Gson gson2; | ||
| 38 | + | ||
| 39 | + public UGCGiftAdapter(String roomId, Context context, List<GiftModle> list, int layoutId, int variableId) { | ||
| 40 | + this.mContext = context; | ||
| 41 | + this.mDataList = list; | ||
| 42 | + this.mLayoutId = layoutId; | ||
| 43 | + mVariableId = variableId; | ||
| 44 | + this.roomId=roomId; | ||
| 45 | + gson2 = new Gson(); | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + public RVHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 53 | + ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), mLayoutId, parent, false); | ||
| 54 | + RVHolder holder = new RVHolder(binding.getRoot()); | ||
| 55 | + holder.binding = binding; | ||
| 56 | + return holder; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public void onBindViewHolder(final RVHolder holder, final int position) { | ||
| 61 | + holder.binding.setVariable(mVariableId, mDataList.get(position)); | ||
| 62 | + holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { | ||
| 63 | + @Override | ||
| 64 | + public void onClick(View v) { | ||
| 65 | + CNMessageModle cnMessageModle = new CNMessageModle("giftType",new MessageInfo("0",mDataList.get(position).getGiftMessage(),"1","0",mDataList.get(position).getGiftMessage())); | ||
| 66 | + String obj2=gson2.toJson(cnMessageModle); | ||
| 67 | + ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, new IChat.OnSendMessageListener() { | ||
| 68 | + @Override | ||
| 69 | + public void onAttached(CNMessage message) { | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public void onSuccess(CNMessage message) { | ||
| 75 | + PlayerActivity context = (PlayerActivity) UGCGiftAdapter.this.mContext; | ||
| 76 | + UGCChatRoomFragment chatRoomFragment = (UGCChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("UGCChatRoomFragment"); | ||
| 77 | + chatRoomFragment.giftItem(position); | ||
| 78 | + | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public void onError(CNMessage message, int what, String extra) { | ||
| 83 | + | ||
| 84 | + } | ||
| 85 | + }); | ||
| 86 | + } | ||
| 87 | + }); | ||
| 88 | + holder.binding.executePendingBindings(); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @Override | ||
| 92 | + public int getItemCount() { | ||
| 93 | + return mDataList == null ? 0 : mDataList.size(); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + class RVHolder extends RecyclerView.ViewHolder { | ||
| 97 | + ViewDataBinding binding; | ||
| 98 | + | ||
| 99 | + RVHolder(View view) { | ||
| 100 | + super(view); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | +} |
app/src/main/java/com/cnlive/gundam/video/fragment/CommentDetailsFragment.java
| @@ -195,6 +195,8 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | @@ -195,6 +195,8 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | ||
| 195 | presenter.addCommment(mContentId, s1, message); | 195 | presenter.addCommment(mContentId, s1, message); |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | + boolean mRefrush; | ||
| 199 | + | ||
| 198 | @Override | 200 | @Override |
| 199 | public void onLoadDataComplete(VodDetailModel model, List datas) { | 201 | public void onLoadDataComplete(VodDetailModel model, List datas) { |
| 200 | mDatas = datas; | 202 | mDatas = datas; |
| @@ -206,7 +208,8 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | @@ -206,7 +208,8 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | ||
| 206 | binding.srvVodDetail.setOnLoadListener(new SwipeRecyclerView.OnLoadListener() { | 208 | binding.srvVodDetail.setOnLoadListener(new SwipeRecyclerView.OnLoadListener() { |
| 207 | @Override | 209 | @Override |
| 208 | public void onRefresh() { | 210 | public void onRefresh() { |
| 209 | - presenter.getComment(false, mContentId, page); | 211 | + presenter.getComment(false, mContentId, 1); |
| 212 | + mRefrush = true; | ||
| 210 | } | 213 | } |
| 211 | 214 | ||
| 212 | @Override | 215 | @Override |
| @@ -217,7 +220,7 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | @@ -217,7 +220,7 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | ||
| 217 | } | 220 | } |
| 218 | 221 | ||
| 219 | }); | 222 | }); |
| 220 | - binding.srvVodDetail.setRefreshEnable(true); | 223 | + binding.srvVodDetail.setRefreshEnable(false); |
| 221 | binding.srvVodDetail.setStickyListener(new SwipeRecyclerView.StickyListener() { | 224 | binding.srvVodDetail.setStickyListener(new SwipeRecyclerView.StickyListener() { |
| 222 | @Override | 225 | @Override |
| 223 | public void onSticky(boolean isVisible) { | 226 | public void onSticky(boolean isVisible) { |
| @@ -243,18 +246,28 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | @@ -243,18 +246,28 @@ public class CommentDetailsFragment extends Fragment implements VodDetialView { | ||
| 243 | if (binding.srvVodDetail.isRefreshing()) { | 246 | if (binding.srvVodDetail.isRefreshing()) { |
| 244 | binding.srvVodDetail.complete(); | 247 | binding.srvVodDetail.complete(); |
| 245 | } | 248 | } |
| 249 | + | ||
| 246 | if (mDatas == null) { | 250 | if (mDatas == null) { |
| 247 | binding.srvVodDetail.onNoMore("快来抢沙发喽~"); | 251 | binding.srvVodDetail.onNoMore("快来抢沙发喽~"); |
| 248 | loadMoreEnable = false; | 252 | loadMoreEnable = false; |
| 249 | } else if (isScroll) { | 253 | } else if (isScroll) { |
| 250 | adapter.add(1, mDatas.get(0)); | 254 | adapter.add(1, mDatas.get(0)); |
| 251 | - binding.srvVodDetail.getRecyclerView().scrollToPosition(1); | 255 | + binding.srvVodDetail.getRecyclerView().scrollToPosition(0); |
| 252 | } else { | 256 | } else { |
| 257 | +// if (mRefrush) { | ||
| 258 | +// adapter.clear(); | ||
| 259 | +// mDatas.add(0, new CommentTitleViewModel("0")); | ||
| 260 | +// mRefrush=false; | ||
| 261 | +// } | ||
| 262 | + | ||
| 253 | adapter.addDatas(mDatas); | 263 | adapter.addDatas(mDatas); |
| 264 | +// binding.srvVodDetail.setRefreshing(false); | ||
| 265 | +// binding.srvVodDetail.onNoMore(""); | ||
| 254 | if (mDatas.size() < 2) { | 266 | if (mDatas.size() < 2) { |
| 255 | binding.srvVodDetail.onNoMore("暂无更多评论~"); | 267 | binding.srvVodDetail.onNoMore("暂无更多评论~"); |
| 256 | loadMoreEnable = false; | 268 | loadMoreEnable = false; |
| 257 | } | 269 | } |
| 270 | + | ||
| 258 | page++; | 271 | page++; |
| 259 | 272 | ||
| 260 | } | 273 | } |
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerUgcLiveFragment.java
| @@ -17,6 +17,7 @@ import com.cnlive.gundam.R; | @@ -17,6 +17,7 @@ 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.ChatRoomFragment; | 19 | import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; |
| 20 | +import com.cnlive.gundam.video.fragment.chat.UGCChatRoomFragment; | ||
| 20 | import com.cnlive.gundam.video.model.VideoModel; | 21 | import com.cnlive.gundam.video.model.VideoModel; |
| 21 | import com.cnlive.gundam.video.utils.PlayerUtils; | 22 | import com.cnlive.gundam.video.utils.PlayerUtils; |
| 22 | import com.cnlive.gundam.video.view.BaseVideoView; | 23 | import com.cnlive.gundam.video.view.BaseVideoView; |
| @@ -59,7 +60,7 @@ public class PlayerUgcLiveFragment extends Fragment implements BaseVideoView.OnU | @@ -59,7 +60,7 @@ public class PlayerUgcLiveFragment extends Fragment implements BaseVideoView.OnU | ||
| 59 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 60 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 60 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_ugc_live, container, false); | 61 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_player_ugc_live, container, false); |
| 61 | initData(); | 62 | initData(); |
| 62 | - getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, ChatRoomFragment.newInstance(id), "chatRoomFragment").commit(); | 63 | + getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentLayout, UGCChatRoomFragment.newInstance(id), "UGCChatRoomFragment").commit(); |
| 63 | return binding.getRoot(); | 64 | return binding.getRoot(); |
| 64 | } | 65 | } |
| 65 | 66 |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
| @@ -12,6 +12,7 @@ import android.support.v4.app.FragmentActivity; | @@ -12,6 +12,7 @@ import android.support.v4.app.FragmentActivity; | ||
| 12 | import android.support.v4.content.ContextCompat; | 12 | import android.support.v4.content.ContextCompat; |
| 13 | import android.support.v7.widget.GridLayoutManager; | 13 | import android.support.v7.widget.GridLayoutManager; |
| 14 | import android.support.v7.widget.SwitchCompat; | 14 | import android.support.v7.widget.SwitchCompat; |
| 15 | +import android.view.Gravity; | ||
| 15 | import android.view.LayoutInflater; | 16 | import android.view.LayoutInflater; |
| 16 | import android.view.View; | 17 | import android.view.View; |
| 17 | import android.view.ViewGroup; | 18 | import android.view.ViewGroup; |
| @@ -23,6 +24,7 @@ import com.cnlive.gundam.BR; | @@ -23,6 +24,7 @@ import com.cnlive.gundam.BR; | ||
| 23 | import com.cnlive.gundam.R; | 24 | import com.cnlive.gundam.R; |
| 24 | import com.cnlive.gundam.databinding.FragmentChatBinding; | 25 | import com.cnlive.gundam.databinding.FragmentChatBinding; |
| 25 | import com.cnlive.gundam.main.model.MsgEvent; | 26 | import com.cnlive.gundam.main.model.MsgEvent; |
| 27 | +import com.cnlive.gundam.main.ui.widget.CustomGiftPopupWindow; | ||
| 26 | import com.cnlive.gundam.main.ui.widget.GlideCircleTransform; | 28 | import com.cnlive.gundam.main.ui.widget.GlideCircleTransform; |
| 27 | import com.cnlive.gundam.main.ui.widget.RecyclerSpace; | 29 | import com.cnlive.gundam.main.ui.widget.RecyclerSpace; |
| 28 | import com.cnlive.gundam.main.utils.SharedPreferencesHelper; | 30 | import com.cnlive.gundam.main.utils.SharedPreferencesHelper; |
| @@ -67,6 +69,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -67,6 +69,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 67 | private String roomId; | 69 | private String roomId; |
| 68 | private int[] imaSource; | 70 | private int[] imaSource; |
| 69 | private String[] gitName; | 71 | private String[] gitName; |
| 72 | + CustomGiftPopupWindow popGift; | ||
| 70 | 73 | ||
| 71 | 74 | ||
| 72 | public static ChatRoomFragment newInstance(String id) { | 75 | public static ChatRoomFragment newInstance(String id) { |
| @@ -95,6 +98,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -95,6 +98,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 95 | initListener(); | 98 | initListener(); |
| 96 | EventBus.getDefault().register(this); | 99 | EventBus.getDefault().register(this); |
| 97 | faceurl = UserService.getInstance(getActivity()).getActiveAccountInfo().getFaceurl(); | 100 | faceurl = UserService.getInstance(getActivity()).getActiveAccountInfo().getFaceurl(); |
| 101 | + popGift= new CustomGiftPopupWindow(getActivity()); | ||
| 98 | initDate(); | 102 | initDate(); |
| 99 | initGift(); | 103 | initGift(); |
| 100 | int checkCallPhonePermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_PHONE_STATE); | 104 | int checkCallPhonePermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_PHONE_STATE); |
| @@ -195,16 +199,19 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -195,16 +199,19 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 195 | fragmentChatBinding.imgGift.setOnClickListener(new View.OnClickListener() { | 199 | fragmentChatBinding.imgGift.setOnClickListener(new View.OnClickListener() { |
| 196 | @Override | 200 | @Override |
| 197 | public void onClick(View view) { | 201 | public void onClick(View view) { |
| 198 | - int i = View.INVISIBLE == fragmentChatBinding.rlGift.getVisibility() ? View.VISIBLE : View.INVISIBLE; | ||
| 199 | - SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", i); | ||
| 200 | - fragmentChatBinding.rlGift.setVisibility(i); | 202 | +// int i = View.INVISIBLE == fragmentChatBinding.rlGift.getVisibility() ? View.VISIBLE : View.INVISIBLE; |
| 203 | +// SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", i); | ||
| 204 | +// fragmentChatBinding.rlGift.setVisibility(i); | ||
| 205 | + popGift.setData(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); | ||
| 206 | + popGift.showAtLocation(fragmentChatBinding.getRoot(),Gravity.BOTTOM| Gravity.CENTER_HORIZONTAL, 0, 200); | ||
| 207 | + | ||
| 201 | } | 208 | } |
| 202 | }); | 209 | }); |
| 203 | GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 6); | 210 | GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 6); |
| 204 | fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager); | 211 | fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager); |
| 205 | fragmentChatBinding.recyclerGift.addItemDecoration(new RecyclerSpace(10)); | 212 | fragmentChatBinding.recyclerGift.addItemDecoration(new RecyclerSpace(10)); |
| 206 | 213 | ||
| 207 | - fragmentChatBinding.setGiftAdapter(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); | 214 | +// fragmentChatBinding.setGiftAdapter(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); |
| 208 | } | 215 | } |
| 209 | 216 | ||
| 210 | 217 | ||
| @@ -295,8 +302,9 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -295,8 +302,9 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 295 | @Subscribe(threadMode = ThreadMode.MAIN) //第2步:注册一个在后台线程执行的方法,用于接收事件 | 302 | @Subscribe(threadMode = ThreadMode.MAIN) //第2步:注册一个在后台线程执行的方法,用于接收事件 |
| 296 | public void onUserEvent(MsgEvent event) { | 303 | public void onUserEvent(MsgEvent event) { |
| 297 | 304 | ||
| 298 | - fragmentChatBinding.rlGift.setVisibility(View.INVISIBLE); | ||
| 299 | - SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", 4); | 305 | +// fragmentChatBinding.rlGift.setVisibility(View.INVISIBLE); |
| 306 | +// SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", 4); | ||
| 307 | + | ||
| 300 | } | 308 | } |
| 301 | 309 | ||
| 302 | } | 310 | } |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/UGCChatRoomFragment.java
0 → 100644
| 1 | +package com.cnlive.gundam.video.fragment.chat; | ||
| 2 | + | ||
| 3 | +import android.Manifest; | ||
| 4 | +import android.content.pm.PackageManager; | ||
| 5 | +import android.databinding.BindingAdapter; | ||
| 6 | +import android.databinding.DataBindingUtil; | ||
| 7 | +import android.os.Bundle; | ||
| 8 | +import android.support.annotation.NonNull; | ||
| 9 | +import android.support.annotation.Nullable; | ||
| 10 | +import android.support.v4.app.Fragment; | ||
| 11 | +import android.support.v4.content.ContextCompat; | ||
| 12 | +import android.support.v7.widget.GridLayoutManager; | ||
| 13 | +import android.support.v7.widget.SwitchCompat; | ||
| 14 | +import android.view.Gravity; | ||
| 15 | +import android.view.LayoutInflater; | ||
| 16 | +import android.view.View; | ||
| 17 | +import android.view.ViewGroup; | ||
| 18 | +import android.widget.CompoundButton; | ||
| 19 | +import android.widget.ImageView; | ||
| 20 | + | ||
| 21 | +import com.bumptech.glide.Glide; | ||
| 22 | +import com.cnlive.gundam.BR; | ||
| 23 | +import com.cnlive.gundam.R; | ||
| 24 | +import com.cnlive.gundam.databinding.FragmentChatBinding; | ||
| 25 | +import com.cnlive.gundam.databinding.FragmentUgcChatBinding; | ||
| 26 | +import com.cnlive.gundam.main.model.MsgEvent; | ||
| 27 | +import com.cnlive.gundam.main.ui.widget.CustomGiftPopupWindow; | ||
| 28 | +import com.cnlive.gundam.main.ui.widget.GlideCircleTransform; | ||
| 29 | +import com.cnlive.gundam.main.ui.widget.RecyclerSpace; | ||
| 30 | +import com.cnlive.gundam.user.auth.UserService; | ||
| 31 | +import com.cnlive.gundam.user.model.User; | ||
| 32 | +import com.cnlive.gundam.user.util.InputUtil; | ||
| 33 | +import com.cnlive.gundam.user.util.ToastUtil; | ||
| 34 | +import com.cnlive.gundam.video.activity.PlayerActivity; | ||
| 35 | +import com.cnlive.gundam.video.adpter.CommonAdapter; | ||
| 36 | +import com.cnlive.gundam.video.adpter.GiftAdapter; | ||
| 37 | +import com.cnlive.gundam.video.adpter.UGCGiftAdapter; | ||
| 38 | +import com.cnlive.gundam.video.barrage.BarrageBaseMessage; | ||
| 39 | +import com.cnlive.gundam.video.barrage.BarrageBaseView; | ||
| 40 | +import com.cnlive.gundam.video.model.GiftModle; | ||
| 41 | +import com.cnlive.gundam.video.model.MessageContent; | ||
| 42 | +import com.cnlive.libs.util.chat.ChatUtil; | ||
| 43 | +import com.cnlive.libs.util.chat.base.IChat; | ||
| 44 | +import com.cnlive.libs.util.chat.model.CNUserInfo; | ||
| 45 | +import com.cnlive.libs.video.barrage.BarrageLayout; | ||
| 46 | + | ||
| 47 | +import org.greenrobot.eventbus.EventBus; | ||
| 48 | +import org.greenrobot.eventbus.Subscribe; | ||
| 49 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 50 | + | ||
| 51 | +import java.util.ArrayList; | ||
| 52 | + | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * @author 陈硕 | ||
| 56 | + * @time 2017/5/27 13:57 | ||
| 57 | + * @desc ${TODD} | ||
| 58 | + */ | ||
| 59 | +public class UGCChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.OnChatListener { | ||
| 60 | + | ||
| 61 | + private final int PERMISSION_REQUEST_CODE = 0x1001; | ||
| 62 | + | ||
| 63 | + private FragmentUgcChatBinding fragmentChatBinding; | ||
| 64 | + private ArrayList<GiftModle> giftArray; | ||
| 65 | + private CommonAdapter<MessageContent> messageContentCommonAdapter; | ||
| 66 | + private MessageContentInfo messageContentInfo; | ||
| 67 | + public SwitchCompat switchCompatBottom; | ||
| 68 | + private BarrageLayout barrageLayout; | ||
| 69 | + private String roomId; | ||
| 70 | + private int[] imaSource; | ||
| 71 | + private String[] gitName; | ||
| 72 | + CustomGiftPopupWindow popGift; | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + public static UGCChatRoomFragment newInstance(String id) { | ||
| 76 | + Bundle args = new Bundle(); | ||
| 77 | + args.putString("roomID", id); | ||
| 78 | + UGCChatRoomFragment fragment = new UGCChatRoomFragment(); | ||
| 79 | + fragment.setArguments(args); | ||
| 80 | + return fragment; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + @Nullable | ||
| 85 | + @Override | ||
| 86 | + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
| 87 | + fragmentChatBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_ugc_chat, container, false); | ||
| 88 | + roomId = getArguments().getString("roomID"); | ||
| 89 | + return fragmentChatBinding.getRoot(); | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + String faceurl; | ||
| 94 | + | ||
| 95 | + @Override | ||
| 96 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
| 97 | + super.onViewCreated(view, savedInstanceState); | ||
| 98 | + initListener(); | ||
| 99 | + EventBus.getDefault().register(this); | ||
| 100 | + faceurl = UserService.getInstance(getActivity()).getActiveAccountInfo().getFaceurl(); | ||
| 101 | + popGift= new CustomGiftPopupWindow(getActivity()); | ||
| 102 | + initDate(); | ||
| 103 | + initGift(); | ||
| 104 | + int checkCallPhonePermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_PHONE_STATE); | ||
| 105 | + if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) { | ||
| 106 | + requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, PERMISSION_REQUEST_CODE); | ||
| 107 | + } else { | ||
| 108 | + initChat(); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @Override | ||
| 113 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 114 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 115 | + if (requestCode == PERMISSION_REQUEST_CODE) { | ||
| 116 | + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
| 117 | + initChat(); | ||
| 118 | + } else { | ||
| 119 | + ToastUtil.show(getActivity(), "使用聊天功能,请通过权限审核"); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + private void barrageBottom() { | ||
| 125 | + switchCompatBottom = fragmentChatBinding.barrage; | ||
| 126 | + switchCompatBottom.setChecked(false); | ||
| 127 | + barrageLayout = getActivity().findViewById(R.id.private_message); | ||
| 128 | + barrageLayout.init(BarrageBaseView.class, 300, 10, 10, 0.5f); | ||
| 129 | + barrageLayout.pause(); | ||
| 130 | + switchCompatBottom.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | ||
| 131 | + @Override | ||
| 132 | + public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { | ||
| 133 | + if (isChecked) { | ||
| 134 | + barrageLayout.resume(); | ||
| 135 | + | ||
| 136 | + } else { | ||
| 137 | + barrageLayout.pause(); | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + }); | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + @BindingAdapter("android:src") | ||
| 147 | + public static void setSrc(ImageView view, int resId) { | ||
| 148 | + view.setImageResource(resId); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + @BindingAdapter({"imageUrl"}) | ||
| 152 | + public static void loadImage(ImageView imageView, String url) { | ||
| 153 | + if (url == null || url.equals("")) { | ||
| 154 | +// imageView.setImageResource(R.mipmap.ic_launcher); | ||
| 155 | + | ||
| 156 | + Glide.with(imageView.getContext()).load(R.mipmap.ic_launcher).bitmapTransform(new GlideCircleTransform(imageView.getContext())).error(R.mipmap.ic_launcher).into(imageView); | ||
| 157 | + } else { | ||
| 158 | + Glide.with(imageView.getContext()).load(url).bitmapTransform(new GlideCircleTransform(imageView.getContext())).error(R.mipmap.ic_launcher).into(imageView); | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + @Override | ||
| 163 | + public void sendMessage(String message) { | ||
| 164 | + ChatUtil.sendMessage(IChat.CHATROOM, roomId, message, messageContentInfo.onSendMessageListener); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + @Override | ||
| 169 | + public void onDestroy() { | ||
| 170 | + super.onDestroy(); | ||
| 171 | + ChatUtil.disconnect(false); | ||
| 172 | + EventBus.getDefault().unregister(this); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + private void initChat() { | ||
| 176 | + User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); | ||
| 177 | + final String faceurl = activeAccountInfo.getFaceurl(); | ||
| 178 | + final String nickname = activeAccountInfo.getNickname(); | ||
| 179 | + final int uid = activeAccountInfo.getUid(); | ||
| 180 | + | ||
| 181 | + if (uid != 0) { | ||
| 182 | + ChatUtil.connect(new CNUserInfo(uid + "", nickname, faceurl), messageContentInfo.onConnectListener); | ||
| 183 | + } else { | ||
| 184 | + ChatUtil.connect(messageContentInfo.onConnectListener); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + ChatUtil.setOnReceiveMessageListener(messageContentInfo.onReceiveMessageListener); | ||
| 188 | + | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + private void initMessageAdapter() { | ||
| 192 | + if (messageContentCommonAdapter == null) | ||
| 193 | + messageContentCommonAdapter = new CommonAdapter<>(getActivity(), R.layout.item_list_right, BR.user); | ||
| 194 | + UGCChatRoomFragment.this.fragmentChatBinding.setMessageAdapter(messageContentCommonAdapter); | ||
| 195 | + | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + private void initGiftAdapter() { | ||
| 199 | + fragmentChatBinding.imgGift.setOnClickListener(new View.OnClickListener() { | ||
| 200 | + @Override | ||
| 201 | + public void onClick(View view) { | ||
| 202 | +// int i = View.INVISIBLE == fragmentChatBinding.rlGift.getVisibility() ? View.VISIBLE : View.INVISIBLE; | ||
| 203 | +// SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", i); | ||
| 204 | +// fragmentChatBinding.rlGift.setVisibility(i); | ||
| 205 | + popGift.setData(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); | ||
| 206 | + popGift.showAtLocation(fragmentChatBinding.getRoot(),Gravity.BOTTOM| Gravity.CENTER_HORIZONTAL, 0, 200); | ||
| 207 | + | ||
| 208 | + } | ||
| 209 | + }); | ||
| 210 | +// GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 6); | ||
| 211 | +// fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager); | ||
| 212 | +// fragmentChatBinding.recyclerGift.addItemDecoration(new RecyclerSpace(10)); | ||
| 213 | + | ||
| 214 | +// fragmentChatBinding.setGiftAdapter(new GiftAdapter(roomId, getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + | ||
| 218 | + private void initDate() { | ||
| 219 | + imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, | ||
| 220 | + R.drawable.plane_small80, | ||
| 221 | + R.drawable.beer, R.drawable.chicken, | ||
| 222 | + R.drawable.cucumber, R.drawable.flower, | ||
| 223 | + R.drawable.hug, R.drawable.mouth, | ||
| 224 | + R.drawable.ring, R.drawable.rose, R.drawable.continuous}; | ||
| 225 | + gitName = new String[]{"跑车", "歼灭机", "飞机", "啤酒", | ||
| 226 | + "小鸡", "小黄瓜", "鲜花", "抱抱", "亲吻", "戒指", "玫瑰花", "荧光棒"}; | ||
| 227 | + giftArray = new ArrayList<>(); | ||
| 228 | + for (int i = 0; i < 12; i++) { | ||
| 229 | + giftArray.add(new GiftModle(gitName[i], imaSource[i])); | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 设置礼物 | ||
| 235 | + */ | ||
| 236 | + private void initGift() { | ||
| 237 | + fragmentChatBinding.sendMessage.setOnClickListener(new View.OnClickListener() { | ||
| 238 | + | ||
| 239 | + private InputUtil inputUtil; | ||
| 240 | + | ||
| 241 | + @Override | ||
| 242 | + public void onClick(View view) { | ||
| 243 | + inputUtil = new InputUtil(getContext(), UGCChatRoomFragment.this); | ||
| 244 | + inputUtil.showInput(view); | ||
| 245 | + } | ||
| 246 | + }); | ||
| 247 | + initGiftAdapter(); | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * 初始化监听事件 | ||
| 254 | + */ | ||
| 255 | + private void initListener() { | ||
| 256 | + barrageBottom(); | ||
| 257 | + initMessageAdapter(); | ||
| 258 | + messageContentInfo = new MessageContentInfo(); | ||
| 259 | + messageContentInfo.setOnReceiveAndSendListener(roomId, getActivity(), UGCChatRoomFragment.this); | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + | ||
| 263 | + public void giftItem(int postion) { | ||
| 264 | +// fragmentChatBinding.rlGift.setVisibility(View.INVISIBLE); | ||
| 265 | + | ||
| 266 | + messageContents.add(new MessageContent(messageContents.get(0).getName(), "送了" + gitName[postion] + ":", faceurl, false)); | ||
| 267 | + messageContentCommonAdapter.addItems((messageContents)); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + ArrayList<MessageContent> messageContents; | ||
| 271 | + | ||
| 272 | + /** | ||
| 273 | + * 聊天的回调接口 | ||
| 274 | + * | ||
| 275 | + * @param messageContents | ||
| 276 | + */ | ||
| 277 | + @Override | ||
| 278 | + public void onchat(ArrayList<MessageContent> messageContents) { | ||
| 279 | + this.messageContents = messageContents; | ||
| 280 | + messageContentCommonAdapter.addItems((messageContents)); | ||
| 281 | + | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * 弹幕 | ||
| 286 | + * | ||
| 287 | + * @param barrageBaseMessage | ||
| 288 | + */ | ||
| 289 | + @Override | ||
| 290 | + public void onbarrage(BarrageBaseMessage barrageBaseMessage) { | ||
| 291 | + barrageLayout.addMessage(barrageBaseMessage); | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + //在处理礼物返回问题 | ||
| 295 | + | ||
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * 接收页面 {@link PlayerActivity} | ||
| 299 | + * | ||
| 300 | + * @param event 处理 礼物出现后activity 和fragment的返回问题. | ||
| 301 | + */ | ||
| 302 | + @Subscribe(threadMode = ThreadMode.MAIN) //第2步:注册一个在后台线程执行的方法,用于接收事件 | ||
| 303 | + public void onUserEvent(MsgEvent event) { | ||
| 304 | + | ||
| 305 | +// fragmentChatBinding.rlGift.setVisibility(View.INVISIBLE); | ||
| 306 | +// SharedPreferencesHelper.getInstance(getActivity()).setValue("ishow", 4); | ||
| 307 | + | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | +} |
app/src/main/res/anim/push_bottom_in.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<!-- res/anim文件夹下定义 --> | ||
| 3 | +<!-- 名为push_bottom_in.xml --> | ||
| 4 | +<set xmlns:android="http://schemas.android.com/apk/res/android" > | ||
| 5 | + | ||
| 6 | + <translate | ||
| 7 | + android:duration="500" | ||
| 8 | + android:fromYDelta="100%p" | ||
| 9 | + android:toYDelta="0" /> | ||
| 10 | + | ||
| 11 | +</set> | ||
| 0 | \ No newline at end of file | 12 | \ No newline at end of file |
app/src/main/res/anim/push_buttom_out.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<!-- push_buttom_out.xml--> | ||
| 3 | +<set xmlns:android="http://schemas.android.com/apk/res/android" > | ||
| 4 | + | ||
| 5 | + <translate | ||
| 6 | + android:duration="500" | ||
| 7 | + android:fromYDelta="0" | ||
| 8 | + android:toYDelta="50%p" /> | ||
| 9 | +</set> | ||
| 0 | \ No newline at end of file | 10 | \ No newline at end of file |
app/src/main/res/layout/fragment_player_ugc_live.xml
| @@ -26,7 +26,9 @@ | @@ -26,7 +26,9 @@ | ||
| 26 | android:id="@+id/contentLayout" | 26 | android:id="@+id/contentLayout" |
| 27 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
| 28 | android:layout_height="200dp" | 28 | android:layout_height="200dp" |
| 29 | - android:layout_alignParentBottom="true"> | 29 | + android:layout_alignParentBottom="true" |
| 30 | + android:layout_alignParentLeft="true" | ||
| 31 | + android:layout_alignParentStart="true"> | ||
| 30 | 32 | ||
| 31 | </RelativeLayout> | 33 | </RelativeLayout> |
| 32 | 34 |
app/src/main/res/layout/fragment_ugc_chat.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
| 4 | + | ||
| 5 | + <data> | ||
| 6 | + | ||
| 7 | + <variable | ||
| 8 | + name="messageAdapter" | ||
| 9 | + type="com.cnlive.gundam.video.adpter.CommonAdapter" /> | ||
| 10 | + | ||
| 11 | + <variable | ||
| 12 | + name="giftAdapter" | ||
| 13 | + type="com.cnlive.gundam.video.adpter.GiftAdapter" /> | ||
| 14 | + </data> | ||
| 15 | + | ||
| 16 | + <RelativeLayout | ||
| 17 | + android:id="@+id/lin" | ||
| 18 | + android:layout_width="match_parent" | ||
| 19 | + android:layout_height="match_parent" | ||
| 20 | + android:background="@android:color/transparent"> | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + <ListView | ||
| 24 | + android:id="@+id/list_message" | ||
| 25 | + android:layout_width="match_parent" | ||
| 26 | + android:layout_height="match_parent" | ||
| 27 | + android:layout_above="@+id/edit_layout" | ||
| 28 | + android:layout_alignParentLeft="true" | ||
| 29 | + android:layout_alignParentStart="true" | ||
| 30 | + android:divider="@null" | ||
| 31 | + android:scrollbars="none" | ||
| 32 | + android:stackFromBottom="true" | ||
| 33 | + android:transcriptMode="alwaysScroll" | ||
| 34 | + app:Adapter="@{messageAdapter}" /> | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + <RelativeLayout | ||
| 38 | + android:id="@+id/edit_layout" | ||
| 39 | + android:layout_width="match_parent" | ||
| 40 | + android:layout_height="50dp" | ||
| 41 | + android:background="#22555756" | ||
| 42 | + android:orientation="horizontal" | ||
| 43 | + android:layout_alignParentBottom="true" | ||
| 44 | + android:layout_alignParentLeft="true" | ||
| 45 | + android:layout_alignParentStart="true"> | ||
| 46 | + | ||
| 47 | + <ImageView | ||
| 48 | + android:padding="4dp" | ||
| 49 | + android:id="@+id/sendMessage" | ||
| 50 | + android:layout_width="wrap_content" | ||
| 51 | + android:layout_height="wrap_content" | ||
| 52 | + android:layout_centerVertical="true" | ||
| 53 | + android:layout_marginLeft="5dp" | ||
| 54 | + android:src="@drawable/btn_send_message" /> | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + <ImageView | ||
| 58 | + android:layout_marginRight="20dp" | ||
| 59 | + android:layout_alignParentRight="true" | ||
| 60 | + android:id="@+id/img_gift" | ||
| 61 | + android:padding="6dp" | ||
| 62 | + android:layout_width="wrap_content" | ||
| 63 | + android:layout_height="wrap_content" | ||
| 64 | + android:layout_centerInParent="true" | ||
| 65 | + android:src="@drawable/gift" /> | ||
| 66 | + | ||
| 67 | + <android.support.v7.widget.SwitchCompat | ||
| 68 | + android:visibility="gone" | ||
| 69 | + android:id="@+id/barrage" | ||
| 70 | + android:layout_width="wrap_content" | ||
| 71 | + android:layout_height="wrap_content" | ||
| 72 | + android:layout_alignParentRight="true" | ||
| 73 | + android:layout_centerVertical="true" | ||
| 74 | + android:background="@null" | ||
| 75 | + android:textIsSelectable="false" | ||
| 76 | + android:thumb="@drawable/switch_thumb" | ||
| 77 | + app:switchMinWidth="30dp" | ||
| 78 | + app:track="@drawable/switch_track" /> | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + </RelativeLayout> | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + <!--<RelativeLayout--> | ||
| 85 | + <!--android:id="@+id/rl_gift"--> | ||
| 86 | + <!--android:layout_width="match_parent"--> | ||
| 87 | + <!--android:layout_height="wrap_content"--> | ||
| 88 | + <!--android:layout_above="@id/edit_layout"--> | ||
| 89 | + <!--android:background="#979797"--> | ||
| 90 | + <!--android:visibility="invisible">--> | ||
| 91 | + | ||
| 92 | + <!--<android.support.v7.widget.RecyclerView--> | ||
| 93 | + <!--android:padding="5dp"--> | ||
| 94 | + <!--android:id="@+id/recycler_gift"--> | ||
| 95 | + <!--android:layout_width="match_parent"--> | ||
| 96 | + <!--android:layout_height="wrap_content"--> | ||
| 97 | + <!--app:adapter="@{giftAdapter}" />--> | ||
| 98 | + | ||
| 99 | + <!--</RelativeLayout>--> | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + </RelativeLayout> | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +</layout> | ||
| 0 | \ No newline at end of file | 106 | \ No newline at end of file |
app/src/main/res/layout/layout_chat_input.xml
| @@ -29,15 +29,26 @@ | @@ -29,15 +29,26 @@ | ||
| 29 | android:paddingTop="9dp"> | 29 | android:paddingTop="9dp"> |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | - <LinearLayout | 32 | + <RelativeLayout |
| 33 | android:layout_width="match_parent" | 33 | android:layout_width="match_parent" |
| 34 | android:layout_height="30dp" | 34 | android:layout_height="30dp" |
| 35 | android:layout_centerVertical="true" | 35 | android:layout_centerVertical="true" |
| 36 | android:layout_marginLeft="8dp" | 36 | android:layout_marginLeft="8dp" |
| 37 | android:background="#ffffff" | 37 | android:background="#ffffff" |
| 38 | android:orientation="horizontal"> | 38 | android:orientation="horizontal"> |
| 39 | + <ImageView | ||
| 40 | + android:visibility="gone" | ||
| 41 | + android:id="@+id/emoticons_button" | ||
| 42 | + android:layout_width="30dp" | ||
| 43 | + android:layout_height="30dp" | ||
| 44 | + android:layout_centerVertical="true" | ||
| 45 | + android:layout_marginLeft="8dp" | ||
| 46 | + android:src="@drawable/expression_face_selector" /> | ||
| 39 | 47 | ||
| 40 | <EditText | 48 | <EditText |
| 49 | + android:layout_marginLeft="5dp" | ||
| 50 | + android:layout_toLeftOf="@+id/send" | ||
| 51 | + android:layout_toRightOf="@+id/emoticons_button" | ||
| 41 | android:id="@+id/chat_content" | 52 | android:id="@+id/chat_content" |
| 42 | android:layout_width="match_parent" | 53 | android:layout_width="match_parent" |
| 43 | android:layout_height="match_parent" | 54 | android:layout_height="match_parent" |
| @@ -51,7 +62,22 @@ | @@ -51,7 +62,22 @@ | ||
| 51 | android:textColor="#323333" | 62 | android:textColor="#323333" |
| 52 | android:textColorHint="#c3c3c9" | 63 | android:textColorHint="#c3c3c9" |
| 53 | android:textSize="16sp" /> | 64 | android:textSize="16sp" /> |
| 54 | - </LinearLayout> | 65 | + |
| 66 | + <TextView | ||
| 67 | + android:visibility="gone" | ||
| 68 | + android:id="@+id/send" | ||
| 69 | + android:layout_width="50dp" | ||
| 70 | + android:layout_height="30dp" | ||
| 71 | + android:layout_alignParentRight="true" | ||
| 72 | + android:layout_centerVertical="true" | ||
| 73 | + android:layout_marginLeft="8dp" | ||
| 74 | + android:layout_marginRight="8dp" | ||
| 75 | + android:background="@drawable/btn_send_chat_selector" | ||
| 76 | + android:gravity="center" | ||
| 77 | + android:text="发送" | ||
| 78 | + android:textColor="@color/chat_send_text" | ||
| 79 | + android:textSize="16sp" /> | ||
| 80 | + </RelativeLayout> | ||
| 55 | 81 | ||
| 56 | </RelativeLayout> | 82 | </RelativeLayout> |
| 57 | 83 |
app/src/main/res/layout/layout_popupwindow_gift.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
| 3 | + | ||
| 4 | + <data> | ||
| 5 | + | ||
| 6 | + <variable | ||
| 7 | + name="giftAdapter" | ||
| 8 | + type="com.cnlive.gundam.video.adpter.GiftAdapter" /> | ||
| 9 | + | ||
| 10 | + </data> | ||
| 11 | + | ||
| 12 | + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 13 | + android:id="@+id/pop_rl" | ||
| 14 | + | ||
| 15 | + android:layout_width="match_parent" | ||
| 16 | + android:layout_height="wrap_content" | ||
| 17 | + android:orientation="vertical"> | ||
| 18 | + | ||
| 19 | + <android.support.v7.widget.RecyclerView | ||
| 20 | + | ||
| 21 | + android:id="@+id/pop_recycle" | ||
| 22 | + android:layout_width="match_parent" | ||
| 23 | + android:layout_height="wrap_content" | ||
| 24 | + | ||
| 25 | + android:padding="5dp" | ||
| 26 | + app:adapter="@{giftAdapter}" /> | ||
| 27 | + </RelativeLayout> | ||
| 28 | + | ||
| 29 | +</layout> | ||
| 0 | \ No newline at end of file | 30 | \ No newline at end of file |
app/src/main/res/values/styles.xml
| @@ -20,4 +20,13 @@ | @@ -20,4 +20,13 @@ | ||
| 20 | <item name="android:windowBackground">@color/transparent</item><!--背景透明--> | 20 | <item name="android:windowBackground">@color/transparent</item><!--背景透明--> |
| 21 | <item name="android:backgroundDimEnabled">false</item><!--模糊--> | 21 | <item name="android:backgroundDimEnabled">false</item><!--模糊--> |
| 22 | </style> | 22 | </style> |
| 23 | + | ||
| 24 | + <!--礼物弹出框的动画的style--> | ||
| 25 | + <style name="gift_popwindow_anim_style"> | ||
| 26 | + <item name="android:windowEnterAnimation">@anim/push_bottom_in</item> | ||
| 27 | + <!-- 指定显示的动画xml --> | ||
| 28 | + | ||
| 29 | + <item name="android:windowExitAnimation">@anim/push_buttom_out</item> | ||
| 30 | + <!-- 指定消失的动画xml --> | ||
| 31 | + </style> | ||
| 23 | </resources> | 32 | </resources> |