--- /dev/null
+/*
+ * Copyright © 2019 Soren Stoutner <soren@stoutner.com>.
+ *
+ * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
+ *
+ * Privacy Browser 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.
+ *
+ * Privacy Browser 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.stoutner.privacybrowser.views;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.viewpager.widget.ViewPager;
+
+public class NoSwipeViewPager extends ViewPager {
+ // The basic constructor
+ public NoSwipeViewPager(@NonNull Context context) {
+ // Roll up to the full constructor.
+ this(context, null);
+ }
+
+ // The full constructor.
+ public NoSwipeViewPager(@NonNull Context context, @Nullable AttributeSet attributeSet) {
+ // Run the default commands.
+ super(context, attributeSet);
+ }
+
+ // It is necessary to override `performClick()` when overriding `onTouchEvent()`
+ @Override
+ public boolean performClick() {
+ // Run the default commands.
+ super.performClick();
+
+ // Do not consume the events.
+ return false;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ // `onTouchEvent()` requires calling `performClick()`.
+ performClick();
+
+ // Do not allow swiping.
+ return false;
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent event) {
+ // Do not allow swiping.
+ return false;
+ }
+}
\ No newline at end of file
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/about_coordinatorlayout"
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fitsSystemWindows="true">
android:id="@+id/about_tablayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android.support.design:tabMode="scrollable"
- android.support.design:tabIndicatorColor="?attr/tabIndicatorColor"
+ app:tabMode="scrollable"
+ app:tabIndicatorColor="?attr/tabIndicatorColor"
android:theme="?attr/tabLayoutTheme" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/guide_coordinatorlayout"
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fitsSystemWindows="true" >
android:id="@+id/guide_tablayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android.support.design:tabMode="scrollable"
- android.support.design:tabIndicatorColor="?attr/tabIndicatorColor"
+ app:tabMode="scrollable"
+ app:tabIndicatorColor="?attr/tabIndicatorColor"
android:theme="?attr/tabLayoutTheme" />
</com.google.android.material.appbar.AppBarLayout>
android:onClick="onClickRadioButton" />
</RadioGroup>
- <!-- Align the EditText and the select file button horizontally. -->
+ <!-- Align the edit text and the select file button horizontally. -->
<LinearLayout
android:id="@+id/file_name_linearlayout"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
- <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
+ <!-- The text input layout makes the hint float above the edit text. -->
<com.google.android.material.textfield.TextInputLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_framelayout"
android:layout_height="match_parent"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android.support.design:layout_scrollFlags="scroll|enterAlways|snap" />
+ app:layout_scrollFlags="scroll|enterAlways|snap" />
<!-- The find on page linear layout. It is initially `visibility="gone"`. -->
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:visibility="gone"
- android.support.design:layout_scrollFlags="scroll|enterAlways|snap" >
+ app:layout_scrollFlags="scroll|enterAlways|snap" >
<!-- `android:imeOptions="actionDone"` sets the keyboard to have a `check mark` key instead of a `new line` key. -->
<EditText
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal"
- android.support.design:layout_scrollFlags="scroll|enterAlways|snap" >
+ app:layout_scrollFlags="scroll|enterAlways|snap" >
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
- android.support.design:tabIndicatorGravity="top"
- android.support.design:tabMode="scrollable" />
+ app:tabIndicatorGravity="top"
+ app:tabMode="scrollable" />
<ImageView
android:layout_height="wrap_content"
android:id="@+id/swiperefreshlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android.support.design:layout_behavior="@string/appbar_scrolling_view_behavior" >
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" >
- <androidx.viewpager.widget.ViewPager
+ <com.stoutner.privacybrowser.views.NoSwipeViewPager
android:id="@+id/webviewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
- android.support.design:headerLayout="@layout/navigation_header"
- android.support.design:menu="@menu/webview_navigation_menu"
- android.support.design:itemIconTint="?attr/navigationIconTintColor" />
+ app:headerLayout="@layout/navigation_header"
+ app:menu="@menu/webview_navigation_menu"
+ app:itemIconTint="?attr/navigationIconTintColor" />
<!-- Include the bookmarks drawer, which varies based on screen width. -->
<include layout="@layout/bookmarks_drawer" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical">
android:id="@+id/pinned_ssl_certificate_mismatch_tablayout"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android.support.design:tabMode="scrollable"
+ app:tabMode="scrollable"
android:theme="?attr/dialogTabLayoutTheme" />
<ScrollView