Commit 9ccd584bb70dd2a75466c8ff6ceb3bd07d1e8003
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/CNLiveApp
Showing
9 changed files
with
88 additions
and
68 deletions
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
| @@ -8,7 +8,6 @@ import android.support.v4.app.Fragment; | @@ -8,7 +8,6 @@ import android.support.v4.app.Fragment; | ||
| 8 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
| 11 | -import android.widget.TextView; | ||
| 12 | 11 | ||
| 13 | import com.bumptech.glide.Glide; | 12 | import com.bumptech.glide.Glide; |
| 14 | import com.cnlive.gundam.R; | 13 | import com.cnlive.gundam.R; |
| @@ -49,8 +48,7 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -49,8 +48,7 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 49 | } | 48 | } |
| 50 | 49 | ||
| 51 | private void initUI() { | 50 | private void initUI() { |
| 52 | - TextView titleText = binding.getRoot().findViewById(R.id.toobar_tv); | ||
| 53 | - if (titleText != null) titleText.setText("我 的"); | 51 | + binding.toobar.toobarTv.setText("我 的"); |
| 54 | binding.configHeader.setOnClickListener(this); | 52 | binding.configHeader.setOnClickListener(this); |
| 55 | binding.message.setOnClickListener(this); | 53 | binding.message.setOnClickListener(this); |
| 56 | } | 54 | } |
app/src/main/java/com/cnlive/gundam/stream/ui/activity/StreamActivity.java
| @@ -103,8 +103,8 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | @@ -103,8 +103,8 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | ||
| 103 | showView.setChatView(false); | 103 | showView.setChatView(false); |
| 104 | showView.setViewers(false); | 104 | showView.setViewers(false); |
| 105 | binding.setIsShow(showView); | 105 | binding.setIsShow(showView); |
| 106 | - binding.chatRecyclerView.setLayoutManager(new LinearLayoutManager(this)); | ||
| 107 | chatItemList = new ArrayList<>(); | 106 | chatItemList = new ArrayList<>(); |
| 107 | + initChatRoomRecycel(); | ||
| 108 | timerUtil = new TimerUtil(this); | 108 | timerUtil = new TimerUtil(this); |
| 109 | 109 | ||
| 110 | accelerometerSensor = new AccelerometerSensor(this); | 110 | accelerometerSensor = new AccelerometerSensor(this); |
| @@ -123,6 +123,13 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | @@ -123,6 +123,13 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | ||
| 123 | orientationChange(); | 123 | orientationChange(); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | + private void initChatRoomRecycel() { | ||
| 127 | + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); | ||
| 128 | + linearLayoutManager.setStackFromEnd(true); | ||
| 129 | + binding.chatRecyclerView.setLayoutManager(linearLayoutManager); | ||
| 130 | + chatAdapter = new SimpleAdapter(this, R.layout.item_chat, com.cnlive.gundam.BR.chat); | ||
| 131 | + } | ||
| 132 | + | ||
| 126 | private void initData() { | 133 | private void initData() { |
| 127 | activityId = getIntent().getStringExtra("activityId"); | 134 | activityId = getIntent().getStringExtra("activityId"); |
| 128 | channelId = getIntent().getStringExtra("channelId"); | 135 | channelId = getIntent().getStringExtra("channelId"); |
| @@ -427,8 +434,10 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | @@ -427,8 +434,10 @@ public class StreamActivity extends BaseStreamActivity implements ChatConnect.Ch | ||
| 427 | } catch (Exception e) { | 434 | } catch (Exception e) { |
| 428 | e.printStackTrace(); | 435 | e.printStackTrace(); |
| 429 | } | 436 | } |
| 430 | - chatAdapter = new SimpleAdapter(this, chatItemList, R.layout.item_chat, com.cnlive.gundam.BR.chat); | 437 | + |
| 438 | + chatAdapter.addItems(chatItemList); | ||
| 431 | binding.setChatAdapter(chatAdapter); | 439 | binding.setChatAdapter(chatAdapter); |
| 440 | + | ||
| 432 | } | 441 | } |
| 433 | 442 | ||
| 434 | private void getOnlinePerson() { | 443 | private void getOnlinePerson() { |
app/src/main/java/com/cnlive/gundam/stream/ui/adapter/SimpleAdapter.java
| @@ -8,6 +8,7 @@ import android.view.LayoutInflater; | @@ -8,6 +8,7 @@ import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | 10 | ||
| 11 | +import java.util.ArrayList; | ||
| 11 | import java.util.List; | 12 | import java.util.List; |
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| @@ -21,13 +22,18 @@ public class SimpleAdapter<T> extends RecyclerView.Adapter<SimpleAdapter.ViewHol | @@ -21,13 +22,18 @@ public class SimpleAdapter<T> extends RecyclerView.Adapter<SimpleAdapter.ViewHol | ||
| 21 | private int variableId; | 22 | private int variableId; |
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | - public SimpleAdapter(Context mContext, List<T> activeInfoList, int layoutId, int variableId) { | 25 | + public SimpleAdapter(Context mContext, int layoutId, int variableId) { |
| 25 | this.mContext = mContext; | 26 | this.mContext = mContext; |
| 26 | - this.activeInfoList = activeInfoList; | 27 | + if(activeInfoList==null){this.activeInfoList = new ArrayList<>();} |
| 27 | this.layoutId = layoutId; | 28 | this.layoutId = layoutId; |
| 28 | this.variableId = variableId; | 29 | this.variableId = variableId; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 32 | + public void addItems(List<T> items){ | ||
| 33 | + if(items == null) return ; | ||
| 34 | + this.activeInfoList=items; | ||
| 35 | + } | ||
| 36 | + | ||
| 31 | @Override | 37 | @Override |
| 32 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 38 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 33 | LayoutInflater inflater = LayoutInflater.from(parent.getContext()); | 39 | LayoutInflater inflater = LayoutInflater.from(parent.getContext()); |
app/src/main/java/com/cnlive/gundam/user/activity/LoginActivity.java
| 1 | package com.cnlive.gundam.user.activity; | 1 | package com.cnlive.gundam.user.activity; |
| 2 | 2 | ||
| 3 | -import android.content.Context; | ||
| 4 | import android.databinding.DataBindingUtil; | 3 | import android.databinding.DataBindingUtil; |
| 5 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 6 | -import android.view.MotionEvent; | ||
| 7 | -import android.view.View; | ||
| 8 | -import android.view.inputmethod.InputMethodManager; | ||
| 9 | 5 | ||
| 10 | import com.cnlive.gundam.R; | 6 | import com.cnlive.gundam.R; |
| 11 | import com.cnlive.gundam.user.auth.AccountAuthenticatorActivity; | 7 | import com.cnlive.gundam.user.auth.AccountAuthenticatorActivity; |
| 12 | import com.cnlive.gundam.user.fragment.LoginFragment; | 8 | import com.cnlive.gundam.user.fragment.LoginFragment; |
| 13 | -import com.cnlive.gundam.user.util.DevilUtil; | ||
| 14 | 9 | ||
| 15 | 10 | ||
| 16 | /** | 11 | /** |
| @@ -26,20 +21,4 @@ public class LoginActivity extends AccountAuthenticatorActivity { | @@ -26,20 +21,4 @@ public class LoginActivity extends AccountAuthenticatorActivity { | ||
| 26 | getSupportFragmentManager().beginTransaction().replace(R.id.login_fragment, LoginFragment.newInstance()).commit(); | 21 | getSupportFragmentManager().beginTransaction().replace(R.id.login_fragment, LoginFragment.newInstance()).commit(); |
| 27 | } | 22 | } |
| 28 | 23 | ||
| 29 | - /** | ||
| 30 | - * 隐藏软键盘 | ||
| 31 | - */ | ||
| 32 | - @Override | ||
| 33 | - public boolean dispatchTouchEvent(MotionEvent ev){ | ||
| 34 | - // TODO Auto-generated method stub | ||
| 35 | - if(ev.getAction()== MotionEvent.ACTION_DOWN){ | ||
| 36 | - | ||
| 37 | - View v=getCurrentFocus(); | ||
| 38 | - if(DevilUtil.isShouldHideInput(v,ev)){ | ||
| 39 | - InputMethodManager im=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | ||
| 40 | - DevilUtil.hideSoftInput(v.getWindowToken(),im); | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - return super.dispatchTouchEvent(ev); | ||
| 44 | - } | ||
| 45 | } | 24 | } |
app/src/main/java/com/cnlive/gundam/video/adpter/CommonAdapter.java
| @@ -12,6 +12,7 @@ import android.widget.LinearLayout; | @@ -12,6 +12,7 @@ import android.widget.LinearLayout; | ||
| 12 | import com.cnlive.gundam.databinding.ItemListRightBinding; | 12 | import com.cnlive.gundam.databinding.ItemListRightBinding; |
| 13 | import com.cnlive.gundam.video.model.MessageContent; | 13 | import com.cnlive.gundam.video.model.MessageContent; |
| 14 | 14 | ||
| 15 | +import java.util.ArrayList; | ||
| 15 | import java.util.List; | 16 | import java.util.List; |
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| @@ -29,12 +30,17 @@ public class CommonAdapter<T> extends BaseAdapter { | @@ -29,12 +30,17 @@ public class CommonAdapter<T> extends BaseAdapter { | ||
| 29 | this.mContext = context; | 30 | this.mContext = context; |
| 30 | this.layoutId = layoutId; | 31 | this.layoutId = layoutId; |
| 31 | this.variableId = variableId; | 32 | this.variableId = variableId; |
| 33 | + this.mDataList= new ArrayList<>(); | ||
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | - public void setDataList(List<T> dataList){ | ||
| 35 | - this.mDataList= dataList; | 36 | + public void addItems(List<T> items){ |
| 37 | + if(items == null) return ; | ||
| 38 | + this.mDataList=items; | ||
| 39 | + notifyDataSetChanged(); | ||
| 36 | } | 40 | } |
| 37 | 41 | ||
| 42 | + | ||
| 43 | + | ||
| 38 | @Override | 44 | @Override |
| 39 | public int getCount() { return mDataList.size(); } | 45 | public int getCount() { return mDataList.size(); } |
| 40 | 46 |
app/src/main/java/com/cnlive/gundam/video/adpter/GiftAdapter.java
| @@ -7,9 +7,10 @@ import android.support.v7.widget.RecyclerView; | @@ -7,9 +7,10 @@ import android.support.v7.widget.RecyclerView; | ||
| 7 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | -import android.widget.Toast; | ||
| 11 | 10 | ||
| 12 | import com.cnlive.gundam.R; | 11 | import com.cnlive.gundam.R; |
| 12 | +import com.cnlive.gundam.video.activity.PlayerActivity; | ||
| 13 | +import com.cnlive.gundam.video.fragment.chat.ChatRoomFragment; | ||
| 13 | import com.cnlive.gundam.video.model.CNMessageModle; | 14 | import com.cnlive.gundam.video.model.CNMessageModle; |
| 14 | import com.cnlive.gundam.video.model.GiftModle; | 15 | import com.cnlive.gundam.video.model.GiftModle; |
| 15 | import com.cnlive.gundam.video.model.MessageInfo; | 16 | import com.cnlive.gundam.video.model.MessageInfo; |
| @@ -52,7 +53,7 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | @@ -52,7 +53,7 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | @Override | 55 | @Override |
| 55 | - public void onBindViewHolder(RVHolder holder, final int position) { | 56 | + public void onBindViewHolder(final RVHolder holder, final int position) { |
| 56 | holder.binding.setVariable(mVariableId, mDataList.get(position)); | 57 | holder.binding.setVariable(mVariableId, mDataList.get(position)); |
| 57 | holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { | 58 | holder.binding.getRoot().findViewById(R.id.ll_item).setOnClickListener(new View.OnClickListener() { |
| 58 | @Override | 59 | @Override |
| @@ -68,7 +69,10 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | @@ -68,7 +69,10 @@ public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | ||
| 68 | 69 | ||
| 69 | @Override | 70 | @Override |
| 70 | public void onSuccess(CNMessage message) { | 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,11 +8,13 @@ import android.support.v4.app.Fragment; | ||
| 8 | import android.support.v7.widget.GridLayoutManager; | 8 | import android.support.v7.widget.GridLayoutManager; |
| 9 | import android.support.v7.widget.OrientationHelper; | 9 | import android.support.v7.widget.OrientationHelper; |
| 10 | import android.support.v7.widget.SwitchCompat; | 10 | import android.support.v7.widget.SwitchCompat; |
| 11 | +import android.util.Log; | ||
| 11 | import android.view.LayoutInflater; | 12 | import android.view.LayoutInflater; |
| 12 | import android.view.View; | 13 | import android.view.View; |
| 13 | import android.view.ViewGroup; | 14 | import android.view.ViewGroup; |
| 14 | import android.widget.CompoundButton; | 15 | import android.widget.CompoundButton; |
| 15 | import android.widget.ImageView; | 16 | import android.widget.ImageView; |
| 17 | +import android.widget.Toast; | ||
| 16 | 18 | ||
| 17 | import com.bumptech.glide.Glide; | 19 | import com.bumptech.glide.Glide; |
| 18 | import com.cnlive.gundam.BR; | 20 | import com.cnlive.gundam.BR; |
| @@ -43,7 +45,7 @@ import java.util.ArrayList; | @@ -43,7 +45,7 @@ import java.util.ArrayList; | ||
| 43 | */ | 45 | */ |
| 44 | public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.SendAndRecevieSucessCall { | 46 | public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.SendAndRecevieSucessCall { |
| 45 | 47 | ||
| 46 | - | 48 | + PlayerControllerView.SwitchCompatChangeListener switchCompatChangeListener; |
| 47 | private FragmentChatBinding fragmentChatBinding; | 49 | private FragmentChatBinding fragmentChatBinding; |
| 48 | private ArrayList<GiftModle> giftArray; | 50 | private ArrayList<GiftModle> giftArray; |
| 49 | private CommonAdapter<MessageContent> messageContentCommonAdapter; | 51 | private CommonAdapter<MessageContent> messageContentCommonAdapter; |
| @@ -51,6 +53,8 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -51,6 +53,8 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 51 | public SwitchCompat switchCompatBottom; | 53 | public SwitchCompat switchCompatBottom; |
| 52 | private BarrageLayout barrageLayout; | 54 | private BarrageLayout barrageLayout; |
| 53 | private String roomId; | 55 | private String roomId; |
| 56 | + private int[] imaSource; | ||
| 57 | + private String[] gitName; | ||
| 54 | 58 | ||
| 55 | 59 | ||
| 56 | public static ChatRoomFragment newInstance(String id ) { | 60 | public static ChatRoomFragment newInstance(String id ) { |
| @@ -71,7 +75,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -71,7 +75,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 71 | 75 | ||
| 72 | } | 76 | } |
| 73 | 77 | ||
| 74 | - PlayerControllerView.SwitchCompatChangeListener switchCompatChangeListener; | ||
| 75 | @Override | 78 | @Override |
| 76 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 79 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 77 | super.onViewCreated(view, savedInstanceState); | 80 | super.onViewCreated(view, savedInstanceState); |
| @@ -126,15 +129,12 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -126,15 +129,12 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 126 | 129 | ||
| 127 | @Override | 130 | @Override |
| 128 | public void sentSucess(ArrayList<MessageContent> messageContents) { | 131 | public void sentSucess(ArrayList<MessageContent> messageContents) { |
| 129 | - | ||
| 130 | - messageContentCommonAdapter.setDataList((messageContents)); | ||
| 131 | - ChatRoomFragment.this.fragmentChatBinding.setMessageAdapter(messageContentCommonAdapter); | 132 | + messageContentCommonAdapter.addItems((messageContents)); |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | @Override | 135 | @Override |
| 135 | public void receaviceSucess(ArrayList<MessageContent> messageContents) { | 136 | public void receaviceSucess(ArrayList<MessageContent> messageContents) { |
| 136 | - messageContentCommonAdapter.setDataList((messageContents)); | ||
| 137 | - ChatRoomFragment.this.fragmentChatBinding.setMessageAdapter(messageContentCommonAdapter); | 137 | + messageContentCommonAdapter.addItems((messageContents)); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | 140 | ||
| @@ -144,10 +144,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -144,10 +144,6 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 144 | ChatUtil.disconnect(false); | 144 | ChatUtil.disconnect(false); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | - | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - | ||
| 151 | private void initChat() { | 147 | private void initChat() { |
| 152 | User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); | 148 | User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); |
| 153 | String faceurl = activeAccountInfo.getFaceurl(); | 149 | String faceurl = activeAccountInfo.getFaceurl(); |
| @@ -165,6 +161,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -165,6 +161,7 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 165 | private void initMessageAdapter() { | 161 | private void initMessageAdapter() { |
| 166 | if (messageContentCommonAdapter == null) | 162 | if (messageContentCommonAdapter == null) |
| 167 | messageContentCommonAdapter = new CommonAdapter<>(getActivity(), R.layout.item_list_right, BR.user); | 163 | messageContentCommonAdapter = new CommonAdapter<>(getActivity(), R.layout.item_list_right, BR.user); |
| 164 | + ChatRoomFragment.this.fragmentChatBinding.setMessageAdapter(messageContentCommonAdapter); | ||
| 168 | 165 | ||
| 169 | } | 166 | } |
| 170 | 167 | ||
| @@ -184,13 +181,13 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -184,13 +181,13 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 184 | 181 | ||
| 185 | 182 | ||
| 186 | private void initDate() { | 183 | private void initDate() { |
| 187 | - int[] imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, | 184 | + imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, |
| 188 | R.drawable.plane_small80, | 185 | R.drawable.plane_small80, |
| 189 | R.drawable.beer, R.drawable.chicken, | 186 | R.drawable.beer, R.drawable.chicken, |
| 190 | R.drawable.cucumber, R.drawable.flower, | 187 | R.drawable.cucumber, R.drawable.flower, |
| 191 | R.drawable.hug, R.drawable.mouth, | 188 | R.drawable.hug, R.drawable.mouth, |
| 192 | R.drawable.ring, R.drawable.rose, R.drawable.continuous}; | 189 | R.drawable.ring, R.drawable.rose, R.drawable.continuous}; |
| 193 | - String[] gitName = new String[]{"跑车", "歼灭机", "飞机", "啤酒", | 190 | + gitName = new String[]{"跑车", "歼灭机", "飞机", "啤酒", |
| 194 | "小鸡", "小黄瓜", "鲜花", "抱抱", "亲吻", "戒指", "玫瑰花", "荧光棒"}; | 191 | "小鸡", "小黄瓜", "鲜花", "抱抱", "亲吻", "戒指", "玫瑰花", "荧光棒"}; |
| 195 | giftArray = new ArrayList<>(); | 192 | giftArray = new ArrayList<>(); |
| 196 | for (int i = 0; i < 12; i++) { | 193 | for (int i = 0; i < 12; i++) { |
| @@ -256,4 +253,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -256,4 +253,15 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 256 | } | 253 | } |
| 257 | 254 | ||
| 258 | 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 | + | ||
| 259 | } | 267 | } |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/MessageContentInfo.java
| @@ -37,11 +37,13 @@ public class MessageContentInfo { | @@ -37,11 +37,13 @@ public class MessageContentInfo { | ||
| 37 | private String JoinType = "joinType"; | 37 | private String JoinType = "joinType"; |
| 38 | private String ChatRoom = "chatRoom"; | 38 | private String ChatRoom = "chatRoom"; |
| 39 | private String giftType = "giftType"; | 39 | private String giftType = "giftType"; |
| 40 | + private Gson gson; | ||
| 40 | 41 | ||
| 41 | 42 | ||
| 42 | public void setOnReceiveAndSendListener(BarrageLayout barrageLayout, String roomID, Context context, SendAndRecevieSucessCall sendAndRecevieSucessCall) { | 43 | public void setOnReceiveAndSendListener(BarrageLayout barrageLayout, String roomID, Context context, SendAndRecevieSucessCall sendAndRecevieSucessCall) { |
| 43 | this.roomId = roomID; | 44 | this.roomId = roomID; |
| 44 | this.mContext = context; | 45 | this.mContext = context; |
| 46 | + gson = new Gson(); | ||
| 45 | this.mSendAndRecevieSucessCall = sendAndRecevieSucessCall; | 47 | this.mSendAndRecevieSucessCall = sendAndRecevieSucessCall; |
| 46 | mHandler = new Handler(); | 48 | mHandler = new Handler(); |
| 47 | messageContentArrayList = new ArrayList<>(); | 49 | messageContentArrayList = new ArrayList<>(); |
| @@ -63,7 +65,7 @@ public class MessageContentInfo { | @@ -63,7 +65,7 @@ public class MessageContentInfo { | ||
| 63 | public void run() { | 65 | public void run() { |
| 64 | try { | 66 | try { |
| 65 | 67 | ||
| 66 | - Gson gson = new Gson(); | 68 | + |
| 67 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); | 69 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); |
| 68 | String messagecontent = cnMessageModle.getMessage().getContent(); | 70 | String messagecontent = cnMessageModle.getMessage().getContent(); |
| 69 | String messageType = cnMessageModle.getType(); | 71 | String messageType = cnMessageModle.getType(); |
| @@ -115,7 +117,6 @@ public class MessageContentInfo { | @@ -115,7 +117,6 @@ public class MessageContentInfo { | ||
| 115 | 117 | ||
| 116 | try { | 118 | try { |
| 117 | 119 | ||
| 118 | - Gson gson = new Gson(); | ||
| 119 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); | 120 | CNMessageModle cnMessageModle = gson.fromJson(message.getContent(), CNMessageModle.class); |
| 120 | String messagecontent = cnMessageModle.getMessage().getContent(); | 121 | String messagecontent = cnMessageModle.getMessage().getContent(); |
| 121 | String messageType = cnMessageModle.getType(); | 122 | String messageType = cnMessageModle.getType(); |
| @@ -169,8 +170,7 @@ public class MessageContentInfo { | @@ -169,8 +170,7 @@ public class MessageContentInfo { | ||
| 169 | @Override | 170 | @Override |
| 170 | public void onSuccess(int what, String extra) { | 171 | public void onSuccess(int what, String extra) { |
| 171 | CNMessageModle cnMessageModle = new CNMessageModle(JoinType, new MessageInfo("", "", "", "", "")); | 172 | CNMessageModle cnMessageModle = new CNMessageModle(JoinType, new MessageInfo("", "", "", "", "")); |
| 172 | - Gson gson2 = new Gson(); | ||
| 173 | - String obj2 = gson2.toJson(cnMessageModle); | 173 | + String obj2 = gson.toJson(cnMessageModle); |
| 174 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, onSendMessageListener); | 174 | ChatUtil.sendMessage(IChat.CHATROOM, roomId, obj2, onSendMessageListener); |
| 175 | } | 175 | } |
| 176 | 176 |
app/src/main/res/layout/item_toolbar.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - > | 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> |
| 4 | 3 | ||
| 5 | <RelativeLayout | 4 | <RelativeLayout |
| 6 | android:id="@+id/toobar" | 5 | android:id="@+id/toobar" |
| 7 | android:layout_width="match_parent" | 6 | android:layout_width="match_parent" |
| 8 | - android:layout_height="50dp"> | 7 | + android:layout_height="60dp" |
| 8 | + > | ||
| 9 | 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" /> | 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 | 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> | 20 | + <View |
| 21 | + android:id="@+id/view" | ||
| 22 | + android:layout_width="match_parent" | ||
| 23 | + android:layout_height="@dimen/_10px" | ||
| 24 | + android:layout_alignParentBottom="true" | ||
| 25 | + android:background="@color/gray_bg" /> | ||
| 26 | + | ||
| 27 | + <View | ||
| 28 | + android:id="@+id/line" | ||
| 29 | + android:layout_width="match_parent" | ||
| 30 | + android:layout_height="1px" | ||
| 31 | + android:layout_above="@id/view" | ||
| 32 | + android:background="@color/gray_line_color" /> | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + </RelativeLayout> | ||
| 26 | 36 | ||
| 27 | </layout> | 37 | </layout> |
| 28 | \ No newline at end of file | 38 | \ No newline at end of file |