Use drakeet drawer
This commit is contained in:
8 files changed
+53
-104
No files matched your search
+1
-1
@@ -95,6 +95,7 @@ dependencies {
|
||||
implementation "androidx.recyclerview:recyclerview:1.2.0-beta02"
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
|
||||
implementation 'androidx.webkit:webkit:1.4.0'
|
||||
implementation 'com.drakeet.drawer:drawer:1.0.3'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'com.getkeepsafe.relinker:relinker:1.4.1'
|
||||
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
|
||||
@@ -117,7 +118,6 @@ dependencies {
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1'
|
||||
implementation 'com.takisoft.preferencex:preferencex:1.1.0'
|
||||
implementation 'com.gitlab.NekoInverter:DrawerLayout:4e79840448'
|
||||
implementation 'com.github.NekoInverter:Image:8fd6c1e1df'
|
||||
implementation 'com.gitlab.NekoInverter:yorozuya:723dc867a9'
|
||||
implementation 'dev.rikka.rikkax.preference:simplemenu-preference:1.0.2'
|
||||
|
||||
@@ -41,11 +41,11 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.hippo.drawerlayout.DrawerLayout;
|
||||
import com.hippo.ehviewer.AppConfig;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
@@ -641,18 +641,4 @@ public final class MainActivity extends StageActivity
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setDrawerGestureBlocker(EhDrawerLayout.GestureBlocker gestureBlocker) {
|
||||
if (mDrawerLayout != null) {
|
||||
mDrawerLayout.setGestureBlocker(gestureBlocker);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDrawersVisible() {
|
||||
if (mDrawerLayout != null) {
|
||||
return mDrawerLayout.isDrawersVisible();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,13 +102,6 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDrawerGestureBlocker(EhDrawerLayout.GestureBlocker gestureBlocker) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
((MainActivity) activity).setDrawerGestureBlocker(gestureBlocker);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleDrawer(int drawerGravity) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
@@ -116,15 +109,6 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDrawersVisible() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
return ((MainActivity) activity).isDrawersVisible();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void showTip(CharSequence message, int length) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
|
||||
@@ -37,11 +37,9 @@ import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -103,7 +101,6 @@ import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.GalleryActivity;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.ehviewer.ui.annotation.WholeLifeCircle;
|
||||
import com.hippo.ehviewer.widget.EhDrawerLayout;
|
||||
import com.hippo.ehviewer.widget.GalleryRatingBar;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
@@ -513,35 +510,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
View actionsScrollView = ViewUtils.$$(view, R.id.actions_scroll_view);
|
||||
setDrawerGestureBlocker(new EhDrawerLayout.GestureBlocker() {
|
||||
private void transformPointToViewLocal(int[] point, View child) {
|
||||
ViewParent viewParent = child.getParent();
|
||||
|
||||
while (viewParent instanceof View) {
|
||||
View view = (View) viewParent;
|
||||
point[0] += view.getScrollX() - child.getLeft();
|
||||
point[1] += view.getScrollY() - child.getTop();
|
||||
|
||||
if (view instanceof EhDrawerLayout) {
|
||||
break;
|
||||
}
|
||||
|
||||
child = view;
|
||||
viewParent = child.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBlockGesture(MotionEvent ev) {
|
||||
int[] point = new int[]{(int) ev.getX(), (int) ev.getY()};
|
||||
transformPointToViewLocal(point, actionsScrollView);
|
||||
return !isDrawersVisible()
|
||||
&& point[0] > 0 && point[0] < actionsScrollView.getWidth()
|
||||
&& point[1] > 0 && point[1] < actionsScrollView.getHeight();
|
||||
}
|
||||
});
|
||||
|
||||
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.big_sad_pandroid);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
mTip.setCompoundDrawables(null, drawable, null, null);
|
||||
@@ -652,8 +620,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
AssertUtils.assertNotNull(context);
|
||||
EhApplication.getDownloadManager(context).removeDownloadInfoListener(this);
|
||||
|
||||
setDrawerGestureBlocker(null);
|
||||
|
||||
mTip = null;
|
||||
mViewTransition = null;
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.hippo.drawerlayout.DrawerLayout;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -19,11 +19,11 @@ package com.hippo.widget;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
|
||||
public class DrawerView extends MaterialCardView {
|
||||
public class DrawerView extends FrameLayout {
|
||||
|
||||
private static final int DEFAULT_MAX_WIDTH = 280;
|
||||
|
||||
|
||||
@@ -23,12 +23,18 @@
|
||||
android:id="@+id/draw_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<com.hippo.scene.StageLayout
|
||||
android:id="@+id/fragment_container"
|
||||
<com.drakeet.drawer.FullDraggableContainer
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.hippo.scene.StageLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</com.drakeet.drawer.FullDraggableContainer>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
@@ -47,6 +53,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@android:color/transparent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:maxWidth="@dimen/drawer_max_width" />
|
||||
|
||||
</com.hippo.ehviewer.widget.EhDrawerLayout>
|
||||
|
||||
@@ -13,41 +13,47 @@
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:cardBackgroundColor="?android:attr/windowBackground">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/toolbarColor"
|
||||
android:elevation="4dp"
|
||||
android:saveEnabled="false"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
|
||||
app:popupTheme="?attr/toolbarPopupTheme" />
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.hippo.easyrecyclerview.EasyRecyclerView
|
||||
android:id="@+id/recycler_view_drawer"
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/toolbarColor"
|
||||
android:elevation="4dp"
|
||||
android:saveEnabled="false"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
|
||||
app:popupTheme="?attr/toolbarPopupTheme" />
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.hippo.easyrecyclerview.EasyRecyclerView
|
||||
android:id="@+id/recycler_view_drawer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
Reference in new issue
Block a user