| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.database.HanJuSQLiteOpenHelper; |
| | |
| | | import com.hanju.video.app.ui.mine.WatchHistoryActivity; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.video.youth.ui.YouthActivity; |
| | | import com.video.youth.util.YouthUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | private RecyclerView rv_watch_history; |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> historyList = new ArrayList<>(); |
| | | |
| | | public static MineFragment newInstance() { |
| | |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | mAquery = new AQuery(contentView); |
| | | tv_no_network = contentView.findViewById(R.id.tv_no_network); |
| | | rv_watch_history = contentView.findViewById(R.id.rv_watch_history); |
| | | tv_no_network.setOnClickListener(this); |
| | |
| | | contentView.findViewById(R.id.ll_mine_follow).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_mine_save).setOnClickListener(this); |
| | | contentView.findViewById(R.id.tv_mine_watch_history).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_youth).setOnClickListener(this); |
| | | |
| | | |
| | | tv_mine_favourite = contentView.findViewById(R.id.tv_mine_favourite); |
| | | tv_mine_follow = contentView.findViewById(R.id.tv_mine_follow); |
| | |
| | | break; |
| | | case R.id.ll_mine_advice://建议 |
| | | startActivity(new Intent(getContext(), BrowserActivity.class).putExtra("title", "意见反馈").putExtra("url", "https://support.qq.com/embed/phone/343178/new-post/")); |
| | | break; |
| | | |
| | | case R.id.ll_youth://青少年模式 |
| | | startActivity(new Intent(getContext(), YouthActivity.class)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | initLoginInfo(); |
| | | } |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("主页面—我的"); |
| | | |
| | | historyList.clear(); |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> list = new ArrayList<>(); |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | mAquery.id(R.id.ll_video_mine).visibility(View.GONE); |
| | | mAquery.id(R.id.fl_history).visibility(View.GONE); |
| | | mAquery.id(R.id.rv_watch_history).visibility(View.GONE); |
| | | } else { |
| | | mAquery.id(R.id.ll_video_mine).visibility(View.VISIBLE); |
| | | mAquery.id(R.id.fl_history).visibility(View.VISIBLE); |
| | | mAquery.id(R.id.rv_watch_history).visibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getUserVideoDataCount() { |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—我的"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | private List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> getWatchHistory() throws Exception { |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> videoInfoList = new ArrayList<>(); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | |
| | | SQLiteDatabase database = new HanJuSQLiteOpenHelper(getContext()).getReadableDatabase(); |
| | | Cursor cursor = database.query(WatchHistoryTable.TABLE_NAME, new String[]{WatchHistoryTable._ID, WatchHistoryTable.VIDEO_ID, WatchHistoryTable.VIDEO_DETAIL_ID, WatchHistoryTable.VIDEO_DETAIL}, null, null, null, null, WatchHistoryTable.UPDATE_TIME + " DESC"); |
| | | cursor.moveToFirst(); |
| | |
| | | .getColumnIndex(WatchHistoryTable.VIDEO_DETAIL_ID)); |
| | | String videoInfoStr = cursor.getString(cursor |
| | | .getColumnIndexOrThrow(WatchHistoryTable.VIDEO_DETAIL)); |
| | | VideoInfo videoInfo = gson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { |
| | | VideoInfo videoInfo = JsonUtil.videoGson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | String[] types = new String[]{"150", "151", "152", "153"}; |
| | | if (videoInfo.getVideoType() != null && Arrays.asList(types).contains(videoInfo.getVideoType().getId())) { |