diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..ea4086c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: xposed73 +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..f4e8e58 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,23 @@ +name: Android CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Grant execute permission for Gradle + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..f614f5e --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,31 @@ +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' # Updated to Java 17 + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # Location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index d77f574..aa724b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,15 @@ *.iml .gradle /local.properties -/.idea/* +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml .DS_Store /build /captures .externalNativeBuild +.cxx +local.properties diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f5045ea..0000000 --- a/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2017 Yaroslav Shevchuk - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md index 029d50e..7dfc2f3 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ The library is a DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible. It doesn't provide you with a drawer builder. -![GifSample](art/sample.gif) +![GifSample](art/demo.gif) ## Gradle Add this into your dependencies block. ``` -compile 'com.yarolegovich:sliding-root-nav:1.1.1' +implementation 'com.github.xposed73:SlidingRootNav:1.0.0' ``` -## Sample -Please see the [sample app](sample/src/main/java/com/yarolegovich/slidingrootnav/sample) for a library usage example. +## Kotlin DSL (New) +![GifSample](art/tutorial.gif) ## Wiki #### Usage: @@ -88,23 +88,3 @@ public interface DragStateListener { DrawerListenerAdapter adapter = new DrawerListenerAdapter(yourDrawerListener, viewToPassAsDrawer); builder.addDragListener(listenerAdapter).addDragStateListener(listenerAdapter); ``` - -## Special thanks -Thanks to [Tayisiya Yurkiv](https://www.behance.net/yurkivt) for a beautiful GIF. - -## License -``` -Copyright 2017 Yaroslav Shevchuk - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` diff --git a/art/demo.gif b/art/demo.gif new file mode 100644 index 0000000..aed435e Binary files /dev/null and b/art/demo.gif differ diff --git a/art/demo.md b/art/demo.md new file mode 100644 index 0000000..1549b67 --- /dev/null +++ b/art/demo.md @@ -0,0 +1 @@ +demo diff --git a/art/sample.gif b/art/sample.gif deleted file mode 100644 index 325ea0f..0000000 Binary files a/art/sample.gif and /dev/null differ diff --git a/art/sample_arsenal.jpg b/art/sample_arsenal.jpg deleted file mode 100644 index b5ae5a4..0000000 Binary files a/art/sample_arsenal.jpg and /dev/null differ diff --git a/art/tutorial.gif b/art/tutorial.gif new file mode 100644 index 0000000..8a7a70d Binary files /dev/null and b/art/tutorial.gif differ diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 9b0033e..0000000 --- a/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -buildscript { - repositories { - jcenter() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5' - } -} - -allprojects { - repositories { - jcenter() - maven { url "https://maven.google.com" } - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -ext { - compileSdkVersion = 29 - buildToolsVersion = '29.0.2' - minSdkVersion = 16 - targetSdkVersion = 29 - - 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', - ] -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..41b070a --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,5 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false +} \ No newline at end of file diff --git a/demo/.gitignore b/demo/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/demo/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts new file mode 100644 index 0000000..766554d --- /dev/null +++ b/demo/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "com.slidingrootnav.demo" + compileSdk = 35 + + defaultConfig { + applicationId = "com.slidingrootnav.demo" + minSdk = 21 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + implementation(project(":library")) + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.activity) + implementation(libs.constraintlayout) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) +} \ No newline at end of file diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/demo/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/sample/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml similarity index 58% rename from sample/src/main/AndroidManifest.xml rename to demo/src/main/AndroidManifest.xml index 96b13e1..835932a 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -1,24 +1,25 @@ + xmlns:tools="http://schemas.android.com/tools"> - + android:theme="@style/AppTheme" + tools:targetApi="31"> + android:name="com.slidingrootnav.demo.SampleActivity" + android:exported="true"> - - \ No newline at end of file diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/SampleActivity.java b/demo/src/main/java/com/slidingrootnav/demo/SampleActivity.java similarity index 88% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/SampleActivity.java rename to demo/src/main/java/com/slidingrootnav/demo/SampleActivity.java index 90db337..f22442c 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/SampleActivity.java +++ b/demo/src/main/java/com/slidingrootnav/demo/SampleActivity.java @@ -1,9 +1,8 @@ -package com.yarolegovich.slidingrootnav.sample; +package com.slidingrootnav.demo; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Bundle; - import androidx.annotation.ColorInt; import androidx.annotation.ColorRes; import androidx.annotation.Nullable; @@ -14,14 +13,14 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.yarolegovich.slidingrootnav.SlidingRootNav; -import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder; -import com.yarolegovich.slidingrootnav.sample.menu.DrawerAdapter; -import com.yarolegovich.slidingrootnav.sample.menu.DrawerItem; -import com.yarolegovich.slidingrootnav.sample.menu.SimpleItem; -import com.yarolegovich.slidingrootnav.sample.menu.SpaceItem; -import com.yarolegovich.slidingrootnav.sample.fragment.CenteredTextFragment; - +import com.slidingrootnav.demo.R; +import com.slidingrootnav.SlidingRootNav; +import com.slidingrootnav.SlidingRootNavBuilder; +import com.slidingrootnav.demo.menu.DrawerAdapter; +import com.slidingrootnav.demo.menu.DrawerItem; +import com.slidingrootnav.demo.menu.SimpleItem; +import com.slidingrootnav.demo.menu.SpaceItem; +import com.slidingrootnav.demo.fragment.CenteredTextFragment; import java.util.Arrays; /** diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/fragment/CenteredTextFragment.java b/demo/src/main/java/com/slidingrootnav/demo/fragment/CenteredTextFragment.java similarity index 93% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/fragment/CenteredTextFragment.java rename to demo/src/main/java/com/slidingrootnav/demo/fragment/CenteredTextFragment.java index 0b0864f..6024a99 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/fragment/CenteredTextFragment.java +++ b/demo/src/main/java/com/slidingrootnav/demo/fragment/CenteredTextFragment.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.sample.fragment; +package com.slidingrootnav.demo.fragment; import android.os.Bundle; import android.view.LayoutInflater; @@ -6,12 +6,9 @@ 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; - +import com.slidingrootnav.demo.R; /** * Created by yarolegovich on 25.03.2017. diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerAdapter.java b/demo/src/main/java/com/slidingrootnav/demo/menu/DrawerAdapter.java similarity index 93% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerAdapter.java rename to demo/src/main/java/com/slidingrootnav/demo/menu/DrawerAdapter.java index c78bb87..4cff3bc 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerAdapter.java +++ b/demo/src/main/java/com/slidingrootnav/demo/menu/DrawerAdapter.java @@ -1,12 +1,10 @@ -package com.yarolegovich.slidingrootnav.sample.menu; +package com.slidingrootnav.demo.menu; 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; @@ -18,10 +16,9 @@ @SuppressWarnings({"rawtypes", "ConstantConditions"}) public class DrawerAdapter extends RecyclerView.Adapter { - private List items; - private Map, Integer> viewTypes; - private SparseArray holderFactories; - + private final List items; + private final Map, Integer> viewTypes; + private final SparseArray holderFactories; private OnItemSelectedListener listener; public DrawerAdapter(List items) { diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerItem.java b/demo/src/main/java/com/slidingrootnav/demo/menu/DrawerItem.java similarity index 90% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerItem.java rename to demo/src/main/java/com/slidingrootnav/demo/menu/DrawerItem.java index ac4a9d5..d26e7e0 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/DrawerItem.java +++ b/demo/src/main/java/com/slidingrootnav/demo/menu/DrawerItem.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.sample.menu; +package com.slidingrootnav.demo.menu; import android.view.ViewGroup; @@ -9,9 +9,7 @@ public abstract class DrawerItem { protected boolean isChecked; - public abstract T createViewHolder(ViewGroup parent); - public abstract void bindViewHolder(T holder); public DrawerItem setChecked(boolean isChecked) { diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SimpleItem.java b/demo/src/main/java/com/slidingrootnav/demo/menu/SimpleItem.java similarity index 84% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SimpleItem.java rename to demo/src/main/java/com/slidingrootnav/demo/menu/SimpleItem.java index 3fc596f..04d145c 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SimpleItem.java +++ b/demo/src/main/java/com/slidingrootnav/demo/menu/SimpleItem.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.sample.menu; +package com.slidingrootnav.demo.menu; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; @@ -6,8 +6,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; - -import com.yarolegovich.slidingrootnav.sample.R; +import com.slidingrootnav.demo.R; /** * Created by yarolegovich on 25.03.2017. @@ -20,8 +19,8 @@ public class SimpleItem extends DrawerItem { private int normalItemIconTint; private int normalItemTextTint; - private Drawable icon; - private String title; + private final Drawable icon; + private final String title; public SimpleItem(Drawable icon, String title) { this.icon = icon; @@ -66,13 +65,13 @@ public SimpleItem withTextTint(int normalItemTextTint) { static class ViewHolder extends DrawerAdapter.ViewHolder { - private ImageView icon; - private TextView title; + private final ImageView icon; + private final TextView title; public ViewHolder(View itemView) { super(itemView); - icon = (ImageView) itemView.findViewById(R.id.icon); - title = (TextView) itemView.findViewById(R.id.title); + icon = itemView.findViewById(R.id.icon); + title = itemView.findViewById(R.id.title); } } } diff --git a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SpaceItem.java b/demo/src/main/java/com/slidingrootnav/demo/menu/SpaceItem.java similarity index 80% rename from sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SpaceItem.java rename to demo/src/main/java/com/slidingrootnav/demo/menu/SpaceItem.java index 7ae76cc..8be064a 100644 --- a/sample/src/main/java/com/yarolegovich/slidingrootnav/sample/menu/SpaceItem.java +++ b/demo/src/main/java/com/slidingrootnav/demo/menu/SpaceItem.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.sample.menu; +package com.slidingrootnav.demo.menu; import android.content.Context; import android.view.View; @@ -10,7 +10,7 @@ public class SpaceItem extends DrawerItem { - private int spaceDp; + private final int spaceDp; public SpaceItem(int spaceDp) { this.spaceDp = spaceDp; @@ -21,9 +21,7 @@ public ViewHolder createViewHolder(ViewGroup parent) { Context c = parent.getContext(); View view = new View(c); int height = (int) (c.getResources().getDisplayMetrics().density * spaceDp); - view.setLayoutParams(new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - height)); + view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height)); return new ViewHolder(view); } diff --git a/sample/src/main/res/drawable-hdpi/ic_account_outline_grey600_24dp.png b/demo/src/main/res/drawable-hdpi/ic_account_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-hdpi/ic_account_outline_grey600_24dp.png rename to demo/src/main/res/drawable-hdpi/ic_account_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-hdpi/ic_cart_outline_grey600_24dp.png b/demo/src/main/res/drawable-hdpi/ic_cart_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-hdpi/ic_cart_outline_grey600_24dp.png rename to demo/src/main/res/drawable-hdpi/ic_cart_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-hdpi/ic_email_outline_grey600_24dp.png b/demo/src/main/res/drawable-hdpi/ic_email_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-hdpi/ic_email_outline_grey600_24dp.png rename to demo/src/main/res/drawable-hdpi/ic_email_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-hdpi/ic_home_outline_grey600_24dp.png b/demo/src/main/res/drawable-hdpi/ic_home_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-hdpi/ic_home_outline_grey600_24dp.png rename to demo/src/main/res/drawable-hdpi/ic_home_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-hdpi/ic_logout_grey600_24dp.png b/demo/src/main/res/drawable-hdpi/ic_logout_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-hdpi/ic_logout_grey600_24dp.png rename to demo/src/main/res/drawable-hdpi/ic_logout_grey600_24dp.png diff --git a/sample/src/main/res/drawable-mdpi/ic_account_outline_grey600_24dp.png b/demo/src/main/res/drawable-mdpi/ic_account_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-mdpi/ic_account_outline_grey600_24dp.png rename to demo/src/main/res/drawable-mdpi/ic_account_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-mdpi/ic_cart_outline_grey600_24dp.png b/demo/src/main/res/drawable-mdpi/ic_cart_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-mdpi/ic_cart_outline_grey600_24dp.png rename to demo/src/main/res/drawable-mdpi/ic_cart_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-mdpi/ic_email_outline_grey600_24dp.png b/demo/src/main/res/drawable-mdpi/ic_email_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-mdpi/ic_email_outline_grey600_24dp.png rename to demo/src/main/res/drawable-mdpi/ic_email_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-mdpi/ic_home_outline_grey600_24dp.png b/demo/src/main/res/drawable-mdpi/ic_home_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-mdpi/ic_home_outline_grey600_24dp.png rename to demo/src/main/res/drawable-mdpi/ic_home_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-mdpi/ic_logout_grey600_24dp.png b/demo/src/main/res/drawable-mdpi/ic_logout_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-mdpi/ic_logout_grey600_24dp.png rename to demo/src/main/res/drawable-mdpi/ic_logout_grey600_24dp.png diff --git a/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml b/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/drawable-xhdpi/ic_account_outline_grey600_24dp.png b/demo/src/main/res/drawable-xhdpi/ic_account_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xhdpi/ic_account_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xhdpi/ic_account_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xhdpi/ic_cart_outline_grey600_24dp.png b/demo/src/main/res/drawable-xhdpi/ic_cart_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xhdpi/ic_cart_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xhdpi/ic_cart_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xhdpi/ic_email_outline_grey600_24dp.png b/demo/src/main/res/drawable-xhdpi/ic_email_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xhdpi/ic_email_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xhdpi/ic_email_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xhdpi/ic_home_outline_grey600_24dp.png b/demo/src/main/res/drawable-xhdpi/ic_home_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xhdpi/ic_home_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xhdpi/ic_home_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xhdpi/ic_logout_grey600_24dp.png b/demo/src/main/res/drawable-xhdpi/ic_logout_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xhdpi/ic_logout_grey600_24dp.png rename to demo/src/main/res/drawable-xhdpi/ic_logout_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxhdpi/ic_account_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxhdpi/ic_account_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxhdpi/ic_account_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxhdpi/ic_account_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxhdpi/ic_cart_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxhdpi/ic_cart_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxhdpi/ic_cart_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxhdpi/ic_cart_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxhdpi/ic_email_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxhdpi/ic_email_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxhdpi/ic_email_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxhdpi/ic_email_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxhdpi/ic_home_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxhdpi/ic_home_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxhdpi/ic_home_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxhdpi/ic_home_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxhdpi/ic_logout_grey600_24dp.png b/demo/src/main/res/drawable-xxhdpi/ic_logout_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxhdpi/ic_logout_grey600_24dp.png rename to demo/src/main/res/drawable-xxhdpi/ic_logout_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_account_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxxhdpi/ic_account_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxxhdpi/ic_account_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxxhdpi/ic_account_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_cart_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxxhdpi/ic_cart_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxxhdpi/ic_cart_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxxhdpi/ic_cart_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_email_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxxhdpi/ic_email_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxxhdpi/ic_email_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxxhdpi/ic_email_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_home_outline_grey600_24dp.png b/demo/src/main/res/drawable-xxxhdpi/ic_home_outline_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxxhdpi/ic_home_outline_grey600_24dp.png rename to demo/src/main/res/drawable-xxxhdpi/ic_home_outline_grey600_24dp.png diff --git a/sample/src/main/res/drawable-xxxhdpi/ic_logout_grey600_24dp.png b/demo/src/main/res/drawable-xxxhdpi/ic_logout_grey600_24dp.png similarity index 100% rename from sample/src/main/res/drawable-xxxhdpi/ic_logout_grey600_24dp.png rename to demo/src/main/res/drawable-xxxhdpi/ic_logout_grey600_24dp.png diff --git a/demo/src/main/res/drawable/ic_launcher_background.xml b/demo/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/demo/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sample/src/main/res/drawable/jdashboard.jpg b/demo/src/main/res/drawable/jdashboard.jpg similarity index 100% rename from sample/src/main/res/drawable/jdashboard.jpg rename to demo/src/main/res/drawable/jdashboard.jpg diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..956d57a --- /dev/null +++ b/demo/src/main/res/layout/activity_main.xml @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/sample/src/main/res/layout/fragment_text.xml b/demo/src/main/res/layout/fragment_text.xml similarity index 90% rename from sample/src/main/res/layout/fragment_text.xml rename to demo/src/main/res/layout/fragment_text.xml index 16399ce..17733a0 100644 --- a/sample/src/main/res/layout/fragment_text.xml +++ b/demo/src/main/res/layout/fragment_text.xml @@ -11,7 +11,7 @@ android:fontFamily="sans-serif-light" android:clickable="true" android:focusable="true" - android:textColor="?android:textColorSecondary" + android:textColor="@color/color_white" android:textSize="36sp" /> \ No newline at end of file diff --git a/sample/src/main/res/layout/item_option.xml b/demo/src/main/res/layout/item_option.xml similarity index 90% rename from sample/src/main/res/layout/item_option.xml rename to demo/src/main/res/layout/item_option.xml index 49cbf72..de1d56e 100644 --- a/sample/src/main/res/layout/item_option.xml +++ b/demo/src/main/res/layout/item_option.xml @@ -3,12 +3,14 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="56dp" + xmlns:app="http://schemas.android.com/apk/res-auto" android:paddingLeft="24dp" android:paddingRight="24dp" android:gravity="center_vertical" android:orientation="horizontal"> - + + + + + \ No newline at end of file diff --git a/demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/demo/src/main/res/mipmap-hdpi/ic_launcher.webp b/demo/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/demo/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/demo/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/demo/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/demo/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/demo/src/main/res/mipmap-mdpi/ic_launcher.webp b/demo/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/demo/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/demo/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/demo/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/demo/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/demo/src/main/res/mipmap-xhdpi/ic_launcher.webp b/demo/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/demo/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/demo/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/demo/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/demo/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/sample/src/main/res/values/arrays.xml b/demo/src/main/res/values/arrays.xml similarity index 100% rename from sample/src/main/res/values/arrays.xml rename to demo/src/main/res/values/arrays.xml diff --git a/demo/src/main/res/values/colors.xml b/demo/src/main/res/values/colors.xml new file mode 100644 index 0000000..e6a5aa7 --- /dev/null +++ b/demo/src/main/res/values/colors.xml @@ -0,0 +1,21 @@ + + + + + #0d6efd + #0D61DE + #217AFD + #FFFFFF + #D5E5E5 + #FFFFFF + #FFFFFF + #E1062D66 + + #E91E63 + #CE1353 + #FFFFFF + + #FFFFFF + #FFFFFF + + diff --git a/sample/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml similarity index 100% rename from sample/src/main/res/values/strings.xml rename to demo/src/main/res/values/strings.xml diff --git a/demo/src/main/res/values/styles.xml b/demo/src/main/res/values/styles.xml new file mode 100644 index 0000000..e897a4c --- /dev/null +++ b/demo/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/demo/src/main/res/xml/backup_rules.xml b/demo/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/demo/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/demo/src/main/res/xml/data_extraction_rules.xml b/demo/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/demo/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index cc6563d..4387edc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,21 @@ +# Project-wide Gradle settings. +# 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=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true - -org.gradle.jvmargs=-Xmx1536m +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..1f9e0eb --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,23 @@ +[versions] +agp = "8.8.0" +junit = "4.13.2" +junitVersion = "1.2.1" +espressoCore = "3.6.1" +appcompat = "1.7.0" +material = "1.12.0" +activity = "1.10.0" +constraintlayout = "2.2.0" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } +ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 13372ae..e708b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6373062..6657f9c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Aug 01 18:16:29 EEST 2020 +#Tue Feb 11 17:10:14 IST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/gradlew b/gradlew index 9d82f78..4f906e0 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,28 +75,14 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -85,7 +106,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -105,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -134,27 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/library/.gitignore b/library/.gitignore index 796b96d..42afabf 100644 --- a/library/.gitignore +++ b/library/.gitignore @@ -1 +1 @@ -/build +/build \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle deleted file mode 100644 index 18eb8d0..0000000 --- a/library/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -apply plugin: 'com.android.library' -apply from: rootProject.file('release-bintray.gradle') - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - - defaultConfig { - minSdkVersion 16 - targetSdkVersion rootProject.ext.targetSdkVersion - } -} - -dependencies { - implementation deps.annotations - implementation deps.androidxCompat -} \ No newline at end of file diff --git a/library/build.gradle.kts b/library/build.gradle.kts new file mode 100644 index 0000000..7b851b5 --- /dev/null +++ b/library/build.gradle.kts @@ -0,0 +1,36 @@ +plugins { + alias(libs.plugins.android.library) +} + +android { + namespace = "com.slidingrootnav" + compileSdk = 35 + + defaultConfig { + minSdk = 21 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } +} + +dependencies { + implementation(libs.appcompat) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) +} \ No newline at end of file diff --git a/library/consumer-rules.pro b/library/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro index 2309852..481bb43 100644 --- a/library/proguard-rules.pro +++ b/library/proguard-rules.pro @@ -1,17 +1,21 @@ # Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in C:\Users\yarolegovich\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html -# Add any project specific keep options here: - # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 36bc036..a5918e6 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1 +1,4 @@ - + + + + \ No newline at end of file diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/SlideGravity.java b/library/src/main/java/com/slidingrootnav/SlideGravity.java similarity index 98% rename from library/src/main/java/com/yarolegovich/slidingrootnav/SlideGravity.java rename to library/src/main/java/com/slidingrootnav/SlideGravity.java index d83e1d9..a0acadc 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/SlideGravity.java +++ b/library/src/main/java/com/slidingrootnav/SlideGravity.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav; +package com.slidingrootnav; import androidx.customview.widget.ViewDragHelper; diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNav.java b/library/src/main/java/com/slidingrootnav/SlidingRootNav.java similarity index 90% rename from library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNav.java rename to library/src/main/java/com/slidingrootnav/SlidingRootNav.java index d6e46dd..91a0aad 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNav.java +++ b/library/src/main/java/com/slidingrootnav/SlidingRootNav.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav; +package com.slidingrootnav; /** * Created by yarolegovich on 25.03.2017. diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavBuilder.java b/library/src/main/java/com/slidingrootnav/SlidingRootNavBuilder.java similarity index 88% rename from library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavBuilder.java rename to library/src/main/java/com/slidingrootnav/SlidingRootNavBuilder.java index 2e1bfaf..f6c464b 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavBuilder.java +++ b/library/src/main/java/com/slidingrootnav/SlidingRootNavBuilder.java @@ -1,28 +1,27 @@ -package com.yarolegovich.slidingrootnav; +package com.slidingrootnav; import android.app.Activity; import android.os.Bundle; 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; -import com.yarolegovich.slidingrootnav.transform.ElevationTransformation; -import com.yarolegovich.slidingrootnav.transform.RootTransformation; -import com.yarolegovich.slidingrootnav.transform.ScaleTransformation; -import com.yarolegovich.slidingrootnav.transform.YTranslationTransformation; -import com.yarolegovich.slidingrootnav.util.ActionBarToggleAdapter; -import com.yarolegovich.slidingrootnav.util.DrawerListenerAdapter; -import com.yarolegovich.slidingrootnav.util.HiddenMenuClickConsumer; - +import com.slidingrootnav.R; +import com.slidingrootnav.callback.DragListener; +import com.slidingrootnav.callback.DragStateListener; +import com.slidingrootnav.transform.CompositeTransformation; +import com.slidingrootnav.transform.ElevationTransformation; +import com.slidingrootnav.transform.RootTransformation; +import com.slidingrootnav.transform.ScaleTransformation; +import com.slidingrootnav.transform.YTranslationTransformation; +import com.slidingrootnav.util.ActionBarToggleAdapter; +import com.slidingrootnav.util.DrawerListenerAdapter; +import com.slidingrootnav.util.HiddenMenuClickConsumer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -37,33 +36,24 @@ public class SlidingRootNavBuilder { private static final int DEFAULT_END_ELEVATION_DP = 8; private static final int DEFAULT_DRAG_DIST_DP = 180; - private Activity activity; - + private final Activity activity; private ViewGroup contentView; - private View menuView; private int menuLayoutRes; - private List transformations; - - private List dragListeners; - - private List dragStateListeners; - + private final List transformations; + private final List dragListeners; + private final List dragStateListeners; private int dragDistance; private Toolbar toolbar; - private SlideGravity gravity; + private Bundle savedState; private boolean isMenuOpened; - private boolean isMenuLocked; - private boolean isContentClickableWhenMenuOpened; - private Bundle savedState; - public SlidingRootNavBuilder(Activity activity) { this.activity = activity; this.transformations = new ArrayList<>(); @@ -248,7 +238,7 @@ private RootTransformation createCompositeTransformation() { protected void initToolbarMenuVisibilityToggle(final SlidingRootNavLayout sideNav, View drawer) { if (toolbar != null) { ActionBarToggleAdapter dlAdapter = new ActionBarToggleAdapter(activity); - dlAdapter.setAdaptee(sideNav); + dlAdapter.setAdapter(sideNav); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(activity, dlAdapter, toolbar, R.string.srn_drawer_open, R.string.srn_drawer_close); diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavLayout.java b/library/src/main/java/com/slidingrootnav/SlidingRootNavLayout.java similarity index 96% rename from library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavLayout.java rename to library/src/main/java/com/slidingrootnav/SlidingRootNavLayout.java index 7349061..cce4589 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNavLayout.java +++ b/library/src/main/java/com/slidingrootnav/SlidingRootNavLayout.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav; +package com.slidingrootnav; import android.annotation.SuppressLint; import android.content.Context; @@ -14,9 +14,9 @@ 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; +import com.slidingrootnav.callback.DragListener; +import com.slidingrootnav.callback.DragStateListener; +import com.slidingrootnav.transform.RootTransformation; import java.util.ArrayList; import java.util.List; @@ -45,21 +45,18 @@ public class SlidingRootNavLayout extends FrameLayout implements SlidingRootNav private int maxDragDistance; private int dragState; - private ViewDragHelper dragHelper; + private final ViewDragHelper dragHelper; private SlideGravity.Helper positionHelper; - private List dragListeners; - private List dragStateListeners; + private final List dragListeners; + private final List dragStateListeners; public SlidingRootNavLayout(Context context) { super(context); dragListeners = new ArrayList<>(); dragStateListeners = new ArrayList<>(); - FLING_MIN_VELOCITY = ViewConfiguration.get(context).getScaledMinimumFlingVelocity(); - dragHelper = ViewDragHelper.create(this, new ViewDragCallback()); - dragProgress = 0f; isMenuHidden = true; } diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragListener.java b/library/src/main/java/com/slidingrootnav/callback/DragListener.java similarity index 70% rename from library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragListener.java rename to library/src/main/java/com/slidingrootnav/callback/DragListener.java index bb0420f..f87b4ca 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragListener.java +++ b/library/src/main/java/com/slidingrootnav/callback/DragListener.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.callback; +package com.slidingrootnav.callback; /** * Created by yarolegovich on 25.03.2017. diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragStateListener.java b/library/src/main/java/com/slidingrootnav/callback/DragStateListener.java similarity index 75% rename from library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragStateListener.java rename to library/src/main/java/com/slidingrootnav/callback/DragStateListener.java index 2715aa9..e3bedcf 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/callback/DragStateListener.java +++ b/library/src/main/java/com/slidingrootnav/callback/DragStateListener.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.callback; +package com.slidingrootnav.callback; /** * Created by yarolegovich on 25.03.2017. @@ -7,6 +7,5 @@ public interface DragStateListener { void onDragStart(); - void onDragEnd(boolean isMenuOpened); } diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/CompositeTransformation.java b/library/src/main/java/com/slidingrootnav/transform/CompositeTransformation.java similarity index 82% rename from library/src/main/java/com/yarolegovich/slidingrootnav/transform/CompositeTransformation.java rename to library/src/main/java/com/slidingrootnav/transform/CompositeTransformation.java index a75cf55..49a721a 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/CompositeTransformation.java +++ b/library/src/main/java/com/slidingrootnav/transform/CompositeTransformation.java @@ -1,7 +1,6 @@ -package com.yarolegovich.slidingrootnav.transform; +package com.slidingrootnav.transform; import android.view.View; - import java.util.List; /** @@ -10,7 +9,7 @@ public class CompositeTransformation implements RootTransformation { - private List transformations; + private final List transformations; public CompositeTransformation(List transformations) { this.transformations = transformations; diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/ElevationTransformation.java b/library/src/main/java/com/slidingrootnav/transform/ElevationTransformation.java similarity index 85% rename from library/src/main/java/com/yarolegovich/slidingrootnav/transform/ElevationTransformation.java rename to library/src/main/java/com/slidingrootnav/transform/ElevationTransformation.java index d914b0a..cab4ccf 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/ElevationTransformation.java +++ b/library/src/main/java/com/slidingrootnav/transform/ElevationTransformation.java @@ -1,9 +1,8 @@ -package com.yarolegovich.slidingrootnav.transform; +package com.slidingrootnav.transform; import android.os.Build; import android.view.View; - -import com.yarolegovich.slidingrootnav.util.SideNavUtils; +import com.slidingrootnav.util.SideNavUtils; /** * Created by yarolegovich on 25.03.2017. @@ -12,7 +11,6 @@ public class ElevationTransformation implements RootTransformation { private static final float START_ELEVATION = 0f; - private final float endElevation; public ElevationTransformation(float endElevation) { diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/RootTransformation.java b/library/src/main/java/com/slidingrootnav/transform/RootTransformation.java similarity index 77% rename from library/src/main/java/com/yarolegovich/slidingrootnav/transform/RootTransformation.java rename to library/src/main/java/com/slidingrootnav/transform/RootTransformation.java index 4755914..256cd8a 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/RootTransformation.java +++ b/library/src/main/java/com/slidingrootnav/transform/RootTransformation.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.transform; +package com.slidingrootnav.transform; import android.view.View; diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/ScaleTransformation.java b/library/src/main/java/com/slidingrootnav/transform/ScaleTransformation.java similarity index 83% rename from library/src/main/java/com/yarolegovich/slidingrootnav/transform/ScaleTransformation.java rename to library/src/main/java/com/slidingrootnav/transform/ScaleTransformation.java index d5fcf30..e66fe09 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/ScaleTransformation.java +++ b/library/src/main/java/com/slidingrootnav/transform/ScaleTransformation.java @@ -1,8 +1,7 @@ -package com.yarolegovich.slidingrootnav.transform; +package com.slidingrootnav.transform; import android.view.View; - -import com.yarolegovich.slidingrootnav.util.SideNavUtils; +import com.slidingrootnav.util.SideNavUtils; /** * Created by yarolegovich on 25.03.2017. @@ -11,7 +10,6 @@ public class ScaleTransformation implements RootTransformation { private static final float START_SCALE = 1f; - private final float endScale; public ScaleTransformation(float endScale) { diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/YTranslationTransformation.java b/library/src/main/java/com/slidingrootnav/transform/YTranslationTransformation.java similarity index 84% rename from library/src/main/java/com/yarolegovich/slidingrootnav/transform/YTranslationTransformation.java rename to library/src/main/java/com/slidingrootnav/transform/YTranslationTransformation.java index 70f2a0d..cae9abf 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/transform/YTranslationTransformation.java +++ b/library/src/main/java/com/slidingrootnav/transform/YTranslationTransformation.java @@ -1,8 +1,7 @@ -package com.yarolegovich.slidingrootnav.transform; +package com.slidingrootnav.transform; import android.view.View; - -import com.yarolegovich.slidingrootnav.util.SideNavUtils; +import com.slidingrootnav.util.SideNavUtils; /** * Created by yarolegovich on 25.03.2017. @@ -11,7 +10,6 @@ public class YTranslationTransformation implements RootTransformation { private static final float START_TRANSLATION = 0f; - private final float endTranslation; public YTranslationTransformation(float endTranslation) { diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/util/ActionBarToggleAdapter.java b/library/src/main/java/com/slidingrootnav/util/ActionBarToggleAdapter.java similarity index 62% rename from library/src/main/java/com/yarolegovich/slidingrootnav/util/ActionBarToggleAdapter.java rename to library/src/main/java/com/slidingrootnav/util/ActionBarToggleAdapter.java index 2fd5496..2727b8d 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/util/ActionBarToggleAdapter.java +++ b/library/src/main/java/com/slidingrootnav/util/ActionBarToggleAdapter.java @@ -1,10 +1,8 @@ -package com.yarolegovich.slidingrootnav.util; +package com.slidingrootnav.util; import android.content.Context; - import androidx.drawerlayout.widget.DrawerLayout; - -import com.yarolegovich.slidingrootnav.SlidingRootNavLayout; +import com.slidingrootnav.SlidingRootNavLayout; /** * Created by yarolegovich on 26.03.2017. @@ -12,7 +10,7 @@ public class ActionBarToggleAdapter extends DrawerLayout { - private SlidingRootNavLayout adaptee; + private SlidingRootNavLayout adapter; public ActionBarToggleAdapter(Context context) { super(context); @@ -20,31 +18,31 @@ public ActionBarToggleAdapter(Context context) { @Override public void openDrawer(int gravity) { - adaptee.openMenu(); + adapter.openMenu(); } @Override public void closeDrawer(int gravity) { - adaptee.closeMenu(); + adapter.closeMenu(); } @Override public boolean isDrawerVisible(int drawerGravity) { - return !adaptee.isMenuClosed(); + return !adapter.isMenuClosed(); } @Override public int getDrawerLockMode(int edgeGravity) { - if (adaptee.isMenuLocked() && adaptee.isMenuClosed()) { + if (adapter.isMenuLocked() && adapter.isMenuClosed()) { return DrawerLayout.LOCK_MODE_LOCKED_CLOSED; - } else if (adaptee.isMenuLocked() && !adaptee.isMenuClosed()) { + } else if (adapter.isMenuLocked() && !adapter.isMenuClosed()) { return DrawerLayout.LOCK_MODE_LOCKED_OPEN; } else { return DrawerLayout.LOCK_MODE_UNLOCKED; } } - public void setAdaptee(SlidingRootNavLayout adaptee) { - this.adaptee = adaptee; + public void setAdapter(SlidingRootNavLayout adapter) { + this.adapter = adapter; } } diff --git a/library/src/main/java/com/slidingrootnav/util/DrawerListenerAdapter.java b/library/src/main/java/com/slidingrootnav/util/DrawerListenerAdapter.java new file mode 100644 index 0000000..c9bc85d --- /dev/null +++ b/library/src/main/java/com/slidingrootnav/util/DrawerListenerAdapter.java @@ -0,0 +1,41 @@ +package com.slidingrootnav.util; + +import android.view.View; +import androidx.drawerlayout.widget.DrawerLayout; +import com.slidingrootnav.callback.DragListener; +import com.slidingrootnav.callback.DragStateListener; + +/** + * Created by yarolegovich on 26.03.2017. + */ + +public class DrawerListenerAdapter implements DragListener, DragStateListener { + + private final DrawerLayout.DrawerListener adapter; + private final View drawer; + + public DrawerListenerAdapter(DrawerLayout.DrawerListener adapter, View drawer) { + this.adapter = adapter; + this.drawer = drawer; + } + + @Override + public void onDrag(float progress) { + adapter.onDrawerSlide(drawer, progress); + } + + @Override + public void onDragStart() { + adapter.onDrawerStateChanged(DrawerLayout.STATE_DRAGGING); + } + + @Override + public void onDragEnd(boolean isMenuOpened) { + if (isMenuOpened) { + adapter.onDrawerOpened(drawer); + } else { + adapter.onDrawerClosed(drawer); + } + adapter.onDrawerStateChanged(DrawerLayout.STATE_IDLE); + } +} diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/util/HiddenMenuClickConsumer.java b/library/src/main/java/com/slidingrootnav/util/HiddenMenuClickConsumer.java similarity index 85% rename from library/src/main/java/com/yarolegovich/slidingrootnav/util/HiddenMenuClickConsumer.java rename to library/src/main/java/com/slidingrootnav/util/HiddenMenuClickConsumer.java index 1ee29b3..971bb48 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/util/HiddenMenuClickConsumer.java +++ b/library/src/main/java/com/slidingrootnav/util/HiddenMenuClickConsumer.java @@ -1,11 +1,10 @@ -package com.yarolegovich.slidingrootnav.util; +package com.slidingrootnav.util; import android.annotation.SuppressLint; import android.content.Context; import android.view.MotionEvent; import android.view.View; - -import com.yarolegovich.slidingrootnav.SlidingRootNavLayout; +import com.slidingrootnav.SlidingRootNavLayout; /** * Created by yarolegovich on 26.03.2017. diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/util/SideNavUtils.java b/library/src/main/java/com/slidingrootnav/util/SideNavUtils.java similarity index 84% rename from library/src/main/java/com/yarolegovich/slidingrootnav/util/SideNavUtils.java rename to library/src/main/java/com/slidingrootnav/util/SideNavUtils.java index 4df260d..692a2cc 100644 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/util/SideNavUtils.java +++ b/library/src/main/java/com/slidingrootnav/util/SideNavUtils.java @@ -1,4 +1,4 @@ -package com.yarolegovich.slidingrootnav.util; +package com.slidingrootnav.util; /** * Created by yarolegovich on 25.03.2017. diff --git a/library/src/main/java/com/yarolegovich/slidingrootnav/util/DrawerListenerAdapter.java b/library/src/main/java/com/yarolegovich/slidingrootnav/util/DrawerListenerAdapter.java deleted file mode 100644 index 0036ad2..0000000 --- a/library/src/main/java/com/yarolegovich/slidingrootnav/util/DrawerListenerAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.yarolegovich.slidingrootnav.util; - -import android.view.View; - -import androidx.drawerlayout.widget.DrawerLayout; - -import com.yarolegovich.slidingrootnav.callback.DragListener; -import com.yarolegovich.slidingrootnav.callback.DragStateListener; - -/** - * Created by yarolegovich on 26.03.2017. - */ - -public class DrawerListenerAdapter implements DragListener, DragStateListener { - - private DrawerLayout.DrawerListener adaptee; - private View drawer; - - public DrawerListenerAdapter(DrawerLayout.DrawerListener adaptee, View drawer) { - this.adaptee = adaptee; - this.drawer = drawer; - } - - @Override - public void onDrag(float progress) { - adaptee.onDrawerSlide(drawer, progress); - } - - @Override - public void onDragStart() { - adaptee.onDrawerStateChanged(DrawerLayout.STATE_DRAGGING); - } - - @Override - public void onDragEnd(boolean isMenuOpened) { - if (isMenuOpened) { - adaptee.onDrawerOpened(drawer); - } else { - adaptee.onDrawerClosed(drawer); - } - adaptee.onDrawerStateChanged(DrawerLayout.STATE_IDLE); - } -} diff --git a/release-bintray.gradle b/release-bintray.gradle deleted file mode 100644 index 323f2fd..0000000 --- a/release-bintray.gradle +++ /dev/null @@ -1,60 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' - -def upload = [ - user : 'yarolegovich', - artifactId : 'sliding-root-nav', - userOrg : 'yarolegovich', - repository : 'maven', - groupId : 'com.yarolegovich', - uploadName : 'SlidingRootNav', - description: 'DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.', - version : '1.1.1', - licences : ['Apache-2.0'] -] - -task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -version upload.version - -afterEvaluate { - - publishing { - publications { - LibRelease(MavenPublication) { - from components.release - - artifact androidSourcesJar - - artifactId upload.artifactId - groupId upload.groupId - version upload.version - } - } - } - - Properties localProps = new Properties() - localProps.load(project.rootProject.file('local.properties').newDataInputStream()) - - bintray { - user = upload.user - key = localProps.getProperty('bintray.api_key') - publications = ['LibRelease'] - configurations = ['archives'] - pkg { - name = upload.uploadName - repo = upload.repository - userOrg = upload.userOrg - licenses = upload.licences - publish = true - dryRun = false - version { - name = upload.version - desc = upload.description - } - } - } -} \ No newline at end of file diff --git a/sample/.gitignore b/sample/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/sample/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/sample/build.gradle b/sample/build.gradle deleted file mode 100644 index 6628c85..0000000 --- a/sample/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion - defaultConfig { - applicationId "com.yarolegovich.slidingrootnav.sample" - minSdkVersion 21 - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - implementation deps.annotations - implementation deps.androidxCompat - implementation deps.designSupport - implementation deps.recycler - - implementation project(':library') -} diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro deleted file mode 100644 index 2309852..0000000 --- a/sample/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in C:\Users\yarolegovich\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml deleted file mode 100644 index 0fe5580..0000000 --- a/sample/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index b01f83f..0000000 Binary files a/sample/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c43f618..0000000 Binary files a/sample/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index f4c9cf2..0000000 Binary files a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 365f970..0000000 Binary files a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 73f34d4..0000000 Binary files a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml deleted file mode 100644 index c648bb7..0000000 --- a/sample/src/main/res/values/colors.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - #fff - #fff - #448AFF - - #212121 - #757575 - diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml deleted file mode 100644 index c62b553..0000000 --- a/sample/src/main/res/values/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 52baf7e..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':sample', ':library' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..0cd755c --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "SlidingNav" +include(":demo") +include(":library")