|
|
@@ -7,14 +7,16 @@ import android.support.design.widget.AppBarLayout;
|
|
|
import android.support.design.widget.CoordinatorLayout;
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
-import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.AdapterView;
|
|
|
+import android.widget.ArrayAdapter;
|
|
|
import android.widget.Spinner;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.CategoryBannerBean;
|
|
|
@@ -50,6 +52,7 @@ public class FirstCategoryMainFragment extends FragmentBase<FirstCategoryMainPre
|
|
|
private IMainSeriesContract.Presenter seriesPresenter;
|
|
|
private Spinner spinnerOrder;
|
|
|
private FirstCategoryMainAdapter firstCategoryMainAdapter;
|
|
|
+ private int selectedIndex = -1;
|
|
|
|
|
|
@Nullable
|
|
|
@Override
|
|
|
@@ -66,6 +69,24 @@ public class FirstCategoryMainFragment extends FragmentBase<FirstCategoryMainPre
|
|
|
recyclerViewFirstCategoryMain.addItemDecoration(new GridItemDecoration(getActivity(), ResourceUtil.dpToPx(4)));
|
|
|
viewFilter = findViewById(R.id.first_category_main_filter);
|
|
|
spinnerOrder = findViewById(R.id.spinner_select_contents);
|
|
|
+ List<String> spinnerList = Arrays.asList(ResourceUtil.getStringArray("main_filter"));
|
|
|
+ ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.support_simple_spinner_dropdown_item, spinnerList) {
|
|
|
+ @Override
|
|
|
+ public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
|
|
+ View view = super.getDropDownView(position, convertView, parent);
|
|
|
+ //초기값 설정
|
|
|
+ if (selectedIndex == -1) {
|
|
|
+ if (position == 0) {view.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));}
|
|
|
+ }
|
|
|
+ //select 된 값 지정
|
|
|
+ if (position == selectedIndex) {
|
|
|
+ view.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));
|
|
|
+ }
|
|
|
+ return view;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ spinnerOrder.setAdapter(arrayAdapter);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -145,7 +166,7 @@ public class FirstCategoryMainFragment extends FragmentBase<FirstCategoryMainPre
|
|
|
spinnerOrder.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
@Override
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- Log.e("APP# FirstCategoryMainFragment | onItemSelected", "|" + "=================================>");
|
|
|
+ selectedIndex = position;
|
|
|
presenter.onEvent(new Event.Builder(Event.ORDER).index(position).build());
|
|
|
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
|
|
|
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior();
|
|
|
@@ -167,7 +188,6 @@ public class FirstCategoryMainFragment extends FragmentBase<FirstCategoryMainPre
|
|
|
public void drawRecommend(ArrayList<CategoryRecommendBean> beans) {
|
|
|
mainSeriesView.init(getActivity(), beans, beans.size());
|
|
|
seriesPresenter = new MainSeriesPresenter(mainSeriesView, index -> {
|
|
|
- Log.e("APP# FirstCategoryMainFragment | drawRecommend", "|" + index);
|
|
|
presenter.onEvent(new Event.Builder(Event.RECOMMEND).index(index).build());
|
|
|
});
|
|
|
}
|