├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── mindinventory │ │ └── circularcardsstackview │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── mindinventory │ │ │ └── circularcardsstackview │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_white_rounded_rect.xml │ │ ├── ic_chat.xml │ │ ├── ic_favorite.xml │ │ ├── ic_home.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_notification.xml │ │ └── ic_profile.xml │ │ ├── font │ │ ├── roboto_bold.ttf │ │ ├── roboto_medium.ttf │ │ └── roboto_regular.ttf │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── mindinventory │ └── circularcardsstackview │ └── ExampleUnitTest.kt ├── build.gradle ├── circularcardsstackview ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── mindinventory │ │ └── circularcardsstackview │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── mindinventory │ │ │ └── circularcardsstackview │ │ │ ├── adapter │ │ │ ├── CardStackAdapter.kt │ │ │ └── CircularAdapter.kt │ │ │ ├── data │ │ │ └── CardModel.kt │ │ │ ├── listener │ │ │ ├── CardActionListener.kt │ │ │ └── OnPageChangeListener.kt │ │ │ ├── ui │ │ │ └── CircularCardsStackView.kt │ │ │ └── util │ │ │ ├── DisplayUtils.kt │ │ │ ├── ScreenSize.kt │ │ │ └── SliderTransformerHorizontal.kt │ └── res │ │ ├── drawable │ │ ├── bg_card.xml │ │ ├── bg_profile_card.xml │ │ ├── bg_white_rounded_rect.xml │ │ ├── girl.webp │ │ ├── ic_chat_action.xml │ │ └── ic_favorite_action.xml │ │ ├── font │ │ ├── roboto_bold_italic.ttf │ │ └── roboto_italic.ttf │ │ ├── layout │ │ ├── circular_cards_stack_view.xml │ │ └── item_card.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── mindinventory │ └── circularcardsstackview │ └── ExampleUnitTest.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── media ├── feature.gif └── feature_image.jpg └── settings.gradle /.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 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | .idea 29 | *.iml 30 | 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 MindInventory 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # CircularCardsStackView 4 | [![](https://jitpack.io/v/Mindinventory/CircularCardsStackView.svg)](https://jitpack.io/#Mindinventory/CircularCardsStackView) 5 | 6 | ## Overview 7 | ![ezgif com-gif-maker (10)](/media/feature.gif) 8 | 9 | ## Features 10 | - Android 11 support 11 | - Easy setup 12 | - Endless card stack 13 | - Swipe horizontally with animation 14 | - Fully customized 15 | - Support to all resolutions with portrait orientation 16 | 17 | ## Usage 18 | ### Dependencies 19 | - **Step 1: Add the JitPack repository in your project build.gradle file** 20 | ```bash 21 | allprojects { 22 | repositories { 23 | ... 24 | maven { url 'https://jitpack.io' } 25 | } 26 | } 27 | ``` 28 | 29 | **or** 30 | 31 | If Android studio version is Arctic Fox then add it in your settings.gradle: 32 | ```bash 33 | dependencyResolutionManagement { 34 | repositories { 35 | ... 36 | maven { url 'https://jitpack.io' } 37 | } 38 | } 39 | ``` 40 | 41 | - **Step 2: Add the dependency in your app module build.gradle file** 42 | ```bash 43 | dependencies { 44 | ... 45 | implementation 'com.github.Mindinventory:CircularCardsStackView:0.0.2' 46 | } 47 | ``` 48 | ### Implementation 49 | - **Step 1: Add CardCircularStackView in your xml and customize attributes** 50 | ```bash 51 | 69 | ``` 70 | 71 | **Step 2: Provide card list and implement pageChangeListener** 72 | ```bash 73 | cardStack.setUpCardStack(ArrayList(), object:OnPageChangeListener{ 74 | override fun onPageScrolled(position: Int) { 75 | 76 | } 77 | 78 | override fun onPageSelected(position: Int) { 79 | 80 | } 81 | 82 | override fun onPageScrollStateChanged(state: Int) { 83 | 84 | } 85 | }) 86 | ``` 87 | **Step 3: Customize card action option's icon and implement action listener** 88 | ```bash 89 | cardStack.setActionOptions( 90 | firstButtonResourceId = R.drawable.ic_message, 91 | secondButtonResourceId = R.drawable.ic_heart, 92 | object : CardActionListener { 93 | override fun onFirstButtonOptionClick(position: Int) { 94 | 95 | } 96 | 97 | override fun onSecondButtonOptionClick(position: Int) { 98 | 99 | } 100 | 101 | } 102 | ) 103 | ``` 104 | ### Appearance 105 | 106 | | Attribute | Description | Default | 107 | | ------------------------------ | -------------------------------------------------------- | :-----------: | 108 | | **stackCardBackgroundColor** | The background color of the card | white | 109 | | **stackCardChildPadding** | The padding of the card's child view | _15sdp | 110 | | **stackCardCornerRadius** | The corner radius of the card | _30sdp | 111 | | **stackCardStrokeColor** | The stroke color of the card | white | 112 | | **stackCardStrokeWidth** | The stroke width of the card | _2sdp | 113 | | **profileViewBackgroundColor** | The background color of profile view | #80000000 | 114 | | **childViewHeight** | The height of the child view of the card | _250sdp | 115 | | **actionOptionsVisibility** | Manage the visibility of the actions of the card | true | 116 | | **primaryTextColor** | The text color of the primary text of the profile view | white | 117 | | **secondaryTextColor** | The text color of the secondary text of the profile view | white | 118 | | **primaryTextFontFamily** | The FontFamily of the primary text of the profile view | roboto_bold | 119 | | **secondaryTextFontFamily** | The FontFamily of the secondary text of the profile view | roboto_medium | 120 | | **primaryTextSize** | The text size of the primary text of the profile view | _16ssp | 121 | | **secondaryTextSize** | The text size of the secondary text of the profile view | _14ssp | 122 | 123 | ## Guideline for contributors 124 | Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only. 125 | 126 | ## Guideline to report an issue/feature request 127 | It would be great for us if the reporter can share the below things to understand the root cause of the issue. 128 | 129 | - Library version 130 | - Code snippet 131 | - Logs if applicable 132 | - Device specification like (Manufacturer, OS version, etc) 133 | - Screenshot/video with steps to reproduce the issue 134 | 135 | ## Requirements 136 | - minSdkVersion >= 21 137 | - Androidx 138 | 139 | ## Library used 140 | - [sdp](https://github.com/intuit/sdp) 141 | - [ssp](https://github.com/intuit/ssp) 142 | - [RoundedImageView](https://github.com/vinc3m1/RoundedImageView) 143 | - [Glide](https://github.com/bumptech/glide) 144 | - [Gson](https://github.com/google/gson) 145 | 146 | 147 | # LICENSE! 148 | 149 | CircularCardsStackView is [MIT-licensed](/LICENSE). 150 | 151 | ## Let us know! 152 | If you use our open-source libraries in your project, please make sure to credit us and Give a star to www.mindinventory.com 153 | 154 |

Please feel free to use this component and Let us know if you are interested to building Apps or Designing Products.

155 | 156 | app development 157 | 158 | 159 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Built application files 3 | *.apk 4 | *.ap_ 5 | 6 | # Files for the Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | 16 | # Gradle files 17 | .gradle/ 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 | 29 | *.idea 30 | *.iml 31 | 32 | .DS_Store 33 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-kapt' 5 | } 6 | 7 | android { 8 | compileSdkVersion 30 9 | buildToolsVersion "30.0.3" 10 | 11 | defaultConfig { 12 | applicationId "com.mindinventory.cardcircularstackview.sample" 13 | minSdkVersion 21 14 | targetSdkVersion 30 15 | versionCode 1 16 | versionName "1.0" 17 | 18 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 19 | } 20 | 21 | buildTypes { 22 | debug { 23 | minifyEnabled true 24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 25 | } 26 | release { 27 | minifyEnabled true 28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 29 | } 30 | } 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | buildFeatures { 39 | viewBinding true 40 | } 41 | } 42 | 43 | dependencies { 44 | 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 46 | implementation 'androidx.core:core-ktx:1.6.0' 47 | implementation 'androidx.appcompat:appcompat:1.3.1' 48 | implementation 'com.google.android.material:material:1.4.0' 49 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0' 50 | implementation project(path: ':circularcardsstackview') 51 | testImplementation 'junit:junit:4.13.2' 52 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 53 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 54 | 55 | implementation 'com.intuit.sdp:sdp-android:1.0.6' 56 | implementation 'com.intuit.ssp:ssp-android:1.0.6' 57 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/mindinventory/circularcardsstackview/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.mindinventory.cardstackview", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/mindinventory/circularcardsstackview/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import com.mindinventory.circularcardsstackview.data.CardModel 6 | import com.mindinventory.circularcardsstackview.listener.CardActionListener 7 | import com.mindinventory.circularcardsstackview.listener.OnPageChangeListener 8 | import com.mindinventory.circularcardsstackview.sample.databinding.ActivityMainBinding 9 | 10 | 11 | /** 12 | * This class defines the available customization and usage of CardCircularStackView 13 | * @author MindInventory 14 | */ 15 | class MainActivity : AppCompatActivity() { 16 | 17 | private lateinit var binding: ActivityMainBinding 18 | 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | 21 | super.onCreate(savedInstanceState) 22 | binding = ActivityMainBinding.inflate(layoutInflater) 23 | setContentView(binding.root) 24 | init() 25 | } 26 | 27 | /** 28 | * Uses for view setup 29 | */ 30 | private fun init() { 31 | setupCardActions() 32 | setCardItems() 33 | } 34 | 35 | /** 36 | * Uses for set card items list 37 | */ 38 | private fun setCardItems() { 39 | binding.cardStack.setUpCardStack(getItemList(), object : OnPageChangeListener { 40 | override fun onPageScrolled(position: Int) { 41 | 42 | } 43 | 44 | override fun onPageSelected(position: Int) { 45 | 46 | } 47 | 48 | override fun onPageScrollStateChanged(state: Int) { 49 | 50 | } 51 | }) 52 | } 53 | 54 | /** 55 | * Uses for card actions options setup 56 | */ 57 | private fun setupCardActions() { 58 | binding.cardStack.setActionOptions( 59 | firstButtonResourceId = R.drawable.ic_chat_action, 60 | secondButtonResourceId = R.drawable.ic_favorite_action, 61 | object : CardActionListener { 62 | override fun onFirstButtonOptionClick(position: Int) { 63 | 64 | } 65 | 66 | override fun onSecondButtonOptionClick(position: Int) { 67 | 68 | } 69 | } 70 | ) 71 | } 72 | 73 | /** 74 | * Uses for prepare dummy list 75 | */ 76 | private fun getItemList(): ArrayList { 77 | return ArrayList().apply { 78 | add( 79 | CardModel( 80 | primaryTitle = "Marry Martin", 81 | secondaryTitle = "Chicago, USA", 82 | image = "https://i.ibb.co/8Bc6hwX/Rectangle-9.png" 83 | ) 84 | ) 85 | add( 86 | CardModel( 87 | primaryTitle = "Pamela", 88 | secondaryTitle = "Phoenix", 89 | image = "https://cdn.pixabay.com/photo/2017/08/06/15/13/woman-2593366__340.jpg" 90 | ) 91 | ) 92 | add( 93 | CardModel( 94 | primaryTitle = "Massey", 95 | secondaryTitle = "New York", 96 | image = "https://cdn.pixabay.com/photo/2016/03/23/04/01/woman-1274056_960_720.jpg" 97 | ) 98 | ) 99 | add( 100 | CardModel( 101 | primaryTitle = "Yema", 102 | secondaryTitle = "Milano", 103 | image = "https://picsum.photos/id/1011/5472/3648" 104 | ) 105 | ) 106 | add( 107 | CardModel( 108 | primaryTitle = "Wilson", 109 | secondaryTitle = "Chicago", 110 | image = "https://picsum.photos/id/1025/4951/3301" 111 | ) 112 | ) 113 | add( 114 | CardModel( 115 | primaryTitle = "John", 116 | secondaryTitle = "Houston", 117 | image = "https://picsum.photos/id/1012/3973/2639" 118 | ) 119 | ) 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_white_rounded_rect.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chat.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home.xml: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notification.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 16 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/font/roboto_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/font/roboto_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/roboto_medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/font/roboto_medium.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/roboto_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/font/roboto_regular.ttf -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 28 | 29 | 40 | 41 | 49 | 50 | 51 | 73 | 74 | 81 | 82 | 93 | 94 | 105 | 106 | 117 | 118 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #90000000 11 | 12 | #F3F4FC 13 | #ACB3EC 14 | #101C4F 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CircularCardsStackView 3 | Find Your Friend 4 | Hi, Paul Wick 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/test/java/com/mindinventory/circularcardsstackview/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.21" 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.2.2" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | jcenter() // Warning: this repository is going to shut down soon 22 | maven { url 'https://jitpack.io' } 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } -------------------------------------------------------------------------------- /circularcardsstackview/.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 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | .idea 29 | *.iml 30 | 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /circularcardsstackview/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'kotlin-android' 4 | id 'kotlin-kapt' 5 | } 6 | 7 | group='com.mindinventory' 8 | 9 | android { 10 | compileSdkVersion 30 11 | buildToolsVersion "30.0.3" 12 | 13 | defaultConfig { 14 | minSdkVersion 21 15 | targetSdkVersion 30 16 | versionCode 2 17 | versionName "0.0.2" 18 | 19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 20 | consumerProguardFiles "consumer-rules.pro" 21 | } 22 | 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | kotlinOptions { 34 | jvmTarget = '1.8' 35 | } 36 | buildFeatures { 37 | viewBinding true 38 | } 39 | 40 | } 41 | 42 | dependencies { 43 | 44 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 45 | implementation 'androidx.core:core-ktx:1.6.0' 46 | implementation 'androidx.appcompat:appcompat:1.3.1' 47 | implementation 'com.google.android.material:material:1.4.0' 48 | testImplementation 'junit:junit:4.13.2' 49 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 50 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 51 | 52 | //Dimension 53 | implementation 'com.intuit.sdp:sdp-android:1.0.6' 54 | implementation 'com.intuit.ssp:ssp-android:1.0.6' 55 | 56 | //Rounded Imageview 57 | implementation 'com.makeramen:roundedimageview:2.3.0' 58 | 59 | // Glide 60 | implementation 'com.github.bumptech.glide:glide:4.12.0' 61 | kapt 'com.github.bumptech.glide:compiler:4.12.0' 62 | 63 | //Gson 64 | implementation 'com.google.code.gson:gson:2.8.7' 65 | } -------------------------------------------------------------------------------- /circularcardsstackview/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/circularcardsstackview/consumer-rules.pro -------------------------------------------------------------------------------- /circularcardsstackview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /circularcardsstackview/src/androidTest/java/com/mindinventory/circularcardsstackview/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.mindinventory.cardstackview.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/adapter/CardStackAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.adapter 2 | 3 | import android.annotation.SuppressLint 4 | import android.graphics.Color 5 | import android.graphics.Typeface 6 | import android.graphics.drawable.Drawable 7 | import android.graphics.drawable.GradientDrawable 8 | import android.net.Uri 9 | import android.util.Log 10 | import android.util.TypedValue 11 | import android.view.LayoutInflater 12 | import android.view.ViewGroup 13 | import androidx.annotation.ColorInt 14 | import androidx.annotation.Dimension 15 | import androidx.core.view.isVisible 16 | import androidx.recyclerview.widget.RecyclerView 17 | import com.bumptech.glide.Glide 18 | import com.mindinventory.circularcardsstackview.data.CardModel 19 | import com.mindinventory.circularcardsstackview.databinding.ItemCardBinding 20 | import com.mindinventory.circularcardsstackview.listener.CardActionListener 21 | import java.io.File 22 | 23 | 24 | /** 25 | * This class uses for set card list items 26 | * @author MindInventory 27 | */ 28 | class CardStackAdapter( 29 | @ColorInt cardStrokeColor: Int? = null, 30 | @ColorInt cardBackgroundColor: Int? = null, 31 | @ColorInt primaryTextColor: Int? = null, 32 | @ColorInt secondaryTextColor: Int? = null, 33 | @ColorInt profileViewBackgroundColor: Int? = null, 34 | @Dimension cardStrokeWidth: Int? = null, 35 | @Dimension cardCornerRadius: Float? = null, 36 | @Dimension cardChildPadding: Int? = null, 37 | @Dimension primaryTextSize: Int? = null, 38 | @Dimension secondaryTextSize: Int? = null, 39 | @Dimension childViewHeight: Int? = null, 40 | actionOptionsVisibility: Boolean? = null, 41 | primaryTextFontFamily: Typeface? = null, 42 | secondaryTextFontFamily: Typeface? = null 43 | ) : 44 | CircularAdapter() { 45 | 46 | companion object { 47 | const val DEFAULT_CARD_STROKE_WIDTH = 5 48 | const val DEFAULT_CARD_STROKE_COLOR = Color.BLACK 49 | const val DEFAULT_CARD_BACKGROUND_COLOR = Color.WHITE 50 | const val DEFAULT_CARD_CORNER_RADIUS = 50f 51 | const val DEFAULT_CARD_CHILD_PADDING = 10 52 | const val DEFAULT_PROFILE_VIEW_BACKGROUND_COLOR = Color.WHITE 53 | } 54 | 55 | private var cardStrokeColor: Int? = null 56 | private var cardStrokeWidth: Int? = null 57 | private var cardCornerRadius: Float? = null 58 | private var cardBackgroundColor: Int? = null 59 | private var cardChildPadding: Int? = null 60 | private var firstButtonId: Int? = null 61 | private var secondButtonId: Int? = null 62 | private var primaryTextSize: Int? = null 63 | private var secondaryTextSize: Int? = null 64 | private var primaryTextColor: Int? = null 65 | private var secondaryTextColor: Int? = null 66 | private var cardActionListener: CardActionListener? = null 67 | private var primaryTextFontFamily: Typeface? = null 68 | private var secondaryTextFontFamily: Typeface? = null 69 | private var profileViewBackgroundColor: Int? = null 70 | private var childViewHeight: Int? = null 71 | private var actionOptionsVisibility: Boolean? = null 72 | 73 | 74 | init { 75 | this.cardStrokeColor = cardStrokeColor 76 | this.cardStrokeWidth = cardStrokeWidth 77 | this.cardCornerRadius = cardCornerRadius 78 | this.cardBackgroundColor = cardBackgroundColor 79 | this.cardChildPadding = cardChildPadding 80 | this.primaryTextSize = primaryTextSize 81 | this.secondaryTextSize = secondaryTextSize 82 | this.primaryTextColor = primaryTextColor 83 | this.secondaryTextColor = secondaryTextColor 84 | this.primaryTextFontFamily = primaryTextFontFamily 85 | this.secondaryTextFontFamily = secondaryTextFontFamily 86 | this.profileViewBackgroundColor = profileViewBackgroundColor 87 | this.childViewHeight = childViewHeight 88 | this.actionOptionsVisibility = actionOptionsVisibility 89 | } 90 | 91 | override fun createItemViewHolder(parent: ViewGroup, viewType: Int): CardStackViewHolder { 92 | return CardStackViewHolder( 93 | ItemCardBinding.inflate( 94 | LayoutInflater.from(parent.context), 95 | parent, 96 | false 97 | ) 98 | ) 99 | } 100 | 101 | fun setActionOptions( 102 | firstButtonResourceId: Int?, 103 | secondButtonResourceId: Int? 104 | ) { 105 | this.firstButtonId = firstButtonResourceId 106 | this.secondButtonId = secondButtonResourceId 107 | notifyDataSetChanged() 108 | } 109 | 110 | fun setCardStackListener(cardActionListener: CardActionListener) { 111 | this.cardActionListener = cardActionListener 112 | } 113 | 114 | override fun bindItemViewHolder( 115 | holder: RecyclerView.ViewHolder, 116 | item: CardModel, 117 | actualPosition: Int, 118 | position: Int, 119 | ) { 120 | 121 | (holder as CardStackViewHolder).bind(item, position) 122 | } 123 | 124 | inner class CardStackViewHolder(private val itemCardBinding: ItemCardBinding) : 125 | RecyclerView.ViewHolder(itemCardBinding.root) { 126 | 127 | @SuppressLint("ClickableViewAccessibility") 128 | fun bind(cardModel: CardModel, position: Int) { 129 | 130 | itemCardBinding.btnOptionFirst.isVisible = firstButtonId != null 131 | itemCardBinding.btnOptionSecond.isVisible = secondButtonId != null 132 | 133 | firstButtonId?.let { 134 | itemCardBinding.btnOptionFirst.setImageResource(it) 135 | } 136 | 137 | secondButtonId?.let { 138 | itemCardBinding.btnOptionSecond.setImageResource(it) 139 | } 140 | 141 | primaryTextSize?.let { 142 | itemCardBinding.tvPrimary.setTextSize(TypedValue.COMPLEX_UNIT_PX, it.toFloat()) 143 | } 144 | 145 | primaryTextColor?.let { 146 | itemCardBinding.tvPrimary.setTextColor(it) 147 | } 148 | 149 | primaryTextFontFamily?.let { 150 | itemCardBinding.tvPrimary.typeface = it 151 | } 152 | 153 | itemCardBinding.tvPrimary.text = cardModel.primaryTitle 154 | 155 | secondaryTextSize?.let { 156 | itemCardBinding.tvSecondary.setTextSize(TypedValue.COMPLEX_UNIT_PX, it.toFloat()) 157 | } 158 | 159 | secondaryTextColor?.let { 160 | itemCardBinding.tvSecondary.setTextColor(it) 161 | } 162 | 163 | secondaryTextFontFamily?.let { 164 | itemCardBinding.tvSecondary.typeface = it 165 | } 166 | 167 | itemCardBinding.tvSecondary.text = cardModel.secondaryTitle 168 | 169 | (itemCardBinding.clChild.background as GradientDrawable).setStroke( 170 | cardStrokeWidth ?: DEFAULT_CARD_STROKE_WIDTH, 171 | cardStrokeColor ?: DEFAULT_CARD_STROKE_COLOR 172 | ) 173 | 174 | (itemCardBinding.clChild.background as GradientDrawable).cornerRadius = 175 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS 176 | 177 | itemCardBinding.ivProfileImage.cornerRadius = 178 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS 179 | 180 | itemCardBinding.cvMain.radius = cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS 181 | 182 | (itemCardBinding.clChild.background as GradientDrawable).setColor( 183 | cardBackgroundColor ?: DEFAULT_CARD_BACKGROUND_COLOR 184 | ) 185 | 186 | itemCardBinding.clChild.setPadding( 187 | cardChildPadding ?: DEFAULT_CARD_CHILD_PADDING, 188 | cardChildPadding ?: DEFAULT_CARD_CHILD_PADDING, 189 | cardChildPadding ?: DEFAULT_CARD_CHILD_PADDING, 190 | cardChildPadding ?: DEFAULT_CARD_CHILD_PADDING 191 | ) 192 | 193 | val shape = itemCardBinding.flUserInfo.background as GradientDrawable 194 | shape.cornerRadii = floatArrayOf( 195 | 0f, 196 | 0f, 197 | 0f, 198 | 0f, 199 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS, 200 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS, 201 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS, 202 | cardCornerRadius ?: DEFAULT_CARD_CORNER_RADIUS, 203 | ) 204 | shape.setColor(profileViewBackgroundColor ?: DEFAULT_PROFILE_VIEW_BACKGROUND_COLOR) 205 | itemCardBinding.flUserInfo.background = shape 206 | 207 | childViewHeight?.let { 208 | itemCardBinding.ivProfileImage.layoutParams.height = it 209 | itemCardBinding.ivProfileImage.requestLayout() 210 | } 211 | 212 | when (cardModel.image) { 213 | is File -> { 214 | Glide.with(itemCardBinding.root.context) 215 | .load(Uri.fromFile(cardModel.image)) 216 | .into(itemCardBinding.ivProfileImage) 217 | } 218 | is String -> { 219 | Glide.with(itemCardBinding.root.context) 220 | .load(cardModel.image) 221 | .into(itemCardBinding.ivProfileImage) 222 | } 223 | is Drawable -> { 224 | itemCardBinding.ivProfileImage.setImageDrawable(cardModel.image) 225 | } 226 | else -> { 227 | Log.e("CardStack", "Added image options is invalid") 228 | } 229 | } 230 | 231 | actionOptionsVisibility?.let { 232 | itemCardBinding.clActionOptions.isVisible = it 233 | } 234 | 235 | itemCardBinding.btnOptionFirst.tag = position 236 | itemCardBinding.btnOptionSecond.tag = position 237 | 238 | itemCardBinding.btnOptionFirst.setOnClickListener { view -> 239 | cardActionListener?.onFirstButtonOptionClick(view.tag as Int) 240 | } 241 | itemCardBinding.btnOptionSecond.setOnClickListener { 242 | cardActionListener?.onSecondButtonOptionClick(it.tag as Int) 243 | } 244 | } 245 | } 246 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/adapter/CircularAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.adapter 2 | 3 | import android.view.ViewGroup 4 | import androidx.recyclerview.widget.RecyclerView 5 | 6 | /** 7 | * This class uses for set endless list 8 | * @author MindInventory 9 | */ 10 | abstract class CircularAdapter : RecyclerView.Adapter() { 11 | private val items = arrayListOf() 12 | 13 | abstract fun createItemViewHolder( 14 | parent: ViewGroup, 15 | viewType: Int 16 | ): RecyclerView.ViewHolder 17 | 18 | abstract fun bindItemViewHolder( 19 | holder: RecyclerView.ViewHolder, 20 | item: T, 21 | actualPosition: Int, 22 | position: Int 23 | ) 24 | 25 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { 26 | return createItemViewHolder(parent, viewType) 27 | } 28 | 29 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { 30 | val positionInList = position % items.size 31 | bindItemViewHolder(holder, items[positionInList], position, positionInList) 32 | } 33 | 34 | fun getActualItemCount() = items.size 35 | 36 | override fun getItemCount(): Int { 37 | return if (items.size > 1) Int.MAX_VALUE else items.size 38 | } 39 | 40 | fun setItems(items: ArrayList, clearPreviousElements: Boolean = false) { 41 | if (clearPreviousElements) { 42 | this.items.clear() 43 | } 44 | this.items.addAll(items) 45 | notifyDataSetChanged() 46 | } 47 | 48 | fun getItems(): ArrayList { 49 | return this.items 50 | } 51 | 52 | fun clear() { 53 | items.clear() 54 | notifyDataSetChanged() 55 | } 56 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/data/CardModel.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.data 2 | 3 | 4 | import com.google.gson.annotations.SerializedName 5 | 6 | data class CardModel( 7 | @SerializedName("primaryTitle") 8 | val primaryTitle: String = "", 9 | @SerializedName("imageUrl") 10 | val image: Any? = null, 11 | @SerializedName("secondaryTitle") 12 | val secondaryTitle: String = "" 13 | ) -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/listener/CardActionListener.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.listener 2 | 3 | interface CardActionListener { 4 | fun onFirstButtonOptionClick(position: Int) 5 | fun onSecondButtonOptionClick(position: Int) 6 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/listener/OnPageChangeListener.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.listener 2 | 3 | interface OnPageChangeListener { 4 | fun onPageScrolled(position: Int) 5 | 6 | fun onPageSelected(position: Int) 7 | 8 | fun onPageScrollStateChanged(state: Int) 9 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/ui/CircularCardsStackView.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.ui 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.content.res.TypedArray 6 | import android.graphics.Color 7 | import android.graphics.Typeface 8 | import android.os.Build 9 | import android.util.AttributeSet 10 | import android.view.LayoutInflater 11 | import androidx.annotation.DrawableRes 12 | import androidx.constraintlayout.widget.ConstraintLayout 13 | import androidx.core.content.ContextCompat 14 | import androidx.viewpager2.widget.ViewPager2 15 | import com.mindinventory.circularcardsstackview.R 16 | import com.mindinventory.circularcardsstackview.adapter.CardStackAdapter 17 | import com.mindinventory.circularcardsstackview.data.CardModel 18 | import com.mindinventory.circularcardsstackview.databinding.CircularCardsStackViewBinding 19 | import com.mindinventory.circularcardsstackview.listener.CardActionListener 20 | import com.mindinventory.circularcardsstackview.listener.OnPageChangeListener 21 | import com.mindinventory.circularcardsstackview.util.DisplayUtils 22 | import com.mindinventory.circularcardsstackview.util.ScreenSize 23 | import com.mindinventory.circularcardsstackview.util.SliderTransformerHorizontal 24 | import kotlin.math.roundToInt 25 | 26 | /** 27 | * This class uses for set CardCircularStackView properties 28 | * @author MindInventory 29 | */ 30 | class CircularCardsStackView(context: Context, attrs: AttributeSet) : 31 | ConstraintLayout(context, attrs) { 32 | private var binding: CircularCardsStackViewBinding? = null 33 | private var screenSize: ScreenSize? = null 34 | private var cardStackAdapter: CardStackAdapter 35 | private var onPageChangeListener: OnPageChangeListener? = null 36 | private var inflater = 37 | context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater 38 | 39 | init { 40 | binding = CircularCardsStackViewBinding.inflate(inflater, this, true) 41 | initScreenSize() 42 | 43 | val typedArray: TypedArray = 44 | context.obtainStyledAttributes(attrs, R.styleable.CircularCardsStackView) 45 | 46 | var primaryTextFontFamily: Typeface? = null 47 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 48 | primaryTextFontFamily = typedArray.getFont( 49 | R.styleable.CircularCardsStackView_primaryTextFontFamily 50 | ) 51 | } 52 | 53 | var secondaryTextFontFamily: Typeface? = null 54 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 55 | secondaryTextFontFamily = typedArray.getFont( 56 | R.styleable.CircularCardsStackView_secondaryTextFontFamily 57 | ) 58 | } 59 | 60 | cardStackAdapter = CardStackAdapter( 61 | cardStrokeColor = typedArray.getColor( 62 | R.styleable.CircularCardsStackView_stackCardStrokeColor, 63 | ContextCompat.getColor(context, R.color.white) 64 | ), 65 | cardBackgroundColor = typedArray.getColor( 66 | R.styleable.CircularCardsStackView_stackCardBackgroundColor, 67 | ContextCompat.getColor(context, R.color.white) 68 | ), 69 | primaryTextColor = typedArray.getColor( 70 | R.styleable.CircularCardsStackView_primaryTextColor, 71 | Color.WHITE 72 | ), 73 | secondaryTextColor = typedArray.getColor( 74 | R.styleable.CircularCardsStackView_secondaryTextColor, 75 | Color.WHITE 76 | ), 77 | profileViewBackgroundColor = typedArray.getColor( 78 | R.styleable.CircularCardsStackView_profileViewBackgroundColor, 79 | ContextCompat.getColor(context, R.color.white) 80 | ), 81 | cardStrokeWidth = typedArray.getDimension( 82 | R.styleable.CircularCardsStackView_stackCardStrokeWidth, 83 | resources.getDimension(R.dimen._2dp) 84 | ).roundToInt(), 85 | cardCornerRadius = typedArray.getDimension( 86 | R.styleable.CircularCardsStackView_stackCardCornerRadius, 87 | resources.getDimension(R.dimen._20sdp) 88 | ), 89 | cardChildPadding = typedArray.getDimension( 90 | R.styleable.CircularCardsStackView_stackCardChildPadding, 91 | resources.getDimension(R.dimen._15sdp) 92 | ).roundToInt(), 93 | primaryTextSize = typedArray.getDimensionPixelSize( 94 | R.styleable.CircularCardsStackView_primaryTextSize, 95 | resources.getDimension(R.dimen._16ssp).roundToInt() 96 | ), 97 | secondaryTextSize = typedArray.getDimensionPixelSize( 98 | R.styleable.CircularCardsStackView_secondaryTextSize, 99 | resources.getDimension(R.dimen._14ssp).roundToInt() 100 | ), 101 | childViewHeight = typedArray.getDimensionPixelSize( 102 | R.styleable.CircularCardsStackView_childViewHeight, 103 | resources.getDimensionPixelSize(R.dimen._300sdp) 104 | ), 105 | actionOptionsVisibility = typedArray.getBoolean( 106 | R.styleable.CircularCardsStackView_actionOptionsVisibility, 107 | true 108 | ), 109 | primaryTextFontFamily = primaryTextFontFamily, 110 | secondaryTextFontFamily = secondaryTextFontFamily, 111 | ) 112 | 113 | binding?.vpCardStack?.adapter = cardStackAdapter 114 | 115 | typedArray.recycle() 116 | } 117 | 118 | /** 119 | * Uses for get screen size 120 | */ 121 | private fun initScreenSize() { 122 | screenSize = DisplayUtils.getScreenSize(context) 123 | } 124 | 125 | /** 126 | * Uses for set action button 127 | */ 128 | fun setActionOptions( 129 | @DrawableRes firstButtonResourceId: Int?, 130 | @DrawableRes secondButtonResourceId: Int?, 131 | cardActionListener: CardActionListener 132 | ) { 133 | cardStackAdapter.setActionOptions(firstButtonResourceId, secondButtonResourceId) 134 | cardStackAdapter.setCardStackListener(cardActionListener) 135 | } 136 | 137 | /** 138 | * Uses for set card items 139 | */ 140 | fun setUpCardStack(items: ArrayList, onPageChangeListener: OnPageChangeListener) { 141 | this.onPageChangeListener = onPageChangeListener 142 | 143 | cardStackAdapter.setItems(items) 144 | 145 | setPageTransformation(items) 146 | 147 | registerViewPager() 148 | 149 | val number: Int = Int.MAX_VALUE / items.size / 2 150 | binding?.vpCardStack?.setCurrentItem(number * items.size, false) 151 | } 152 | 153 | /** 154 | * Uses for register viewpager for callBack 155 | */ 156 | private fun registerViewPager() { 157 | binding?.vpCardStack?.registerOnPageChangeCallback(object : 158 | ViewPager2.OnPageChangeCallback() { 159 | override fun onPageSelected(position: Int) { 160 | super.onPageSelected(position) 161 | val positionInList = position % (cardStackAdapter.getItems().size) 162 | onPageChangeListener?.onPageSelected(positionInList) 163 | } 164 | 165 | override fun onPageScrollStateChanged(state: Int) { 166 | super.onPageScrollStateChanged(state) 167 | onPageChangeListener?.onPageScrollStateChanged(state) 168 | } 169 | 170 | override fun onPageScrolled( 171 | position: Int, 172 | positionOffset: Float, 173 | positionOffsetPixels: Int 174 | ) { 175 | super.onPageScrolled(position, positionOffset, positionOffsetPixels) 176 | onPageChangeListener?.onPageScrolled(position % (cardStackAdapter.getItems().size)) 177 | } 178 | }) 179 | } 180 | 181 | /** 182 | * Uses for set page transformation 183 | */ 184 | private fun setPageTransformation(items: ArrayList) { 185 | val numberOfCards = items.size 186 | val translationFactor = when (Resources.getSystem().displayMetrics.heightPixels) { 187 | in 500..1000 -> { 188 | 7f 189 | } 190 | in 1000..1500 -> { 191 | 6f 192 | } 193 | in 1500..2000 -> { 194 | 4.0f 195 | } 196 | in 2000..2500 -> { 197 | 3.3f 198 | } 199 | in 2500..3000 -> { 200 | 3.0f 201 | } 202 | else -> { 203 | 3.5f 204 | } 205 | } 206 | if (numberOfCards >= 3) { 207 | binding?.vpCardStack?.offscreenPageLimit = 3 208 | binding?.vpCardStack?.setPageTransformer( 209 | SliderTransformerHorizontal( 210 | 3, 211 | DisplayUtils.dpToPx(translationFactor, context) 212 | ) 213 | ) 214 | } else { 215 | binding?.vpCardStack?.offscreenPageLimit = numberOfCards 216 | binding?.vpCardStack?.setPageTransformer( 217 | SliderTransformerHorizontal( 218 | numberOfCards, 219 | DisplayUtils.dpToPx(translationFactor, context) 220 | ) 221 | ) 222 | } 223 | } 224 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/util/DisplayUtils.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.util 2 | 3 | import android.content.Context 4 | import android.content.res.Configuration 5 | import android.util.TypedValue 6 | 7 | /** 8 | * This class contains display utility functions 9 | * @author MindInventory 10 | */ 11 | object DisplayUtils { 12 | 13 | /** 14 | * Uses for convert DP to Pixel 15 | */ 16 | fun dpToPx(dp: Float, context: Context): Float { 17 | return TypedValue.applyDimension( 18 | TypedValue.COMPLEX_UNIT_DIP, 19 | dp, 20 | context.resources.displayMetrics 21 | ) 22 | } 23 | 24 | /** 25 | * Uses for get screen size 26 | */ 27 | fun getScreenSize(context: Context): ScreenSize { 28 | return when (context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) { 29 | Configuration.SCREENLAYOUT_SIZE_LARGE -> ScreenSize.LARGE 30 | Configuration.SCREENLAYOUT_SIZE_NORMAL -> ScreenSize.NORMAL 31 | else -> throw Exception("Screen size is neither large, normal or small") 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/util/ScreenSize.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.util 2 | 3 | enum class ScreenSize { 4 | LARGE, 5 | NORMAL 6 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/java/com/mindinventory/circularcardsstackview/util/SliderTransformerHorizontal.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview.util 2 | 3 | import android.util.Log 4 | import android.view.View 5 | import androidx.core.view.ViewCompat 6 | import androidx.viewpager2.widget.ViewPager2 7 | import kotlin.math.abs 8 | 9 | /** 10 | * This class uses for set page slide transformation 11 | * @author MindInventory 12 | */ 13 | class SliderTransformerHorizontal( 14 | private val offscreenPageLimit: Int, 15 | private val defaultTranslationFactor: Float 16 | ) : 17 | ViewPager2.PageTransformer { 18 | 19 | companion object { 20 | private const val DEFAULT_TRANSLATION_X = .0f 21 | private const val DEFAULT_TRANSLATION_Y = .0f 22 | private const val DEFAULT_TRANSLATION_FACTOR_X = 1f 23 | 24 | private const val SCALE_FACTOR = .10f 25 | private const val DEFAULT_SCALE = 1f 26 | 27 | private const val ALPHA_FACTOR = .0f 28 | private const val DEFAULT_ALPHA = 1f 29 | 30 | private const val TAG = "SliderTransformer" 31 | } 32 | 33 | override fun transformPage(page: View, position: Float) { 34 | page.apply { 35 | ViewCompat.setElevation(page, -abs(position)) 36 | 37 | val scaleFactor = -SCALE_FACTOR * position + DEFAULT_SCALE 38 | val alphaFactor = -ALPHA_FACTOR * position + DEFAULT_ALPHA 39 | 40 | when { 41 | position <= 0f -> { 42 | translationX = DEFAULT_TRANSLATION_X 43 | translationY = DEFAULT_TRANSLATION_Y 44 | scaleX = DEFAULT_SCALE 45 | scaleY = DEFAULT_SCALE 46 | //Current visible 47 | alpha = DEFAULT_ALPHA + position 48 | Log.d(TAG, "Position => $position TranslationX -> $translationX TranslationY -> $translationY ScaleX -> $scaleX ScaleY -> $scaleY Alpha -> $alpha" ) 49 | } 50 | position <= offscreenPageLimit - 1 -> { 51 | scaleX = scaleFactor 52 | scaleY = scaleFactor 53 | 54 | // To Move Page From it's position to up side(plus side) on Y-Axis 55 | translationY = (width / defaultTranslationFactor) * position 56 | 57 | // To Move Page From it's position to left side(minus side) on X-Axis 58 | translationX = -(width / DEFAULT_TRANSLATION_FACTOR_X) * position 59 | alpha = alphaFactor 60 | } 61 | else -> { 62 | translationX = DEFAULT_TRANSLATION_X 63 | translationY = DEFAULT_TRANSLATION_Y 64 | scaleX = DEFAULT_SCALE 65 | scaleY = DEFAULT_SCALE 66 | alpha = DEFAULT_ALPHA 67 | 68 | Log.d(TAG, "Position else => $position TranslationX -> $translationX TranslationY -> $translationY ScaleX -> $scaleX ScaleY -> $scaleY Alpha -> $alpha") 69 | } 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/bg_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/bg_profile_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/bg_white_rounded_rect.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/girl.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/circularcardsstackview/src/main/res/drawable/girl.webp -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/ic_chat_action.xml: -------------------------------------------------------------------------------- 1 | 6 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/drawable/ic_favorite_action.xml: -------------------------------------------------------------------------------- 1 | 7 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/font/roboto_bold_italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/circularcardsstackview/src/main/res/font/roboto_bold_italic.ttf -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/font/roboto_italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/circularcardsstackview/src/main/res/font/roboto_italic.ttf -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/layout/circular_cards_stack_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 23 | 24 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/layout/item_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | 27 | 28 | 37 | 38 | 47 | 48 | 59 | 60 | 70 | 71 | 72 | 80 | 81 | 95 | 96 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #90000000 11 | 12 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1dp 5 | 2dp 6 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CircularCardsStackView 3 | -------------------------------------------------------------------------------- /circularcardsstackview/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /circularcardsstackview/src/test/java/com/mindinventory/circularcardsstackview/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.mindinventory.circularcardsstackview 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 06 12:57:03 IST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /media/feature.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/media/feature.gif -------------------------------------------------------------------------------- /media/feature_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mindinventory/CircularCardsStackView/315c7d767509bc43dd8d5fe2f93e57e9818b1be2/media/feature_image.jpg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "CardStackView" 2 | include ':app' 3 | include ':circularcardsstackview' 4 | --------------------------------------------------------------------------------