|
@@ -1,19 +1,9 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.screen.category.type3;
|
|
package kr.co.zumo.app.lifeplus.view.screen.category.type3;
|
|
|
|
|
|
|
|
-import android.os.Bundle;
|
|
|
|
|
-import android.support.annotation.NonNull;
|
|
|
|
|
-import android.support.annotation.Nullable;
|
|
|
|
|
-import android.support.design.widget.AppBarLayout;
|
|
|
|
|
-import android.support.design.widget.CoordinatorLayout;
|
|
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
|
-import android.support.v7.widget.RecyclerView;
|
|
|
|
|
-import android.view.LayoutInflater;
|
|
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
|
-import android.widget.AdapterView;
|
|
|
|
|
-import android.widget.Spinner;
|
|
|
|
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
import kr.co.zumo.app.R;
|
|
@@ -25,10 +15,9 @@ import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.custom.category.series.IMainSeriesContract;
|
|
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.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.CategoryID;
|
|
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.category.CategoryMainFragment;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.category.CategorySortScroller;
|
|
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.GridItemDecoration;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.category.IThirdCategoryMainView;
|
|
import kr.co.zumo.app.lifeplus.view.screen.category.IThirdCategoryMainView;
|
|
|
|
|
|
|
@@ -42,38 +31,11 @@ import kr.co.zumo.app.lifeplus.view.screen.category.IThirdCategoryMainView;
|
|
|
* @history 하세미 [2018-10-24] [최초 작성]
|
|
* @history 하세미 [2018-10-24] [최초 작성]
|
|
|
* @since 2018-10-24
|
|
* @since 2018-10-24
|
|
|
*/
|
|
*/
|
|
|
-public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPresenter> implements IThirdCategoryMainView {
|
|
|
|
|
|
|
+public class ThirdCategoryMainFragment extends CategoryMainFragment<ThirdCategoryMainPresenter> implements IThirdCategoryMainView {
|
|
|
|
|
|
|
|
- private CoordinatorLayout layoutRoot;
|
|
|
|
|
- private AppBarLayout appBarLayout;
|
|
|
|
|
- private MainSeriesView mainSeriesView;
|
|
|
|
|
- private RecyclerView recyclerViewThirdCategoryMain;
|
|
|
|
|
private IMainSeriesContract.Presenter seriesPresenter;
|
|
private IMainSeriesContract.Presenter seriesPresenter;
|
|
|
- private Spinner spinnerOrder;
|
|
|
|
|
- private FocusArrayAdapter arrayAdapter;
|
|
|
|
|
private ThirdCategoryMainAdapter adapter;
|
|
private ThirdCategoryMainAdapter adapter;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
|
|
- return inflater.inflate(R.layout.fragment_category_main_third, container, false);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- protected void onAfterActivityCreated(Bundle savedInstanceState) {
|
|
|
|
|
- layoutRoot = findViewById(R.id.root_layout);
|
|
|
|
|
- appBarLayout = findViewById(R.id.app_bar_layout);
|
|
|
|
|
- mainSeriesView = findViewById(R.id.series_image_text_view);
|
|
|
|
|
-
|
|
|
|
|
- recyclerViewThirdCategoryMain = findViewById(R.id.recycler_view_third_category_main);
|
|
|
|
|
- recyclerViewThirdCategoryMain.addItemDecoration(new GridItemDecoration(getActivity(), ResourceUtil.dpToPx(8), ResourceUtil.dpToPx(13), ResourceUtil.dpToPx(8), ResourceUtil.dpToPx(13)));
|
|
|
|
|
-
|
|
|
|
|
- spinnerOrder = findViewById(R.id.spinner_select_contents);
|
|
|
|
|
- List<String> spinnerList = Arrays.asList(ResourceUtil.getStringArray("main_filter"));
|
|
|
|
|
- arrayAdapter = new FocusArrayAdapter(getActivity(), R.layout.custom_spinner, spinnerList);
|
|
|
|
|
- spinnerOrder.setAdapter(arrayAdapter);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void defineActionBar(ActionBarHelper actionBarHelper) {
|
|
protected void defineActionBar(ActionBarHelper actionBarHelper) {
|
|
|
actionBarHelper.begin().title(R.string.contents_category3_action_bar_title)
|
|
actionBarHelper.begin().title(R.string.contents_category3_action_bar_title)
|
|
@@ -96,7 +58,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
spinnerOrder = null;
|
|
spinnerOrder = null;
|
|
|
}
|
|
}
|
|
|
mainSeriesView = null;
|
|
mainSeriesView = null;
|
|
|
- recyclerViewThirdCategoryMain = null;
|
|
|
|
|
|
|
+ recyclerView = null;
|
|
|
if (null != seriesPresenter) {
|
|
if (null != seriesPresenter) {
|
|
|
seriesPresenter.dispose();
|
|
seriesPresenter.dispose();
|
|
|
seriesPresenter = null;
|
|
seriesPresenter = null;
|
|
@@ -113,11 +75,24 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected String getCategoryNumber() {
|
|
|
|
|
+ return CategoryID.CATEGORY_3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void addItemDecoration() {
|
|
|
|
|
+ recyclerView.addItemDecoration(new GridItemDecoration(getActivity(), ResourceUtil.dpToPx(8), ResourceUtil.dpToPx(13), ResourceUtil.dpToPx(8), ResourceUtil.dpToPx(13)));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void hideRecommendArea() {
|
|
public void hideRecommendArea() {
|
|
|
|
|
+ space.setVisibility(View.VISIBLE);
|
|
|
|
|
+ ViewGroup.LayoutParams params = space.getLayoutParams();
|
|
|
|
|
+ params.height = ResourceUtil.dpToPx(10);
|
|
|
|
|
+ space.setLayoutParams(params);
|
|
|
|
|
+
|
|
|
mainSeriesView.setVisibility(View.GONE);
|
|
mainSeriesView.setVisibility(View.GONE);
|
|
|
- // TODO: 추후개발 예정
|
|
|
|
|
- recyclerViewThirdCategoryMain.setPadding(0, ResourceUtil.dpToPx(10), 0, 0);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -125,6 +100,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
adapter = new ThirdCategoryMainAdapter(getActivity(), bannerBeans, contents, event -> {
|
|
adapter = new ThirdCategoryMainAdapter(getActivity(), bannerBeans, contents, event -> {
|
|
|
presenter.onEvent(event);
|
|
presenter.onEvent(event);
|
|
|
});
|
|
});
|
|
|
|
|
+ recyclerView.setPadding(ResourceUtil.dpToPx(25), 0, ResourceUtil.dpToPx(25), 0);
|
|
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2);
|
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2);
|
|
|
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
|
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
|
|
@Override
|
|
@Override
|
|
@@ -142,25 +118,12 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- recyclerViewThirdCategoryMain.setLayoutManager(gridLayoutManager);
|
|
|
|
|
- recyclerViewThirdCategoryMain.setAdapter(adapter);
|
|
|
|
|
-
|
|
|
|
|
- spinnerOrder.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
- arrayAdapter.setSelectedIndex(position);
|
|
|
|
|
- presenter.onEvent(new Event.Builder(Event.ORDER).index(position).build());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNothingSelected(AdapterView<?> parent) {}
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+ recyclerView.setLayoutManager(gridLayoutManager);
|
|
|
|
|
+ recyclerView.setAdapter(adapter);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void drawRecommend(List<CategoryRecommendBean> beans) {
|
|
public void drawRecommend(List<CategoryRecommendBean> beans) {
|
|
|
- ;
|
|
|
|
|
mainSeriesView.init(getActivity(), beans, beans.size());
|
|
mainSeriesView.init(getActivity(), beans, beans.size());
|
|
|
seriesPresenter = new MainSeriesPresenter(mainSeriesView, index -> {
|
|
seriesPresenter = new MainSeriesPresenter(mainSeriesView, index -> {
|
|
|
presenter.onEvent(new Event.Builder(Event.RECOMMEND).index(index).build());
|
|
presenter.onEvent(new Event.Builder(Event.RECOMMEND).index(index).build());
|
|
@@ -170,7 +133,7 @@ public class ThirdCategoryMainFragment extends FragmentBase<ThirdCategoryMainPre
|
|
|
@Override
|
|
@Override
|
|
|
public void updateContents(List<CategoryContentsBean> contentsBeans) {
|
|
public void updateContents(List<CategoryContentsBean> contentsBeans) {
|
|
|
adapter.update(contentsBeans);
|
|
adapter.update(contentsBeans);
|
|
|
- recyclerViewThirdCategoryMain.scrollToPosition(0);
|
|
|
|
|
|
|
+ recyclerView.scrollToPosition(0);
|
|
|
|
|
|
|
|
CategorySortScroller scroller = new CategorySortScroller(layoutRoot, appBarLayout);
|
|
CategorySortScroller scroller = new CategorySortScroller(layoutRoot, appBarLayout);
|
|
|
scroller.doAppBarLayoutInitialization();
|
|
scroller.doAppBarLayoutInitialization();
|