修复已知bug
This commit is contained in:
@ -11,7 +11,6 @@ import com.halo.assistant.fragment.myconcern.MyConcernFragment;
|
||||
/**
|
||||
* 我的关注页面
|
||||
*/
|
||||
@Deprecated
|
||||
public class ConcernActivity extends NormalActivity {
|
||||
|
||||
@NonNull
|
||||
|
||||
@ -18,9 +18,6 @@ public class LibaoActivity extends NormalActivity {
|
||||
public static Intent getIntent(Context context, String entrance) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
|
||||
// return new IntentFactory.Builder(context)
|
||||
// .setActivity(LibaoActivity.class)
|
||||
// .setFragment(LibaoWrapperFragment.class).setArgs(args).build();
|
||||
return getTargetIntent(context, LibaoActivity.class, LibaoFragment.class, args);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ public class ShareCardPicActivity extends BaseActivity {
|
||||
setNavigationTitle(getString(R.string.title_share_card_pic));
|
||||
|
||||
shareArrImg = new Vector<>();
|
||||
shareArrImg.addAll(arrImg);
|
||||
if (arrImg != null) shareArrImg.addAll(arrImg);
|
||||
|
||||
mActionbar.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), android.R.color.black));
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
}
|
||||
setNavigationTitle(title);
|
||||
} else {
|
||||
setNavigationTitle(getContext().getString(R.string.answer_detail_title));
|
||||
setNavigationTitle(getString(R.string.answer_detail_title));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
|
||||
}
|
||||
} else {
|
||||
location = adapter.getLocation(downloadEntity.getUrl());
|
||||
if (location != null) {
|
||||
if (location != null && adapter.getDownloadingList().size() > 0) {
|
||||
adapter.getDownloadingList().set(location, downloadEntity);
|
||||
adapter.notifyItemChanged(adapter.getBase() + location + 1);
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ public class ConcernFragment extends NormalFragment implements SwipeRefreshLayou
|
||||
|
||||
@Override
|
||||
public void onNext(GameEntity response) {
|
||||
if (getContext().getString(R.string.ghzs_id).equals(response.getId())) {
|
||||
if (getString(R.string.ghzs_id).equals(response.getId())) {
|
||||
recommendGameList.add(response);
|
||||
} else {
|
||||
ApkActiveUtils.filterHideApk(response);
|
||||
|
||||
@ -166,10 +166,10 @@ public class Libao1Fragment extends BaseFragment implements SwipeRefreshLayout.O
|
||||
// 页面切换事件(查看历史礼包的页面)
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if (LibaoWrapperFragment.LIBAO_OPENPAGE.equals(reuse.getType())) {
|
||||
if (LibaoFragment.LIBAO_OPENPAGE.equals(reuse.getType())) {
|
||||
mAppBar.setVisibility(View.GONE);
|
||||
mRefreshLayout.setEnabled(false);
|
||||
} else if (LibaoWrapperFragment.LIBAO_CLOSEPAGE.equals(reuse.getType())) {
|
||||
} else if (LibaoFragment.LIBAO_CLOSEPAGE.equals(reuse.getType())) {
|
||||
mAppBar.setVisibility(View.VISIBLE);
|
||||
mRefreshLayout.setEnabled(true);
|
||||
} else if (OPEN_LIBAO_APPBAR.equals(reuse.getType()) && !mIsTouchScreen) {
|
||||
|
||||
@ -184,7 +184,7 @@ public class Libao2Fragment extends BaseFragment implements SwipeRefreshLayout.O
|
||||
// 资讯Fragment界面切换事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBUISwitch busNine) {
|
||||
if (LibaoWrapperFragment.EB_LIBAOACTIVITY_TAG.equals(busNine.getFrom())) {
|
||||
if (LibaoFragment.EB_LIBAOACTIVITY_TAG.equals(busNine.getFrom())) {
|
||||
if (busNine.getPosition() == 1) {
|
||||
if (mLoadingLayout.getVisibility() == View.VISIBLE) {
|
||||
adapter.addList();
|
||||
|
||||
@ -149,7 +149,7 @@ public class Libao3Fragment extends BaseFragment implements SwipeRefreshLayout.O
|
||||
// 资讯Fragment界面切换事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBUISwitch busNine) {
|
||||
if (LibaoWrapperFragment.EB_LIBAOACTIVITY_TAG.equals(busNine.getFrom())) {
|
||||
if (LibaoFragment.EB_LIBAOACTIVITY_TAG.equals(busNine.getFrom())) {
|
||||
if (busNine.getPosition() == 2) {
|
||||
if (mLoadingLayout.getVisibility() == View.VISIBLE) {
|
||||
adapter.loadData();
|
||||
|
||||
@ -25,8 +25,6 @@ import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
import static com.gh.gamecenter.libao.LibaoWrapperFragment.EB_LIBAOACTIVITY_TAG;
|
||||
|
||||
/**
|
||||
* @author CsHeng
|
||||
* @Date 17/06/2017
|
||||
@ -35,6 +33,10 @@ import static com.gh.gamecenter.libao.LibaoWrapperFragment.EB_LIBAOACTIVITY_TAG;
|
||||
|
||||
public class LibaoFragment extends BaseFragment_TabLayout {
|
||||
|
||||
public static final String EB_LIBAOACTIVITY_TAG = "LibaoActivity";
|
||||
public static final String LIBAO_OPENPAGE = "openPage";
|
||||
public static final String LIBAO_CLOSEPAGE = "closePage";
|
||||
|
||||
@BindView(R.id.libao_history_title)
|
||||
TextView mHistoryTitle;
|
||||
@BindView(R.id.fragment_tab_rl)
|
||||
@ -96,12 +98,12 @@ public class LibaoFragment extends BaseFragment_TabLayout {
|
||||
// 页面切换事件(查看历史礼包的页面)
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if (LibaoWrapperFragment.LIBAO_OPENPAGE.equals(reuse.getType())) {
|
||||
if (LIBAO_OPENPAGE.equals(reuse.getType())) {
|
||||
mTabRl.setVisibility(View.GONE);
|
||||
mHistoryTitle.setVisibility(View.VISIBLE);
|
||||
mHistoryTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.hint));
|
||||
mViewPager.setScrollable(false);
|
||||
} else if (LibaoWrapperFragment.LIBAO_CLOSEPAGE.equals(reuse.getType())) {
|
||||
} else if (LIBAO_CLOSEPAGE.equals(reuse.getType())) {
|
||||
mTabRl.setVisibility(View.VISIBLE);
|
||||
mHistoryTitle.setVisibility(View.GONE);
|
||||
mViewPager.setScrollable(true);
|
||||
|
||||
@ -117,7 +117,7 @@ class LibaoNewAdapter(context: Context, callBackListener: OnRequestCallBackListe
|
||||
val ids = builder.toString()
|
||||
|
||||
LibaoUtils.getLibaoStatus(mContext, ids, object : LibaoUtils.PostLibaoListener {
|
||||
override fun postSucced(response: Any) {
|
||||
override fun postSucced(response: Any?) {
|
||||
val statusList = response as List<LibaoStatusEntity>
|
||||
|
||||
LibaoUtils.initLiBaoEntity(statusList, mLibaoList)
|
||||
|
||||
@ -141,7 +141,7 @@ public class LibaoNewFragment extends BaseFragment implements SwipeRefreshLayout
|
||||
@Override
|
||||
public void onOpen(SwipeLayout layout) {
|
||||
swipeLayout.setSwipeEnabled(true);
|
||||
EventBus.getDefault().post(new EBReuse(LibaoWrapperFragment.LIBAO_OPENPAGE));
|
||||
EventBus.getDefault().post(new EBReuse(LibaoFragment.LIBAO_OPENPAGE));
|
||||
if (mFooterHint != null) {
|
||||
mFooterHint.setText("下拉回到最新礼包");
|
||||
}
|
||||
@ -154,7 +154,7 @@ public class LibaoNewFragment extends BaseFragment implements SwipeRefreshLayout
|
||||
|
||||
@Override
|
||||
public void onClose(SwipeLayout layout) {
|
||||
EventBus.getDefault().post(new EBReuse(LibaoWrapperFragment.LIBAO_CLOSEPAGE));
|
||||
EventBus.getDefault().post(new EBReuse(LibaoFragment.LIBAO_CLOSEPAGE));
|
||||
swipeLayout.setSwipeEnabled(false);
|
||||
mAdapter.notifyItemChanged(mAdapter.getItemCount() - 1);
|
||||
}
|
||||
|
||||
@ -1,183 +0,0 @@
|
||||
package com.gh.gamecenter.libao;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.gh.base.adapter.FragmentAdapter;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.RandomUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.eventbus.EBUISwitch;
|
||||
import com.gh.gamecenter.normal.NormalFragment;
|
||||
import com.lightgame.view.NoScrollableViewPager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
/**
|
||||
* Created by CsHeng on 15/12/2017.
|
||||
*/
|
||||
|
||||
public class LibaoWrapperFragment extends NormalFragment implements View.OnClickListener,
|
||||
ViewPager.OnPageChangeListener {
|
||||
|
||||
@BindView(R.id.libao_vp_content)
|
||||
NoScrollableViewPager mLibaoVp;
|
||||
@BindView(R.id.libao_ll_top)
|
||||
View mLibaoTopLl;
|
||||
@BindView(R.id.libao_slide_line)
|
||||
View mLibaoLine;
|
||||
@BindView(R.id.libao_history_title)
|
||||
TextView mHistoryTitle;
|
||||
@BindView(R.id.libao_zuixun_tv)
|
||||
TextView mZuixinTv;
|
||||
@BindView(R.id.libao_concern_tv)
|
||||
TextView mGuanzhuTv;
|
||||
@BindView(R.id.libao_chunhaoxiang_tv)
|
||||
TextView mChunhaoxiangTv;
|
||||
|
||||
private LinearLayout.LayoutParams mLayoutParams;
|
||||
|
||||
public static final String EB_LIBAOACTIVITY_TAG = "LibaoActivity";
|
||||
public static final String LIBAO_OPENPAGE = "openPage";
|
||||
public static final String LIBAO_CLOSEPAGE = "closePage";
|
||||
|
||||
private int mCurrentItem;
|
||||
private int mWidth;
|
||||
private Libao1Fragment mLibao1Fragment;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_libao_wrapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof Activity) {
|
||||
((Activity) context).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setNavigationTitle(R.string.title_libao);
|
||||
|
||||
mZuixinTv.setSelected(true);
|
||||
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
mLibao1Fragment = new Libao1Fragment();
|
||||
list.add(mLibao1Fragment);
|
||||
list.add(new Libao2Fragment());
|
||||
list.add(new Libao3Fragment());
|
||||
mLibaoVp.setAdapter(new FragmentAdapter(getChildFragmentManager(), list));
|
||||
mLibaoVp.addOnPageChangeListener(this);
|
||||
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
|
||||
mWidth = outMetrics.widthPixels / 3;
|
||||
mLayoutParams = new LinearLayout.LayoutParams(mWidth / 2, DisplayUtils.dip2px(getContext(), 2));
|
||||
mLayoutParams.leftMargin = RandomUtils.getInt(mWidth * (mCurrentItem + 0.25f));
|
||||
mLibaoLine.setLayoutParams(mLayoutParams);
|
||||
|
||||
mLibaoTopLl.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventBus.getDefault().post(new EBUISwitch(EB_LIBAOACTIVITY_TAG, 0));
|
||||
}
|
||||
}, 100);
|
||||
|
||||
}
|
||||
|
||||
@OnClick({R.id.libao_zuixun_tv, R.id.libao_concern_tv, R.id.libao_chunhaoxiang_tv})
|
||||
public void onClick(View v) {
|
||||
if (v == mZuixinTv) {
|
||||
mLibaoVp.setCurrentItem(0);
|
||||
} else if (v == mGuanzhuTv) {
|
||||
mLibaoVp.setCurrentItem(1);
|
||||
} else if (v == mChunhaoxiangTv) {
|
||||
mLibaoVp.setCurrentItem(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
if (positionOffset != 0) {
|
||||
mLayoutParams.leftMargin = RandomUtils.getInt(mWidth * (position + positionOffset + 0.25f));
|
||||
mLibaoLine.setLayoutParams(mLayoutParams);
|
||||
} else {
|
||||
if (mCurrentItem != mLibaoVp.getCurrentItem()) {
|
||||
mCurrentItem = mLibaoVp.getCurrentItem();
|
||||
EventBus.getDefault().post(new EBUISwitch(EB_LIBAOACTIVITY_TAG, mCurrentItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
mZuixinTv.setSelected(true);
|
||||
mGuanzhuTv.setSelected(false);
|
||||
mChunhaoxiangTv.setSelected(false);
|
||||
break;
|
||||
case 1:
|
||||
mZuixinTv.setSelected(false);
|
||||
mGuanzhuTv.setSelected(true);
|
||||
mChunhaoxiangTv.setSelected(false);
|
||||
break;
|
||||
case 2:
|
||||
mZuixinTv.setSelected(false);
|
||||
mGuanzhuTv.setSelected(false);
|
||||
mChunhaoxiangTv.setSelected(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
|
||||
// 页面切换事件(查看历史礼包的页面)
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBReuse reuse) {
|
||||
if (LIBAO_OPENPAGE.equals(reuse.getType())) {
|
||||
mLibaoTopLl.setVisibility(View.GONE);
|
||||
mLibaoLine.setVisibility(View.GONE);
|
||||
mHistoryTitle.setVisibility(View.VISIBLE);
|
||||
mHistoryTitle.setTextColor(ContextCompat.getColor(getContext(), R.color.hint));
|
||||
mLibaoVp.setScrollable(false);
|
||||
} else if (LIBAO_CLOSEPAGE.equals(reuse.getType())) {
|
||||
mLibaoTopLl.setVisibility(View.VISIBLE);
|
||||
mLibaoLine.setVisibility(View.VISIBLE);
|
||||
mHistoryTitle.setVisibility(View.GONE);
|
||||
mLibaoVp.setScrollable(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouchEvent(MotionEvent event) {
|
||||
if (mLibao1Fragment != null) mLibao1Fragment.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user