|
|
|
@ -80,15 +80,15 @@ public class HomeActivity extends BaseActivity { |
|
|
|
private SortAdapter sortAdapter; |
|
|
|
private SortAdapter sortAdapter; |
|
|
|
private HomePageAdapter pageAdapter; |
|
|
|
private HomePageAdapter pageAdapter; |
|
|
|
private View currentView; |
|
|
|
private View currentView; |
|
|
|
private List<BaseLazyFragment> fragments = new ArrayList<>(); |
|
|
|
private final List<BaseLazyFragment> fragments = new ArrayList<>(); |
|
|
|
private boolean isDownOrUp = false; |
|
|
|
private boolean isDownOrUp = false; |
|
|
|
private boolean sortChange = false; |
|
|
|
private boolean sortChange = false; |
|
|
|
private int currentSelected = 0; |
|
|
|
private int currentSelected = 0; |
|
|
|
private int sortFocused = 0; |
|
|
|
private int sortFocused = 0; |
|
|
|
public View sortFocusView = null; |
|
|
|
public View sortFocusView = null; |
|
|
|
private Handler mHandler = new Handler(); |
|
|
|
private final Handler mHandler = new Handler(); |
|
|
|
private long mExitTime = 0; |
|
|
|
private long mExitTime = 0; |
|
|
|
private Runnable mRunnable = new Runnable() { |
|
|
|
private final Runnable mRunnable = new Runnable() { |
|
|
|
@SuppressLint({"DefaultLocale", "SetTextI18n"}) |
|
|
|
@SuppressLint({"DefaultLocale", "SetTextI18n"}) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
@ -153,8 +153,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
textView.invalidate(); |
|
|
|
textView.invalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public View v = view; |
|
|
|
public final int p = position; |
|
|
|
public int p = position; |
|
|
|
|
|
|
|
}, 10); |
|
|
|
}, 10); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -265,13 +264,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
if (home != null && home.getName() != null && !home.getName().isEmpty()) |
|
|
|
if (home != null && home.getName() != null && !home.getName().isEmpty()) |
|
|
|
tvName.setText(home.getName()); |
|
|
|
tvName.setText(home.getName()); |
|
|
|
if (dataInitOk && jarInitOk) { |
|
|
|
if (dataInitOk && jarInitOk) { |
|
|
|
showLoading(); |
|
|
|
|
|
|
|
sourceViewModel.getSort(ApiConfig.get().getHomeSourceBean().getKey()); |
|
|
|
sourceViewModel.getSort(ApiConfig.get().getHomeSourceBean().getKey()); |
|
|
|
if (hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { |
|
|
|
|
|
|
|
LOG.e("有"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
LOG.e("无"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
showLoading(); |
|
|
|
showLoading(); |
|
|
|
@ -307,7 +300,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
mHandler.post(new Runnable() { |
|
|
|
mHandler.post(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
Toast.makeText(HomeActivity.this, "jar加载失败", Toast.LENGTH_SHORT).show(); |
|
|
|
Toast.makeText(HomeActivity.this, "jar加载失败;尝试加载上一次缓存", Toast.LENGTH_SHORT).show(); |
|
|
|
initData(); |
|
|
|
initData(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -521,7 +514,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
currentView.findViewById(R.id.tvFilter).setVisibility(visible ? View.GONE : View.VISIBLE); |
|
|
|
currentView.findViewById(R.id.tvFilter).setVisibility(visible ? View.GONE : View.VISIBLE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Runnable mDataRunnable = new Runnable() { |
|
|
|
private final Runnable mDataRunnable = new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
if (sortChange) { |
|
|
|
if (sortChange) { |
|
|
|
@ -529,11 +522,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
if (sortFocused != currentSelected) { |
|
|
|
if (sortFocused != currentSelected) { |
|
|
|
currentSelected = sortFocused; |
|
|
|
currentSelected = sortFocused; |
|
|
|
mViewPager.setCurrentItem(sortFocused, false); |
|
|
|
mViewPager.setCurrentItem(sortFocused, false); |
|
|
|
if (sortFocused == 0) { |
|
|
|
changeTop(sortFocused != 0); |
|
|
|
changeTop(false); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
changeTop(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -588,38 +577,27 @@ public class HomeActivity extends BaseActivity { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (hide && topHide == 0) { |
|
|
|
if (hide && topHide == 0) { |
|
|
|
animatorSet.playTogether(new Animator[]{ |
|
|
|
animatorSet.playTogether(ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), |
|
|
|
ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 10.0f), |
|
|
|
new Object[]{ |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 0.0f)), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 10.0f)), |
|
|
|
|
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 0.0f)) |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), |
|
|
|
ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), |
|
|
|
new Object[]{ |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 50.0f), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 50.0f)), |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 1.0f)), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 1.0f)) |
|
|
|
ObjectAnimator.ofFloat(this.topLayout, "alpha", 1.0f, 0.0f)); |
|
|
|
}), |
|
|
|
|
|
|
|
ObjectAnimator.ofFloat(this.topLayout, "alpha", new float[]{1.0f, 0.0f})}); |
|
|
|
|
|
|
|
animatorSet.setDuration(200); |
|
|
|
animatorSet.setDuration(200); |
|
|
|
animatorSet.start(); |
|
|
|
animatorSet.start(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!hide && topHide == 1) { |
|
|
|
if (!hide && topHide == 1) { |
|
|
|
animatorSet.playTogether(new Animator[]{ |
|
|
|
animatorSet.playTogether(ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), |
|
|
|
ObjectAnimator.ofObject(viewObj, "marginTop", new IntEvaluator(), |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 0.0f), |
|
|
|
new Object[]{ |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 10.0f)), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 0.0f)), |
|
|
|
|
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 10.0f)) |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), |
|
|
|
ObjectAnimator.ofObject(viewObj, "height", new IntEvaluator(), |
|
|
|
new Object[]{ |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 1.0f), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 1.0f)), |
|
|
|
AutoSizeUtils.mm2px(this.mContext, 50.0f)), |
|
|
|
Integer.valueOf(AutoSizeUtils.mm2px(this.mContext, 50.0f)) |
|
|
|
ObjectAnimator.ofFloat(this.topLayout, "alpha", 0.0f, 1.0f)); |
|
|
|
}), |
|
|
|
|
|
|
|
ObjectAnimator.ofFloat(this.topLayout, "alpha", new float[]{0.0f, 1.0f})}); |
|
|
|
|
|
|
|
animatorSet.setDuration(200); |
|
|
|
animatorSet.setDuration(200); |
|
|
|
animatorSet.start(); |
|
|
|
animatorSet.start(); |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|