content: /*
   * This file is part of AdGuard Content Blocker (https://github.com/AdguardTeam/ContentBlocker).
   * Copyright © 2018 AdGuard Content Blocker. All rights reserved.
   * <p/>
   * AdGuard Content Blocker is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by the
   * Free Software Foundation, either version 3 of the License, or (at your option)
   * any later version.
   * <p/>
   * AdGuard Content Blocker is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   * <p/>
   * You should have received a copy of the GNU General Public License along with
   * AdGuard Content Blocker.  If not, see <http://www.gnu.org/licenses/>.
   */
  package com.adguard.android.contentblocker.ui;
  
  import android.annotation.SuppressLint;
  import android.content.Context;
  import android.util.AttributeSet;
  import android.view.MotionEvent;
  
  import androidx.viewpager.widget.ViewPager;
  
  public class ClickViewPager extends ViewPager {
  
      private boolean enabled;
  
      public ClickViewPager(Context context, AttributeSet attrs) {
          super(context, attrs);
          this.enabled = true;
      }
  
      @Override
      @SuppressLint("ClickableViewAccessibility")
      public boolean onTouchEvent(MotionEvent event) {
          return this.enabled && super.onTouchEvent(event);
      }
  
      @Override
      public boolean onInterceptTouchEvent(MotionEvent event) {
          return this.enabled && super.onInterceptTouchEvent(event);
      }
  
      public void setPagingEnabled(boolean enabled) {
          this.enabled = enabled;
      }
  }
  