Commit abfdfe1a279706398e5e6bf78f555ebe1f302a79
1 parent
94d8abb3
修改送礼物信息
Showing
2 changed files
with
24 additions
and
5 deletions
app/src/main/java/com/cnlive/gundam/video/adpter/GiftAdapter.java
| ... | ... | @@ -7,9 +7,10 @@ import android.support.v7.widget.RecyclerView; |
| 7 | 7 | import android.view.LayoutInflater; |
| 8 | 8 | import android.view.View; |
| 9 | 9 | import android.view.ViewGroup; |
| 10 | -import android.widget.Toast; | |
| 11 | 10 | |
| 12 | 11 | import com.cnlive.gundam.R; |
| 12 | +import com.cnlive.gundam.video.activity.PlayerActivity; | |
| 13 | +import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; | |
| 13 | 14 | import com.cnlive.gundam.video.model.CNMessageModle; |
| 14 | 15 | import com.cnlive.gundam.video.model.GiftModle; |
| 15 | 16 | import com.cnlive.gundam.video.model.MessageInfo; |
| ... | ... | @@ -52,7 +53,7 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | @Override |
| 55 | - public void onBindViewHolder(RVHolder holder, final int position) { | |
| 56 | + public void onBindViewHolder(final RVHolder holder, final int position) { | |
| 56 | 57 | holder.binding.setVariable(mVariableId, mDataList.get(position)); |
| 57 | 58 | holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { |
| 58 | 59 | @Override |
| ... | ... | @@ -68,7 +69,10 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 68 | 69 | |
| 69 | 70 | @Override |
| 70 | 71 | public void onSuccess(CNMessage message) { |
| 71 | - Toast.makeText(mContext,mDataList.get(position).getGiftMessage(),Toast.LENGTH_SHORT).show(); | |
| 72 | + PlayerActivity context = (PlayerActivity) GiftAdapter.this.mContext; | |
| 73 | + | |
| 74 | + ChatRoomFragment chatRoomFragment = (ChatRoomFragment) context.getSupportFragmentManager().findFragmentByTag("chatRoomFragment"); | |
| 75 | + chatRoomFragment.giftItem(position); | |
| 72 | 76 | |
| 73 | 77 | } |
| 74 | 78 | ... | ... |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
| ... | ... | @@ -8,11 +8,13 @@ import android.support.v4.app.Fragment; |
| 8 | 8 | import android.support.v7.widget.GridLayoutManager; |
| 9 | 9 | import android.support.v7.widget.OrientationHelper; |
| 10 | 10 | import android.support.v7.widget.SwitchCompat; |
| 11 | +import android.util.Log; | |
| 11 | 12 | import android.view.LayoutInflater; |
| 12 | 13 | import android.view.View; |
| 13 | 14 | import android.view.ViewGroup; |
| 14 | 15 | import android.widget.CompoundButton; |
| 15 | 16 | import android.widget.ImageView; |
| 17 | +import android.widget.Toast; | |
| 16 | 18 | |
| 17 | 19 | import com.bumptech.glide.Glide; |
| 18 | 20 | import com.cnlive.gundam.BR; |
| ... | ... | @@ -51,6 +53,8 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 51 | 53 | public SwitchCompat switchCompatBottom; |
| 52 | 54 | private BarrageLayout barrageLayout; |
| 53 | 55 | private String roomId; |
| 56 | + private int[] imaSource; | |
| 57 | + private String[] gitName; | |
| 54 | 58 | |
| 55 | 59 | |
| 56 | 60 | public static ChatRoomFragment newInstance(String id ) { |
| ... | ... | @@ -177,13 +181,13 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 177 | 181 | |
| 178 | 182 | |
| 179 | 183 | private void initDate() { |
| 180 | - int[] imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, | |
| 184 | + imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, | |
| 181 | 185 | R.drawable.plane_small80, |
| 182 | 186 | R.drawable.beer, R.drawable.chicken, |
| 183 | 187 | R.drawable.cucumber, R.drawable.flower, |
| 184 | 188 | R.drawable.hug, R.drawable.mouth, |
| 185 | 189 | R.drawable.ring, R.drawable.rose, R.drawable.continuous}; |
| 186 | - String[] gitName = new String[]{"跑车", "歼灭机", "飞机", "啤酒", | |
| 190 | + gitName = new String[]{"跑车", "歼灭机", "飞机", "啤酒", | |
| 187 | 191 | "小鸡", "小黄瓜", "鲜花", "抱抱", "亲吻", "戒指", "玫瑰花", "荧光棒"}; |
| 188 | 192 | giftArray = new ArrayList<>(); |
| 189 | 193 | for (int i = 0; i < 12; i++) { |
| ... | ... | @@ -249,4 +253,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback |
| 249 | 253 | } |
| 250 | 254 | |
| 251 | 255 | |
| 256 | + public void giftItem(int postion){ | |
| 257 | + Toast.makeText(getActivity(),gitName[postion],Toast.LENGTH_SHORT).show(); | |
| 258 | + Log.d("giftItem", "giftItem: " +gitName[postion]); | |
| 259 | + int i = imaSource[postion]; | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + } | |
| 265 | + | |
| 266 | + | |
| 252 | 267 | } | ... | ... |