diff --git a/README.md b/README.md index 2a91e47..98c7561 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Check this +![Preview](https://cdn.dribbble.com/users/125056/screenshots/1689922/events-menu_1-1-6.gif) Sample ====== @@ -21,10 +21,10 @@ Using ====== First of all you have to upload animation submodule with `git submodule update --init` command

-Or you can add gradle dependency with command:
+Or you can add gradle dependency with command :
```groovy dependencies { - compile 'com.yalantis:sidemenu:1.0'` + implementation 'com.github.yalantis:Side-Menu.Android:1.0.2' } ``` .
@@ -36,11 +36,15 @@ and command:
} } dependencies { - compile 'com.github.ozodrukh:CircularReveal:(latest-release)@aar' + implementation 'com.github.ozodrukh:CircularReveal:(latest-release)@aar' } ``` -
for CircularReveal module + +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. @@ -122,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 c382464..2cf63e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,12 +5,12 @@ repositories { } } 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" } @@ -23,8 +23,8 @@ android { } dependencies { - compile project(':library') - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:21.0.3' - compile 'com.github.ozodrukh:CircularReveal:1.0.4' + 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/java/yalantis/com/sidemenu/sample/MainActivity.java b/app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java index 8dfb1e1..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,13 +39,13 @@ public class MainActivity extends ActionBarActivity implements ViewAnimator.View protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - contentFragment = ContentFragment.newInstance(R.drawable.content_music); + ContentFragment contentFragment = ContentFragment.newInstance(R.drawable.content_music); getSupportFragmentManager().beginTransaction() .replace(R.id.content_frame, contentFragment) .commit(); - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + 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) { @@ -81,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); @@ -112,7 +111,7 @@ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; - drawerLayout.setDrawerListener(drawerToggle); + drawerLayout.addDrawerListener(drawerToggle); } @Override @@ -151,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/build.gradle b/build.gradle index c79e0d2..3a3193f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,11 @@ 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 @@ -20,6 +22,7 @@ allprojects { group = GROUP repositories { jcenter() + google() } } apply plugin: 'android-reporting' \ No newline at end of file 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/library/build.gradle b/library/build.gradle index 5529aca..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,6 +19,27 @@ android { } } dependencies { - compile 'com.android.support:appcompat-v7:21.0.3' + implementation 'com.android.support:appcompat-v7:28.0.0' } -apply from: '../mavenpush.gradle' \ No newline at end of file + +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/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