|
|
@@ -1,6 +1,5 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.screen.category.type3;
|
|
|
|
|
|
-import android.graphics.Typeface;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
@@ -8,14 +7,11 @@ 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 android.widget.TextView;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
@@ -32,6 +28,8 @@ import kr.co.zumo.app.lifeplus.view.custom.category.series.IMainSeriesContract;
|
|
|
import kr.co.zumo.app.lifeplus.view.custom.category.series.MainSeriesPresenter;
|
|
|
import kr.co.zumo.app.lifeplus.view.custom.category.series.MainSeriesView;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.category.CategorySortScroller;
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.category.FocusArrayAdapter;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.category.GridItemDecoration;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.category.IThirdCategoryMainView;
|
|
|
|
|
|
@@ -53,7 +51,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
private RecyclerView recyclerViewThirdCategoryMain;
|
|
|
private IMainSeriesContract.Presenter seriesPresenter;
|
|
|
private Spinner spinnerOrder;
|
|
|
- private int selectedIndex = -1;
|
|
|
+ private FocusArrayAdapter arrayAdapter;
|
|
|
private ThirdCategoryMainAdapter adapter;
|
|
|
|
|
|
|
|
|
@@ -73,26 +71,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
|
|
|
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.custom_spinner, 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));
|
|
|
- ((TextView)view.findViewById(R.id.spinner_text)).setTypeface(null, Typeface.BOLD);
|
|
|
- }
|
|
|
- }
|
|
|
- //select 된 값 지정
|
|
|
- if (position == selectedIndex) {
|
|
|
- view.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));
|
|
|
- ((TextView)view.findViewById(R.id.spinner_text)).setTypeface(null, Typeface.BOLD);
|
|
|
- }
|
|
|
- return view;
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
+ arrayAdapter = new FocusArrayAdapter(getActivity(), R.layout.custom_spinner, spinnerList);
|
|
|
spinnerOrder.setAdapter(arrayAdapter);
|
|
|
}
|
|
|
|
|
|
@@ -168,7 +147,6 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
spinnerOrder.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
@Override
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
- selectedIndex = position;
|
|
|
presenter.onEvent(new Event.Builder(Event.ORDER).index(position).build());
|
|
|
}
|
|
|
|
|
|
@@ -179,9 +157,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void drawRecommend(ArrayList<CategoryRecommendBean> beans) {
|
|
|
- Log.i("APP# ThirdCategoryMainFragment | drawRecommend", "| 1" + beans);
|
|
|
- Log.i("APP# ThirdCategoryMainFragment | drawRecommend", "| 2" + mainSeriesView);
|
|
|
+ public void drawRecommend(ArrayList<CategoryRecommendBean> beans) { ;
|
|
|
mainSeriesView.init(getActivity(), beans, beans.size());
|
|
|
seriesPresenter = new MainSeriesPresenter(mainSeriesView, index -> {
|
|
|
presenter.onEvent(new Event.Builder(Event.RECOMMEND).index(index).build());
|
|
|
@@ -193,11 +169,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
adapter.update(contentsBeans);
|
|
|
recyclerViewThirdCategoryMain.scrollToPosition(0);
|
|
|
|
|
|
- CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams();
|
|
|
- AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior();
|
|
|
- if (null != behavior) {
|
|
|
- behavior.setTopAndBottomOffset(0);
|
|
|
- behavior.onNestedPreScroll(layoutRoot, appBarLayout, null, 0, 1, new int[2], 0);
|
|
|
- }
|
|
|
+ CategorySortScroller scroller = new CategorySortScroller(layoutRoot, appBarLayout);
|
|
|
+ scroller.doAppBarLayoutInitialization();
|
|
|
}
|
|
|
}
|