diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserContributeVideoAdapter.java b/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserContributeVideoAdapter.java index 1003736a..02787e3d 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserContributeVideoAdapter.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserContributeVideoAdapter.java @@ -11,7 +11,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.hotbitmapgg.bilibili.adapter.helper.AbsRecyclerViewAdapter; import com.hotbitmapgg.bilibili.entity.user.UserContributeInfo; -import com.hotbitmapgg.bilibili.network.auxiliary.UrlHelper; import com.hotbitmapgg.ohmybilibili.R; import java.util.List; @@ -46,7 +45,7 @@ public void onBindViewHolder(ClickableViewHolder holder, int position) { UserContributeInfo.DataBean.VlistBean vlistBean = userVideoList.get(position); Glide.with(getContext()) - .load(UrlHelper.getClearVideoPreviewUrl(vlistBean.getPic())) + .load("http:" + vlistBean.getPic()) .centerCrop() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.bili_default_image_tv) diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserHomePagerContributeAdapter.java b/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserHomePagerContributeAdapter.java index 5f3e9aed..67d3d00e 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserHomePagerContributeAdapter.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/adapter/UserHomePagerContributeAdapter.java @@ -45,7 +45,7 @@ public void onBindViewHolder(ClickableViewHolder holder, int position) { UserContributeInfo.DataBean.VlistBean vlistBean = userContributes.get(position); Glide.with(getContext()) - .load(vlistBean.getPic()) + .load("http:" + vlistBean.getPic()) .centerCrop() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.bili_default_image_tv) diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserHomePageFragment.java b/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserHomePageFragment.java index 3d726385..d07a24fd 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserHomePageFragment.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserHomePageFragment.java @@ -12,22 +12,18 @@ import android.widget.RelativeLayout; import android.widget.TextView; -import com.hotbitmapgg.bilibili.adapter.UserHomePagerChaseBangumiAdapter; import com.hotbitmapgg.bilibili.adapter.UserHomePagerCoinsAdapter; import com.hotbitmapgg.bilibili.adapter.UserHomePagerContributeAdapter; import com.hotbitmapgg.bilibili.adapter.UserHomePagerInterestQuanAdapter; import com.hotbitmapgg.bilibili.adapter.UserHomePagerPlayGameAdapter; import com.hotbitmapgg.bilibili.base.RxLazyFragment; -import com.hotbitmapgg.bilibili.entity.user.UserChaseBangumiInfo; import com.hotbitmapgg.bilibili.entity.user.UserCoinsInfo; +import com.hotbitmapgg.bilibili.entity.user.UserContributeInfo; import com.hotbitmapgg.bilibili.entity.user.UserInterestQuanInfo; +import com.hotbitmapgg.bilibili.entity.user.UserLiveRoomStatusInfo; import com.hotbitmapgg.bilibili.entity.user.UserPlayGameInfo; import com.hotbitmapgg.bilibili.utils.ConstantUtil; import com.hotbitmapgg.ohmybilibili.R; -import com.hotbitmapgg.bilibili.entity.user.UserContributeInfo; -import com.hotbitmapgg.bilibili.entity.user.UserFavoritesInfo; -import com.hotbitmapgg.bilibili.entity.user.UserLiveRoomStatusInfo; -import com.hotbitmapgg.bilibili.widget.FavoritesItemLayout; import java.util.List; @@ -50,14 +46,6 @@ public class UserHomePageFragment extends RxLazyFragment { TextView mCoinsCount; @BindView(R.id.coins_recycler) RecyclerView mCoinsRecycler; - @BindView(R.id.favorites_count) - TextView mFavoritesCount; - @BindView(R.id.favorites_layout) - FavoritesItemLayout mFavoritesLayout; - @BindView(R.id.chase_bangumi_count) - TextView mChaseBangumiCount; - @BindView(R.id.chase_bangumi_recycler) - RecyclerView mChaseBangumiRecycler; @BindView(R.id.quanzi_count) TextView mQuanziCount; @BindView(R.id.quanzi_recycler) @@ -70,10 +58,6 @@ public class UserHomePageFragment extends RxLazyFragment { RelativeLayout contributeLayout; @BindView(R.id.coins_layout) RelativeLayout coinsLayout; - @BindView(R.id.favorites_head_layout) - RelativeLayout favoritesHeadLayout; - @BindView(R.id.chase_bangumi_layout) - RelativeLayout chaseBangumiLayout; @BindView(R.id.quanzi_layout) RelativeLayout quanziLayout; @BindView(R.id.play_game_layout) @@ -88,23 +72,18 @@ public class UserHomePageFragment extends RxLazyFragment { private UserCoinsInfo mUserCoinsInfo; private UserPlayGameInfo mUserPlayGameInfo; private UserContributeInfo mUserContributeInfo; - private UserFavoritesInfo mUserFavoritesInfo; - private UserChaseBangumiInfo mUserChaseBangumiInfo; private UserInterestQuanInfo mUserInterestQuanInfo; private UserLiveRoomStatusInfo mUserLiveRoomStatusInfo; - - public static UserHomePageFragment newInstance( - UserContributeInfo userContributeInfo, UserFavoritesInfo userFavoritesInfo, - UserChaseBangumiInfo userChaseBangumiInfo, UserInterestQuanInfo userInterestQuanInfo, - UserCoinsInfo userCoinsInfo, UserPlayGameInfo userPlayGameInfo, - UserLiveRoomStatusInfo userLiveRoomStatusInfo) { + public static UserHomePageFragment newInstance(UserContributeInfo userContributeInfo, + UserInterestQuanInfo userInterestQuanInfo, + UserCoinsInfo userCoinsInfo, + UserPlayGameInfo userPlayGameInfo, + UserLiveRoomStatusInfo userLiveRoomStatusInfo) { UserHomePageFragment mFragment = new UserHomePageFragment(); Bundle bundle = new Bundle(); bundle.putParcelable(ConstantUtil.USER_CONTRIBUTE, userContributeInfo); - bundle.putParcelable(ConstantUtil.USER_FAVORITES, userFavoritesInfo); - bundle.putParcelable(ConstantUtil.USER_CHASE_BANGUMI, userChaseBangumiInfo); bundle.putParcelable(ConstantUtil.USER_INTEREST_QUAN, userInterestQuanInfo); bundle.putParcelable(ConstantUtil.USER_COINS, userCoinsInfo); bundle.putParcelable(ConstantUtil.USER_PLAY_GAME, userPlayGameInfo); @@ -122,8 +101,6 @@ public int getLayoutResId() { @Override public void finishCreateView(Bundle state) { mUserContributeInfo = getArguments().getParcelable(ConstantUtil.USER_CONTRIBUTE); - mUserFavoritesInfo = getArguments().getParcelable(ConstantUtil.USER_FAVORITES); - mUserChaseBangumiInfo = getArguments().getParcelable(ConstantUtil.USER_CHASE_BANGUMI); mUserInterestQuanInfo = getArguments().getParcelable(ConstantUtil.USER_INTEREST_QUAN); mUserCoinsInfo = getArguments().getParcelable(ConstantUtil.USER_COINS); mUserPlayGameInfo = getArguments().getParcelable(ConstantUtil.USER_PLAY_GAME); @@ -132,8 +109,6 @@ public void finishCreateView(Bundle state) { setLive(); setContribute(); setCoins(); - setFavorites(); - setChaseBangumi(); setQuanzi(); setPlayGame(); } @@ -183,31 +158,6 @@ private void setQuanzi() { mQuanziCount.setText(String.valueOf(total_count)); } - private void setChaseBangumi() { - int count = mUserChaseBangumiInfo.getData().getCount(); - if (count == 0) { - chaseBangumiLayout.setVisibility(View.GONE); - } - List result = mUserChaseBangumiInfo.getData().getResult(); - mChaseBangumiRecycler.setHasFixedSize(false); - mChaseBangumiRecycler.setNestedScrollingEnabled(false); - mChaseBangumiRecycler.setLayoutManager(new GridLayoutManager(getActivity(), 3)); - mChaseBangumiRecycler.setAdapter(new UserHomePagerChaseBangumiAdapter(mChaseBangumiRecycler, result)); - mChaseBangumiCount.setText(String.valueOf(count)); - } - - private void setFavorites() { - int size = mUserFavoritesInfo.getData().size(); - if (size == 0) { - favoritesHeadLayout.setVisibility(View.GONE); - } - List data = mUserFavoritesInfo.getData(); - List videos = data.get(0).getVideos(); - mFavoritesLayout.setImages(videos); - mFavoritesCount.setText(String.valueOf(size)); - } - - private void setCoins() { int count = mUserCoinsInfo.getData().getCount(); if (count == 0) { @@ -235,38 +185,26 @@ private void setContribute() { } - @OnClick(R.id.contribute_more) - void gotoContributePager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(1); - } - - - @OnClick(R.id.favorites_more) - void gotoFavoritesPager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(2); - } - - - @OnClick(R.id.chase_bangumi_more) - void gotoChaseBangumiPager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(3); - } - - - @OnClick(R.id.quanzi_more) - void gotoQuanziPager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(4); - } - + @OnClick({R.id.contribute_more, R.id.quanzi_more, R.id.coins_more, R.id.play_game_more}) + void onClick(View view) { + switch (view.getId()) { + case R.id.contribute_more: + //更多投稿 + ((UserInfoDetailsActivity) getActivity()).switchPager(1); + break; + case R.id.quanzi_more: + //更多圈子 + ((UserInfoDetailsActivity) getActivity()).switchPager(2); + break; + case R.id.coins_more: + //更多投币 + ((UserInfoDetailsActivity) getActivity()).switchPager(3); + break; + case R.id.play_game_more: + //更多游戏 + ((UserInfoDetailsActivity) getActivity()).switchPager(4); + break; - @OnClick(R.id.coins_more) - void gotoCoinsPager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(5); - } - - - @OnClick(R.id.play_game_more) - void gotoPlayGamePager() { - ((UserInfoDetailsActivity) getActivity()).switchPager(6); + } } } diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserInfoDetailsActivity.java b/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserInfoDetailsActivity.java index 8d836e87..2498ba8d 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserInfoDetailsActivity.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/module/user/UserInfoDetailsActivity.java @@ -23,11 +23,9 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.flyco.tablayout.SlidingTabLayout; import com.hotbitmapgg.bilibili.base.RxBaseActivity; -import com.hotbitmapgg.bilibili.entity.user.UserChaseBangumiInfo; import com.hotbitmapgg.bilibili.entity.user.UserCoinsInfo; import com.hotbitmapgg.bilibili.entity.user.UserContributeInfo; import com.hotbitmapgg.bilibili.entity.user.UserDetailsInfo; -import com.hotbitmapgg.bilibili.entity.user.UserFavoritesInfo; import com.hotbitmapgg.bilibili.entity.user.UserInterestQuanInfo; import com.hotbitmapgg.bilibili.entity.user.UserLiveRoomStatusInfo; import com.hotbitmapgg.bilibili.entity.user.UserPlayGameInfo; @@ -36,6 +34,7 @@ import com.hotbitmapgg.bilibili.utils.LogUtil; import com.hotbitmapgg.bilibili.utils.NumberUtil; import com.hotbitmapgg.bilibili.utils.SystemBarHelper; +import com.hotbitmapgg.bilibili.utils.ToastUtil; import com.hotbitmapgg.bilibili.widget.CircleImageView; import com.hotbitmapgg.bilibili.widget.CircleProgressView; import com.hotbitmapgg.bilibili.widget.NoScrollViewPager; @@ -95,26 +94,20 @@ public class UserInfoDetailsActivity extends RxBaseActivity { private String name = ""; private String avatar_url; private int userContributeCount; - private int userFavoritesCount; - private int userChaseBangumiCount; private int userInterestQuanCount; private int userCoinsCount; private int userPlayGameCount; private UserDetailsInfo mUserDetailsInfo; private UserCoinsInfo mUserCoinsInfo; private UserPlayGameInfo mUserPlayGameInfo; - private UserFavoritesInfo mUserFavoritesInfo; private UserContributeInfo mUserContributeInfo; - private UserChaseBangumiInfo mUserChaseBangumiInfo; private UserInterestQuanInfo mUserInterestQuanInfo; private UserLiveRoomStatusInfo mUserLiveRoomStatusInfo; private List titles = new ArrayList<>(); private List fragments = new ArrayList<>(); - private List userFavorites = new ArrayList<>(); private List userCoins = new ArrayList<>(); private List userPlayGames = new ArrayList<>(); private List userContributes = new ArrayList<>(); - private List userChaseBangumis = new ArrayList<>(); private List userInterestQuans = new ArrayList<>(); private static final String EXTRA_USER_NAME = "extra_user_name", EXTRA_MID = "extra_mid", EXTRA_AVATAR_URL = "extra_avatar_url"; @@ -261,32 +254,12 @@ private void getUserAllData() { RetrofitHelper.getUserAPI() .getUserContributeVideos(mid, 1, 10) .compose(this.bindToLifecycle()) - .flatMap(new Func1>() { + .flatMap(new Func1>() { @Override - public Observable call(UserContributeInfo userContributeInfo) { + public Observable call(UserContributeInfo userContributeInfo) { mUserContributeInfo = userContributeInfo; userContributeCount = userContributeInfo.getData().getCount(); userContributes.addAll(userContributeInfo.getData().getVlist()); - return RetrofitHelper.getBiliAPI().getUserFavorites(mid); - } - }) - .compose(bindToLifecycle()) - .flatMap(new Func1>() { - @Override - public Observable call(UserFavoritesInfo userFavoritesInfo) { - mUserFavoritesInfo = userFavoritesInfo; - userFavoritesCount = userFavoritesInfo.getData().size(); - userFavorites.addAll(userFavoritesInfo.getData()); - return RetrofitHelper.getUserAPI().getUserChaseBangumis(mid); - } - }) - .compose(bindToLifecycle()) - .flatMap(new Func1>() { - @Override - public Observable call(UserChaseBangumiInfo userChaseBangumiInfo) { - mUserChaseBangumiInfo = userChaseBangumiInfo; - userChaseBangumiCount = userChaseBangumiInfo.getData().getCount(); - userChaseBangumis.addAll(userChaseBangumiInfo.getData().getResult()); return RetrofitHelper.getIm9API().getUserInterestQuanData(mid, 1, 10); } }) @@ -326,15 +299,17 @@ public Observable call(UserPlayGameInfo userPlayGameInfo .subscribe(userLiveRoomStatusInfo -> { mUserLiveRoomStatusInfo = userLiveRoomStatusInfo; initViewPager(); - }, throwable -> hideProgressBar()); + }, throwable -> { + ToastUtil.ShortToast("用户隐私未公开"); + hideProgressBar(); + }); } private void initViewPager() { - fragments.add(UserHomePageFragment.newInstance(mUserContributeInfo, mUserFavoritesInfo, mUserChaseBangumiInfo, mUserInterestQuanInfo, mUserCoinsInfo, mUserPlayGameInfo, mUserLiveRoomStatusInfo)); + fragments.add(UserHomePageFragment.newInstance(mUserContributeInfo, + mUserInterestQuanInfo, mUserCoinsInfo, mUserPlayGameInfo, mUserLiveRoomStatusInfo)); fragments.add(UserContributeFragment.newInstance(mid, mUserContributeInfo)); - fragments.add(UserFavoritesFragment.newInstance(mUserFavoritesInfo)); - fragments.add(UserChaseBangumiFragment.newInstance(mUserChaseBangumiInfo)); fragments.add(UserInterestQuanFragment.newInstance(mid, mUserInterestQuanInfo)); fragments.add(UserCoinsVideoFragment.newInstance(mUserCoinsInfo)); fragments.add(UserPlayGameFragment.newInstance(mUserPlayGameInfo)); @@ -365,8 +340,6 @@ public void onPageScrollStateChanged(int state) { private void setPagerTitles() { titles.add("主页"); titles.add("投稿 " + userContributeCount); - titles.add("收藏 " + userFavoritesCount); - titles.add("追番 " + userChaseBangumiCount); titles.add("兴趣圈 " + userInterestQuanCount); titles.add("投币 " + userCoinsCount); titles.add("游戏 " + userPlayGameCount); @@ -447,12 +420,6 @@ public void switchPager(int index) { case 4: mViewPager.setCurrentItem(4); break; - case 5: - mViewPager.setCurrentItem(5); - break; - case 6: - mViewPager.setCurrentItem(6); - break; } } diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/network/api/BiliApiService.java b/app/src/main/java/com/hotbitmapgg/bilibili/network/api/BiliApiService.java index 4cd37718..c560a3ac 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/network/api/BiliApiService.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/network/api/BiliApiService.java @@ -1,12 +1,11 @@ package com.hotbitmapgg.bilibili.network.api; -import com.hotbitmapgg.bilibili.entity.bangumi.SpecialTopic; -import com.hotbitmapgg.bilibili.entity.bangumi.SpecialTopicIResult; -import com.hotbitmapgg.bilibili.entity.discover.TopicCenterInfo; import com.hotbitmapgg.bilibili.entity.attention.AttentionDynamicInfo; import com.hotbitmapgg.bilibili.entity.bangumi.BangumiDetailsCommentInfo; +import com.hotbitmapgg.bilibili.entity.bangumi.SpecialTopic; +import com.hotbitmapgg.bilibili.entity.bangumi.SpecialTopicIResult; import com.hotbitmapgg.bilibili.entity.discover.ActivityCenterInfo; -import com.hotbitmapgg.bilibili.entity.user.UserFavoritesInfo; +import com.hotbitmapgg.bilibili.entity.discover.TopicCenterInfo; import com.hotbitmapgg.bilibili.entity.video.VideoCommentInfo; import retrofit2.http.GET; @@ -49,11 +48,6 @@ public interface BiliApiService { @GET("event/getlist?device=phone&mobi_app=iphone") Observable getActivityCenterList(@Query("page") int page, @Query("pagesize") int pageSize); - /** - * 用户收藏夹 - */ - @GET("x/app/favourite/folder?") - Observable getUserFavorites(@Query("mid") int mid); /** * 首页关注 diff --git a/app/src/main/java/com/hotbitmapgg/bilibili/network/auxiliary/UrlHelper.java b/app/src/main/java/com/hotbitmapgg/bilibili/network/auxiliary/UrlHelper.java index 21fda2c4..c8416e63 100644 --- a/app/src/main/java/com/hotbitmapgg/bilibili/network/auxiliary/UrlHelper.java +++ b/app/src/main/java/com/hotbitmapgg/bilibili/network/auxiliary/UrlHelper.java @@ -1,7 +1,5 @@ package com.hotbitmapgg.bilibili.network.auxiliary; -import android.util.Log; - import com.hotbitmapgg.bilibili.entity.user.UserDetailsInfo; /** @@ -16,22 +14,6 @@ public class UrlHelper { private static final String HDSLB_HOST = "http://i2.hdslb.com"; - private static boolean isVideoUrl(String url) { - return url.contains("bilibili.com/video/av"); - } - - public static int getAVfromVideoUrl(String url) { - if (!isVideoUrl(url)) { - return -1; - } - String av = url; - av = av.substring(av.indexOf("bilibili.com/video/av") + "bilibili.com/video/av".length()); - Log.i("test", av); - av = av.substring(0, av.indexOf("/")); - Log.i("test", av); - return Integer.parseInt(av); - } - public static String getFaceUrl(UserDetailsInfo info) { if (info.getCard().getFace().contains(".hdslb.com")) { return info.getCard().getFace(); diff --git a/app/src/main/res/layout/fragment_user_home_page.xml b/app/src/main/res/layout/fragment_user_home_page.xml index aef9c5ff..91dc20d7 100644 --- a/app/src/main/res/layout/fragment_user_home_page.xml +++ b/app/src/main/res/layout/fragment_user_home_page.xml @@ -147,107 +147,6 @@ android:scrollbars="none" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -