diff --git a/.gitmodules b/.gitmodules index 0c8cdba..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "lib/CircularReveal"] - path = lib/CircularReveal - url = git@github.com:ozodrukh/CircularReveal.git diff --git a/README.md b/README.md index e15ab43..98c7561 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Side--Menu.Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1388) +[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Side--Menu.Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1388) [![Yalantis](https://github.com/Yalantis/Side-Menu.Android/blob/master/badge.png)](https://yalantis.com/?utm_source=github) Side Menu ============== -Side menu with some categories to choose. -Made in Yalantis.
+#### Side menu with some categories to choose. Check this project on dribbble.
Check this project on Behance. God bless Ukraine! - +![Preview](https://cdn.dribbble.com/users/125056/screenshots/1689922/events-menu_1-1-6.gif) Sample ====== @@ -20,8 +19,35 @@ depends on Ozodrukh's animation util f Using ====== -First of all you have to upload animation submodule with `git submodule update --init` command -You have to create special overlay layout to show in behind current `Circular Reveal` animated view. +First of all you have to upload animation submodule with `git submodule update --init` command
+
+Or you can add gradle dependency with command :
+```groovy + dependencies { + implementation 'com.github.yalantis:Side-Menu.Android:1.0.2' + } +``` +.
+and command:
+```groovy + repositories { + maven { + url "https://jitpack.io" + } + } + dependencies { + implementation 'com.github.ozodrukh:CircularReveal:(latest-release)@aar' + } + +``` + +To add gradle dependency you need to open build.gradle (in your app folder,not in a project folder) then copy and add the dependencies there in the dependencies block; + + +
for CircularReveal module + + +After you have to create special overlay layout to show in behind current `Circular Reveal` animated view. And to add all items to menu you have to add all of them into `LinearLayout` ```xml @@ -100,9 +126,31 @@ And to add all items to menu you have to add all of them into `LinearLayout` All menu items should implement `Resourceble` interface to get menu item name and drawable res And all fragments should implement `ScreenShotable` to get screenshot of a fragment +You can customize icons that u place in the menu,or add mor items. Simply by changing the list you parse to view animator .For example: + +```java + + private List list = new ArrayList<>(); \\ the list of menu items + + SlideMenuItem menuItem0 = new SlideMenuItem(ContentFragment.CLOSE, R.drawable.icn_close); + list.add(menuItem0); + SlideMenuItem menuItem = new SlideMenuItem(ContentFragment.BUILDING, R.drawable.icn_1); \\first parameter is the id of menu item,the second is the icon resouce + list.add(menuItem); + SlideMenuItem menuItem2 = new SlideMenuItem(ContentFragment.BOOK, R.drawable.icn_2); + list.add(menuItem2); + + viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this); +``` + +#### Let us know! + +We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation. + +P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned! + ## License - Copyright 2015, Yalantis + Copyright 2019, Yalantis Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/app/build.gradle b/app/build.gradle index 992a92d..2cf63e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,16 @@ apply plugin: 'com.android.application' - +repositories { + maven { + url "https://jitpack.io" + } +} android { - compileSdkVersion 21 - buildToolsVersion "21.1.2" + compileSdkVersion 28 + buildToolsVersion "28.0.3" defaultConfig { - minSdkVersion 15 - targetSdkVersion 21 + minSdkVersion 16 + targetSdkVersion 28 versionCode 1 versionName "1.0" } @@ -19,8 +23,8 @@ android { } dependencies { - compile project(':lib:CircularReveal:circualreveal') - compile project(':library') - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:21.0.3' + implementation project(':library') + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.github.ozodrukh:CircularReveal:2.1.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e1f59e1..67bff47 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ android:theme="@style/AppTheme"> diff --git a/app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java b/app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java index 3f4371f..59aafda 100644 --- a/app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java +++ b/app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java @@ -1,12 +1,13 @@ package yalantis.com.sidemenu.sample; +import android.animation.Animator; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; @@ -17,7 +18,6 @@ import java.util.ArrayList; import java.util.List; -import io.codetail.animation.SupportAnimator; import io.codetail.animation.ViewAnimationUtils; import yalantis.com.sidemenu.interfaces.Resourceble; import yalantis.com.sidemenu.interfaces.ScreenShotable; @@ -26,11 +26,10 @@ import yalantis.com.sidemenu.util.ViewAnimator; -public class MainActivity extends ActionBarActivity implements ViewAnimator.ViewAnimatorListener { +public class MainActivity extends AppCompatActivity implements ViewAnimator.ViewAnimatorListener { private DrawerLayout drawerLayout; private ActionBarDrawerToggle drawerToggle; private List list = new ArrayList<>(); - private ContentFragment contentFragment; private ViewAnimator viewAnimator; private int res = R.drawable.content_music; private LinearLayout linearLayout; @@ -40,15 +39,13 @@ public class MainActivity extends ActionBarActivity implements ViewAnimator.View protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - if (savedInstanceState == null) { - contentFragment = ContentFragment.newInstance(R.drawable.content_music); - getSupportFragmentManager().beginTransaction() - .add(R.id.content_frame, contentFragment) - .commit(); - } - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + ContentFragment contentFragment = ContentFragment.newInstance(R.drawable.content_music); + getSupportFragmentManager().beginTransaction() + .replace(R.id.content_frame, contentFragment) + .commit(); + drawerLayout = findViewById(R.id.drawer_layout); drawerLayout.setScrimColor(Color.TRANSPARENT); - linearLayout = (LinearLayout) findViewById(R.id.left_drawer); + linearLayout = findViewById(R.id.left_drawer); linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -83,7 +80,7 @@ private void createMenuList() { private void setActionBar() { - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -114,7 +111,7 @@ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; - drawerLayout.setDrawerListener(drawerToggle); + drawerLayout.addDrawerListener(drawerToggle); } @Override @@ -153,11 +150,11 @@ private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPos this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music; View view = findViewById(R.id.content_frame); int finalRadius = Math.max(view.getWidth(), view.getHeight()); - SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius); + Animator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION); - findViewById(R.id.content_overlay).setBackgroundDrawable(new BitmapDrawable(getResources(), screenShotable.getBitmap())); + findViewById(R.id.content_overlay).setBackground(new BitmapDrawable(getResources(), screenShotable.getBitmap())); animator.start(); ContentFragment contentFragment = ContentFragment.newInstance(this.res); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit(); diff --git a/badge.png b/badge.png new file mode 100644 index 0000000..014ac44 Binary files /dev/null and b/badge.png differ diff --git a/build.gradle b/build.gradle index 6356aab..3a3193f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,17 +3,26 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:1.0.0' + classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } +def isReleaseBuild() { + return version.contains("SNAPSHOT") == false +} allprojects { + version = VERSION_NAME + group = GROUP repositories { jcenter() + google() } } +apply plugin: 'android-reporting' \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1d3591c..c9cc08d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,14 @@ -# 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. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# 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 \ No newline at end of file +VERSION_NAME=1.0 +VERSION_CODE=1 +GROUP=com.yalantis + +POM_DESCRIPTION=Side menu with some categories to choose. Made in Yalantis. +POM_URL=https://github.com/Yalantis/Side-Menu.Android +POM_SCM_URL=https://github.com/Yalantis/Side-Menu.Android +POM_SCM_CONNECTION=scm:git@github.com:yalantis/Side-Menu.Android.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:yalantis/Side-Menu.Android.git +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID=yalantis +POM_DEVELOPER_NAME=Yalantis diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8c0fb64..3baa851 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 0c71e76..abb087f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Thu Jan 31 15:40:02 EET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/lib/CircularReveal b/lib/CircularReveal deleted file mode 160000 index 70386c3..0000000 --- a/lib/CircularReveal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 70386c334a99de81cfd1cf28c4eeb6154e4f7549 diff --git a/library/build.gradle b/library/build.gradle index 197f454..8f292ea 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,12 +1,13 @@ apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 21 - buildToolsVersion "21.1.2" + compileSdkVersion 28 + buildToolsVersion "28.0.3" defaultConfig { minSdkVersion 15 - targetSdkVersion 21 + targetSdkVersion 28 versionCode 1 versionName "1.0" } @@ -18,5 +19,27 @@ android { } } dependencies { - compile 'com.android.support:appcompat-v7:21.0.3' + implementation 'com.android.support:appcompat-v7:28.0.0' } + +task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.sourceFiles +} + +task androidJavadocsJar(type: Jar) { + classifier = 'javadoc' + //basename = artifact_id + from androidJavadocs.destinationDir +} + +task androidSourcesJar(type: Jar) { + classifier = 'sources' + //basename = artifact_id + from android.sourceSets.main.java.sourceFiles +} + +artifacts { + //archives packageReleaseJar + archives androidSourcesJar + archives androidJavadocsJar +} \ No newline at end of file diff --git a/library/gradle.properties b/library/gradle.properties new file mode 100644 index 0000000..989904b --- /dev/null +++ b/library/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=Side Menu +POM_ARTIFACT_ID=sidemenu +POM_PACKAGING=aar \ No newline at end of file diff --git a/library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java b/library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java index a3533de..3b4be28 100644 --- a/library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java +++ b/library/src/main/java/yalantis/com/sidemenu/util/ViewAnimator.java @@ -2,7 +2,7 @@ import android.os.Handler; import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; @@ -23,7 +23,8 @@ public class ViewAnimator { private final int ANIMATION_DURATION = 175; public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500; - private ActionBarActivity actionBarActivity; + private AppCompatActivity appCompatActivity; + private List list; private List viewList = new ArrayList<>(); @@ -31,24 +32,28 @@ public class ViewAnimator { private DrawerLayout drawerLayout; private ViewAnimatorListener animatorListener; - public ViewAnimator(ActionBarActivity activity, + + public ViewAnimator(AppCompatActivity activity, List items, ScreenShotable screenShotable, final DrawerLayout drawerLayout, ViewAnimatorListener animatorListener) { - this.actionBarActivity = activity; + this.appCompatActivity = activity; + this.list = items; this.screenShotable = screenShotable; this.drawerLayout = drawerLayout; this.animatorListener = animatorListener; } + public void showMenuContent() { setViewsClickable(false); viewList.clear(); double size = list.size(); for (int i = 0; i < size; i++) { - View viewMenu = actionBarActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null); + View viewMenu = appCompatActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null); + final int finalI = i; viewMenu.setOnClickListener(new View.OnClickListener() { @Override diff --git a/mavenpush.gradle b/mavenpush.gradle new file mode 100644 index 0000000..b741e61 --- /dev/null +++ b/mavenpush.gradle @@ -0,0 +1,92 @@ +apply plugin: 'maven' +apply plugin: 'signing' + +def sonatypeRepositoryUrl +if (isReleaseBuild()) { + println 'RELEASE BUILD' + sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} else { + println 'DEBUG BUILD' + sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" +} + +def getRepositoryUsername() { + return hasProperty('nexusUsername') ? nexusUsername : "" +} + +def getRepositoryPassword() { + return hasProperty('nexusPassword') ? nexusPassword : "" +} + +afterEvaluate { project -> + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + pom.artifactId = POM_ARTIFACT_ID + + repository(url: sonatypeRepositoryUrl) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + + pom.project { + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + } + } + } + } + } + } + + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.sourceFiles + } + + task androidJavadocsJar(type: Jar) { + classifier = 'javadoc' + //basename = artifact_id + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + classifier = 'sources' + //basename = artifact_id + from android.sourceSets.main.java.sourceFiles + } + + artifacts { + //archives packageReleaseJar + archives androidSourcesJar + archives androidJavadocsJar + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3f3871a..093dc1b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':lib:CircularReveal:circualreveal',':library' +include ':app',':library'