├── .gitignore
├── .idea
├── caches
│ ├── build_file_checksums.ser
│ └── gradle_models.ser
├── codeStyles
│ └── Project.xml
├── compiler.xml
├── deploymentTargetDropDown.xml
├── encodings.xml
├── gradle.xml
├── jarRepositories.xml
├── kotlinc.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── migrations.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── marcoscg
│ │ └── dialogsheetsample
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── marcoscg
│ │ │ └── dialogsheetsample
│ │ │ └── MainActivity.kt
│ └── res
│ │ ├── drawable-hdpi
│ │ └── ic_github.png
│ │ ├── drawable-mdpi
│ │ └── ic_github.png
│ │ ├── drawable-xhdpi
│ │ └── ic_github.png
│ │ ├── drawable-xxhdpi
│ │ └── ic_github.png
│ │ ├── drawable-xxxhdpi
│ │ └── ic_github.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── custom_dialog_view.xml
│ │ ├── menu
│ │ └── main.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
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── marcoscg
│ └── dialogsheetsample
│ └── ExampleUnitTest.kt
├── build.gradle
├── dialogsheet
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── marcoscg
│ │ └── dialogsheet
│ │ ├── CircleImageView.kt
│ │ ├── DialogSheet.kt
│ │ ├── DialogSheet2.kt
│ │ ├── ExpandedBottomSheetDialog.kt
│ │ └── Utils.kt
│ └── res
│ ├── drawable
│ ├── dialog_sheet_main_background.xml
│ ├── dialog_sheet_main_background_margin.xml
│ ├── dialog_sheet_main_background_round.xml
│ └── dialog_sheet_main_background_round_margin.xml
│ ├── layout-land
│ ├── layout_dialog_sheet.xml
│ └── layout_dialog_sheet_v2.xml
│ ├── layout
│ ├── layout_dialog_sheet.xml
│ ├── layout_dialog_sheet_content.xml
│ ├── layout_dialog_sheet_content_v2.xml
│ └── layout_dialog_sheet_v2.xml
│ └── values
│ ├── attrs.xml
│ ├── dimens.xml
│ ├── public.xml
│ ├── strings.xml
│ └── styles.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
├── android-arsenal-screenshot.png
├── sc_1.png
├── sc_2.png
├── sc_3.png
└── sc_4.png
├── settings.gradle
└── web_hi_res_512.png
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marcoscgdev/DialogSheet/0389ec7872816bd0645c5d477d21145695203b04/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marcoscgdev/DialogSheet/0389ec7872816bd0645c5d477d21145695203b04/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | xmlns:android
32 |
33 | ^$
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | xmlns:.*
43 |
44 | ^$
45 |
46 |
47 | BY_NAME
48 |
49 |
50 |
51 |
52 |
53 |
54 | .*:id
55 |
56 | http://schemas.android.com/apk/res/android
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | .*:name
66 |
67 | http://schemas.android.com/apk/res/android
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | name
77 |
78 | ^$
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | style
88 |
89 | ^$
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | .*
99 |
100 | ^$
101 |
102 |
103 | BY_NAME
104 |
105 |
106 |
107 |
108 |
109 |
110 | .*
111 |
112 | http://schemas.android.com/apk/res/android
113 |
114 |
115 | ANDROID_ATTRIBUTE_ORDER
116 |
117 |
118 |
119 |
120 |
121 |
122 | .*
123 |
124 | .*
125 |
126 |
127 | BY_NAME
128 |
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.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 |
35 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.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 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.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 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Marcos Calvo García
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 | # DialogSheet [](https://jitpack.io/#marcoscgdev/DialogSheet)  
2 | An Android library to create fully material designed bottom dialogs similar to the Android Pay app.
3 |
4 | ---
5 |
6 | ## Releases:
7 |
8 | #### Current release: 2.2.0.
9 |
10 | You can see all the library releases [here](https://github.com/marcoscgdev/DialogSheet/releases).
11 |
12 | ---
13 |
14 | ## Screenshots
15 |
16 |
17 |
18 |
19 | Download the sample apk [here](https://github.com/marcoscgdev/DialogSheet/releases/download/2.2.0/app-debug.apk).
20 |
21 | ---
22 |
23 | ## Usage:
24 |
25 | ### Adding the depencency
26 |
27 | Add this to your root *build.gradle* file:
28 |
29 | ```
30 | allprojects {
31 | repositories {
32 | ...
33 | maven { url 'https://jitpack.io' }
34 | }
35 | }
36 | ```
37 |
38 | Or if you are using KTS, add this into your *settings.gradle.kts* file:
39 |
40 | ```
41 | dependencyResolutionManagement {
42 | ...
43 | repositories {
44 | ...
45 | maven {
46 | setUrl("https://jitpack.io")
47 | }
48 | }
49 | }
50 | ```
51 |
52 | Now add the dependency to your app *build.gradle* file:
53 |
54 | ```
55 | implementation 'com.github.marcoscgdev:DialogSheet:2.2.0'
56 | ```
57 |
58 | Or if you are using KTS:
59 |
60 | ```
61 | implementation("com.github.marcoscgdev:DialogSheet:2.2.0")
62 | ```
63 |
64 | ### Creating the dialog
65 |
66 | Here is a complete snippet of it usage:
67 |
68 | ```java
69 | val dialogSheet = DialogSheet(this)
70 | .setTitle(R.string.app_name)
71 | .setMessage(R.string.lorem)
72 | .setColoredNavigationBar(true)
73 | .setTitleTextSize(20) // In SP
74 | .setCancelable(false)
75 | .setPositiveButton(android.R.string.ok) {
76 | // Your action
77 | }
78 | .setNegativeButton(android.R.string.cancel) {
79 | // Your action
80 | }
81 | .setNeutralButton("Neutral")
82 | .setRoundedCorners(false) // Default value is true
83 | .setBackgroundColor(Color.BLACK) // Your custom background color
84 | .setButtonsColorRes(R.color.colorAccent) // You can use dialogSheetAccent style attribute instead
85 | .setNeutralButtonColor(Color.WHITE)
86 | .show()
87 | ```
88 |
89 | ### Creating the dialog using the new style
90 |
91 | Simply use the new _DialogSheet2_ class:
92 |
93 | ```java
94 | val dialogSheet = DialogSheet2(this)
95 | ...
96 | ...
97 | .show()
98 | ```
99 |
100 | Or add a new boolean-type argument to the dialog constructor:
101 |
102 | ```java
103 | val dialogSheet = DialogSheet2(this, true)
104 | ...
105 | ...
106 | .show()
107 | ```
108 |
109 | ### Colorize buttons
110 |
111 | You can do it programmatically
112 |
113 | ```java
114 | .setButtonsColorRes(R.color.colorPrimary)
115 | ```
116 |
117 | ```java
118 | .setPositiveButtonColorRes(R.color.colorPrimary)
119 | .setNegativeButtonColorRes(R.color.colorNegative)
120 | .setNeutralButtonColorRes(R.color.colorNeutral)
121 | ```
122 |
123 | Or by adding this atribute to your main app theme
124 |
125 | ```xml
126 | - @color/colorAccent
127 | ```
128 |
129 | ### Customize corner radius
130 |
131 | Simply override this dimen with your desired size
132 |
133 | ```xml
134 | 16dp
135 | ```
136 |
137 | ### Adding a custom view:
138 |
139 | - Via inflated view:
140 |
141 | ```java
142 | val view = View.inflate(context, R.layout.custom_dialog_view, null)
143 | dialogSheet.setView(view)
144 | ```
145 |
146 | - Via layout resource:
147 |
148 | ```java
149 | dialogSheet.setView(R.layout.custom_dialog_view)
150 |
151 | // Access dialog custom inflated view
152 | val inflatedView = dialogSheet.getInflatedView()
153 | val button = inflatedView.findViewById(R.id.customButton)
154 | ...
155 | ```
156 |
157 | ### Custom resources:
158 |
159 | Override it if you want :P
160 |
161 | ```xml
162 | 16dp
163 | 56dp
164 | 60dp
165 | 15sp
166 | 400dp
167 | ```
168 |
169 | ---
170 | >See the *sample project* to clarify any queries you may have.
171 |
172 | ---
173 |
174 | ## License
175 |
176 | ```
177 | The MIT License (MIT)
178 |
179 | Copyright (c) 2017 Marcos Calvo García
180 |
181 | Permission is hereby granted, free of charge, to any person obtaining a copy
182 | of this software and associated documentation files (the "Software"), to deal
183 | in the Software without restriction, including without limitation the rights
184 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
185 | copies of the Software, and to permit persons to whom the Software is
186 | furnished to do so, subject to the following conditions:
187 |
188 | The above copyright notice and this permission notice shall be included in all
189 | copies or substantial portions of the Software.
190 |
191 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
192 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
193 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
194 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
195 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
196 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
197 | SOFTWARE.
198 | ```
199 |
200 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | defaultConfig {
6 | applicationId "com.marcoscg.dialogsheetsample"
7 | minSdkVersion 14
8 | targetSdkVersion 34
9 | compileSdk 34
10 | versionCode 220
11 | versionName "2.2.0"
12 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
13 | }
14 | buildFeatures.viewBinding = true
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | compileOptions {
22 | sourceCompatibility JavaVersion.VERSION_17
23 | targetCompatibility JavaVersion.VERSION_17
24 | }
25 | kotlinOptions {
26 | jvmTarget = '17'
27 | }
28 | namespace 'com.marcoscg.dialogsheetsample'
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
34 | exclude group: 'com.android.support', module: 'support-annotations'
35 | })
36 | implementation 'androidx.appcompat:appcompat:1.6.1'
37 | implementation 'com.google.android.material:material:1.11.0'
38 | implementation project(':dialogsheet')
39 | testImplementation 'junit:junit:4.13.2'
40 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
41 | }
42 |
--------------------------------------------------------------------------------
/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 C:\Users\marco\AppData\Local\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/marcoscg/dialogsheetsample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.marcoscg.dialogsheetsample
2 |
3 | import android.content.Context
4 | import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
5 | import androidx.test.platform.app.InstrumentationRegistry
6 | import org.junit.Assert
7 | import org.junit.Test
8 | import org.junit.runner.RunWith
9 |
10 | /**
11 | * Instrumentation test, which will execute on an Android device.
12 | *
13 | * @see [Testing documentation](http://d.android.com/tools/testing)
14 | */
15 | @RunWith(AndroidJUnit4ClassRunner::class)
16 | class ExampleInstrumentedTest {
17 | @Test
18 | @Throws(Exception::class)
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext: Context = InstrumentationRegistry.getInstrumentation().targetContext
22 | Assert.assertEquals("com.marcoscg.dialogsheetsample", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/marcoscg/dialogsheetsample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.marcoscg.dialogsheetsample
2 |
3 | import android.content.Intent
4 | import android.net.Uri
5 | import android.os.Bundle
6 | import android.view.Menu
7 | import android.view.MenuItem
8 | import android.widget.Button
9 | import android.widget.Toast
10 | import androidx.appcompat.app.AppCompatActivity
11 | import com.marcoscg.dialogsheet.DialogSheet
12 | import com.marcoscg.dialogsheetsample.databinding.ActivityMainBinding
13 |
14 | class MainActivity : AppCompatActivity() {
15 |
16 | private val binding: ActivityMainBinding by lazy {
17 | ActivityMainBinding.inflate(layoutInflater)
18 | }
19 | override fun onCreate(savedInstanceState: Bundle?) {
20 | super.onCreate(savedInstanceState)
21 | setContentView(binding.root)
22 |
23 | binding.button.setOnClickListener {
24 | createAndShowDialog()
25 | }
26 | }
27 |
28 | private fun createAndShowDialog() {
29 | val useNewDialogStyle = binding.newStyleCheckBox.isChecked
30 |
31 | val dialogSheet = DialogSheet(this@MainActivity, useNewDialogStyle) // you can also use DialogSheet2 if you want the new style
32 | //.setNewDialogStyle() // You can also set new style by this method, but put it on the first line
33 | .setTitle(R.string.app_name)
34 | .setMessage(R.string.lorem)
35 | .setSingleLineTitle(true)
36 | .setColoredNavigationBar(true)
37 | //.setButtonsColorRes(R.color.colorAccent) // You can use dialogSheetAccent style attribute instead
38 | .setPositiveButton(android.R.string.ok) {
39 | Toast.makeText(this@MainActivity, "Positive button clicked!", Toast.LENGTH_SHORT).show()
40 | }
41 | .setNegativeButton(android.R.string.cancel)
42 | .setNeutralButton("Neutral")
43 | //.setNeutralButtonColor(Color.BLACK)
44 |
45 | if (binding.customViewCheckBox.isChecked) {
46 | dialogSheet.setView(R.layout.custom_dialog_view)
47 |
48 | // Access dialog custom inflated view
49 | val inflatedView = dialogSheet.inflatedView
50 | val button = inflatedView?.findViewById