├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── stream │ │ └── customalertapp │ │ └── MainActivity.java │ └── res │ ├── drawable │ └── bg_triangle_color.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-ldpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── customalert ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── stream │ │ └── customalert │ │ ├── CustomAlertDialogue.java │ │ └── ui │ │ ├── CustomBlurDialogue.java │ │ └── RoundedCornersDrawable.java │ └── res │ ├── anim │ ├── fade_in_center.xml │ ├── fade_out_center.xml │ ├── slide_in_bottom.xml │ └── slide_out_bottom.xml │ ├── drawable │ ├── bg_alertview.xml │ ├── bg_alertview_button.xml │ ├── bg_transparent.xml │ └── cursor.xml │ ├── layout-land-v21 │ └── alert.xml │ ├── layout-land │ └── alert.xml │ ├── layout-v21 │ ├── alert.xml │ ├── alert_actionsheet.xml │ └── alert_input.xml │ ├── layout │ ├── alert.xml │ ├── alert_actionsheet.xml │ ├── alert_button.xml │ ├── alert_input.xml │ ├── alert_input_box.xml │ ├── alert_input_line.xml │ ├── alertview_horizontal.xml │ ├── alertview_input.xml │ └── alertview_vertical.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshots ├── Action-Sheet_540x.png ├── Confirmation-Alert_540x.png ├── Custom-Alert-Dialogue-Screenshot.gif ├── Custom-Alertview-Dialogue-Cover_1280x.gif ├── Input-Box_540x.png ├── Selector_500x.png └── Simple-Alert_480x.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | build/* 3 | */app.iml 4 | 5 | # Crashlytics configuations 6 | com_crashlytics_export_strings.xml 7 | 8 | # Local configuration file (sdk path, etc) 9 | local.properties 10 | 11 | # Gradle generated files 12 | .gradle/ 13 | 14 | # Signing files 15 | .signing/ 16 | 17 | # User-specific configurations 18 | .idea/* 19 | .idea/libraries/ 20 | .idea/workspace.xml 21 | .idea/tasks.xml 22 | .idea/.name 23 | .idea/compiler.xml 24 | .idea/copyright/profiles_settings.xml 25 | .idea/encodings.xml 26 | .idea/misc.xml 27 | .idea/modules.xml 28 | .idea/scopes/scope_settings.xml 29 | .idea/vcs.xml 30 | *.iml 31 | 32 | # OS-specific files 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD Zero Clause License 2 | 3 | Copyright © 2020 Ray Li 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Screenshots](screenshots/Custom-Alertview-Dialogue-Cover_1280x.gif) 2 | 3 | # Custom AlertView Dialogue 4 | 5 | [![GitHub release](https://img.shields.io/github/release/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue/releases) [![GitHub Release Date](https://img.shields.io/github/release-date/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) [![Libraries.io for GitHub](https://img.shields.io/librariesio/github/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) [![GitHub issues](https://img.shields.io/github/issues/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) [![API](https://img.shields.io/badge/API-15%2B-blue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) [![GitHub top language](https://img.shields.io/github/languages/top/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue) 6 | 7 | 8 | 9 | > ### The most advanced Android dialogue library. 10 | 11 | Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms. This library fixes many issues and crashes that plague other alert dialogue libraries and looks amazing while doing so! 12 | 13 | Custom AlertView Dialogue is part of the [Custom UI](http://rayliverified.com/index.php/code/) collection of beautiful, minimalistic, and customizable Android UI components. 14 | 15 | ![Screenshots](screenshots/Custom-Alert-Dialogue-Screenshot.gif) 16 | 17 | ## About 18 | 19 | Android alert dialogues are bland, limited in functionality, and visually inconsistent across Android versions. Existing Android dialogue libraries often crashed and were hard to customize. CustomAlertDialogue was created to offer a beautiful alert dialogue with advanced capabilities. Here at Codelessly, we're building a Flutter website/app builder, development tools, and UI templates to increase productivity. If that sounds interesting, you'll want to subscribe to updates below 😎 20 | 21 | CustomAlertViewDialogue is licensed under Zero-Clause BSD and released as Emailware. If you like this project or it helped you, please subscribe to updates. Although it is not required, you might miss the goodies we share! 22 | 23 | 24 | 25 | # Import 26 | 27 | [![GitHub release](https://img.shields.io/github/release/searchy2/CustomAlertViewDialogue.svg?style=flat-square)](https://github.com/searchy2/CustomAlertViewDialogue/releases) 28 | 29 | Add this library to `build.gradle`. 30 | 31 | ```java 32 | repositories { 33 | maven { url 'https://jitpack.io' } 34 | } 35 | implementation 'com.github.searchy2:CustomAlertViewDialogue:latest-version' 36 | ``` 37 | # Usage 38 | 39 | Custom AlertView Dialogue uses the Builder format to initialize an alert view programmatically. To display an simple alert message, just drag and drop the following code into your project. It's that easy! 40 | 41 | ![Screenshots](screenshots/Simple-Alert_480x.png) 42 | 43 | ```java 44 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 45 | .setStyle(CustomAlertDialogue.Style.DIALOGUE) 46 | .setTitle("Custom Alert") 47 | .setMessage("This is a long description to test the dialogue's text wrapping functionality") 48 | .setNegativeText("OK") 49 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 50 | @Override 51 | public void OnClick(View view, Dialog dialog) { 52 | dialog.dismiss(); 53 | } 54 | }) 55 | .setDecorView(getWindow().getDecorView()) 56 | .build(); 57 | alert.show(); 58 | ``` 59 | **IMPORTANT:** The Dialog Fragment is extremely picky about the `Activity` passed into the builder. If the improper Activity is passed, the dialogue will crash! Here's how to pass the proper Activity in the following cases: 60 | * Activity - construct with `ClassName.this` 61 | * Fragment - construct with `getActivity()` 62 | * ViewHolder - construct with `getActivity().getApplicationContext()` 63 | 64 | Do not attempt to construct the dialogue with `getContext()`. The Builder requires an Activity and passing a Context does not work! 65 | 66 | **Hint:** Passing the DecorView to the Dialogue Builder in setDecorView will create a nice blurred background. Here's how to pass the correct DecorView: 67 | * Activity - use `getWindow().getDecorView()` 68 | * Fragment - use `getActivity().getWindow().getDecorView()` 69 | * Viewholder - use `((Activity) mContext).getWindow().getDecorView()` 70 | 71 | # Examples 72 | 73 | Custom AlertView Dialogue provides many customization methods to display the alerts you need. 74 | 75 | **Simple Alert - a simple popup message.** 76 | 77 | ![Screenshots](screenshots/Simple-Alert_480x.png) 78 | 79 | ```java 80 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 81 | .setStyle(CustomAlertDialogue.Style.DIALOGUE) 82 | .setTitle("Custom Alert") 83 | .setMessage("This is a long description to test the dialogue's text wrapping functionality") 84 | .setNegativeText("OK") 85 | .setNegativeColor(R.color.negative) 86 | .setNegativeTypeface(Typeface.DEFAULT_BOLD) 87 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 88 | @Override 89 | public void OnClick(View view, Dialog dialog) { 90 | dialog.dismiss(); 91 | } 92 | }) 93 | .setDecorView(getWindow().getDecorView()) 94 | .build(); 95 | alert.show(); 96 | 97 | ``` 98 | 99 | **Confirmation Alert - a popup dialogue with two customizable choices.** 100 | 101 | ![Screenshots](screenshots/Confirmation-Alert_540x.png) 102 | 103 | ```java 104 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 105 | .setStyle(CustomAlertDialogue.Style.DIALOGUE) 106 | .setCancelable(false) 107 | .setTitle("Delete Items") 108 | .setMessage("Delete all completed items?") 109 | .setPositiveText("Confirm") 110 | .setPositiveColor(R.color.negative) 111 | .setPositiveTypeface(Typeface.DEFAULT_BOLD) 112 | .setOnPositiveClicked(new CustomAlertDialogue.OnPositiveClicked() { 113 | @Override 114 | public void OnClick(View view, Dialog dialog) { 115 | dialog.dismiss(); 116 | Toast.makeText(mContext, "Items Deleted", Toast.LENGTH_SHORT).show(); 117 | } 118 | }) 119 | .setNegativeText("Cancel") 120 | .setNegativeColor(R.color.positive) 121 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 122 | @Override 123 | public void OnClick(View view, Dialog dialog) { 124 | dialog.dismiss(); 125 | } 126 | }) 127 | .setDecorView(getWindow().getDecorView()) 128 | .build(); 129 | alert.show(); 130 | ``` 131 | 132 | **Selector - a scrollable list of options.** 133 | 134 | ![Screenshots](screenshots/Selector_500x.png) 135 | 136 | ```java 137 | ArrayList destructive = new ArrayList<>(); 138 | destructive.add("Choice 1"); 139 | 140 | ArrayList other = new ArrayList<>(); 141 | other.add("Choice 2"); 142 | other.add("Choice 3"); 143 | other.add("Choice 4"); 144 | other.add("Choice 5"); 145 | other.add("Choice 6"); 146 | other.add("Choice 7"); 147 | other.add("Choice 8"); 148 | other.add("Choice 9"); 149 | other.add("Choice 10"); 150 | other.add("Choice 11"); 151 | other.add("Choice 12"); 152 | other.add("Choice 13"); 153 | other.add("Choice 14"); 154 | other.add("Choice 15"); 155 | other.add("Choice 16"); 156 | other.add("Choice 17"); 157 | other.add("Choice 18"); 158 | other.add("Choice 19"); 159 | other.add("Choice 20"); 160 | 161 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 162 | .setStyle(CustomAlertDialogue.Style.SELECTOR) 163 | .setDestructive(destructive) 164 | .setOthers(other) 165 | .setOnItemClickListener(new AdapterView.OnItemClickListener() { 166 | @Override 167 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 168 | CustomAlertDialogue.getInstance().dismiss(); 169 | Toast.makeText(mContext, "Selected " + i, Toast.LENGTH_SHORT).show(); 170 | } 171 | }) 172 | .setDecorView(getWindow().getDecorView()) 173 | .build(); 174 | alert.show(); 175 | ``` 176 | 177 | **Action Sheet - a highly customizable bottom menu.** 178 | 179 | ![Screenshots](screenshots/Action-Sheet_540x.png) 180 | 181 | ```java 182 | ArrayList other = new ArrayList(); 183 | other.add("Copy"); 184 | other.add("Forward"); 185 | 186 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 187 | .setStyle(CustomAlertDialogue.Style.ACTIONSHEET) 188 | .setTitle("Action Sheet") 189 | .setTitleColor(R.color.text_default) 190 | .setCancelText("More...") 191 | .setOnCancelClicked(new CustomAlertDialogue.OnCancelClicked() { 192 | @Override 193 | public void OnClick(View view, Dialog dialog) { 194 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 195 | vibe.vibrate(10); 196 | dialog.dismiss(); 197 | Handler handler = new Handler(); 198 | Runnable r = new Runnable() { 199 | public void run() { 200 | MoreSelector(); 201 | } 202 | }; 203 | handler.postDelayed(r, 50); 204 | } 205 | }) 206 | .setOthers(other) 207 | .setOnItemClickListener(new AdapterView.OnItemClickListener() { 208 | @Override 209 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 210 | String selection = adapterView.getItemAtPosition(i).toString(); 211 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 212 | vibe.vibrate(10); 213 | switch (selection) 214 | { 215 | case "Copy": 216 | CustomAlertDialogue.getInstance().dismiss(); 217 | Toast.makeText(mContext, "Copied", Toast.LENGTH_SHORT).show(); 218 | break; 219 | case "Forward": 220 | CustomAlertDialogue.getInstance().dismiss(); 221 | Toast.makeText(mContext, "Forwarded", Toast.LENGTH_SHORT).show(); 222 | break; 223 | } 224 | } 225 | }) 226 | .setDecorView(getWindow().getDecorView()) 227 | .build(); 228 | alert.show(); 229 | ``` 230 | 231 | **Input Box - helps collect user input. Can be used as a contact/feedback form.** 232 | 233 | ![Screenshots](screenshots/Input-Box_540x.png) 234 | 235 | ```java 236 | ArrayList lineHint = new ArrayList<>(); 237 | lineHint.add("Username"); 238 | lineHint.add("Email Address"); 239 | lineHint.add("Name"); 240 | lineHint.add("Zip Code"); 241 | 242 | ArrayList lineText = new ArrayList<>(); 243 | lineText.add("sampleuser"); 244 | lineText.add(null); 245 | lineText.add("Sample User"); 246 | 247 | ArrayList boxHint = new ArrayList<>(); 248 | boxHint.add("Message"); 249 | 250 | ArrayList boxText = new ArrayList<>(); 251 | boxText.add("BoxText"); 252 | 253 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 254 | .setStyle(CustomAlertDialogue.Style.INPUT) 255 | .setTitle("Submit Feedback") 256 | .setMessage("We love to hear feedback! Please share your thoughts and comments:") 257 | .setPositiveText("Submit") 258 | .setPositiveColor(R.color.positive) 259 | .setPositiveTypeface(Typeface.DEFAULT_BOLD) 260 | .setOnInputClicked(new CustomAlertDialogue.OnInputClicked() { 261 | @Override 262 | public void OnClick(View view, Dialog dialog, ArrayList inputList) { 263 | Toast.makeText(mContext, "Sent", Toast.LENGTH_SHORT).show(); 264 | for (String input : inputList) 265 | { 266 | Log.d("Input", input); 267 | } 268 | dialog.dismiss(); 269 | } 270 | }) 271 | .setNegativeText("Cancel") 272 | .setNegativeColor(R.color.negative) 273 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 274 | @Override 275 | public void OnClick(View view, Dialog dialog) { 276 | dialog.dismiss(); 277 | } 278 | }) 279 | .setLineInputHint(lineHint) 280 | .setLineInputText(lineText) 281 | .setBoxInputHint(boxHint) 282 | .setBoxInputText(boxText) 283 | .setDecorView(getWindow().getDecorView()) 284 | .build(); 285 | alert.show(); 286 | ``` 287 | 288 | # Customization 289 | 290 | ### Override Fullscreen 291 | 292 | By default, showing an alert dialogue enters fullscreen mode. This behavior can be disabled by overriding the dialogue's style. 293 | Place the following code in your project's `style.xml` to override the dialogue's style and disable fullscreen mode. 294 | 295 | ``` 296 | 297 | 307 | ``` 308 | 309 | ### Builder Attributes 310 | 311 | |Attribute|Description| 312 | |--|--| 313 | |setStyle(Style style)|Set AlertView type
`DIALOGUE`
`ACTIONSHEET`
`SELECTOR`
`INPUT`| 314 | |setTitle(String title)|set AlertView title text| 315 | |setMessage(String message)|setMessage(String message)| 316 | |setPositiveText(String positiveButtonText)|set Confirmation Alert right button text| 317 | |set Confirmation Alert right button text|set Confirmation Alert right button text| 318 | |set Confirmation Alert right button text|set Action Sheet cancel button text| 319 | |setTitleColor(int titleColor)|set title text color| 320 | |setMessageColor(int messageColor)|set message text color| 321 | |setPositiveColor(int positiveTextColor)|set positive button text color| 322 | |setNegativeColor(int negativeColor)|set negative button text color| 323 | |setCancelColor(int cancelColor)|set cancel button text color| 324 | |set cancel button text color|set title text font. Must pass the path to the font in the assets folder| 325 | |setMessageFont(String bodyFontPath)|set message text font. Must pass the path to the font in the assets folder| 326 | |setPositiveTypeface(Typeface positiveTypeface)|set positive button text typeface| 327 | |set positive button text typeface|set positive button text typeface| 328 | |setOnPositiveClicked(OnPositiveClicked onPositiveClicked)|pass a listener to be called when the positive button is clicked| 329 | |setOnNegativeClicked(OnNegativeClicked onNegativeClicked)|pass a listener to be called when the negative button is clicked| 330 | |setOnCancelClicked(OnCancelClicked onCancelClicked)|pass a listener to be called when the cancel button is clicked| 331 | |setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener)|pass a listener to be called when a selection item is clicked| 332 | |setOnInputClicked(OnInputClicked onInputClicked)|pass a listener to be called when an input box is submitted| 333 | |setDestructive(ArrayList destructive)|converts a String ArrayList into destructive options in the selector| 334 | |setOthers(ArrayList others)|converts a String ArrayList into neutral options in the selector| 335 | |setLineInputText(ArrayList lineInputText)|converts a String ArrayList into single line text input boxes| 336 | |setLineInputHint(ArrayList lineInputHint)|converts a String ArrayList into single line input boxes hints. Array length must match LineInputText length.| 337 | |setBoxInputText(ArrayList boxInputText)|setBoxInputText(ArrayList boxInputText)| 338 | |setBoxInputText(ArrayList boxInputText)|converts a String ArrayList into multiline input boxes hints. Array length must match BoxInputText length| 339 | |setAutoHide(boolean autoHide)|set `true` to automatically hide alert after a set time| 340 | |setTimeToHide(int timeToHide)|set time in milliseconds for popup to automatically dismiss. No listeners are triggered when dismissed automatically.| 341 | |setCancelable(boolean cancelable)|set false to prevent dialogue dismissal through tapping outside or pressing the back button. Force the user to choose an option.| 342 | |setDecorView(View decorView)|pass the Window DecorView for a nice blurred background. Defaults to overlay color.| 343 | |build()|construct the Dialogue Builder| 344 | |show()|display the Dialogue with Builder parameters| 345 | 346 | View the Layouts section or the sample app for examples of how to use these Builder attributes. 347 | 348 | ### New Layout Creation 349 | 350 | Custom AlertView Dialogue provides a powerful framework to creating new alert layouts quickly. If one of the existing alerts do not meet your needs, creating a new alert is very simple! You can take advantage of the existing dialogue code and just declare a new style in the Style enumerator. 351 | 352 | Once you have a new style, you can duplicate an existing layout or start from scratch. Dialog Fragment behaves much like a regular fragment with support for RecyclerViews and Relative Layouts. Most existing layout and code can be dragged and dropped into a Dialog Fragment. **Note:** ViewPagers cannot be placed in a Dialog Fragment because Dialog Fragments do not support ViewPagers (an entire day's work was lost due to this unfortunate limitation :P). 353 | 354 | With your new layout, all that is left is adding the corresponding code and listener callbacks. Most code works well within a Dialog Fragment just like layouts do. If you wish to pass back information, follow the existing examples to create your own onClickListener callback. 355 | 356 | Create the necessary Builder methods to customize your new layout and you're done! 357 | 358 | # Features Wishlist 359 | 360 | These features would make this library even more awesome. You can contribute to this library by developing any of the features below. Or, if you really want to see a feature developed, you can sponsor me to develop the feature. 361 | 362 | --- 363 | 364 | >Dynamic Blur Background ✔️ (Completed 2/22/2018) 365 | 366 | Thanks to [@Dimezis](https://github.com/Dimezis) for fixing his [BlurView](https://github.com/Dimezis/BlurView) library to work with DialogFragments. Without Dimezis's help, there would be no blurred background! 367 | 368 | >Date Selector 369 | 370 | There are a lot of ugly date selectors. Then their are a lot of beautiful date selectors that don't calculate dates correctly or require a time to be selected as well. A beautiful, dedicated date selector with correct date calculation would be wonderful! 371 | 372 | >Slider Value Picker 373 | 374 | The easiest way to choose a number is with a slider. Having a slider integrated into this library would help cover many number entry scenarios. 375 | 376 | >Number Setter 377 | 378 | This is a more precise way to select small numbers or numbers that do not change much. The number setter would have a text box in the middle that accepts direct number input and buttons on either side to increment or decrease the number. 379 | 380 | --- 381 | 382 | Pull requests are most welcome! 383 | 384 | If you've fixed a bug or have a feature you've added, just create a pull request. If you've found a bug, file an issue. If you have any questions or would like to discuss upcoming features, please get in touch. You can get in touch with me in the Contact section below. 385 | 386 | # ★ Acknowledgements ★ 387 | **♥ Developer ♥** 388 | 389 | [Ray Li](https://rayliverified.com) 390 | 391 | **♥ Designer ♥** 392 | 393 | [Ray Li](https://rayliverified.com) 394 | 395 | **♥ Inspiration ♥** 396 | 397 | UI design and functionality - https://github.com/saiwu-bigkoo/Android-AlertView 398 | 399 | Dialog Fragment code - https://github.com/geniusforapp/fancyDialog 400 | 401 | **♥ Sponsor ♥** 402 | 403 | [Codelessly - Flutter Website and App Builder](https://codelessly.com/?utm_medium=link&utm_campaign=direct) 404 | 405 | # ★ Get in Touch ★ 406 | 407 | Ray Li Email 409 | 410 | 411 | Ray Li Website 413 | 414 | 415 | Ray Li Twitter 417 | 418 | 419 | Ray Li LinkedIn 421 | 422 | 423 | Ray Li UpLabs 425 | 426 | 427 | Ray Li GitHub 429 | 430 | 431 | # Apps Using This Library 432 | 433 | Add your app here by making a `pull request`. 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 |
Rocket Notes
Crowdfunding Community
Blank Icon
449 | 450 | ## Search Terms 451 | android, alert, alertview, popup, dialog, dialogs, select, selector, confirmation, bottom menu, action sheet, chooser, choice, options, display, input, box, message, contact, feedback, form, modal 452 | 453 | ## License 454 | 455 | BSD Zero Clause License 456 | 457 | Copyright © 2020 Ray Li 458 | 459 | Permission to use, copy, modify, and/or distribute this software for any 460 | purpose with or without fee is hereby granted. 461 | 462 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 463 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 464 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 465 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 466 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 467 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 468 | PERFORMANCE OF THIS SOFTWARE. 469 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | build/* 3 | */app.iml 4 | 5 | # Crashlytics configuations 6 | com_crashlytics_export_strings.xml 7 | 8 | # Local configuration file (sdk path, etc) 9 | local.properties 10 | 11 | # Gradle generated files 12 | .gradle/ 13 | 14 | # Signing files 15 | .signing/ 16 | 17 | # User-specific configurations 18 | .idea/* 19 | .idea/libraries/ 20 | .idea/workspace.xml 21 | .idea/tasks.xml 22 | .idea/.name 23 | .idea/compiler.xml 24 | .idea/copyright/profiles_settings.xml 25 | .idea/encodings.xml 26 | .idea/misc.xml 27 | .idea/modules.xml 28 | .idea/scopes/scope_settings.xml 29 | .idea/vcs.xml 30 | *.iml 31 | 32 | # OS-specific files 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "stream.customalertsample" 7 | minSdkVersion 15 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | vectorDrawables.useSupportLibrary true 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | repositories { 23 | maven { url 'https://jitpack.io' } 24 | maven { url "https://maven.google.com" } 25 | } 26 | implementation fileTree(include: ['*.jar'], dir: 'libs') 27 | implementation project(':customalert') 28 | implementation 'com.github.searchy2:CustomButton:1.9.1' 29 | 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | implementation 'com.google.android.material:material:1.1.0' 32 | implementation 'androidx.cardview:cardview:1.0.0' 33 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/ahmadnajar/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/stream/customalertapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package stream.customalertapp; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.graphics.Typeface; 6 | import android.os.Build; 7 | import android.os.Bundle; 8 | import android.os.Handler; 9 | import android.os.Vibrator; 10 | import android.util.Log; 11 | import android.view.View; 12 | import android.view.Window; 13 | import android.widget.AdapterView; 14 | import android.widget.ImageView; 15 | import android.widget.Toast; 16 | 17 | import androidx.appcompat.app.AppCompatActivity; 18 | import androidx.cardview.widget.CardView; 19 | 20 | import java.util.ArrayList; 21 | 22 | import stream.customalert.CustomAlertDialogue; 23 | import stream.custombutton.CustomButton; 24 | 25 | public class MainActivity extends AppCompatActivity{ 26 | 27 | ImageView mBackground; 28 | CardView mCardView; 29 | 30 | private Context mContext; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | requestWindowFeature(Window.FEATURE_NO_TITLE); 35 | super.onCreate(savedInstanceState); 36 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 37 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 38 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 39 | | View.SYSTEM_UI_FLAG_FULLSCREEN 40 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); 41 | } 42 | setContentView(R.layout.activity_main); 43 | mContext = getApplicationContext(); 44 | 45 | mBackground = findViewById(R.id.background); 46 | mCardView = findViewById(R.id.cardview); 47 | 48 | //Simple Alert - a simple popup message. 49 | CustomButton btn1 = findViewById(R.id.btn1); 50 | btn1.setOnClickListener(new View.OnClickListener() { 51 | @Override 52 | public void onClick(View view) { 53 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 54 | .setStyle(CustomAlertDialogue.Style.DIALOGUE) 55 | .setTitle("Custom Alert") 56 | .setMessage("This is a long description to test the dialogue's text wrapping functionality") 57 | .setNegativeText("OK") 58 | .setNegativeColor(R.color.negative) 59 | .setNegativeTypeface(Typeface.DEFAULT_BOLD) 60 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 61 | @Override 62 | public void OnClick(View view, Dialog dialog) { 63 | dialog.dismiss(); 64 | } 65 | }) 66 | .setDecorView(getWindow().getDecorView()) 67 | .build(); 68 | alert.show(); 69 | } 70 | }); 71 | 72 | //Confirmation Alert - a popup dialogue with two customizable choices. 73 | CustomButton btn2 = findViewById(R.id.btn2); 74 | btn2.setOnClickListener(new View.OnClickListener() { 75 | @Override 76 | public void onClick(View view) { 77 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 78 | .setStyle(CustomAlertDialogue.Style.DIALOGUE) 79 | .setCancelable(false) 80 | .setTitle("Delete Items") 81 | .setMessage("Delete all completed items?") 82 | .setPositiveText("Confirm") 83 | .setPositiveColor(R.color.negative) 84 | .setPositiveTypeface(Typeface.DEFAULT_BOLD) 85 | .setOnPositiveClicked(new CustomAlertDialogue.OnPositiveClicked() { 86 | @Override 87 | public void OnClick(View view, Dialog dialog) { 88 | dialog.dismiss(); 89 | Toast.makeText(mContext, "Items Deleted", Toast.LENGTH_SHORT).show(); 90 | } 91 | }) 92 | .setNegativeText("Cancel") 93 | .setNegativeColor(R.color.positive) 94 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 95 | @Override 96 | public void OnClick(View view, Dialog dialog) { 97 | dialog.dismiss(); 98 | } 99 | }) 100 | .setDecorView(getWindow().getDecorView()) 101 | .build(); 102 | alert.show(); 103 | } 104 | }); 105 | 106 | //Selector - a scrollable list of options. 107 | CustomButton btn3 = findViewById(R.id.btn3); 108 | btn3.setOnClickListener(new View.OnClickListener() { 109 | @Override 110 | public void onClick(View view) { 111 | ArrayList destructive = new ArrayList<>(); 112 | destructive.add("Choice 1"); 113 | 114 | ArrayList other = new ArrayList<>(); 115 | other.add("Choice 2"); 116 | other.add("Choice 3"); 117 | other.add("Choice 4"); 118 | other.add("Choice 5"); 119 | other.add("Choice 6"); 120 | other.add("Choice 7"); 121 | other.add("Choice 8"); 122 | other.add("Choice 9"); 123 | other.add("Choice 10"); 124 | other.add("Choice 11"); 125 | other.add("Choice 12"); 126 | other.add("Choice 13"); 127 | other.add("Choice 14"); 128 | other.add("Choice 15"); 129 | other.add("Choice 16"); 130 | other.add("Choice 17"); 131 | other.add("Choice 18"); 132 | other.add("Choice 19"); 133 | other.add("Choice 20"); 134 | 135 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 136 | .setStyle(CustomAlertDialogue.Style.SELECTOR) 137 | .setDestructive(destructive) 138 | .setOthers(other) 139 | .setOnItemClickListener(new AdapterView.OnItemClickListener() { 140 | @Override 141 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 142 | CustomAlertDialogue.getInstance().dismiss(); 143 | Toast.makeText(mContext, "Selected " + i, Toast.LENGTH_SHORT).show(); 144 | } 145 | }) 146 | .setDecorView(getWindow().getDecorView()) 147 | .build(); 148 | alert.show(); 149 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 150 | vibe.vibrate(30); 151 | } 152 | }); 153 | 154 | //Action Sheet - a highly customizable bottom menu. 155 | CustomButton btn4 = findViewById(R.id.btn4); 156 | btn4.setOnClickListener(new View.OnClickListener() { 157 | @Override 158 | public void onClick(View view) { 159 | ArrayList other = new ArrayList<>(); 160 | other.add("Copy"); 161 | other.add("Forward"); 162 | 163 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 164 | .setStyle(CustomAlertDialogue.Style.ACTIONSHEET) 165 | .setTitle("Action Sheet") 166 | .setTitleColor(R.color.text_default) 167 | .setCancelText("More...") 168 | .setOnCancelClicked(new CustomAlertDialogue.OnCancelClicked() { 169 | @Override 170 | public void OnClick(View view, Dialog dialog) { 171 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 172 | vibe.vibrate(10); 173 | dialog.dismiss(); 174 | Handler handler = new Handler(); 175 | Runnable r = new Runnable() { 176 | public void run() { 177 | MoreSelector(); 178 | } 179 | }; 180 | handler.postDelayed(r, 50); 181 | } 182 | }) 183 | .setOthers(other) 184 | .setOnItemClickListener(new AdapterView.OnItemClickListener() { 185 | @Override 186 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 187 | String selection = adapterView.getItemAtPosition(i).toString(); 188 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 189 | vibe.vibrate(10); 190 | switch (selection) 191 | { 192 | case "Copy": 193 | CustomAlertDialogue.getInstance().dismiss(); 194 | Toast.makeText(mContext, "Copied", Toast.LENGTH_SHORT).show(); 195 | break; 196 | case "Forward": 197 | CustomAlertDialogue.getInstance().dismiss(); 198 | Toast.makeText(mContext, "Forwarded", Toast.LENGTH_SHORT).show(); 199 | break; 200 | } 201 | } 202 | }) 203 | .setDecorView(getWindow().getDecorView()) 204 | .build(); 205 | alert.show(); 206 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 207 | vibe.vibrate(30); 208 | } 209 | }); 210 | 211 | //Input Box - helps collect user input. Can be used as a contact/feedback form. 212 | CustomButton btn5 = findViewById(R.id.btn5); 213 | btn5.setOnClickListener(new View.OnClickListener() { 214 | @Override 215 | public void onClick(View view) { 216 | 217 | ArrayList lineHint = new ArrayList<>(); 218 | lineHint.add("Username"); 219 | lineHint.add("Email Address"); 220 | lineHint.add("Name"); 221 | lineHint.add("Zip Code"); 222 | 223 | ArrayList lineText = new ArrayList<>(); 224 | lineText.add("sampleuser"); 225 | lineText.add(null); 226 | lineText.add("Sample User"); 227 | 228 | ArrayList boxHint = new ArrayList<>(); 229 | boxHint.add("Message"); 230 | 231 | ArrayList boxText = new ArrayList<>(); 232 | boxText.add("BoxText"); 233 | 234 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 235 | .setStyle(CustomAlertDialogue.Style.INPUT) 236 | .setTitle("Submit Feedback") 237 | .setMessage("We love to hear feedback! Please share your thoughts and comments:") 238 | .setPositiveText("Submit") 239 | .setPositiveColor(R.color.positive) 240 | .setPositiveTypeface(Typeface.DEFAULT_BOLD) 241 | .setOnInputClicked(new CustomAlertDialogue.OnInputClicked() { 242 | @Override 243 | public void OnClick(View view, Dialog dialog, ArrayList inputList) { 244 | Toast.makeText(mContext, "Sent", Toast.LENGTH_SHORT).show(); 245 | for (String input : inputList) 246 | { 247 | Log.d("Input", input); 248 | } 249 | dialog.dismiss(); 250 | } 251 | }) 252 | .setNegativeText("Cancel") 253 | .setNegativeColor(R.color.negative) 254 | .setOnNegativeClicked(new CustomAlertDialogue.OnNegativeClicked() { 255 | @Override 256 | public void OnClick(View view, Dialog dialog) { 257 | dialog.dismiss(); 258 | } 259 | }) 260 | .setLineInputHint(lineHint) 261 | .setLineInputText(lineText) 262 | .setBoxInputHint(boxHint) 263 | .setBoxInputText(boxText) 264 | .setDecorView(getWindow().getDecorView()) 265 | .build(); 266 | alert.show(); 267 | } 268 | }); 269 | } 270 | 271 | public void MoreSelector() 272 | { 273 | ArrayList destructive = new ArrayList<>(); 274 | destructive.add("Delete"); 275 | ArrayList other = new ArrayList<>(); 276 | other.add("Details"); 277 | 278 | CustomAlertDialogue.Builder alert = new CustomAlertDialogue.Builder(MainActivity.this) 279 | .setStyle(CustomAlertDialogue.Style.SELECTOR) 280 | .setDestructive(destructive) 281 | .setOthers(other) 282 | .setOnItemClickListener(new AdapterView.OnItemClickListener() { 283 | @Override 284 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 285 | String selection = adapterView.getItemAtPosition(i).toString(); 286 | Vibrator vibe = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE); 287 | vibe.vibrate(10); 288 | switch (selection) 289 | { 290 | case "Delete": 291 | CustomAlertDialogue.getInstance().dismiss(); 292 | Toast.makeText(mContext, "Deleted", Toast.LENGTH_SHORT).show(); 293 | break; 294 | case "Details": 295 | CustomAlertDialogue.getInstance().dismiss(); 296 | Toast.makeText(mContext, "Details", Toast.LENGTH_SHORT).show(); 297 | break; 298 | } 299 | } 300 | }) 301 | .setDecorView(getWindow().getDecorView()) 302 | .build(); 303 | alert.show(); 304 | } 305 | 306 | //Hide background for screenshots. 307 | @SuppressWarnings("unused") 308 | public void HideBackground(boolean hide) 309 | { 310 | if (hide) 311 | { 312 | mBackground.setVisibility(View.GONE); 313 | mCardView.setVisibility(View.GONE); 314 | Handler handler = new Handler(); 315 | handler.postDelayed(new Runnable() { 316 | @Override 317 | public void run() { 318 | HideBackground(false); 319 | } 320 | }, 5000); 321 | } 322 | else 323 | { 324 | mBackground.setVisibility(View.VISIBLE); 325 | mCardView.setVisibility(View.VISIBLE); 326 | } 327 | } 328 | 329 | @Override 330 | protected void onPause() { 331 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { 332 | //Removes flickering from setting window fullscreen 333 | Handler handler = new Handler(); 334 | handler.post(new Runnable() { 335 | @Override 336 | public void run() { 337 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 338 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 339 | | View.SYSTEM_UI_FLAG_FULLSCREEN 340 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); 341 | } 342 | }); 343 | } 344 | super.onPause(); 345 | } 346 | 347 | @Override 348 | public void onWindowFocusChanged(boolean hasFocus) { 349 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { 350 | if (hasFocus) { 351 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 352 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 353 | | View.SYSTEM_UI_FLAG_FULLSCREEN 354 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); 355 | } 356 | } 357 | super.onWindowFocusChanged(hasFocus); 358 | } 359 | } 360 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_triangle_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 32 | 35 | 38 | 41 | 44 | 47 | 50 | 53 | 56 | 59 | 62 | 65 | 68 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 29 | 30 | 39 | 40 | 50 | 51 | 56 | 57 | 61 | 62 | 66 | 67 | 71 | 72 | 76 | 77 | 81 | 82 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008af9 4 | #303F9F 5 | #4dafff 6 | #cc3332 7 | 8 | 9 | #FFFFFF 10 | #c8ffffff 11 | #00FFFFFF 12 | 13 | #2D2D2D 14 | #8C8C8C 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Custom AlertView Dialogue 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 35 | 36 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven { url "https://maven.google.com" } 5 | google() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.0.0' 9 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | jcenter() 16 | } 17 | } -------------------------------------------------------------------------------- /customalert/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | build/* 3 | */app.iml 4 | 5 | # Crashlytics configuations 6 | com_crashlytics_export_strings.xml 7 | 8 | # Local configuration file (sdk path, etc) 9 | local.properties 10 | 11 | # Gradle generated files 12 | .gradle/ 13 | 14 | # Signing files 15 | .signing/ 16 | 17 | # User-specific configurations 18 | .idea/* 19 | .idea/libraries/ 20 | .idea/workspace.xml 21 | .idea/tasks.xml 22 | .idea/.name 23 | .idea/compiler.xml 24 | .idea/copyright/profiles_settings.xml 25 | .idea/encodings.xml 26 | .idea/misc.xml 27 | .idea/modules.xml 28 | .idea/scopes/scope_settings.xml 29 | .idea/vcs.xml 30 | *.iml 31 | 32 | # OS-specific files 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db -------------------------------------------------------------------------------- /customalert/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group='com.github.searchy2' 5 | version = '2.6.1' 6 | 7 | android { 8 | compileSdkVersion 28 9 | 10 | defaultConfig { 11 | minSdkVersion 15 12 | targetSdkVersion 28 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | repositories { 24 | maven { url 'https://jitpack.io' } 25 | maven { url "https://maven.google.com" } 26 | } 27 | implementation fileTree(include: ['*.jar'], dir: 'libs') 28 | api 'com.google.android.material:material:1.1.0' 29 | api 'com.eightbitlab:blurview:1.5.0' 30 | } 31 | 32 | -------------------------------------------------------------------------------- /customalert/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/customalert/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /customalert/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Mar 08 22:00:25 AST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /customalert/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /customalert/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /customalert/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/ahmadnajar/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 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 | -------------------------------------------------------------------------------- /customalert/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /customalert/src/main/java/stream/customalert/CustomAlertDialogue.java: -------------------------------------------------------------------------------- 1 | package stream.customalert; 2 | 3 | import android.annotation.TargetApi; 4 | import android.app.Activity; 5 | import android.app.Dialog; 6 | import android.content.Context; 7 | import android.graphics.Typeface; 8 | import android.os.Build; 9 | import android.os.Bundle; 10 | import android.os.Handler; 11 | import android.os.Parcel; 12 | import android.os.Parcelable; 13 | import android.text.method.ScrollingMovementMethod; 14 | import android.util.DisplayMetrics; 15 | import android.util.Log; 16 | import android.view.Gravity; 17 | import android.view.KeyEvent; 18 | import android.view.LayoutInflater; 19 | import android.view.View; 20 | import android.view.ViewGroup; 21 | import android.view.ViewStub; 22 | import android.view.Window; 23 | import android.view.WindowManager; 24 | import android.view.inputmethod.EditorInfo; 25 | import android.widget.AdapterView; 26 | import android.widget.BaseAdapter; 27 | import android.widget.EditText; 28 | import android.widget.LinearLayout; 29 | import android.widget.ListView; 30 | import android.widget.TextView; 31 | 32 | import androidx.annotation.NonNull; 33 | import androidx.annotation.Nullable; 34 | import androidx.appcompat.app.AppCompatActivity; 35 | import androidx.core.content.ContextCompat; 36 | import androidx.fragment.app.DialogFragment; 37 | 38 | import com.google.android.material.textfield.TextInputEditText; 39 | import com.google.android.material.textfield.TextInputLayout; 40 | 41 | import java.util.ArrayList; 42 | import java.util.List; 43 | 44 | import stream.customalert.ui.CustomBlurDialogue; 45 | 46 | public class CustomAlertDialogue extends DialogFragment { 47 | public static final String TAG = CustomAlertDialogue.class.getSimpleName(); 48 | private Builder builder; 49 | private Style style = Style.DIALOGUE; 50 | private ArrayList inputList; 51 | private TextView positiveText; 52 | private ArrayList tagList; 53 | private static CustomAlertDialogue instance = new CustomAlertDialogue(); 54 | 55 | public static CustomAlertDialogue getInstance() { 56 | return instance; 57 | } 58 | 59 | private View layout; 60 | private TextView title, message; 61 | 62 | @Override 63 | public void onCreate(@Nullable Bundle savedInstanceState) { 64 | 65 | if (savedInstanceState != null) { 66 | if (builder == null) { 67 | builder = savedInstanceState.getParcelable(Builder.class.getSimpleName()); 68 | } 69 | } 70 | setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CustomDialog); 71 | setRetainInstance(true); 72 | super.onCreate(savedInstanceState); 73 | } 74 | 75 | @Override 76 | public void onSaveInstanceState(Bundle outState) { 77 | super.onSaveInstanceState(outState); 78 | if (builder != null) 79 | outState.putParcelable(Builder.class.getSimpleName(), builder); 80 | } 81 | 82 | @Override 83 | public void onPause() { 84 | super.onPause(); 85 | dismiss(); 86 | } 87 | 88 | @NonNull 89 | @Override 90 | public Dialog onCreateDialog(Bundle savedInstanceState) { 91 | Dialog dialog = super.onCreateDialog(savedInstanceState); 92 | Window window = dialog.getWindow(); 93 | WindowManager.LayoutParams wlp = window.getAttributes(); 94 | 95 | if (builder.getStyle() != null) 96 | { 97 | style = builder.getStyle(); 98 | } 99 | 100 | switch (style) 101 | { 102 | case DIALOGUE: 103 | wlp.windowAnimations = R.style.CustomDialogAnimation; 104 | wlp.gravity = Gravity.CENTER; 105 | break; 106 | case ACTIONSHEET: 107 | wlp.windowAnimations = R.style.CustomActionsheetAnimation; 108 | wlp.gravity = Gravity.BOTTOM; 109 | break; 110 | case SELECTOR: 111 | wlp.windowAnimations = R.style.CustomDialogAnimation; 112 | wlp.gravity = Gravity.CENTER; 113 | break; 114 | case INPUT: 115 | wlp.windowAnimations = R.style.CustomDialogAnimation; 116 | wlp.gravity = Gravity.CENTER; 117 | break; 118 | } 119 | 120 | if (builder.getGravity() != null) 121 | { 122 | wlp.gravity = builder.getGravity(); 123 | switch (builder.getGravity()) 124 | { 125 | case Gravity.CENTER: 126 | wlp.windowAnimations = R.style.CustomDialogAnimation; 127 | break; 128 | case Gravity.BOTTOM: 129 | wlp.windowAnimations = R.style.CustomActionsheetAnimation; 130 | break; 131 | } 132 | } 133 | 134 | window.setAttributes(wlp); 135 | 136 | if (builder != null) { 137 | if (!builder.getCancelable()) { 138 | setCancelable(false); 139 | } else { 140 | setCancelable(true); 141 | } 142 | } 143 | 144 | return dialog; 145 | } 146 | 147 | @Nullable 148 | @Override 149 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 150 | 151 | if (builder.getStyle() != null) 152 | { 153 | style = builder.getStyle(); 154 | Log.d("View Inflator", "Inflated"); 155 | } 156 | 157 | switch (style) 158 | { 159 | case DIALOGUE: 160 | return inflater.inflate(R.layout.alert, container, false); 161 | case ACTIONSHEET: 162 | return inflater.inflate(R.layout.alert_actionsheet, container,false); 163 | case SELECTOR: 164 | return inflater.inflate(R.layout.alert, container, false); 165 | case INPUT: 166 | return inflater.inflate(R.layout.alert_input, container, false); 167 | } 168 | 169 | return null; 170 | } 171 | 172 | @Override 173 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 174 | super.onViewCreated(view, savedInstanceState); 175 | if (builder != null) { 176 | 177 | initCommonView(view); 178 | 179 | //Style specific elements 180 | if (style == Style.DIALOGUE) 181 | { 182 | initDialogueView(view); 183 | } 184 | if (style == Style.ACTIONSHEET) 185 | { 186 | initActionsheetView(view); 187 | } 188 | if (style == Style.SELECTOR) 189 | { 190 | initSelectorView(view); 191 | } 192 | if (style == Style.INPUT) 193 | { 194 | initInputView(view); 195 | } 196 | } 197 | } 198 | 199 | private void initCommonView(View view) { 200 | //Common elements 201 | layout = view.findViewById(R.id.main_layout); 202 | layout.setOnClickListener(new View.OnClickListener() { 203 | @Override 204 | public void onClick(View view) { 205 | if (builder.getCancelable()) 206 | { 207 | dismiss(); 208 | } 209 | } 210 | }); 211 | title = view.findViewById(R.id.title); 212 | message = view.findViewById(R.id.message); 213 | if (builder.getTitle() != null) { 214 | title.setText(builder.getTitle()); 215 | } else { 216 | title.setVisibility(View.GONE); 217 | } 218 | if (builder.getMessage() != null) { 219 | message.setText(builder.getMessage()); 220 | message.setMovementMethod(new ScrollingMovementMethod()); 221 | } else { 222 | message.setVisibility(View.GONE); 223 | } 224 | 225 | if (builder.isAutoHide()) { 226 | int time = builder.getTimeToHide() != 0 ? builder.getTimeToHide() : 10000; 227 | new Handler().postDelayed(new Runnable() { 228 | @Override 229 | public void run() { 230 | if (isAdded() && getActivity() != null) 231 | dismiss(); 232 | } 233 | }, time); 234 | } 235 | } 236 | 237 | private void initDialogueView(View view) { 238 | 239 | ViewStub viewStub = view.findViewById(R.id.viewStubHorizontal); 240 | viewStub.inflate(); 241 | 242 | LinearLayout alertButtons = view.findViewById(R.id.alertButtons); 243 | 244 | if (builder.getNegativeText() != null) { 245 | View negativeButton = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_button, null); 246 | TextView negativeText = negativeButton.findViewById(R.id.alerttext); 247 | negativeText.setText(builder.getNegativeText()); 248 | if (builder.getNegativeTypeface() != null) 249 | { 250 | negativeText.setTypeface(builder.getNegativeTypeface()); 251 | } 252 | if (builder.getNegativeColor() != 0) 253 | { 254 | negativeText.setTextColor(ContextCompat.getColor(view.getContext(), builder.getNegativeColor())); 255 | } 256 | else 257 | { 258 | negativeText.setTextColor(ContextCompat.getColor(view.getContext(), R.color.negative)); 259 | } 260 | negativeText.setOnClickListener(new View.OnClickListener() { 261 | @Override 262 | public void onClick(View v) { 263 | builder.getOnNegativeClicked().OnClick(v, getDialog()); 264 | } 265 | }); 266 | alertButtons.addView(negativeButton, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 267 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 268 | } 269 | 270 | if (builder.getPositiveText() != null) { 271 | 272 | //Add a divider between buttons if button exists. 273 | View divider = new View(view.getContext()); 274 | divider.setBackgroundColor(ContextCompat.getColor(view.getContext(), R.color.divider)); 275 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) view.getContext().getResources().getDimension(R.dimen.size_divider), LinearLayout.LayoutParams.MATCH_PARENT); 276 | alertButtons.addView(divider, params); 277 | 278 | View positiveButton = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_button, null); 279 | TextView positiveText = positiveButton.findViewById(R.id.alerttext); 280 | positiveText.setText(builder.getPositiveText()); 281 | if (builder.getPositiveTypeface() != null) 282 | { 283 | positiveText.setTypeface(builder.getPositiveTypeface()); 284 | } 285 | if (builder.getPositiveColor() != 0) 286 | { 287 | positiveText.setTextColor(ContextCompat.getColor(view.getContext(), builder.getPositiveColor())); 288 | } 289 | else 290 | { 291 | positiveText.setTextColor(ContextCompat.getColor(view.getContext(), R.color.positive)); 292 | } 293 | positiveText.setOnClickListener(new View.OnClickListener() { 294 | @Override 295 | public void onClick(View v) { 296 | builder.getOnPositiveClicked().OnClick(v, getDialog()); 297 | } 298 | }); 299 | alertButtons.addView(positiveButton, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 300 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 301 | } 302 | 303 | float radius = 5; 304 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && builder.getDecorView() != null) 305 | { 306 | CustomBlurDialogue blurDialogue = view.findViewById(R.id.blurview); 307 | blurDialogue.create(builder.getDecorView(), radius); 308 | } 309 | } 310 | 311 | private void initActionsheetView(View view) { 312 | 313 | float radius = 5; 314 | 315 | final TextView cancelButton = view.findViewById(R.id.cancel); 316 | if(builder.getCancelText() != null){ 317 | cancelButton.setVisibility(View.VISIBLE); 318 | cancelButton.setText(builder.getCancelText()); 319 | cancelButton.setOnClickListener(new View.OnClickListener() { 320 | @Override 321 | public void onClick(View v) { 322 | builder.getOnCancelClicked().OnClick(v, getDialog()); 323 | } 324 | }); 325 | if (builder.getCancelColor() != 0) 326 | { 327 | cancelButton.setTextColor(ContextCompat.getColor(view.getContext(), builder.getCancelColor())); 328 | } 329 | 330 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && builder.getDecorView() != null) 331 | { 332 | CustomBlurDialogue blurDialogue = view.findViewById(R.id.blurview_button); 333 | blurDialogue.create(builder.getDecorView(), radius); 334 | } 335 | } 336 | 337 | if (builder.getTitle() != null || builder.getMessage() != null) 338 | { 339 | if (builder.getDestructive() != null || builder.getOthers() != null) 340 | { 341 | //Add a divider between header and listview 342 | View header = view.findViewById(R.id.header_divider); 343 | header.setVisibility(View.VISIBLE); 344 | } 345 | } 346 | 347 | initListView(view); 348 | 349 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && builder.getDecorView() != null) 350 | { 351 | CustomBlurDialogue blurDialogue = view.findViewById(R.id.blurview); 352 | blurDialogue.create(builder.getDecorView(), radius); 353 | } 354 | } 355 | 356 | private void initSelectorView(View view) { 357 | 358 | ViewStub viewStub = view.findViewById(R.id.viewStubVertical); 359 | viewStub.inflate(); 360 | initListView(view); 361 | 362 | float radius = 5; 363 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && builder.getDecorView() != null) 364 | { 365 | CustomBlurDialogue blurDialogue = view.findViewById(R.id.blurview); 366 | blurDialogue.create(builder.getDecorView(), radius); 367 | } 368 | } 369 | 370 | private void initListView(View view) { 371 | ArrayList mData = new ArrayList(); 372 | if (builder.getDestructive() != null) 373 | { 374 | mData.addAll(builder.getDestructive()); 375 | } 376 | if (builder.getOthers() != null) 377 | { 378 | mData.addAll(builder.getOthers()); 379 | } 380 | ListView alertButtonListView = view.findViewById(R.id.listview); 381 | CustomActionsheetAdapter adapter = new CustomActionsheetAdapter(mData, builder.getDestructive()); 382 | alertButtonListView.setAdapter(adapter); 383 | if (builder.getOnItemClickListener() != null) 384 | { 385 | alertButtonListView.setOnItemClickListener(builder.getOnItemClickListener()); 386 | } 387 | } 388 | 389 | private void initInputView(final View view) { 390 | 391 | //Initialize and reset input/tag arrays. 392 | inputList = new ArrayList<>(); 393 | tagList = new ArrayList<>(); 394 | 395 | //Initialize Dialogue View buttons. Identical code except for Positive button's OnInputClick listener 396 | ViewStub viewStub1 = view.findViewById(R.id.viewStubHorizontal); 397 | viewStub1.inflate(); 398 | 399 | LinearLayout alertButtons = view.findViewById(R.id.alertButtons); 400 | 401 | if (builder.getNegativeText() != null) { 402 | View negativeButton = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_button, null); 403 | TextView negativeText = negativeButton.findViewById(R.id.alerttext); 404 | negativeText.setText(builder.getNegativeText()); 405 | if (builder.getNegativeTypeface() != null) 406 | { 407 | negativeText.setTypeface(builder.getNegativeTypeface()); 408 | } 409 | if (builder.getNegativeColor() != 0) 410 | { 411 | negativeText.setTextColor(ContextCompat.getColor(view.getContext(), builder.getNegativeColor())); 412 | } 413 | else 414 | { 415 | negativeText.setTextColor(ContextCompat.getColor(view.getContext(), R.color.negative)); 416 | } 417 | negativeText.setOnClickListener(new View.OnClickListener() { 418 | @Override 419 | public void onClick(View v) { 420 | builder.getOnNegativeClicked().OnClick(v, getDialog()); 421 | } 422 | }); 423 | alertButtons.addView(negativeButton, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 424 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 425 | } 426 | 427 | if (builder.getPositiveText() != null) { 428 | 429 | //Add a divider between buttons if button exists. 430 | View divider = new View(view.getContext()); 431 | divider.setBackgroundColor(ContextCompat.getColor(view.getContext(), R.color.divider)); 432 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) view.getContext().getResources().getDimension(R.dimen.size_divider), LinearLayout.LayoutParams.MATCH_PARENT); 433 | alertButtons.addView(divider, params); 434 | 435 | View positiveButton = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_button, null); 436 | positiveText = positiveButton.findViewById(R.id.alerttext); 437 | positiveText.setText(builder.getPositiveText()); 438 | if (builder.getPositiveTypeface() != null) 439 | { 440 | positiveText.setTypeface(builder.getPositiveTypeface()); 441 | } 442 | if (builder.getPositiveColor() != 0) 443 | { 444 | positiveText.setTextColor(ContextCompat.getColor(view.getContext(), builder.getPositiveColor())); 445 | } 446 | else 447 | { 448 | positiveText.setTextColor(ContextCompat.getColor(view.getContext(), R.color.positive)); 449 | } 450 | positiveText.setOnClickListener(new View.OnClickListener() { 451 | @Override 452 | public void onClick(View v) { 453 | for (String tag : tagList) 454 | { 455 | EditText editInput = view.findViewWithTag(tag); 456 | inputList.add(editInput.getText().toString()); 457 | } 458 | builder.getOnInputClicked().OnClick(v, getDialog(), inputList); 459 | } 460 | }); 461 | alertButtons.addView(positiveButton, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 462 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 463 | } 464 | 465 | //Initialize input boxes. 466 | ViewStub viewStub = view.findViewById(R.id.viewStubVerticalInput); 467 | viewStub.inflate(); 468 | 469 | LinearLayout alertInput = view.findViewById(R.id.alertInput); 470 | 471 | if (builder.getLineInputHint() != null) { 472 | 473 | for (int i = 0; i < builder.getLineInputHint().size(); i++) 474 | { 475 | View lineInput = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_input_line, null); 476 | TextInputLayout inputLayout = lineInput.findViewById(R.id.alert_input_layout); 477 | inputLayout.setHint(builder.getLineInputHint().get(i)); 478 | TextInputEditText editInput = lineInput.findViewById(R.id.alert_input_text); 479 | editInput.setOnEditorActionListener(new TextView.OnEditorActionListener() { 480 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 481 | if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { 482 | if (builder.getPositiveText() != null) 483 | { 484 | Log.d("Input", "Submit"); 485 | positiveText.performClick(); 486 | } 487 | } 488 | return false; 489 | } 490 | }); 491 | if (builder.getLineInputText().size() > i) 492 | { 493 | if (builder.getLineInputText().get(i) != null) 494 | { 495 | editInput.setText(builder.getLineInputText().get(i)); 496 | } 497 | } 498 | editInput.setTag("Line" + i); 499 | tagList.add("Line" + i); 500 | alertInput.addView(lineInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 501 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 502 | } 503 | } 504 | 505 | if (builder.getBoxInputHint() != null) { 506 | 507 | for (int i = 0; i < builder.getBoxInputHint().size(); i++) 508 | { 509 | View boxInput = LayoutInflater.from(view.getContext()).inflate(R.layout.alert_input_box, null); 510 | TextInputLayout inputLayout = boxInput.findViewById(R.id.alert_input_layout); 511 | inputLayout.setHint(builder.getBoxInputHint().get(i)); 512 | EditText editInput = boxInput.findViewById(R.id.alert_input_text); 513 | if (builder.getBoxInputText().size() > i) 514 | { 515 | if (builder.getBoxInputText().get(i) != null) 516 | { 517 | editInput.setText(builder.getBoxInputText().get(i)); 518 | } 519 | } 520 | editInput.setTag("Box" + i); 521 | tagList.add("Box" + i); 522 | alertInput.addView(boxInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 523 | LinearLayout.LayoutParams.WRAP_CONTENT, 1)); 524 | } 525 | } 526 | 527 | float radius = 5; 528 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && builder.getDecorView() != null) 529 | { 530 | CustomBlurDialogue blurDialogue = view.findViewById(R.id.blurview); 531 | blurDialogue.create(builder.getDecorView(), radius); 532 | } 533 | } 534 | 535 | private Dialog show(Activity activity, Builder builder) { 536 | this.builder = builder; 537 | if (!isAdded()) 538 | show(((AppCompatActivity) activity).getSupportFragmentManager(), TAG); 539 | return getDialog(); 540 | } 541 | 542 | public static class Builder implements Parcelable { 543 | 544 | private String title; 545 | private String message; 546 | private String positiveText; 547 | private String negativeText; 548 | private String cancelText; 549 | 550 | private int titleColor; 551 | private int messageColor; 552 | private int positiveColor; 553 | private int negativeColor; 554 | private int cancelColor; 555 | private int backgroundColor; 556 | private int timeToHide; 557 | 558 | private Typeface titleFont; 559 | private Typeface messageFont; 560 | private Typeface positiveTypeface; 561 | private Typeface negativeTypeface; 562 | private Typeface alertTypeface; 563 | 564 | private OnPositiveClicked onPositiveClicked; 565 | private OnNegativeClicked onNegativeClicked; 566 | private OnCancelClicked onCancelClicked; 567 | private OnInputClicked onInputClicked; 568 | 569 | private ArrayList destructive; 570 | private ArrayList others; 571 | private ArrayList lineInputHint; 572 | private ArrayList lineInputText; 573 | private ArrayList boxInputHint; 574 | private ArrayList boxInputText; 575 | private AdapterView.OnItemClickListener onItemClickListener; 576 | 577 | private boolean autoHide; 578 | private boolean cancelable = true; 579 | 580 | private Integer gravity = Gravity.CENTER; 581 | private Style style; 582 | private View decorView; 583 | private Context context; 584 | 585 | protected Builder(Parcel in) { 586 | title = in.readString(); 587 | message = in.readString(); 588 | positiveText = in.readString(); 589 | negativeText = in.readString(); 590 | cancelText = in.readString(); 591 | titleColor = in.readInt(); 592 | messageColor = in.readInt(); 593 | positiveColor = in.readInt(); 594 | negativeColor = in.readInt(); 595 | cancelColor = in.readInt(); 596 | backgroundColor = in.readInt(); 597 | timeToHide = in.readInt(); 598 | destructive = in.createStringArrayList(); 599 | others = in.createStringArrayList(); 600 | lineInputHint = in.createStringArrayList(); 601 | lineInputText = in.createStringArrayList(); 602 | boxInputHint = in.createStringArrayList(); 603 | boxInputText = in.createStringArrayList(); 604 | autoHide = in.readByte() != 0; 605 | cancelable = in.readByte() != 0; 606 | gravity = in.readInt(); 607 | style = Style.valueOf(in.readString()); 608 | } 609 | 610 | /** 611 | * @param style - set DIALOGUE, ACTIONSHEET, SELECTOR, INPUT to select AlertView type. 612 | * @return 613 | */ 614 | public Builder setStyle(Style style) { 615 | if(style != null) { 616 | this.style = style; 617 | } 618 | return this; 619 | } 620 | public Style getStyle() { return style; } 621 | 622 | public Builder setGravity(Integer gravity) { 623 | if(gravity != null) { 624 | this.gravity = gravity; 625 | } 626 | return this; 627 | } 628 | public Integer getGravity() { return gravity; } 629 | 630 | /** 631 | * @param title - set AlertView title text. 632 | * @return 633 | */ 634 | public Builder setTitle(String title) { 635 | this.title = title; 636 | return this; 637 | } 638 | public String getTitle() { return title; } 639 | 640 | /** 641 | * @param message - set AlertView message text. 642 | * @return 643 | */ 644 | public Builder setMessage(String message) { 645 | this.message = message; 646 | return this; 647 | } 648 | public String getMessage() { 649 | return message; 650 | } 651 | 652 | /** 653 | * @param positiveButtonText - set Confirmation Alert right button text. 654 | * @return 655 | */ 656 | public Builder setPositiveText(String positiveButtonText) { 657 | this.positiveText = positiveButtonText; 658 | return this; 659 | } 660 | public String getPositiveText() { 661 | return positiveText; 662 | } 663 | 664 | /** 665 | * @param negativeText - set Simple Alert button text. Set Confirmation Alert left button text. 666 | * @return 667 | */ 668 | public Builder setNegativeText(String negativeText) { 669 | this.negativeText = negativeText; 670 | return this; 671 | } 672 | public String getNegativeText() { 673 | return negativeText; 674 | } 675 | 676 | /** 677 | * @param cancel - set Action Sheet cancel button text. 678 | * @return 679 | */ 680 | public Builder setCancelText(String cancel) { 681 | this.cancelText = cancel; 682 | return this; 683 | } 684 | public String getCancelText() { return cancelText; } 685 | 686 | /** 687 | * @param titleColor - set title text color. 688 | * @return 689 | */ 690 | public Builder setTitleColor(int titleColor) { 691 | this.titleColor = titleColor; 692 | return this; 693 | } 694 | public int getTitleColor() { 695 | return titleColor; 696 | } 697 | 698 | /** 699 | * @param messageColor - set message text color. 700 | * @return 701 | */ 702 | public Builder setMessageColor(int messageColor) { 703 | this.messageColor = messageColor; 704 | return this; 705 | } 706 | public int getMessageColor() { 707 | return messageColor; 708 | } 709 | 710 | /** 711 | * @param positiveTextColor - set positive button text color. 712 | * @return 713 | */ 714 | public Builder setPositiveColor(int positiveTextColor) { 715 | this.positiveColor = positiveTextColor; 716 | return this; 717 | } 718 | public int getPositiveColor() { 719 | return positiveColor; 720 | } 721 | 722 | /** 723 | * @param negativeColor - set negative button text color. 724 | * @return 725 | */ 726 | public Builder setNegativeColor(int negativeColor) { 727 | this.negativeColor = negativeColor; 728 | return this; 729 | } 730 | public int getNegativeColor() { 731 | return negativeColor; 732 | } 733 | 734 | /** 735 | * @param cancelColor - set cancel button text color. 736 | * @return 737 | */ 738 | public Builder setCancelColor(int cancelColor) { 739 | this.cancelColor = cancelColor; 740 | return this; 741 | } 742 | public int getCancelColor() { 743 | return cancelColor; 744 | } 745 | 746 | public Builder setBackgroundColor(int backgroundColor) { 747 | this.backgroundColor = backgroundColor; 748 | return this; 749 | } 750 | public int getBackgroundColor() { 751 | return backgroundColor; 752 | } 753 | 754 | /** 755 | * @param titleFontPath - set title text font. Must pass the path to the font in the assets folder. 756 | * @return 757 | */ 758 | public Builder setTitleFont(String titleFontPath) { 759 | this.titleFont = Typeface.createFromAsset(context.getAssets(), titleFontPath); 760 | return this; 761 | } 762 | public Typeface getTitleFont() { 763 | return titleFont; 764 | } 765 | 766 | /** 767 | * @param bodyFontPath - set message text font. Must pass the path to the font in the assets folder. 768 | * @return 769 | */ 770 | public Builder setMessageFont(String bodyFontPath) { 771 | this.messageFont = Typeface.createFromAsset(context.getAssets(), bodyFontPath); 772 | return this; 773 | } 774 | public Typeface getMessageFont() { 775 | return messageFont; 776 | } 777 | 778 | /** 779 | * @param positiveTypeface - set positive button text typeface. 780 | * @return 781 | */ 782 | public Builder setPositiveTypeface(Typeface positiveTypeface) { 783 | this.positiveTypeface = positiveTypeface; 784 | return this; 785 | } 786 | public Typeface getPositiveTypeface() { 787 | return positiveTypeface; 788 | } 789 | 790 | /** 791 | * @param negativeTypeface - set negative button text typeface. 792 | * @return 793 | */ 794 | public Builder setNegativeTypeface(Typeface negativeTypeface) { 795 | this.negativeTypeface = negativeTypeface; 796 | return this; 797 | } 798 | public Typeface getNegativeTypeface() { 799 | return negativeTypeface; 800 | } 801 | 802 | public Builder setAlertTypeface(String alertTypeface) { 803 | this.alertTypeface = Typeface.createFromAsset(context.getAssets(), alertTypeface); 804 | return this; 805 | } 806 | public Typeface getAlertTypeface() { 807 | return alertTypeface; 808 | } 809 | 810 | /** 811 | * @param onPositiveClicked - pass a listener to be called when the positive button is clicked. 812 | * @return 813 | */ 814 | public Builder setOnPositiveClicked(OnPositiveClicked onPositiveClicked) { 815 | this.onPositiveClicked = onPositiveClicked; 816 | return this; 817 | } 818 | public OnPositiveClicked getOnPositiveClicked() { 819 | return onPositiveClicked; 820 | } 821 | 822 | /** 823 | * @param onNegativeClicked - pass a listener to be called when the negative button is clicked. 824 | * @return 825 | */ 826 | public Builder setOnNegativeClicked(OnNegativeClicked onNegativeClicked) { 827 | this.onNegativeClicked = onNegativeClicked; 828 | return this; 829 | } 830 | public OnNegativeClicked getOnNegativeClicked() { 831 | return onNegativeClicked; 832 | } 833 | 834 | /** 835 | * @param onCancelClicked - pass a listener to be called when the cancel button is clicked. 836 | * @return 837 | */ 838 | public Builder setOnCancelClicked(OnCancelClicked onCancelClicked) { 839 | this.onCancelClicked = onCancelClicked; 840 | return this; 841 | } 842 | public OnCancelClicked getOnCancelClicked() { 843 | return onCancelClicked; 844 | } 845 | 846 | /** 847 | * @param onItemClickListener - pass a listener to be called when a selection item is clicked. 848 | * @return 849 | */ 850 | public Builder setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) { 851 | this.onItemClickListener = onItemClickListener; 852 | return this; 853 | } 854 | public AdapterView.OnItemClickListener getOnItemClickListener() { return onItemClickListener; } 855 | 856 | /** 857 | * @param onInputClicked - pass a listener to be called when an input box is submitted. 858 | * @return 859 | */ 860 | public Builder setOnInputClicked(OnInputClicked onInputClicked) { 861 | this.onInputClicked = onInputClicked; 862 | return this; 863 | } 864 | public OnInputClicked getOnInputClicked() { 865 | return onInputClicked; 866 | } 867 | 868 | /** 869 | * @param destructive - converts a String ArrayList into destructive options in the selector. 870 | * @return 871 | */ 872 | public Builder setDestructive(ArrayList destructive) { 873 | this.destructive = destructive; 874 | return this; 875 | } 876 | public ArrayList getDestructive() { return destructive; } 877 | 878 | /** 879 | * @param others - converts a String ArrayList into neutral options in the selector. 880 | * @return 881 | */ 882 | public Builder setOthers(ArrayList others) { 883 | this.others = others; 884 | return this; 885 | } 886 | public ArrayList getOthers() { return others; } 887 | 888 | /** 889 | * @param lineInputText - converts a String ArrayList into single line text input boxes. 890 | * @return 891 | */ 892 | public Builder setLineInputText(ArrayList lineInputText) { 893 | this.lineInputText = lineInputText; 894 | return this; 895 | } 896 | public ArrayList getLineInputText() { 897 | if (lineInputText == null) 898 | return new ArrayList<>(); 899 | return lineInputText; 900 | } 901 | 902 | /** 903 | * @param lineInputHint - converts a String ArrayList into single line input boxes hints. 904 | * Array length must match LineInputText length. 905 | * @return 906 | */ 907 | public Builder setLineInputHint(ArrayList lineInputHint) { 908 | this.lineInputHint = lineInputHint; 909 | return this; 910 | } 911 | public ArrayList getLineInputHint() { 912 | return lineInputHint; 913 | } 914 | 915 | /** 916 | * @param boxInputText - converts a String ArrayList into multiline text input boxes. 917 | * @return 918 | */ 919 | public Builder setBoxInputText(ArrayList boxInputText) { 920 | this.boxInputText = boxInputText; 921 | return this; 922 | } 923 | public ArrayList getBoxInputText() { 924 | if (boxInputText == null) 925 | return new ArrayList<>(); 926 | return boxInputText; 927 | } 928 | 929 | /** 930 | * @param boxInputHint - converts a String ArrayList into multiline input boxes hints. 931 | * Array length must match BoxInputText length. 932 | * @return 933 | */ 934 | public Builder setBoxInputHint(ArrayList boxInputHint) { 935 | this.boxInputHint = boxInputHint; 936 | return this; 937 | } 938 | public ArrayList getBoxInputHint() { 939 | return boxInputHint; 940 | } 941 | 942 | /** 943 | * @param autoHide - set `true` to automatically hide alert after a set time. 944 | * @return 945 | */ 946 | public Builder setAutoHide(boolean autoHide) { 947 | this.autoHide = autoHide; 948 | return this; 949 | } 950 | public boolean isAutoHide() { 951 | return autoHide; 952 | } 953 | 954 | /** 955 | * @param timeToHide - set time in milliseconds for popup to automatically dismiss. 956 | * No listeners are triggered when dismissed automatically. 957 | * @return 958 | */ 959 | public Builder setTimeToHide(int timeToHide) { 960 | this.timeToHide = timeToHide; 961 | return this; 962 | } 963 | public int getTimeToHide() { 964 | return timeToHide; 965 | } 966 | 967 | /** 968 | * @param cancelable - set false to prevent dialogue dismissal through tapping outside or pressing the back button. 969 | * Force the user to an choose option. 970 | * @return 971 | */ 972 | public Builder setCancelable(boolean cancelable) { 973 | this.cancelable = cancelable; 974 | return this; 975 | } 976 | public boolean getCancelable() { return cancelable; } 977 | 978 | /** 979 | * @param decorView - pass the Window DecorView for a nice blurred background. Defaults to overlay color. 980 | * Here's how to pass the correct DecorView in the following classes: 981 | * Activity - use `getWindow().getDecorView()` 982 | * Fragment - use `getActivity().getWindow().getDecorView()` 983 | * Viewholder - use `((Activity) mContext).getWindow().getDecorView()` 984 | * @return 985 | */ 986 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 987 | public Builder setDecorView(View decorView) { 988 | 989 | this.decorView = decorView; 990 | return this; 991 | } 992 | public View getDecorView() { return decorView; } 993 | 994 | /** 995 | * The Dialog Fragment is extremely picky about the `Activity` passed into the builder. 996 | * If the improper Activity is passed, the dialogue will crash! 997 | * Here's how to pass the proper Activity in the following cases: 998 | * Activity - construct with `ClassName.this` 999 | * Fragment - construct with `getActivity()` 1000 | * ViewHolder - construct with `getActivity().getApplicationContext()` 1001 | * Do not attempt to construct the dialogue with `getContext()`. 1002 | * The Builder requires an Activity and passing a Context does not work! 1003 | * @param context - pass the Dialogue's parent activity. 1004 | * @return 1005 | */ 1006 | public Builder(Context context) { this.context = context; } 1007 | 1008 | /** 1009 | * Construct the Dialogue Builder. 1010 | * @return 1011 | */ 1012 | public Builder build() { 1013 | return this; 1014 | } 1015 | 1016 | /** 1017 | * Display the Dialogue with Builder parameters. 1018 | * @return 1019 | */ 1020 | public Dialog show() { 1021 | return CustomAlertDialogue.getInstance().show(((Activity) context), this); 1022 | } 1023 | 1024 | public static final Creator CREATOR = new Creator() { 1025 | @Override 1026 | public Builder createFromParcel(Parcel in) { 1027 | return new Builder(in); 1028 | } 1029 | 1030 | @Override 1031 | public Builder[] newArray(int size) { 1032 | return new Builder[size]; 1033 | } 1034 | }; 1035 | 1036 | @Override 1037 | public int describeContents() { 1038 | return 0; 1039 | } 1040 | 1041 | @Override 1042 | public void writeToParcel(Parcel parcel, int i) { 1043 | parcel.writeString(title); 1044 | parcel.writeString(message); 1045 | parcel.writeString(positiveText); 1046 | parcel.writeString(negativeText); 1047 | parcel.writeString(cancelText); 1048 | parcel.writeInt(titleColor); 1049 | parcel.writeInt(messageColor); 1050 | parcel.writeInt(positiveColor); 1051 | parcel.writeInt(negativeColor); 1052 | parcel.writeInt(cancelColor); 1053 | parcel.writeInt(backgroundColor); 1054 | parcel.writeInt(timeToHide); 1055 | parcel.writeStringList(destructive); 1056 | parcel.writeStringList(others); 1057 | parcel.writeStringList(lineInputHint); 1058 | parcel.writeStringList(lineInputText); 1059 | parcel.writeStringList(boxInputHint); 1060 | parcel.writeStringList(boxInputText); 1061 | parcel.writeByte((byte) (autoHide ? 1 : 0)); 1062 | parcel.writeByte((byte) (cancelable ? 1 : 0)); 1063 | parcel.writeInt(gravity); 1064 | parcel.writeString(style.toString()); 1065 | } 1066 | } 1067 | 1068 | @Override 1069 | public void onAttach(Context context) { 1070 | super.onAttach(context); 1071 | } 1072 | 1073 | public interface OnPositiveClicked { 1074 | void OnClick(View view, Dialog dialog); 1075 | } 1076 | 1077 | public interface OnNegativeClicked { 1078 | void OnClick(View view, Dialog dialog); 1079 | } 1080 | 1081 | public interface OnCancelClicked { 1082 | void OnClick(View view, Dialog dialog); 1083 | } 1084 | 1085 | public interface OnInputClicked { 1086 | void OnClick(View view, Dialog dialog, ArrayList inputList); 1087 | } 1088 | 1089 | public enum Style{ 1090 | DIALOGUE, 1091 | ACTIONSHEET, 1092 | SELECTOR, 1093 | INPUT 1094 | } 1095 | 1096 | public class CustomActionsheetAdapter extends BaseAdapter { 1097 | 1098 | private List mDatas; 1099 | private List mDestructive; 1100 | 1101 | public CustomActionsheetAdapter(List datas, List destructive){ 1102 | this.mDatas = datas; 1103 | this.mDestructive = destructive; 1104 | } 1105 | 1106 | @Override 1107 | public int getCount() { 1108 | return mDatas.size(); 1109 | } 1110 | 1111 | @Override 1112 | public Object getItem(int position) { 1113 | return mDatas.get(position); 1114 | } 1115 | 1116 | @Override 1117 | public long getItemId(int position) { 1118 | return position; 1119 | } 1120 | 1121 | @Override 1122 | public View getView(int position, View convertView, ViewGroup parent) { 1123 | 1124 | String data = mDatas.get(position); 1125 | Holder holder = null; 1126 | View view = convertView; 1127 | if(view == null){ 1128 | LayoutInflater inflater = LayoutInflater.from(parent.getContext()); 1129 | view = inflater.inflate(R.layout.alert_button, null); 1130 | holder = createHolder(view); 1131 | view.setTag(holder); 1132 | } 1133 | else{ 1134 | holder = (Holder) view.getTag(); 1135 | } 1136 | holder.UpdateUI(parent.getContext(), data, position); 1137 | return view; 1138 | } 1139 | public Holder createHolder(View view){ 1140 | return new Holder(view); 1141 | } 1142 | 1143 | class Holder { 1144 | 1145 | private View buttonDivider; 1146 | private TextView buttonText; 1147 | 1148 | public Holder(View view){ 1149 | buttonText = view.findViewById(R.id.alerttext); 1150 | buttonDivider = view.findViewById(R.id.button_divider); 1151 | } 1152 | public void UpdateUI(Context context, String data, int position){ 1153 | 1154 | buttonText.setText(data); 1155 | if (position == 0) 1156 | { 1157 | buttonDivider.setVisibility(View.GONE); 1158 | } 1159 | else 1160 | { 1161 | buttonDivider.setVisibility(View.VISIBLE); 1162 | } 1163 | 1164 | if (mDestructive!= null && mDestructive.contains(data)){ 1165 | buttonText.setTextColor(ContextCompat.getColor(context, R.color.negative)); 1166 | } 1167 | else{ 1168 | buttonText.setTextColor(ContextCompat.getColor(context, R.color.positive)); 1169 | } 1170 | } 1171 | } 1172 | } 1173 | 1174 | public static class Units { 1175 | /** 1176 | * Converts dp to pixels. 1177 | */ 1178 | public static int dpToPx(Context context, int dp) { 1179 | DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); 1180 | int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); 1181 | return px; 1182 | } 1183 | } 1184 | } 1185 | -------------------------------------------------------------------------------- /customalert/src/main/java/stream/customalert/ui/CustomBlurDialogue.java: -------------------------------------------------------------------------------- 1 | package stream.customalert.ui; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.drawable.Drawable; 6 | import android.os.Build; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.view.ViewOutlineProvider; 11 | 12 | import eightbitlab.com.blurview.BlurView; 13 | import eightbitlab.com.blurview.RenderScriptBlur; 14 | import stream.customalert.CustomAlertDialogue; 15 | 16 | public class CustomBlurDialogue extends BlurView { 17 | 18 | public CustomBlurDialogue(Context context) { 19 | super(context); 20 | init(); 21 | } 22 | 23 | public CustomBlurDialogue(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | init(); 26 | initCorners(context); 27 | } 28 | 29 | public CustomBlurDialogue(Context context, AttributeSet attrs, int defStyleAttr) { 30 | super(context, attrs, defStyleAttr); 31 | init(); 32 | initCorners(context); 33 | } 34 | 35 | private void init() { 36 | 37 | } 38 | 39 | private void initCorners(Context context) { 40 | setRoundedCorners(CustomAlertDialogue.Units.dpToPx(context, 15)); 41 | } 42 | 43 | @Override 44 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 45 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 46 | } 47 | 48 | @Override 49 | protected void onDraw(Canvas canvas) { 50 | super.onDraw(canvas); 51 | } 52 | 53 | public void create(View decorView, float radius) { 54 | 55 | ViewGroup rootView = decorView.findViewById(android.R.id.content); 56 | Drawable windowBackground = decorView.getBackground(); 57 | 58 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 59 | setupWith(rootView) 60 | .setFrameClearDrawable(windowBackground) 61 | .setBlurAlgorithm(new RenderScriptBlur(getContext())) 62 | .setBlurRadius(radius) 63 | .setHasFixedTransformationMatrix(true); 64 | } 65 | } 66 | 67 | /** 68 | * Set Rounded Corners on Lollipop and above. Use rounded drawable and disable blur below Lollipop. 69 | * @param cornerRadius - set corner radius in pixels. 70 | */ 71 | private void setRoundedCorners(int cornerRadius) { 72 | 73 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 74 | setBackground(new RoundedCornersDrawable(cornerRadius)); 75 | setOutlineProvider(ViewOutlineProvider.BACKGROUND); 76 | setClipToOutline(true); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /customalert/src/main/java/stream/customalert/ui/RoundedCornersDrawable.java: -------------------------------------------------------------------------------- 1 | package stream.customalert.ui; 2 | 3 | import android.graphics.Color; 4 | import android.graphics.drawable.GradientDrawable; 5 | 6 | public class RoundedCornersDrawable extends GradientDrawable { 7 | 8 | public RoundedCornersDrawable(int cornerRadius){ 9 | super(Orientation.BOTTOM_TOP, new int[]{Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT}); 10 | setCornerRadius(cornerRadius); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /customalert/src/main/res/anim/fade_in_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 17 | 18 | -------------------------------------------------------------------------------- /customalert/src/main/res/anim/fade_out_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 17 | 18 | -------------------------------------------------------------------------------- /customalert/src/main/res/anim/slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /customalert/src/main/res/anim/slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /customalert/src/main/res/drawable/bg_alertview.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /customalert/src/main/res/drawable/bg_alertview_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /customalert/src/main/res/drawable/bg_transparent.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /customalert/src/main/res/drawable/cursor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout-land-v21/alert.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 20 | 21 | 25 | 26 | 38 | 39 | 53 | 54 | 59 | 60 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout-land/alert.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 31 | 32 | 46 | 47 | 52 | 53 | 58 | 59 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout-v21/alert.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 21 | 22 | 34 | 35 | 49 | 50 | 55 | 56 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout-v21/alert_actionsheet.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 21 | 22 | 27 | 28 | 39 | 40 | 51 | 52 | 59 | 60 | 69 | 70 | 71 | 72 | 73 | 83 | 84 | 89 | 90 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout-v21/alert_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 23 | 24 | 30 | 31 | 43 | 44 | 58 | 59 | 64 | 65 | 66 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 32 | 33 | 47 | 48 | 53 | 54 | 59 | 60 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert_actionsheet.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 21 | 22 | 33 | 34 | 45 | 46 | 53 | 54 | 63 | 64 | 65 | 66 | 77 | 78 | 90 | 91 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 21 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 24 | 25 | 37 | 38 | 52 | 53 | 58 | 59 | 60 | 66 | 67 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert_input_box.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 34 | 35 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alert_input_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 29 | 30 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alertview_horizontal.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alertview_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | -------------------------------------------------------------------------------- /customalert/src/main/res/layout/alertview_vertical.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /customalert/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #d7d7db 4 | #ff3b30 5 | #007aff 6 | #007aff 7 | #000000 8 | #8f8f8f 9 | #5c5c5c 10 | #000000 11 | #00FFFFFF 12 | #d2ffffff 13 | 14 | -------------------------------------------------------------------------------- /customalert/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 1dp 3 | 10dp 4 | 5dp 5 | 30dp 6 | 50dp 7 | 30dp 8 | 44dp 9 | 16sp 10 | 10dp 11 | 18dp 12 | 14dp 13 | 12dp 14 | 4dp 15 | 20sp 16 | 14sp 17 | 6dp 18 | 10dp 19 | 20 | -------------------------------------------------------------------------------- /customalert/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 17 | 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jul 04 09:48:13 CDT 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /screenshots/Action-Sheet_540x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Action-Sheet_540x.png -------------------------------------------------------------------------------- /screenshots/Confirmation-Alert_540x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Confirmation-Alert_540x.png -------------------------------------------------------------------------------- /screenshots/Custom-Alert-Dialogue-Screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Custom-Alert-Dialogue-Screenshot.gif -------------------------------------------------------------------------------- /screenshots/Custom-Alertview-Dialogue-Cover_1280x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Custom-Alertview-Dialogue-Cover_1280x.gif -------------------------------------------------------------------------------- /screenshots/Input-Box_540x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Input-Box_540x.png -------------------------------------------------------------------------------- /screenshots/Selector_500x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Selector_500x.png -------------------------------------------------------------------------------- /screenshots/Simple-Alert_480x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rayliverified/CustomAlertViewDialogue/3541e448d6722c4765ae222b078ebe329ddf7d5b/screenshots/Simple-Alert_480x.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':customalert' 2 | --------------------------------------------------------------------------------