Commit 149c7a66b92d87242bc587a8ce7bc1ebab02dc14
1 parent
6c56b92a
6.0聊天室权限认证,添加签名信息,更新Jar
Showing
6 changed files
with
40 additions
and
7 deletions
app/build.gradle
| @@ -11,13 +11,28 @@ android { | @@ -11,13 +11,28 @@ android { | ||
| 11 | versionName "1.0" | 11 | versionName "1.0" |
| 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| 13 | } | 13 | } |
| 14 | + | ||
| 14 | dataBinding { | 15 | dataBinding { |
| 15 | enabled true | 16 | enabled true |
| 16 | } | 17 | } |
| 18 | + | ||
| 19 | + signingConfigs { | ||
| 20 | + myConfig { | ||
| 21 | + storeFile file("cnlive_app.jks") | ||
| 22 | + storePassword "000000" | ||
| 23 | + keyAlias "CNliveApp" | ||
| 24 | + keyPassword "000000" | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + | ||
| 17 | buildTypes { | 28 | buildTypes { |
| 29 | + debug{ | ||
| 30 | + signingConfig signingConfigs.myConfig | ||
| 31 | + } | ||
| 18 | release { | 32 | release { |
| 19 | minifyEnabled false | 33 | minifyEnabled false |
| 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 35 | + signingConfig signingConfigs.myConfig | ||
| 21 | } | 36 | } |
| 22 | } | 37 | } |
| 23 | } | 38 | } |
app/cnlive_app.jks
0 → 100644
No preview for this file type
app/libs/libcnlivelive.jar
No preview for this file type
app/libs/libcnliveutil.jar
No preview for this file type
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
| 1 | package com.cnlive.gundam.video.fragment.chat; | 1 | package com.cnlive.gundam.video.fragment.chat; |
| 2 | 2 | ||
| 3 | +import android.Manifest; | ||
| 4 | +import android.content.pm.PackageManager; | ||
| 3 | import android.databinding.BindingAdapter; | 5 | import android.databinding.BindingAdapter; |
| 4 | import android.databinding.DataBindingUtil; | 6 | import android.databinding.DataBindingUtil; |
| 5 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 8 | +import android.support.annotation.NonNull; | ||
| 6 | import android.support.annotation.Nullable; | 9 | import android.support.annotation.Nullable; |
| 7 | import android.support.v4.app.Fragment; | 10 | import android.support.v4.app.Fragment; |
| 11 | +import android.support.v4.content.ContextCompat; | ||
| 8 | import android.support.v7.widget.GridLayoutManager; | 12 | import android.support.v7.widget.GridLayoutManager; |
| 9 | import android.support.v7.widget.SwitchCompat; | 13 | import android.support.v7.widget.SwitchCompat; |
| 10 | import android.view.LayoutInflater; | 14 | import android.view.LayoutInflater; |
| @@ -20,6 +24,7 @@ import com.cnlive.gundam.databinding.FragmentChatBinding; | @@ -20,6 +24,7 @@ import com.cnlive.gundam.databinding.FragmentChatBinding; | ||
| 20 | import com.cnlive.gundam.user.auth.UserService; | 24 | import com.cnlive.gundam.user.auth.UserService; |
| 21 | import com.cnlive.gundam.user.model.User; | 25 | import com.cnlive.gundam.user.model.User; |
| 22 | import com.cnlive.gundam.user.util.InputUtil; | 26 | import com.cnlive.gundam.user.util.InputUtil; |
| 27 | +import com.cnlive.gundam.user.util.ToastUtil; | ||
| 23 | import com.cnlive.gundam.video.adpter.CommonAdapter; | 28 | import com.cnlive.gundam.video.adpter.CommonAdapter; |
| 24 | import com.cnlive.gundam.video.adpter.GiftAdapter; | 29 | import com.cnlive.gundam.video.adpter.GiftAdapter; |
| 25 | import com.cnlive.gundam.video.barrage.BarrageBaseMessage; | 30 | import com.cnlive.gundam.video.barrage.BarrageBaseMessage; |
| @@ -42,6 +47,8 @@ import java.util.ArrayList; | @@ -42,6 +47,8 @@ import java.util.ArrayList; | ||
| 42 | */ | 47 | */ |
| 43 | public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.OnChatListener { | 48 | public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback, MessageContentInfo.OnChatListener { |
| 44 | 49 | ||
| 50 | + private final int PERMISSION_REQUEST_CODE = 0x1001; | ||
| 51 | + | ||
| 45 | private FragmentChatBinding fragmentChatBinding; | 52 | private FragmentChatBinding fragmentChatBinding; |
| 46 | private ArrayList<GiftModle> giftArray; | 53 | private ArrayList<GiftModle> giftArray; |
| 47 | private CommonAdapter<MessageContent> messageContentCommonAdapter; | 54 | private CommonAdapter<MessageContent> messageContentCommonAdapter; |
| @@ -77,9 +84,24 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -77,9 +84,24 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 77 | initListener(); | 84 | initListener(); |
| 78 | initDate(); | 85 | initDate(); |
| 79 | initGift(); | 86 | initGift(); |
| 80 | - initChat(); | 87 | + int checkCallPhonePermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_PHONE_STATE); |
| 88 | + if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) { | ||
| 89 | + requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, PERMISSION_REQUEST_CODE); | ||
| 90 | + }else{ | ||
| 91 | + initChat(); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + @Override | ||
| 95 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||
| 96 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 97 | + if(requestCode == PERMISSION_REQUEST_CODE){ | ||
| 98 | + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||
| 99 | + initChat(); | ||
| 100 | + } else { | ||
| 101 | + ToastUtil.show(getActivity(),"使用聊天功能,请通过权限审核"); | ||
| 102 | + } | ||
| 103 | + } | ||
| 81 | } | 104 | } |
| 82 | - | ||
| 83 | 105 | ||
| 84 | private void barrageBottom() { | 106 | private void barrageBottom() { |
| 85 | switchCompatBottom = fragmentChatBinding.barrage; | 107 | switchCompatBottom = fragmentChatBinding.barrage; |
| @@ -135,15 +157,11 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | @@ -135,15 +157,11 @@ public class ChatRoomFragment extends Fragment implements InputUtil.SendCallback | ||
| 135 | final int uid = activeAccountInfo.getUid(); | 157 | final int uid = activeAccountInfo.getUid(); |
| 136 | 158 | ||
| 137 | if (uid != 0) { | 159 | if (uid != 0) { |
| 138 | - | ||
| 139 | ChatUtil.connect(new CNUserInfo(uid + "", nickname, faceurl), messageContentInfo.onConnectListener); | 160 | ChatUtil.connect(new CNUserInfo(uid + "", nickname, faceurl), messageContentInfo.onConnectListener); |
| 140 | } else { | 161 | } else { |
| 141 | - | ||
| 142 | ChatUtil.connect(messageContentInfo.onConnectListener); | 162 | ChatUtil.connect(messageContentInfo.onConnectListener); |
| 143 | - | ||
| 144 | } | 163 | } |
| 145 | 164 | ||
| 146 | - | ||
| 147 | ChatUtil.setOnReceiveMessageListener(messageContentInfo.onReceiveMessageListener); | 165 | ChatUtil.setOnReceiveMessageListener(messageContentInfo.onReceiveMessageListener); |
| 148 | 166 | ||
| 149 | } | 167 | } |
app/src/main/res/layout/fragment_player_ugc_live.xml
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | <RelativeLayout | 25 | <RelativeLayout |
| 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="240dp" | 28 | + android:layout_height="200dp" |
| 29 | android:layout_alignParentBottom="true"> | 29 | android:layout_alignParentBottom="true"> |
| 30 | 30 | ||
| 31 | </RelativeLayout> | 31 | </RelativeLayout> |