修复部分BUG,工具箱增加搜索功能
This commit is contained in:
@ -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));
|
||||
|
||||
Reference in New Issue
Block a user