Explorar o código

[LP소개][Common] viewpager swipe 안되게 막음

Hasemi %!s(int64=7) %!d(string=hai) anos
pai
achega
8bbbe78011

+ 54 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/SwipeNoneViewPager.java

@@ -0,0 +1,54 @@
+package kr.co.zumo.app.lifeplus.view.custom;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+/**
+ * CustomViewPager
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2018-11-16]   [최초 작성]
+ * @since 2018-11-16
+ */
+public class SwipeNoneViewPager extends ViewPager {
+
+  private boolean enabled;
+
+  public SwipeNoneViewPager(@NonNull Context context) {
+    super(context);
+  }
+
+  public SwipeNoneViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
+    super(context, attrs);
+  }
+
+  @Override
+  public boolean onTouchEvent(MotionEvent event) {
+    if (this.enabled) {
+      return super.onTouchEvent(event);
+    }
+
+    return false;
+  }
+
+  @Override
+  public boolean onInterceptTouchEvent(MotionEvent event) {
+    if (this.enabled) {
+      return super.onInterceptTouchEvent(event);
+    }
+
+    return false;
+  }
+
+  public void setPagingEnabled(boolean enabled) {
+    this.enabled = enabled;
+  }
+
+}

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/factory/BasicFragmentFactory.java

@@ -20,7 +20,7 @@ import kr.co.zumo.app.lifeplus.view.screen.event.EventFragment;
 import kr.co.zumo.app.lifeplus.view.screen.faq.FAQFragment;
 import kr.co.zumo.app.lifeplus.view.screen.faq.FAQWriteFragment;
 import kr.co.zumo.app.lifeplus.view.screen.faq.MyFAQFragment;
-import kr.co.zumo.app.lifeplus.view.screen.guide.LifeplusIntroductionFramgment;
+import kr.co.zumo.app.lifeplus.view.screen.guide.LifeplusIntroductionFragment;
 import kr.co.zumo.app.lifeplus.view.screen.info.PermissionInfoFragment;
 import kr.co.zumo.app.lifeplus.view.screen.main.MainFragment;
 import kr.co.zumo.app.lifeplus.view.screen.main.pin.MainPinUnlockFragment;
@@ -242,7 +242,7 @@ public class BasicFragmentFactory extends FragmentFactory {
         fragment = new MyPurchaseHistoryFragment();
         break;
       case ScreenID.LIFE_PLUS_INTRODUCTION:
-        fragment = new LifeplusIntroductionFramgment();
+        fragment = new LifeplusIntroductionFragment();
         break;
       case ScreenID.SETTING_MEMBER_INFO:
         fragment = new SettingMemberInfoFragment();

+ 5 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/guide/LifeplusIntroductionFramgment.java

@@ -4,7 +4,6 @@ import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.design.widget.TabLayout;
-import android.support.v4.view.ViewPager;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -12,6 +11,7 @@ import android.view.ViewGroup;
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
 import kr.co.zumo.app.lifeplus.model.BlankModel;
+import kr.co.zumo.app.lifeplus.view.custom.SwipeNoneViewPager;
 import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
 
 /**
@@ -24,10 +24,10 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
  * @history 하세미   [2018-11-16]   [최초 작성]
  * @since 2018-11-16
  */
-public class LifeplusIntroductionFramgment extends FragmentBase<LifeplusIntroductionPresenter> {
+public class LifeplusIntroductionFragment extends FragmentBase<LifeplusIntroductionPresenter> {
 
   private TabLayout tabLayoutIntroduction;
-  private ViewPager viewPagerIntroduction;
+  private SwipeNoneViewPager viewPagerIntroduction;
   private LifeplusIntroductionPagerAdapter pagerAdapter;
 
   private static final String APP_GUIDE = "App 이용가이드";
@@ -44,7 +44,8 @@ public class LifeplusIntroductionFramgment extends FragmentBase<LifeplusIntroduc
     tabLayoutIntroduction = findViewById(R.id.life_plus_tab_layout);
     tabLayoutIntroduction.setTabGravity(TabLayout.GRAVITY_FILL);
     viewPagerIntroduction = findViewById(R.id.life_plus_view_pager);
-   // tabLayoutIntroduction.setAnimation(Animation.ABSOLUTE);
+    viewPagerIntroduction.setPagingEnabled(false);
+
 
     String[] tabs = {APP_GUIDE, LIFE_PLUS_BRAND};
     pagerAdapter = new LifeplusIntroductionPagerAdapter(getChildFragmentManager(), tabs);

+ 1 - 1
app/src/main/res/layout/fragment_life_plus_introduction.xml

@@ -25,7 +25,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <android.support.v4.view.ViewPager
+    <kr.co.zumo.app.lifeplus.view.custom.SwipeNoneViewPager
       android:id="@+id/life_plus_view_pager"
       android:layout_width="match_parent"
       android:layout_height="match_parent"/>