修复部分BUG,工具箱增加搜索功能
This commit is contained in:
@ -16,7 +16,6 @@ import com.gh.common.util.ApkActiveUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.FileUtils;
|
||||
import com.gh.common.util.GameUtils;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
@ -344,11 +343,8 @@ public abstract class BaseDetailActivity extends BaseActivity implements View.On
|
||||
} else if (v == detail_pb_progressbar || v == detail_tv_per) {
|
||||
String str = detail_tv_per.getText().toString();
|
||||
if ("下载中".equals(str)) {
|
||||
Intent intent = new Intent(this, DownloadManagerActivity.class);
|
||||
intent.putExtra("currentItem", 1);
|
||||
intent.putExtra("url", gameEntity.getApk().get(0).getUrl());
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, mEntrance + "+(" + name + "[" + title + "])");
|
||||
startActivity(intent);
|
||||
DownloadManagerActivity.startDownloadManagerActivity(this, gameEntity.getApk().get(0).getUrl()
|
||||
, mEntrance + "+(" + name + "[" + title + "])");
|
||||
} else if ("安装".equals(str)) {
|
||||
PackageUtils.launchSetup(this, mDownloadEntity.getPath());
|
||||
}
|
||||
|
||||
@ -201,10 +201,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Sear
|
||||
DataUtils.onEvent(getActivity(), "主页", "下载图标");
|
||||
DataCollectionUtils.uploadClick(getActivity(), "下载图标", "主页");
|
||||
|
||||
Intent intent = new Intent(getActivity(), DownloadManagerActivity.class);
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "(工具栏)");
|
||||
intent.putExtra("currentItem", 0);
|
||||
startActivity(intent);
|
||||
DownloadManagerActivity.startDownloadManagerActivity(getContext(), null, "(工具栏)");
|
||||
} else if (id == R.id.actionbar_iv_search) {
|
||||
DataUtils.onEvent(getActivity(), "主页", "搜索图标");
|
||||
DataCollectionUtils.uploadClick(getActivity(), "搜索图标", "主页");
|
||||
|
||||
@ -358,7 +358,7 @@ public class DownloadItemUtils {
|
||||
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk().get(0).getPackageName());
|
||||
} else if ("下载中".equals(str)) {
|
||||
context.startActivity(
|
||||
DownloadManagerActivity.getDownloadMangerIntent(context, gameEntity, entrance + "+(" + location.split(":")[0] + ")"));
|
||||
DownloadManagerActivity.getDownloadMangerIntent(context, gameEntity.getApk().get(0).getUrl(), entrance + "+(" + location.split(":")[0] + ")"));
|
||||
} else if ("更新".equals(str)) {
|
||||
if (NetworkUtils.isWifiConnected(context)) {
|
||||
update(context, gameEntity, entrance, location);
|
||||
|
||||
@ -220,8 +220,8 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
|
||||
}
|
||||
|
||||
private void showConnHintDialog() {
|
||||
DialogUtils.showHintDialog(ChooseReceiverActivity.this, "请告诉你的好友这样操作:", "1.请好友拿出手机,打开光环助手 " +
|
||||
"\n2.点击首页左上角“↓”按钮 \n3.点击“我要接收”", "确定");
|
||||
DialogUtils.showHintDialog(ChooseReceiverActivity.this, "请告诉你的好友这样操作:", "1.打开光环助手,点击左上角“↓” " +
|
||||
"\n2.点击右上方的“免流量传送” \n3.点击“我要接收/发送”", "确定");
|
||||
}
|
||||
|
||||
private void updateWifiScanResult() {
|
||||
|
||||
@ -21,7 +21,6 @@ import com.gh.gamecenter.adapter.FragmentAdapter;
|
||||
import com.gh.gamecenter.download.FileSendFragment;
|
||||
import com.gh.gamecenter.download.GameDownLoadFragment;
|
||||
import com.gh.gamecenter.download.GameUpdateFragment;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadChanged;
|
||||
import com.gh.gamecenter.eventbus.EBMiPush;
|
||||
import com.gh.gamecenter.eventbus.EBSkip;
|
||||
@ -41,9 +40,9 @@ import de.greenrobot.event.EventBus;
|
||||
*/
|
||||
public class DownloadManagerActivity extends BaseActivity implements OnClickListener, OnPageChangeListener {
|
||||
|
||||
public static final int INDEX_SEND = 0;
|
||||
public static final int INDEX_DOWNLOAD = 1;
|
||||
public static final int INDEX_UPDATE = 2;
|
||||
public static final int INDEX_SEND = 2;
|
||||
public static final int INDEX_DOWNLOAD = 0;
|
||||
public static final int INDEX_UPDATE = 1;
|
||||
|
||||
public static final String TAG = "DownloadManagerActivity";
|
||||
|
||||
@ -76,22 +75,21 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
|
||||
private LinearLayout.LayoutParams lparams;
|
||||
private int width;
|
||||
|
||||
public static Intent getDownloadMangerIntent(Context context, GameEntity gameEntity, String value) {
|
||||
Intent intent = new Intent(context, DownloadManagerActivity.class);
|
||||
intent.putExtra("currentItem", 1);
|
||||
intent.putExtra("url", gameEntity.getApk().get(0).getUrl());
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, value);
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static Intent getDownloadMangerIntent(Context context, String url, String entrance) {
|
||||
Intent intent = new Intent(context, DownloadManagerActivity.class);
|
||||
intent.putExtra("currentItem", 1);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static void startDownloadManagerActivity(Context context, String url, String entrance) {
|
||||
Intent intent = new Intent(context, DownloadManagerActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@ -133,14 +131,11 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
|
||||
if (savedInstanceState != null) {
|
||||
currentItem = savedInstanceState.getInt("CurrentItem");
|
||||
} else {
|
||||
currentItem = getIntent().getIntExtra("currentItem", -1);
|
||||
currentItem = getIntent().getIntExtra("currentItem", 0);
|
||||
if (getIntent().getBundleExtra("data") != null) {
|
||||
currentItem = getIntent().getBundleExtra("data").getInt("currentItem", -1);
|
||||
currentItem = getIntent().getBundleExtra("data").getInt("currentItem", 0);
|
||||
}
|
||||
}
|
||||
if (currentItem == -1) {
|
||||
currentItem = 1; //默认游戏下载页面
|
||||
}
|
||||
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
|
||||
@ -151,9 +146,9 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
|
||||
downloadmanager_slide_line.setLayoutParams(lparams);
|
||||
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(new FileSendFragment());
|
||||
list.add(new GameDownLoadFragment());
|
||||
list.add(new GameUpdateFragment());
|
||||
list.add(new FileSendFragment());
|
||||
downloadmanager_viewPager.setAdapter(new FragmentAdapter(getSupportFragmentManager(), list));
|
||||
downloadmanager_viewPager.addOnPageChangeListener(this);
|
||||
downloadmanager_viewPager.setCurrentItem(currentItem);
|
||||
@ -169,13 +164,13 @@ public class DownloadManagerActivity extends BaseActivity implements OnClickList
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (position == 1) {
|
||||
EventBus.getDefault().post(new EBUISwitch(DownloadManagerActivity.TAG, 1));
|
||||
if (position == 0) {
|
||||
EventBus.getDefault().post(new EBUISwitch(DownloadManagerActivity.TAG, 0));
|
||||
downloadmanager_tv_download.setTextColor(ContextCompat.getColor(this, R.color.theme));
|
||||
downloadmanager_tv_update.setTextColor(ContextCompat.getColor(this, R.color.title));
|
||||
downloadmanager_tv_send.setTextColor(ContextCompat.getColor(this, R.color.title));
|
||||
} else if (position == 2) {
|
||||
EventBus.getDefault().post(new EBUISwitch(DownloadManagerActivity.TAG, 2));
|
||||
} else if (position == 1) {
|
||||
EventBus.getDefault().post(new EBUISwitch(DownloadManagerActivity.TAG, 0));
|
||||
downloadmanager_tv_download.setTextColor(ContextCompat.getColor(this, R.color.title));
|
||||
downloadmanager_tv_update.setTextColor(ContextCompat.getColor(this, R.color.theme));
|
||||
downloadmanager_tv_send.setTextColor(ContextCompat.getColor(this, R.color.title));
|
||||
|
||||
@ -75,6 +75,7 @@ import rx.schedulers.Schedulers;
|
||||
public class GameDetailActivity extends BaseActivity {
|
||||
|
||||
public static final String SKIP_XINXI = "skipXinxi";
|
||||
public static final String SKIP_FULI = "skipFuli";
|
||||
public static final String OPEN_APPBAR = "openappbar";
|
||||
|
||||
@BindView(R.id.gamedetail_vp)
|
||||
@ -448,6 +449,8 @@ public class GameDetailActivity extends BaseActivity {
|
||||
mViewPager.setCurrentItem(1);
|
||||
} else if (OPEN_APPBAR.equals(reuse.getType()) && !mIsTouchScreen) {
|
||||
mAppBarLayout.setExpanded(true, true);
|
||||
} else if (SKIP_FULI.equals(reuse.getType())) {
|
||||
mViewPager.setCurrentItem(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import android.widget.Toast;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.MeasureHeightLayoutManager;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.view.VerticalItemDecoration;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
|
||||
@ -288,8 +288,8 @@ public class ReceiverWaitingActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void showConnHintDialog() {
|
||||
DialogUtils.showHintDialog(ReceiverWaitingActivity.this, "请告诉你的好友这样操作:", "1.请好友拿出手机,打开光环助手 " +
|
||||
"\n2.点击首页左上角“↓”按钮 \n3.点击“我要发送”", "确定");
|
||||
DialogUtils.showHintDialog(ReceiverWaitingActivity.this, "请告诉你的好友这样操作:", "1.打开光环助手,点击左上角“↓”" +
|
||||
"\n2.点击右上方的“免流量传送” \n3.点击“我要接收/发送”", "确定");
|
||||
}
|
||||
|
||||
private void startFileReceiverServer(int serverPort) throws Exception {
|
||||
|
||||
@ -6,6 +6,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
|
||||
import com.gh.base.BaseActivity;
|
||||
@ -19,12 +20,15 @@ import butterknife.OnClick;
|
||||
* Created by khy on 24/05/17.
|
||||
*/
|
||||
|
||||
public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.OnRefreshListener{
|
||||
public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.OnRefreshListener,
|
||||
ToolBoxRvAdapter.OnSearchCallBackListener {
|
||||
|
||||
@BindView(R.id.toolbox_rv)
|
||||
RecyclerView mToolboxRv;
|
||||
@BindView(R.id.reuse_none_data)
|
||||
LinearLayout mNoneData;
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
TextView mNoneDataTv;
|
||||
@BindView(R.id.reuse_no_connection)
|
||||
LinearLayout mNoConnection;
|
||||
@BindView(R.id.toolbox_refresh)
|
||||
@ -34,12 +38,18 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private ToolBoxRvAdapter mRvAdapter;
|
||||
private ToolBoxRvAdapter mNormalRvAdapter;
|
||||
|
||||
|
||||
private boolean mIsSearch; // 记录页面状态 搜索页面/普通页面
|
||||
private String mSearckKey; // 记录搜索关键字
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mRvAdapter = new ToolBoxRvAdapter(ToolBoxActivity.this, ToolBoxActivity.this);
|
||||
mToolboxRv.setAdapter(mRvAdapter);
|
||||
// mRvAdapter = new ToolBoxRvAdapter(ToolBoxActivity.this, ToolBoxActivity.this, ToolBoxActivity.this, mIsSearch, mSearckKey);
|
||||
// mToolboxRv.setAdapter(mRvAdapter);
|
||||
changeAdapter(true);
|
||||
}
|
||||
};
|
||||
|
||||
@ -59,10 +69,12 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
mToolboxRv.setLayoutManager(mLayoutManager);
|
||||
mRvAdapter = new ToolBoxRvAdapter(this, this);
|
||||
mToolboxRv.addItemDecoration(new VerticalItemDecoration(this, 8, true));
|
||||
mRvAdapter = new ToolBoxRvAdapter(this, this, ToolBoxActivity.this, mIsSearch, mSearckKey);
|
||||
mToolboxRv.addItemDecoration(new VerticalItemDecoration(this, 8, false));
|
||||
mToolboxRv.setAdapter(mRvAdapter);
|
||||
|
||||
mNormalRvAdapter = mRvAdapter;
|
||||
|
||||
mToolboxRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
@ -70,18 +82,26 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE
|
||||
&& mLayoutManager.findLastVisibleItemPosition() + 1 == mRvAdapter.getItemCount()) {
|
||||
if (!mRvAdapter.isOver() && !mRvAdapter.isLoading() && !mRvAdapter.isNetworkError()) {
|
||||
// mRvAdapter.loadData();
|
||||
mRvAdapter.loadData(mIsSearch, mRvAdapter.dataSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@OnClick(R.id.reuse_no_connection)
|
||||
public void onClick() {
|
||||
mLoading.setVisibility(View.VISIBLE);
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mLoading.postDelayed(runnable, 1000);
|
||||
@OnClick({R.id.reuse_no_connection, R.id.reuse_tv_none_data})
|
||||
public void onClick(View view) {
|
||||
if (view.getId() == R.id.reuse_no_connection) {
|
||||
mLoading.setVisibility(View.VISIBLE);
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mLoading.postDelayed(runnable, 1000);
|
||||
} else if (view.getId() == R.id.reuse_none_data) {
|
||||
if (mIsSearch) {
|
||||
// TODO反馈
|
||||
SuggestionActivity.startSuggestionActivity(this, 2, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,7 +110,6 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
mRefresh.setRefreshing(false);
|
||||
mNoneData.setVisibility(View.GONE);
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mToolboxRv.setVisibility(View.VISIBLE);
|
||||
mLoading.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
@ -101,8 +120,12 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
mRefresh.setRefreshing(false);
|
||||
mNoneData.setVisibility(View.VISIBLE);
|
||||
mNoConnection.setVisibility(View.GONE);
|
||||
mToolboxRv.setVisibility(View.GONE);
|
||||
mLoading.setVisibility(View.GONE);
|
||||
if (mIsSearch) {
|
||||
mNoneDataTv.setText("未找到结果,点我反馈");
|
||||
} else {
|
||||
mNoneDataTv.setText(getResources().getString(R.string.game_empty));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,7 +134,6 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
mRefresh.setRefreshing(false);
|
||||
mNoneData.setVisibility(View.GONE);
|
||||
mNoConnection.setVisibility(View.VISIBLE);
|
||||
mToolboxRv.setVisibility(View.GONE);
|
||||
mLoading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@ -119,4 +141,28 @@ public class ToolBoxActivity extends BaseActivity implements SwipeRefreshLayout.
|
||||
public void onRefresh() {
|
||||
mRefresh.postDelayed(runnable, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void search(boolean isSearch, String searchKey) {
|
||||
if (mNoneData.getVisibility() == View.VISIBLE) {
|
||||
mNoneData.setVisibility(View.GONE);
|
||||
}
|
||||
mIsSearch = isSearch;
|
||||
mSearckKey = searchKey;
|
||||
changeAdapter(false);
|
||||
}
|
||||
|
||||
private void changeAdapter(boolean isRefresh) {
|
||||
if (mIsSearch) {
|
||||
mRvAdapter = new ToolBoxRvAdapter(this, this, this, mIsSearch, mSearckKey);
|
||||
} else {
|
||||
if (mNormalRvAdapter != null && !isRefresh) {
|
||||
mRvAdapter = mNormalRvAdapter;
|
||||
} else {
|
||||
mRvAdapter = new ToolBoxRvAdapter(this, this, this, mIsSearch, null);
|
||||
mNormalRvAdapter = mRvAdapter;
|
||||
}
|
||||
}
|
||||
mToolboxRv.setAdapter(mRvAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.FileUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
@ -150,11 +149,8 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
|| "插件化下载中".equals(status)
|
||||
|| "更新下载中".equals(status)) {
|
||||
// 打开下载管理界面
|
||||
Intent intent = new Intent(mContext, DownloadManagerActivity.class);
|
||||
intent.putExtra("currentItem", 1);
|
||||
intent.putExtra("url", apkEntity.getUrl());
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, mEntrance + "(" + mLocation.split(":")[0] + ")");
|
||||
mContext.startActivity(intent);
|
||||
DownloadManagerActivity.startDownloadManagerActivity(mContext, apkEntity.getUrl()
|
||||
, mEntrance + "(" + mLocation.split(":")[0] + ")");
|
||||
} else if ("启动".equals(status)) {
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
|
||||
@ -2,8 +2,6 @@ package com.gh.gamecenter.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
@ -45,9 +43,10 @@ public class SubjectTypeAdapter extends BaseRecyclerAdapter<GameTypeViewHolder>
|
||||
textView.setTextSize(14);
|
||||
textView.setBackgroundResource(R.drawable.subject_tab_style);
|
||||
textView.setTextColor(ContextCompat.getColor(mContext, R.color.title));
|
||||
textView.setLayoutParams(new LinearLayout.LayoutParams(DisplayUtils.dip2px(mContext, 55)
|
||||
textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
, DisplayUtils.dip2px(mContext, 25)));
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setPadding(DisplayUtils.dip2px(mContext, 10), 0 , DisplayUtils.dip2px(mContext, 10), 0);
|
||||
relativeLayout.addView(textView);
|
||||
return new GameTypeViewHolder(relativeLayout);
|
||||
}
|
||||
|
||||
@ -3,16 +3,22 @@ package com.gh.gamecenter.adapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.constant.ItemViewType;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.SuggestionActivity;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.LibaoSearchViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.ToolBoxViewHolder;
|
||||
import com.gh.gamecenter.entity.ToolBoxEntity;
|
||||
import com.gh.gamecenter.listener.OnCallBackListener;
|
||||
@ -23,9 +29,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.gh.gamecenter.R.string.loading;
|
||||
|
||||
/**
|
||||
* Created by khy on 24/05/17.
|
||||
*/
|
||||
@ -33,25 +42,40 @@ import rx.schedulers.Schedulers;
|
||||
public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
|
||||
private OnCallBackListener mCallBackListener;
|
||||
private OnSearchCallBackListener mSearchListener;
|
||||
|
||||
private List<ToolBoxEntity> mEntityList;
|
||||
|
||||
private String mSerchKey;
|
||||
|
||||
private boolean mIsSearch;
|
||||
private boolean mIsLoading;
|
||||
private boolean mIsOver;
|
||||
private boolean mIsNetworkError;
|
||||
|
||||
public ToolBoxRvAdapter(Context context, OnCallBackListener listener) {
|
||||
public ToolBoxRvAdapter(Context context, OnCallBackListener listener, OnSearchCallBackListener searchListener,
|
||||
boolean isSearch, String key) {
|
||||
super(context);
|
||||
this.mIsSearch = isSearch;
|
||||
this.mSerchKey = key;
|
||||
|
||||
mSearchListener = searchListener;
|
||||
mCallBackListener = listener;
|
||||
mEntityList = new ArrayList<>();
|
||||
|
||||
loadData(0);
|
||||
loadData(isSearch, 0);
|
||||
}
|
||||
|
||||
public void loadData(int offset) {
|
||||
RetrofitManager
|
||||
.getApi()
|
||||
.getToolBoxData(offset, "")
|
||||
public void loadData(boolean isSearch, int offset) {
|
||||
mIsLoading = true;
|
||||
|
||||
Observable<List<ToolBoxEntity>> api;
|
||||
if (isSearch) {
|
||||
api = RetrofitManager.getApi().getToolBoxDataSearch(offset, mSerchKey);
|
||||
} else {
|
||||
api = RetrofitManager.getApi().getToolBoxData(offset);
|
||||
}
|
||||
|
||||
api
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<ToolBoxEntity>>(){
|
||||
@ -68,6 +92,7 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
mIsLoading = false;
|
||||
|
||||
if (mEntityList.size() == 0) {
|
||||
mCallBackListener.loadEmpty();
|
||||
@ -77,6 +102,7 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
super.onFailure(e);
|
||||
mIsLoading = false;
|
||||
if (mEntityList.size() == 0) {
|
||||
mCallBackListener.loadError();
|
||||
} else {
|
||||
@ -89,16 +115,21 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) {
|
||||
if (position == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
} else if (position == getItemCount() - 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
if (viewType == 0) {
|
||||
View view = mLayoutInflater.inflate(R.layout.libao_item_search, parent, false);
|
||||
return new LibaoSearchViewHolder(view);
|
||||
} else if (viewType == 1) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view);
|
||||
} else {
|
||||
@ -112,25 +143,105 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof ToolBoxViewHolder) {
|
||||
ToolBoxViewHolder viewHolder = (ToolBoxViewHolder) holder;
|
||||
ToolBoxEntity toolBoxEntity = mEntityList.get(position);
|
||||
ToolBoxEntity toolBoxEntity = mEntityList.get(position - 1);
|
||||
initToolBoxViewHolder(viewHolder, toolBoxEntity);
|
||||
} else if (holder instanceof FooterViewHolder) {
|
||||
FooterViewHolder viewHolder = (FooterViewHolder) holder;
|
||||
viewHolder.initItemPadding();
|
||||
viewHolder.initFooterViewHolder(mIsNetworkError, mIsOver
|
||||
, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mIsNetworkError = false;
|
||||
loadData(mEntityList.size());
|
||||
}
|
||||
});
|
||||
initFooterViewHolder(viewHolder);
|
||||
} else if (holder instanceof LibaoSearchViewHolder) {
|
||||
LibaoSearchViewHolder viewHolder = (LibaoSearchViewHolder) holder;
|
||||
initSearchViewHolder(viewHolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEntityList.size();
|
||||
if (mEntityList.size() > 0) {
|
||||
return mEntityList.size() + 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initSearchViewHolder(final LibaoSearchViewHolder viewHolder) {
|
||||
|
||||
if (mSerchKey != null) {
|
||||
viewHolder.searchEt.setText(mSerchKey);
|
||||
}
|
||||
|
||||
if (mIsSearch) {
|
||||
viewHolder.backTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.backTv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
viewHolder.backTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mSearchListener.search(false, viewHolder.searchEt.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.searchTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (TextUtils.isEmpty(viewHolder.searchEt.getText().toString())) {
|
||||
Utils.toast(mContext, "请输入关键字");
|
||||
return;
|
||||
}
|
||||
mSearchListener.search(true, viewHolder.searchEt.getText().toString());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
viewHolder.searchEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(viewHolder.searchEt.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initFooterViewHolder(FooterViewHolder viewHolder) {
|
||||
viewHolder.initItemPadding();
|
||||
if (mIsNetworkError) {
|
||||
viewHolder.lineLeft.setVisibility(View.GONE);
|
||||
viewHolder.lineRight.setVisibility(View.GONE);
|
||||
viewHolder.loading.setVisibility(View.GONE);
|
||||
viewHolder.hint.setText("加载失败,点击重试");
|
||||
viewHolder.itemView.setClickable(true);
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loadData(false, mEntityList.size());
|
||||
}
|
||||
});
|
||||
} else if (mIsOver) {
|
||||
viewHolder.lineLeft.setVisibility(View.VISIBLE);
|
||||
viewHolder.lineRight.setVisibility(View.VISIBLE);
|
||||
viewHolder.loading.setVisibility(View.GONE);
|
||||
viewHolder.hint.setText("需要什么工具,点击这里反馈");
|
||||
viewHolder.itemView.setClickable(true);
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SuggestionActivity.startSuggestionActivity(mContext, 2, null, null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
viewHolder.lineLeft.setVisibility(View.GONE);
|
||||
viewHolder.lineRight.setVisibility(View.GONE);
|
||||
viewHolder.loading.setVisibility(View.VISIBLE);
|
||||
viewHolder.hint.setText(loading);
|
||||
viewHolder.itemView.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void initToolBoxViewHolder(ToolBoxViewHolder viewHolder, final ToolBoxEntity toolBoxEntity) {
|
||||
@ -141,15 +252,30 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AppController.put("ToolBoxEntity", toolBoxEntity);
|
||||
Intent intent = new Intent(mContext, WebActivity.class);
|
||||
intent.putExtra("url", toolBoxEntity.getUrl());
|
||||
intent.putExtra("isTools", true);
|
||||
mContext.startActivity(intent);
|
||||
String url = toolBoxEntity.getUrl();
|
||||
// http://www.ghzhushou.com/article/59291e7ce9a64a496cfd6897.html
|
||||
if (url.contains("http://www.ghzhushou.com/article/")) {
|
||||
String newsId = url.substring(url.lastIndexOf("/") + 1, url.length() - 5);
|
||||
Utils.log("=========" + newsId);
|
||||
Intent intent = new Intent(mContext, NewsDetailActivity.class);
|
||||
intent.putExtra("newsId", newsId);
|
||||
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "工具箱列表");
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
AppController.put("ToolBoxEntity", toolBoxEntity);
|
||||
Intent intent = new Intent(mContext, WebActivity.class);
|
||||
intent.putExtra("url", toolBoxEntity.getUrl());
|
||||
intent.putExtra("isTools", true);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int dataSize() {
|
||||
return mEntityList.size();
|
||||
}
|
||||
|
||||
public boolean isOver() {
|
||||
return mIsOver;
|
||||
}
|
||||
@ -161,4 +287,8 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
|
||||
public boolean isNetworkError() {
|
||||
return mIsNetworkError;
|
||||
}
|
||||
|
||||
public interface OnSearchCallBackListener {
|
||||
void search(boolean isSearch, String searchKey);
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ public class GameDownLoadFragment extends Fragment implements View.OnClickListen
|
||||
|
||||
public void onEventMainThread(EBUISwitch busNine) {
|
||||
if (DownloadManagerActivity.TAG.equals(busNine.getFrom())) {
|
||||
if (busNine.getPosition() != 1) {
|
||||
if (busNine.getPosition() != 0) {
|
||||
adapter.getDeleteList().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
// CardRelativeLayout cardRelativeLayout = (CardRelativeLayout) viewHolder.itemView;
|
||||
// cardRelativeLayout.setmBottom(DisplayUtils.dip2px(mContext, 8));
|
||||
// cardRelativeLayout.setmTop(0);
|
||||
viewHolder.dm_item_head_tv_task.setText("共" + updateList.size() + "个游戏可更新,需" + getSize(size));
|
||||
viewHolder.dm_item_head_tv_task.setText(updateList.size() + "个游戏可更新,共" + getSize(size));
|
||||
|
||||
if (done == updateList.size()) {
|
||||
viewHolder.dm_item_head_tv_allstart.setText("更新完成");
|
||||
|
||||
@ -25,13 +25,13 @@ import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.LibaoUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.QQUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.GridDivider;
|
||||
import com.gh.common.view.MarqueeView;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.GameNewsActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.SuggestionActivity;
|
||||
import com.gh.gamecenter.adapter.BaseRecyclerAdapter;
|
||||
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
|
||||
import com.gh.gamecenter.db.LibaoDao;
|
||||
@ -67,8 +67,6 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
private List<LibaoEntity> mLibaoList;
|
||||
private List<ToolBoxEntity> mToolBoxList;
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private FuliFragment fuLiFragment;
|
||||
private GameDetailEntity mGameDetailEntity;
|
||||
private GameEntity mGameEntity;
|
||||
private String entrance;
|
||||
@ -82,13 +80,10 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
private boolean isOpenLibaoList;
|
||||
private boolean isOpenToolList;
|
||||
|
||||
private int offsetH = 0;
|
||||
|
||||
public FuLiAdapter(Context context, RecyclerView recyclerView, FuliFragment fuLiFragment, String entrance) {
|
||||
public FuLiAdapter(Context context, String entrance) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.mRecyclerView = recyclerView;
|
||||
this.fuLiFragment = fuLiFragment;
|
||||
|
||||
this.entrance = entrance;
|
||||
isOpenLibaoList = false;
|
||||
@ -181,7 +176,7 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
private void getToolTox() {
|
||||
RetrofitManager
|
||||
.getApi()
|
||||
.getToolBoxData(0, mGameEntity.getId())
|
||||
.getGameToolBoxData(0, mGameEntity.getId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<ToolBoxEntity>>() {
|
||||
@ -309,7 +304,7 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
layout.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(mContext, 35)));
|
||||
layout.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
TextView textView = new TextView(mContext);
|
||||
textView.setText("查看游戏介绍→");
|
||||
textView.setText("此游戏有问题?点击反馈");
|
||||
textView.setTextColor(ContextCompat.getColor(mContext, R.color.content));
|
||||
textView.setPadding(0, DisplayUtils.dip2px(mContext, 8), 0, 0);
|
||||
layout.addView(textView);
|
||||
@ -318,14 +313,6 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
view = mLayoutInflater.inflate(R.layout.reuse_none_data, parent, false);
|
||||
LinearLayout content = (LinearLayout) view.findViewById(R.id.reuse_none_data);
|
||||
content.setVisibility(View.VISIBLE);
|
||||
|
||||
TextView tv = new TextView(mContext);
|
||||
tv.setText("点击查看游戏介绍→");
|
||||
tv.setGravity(Gravity.CENTER);
|
||||
tv.setPadding(0, DisplayUtils.dip2px(mContext, 8), 0, DisplayUtils.dip2px(mContext, 80));
|
||||
tv.setTextColor(ContextCompat.getColor(mContext, R.color.c7c7c7));
|
||||
|
||||
content.addView(tv);
|
||||
return new ReuseViewHolder(view);
|
||||
case 8:
|
||||
view = mLayoutInflater.inflate(R.layout.gamedetail_item_plugin, parent, false);
|
||||
@ -355,17 +342,18 @@ public class FuLiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
GameDetailKaiFuViewHolder viewHolder = (GameDetailKaiFuViewHolder) holder;
|
||||
initKaiFuViewHolder(viewHolder);
|
||||
} else if (holder instanceof ReuseViewHolder) {
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EventBus.getDefault().post(new EBReuse(GameDetailActivity.SKIP_XINXI));
|
||||
}
|
||||
});
|
||||
// holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// EventBus.getDefault().post(new EBReuse(GameDetailActivity.SKIP_XINXI));
|
||||
// }
|
||||
// });
|
||||
} else if (holder instanceof BottomViewHolder) {
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EventBus.getDefault().post(new EBReuse(GameDetailActivity.SKIP_XINXI));
|
||||
// EventBus.getDefault().post(new EBReuse(GameDetailActivity.SKIP_XINXI));
|
||||
SuggestionActivity.startSuggestionActivity(mContext, 4, "game", mGameEntity.getName() + ",问题反馈:");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -3,18 +3,13 @@ package com.gh.gamecenter.gamedetail;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.base.BaseFragment;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.common.view.MeasureLinearLayoutManager;
|
||||
import com.gh.common.view.VerticalItemDecoration;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBMoveTop;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.eventbus.EBSlide;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
@ -39,7 +34,7 @@ public class FuliFragment extends BaseFragment {
|
||||
|
||||
mRecyclerView = (RecyclerView) view.findViewById(R.id.fm_fuli_rv);
|
||||
|
||||
mAdapter = new FuLiAdapter(getContext(), mRecyclerView, this, mEntrance);
|
||||
mAdapter = new FuLiAdapter(getContext(), mEntrance);
|
||||
|
||||
layoutManager = new MeasureLinearLayoutManager(getContext()) {
|
||||
@Override
|
||||
|
||||
@ -1,48 +1,39 @@
|
||||
package com.gh.gamecenter.gamedetail;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.common.util.ApkActiveUtils;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.RandomUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.common.view.HorizontalItemDecoration;
|
||||
import com.gh.common.view.MarqueeView;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.GameNewsActivity;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.SuggestionActivity;
|
||||
import com.gh.gamecenter.adapter.BaseRecyclerAdapter;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameDetailEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.NewsEntity;
|
||||
import com.gh.gamecenter.entity.TagEntity;
|
||||
import com.gh.gamecenter.entity.TipsEntity;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.manager.GameManager;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
@ -52,6 +43,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import retrofit2.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
@ -78,7 +70,7 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
private int position_notice = -1;
|
||||
|
||||
private boolean isOpenPlugin = false;
|
||||
|
||||
private boolean isFuliNoData;
|
||||
|
||||
public XinXiAdapter(Context context, String entrance) {
|
||||
super(context);
|
||||
@ -90,6 +82,7 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
mGameEntity = (GameEntity) AppController.get("GameEntity", false);
|
||||
|
||||
name = "游戏详情";
|
||||
isFuliNoData = false;
|
||||
|
||||
if (mGameEntity != null) {
|
||||
initPosition();
|
||||
@ -326,12 +319,12 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
} else if (holder instanceof FooterViewHolder) {
|
||||
FooterViewHolder viewHolder = (FooterViewHolder) holder;
|
||||
viewHolder.loading.setVisibility(View.GONE);
|
||||
viewHolder.hint.setText("此游戏有问题?点击反馈");
|
||||
viewHolder.hint.setText("←查看游戏动态");
|
||||
|
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SuggestionActivity.startSuggestionActivity(mContext, 4, "game", mGameEntity.getName() + ",问题反馈:");
|
||||
EventBus.getDefault().post(new EBReuse(GameDetailActivity.SKIP_FULI));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -350,7 +343,7 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
return 5;
|
||||
} else if (position_game != -1 && position_game == position) {
|
||||
return 6;
|
||||
} else if (position == getItemCount() - 1) {
|
||||
} else if (position == getItemCount() - 1 && !isFuliNoData) {
|
||||
return 101;
|
||||
} else if (position_game != -1 && mGameList != null && mGameList.size() > 0) {
|
||||
return 100;
|
||||
@ -362,6 +355,10 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
public int getItemCount() {
|
||||
int index = 1;
|
||||
|
||||
if (isFuliNoData) {
|
||||
index --;
|
||||
}
|
||||
|
||||
if (position_notice != -1) {
|
||||
index++;
|
||||
}
|
||||
@ -516,6 +513,10 @@ public class XinXiAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
return position_game;
|
||||
}
|
||||
|
||||
public void setFuliNoData(boolean b) {
|
||||
isFuliNoData = b;
|
||||
}
|
||||
|
||||
public List<GameEntity> getGameList() {
|
||||
return mGameList;
|
||||
}
|
||||
|
||||
@ -5,29 +5,26 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.base.BaseFragment;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.eventbus.EBMoveTop;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.eventbus.EBSlide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
import static com.gh.gamecenter.GameDetailActivity.OPEN_APPBAR;
|
||||
import static com.gh.gamecenter.GameDetailActivity.SKIP_XINXI;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/3/24.
|
||||
*/
|
||||
@ -72,7 +69,7 @@ public class XinXiFragment extends BaseFragment {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
int position = layoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
if (position == 0 && Math.abs(dy) > 10) {
|
||||
EventBus.getDefault().post(new EBReuse(GameDetailActivity.OPEN_APPBAR));
|
||||
EventBus.getDefault().post(new EBReuse(OPEN_APPBAR));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -90,6 +87,13 @@ public class XinXiFragment extends BaseFragment {
|
||||
DownloadManager.getInstance(getActivity()).removeObserver(dataWatcher);
|
||||
}
|
||||
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if (SKIP_XINXI.equals(reuse.getType())) {
|
||||
mAdapter.setFuliNoData(true);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// 下载被删除事件
|
||||
public void onEventMainThread(EBDownloadStatus status) {
|
||||
if ("delete".equals(status.getStatus())) {
|
||||
|
||||
@ -79,7 +79,7 @@ class Libao1FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
}
|
||||
|
||||
void addLibaoList(final boolean isSearch, int offset) {
|
||||
void addLibaoList(boolean isSearch, int offset) {
|
||||
if (isLoading) return;
|
||||
|
||||
isLoading = true;
|
||||
@ -213,7 +213,7 @@ class Libao1FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (mLibaoList.size() == 0) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
return mLibaoList.size() + ITEM_FOOTER + ITEM_SEARCH;
|
||||
}
|
||||
|
||||
@ -43,11 +43,7 @@ public class DownloadReceiver extends BroadcastReceiver {
|
||||
// 切换到游戏下载fragment
|
||||
EventBus.getDefault().post(new EBSkip(DownloadManagerActivity.TAG, 1));
|
||||
} else {
|
||||
Intent intent2 = new Intent(context, DownloadManagerActivity.class);
|
||||
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent2.putExtra(KEY_ENTRANCE, ENTRANCE_DOWNLOAD);
|
||||
intent2.putExtra(EntranceUtils.KEY_CURRENT_ITEM, 1);
|
||||
context.startActivity(intent2);
|
||||
DownloadManagerActivity.startDownloadManagerActivity(context, null, ENTRANCE_DOWNLOAD);
|
||||
}
|
||||
} else {
|
||||
// 助手未在运行
|
||||
|
||||
@ -196,6 +196,11 @@ public interface ApiService {
|
||||
Observable<ResponseBody> postVersionVote(@Header("TOKEN") String token, @Body RequestBody body, @Path("game_id") String gameId);//提交投票
|
||||
|
||||
@GET("game/toolkit")
|
||||
Observable<List<ToolBoxEntity>> getToolBoxData(@Query("offset") int offset, @Query("game_id") String gameId);
|
||||
Observable<List<ToolBoxEntity>> getGameToolBoxData(@Query("offset") int offset, @Query("game_id") String gameId);
|
||||
|
||||
@GET("toolkit")
|
||||
Observable<List<ToolBoxEntity>> getToolBoxData(@Query("offset") int offset);
|
||||
|
||||
@GET("toolkit")
|
||||
Observable<List<ToolBoxEntity>> getToolBoxDataSearch(@Query("offset") int offset, @Query("keyword") String key);
|
||||
}
|
||||
@ -81,6 +81,11 @@ public class SearchHistoryFragment extends Fragment {
|
||||
ViewGroup.LayoutParams params = mSearchHistoryRv.getLayoutParams();
|
||||
params.height = (int) Math.ceil(mHistorylist.size() / 3f) * DisplayUtils.dip2px(getContext(), 32) + DisplayUtils.dip2px(getContext(), 10);
|
||||
mSearchHistoryRv.setLayoutParams(params);
|
||||
if (mHistorylist.size() > 0) {
|
||||
mSearchHistoryRv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mSearchHistoryRv.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mSearchHotRv.setHasFixedSize(true);
|
||||
mSearchHotRv.setLayoutManager(new GridLayoutManager(getActivity(), 3) {
|
||||
|
||||
@ -53,7 +53,7 @@ class SearchHistoryFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView.setTextSize(13);
|
||||
textView.setPadding(DisplayUtils.dip2px(mContext, 10), 0, DisplayUtils.dip2px(mContext, 10), 0);
|
||||
textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT
|
||||
, DisplayUtils.dip2px(mContext, 32)));
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
textView.setBackgroundResource(R.drawable.reuse_listview_item_style);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.gamecenter.subject;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
@ -30,22 +29,21 @@ import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.SubjectTypeAdapter;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.SubjectHeadEntity;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by khy on 27/05/17.
|
||||
*/
|
||||
|
||||
public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdapter.OnSelectTypeListener {
|
||||
|
||||
|
||||
@BindView(R.id.subject_list)
|
||||
RecyclerView subject_list;
|
||||
@BindView(R.id.subject_type_list)
|
||||
@ -102,7 +100,7 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
|
||||
}
|
||||
};
|
||||
|
||||
public void loadData(){
|
||||
public void loadData() {
|
||||
subject_pb_loading.setVisibility(View.VISIBLE);
|
||||
subject_list.setVisibility(View.VISIBLE);
|
||||
reuse_no_connection.setVisibility(View.GONE);
|
||||
@ -111,7 +109,6 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -362,7 +359,7 @@ public class SubjectTileFragment extends BaseFragment implements SubjectTypeAdap
|
||||
mTabbarHotTv.setTextColor(Color.BLACK);
|
||||
mTabbarHotTv.setBackgroundDrawable(new ColorDrawable(0));
|
||||
mTabbarNewTv.setTextColor(Color.WHITE);
|
||||
mTabbarNewTv.setBackgroundResource(R.drawable.gamedetail_tag_unselect_bg );
|
||||
mTabbarNewTv.setBackgroundResource(R.drawable.gamedetail_tag_unselect_bg);
|
||||
mOrder = "latest";
|
||||
loadData();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user