├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_drawer.png │ │ │ │ └── drawer_shadow.9.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_drawer.png │ │ │ │ └── drawer_shadow.9.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_drawer.png │ │ │ │ └── drawer_shadow.9.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── speakers.jpg │ │ │ │ ├── ic_drawer.png │ │ │ │ ├── drawer_shadow.9.png │ │ │ │ ├── avatar_placeholder.png │ │ │ │ └── icon_active_conversation.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── shape_dark_circle.xml │ │ │ │ ├── branch_minified_grow_source.xml │ │ │ │ ├── branch_minified_grow_leave1.xml │ │ │ │ ├── branch_minified_grow_leave2.xml │ │ │ │ ├── branch_minified_grow_leave3.xml │ │ │ │ ├── branch_minified_grow_leave4.xml │ │ │ │ ├── branch_minified_grow_leave5.xml │ │ │ │ ├── branch_minified_grow_leave6.xml │ │ │ │ ├── branch_minified_grow_leave7.xml │ │ │ │ ├── branch_minified_grow_leave8.xml │ │ │ │ ├── branch_minified_grow_leave9.xml │ │ │ │ ├── branch_minified_grow_branch1.xml │ │ │ │ ├── branch_minified_grow_branch2.xml │ │ │ │ ├── branch_minified_grow_branch3.xml │ │ │ │ ├── branch_minified_grow_branch4.xml │ │ │ │ ├── branch_minified_grow_branch5.xml │ │ │ │ ├── branch_minified_grow_branch6.xml │ │ │ │ ├── circle_stroke_animated_show.xml │ │ │ │ ├── circle_stroke_animated_hide.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch2.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch6.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch3.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch4.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch5.xml │ │ │ │ ├── branch_minified_swipe_refresh_branch1.xml │ │ │ │ ├── circle_stroke.xml │ │ │ │ ├── branch_minified_swipe_refresh_dot.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave2.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave8.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave9.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave3.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave1.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave4.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave5.xml │ │ │ │ ├── branch_minified_swipe_refresh_leave6.xml │ │ │ │ └── branch_minified_swipe_refresh_leave7.xml │ │ │ ├── menu │ │ │ │ ├── global.xml │ │ │ │ └── main.xml │ │ │ ├── values │ │ │ │ ├── styles.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── attrs.xml │ │ │ │ ├── colors.xml │ │ │ │ └── dimens.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── layout │ │ │ │ ├── view_viewpager_header_textview.xml │ │ │ │ ├── fragment_navigation_drawer.xml │ │ │ │ ├── item_list.xml │ │ │ │ ├── fragment_viewpager_container.xml │ │ │ │ ├── fragment_placeholder.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── fragment_viewpager.xml │ │ │ │ ├── fragment_static_header_list.xml │ │ │ │ ├── view_recyclerview_header.xml │ │ │ │ ├── fragment_dynamic_header_list.xml │ │ │ │ └── fragment_slidinglayer.xml │ │ │ └── animator │ │ │ │ ├── shape_pop.xml │ │ │ │ ├── stroke_appear_from_end.xml │ │ │ │ ├── stroke_appear_from_center.xml │ │ │ │ └── stroke_disappear_to_center.xml │ │ ├── java │ │ │ └── ugia │ │ │ │ └── io │ │ │ │ └── androidbeautytreatment │ │ │ │ ├── viewcontroller │ │ │ │ ├── fragment │ │ │ │ │ ├── ClickableViewController.java │ │ │ │ │ ├── TaggableFragment.java │ │ │ │ │ ├── ViewPagerTextViewFragment.java │ │ │ │ │ ├── SlidingLayerFragment.java │ │ │ │ │ ├── ViewPagerFragment.java │ │ │ │ │ ├── NavigationDrawerFragment.java │ │ │ │ │ ├── DynamicHeaderListFragment.java │ │ │ │ │ └── StaticHeaderListFragment.java │ │ │ │ ├── adapter │ │ │ │ │ ├── ViewPagerAdapter.java │ │ │ │ │ ├── ContactAdapter.java │ │ │ │ │ ├── HeaderContactListAdapter.java │ │ │ │ │ ├── ContactListAdapter.java │ │ │ │ │ └── FragmentPagerAdapter.java │ │ │ │ └── activity │ │ │ │ │ └── MainActivity.java │ │ │ │ ├── util │ │ │ │ ├── ColorUtils.java │ │ │ │ ├── Poets.java │ │ │ │ └── Transitions.java │ │ │ │ ├── model │ │ │ │ └── Contact.java │ │ │ │ └── view │ │ │ │ ├── ClippedImageView.java │ │ │ │ └── NoisySwipeRefreshLayout.java │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── ugia │ │ └── io │ │ └── androidbeautytreatment │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── assets ├── swiperefresh.gif ├── listviewpathexample.gif ├── slidinglayerparty.gif └── viewpagerslidejoy.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat ├── gradlew └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /assets/swiperefresh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/assets/swiperefresh.gif -------------------------------------------------------------------------------- /assets/listviewpathexample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/assets/listviewpathexample.gif -------------------------------------------------------------------------------- /assets/slidinglayerparty.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/assets/slidinglayerparty.gif -------------------------------------------------------------------------------- /assets/viewpagerslidejoy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/assets/viewpagerslidejoy.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/speakers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xxhdpi/speakers.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/avatar_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xxhdpi/avatar_placeholder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon_active_conversation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JlUgia/beauty-treatment-android-animations/HEAD/app/src/main/res/drawable-xxhdpi/icon_active_conversation.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Sep 16 21:58:55 CEST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | *.iml 29 | .idea 30 | -------------------------------------------------------------------------------- /app/src/androidTest/java/ugia/io/androidbeautytreatment/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package ugia.io.androidbeautytreatment; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # beauty-treatment-android-animations 2 | Set of samples of views with slick interaction patterns and animations 3 | 4 | Screenshots 5 | ----------- 6 | 7 | ![Demo Screenshot 1][1] 8 | ![Demo Screenshot 2][2] 9 | ![Demo Screenshot 4][3] 10 | ![Demo Screenshot 3][4] 11 | 12 | [1]: ./assets/swiperefresh.gif 13 | [2]: ./assets/slidinglayerparty.gif 14 | [3]: ./assets/listviewpathexample.gif 15 | [4]: ./assets/viewpagerslidejoy.gif 16 | 17 | 18 | Seen on: 19 | 20 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-beauty--treatment--android--animations-green.svg?style=flat)](https://android-arsenal.com/details/3/2611) 21 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/joseluisugia/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_dark_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "ugia.io.androidbeautytreatment" 9 | minSdkVersion 21 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | 25 | compile 'com.wunderlist:sliding-layer:1.2.5' 26 | 27 | compile 'com.android.support:recyclerview-v7:23.0.1' 28 | compile 'com.android.support:appcompat-v7:23.0.1' 29 | compile 'com.android.support:design:23.0.1' 30 | compile 'com.android.support:support-v4:23.0.1' 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/menu/global.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 64dp 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_source.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave1.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave2.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave3.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave4.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave5.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave6.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave7.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave8.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_leave9.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch1.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch2.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch3.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch4.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch5.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_grow_branch6.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_viewpager_header_textview.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/fragment/ClickableViewController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ClickableViewController.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.fragment; 18 | 19 | import android.view.View; 20 | 21 | /** 22 | * This interface enforces the fact that classes implementing it can accept click events on sub views contained 23 | * within the view group. 24 | *

25 | * Created by joseluisugia on 01/10/15. 26 | */ 27 | public interface ClickableViewController { 28 | 29 | void buttonClicked(View view); 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/animator/shape_pop.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 |

20 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/animator/stroke_appear_from_end.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_stroke_animated_show.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_stroke_animated_hide.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 25 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | Android Beauty Treatment 19 | 20 | Active View Pager 21 | Artistic Recycler View 22 | Creative Recycler View 23 | Composed Sliding Layer 24 | 25 | Open navigation drawer 26 | Close navigation drawer 27 | 28 | Example action 29 | 30 | Settings 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_list.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_viewpager_container.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch2.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch6.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch3.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch4.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch5.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_branch1.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/util/ColorUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ColorUtils.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.util; 18 | 19 | /** 20 | * Utils to play with colors seamlessly 21 | *

22 | * Created by joseluisugia on 11/02/15. 23 | */ 24 | public class ColorUtils { 25 | 26 | /** 27 | * This method applies alpha channel to a given color without it. Useful when playing with alpha channels on 28 | * #android.widget.TextView. Applying a color with alpha is significantly more performing that doing the 29 | * same at the view level 30 | *

31 | * 32 | * @param color 33 | * @param alpha 34 | * @return the final result with the desired alpha applied 35 | */ 36 | public static int applyAlphaToColor(int color, float alpha) { 37 | return (int) (0xFF * alpha) << 24 | color & 0xFFFFFF; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/fragment/TaggableFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TaggableFragment.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.fragment; 18 | 19 | import android.app.Fragment; 20 | import android.os.Bundle; 21 | import android.view.View; 22 | 23 | /** 24 | * Created by joseluisugia on 25/09/15. 25 | */ 26 | public abstract class TaggableFragment extends Fragment { 27 | 28 | private static final int INVALID_TAG = -1; 29 | protected int viewTag = INVALID_TAG; 30 | 31 | @Override 32 | public void onViewCreated(View view, Bundle savedInstanceState) { 33 | super.onViewCreated(view, savedInstanceState); 34 | 35 | if (viewTag != INVALID_TAG && view != null) { 36 | view.setTag(viewTag); 37 | } 38 | } 39 | 40 | public void setViewTag(int viewTag) { 41 | this.viewTag = viewTag; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/animator/stroke_appear_from_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 29 | 30 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/animator/stroke_disappear_to_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 29 | 30 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_placeholder.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_stroke.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 29 | 30 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_dot.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave2.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave8.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave9.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave3.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | #dadada 22 | #c8c8c8 23 | #808080 24 | #666666 25 | #424242 26 | #242424 27 | 28 | #55000000 29 | #80000000 30 | #bb000000 31 | 32 | 33 | #e3ffffff 34 | #ddffffff 35 | #ccffffff 36 | #aaffffff 37 | #99ffffff 38 | #66ffffff 39 | #33ffffff 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave1.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave4.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave5.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave6.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branch_minified_swipe_refresh_leave7.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 16dp 20 | 16dp 21 | 22 | 24 | 240dp 25 | 26 | 27 | 80dp 28 | 29 | 30 | 100dp 31 | 50dp 32 | 120dp 33 | 34 | 35 | 150dp 36 | 50dp 37 | 38 | 100dp 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 25 | 26 | 30 | 31 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/model/Contact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Contact.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.model; 18 | 19 | /** 20 | * Simple POJO holding the information of a contact or friend 21 | *

22 | * Created by joseluisugia on 26/09/15. 23 | */ 24 | public class Contact { 25 | 26 | private final int avatarResource; 27 | private final String name; 28 | private final String phoneNumber; 29 | private final boolean hasRecentConversation; 30 | 31 | public Contact(String name, String phoneNumber, boolean hasRecentConversation) { 32 | this(name, phoneNumber, hasRecentConversation, 0); 33 | } 34 | 35 | public Contact(String name, String phoneNumber, boolean hasRecentConversation, int avatarResource) { 36 | 37 | this.name = name; 38 | this.phoneNumber = phoneNumber; 39 | this.hasRecentConversation = hasRecentConversation; 40 | this.avatarResource = avatarResource; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public String getPhoneNumber() { 48 | return phoneNumber; 49 | } 50 | 51 | public boolean hasRecentConversation() { 52 | return hasRecentConversation; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/util/Poets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Poets.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.util; 18 | 19 | import ugia.io.androidbeautytreatment.model.Contact; 20 | 21 | /** 22 | * Ghost data provider utils that simulates a source of information. 23 | *

24 | * Created by joseluisugia on 18/11/15. 25 | */ 26 | public class Poets { 27 | 28 | public static Contact[] generate() { 29 | 30 | return new Contact[] { 31 | 32 | new Contact("Pio Baroja", "123", true), 33 | new Contact("Miguel Hernandez", "456", false), 34 | new Contact("Miguel de Cervantes", "789", false), 35 | new Contact("Juan Ramón Jimenez", "101", true), 36 | new Contact("Miguel de Unamuno", "112", true), 37 | new Contact("Antonio Machado", "175", false), 38 | new Contact("Federico García Lorca", "623", false), 39 | new Contact("Ramiro de Maeztu", "999", true), 40 | new Contact("Ramón María del Valle-Inclán", "747", false), 41 | new Contact("Ángel Ganivet", "622", false), 42 | new Contact("Enrique de Mesa", "278", true), 43 | new Contact("Azorín", "345", false) 44 | }; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/adapter/ViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ViewPagerAdapter.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.adapter; 18 | 19 | import android.app.Fragment; 20 | import android.app.FragmentManager; 21 | 22 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.TaggableFragment; 23 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.ViewPagerTextViewFragment; 24 | 25 | /** 26 | * Created by joseluisugia on 18/09/15. 27 | */ 28 | public class ViewPagerAdapter extends FragmentPagerAdapter { 29 | 30 | private int[] backgroundColorResources = new int[] { 31 | android.R.color.holo_green_light, 32 | android.R.color.holo_blue_dark, 33 | android.R.color.holo_orange_dark, 34 | android.R.color.holo_red_dark, 35 | android.R.color.holo_purple }; 36 | 37 | public ViewPagerAdapter(FragmentManager fm) { 38 | super(fm); 39 | } 40 | 41 | @Override 42 | public Fragment getItem(int position) { 43 | 44 | int color = backgroundColorResources[position]; 45 | 46 | TaggableFragment fragment = ViewPagerTextViewFragment.newInstance(position + 1, color); 47 | fragment.setViewTag(position); 48 | return fragment; 49 | } 50 | 51 | @Override 52 | public int getCount() { 53 | return backgroundColorResources.length; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_viewpager.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 28 | 29 | 31 | 32 | 34 | 35 | 37 | 38 | 40 | 41 | 43 | 44 | 45 | 46 | 50 | 51 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/util/Transitions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Transitions.java 3 | * 4 | * @author Jose L Ugia - @Jl_Ugia 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package ugia.io.androidbeautytreatment.util; 20 | 21 | /** 22 | * Created by joseluisugia on 17/03/15. 23 | */ 24 | public class Transitions { 25 | 26 | 27 | public static float intermediateValueForRange(float position, float[] values) { 28 | return intermediateValueForRange(position, new float[] { 0, 1 }, values); 29 | } 30 | 31 | public static float intermediateValueForCuePoints(float position, float[] range) { 32 | return intermediateValueForRange(position, range, range); 33 | } 34 | 35 | public static float intermediateValueForRange(float position, float[] cuePoints, float[] values) { 36 | 37 | if (cuePoints.length != values.length) { 38 | throw new IllegalArgumentException("Range and values arrays must be of the same size"); 39 | } 40 | 41 | int length = cuePoints.length; 42 | 43 | if (position <= cuePoints[0]) { 44 | return values[0]; 45 | 46 | } else { 47 | 48 | float cuePoint, previousCuePoint, value, previousValue; 49 | float rangeRatio; 50 | 51 | for (int i = 1; i < length; i++) { 52 | 53 | cuePoint = cuePoints[i]; 54 | 55 | if (position <= cuePoint) { 56 | previousCuePoint = cuePoints[i - 1]; 57 | value = values[i]; 58 | previousValue = values[i - 1]; 59 | rangeRatio = (position - previousCuePoint) / (cuePoint - previousCuePoint); 60 | return previousValue + ((value - previousValue) * rangeRatio); 61 | } 62 | } 63 | 64 | return values[length - 1]; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/adapter/ContactAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ContactAdapter.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.adapter; 18 | 19 | import java.util.Arrays; 20 | import java.util.Comparator; 21 | 22 | import android.support.v7.widget.RecyclerView; 23 | import android.view.View; 24 | import android.widget.TextView; 25 | 26 | import ugia.io.androidbeautytreatment.R; 27 | import ugia.io.androidbeautytreatment.model.Contact; 28 | 29 | /** 30 | * This base class holds a basic adapter that takes care of populating a list of contacts. This class may be 31 | * extended to add extra functionality 32 | *

33 | * Created by joseluisugia on 16/07/15. 34 | */ 35 | abstract class ContactAdapter extends RecyclerView.Adapter { 36 | 37 | protected final static int VIEW_TYPE_ROW = 0; 38 | 39 | protected final Contact[] contacts; 40 | 41 | public ContactAdapter(Contact[] contacts) { 42 | this.contacts = contacts; 43 | sortContactArray(); 44 | } 45 | 46 | private void sortContactArray() { 47 | Arrays.sort(contacts, contactComparator); 48 | } 49 | 50 | @Override 51 | public int getItemCount() { 52 | return contacts.length; 53 | } 54 | 55 | class ContactViewHolder extends RecyclerView.ViewHolder { 56 | 57 | private final TextView contactName; 58 | 59 | public ContactViewHolder(View view) { 60 | super(view); 61 | contactName = (TextView) view.findViewById(R.id.il_textview); 62 | } 63 | 64 | protected void bindContact(Contact contact) { 65 | contactName.setText(contact.getName()); 66 | } 67 | } 68 | 69 | private final Comparator contactComparator = new Comparator() { 70 | @Override 71 | public int compare(Contact lhs, Contact rhs) { 72 | return lhs.getName().compareTo(rhs.getName()); 73 | } 74 | }; 75 | } 76 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/fragment/ViewPagerTextViewFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ViewPagerTextViewFragment.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.fragment; 18 | 19 | import android.os.Bundle; 20 | import android.support.annotation.Nullable; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.TextView; 25 | 26 | import ugia.io.androidbeautytreatment.R; 27 | 28 | /** 29 | * This fragment is used to populate the each of the pages of the view pager. Depending on the index, a different 30 | * text and background color is assigned to it. 31 | *

32 | * Created by joseluisugia on 22/09/15. 33 | */ 34 | public class ViewPagerTextViewFragment extends TaggableFragment { 35 | 36 | private static final String PAGE_COLOR_RESOURCE = "pageColorResource"; 37 | private static final String PAGE_INDEX_KEY = "pageIndex"; 38 | 39 | protected int pageColor; 40 | private int pageIndex; 41 | 42 | public static ViewPagerTextViewFragment newInstance(int pageIndex, int color) { 43 | 44 | ViewPagerTextViewFragment fragment = new ViewPagerTextViewFragment(); 45 | Bundle arguments = new Bundle(); 46 | arguments.putInt(PAGE_INDEX_KEY, pageIndex); 47 | arguments.putInt(PAGE_COLOR_RESOURCE, color); 48 | 49 | fragment.setArguments(arguments); 50 | 51 | return fragment; 52 | } 53 | 54 | @Override 55 | public void onCreate(Bundle savedInstanceState) { 56 | super.onCreate(savedInstanceState); 57 | 58 | Bundle arguments = getArguments(); 59 | pageIndex = arguments != null ? arguments.getInt(PAGE_INDEX_KEY) : 1; 60 | pageColor = arguments != null ? getResources().getColor(arguments.getInt(PAGE_COLOR_RESOURCE)) : 0; 61 | } 62 | 63 | @Nullable 64 | @Override 65 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 66 | 67 | View view = inflater.inflate(R.layout.fragment_viewpager_container, container, false); 68 | view.setBackgroundColor(pageColor); 69 | 70 | TextView textView = (TextView) view.findViewById(R.id.fvc_textview); 71 | textView.setText("I am #" + pageIndex); 72 | 73 | return view; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_static_header_list.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 27 | 28 | 30 | 31 | 42 | 43 | 44 | 45 | 48 | 49 | 54 | 55 | 56 | 60 | 61 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_recyclerview_header.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 35 | 36 | 43 | 44 | 51 | 52 | 60 | 61 | 62 | 63 | 73 | 74 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/fragment/SlidingLayerFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SlidingLayerFragment.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.fragment; 18 | 19 | import android.app.Fragment; 20 | import android.os.Bundle; 21 | import android.support.annotation.Nullable; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | 26 | import com.wunderlist.slidinglayer.SlidingLayer; 27 | import com.wunderlist.slidinglayer.transformer.RotationTransformer; 28 | import com.wunderlist.slidinglayer.transformer.SlideJoyTransformer; 29 | import ugia.io.androidbeautytreatment.R; 30 | 31 | /** 32 | * Created by joseluisugia on 18/09/15. 33 | */ 34 | public class SlidingLayerFragment extends Fragment implements ClickableViewController { 35 | 36 | private SlidingLayer slidingLayerLeft; 37 | private SlidingLayer slidingLayerTop; 38 | private SlidingLayer slidingLayerRight; 39 | private SlidingLayer slidingLayerBottom; 40 | 41 | public static SlidingLayerFragment newInstance() { 42 | return new SlidingLayerFragment(); 43 | } 44 | 45 | @Nullable 46 | @Override 47 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 48 | 49 | View view = inflater.inflate(R.layout.fragment_slidinglayer, container, false); 50 | 51 | slidingLayerLeft = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_left); 52 | slidingLayerTop = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_top); 53 | slidingLayerRight = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_right); 54 | slidingLayerBottom = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_bottom); 55 | 56 | slidingLayerLeft.setLayerTransformer(new RotationTransformer()); 57 | slidingLayerRight.setLayerTransformer(new RotationTransformer()); 58 | slidingLayerTop.setLayerTransformer(new SlideJoyTransformer()); 59 | slidingLayerBottom.setLayerTransformer(new SlideJoyTransformer()); 60 | 61 | view.post(new Runnable() { 62 | @Override 63 | public void run() { 64 | slidingLayerLeft.closeLayer(false); 65 | slidingLayerRight.closeLayer(false); 66 | } 67 | }); 68 | 69 | return view; 70 | } 71 | 72 | @Override 73 | public void buttonClicked(View view) { 74 | openLayers(); 75 | } 76 | 77 | private void openLayers() { 78 | slidingLayerLeft.openLayer(true); 79 | slidingLayerTop.openLayer(true); 80 | slidingLayerRight.openLayer(true); 81 | slidingLayerBottom.openLayer(true); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/adapter/HeaderContactListAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * HeaderContactListAdapter.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.adapter; 18 | 19 | import android.support.v7.widget.RecyclerView; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | import ugia.io.androidbeautytreatment.R; 25 | import ugia.io.androidbeautytreatment.model.Contact; 26 | 27 | /** 28 | * This class adds on top of @{ContactAdapter} and includes a header on top of the list 29 | *

30 | * Created by joseluisugia on 16/07/15. 31 | */ 32 | public class HeaderContactListAdapter extends ContactAdapter { 33 | 34 | private final static int VIEW_TYPE_HEADER = 1; 35 | 36 | public HeaderContactListAdapter(Contact[] contacts) { 37 | super(contacts); 38 | } 39 | 40 | @Override 41 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 42 | 43 | LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); 44 | 45 | if (viewType == VIEW_TYPE_ROW) { 46 | View view = layoutInflater.inflate(R.layout.item_list, parent, false); 47 | return new ContactViewHolder(view); 48 | 49 | } else { 50 | return new HeaderViewHolder(createHeader(parent)); 51 | } 52 | } 53 | 54 | private View createHeader(ViewGroup parent) { 55 | 56 | View view = new View(parent.getContext()); 57 | parent.addView(view); 58 | 59 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 60 | lp.height = (int) parent.getContext().getResources() 61 | .getDimension(R.dimen.recyclerview_dynamic_header_big_height); 62 | view.setLayoutParams(lp); 63 | 64 | return view; 65 | } 66 | 67 | @Override 68 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { 69 | 70 | int viewType = getItemViewType(position); 71 | 72 | if (viewType == VIEW_TYPE_ROW) { 73 | Contact contact = contacts[position - 1]; 74 | ((ContactViewHolder) holder).bindContact(contact); 75 | } 76 | } 77 | 78 | @Override 79 | public int getItemCount() { 80 | return super.getItemCount() + 1; 81 | } 82 | 83 | @Override 84 | public int getItemViewType(int position) { 85 | if (position == 0) { 86 | return VIEW_TYPE_HEADER; 87 | } else { 88 | return VIEW_TYPE_ROW; 89 | } 90 | } 91 | 92 | class HeaderViewHolder extends RecyclerView.ViewHolder { 93 | 94 | public HeaderViewHolder(View view) { 95 | super(view); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_dynamic_header_list.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 26 | 27 | 34 | 35 | 36 | 37 | 44 | 45 | 51 | 52 | 61 | 62 | 66 | 67 | 68 | 69 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/adapter/ContactListAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ContactListAdapter.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.adapter; 18 | 19 | import android.support.v7.widget.RecyclerView; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | import ugia.io.androidbeautytreatment.R; 25 | import ugia.io.androidbeautytreatment.model.Contact; 26 | 27 | /** 28 | * This class adds on top of @{ContactAdapter} and includes a footer in the bottom of the list 29 | *

30 | * Created by joseluisugia on 16/07/15. 31 | */ 32 | public class ContactListAdapter extends ContactAdapter { 33 | 34 | private final static int VIEW_TYPE_FOOTER = 1; 35 | 36 | public ContactListAdapter(Contact[] contacts) { 37 | super(contacts); 38 | } 39 | 40 | @Override 41 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 42 | 43 | LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); 44 | 45 | if (viewType == VIEW_TYPE_ROW) { 46 | View view = layoutInflater.inflate(R.layout.item_list, parent, false); 47 | return new ContactViewHolder(view); 48 | } else { 49 | return new FooterViewHolder(createFooterView(parent)); 50 | } 51 | } 52 | 53 | private View createFooterView(ViewGroup parent) { 54 | 55 | int screenHeight = parent.getMeasuredHeight(); 56 | int itemHeight = (int) parent.getContext().getResources().getDimension(R.dimen.recyclerview_item_height); 57 | 58 | View view = new View(parent.getContext()); 59 | parent.addView(view); 60 | 61 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 62 | lp.height = screenHeight - itemHeight; 63 | view.setLayoutParams(lp); 64 | 65 | return view; 66 | } 67 | 68 | @Override 69 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { 70 | 71 | int viewType = getItemViewType(position); 72 | 73 | if (viewType == VIEW_TYPE_ROW) { 74 | Contact contact = contacts[position]; 75 | ((ContactViewHolder) holder).bindContact(contact); 76 | } 77 | } 78 | 79 | @Override 80 | public int getItemCount() { 81 | return super.getItemCount() + 1; 82 | } 83 | 84 | @Override 85 | public int getItemViewType(int position) { 86 | if (position == super.getItemCount()) { 87 | return VIEW_TYPE_FOOTER; 88 | } else { 89 | return VIEW_TYPE_ROW; 90 | } 91 | } 92 | 93 | class FooterViewHolder extends RecyclerView.ViewHolder { 94 | 95 | public FooterViewHolder(View view) { 96 | super(view); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/viewcontroller/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MainActivity.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.viewcontroller.activity; 18 | 19 | import android.app.Activity; 20 | import android.app.Fragment; 21 | import android.os.Bundle; 22 | import android.support.v4.widget.DrawerLayout; 23 | import android.view.Menu; 24 | import android.view.View; 25 | 26 | import ugia.io.androidbeautytreatment.R; 27 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.ClickableViewController; 28 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.DynamicHeaderListFragment; 29 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.NavigationDrawerFragment; 30 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.SlidingLayerFragment; 31 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.StaticHeaderListFragment; 32 | import ugia.io.androidbeautytreatment.viewcontroller.fragment.ViewPagerFragment; 33 | 34 | public class MainActivity extends Activity 35 | implements NavigationDrawerFragment.NavigationDrawerCallbacks, ClickableViewController { 36 | 37 | /** 38 | * Fragment managing the behaviors, interactions and presentation of the navigation drawer. 39 | */ 40 | private NavigationDrawerFragment mNavigationDrawerFragment; 41 | private ClickableViewController visibleFragment; 42 | 43 | @Override 44 | protected void onCreate(Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | 47 | setContentView(R.layout.activity_main); 48 | bindViews(); 49 | } 50 | 51 | @Override 52 | public void buttonClicked(View view) { 53 | visibleFragment.buttonClicked(view); 54 | } 55 | 56 | private void bindViews() { 57 | 58 | mNavigationDrawerFragment = (NavigationDrawerFragment) 59 | getFragmentManager().findFragmentById(R.id.navigation_drawer); 60 | 61 | mNavigationDrawerFragment.setUp( 62 | R.id.navigation_drawer, 63 | (DrawerLayout) findViewById(R.id.drawer_layout)); 64 | } 65 | 66 | @Override 67 | public void onNavigationDrawerItemSelected(int position) { 68 | 69 | switch (position) { 70 | case 0: 71 | visibleFragment = ViewPagerFragment.newInstance(); 72 | break; 73 | 74 | case 1: 75 | visibleFragment = StaticHeaderListFragment.newInstance(); 76 | break; 77 | 78 | case 2: 79 | visibleFragment = DynamicHeaderListFragment.newInstance(); 80 | break; 81 | 82 | case 3: 83 | visibleFragment = SlidingLayerFragment.newInstance(); 84 | break; 85 | 86 | default: 87 | throw new IllegalArgumentException("There should be no section with this position index."); 88 | } 89 | 90 | getFragmentManager().beginTransaction() 91 | .replace(R.id.container, (Fragment) visibleFragment) 92 | .commit(); 93 | } 94 | 95 | @Override 96 | public boolean onCreateOptionsMenu(Menu menu) { 97 | if (!mNavigationDrawerFragment.isDrawerOpen()) { 98 | getMenuInflater().inflate(R.menu.main, menu); 99 | return true; 100 | } 101 | return super.onCreateOptionsMenu(menu); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/ugia/io/androidbeautytreatment/view/ClippedImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ClippedImageView.java 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ugia.io.androidbeautytreatment.view; 18 | 19 | import android.content.Context; 20 | import android.content.res.TypedArray; 21 | import android.graphics.Canvas; 22 | import android.graphics.Paint; 23 | import android.graphics.Path; 24 | import android.graphics.RectF; 25 | import android.os.Build; 26 | import android.util.AttributeSet; 27 | import android.view.View; 28 | import android.widget.ImageView; 29 | 30 | import ugia.io.androidbeautytreatment.R; 31 | 32 | /** 33 | * This class provides a straightforward way to add clipping and stroke to an #ImageView 34 | *

35 | * Created by joseluisugia on 1/28/14. 36 | */ 37 | public class ClippedImageView extends ImageView { 38 | 39 | private float cornerRadius; 40 | private Path path; 41 | private RectF rect; 42 | 43 | private Paint strokePaint; 44 | 45 | public ClippedImageView(Context context) { 46 | this(context, null); 47 | } 48 | 49 | public ClippedImageView(Context context, AttributeSet attrs) { 50 | this(context, attrs, 0); 51 | } 52 | 53 | public ClippedImageView(Context context, AttributeSet attrs, int defStyle) { 54 | super(context, attrs, defStyle); 55 | 56 | if (attrs == null) return; 57 | 58 | path = new Path(); 59 | rect = new RectF(); 60 | 61 | TypedArray attrsArray = context.obtainStyledAttributes(attrs, R.styleable.ClippedImageView, defStyle, 0); 62 | cornerRadius = attrsArray.getDimensionPixelSize(R.styleable.ClippedImageView_cornerRadius, 0); 63 | 64 | TypedArray bgAttrsArray = context.obtainStyledAttributes(attrs, R.styleable.BackgroundShape, defStyle, 0); 65 | int strokeColor = bgAttrsArray.getColor(R.styleable.BackgroundShape_backgroundStrokeColor, 0); 66 | int strokeWidth = bgAttrsArray.getDimensionPixelSize(R.styleable.BackgroundShape_backgroundStrokeSize, 0); 67 | 68 | if (strokeWidth > 0) { 69 | setupStrokePaint(strokeColor, strokeWidth); 70 | } 71 | 72 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH 73 | && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { 74 | 75 | setLayerType(View.LAYER_TYPE_SOFTWARE, null); 76 | } 77 | } 78 | 79 | private void setupStrokePaint(int color, int borderWidth) { 80 | 81 | strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); 82 | strokePaint.setStrokeJoin(Paint.Join.ROUND); 83 | strokePaint.setStrokeCap(Paint.Cap.ROUND); 84 | strokePaint.setStyle(Paint.Style.STROKE); 85 | strokePaint.setColor(color); 86 | strokePaint.setStrokeWidth(borderWidth); 87 | } 88 | 89 | @Override 90 | protected void onDraw(Canvas canvas) { 91 | 92 | int width = getWidth(); 93 | int height = getHeight(); 94 | 95 | rect.set(getPaddingLeft(), 96 | getPaddingTop(), 97 | width - getPaddingRight(), 98 | height - getPaddingBottom()); 99 | 100 | path.addRoundRect(rect, cornerRadius, cornerRadius, Path.Direction.CW); 101 | canvas.clipPath(path); 102 | 103 | super.onDraw(canvas); 104 | 105 | if (strokePaint != null) { 106 | canvas.drawCircle(width / 2, height / 2, 107 | (cornerRadius - strokePaint.getStrokeWidth() + 1) / 2, strokePaint); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_slidinglayer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 |