Commit ecc0701522a7996f582426b83566d17e92241d52
1 parent
86217543
解决直播没有数据
Showing
4 changed files
with
48 additions
and
6 deletions
app/src/main/java/com/cnlive/gundam/main/presenter/AnchorInfoPresenter.java
| @@ -8,7 +8,6 @@ import com.cnlive.gundam.main.presenter.view.IAnchorInfoView; | @@ -8,7 +8,6 @@ import com.cnlive.gundam.main.presenter.view.IAnchorInfoView; | ||
| 8 | import com.cnlive.gundam.stream.model.ChannelInfoModel; | 8 | import com.cnlive.gundam.stream.model.ChannelInfoModel; |
| 9 | import com.cnlive.libs.util.Config; | 9 | import com.cnlive.libs.util.Config; |
| 10 | 10 | ||
| 11 | -import java.lang.ref.WeakReference; | ||
| 12 | import java.util.HashMap; | 11 | import java.util.HashMap; |
| 13 | import java.util.Map; | 12 | import java.util.Map; |
| 14 | 13 | ||
| @@ -22,14 +21,14 @@ import retrofit2.Response; | @@ -22,14 +21,14 @@ import retrofit2.Response; | ||
| 22 | 21 | ||
| 23 | public class AnchorInfoPresenter { | 22 | public class AnchorInfoPresenter { |
| 24 | 23 | ||
| 25 | - private WeakReference<IAnchorInfoView> viewRef; | 24 | + private IAnchorInfoView view; |
| 26 | 25 | ||
| 27 | public AnchorInfoPresenter(IAnchorInfoView view) { | 26 | public AnchorInfoPresenter(IAnchorInfoView view) { |
| 28 | - viewRef = new WeakReference<>(view); | 27 | + this.view = view; |
| 29 | } | 28 | } |
| 30 | 29 | ||
| 31 | private IAnchorInfoView getView(){ | 30 | private IAnchorInfoView getView(){ |
| 32 | - return viewRef == null ? null : viewRef.get(); | 31 | + return view; |
| 33 | } | 32 | } |
| 34 | /** | 33 | /** |
| 35 | * 查询主播信息 | 34 | * 查询主播信息 |
app/src/main/java/com/cnlive/gundam/main/ui/activity/MainActivity.java
| @@ -4,6 +4,7 @@ import android.content.Intent; | @@ -4,6 +4,7 @@ import android.content.Intent; | ||
| 4 | import android.databinding.DataBindingUtil; | 4 | import android.databinding.DataBindingUtil; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | +import android.util.Log; | ||
| 7 | 8 | ||
| 8 | import com.cnlive.gundam.R; | 9 | import com.cnlive.gundam.R; |
| 9 | import com.cnlive.gundam.databinding.ActivityMainBinding; | 10 | import com.cnlive.gundam.databinding.ActivityMainBinding; |
| @@ -20,6 +21,7 @@ import com.cnlive.gundam.user.activity.LoginActivity; | @@ -20,6 +21,7 @@ import com.cnlive.gundam.user.activity.LoginActivity; | ||
| 20 | import com.cnlive.gundam.user.auth.UserService; | 21 | import com.cnlive.gundam.user.auth.UserService; |
| 21 | import com.cnlive.gundam.user.model.User; | 22 | import com.cnlive.gundam.user.model.User; |
| 22 | import com.cnlive.gundam.video.view.VideoView; | 23 | import com.cnlive.gundam.video.view.VideoView; |
| 24 | +import com.cnlive.libs.util.ProbeUtil; | ||
| 23 | 25 | ||
| 24 | import java.util.Arrays; | 26 | import java.util.Arrays; |
| 25 | 27 | ||
| @@ -46,7 +48,9 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | @@ -46,7 +48,9 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | ||
| 46 | )); | 48 | )); |
| 47 | 49 | ||
| 48 | mAnchorInfoPresenter = new AnchorInfoPresenter(new AnchorInfoView(this)); | 50 | mAnchorInfoPresenter = new AnchorInfoPresenter(new AnchorInfoView(this)); |
| 51 | + ProbeUtil.probeSDK("statup"); | ||
| 49 | 52 | ||
| 53 | + Log.d("MainActivity", "onCreate:"); | ||
| 50 | //加载水印图片 | 54 | //加载水印图片 |
| 51 | FileUtil.copyFile(this, "cnlive_logo.png"); | 55 | FileUtil.copyFile(this, "cnlive_logo.png"); |
| 52 | } | 56 | } |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
| @@ -17,7 +17,10 @@ import com.cnlive.gundam.user.activity.LoginActivity; | @@ -17,7 +17,10 @@ import com.cnlive.gundam.user.activity.LoginActivity; | ||
| 17 | import com.cnlive.gundam.user.activity.UserPersonalActivity; | 17 | import com.cnlive.gundam.user.activity.UserPersonalActivity; |
| 18 | import com.cnlive.gundam.user.auth.UserService; | 18 | import com.cnlive.gundam.user.auth.UserService; |
| 19 | import com.cnlive.gundam.user.model.User; | 19 | import com.cnlive.gundam.user.model.User; |
| 20 | - | 20 | +import com.cnlive.libs.user.IUserService; |
| 21 | +import com.cnlive.libs.user.UserUtil; | ||
| 22 | +import com.cnlive.libs.user.model.UserData; | ||
| 23 | +import com.cnlive.libs.util.data.network.Callback; | ||
| 21 | 24 | ||
| 22 | 25 | ||
| 23 | /** | 26 | /** |
| @@ -26,6 +29,7 @@ import com.cnlive.gundam.user.model.User; | @@ -26,6 +29,7 @@ import com.cnlive.gundam.user.model.User; | ||
| 26 | 29 | ||
| 27 | public class ConfigFragment extends Fragment implements View.OnClickListener { | 30 | public class ConfigFragment extends Fragment implements View.OnClickListener { |
| 28 | private UserFragmentBinding binding; | 31 | private UserFragmentBinding binding; |
| 32 | + private User activeAccountInfo; | ||
| 29 | 33 | ||
| 30 | @Nullable | 34 | @Nullable |
| 31 | @Override | 35 | @Override |
| @@ -86,7 +90,9 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -86,7 +90,9 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 86 | 90 | ||
| 87 | private void notifyUI(boolean isLogin) { | 91 | private void notifyUI(boolean isLogin) { |
| 88 | if(isLogin){ | 92 | if(isLogin){ |
| 89 | - User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); | 93 | + activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); |
| 94 | + updateUserInfo(activeAccountInfo); | ||
| 95 | + activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); | ||
| 90 | Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg); | 96 | Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg); |
| 91 | binding.tvNickname.setText(activeAccountInfo.getNickname()); | 97 | binding.tvNickname.setText(activeAccountInfo.getNickname()); |
| 92 | }else{ | 98 | }else{ |
| @@ -94,4 +100,19 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -94,4 +100,19 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 94 | binding.tvNickname.setText(getString(R.string.click_login)); | 100 | binding.tvNickname.setText(getString(R.string.click_login)); |
| 95 | } | 101 | } |
| 96 | } | 102 | } |
| 103 | + | ||
| 104 | + | ||
| 105 | + | ||
| 106 | + private void updateUserInfo(User user) { | ||
| 107 | + UserUtil.queryUserInfo(String.valueOf(user.getUid()), String.valueOf(user.getUid()), new Callback() { | ||
| 108 | + @Override | ||
| 109 | + public void onState(int i, String s, Object obj) { | ||
| 110 | + if (i == IUserService.SUCCESS) { | ||
| 111 | + UserData userData = (UserData) obj; | ||
| 112 | + UserService userService = UserService.getInstance(getActivity()); | ||
| 113 | + userService.setActiveAccountInfo(userData.getData()); | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + }); | ||
| 117 | + } | ||
| 97 | } | 118 | } |
app/src/main/java/com/cnlive/gundam/video/view/BaseVideoView.java
| @@ -205,19 +205,37 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -205,19 +205,37 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 205 | if (isPlay) { | 205 | if (isPlay) { |
| 206 | if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) { | 206 | if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) { |
| 207 | ProbeUtil.probeSDK("ugcLiveStart"); | 207 | ProbeUtil.probeSDK("ugcLiveStart"); |
| 208 | + | ||
| 209 | + Log.v("TestDemo","ugcLiveStart"); | ||
| 210 | + | ||
| 208 | } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) { | 211 | } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) { |
| 209 | ProbeUtil.probeSDK("pgcLiveStart"); | 212 | ProbeUtil.probeSDK("pgcLiveStart"); |
| 213 | + | ||
| 214 | + Log.v("TestDemo","pgcLiveStart"); | ||
| 215 | + | ||
| 210 | } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) { | 216 | } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) { |
| 211 | ProbeUtil.probeSDK("ugcVodStart"); | 217 | ProbeUtil.probeSDK("ugcVodStart"); |
| 218 | + | ||
| 219 | + Log.v("TestDemo","ugcVodStart"); | ||
| 220 | + | ||
| 212 | } | 221 | } |
| 213 | binding.videoView.start(); | 222 | binding.videoView.start(); |
| 214 | } else { | 223 | } else { |
| 215 | if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) { | 224 | if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) { |
| 216 | ProbeUtil.probeSDK("ugcLiveEnd"); | 225 | ProbeUtil.probeSDK("ugcLiveEnd"); |
| 226 | + | ||
| 227 | + Log.v("TestDemo","ugcLiveEnd"); | ||
| 228 | + | ||
| 217 | } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) { | 229 | } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) { |
| 218 | ProbeUtil.probeSDK("pgcLiveEnd"); | 230 | ProbeUtil.probeSDK("pgcLiveEnd"); |
| 231 | + | ||
| 232 | + Log.v("TestDemo","pgcLiveEnd"); | ||
| 233 | + | ||
| 219 | } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) { | 234 | } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) { |
| 220 | ProbeUtil.probeSDK("ugcVodEnd"); | 235 | ProbeUtil.probeSDK("ugcVodEnd"); |
| 236 | + | ||
| 237 | + Log.v("TestDemo","ugcVodEnd"); | ||
| 238 | + | ||
| 221 | } | 239 | } |
| 222 | binding.videoView.pause(); | 240 | binding.videoView.pause(); |
| 223 | } | 241 | } |