|
|
@@ -7,12 +7,10 @@ import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
-import android.widget.TextView;
|
|
|
+import android.widget.ImageView;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
|
|
|
-import kr.co.zumo.app.lifeplus.view.command.TutorialCommand;
|
|
|
-import kr.co.zumo.app.lifeplus.view.presenter.Event;
|
|
|
|
|
|
/**
|
|
|
* TutorialPagerAdapter
|
|
|
@@ -27,6 +25,8 @@ import kr.co.zumo.app.lifeplus.view.presenter.Event;
|
|
|
*/
|
|
|
public class TutorialPagerAdapter extends PagerAdapter {
|
|
|
|
|
|
+ private View view;
|
|
|
+ private View bottomView;
|
|
|
private Presenter presenter;
|
|
|
private LayoutInflater layoutInflater;
|
|
|
private static final int VIEW_COUNT = 5;
|
|
|
@@ -44,6 +44,10 @@ public class TutorialPagerAdapter extends PagerAdapter {
|
|
|
layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
}
|
|
|
|
|
|
+ public void setBottomView(View view) {
|
|
|
+ bottomView = view;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* viewPager의 item 갯수 return
|
|
|
*
|
|
|
@@ -79,41 +83,40 @@ public class TutorialPagerAdapter extends PagerAdapter {
|
|
|
@Override
|
|
|
public Object instantiateItem(@NonNull ViewGroup container, int position) {
|
|
|
|
|
|
- Log.e("APP# TutorialPagerAdapter | instantiateItem", "|" + "position" + position);
|
|
|
- View view = layoutInflater.inflate(R.layout.tutorial_layout, container, false);
|
|
|
- TextView buttonTutorial1 = (TextView) view.findViewById(R.id.button1_tutorial);
|
|
|
- TextView buttonTutorial2 = (TextView) view.findViewById(R.id.button2_tutorial);
|
|
|
+ view = layoutInflater.inflate(R.layout.tutorial_layout, container, false);
|
|
|
+ Log.e("APP# TutorialPagerAdapter | instantiateItem", "|" + position);
|
|
|
+ ImageView imageViewTutorial = (ImageView) view.findViewById(R.id.image_view_tutorial);
|
|
|
+
|
|
|
+ switch (position) {
|
|
|
+ case 0:
|
|
|
+ bottomView.setVisibility(View.VISIBLE);
|
|
|
+ imageViewTutorial.setImageResource(R.drawable.tutorial_image1);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ bottomView.setVisibility(View.VISIBLE);
|
|
|
+ imageViewTutorial.setImageResource(R.drawable.tutorial_image2);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ bottomView.setVisibility(View.VISIBLE);
|
|
|
+ imageViewTutorial.setImageResource(R.drawable.tutorial_image3);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ bottomView.setVisibility(View.VISIBLE);
|
|
|
+ imageViewTutorial.setImageResource(R.drawable.tutorial_image4);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ //하단 바 사라짐
|
|
|
+ bottomView.setVisibility(View.GONE);
|
|
|
+ view = layoutInflater.inflate(R.layout.tutorial_last, container, false);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
|
|
|
- if (position == 4) {
|
|
|
- buttonTutorial1.setVisibility(View.INVISIBLE);
|
|
|
- buttonTutorial2.setText("닫기");
|
|
|
- }
|
|
|
|
|
|
- buttonTutorial1.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- presenter.onCommand(new TutorialCommand(Event.TUTORIAL_CLOSE));
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (buttonTutorial2.getText().equals("다음")) {
|
|
|
- buttonTutorial2.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- presenter.onCommand(new TutorialCommand(Event.TUTORIAL_NEXT));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- buttonTutorial2.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- presenter.onCommand(new TutorialCommand(Event.TUTORIAL_CLOSE));
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
container.addView(view);
|
|
|
+
|
|
|
return view;
|
|
|
}
|
|
|
|