|
|
@@ -57,7 +57,7 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
private final int INDEX_ORANGE = 0;
|
|
|
private final int INDEX_GREEN = 1;
|
|
|
|
|
|
- private boolean isIncreaseSort = true;
|
|
|
+ private boolean isDescendingOrder = true;
|
|
|
|
|
|
@Override
|
|
|
public String getClassUri() {
|
|
|
@@ -117,7 +117,7 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
mPresenter = new MainDashboardPresenter(getActivity(), this,
|
|
|
mAdapterGreen, mAdapterGreen,
|
|
|
mAdapterOrange, mAdapterOrange);
|
|
|
- mPresenter.initData(true);
|
|
|
+ mPresenter.initData(true, isDescendingOrder);
|
|
|
|
|
|
return parent;
|
|
|
}
|
|
|
@@ -127,7 +127,7 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
super.onResume();
|
|
|
|
|
|
if (HFInfoUtil.getNeedRefreshMainDashboardList(getActivity())) {
|
|
|
- mPresenter.initData(true);
|
|
|
+ mPresenter.initData(true, isDescendingOrder);
|
|
|
}
|
|
|
|
|
|
HFAnalyticsUtil.logEvent(this);
|
|
|
@@ -161,6 +161,23 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void initSortText() {
|
|
|
+ isDescendingOrder = true;
|
|
|
+ setSortText();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setSortText() {
|
|
|
+ if (isDescendingOrder) {
|
|
|
+ mTextViewSort.setText(R.string.main_dashboard_descending_order);
|
|
|
+ mTextViewSort.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.ic_arr_high, 0);
|
|
|
+ } else {
|
|
|
+ mTextViewSort.setText(R.string.main_dashboard_ascending_order);
|
|
|
+ mTextViewSort.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.ic_arr_low, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**************************************************
|
|
|
* View.OnClickListener
|
|
|
**************************************************/
|
|
|
@@ -175,17 +192,9 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
HFActivityUtil.startSearchActivity(getActivity());
|
|
|
break;
|
|
|
case R.id.sort_linearLayout:
|
|
|
- if (isIncreaseSort) {
|
|
|
- mTextViewSort.setText(R.string.main_dashboard_decrease_sort);
|
|
|
- mTextViewSort.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.ic_arr_high, 0);
|
|
|
- isIncreaseSort = false;
|
|
|
- } else {
|
|
|
- mTextViewSort.setText(R.string.main_dashboard_increase_sort);
|
|
|
- mTextViewSort.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.ic_arr_low, 0);
|
|
|
- isIncreaseSort = true;
|
|
|
- }
|
|
|
- mAdapterGreen.reverseSort();
|
|
|
- mAdapterGreen.notifyDataAll();
|
|
|
+ isDescendingOrder = !isDescendingOrder;
|
|
|
+ mPresenter.reverseSort();
|
|
|
+ setSortText();
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -198,7 +207,7 @@ public class MainDashboardFragment extends BaseFragment implements MainDashboard
|
|
|
SwipeRefreshLayout.OnRefreshListener onRefreshListener = new SwipeRefreshLayout.OnRefreshListener() {
|
|
|
@Override
|
|
|
public void onRefresh() {
|
|
|
- mPresenter.initData(false);
|
|
|
+ mPresenter.initData(false, isDescendingOrder);
|
|
|
}
|
|
|
};
|
|
|
|