Migrated to AndroidX
This commit is contained in:
+11
-6
@@ -1,10 +1,10 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.novoda:bintray-release:0.4.0'
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,15 @@ ext {
|
||||
publishVersion = '1.1.0'
|
||||
licences = ['Apache-2.0']
|
||||
|
||||
compileSdkVersion = 26
|
||||
buildToolsVersion = '26.0.1'
|
||||
compileSdkVersion = 29
|
||||
buildToolsVersion = '29.0.2'
|
||||
minSdkVersion = 16
|
||||
targetSdkVersion = 25
|
||||
targetSdkVersion = 29
|
||||
|
||||
supportLibVersion = '26.0.0'
|
||||
deps = [
|
||||
recycler : 'androidx.recyclerview:recyclerview:1.0.0',
|
||||
designSupport : 'com.google.android.material:material:1.0.0',
|
||||
annotations : 'androidx.annotation:annotation:1.1.0',
|
||||
androidxCompat: 'androidx.appcompat:appcompat:1.1.0',
|
||||
]
|
||||
}
|
||||
+1
-15
@@ -1,17 +1,3 @@
|
||||
# Project-wide Gradle settings.
|
||||
android.useAndroidX=true
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Sun Sep 03 13:36:54 WIB 2017
|
||||
#Sat Aug 01 18:16:29 EEST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
|
||||
+2
-12
@@ -1,5 +1,4 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.novoda.bintray-release'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
@@ -12,15 +11,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "com.android.support:appcompat-v7:$supportLibVersion"
|
||||
}
|
||||
|
||||
publish {
|
||||
artifactId = 'sliding-root-nav'
|
||||
userOrg = rootProject.userOrg
|
||||
groupId = rootProject.groupId
|
||||
uploadName = rootProject.uploadName
|
||||
publishVersion = rootProject.publishVersion
|
||||
description = rootProject.description
|
||||
licences = rootProject.licences
|
||||
implementation deps.annotations
|
||||
implementation deps.androidxCompat
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yarolegovich.slidingrootnav;
|
||||
|
||||
import android.support.v4.widget.ViewDragHelper;
|
||||
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
|
||||
/**
|
||||
* Created by yarolegovich on 25.03.2017.
|
||||
|
||||
@@ -2,15 +2,16 @@ package com.yarolegovich.slidingrootnav;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.FloatRange;
|
||||
import androidx.annotation.IntRange;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.callback.DragListener;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
import com.yarolegovich.slidingrootnav.transform.CompositeTransformation;
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package com.yarolegovich.slidingrootnav;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.widget.ViewDragHelper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.callback.DragListener;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
import com.yarolegovich.slidingrootnav.transform.RootTransformation;
|
||||
@@ -69,6 +72,7 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
dragHelper.processTouchEvent(event);
|
||||
return true;
|
||||
@@ -199,9 +203,7 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
}
|
||||
if (rootView != null && isMenuOpened()) {
|
||||
rootView.getHitRect(tempRect);
|
||||
if (tempRect.contains((int) event.getX(), (int) event.getY())) {
|
||||
return true;
|
||||
}
|
||||
return tempRect.contains((int) event.getX(), (int) event.getY());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -251,7 +253,7 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
private boolean edgeTouched;
|
||||
|
||||
@Override
|
||||
public boolean tryCaptureView(View child, int pointerId) {
|
||||
public boolean tryCaptureView(@NonNull View child, int pointerId) {
|
||||
if (isMenuLocked) {
|
||||
return false;
|
||||
}
|
||||
@@ -269,7 +271,7 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
|
||||
public void onViewPositionChanged(@NonNull View changedView, int left, int top, int dx, int dy) {
|
||||
dragProgress = positionHelper.getDragProgress(left, maxDragDistance);
|
||||
rootTransformation.transform(dragProgress, rootView);
|
||||
notifyDrag();
|
||||
@@ -277,7 +279,7 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewReleased(View releasedChild, float xvel, float yvel) {
|
||||
public void onViewReleased(@NonNull View releasedChild, float xvel, float yvel) {
|
||||
int left = Math.abs(xvel) < FLING_MIN_VELOCITY ?
|
||||
positionHelper.getLeftToSettle(dragProgress, maxDragDistance) :
|
||||
positionHelper.getLeftAfterFling(xvel, maxDragDistance);
|
||||
@@ -302,12 +304,12 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewHorizontalDragRange(View child) {
|
||||
public int getViewHorizontalDragRange(@NonNull View child) {
|
||||
return child == rootView ? maxDragDistance : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int clampViewPositionHorizontal(View child, int left, int dx) {
|
||||
public int clampViewPositionHorizontal(@NonNull View child, int left, int dx) {
|
||||
return positionHelper.clampViewPosition(left, maxDragDistance);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
package com.yarolegovich.slidingrootnav.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNavLayout;
|
||||
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
package com.yarolegovich.slidingrootnav.util;
|
||||
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.callback.DragListener;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.yarolegovich.slidingrootnav.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -19,6 +20,7 @@ public class HiddenMenuClickConsumer extends View {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return menuHost.isMenuClosed();
|
||||
}
|
||||
|
||||
+5
-4
@@ -20,9 +20,10 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "com.android.support:appcompat-v7:$supportLibVersion"
|
||||
compile "com.android.support:design:$supportLibVersion"
|
||||
compile "com.android.support:recyclerview-v7:$supportLibVersion"
|
||||
implementation deps.annotations
|
||||
implementation deps.androidxCompat
|
||||
implementation deps.designSupport
|
||||
implementation deps.recycler
|
||||
|
||||
compile project(':library')
|
||||
implementation project(':library')
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.yarolegovich.slidingrootnav.sample;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNav;
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder;
|
||||
@@ -87,11 +88,12 @@ public class SampleActivity extends AppCompatActivity implements DrawerAdapter.O
|
||||
}
|
||||
|
||||
private void showFragment(Fragment fragment) {
|
||||
getFragmentManager().beginTransaction()
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.container, fragment)
|
||||
.commit();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private DrawerItem createItemFor(int position) {
|
||||
return new SimpleItem(screenIcons[position], screenTitles[position])
|
||||
.withIconTint(color(R.color.textColorSecondary))
|
||||
|
||||
+5
-3
@@ -1,14 +1,15 @@
|
||||
package com.yarolegovich.slidingrootnav.sample.fragment;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.yarolegovich.slidingrootnav.sample.R;
|
||||
|
||||
|
||||
@@ -36,7 +37,8 @@ public class CenteredTextFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
final String text = getArguments().getString(EXTRA_TEXT);
|
||||
Bundle args = getArguments();
|
||||
final String text = args != null ? args.getString(EXTRA_TEXT) : "";
|
||||
TextView textView = view.findViewById(R.id.text);
|
||||
textView.setText(text);
|
||||
textView.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.yarolegovich.slidingrootnav.sample.menu;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -13,6 +15,7 @@ import java.util.Map;
|
||||
* Created by yarolegovich on 25.03.2017.
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"rawtypes", "ConstantConditions"})
|
||||
public class DrawerAdapter extends RecyclerView.Adapter<DrawerAdapter.ViewHolder> {
|
||||
|
||||
private List<DrawerItem> items;
|
||||
@@ -29,8 +32,9 @@ public class DrawerAdapter extends RecyclerView.Adapter<DrawerAdapter.ViewHolder
|
||||
processViewTypes();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ViewHolder holder = holderFactories.get(viewType).createViewHolder(parent);
|
||||
holder.adapter = this;
|
||||
return holder;
|
||||
@@ -38,7 +42,7 @@ public class DrawerAdapter extends RecyclerView.Adapter<DrawerAdapter.ViewHolder
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
items.get(position).bindViewHolder(holder);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public abstract class DrawerItem<T extends DrawerAdapter.ViewHolder> {
|
||||
|
||||
public abstract void bindViewHolder(T holder);
|
||||
|
||||
public DrawerItem setChecked(boolean isChecked) {
|
||||
public DrawerItem<T> setChecked(boolean isChecked) {
|
||||
this.isChecked = isChecked;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimary" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="36sp" />
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:paddingLeft="24dp"
|
||||
@@ -10,7 +11,8 @@
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<Space
|
||||
android:layout_width="12dp"
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="56dp" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
Reference in New Issue
Block a user