Full Code of pranavpandey/dynamic-toasts for AI

master 63df450837fa cached
52 files
193.8 KB
44.8k tokens
105 symbols
1 requests
Download .txt
Showing preview only (209K chars total). Download the full file or copy to clipboard to get everything.
Repository: pranavpandey/dynamic-toasts
Branch: master
Commit: 63df450837fa
Files: 52
Total size: 193.8 KB

Directory structure:
gitextract_ks34k4c_/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   └── issue_template.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── build.yml
├── .gitignore
├── .travis.yml
├── CNAME
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── build.gradle
├── dynamic-toasts/
│   ├── build.gradle
│   ├── maven.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── pranavpandey/
│           │           └── android/
│           │               └── dynamic/
│           │                   └── toasts/
│           │                       ├── DynamicHint.java
│           │                       ├── DynamicToast.java
│           │                       └── internal/
│           │                           ├── ToastCompat.java
│           │                           └── ToastContext.java
│           └── res/
│               ├── drawable/
│               │   ├── adt_hint_background.xml
│               │   └── adt_toast_background.xml
│               ├── layout/
│               │   ├── adt_layout_hint.xml
│               │   └── adt_layout_toast.xml
│               └── values/
│                   └── dimens.xml
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── graphics/
│   ├── icon.psd
│   ├── legacy/
│   │   └── icon.psd
│   └── preview.psd
├── sample/
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── pranavpandey/
│           │           └── android/
│           │               └── dynamic/
│           │                   └── toasts/
│           │                       └── sample/
│           │                           ├── DynamicToastsActivity.kt
│           │                           └── dialog/
│           │                               └── AboutDialogFragment.kt
│           └── res/
│               ├── drawable/
│               │   ├── app_bar_shadow.xml
│               │   ├── bg_custom_toast.xml
│               │   ├── ic_info.xml
│               │   ├── ic_launcher_foreground.xml
│               │   ├── ic_social_github.xml
│               │   └── ic_toast_icon.xml
│               ├── layout/
│               │   ├── activity_dynamic_toasts.xml
│               │   ├── content_dynamic_toasts.xml
│               │   └── dialog_about.xml
│               ├── menu/
│               │   └── main.xml
│               ├── mipmap-anydpi-v26/
│               │   └── ic_launcher.xml
│               └── values/
│                   ├── colors.xml
│                   ├── dimens.xml
│                   ├── strings.xml
│                   └── styles.xml
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# Funding links

github: pranavpandey
open_collective: pranavpandeydev
ko_fi: pranavpandey
buy_me_a_coffee: pranavpandey
patreon: pranavpandey
custom: ['paypal.me/pranavpandeydev']


================================================
FILE: .github/ISSUE_TEMPLATE/issue_template.md
================================================
---
name: Issue
about: Create a issue to help us improve
title: "Short description of the issue"
---

**Description:** Full description of the issue.

**Expected behavior:** Screenshots and/or description of the expected behavior.

**Source code:** [OPTIONAL] The code snippet which is causing this issue.

**Sample app and/or repro:** [OPTIONAL] A sample app or steps to reproduce the issue. You may attach a `zip` or `APK` file of the sample app or a link to the GitHub repository.

**Android API version:** Android API version. `API 19`

**Library version:** The Library version you are using. `1.0.0`

**Device:** Device on which the bug was encountered. `Emulator or Brand Model`

*Please make sure that you are using the [latest version](https://github.com/pranavpandey/dynamic-toasts/releases) of the library and we also accept [pull requests](https://github.com/pranavpandey/dynamic-toasts/pulls).*


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
### Thanks for starting a pull request!

## Changes

  -
  -

## Testing

Describe how you tested your changes.

## Issues

[OPTIONAL] Link to GitHub issues it solves. `Resolve #1234`


================================================
FILE: .github/workflows/build.yml
================================================
name: Build

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 60

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup JDK 17
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: 17

      - name: Setup Gradle
        uses: gradle/gradle-build-action@v2

      - name: Build with Gradle
        run: |
          chmod +x gradlew
          ./gradlew build

      - name: Generate Javadoc
        if: github.ref_type == 'tag'
        run: ./gradlew generateJavadoc


================================================
FILE: .gitignore
================================================
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/
release/

# IntelliJ project files
**.iml
.idea

# Android Studio captures folder
captures/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Misc
.DS_Store

================================================
FILE: .travis.yml
================================================
language: android
jdk: oraclejdk17

before_install:
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo -e "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"

android:
  components:
    - tools
    - platform-tools
    - build-tools-35.0.0
    - android-35
    - extra-android-support
    - extra-android-m2repository
    - extra-google-m2repository
before_script:
  - chmod +x gradlew
script:
  - ./gradlew build

after_success:
  - ./gradlew generateJavadoc

deploy:
  provider: pages
  token: $GITHUB_TOKEN
  edge: true
  keep_history: true
  local_dir: dynamic-toasts/build/docs/javadoc/release
  on:
    branch: master
    tags: true


================================================
FILE: CNAME
================================================
pranavpandey.org

================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
  and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
  community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
  any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
  without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
support@pranavpandey.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations


================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2017-2024 Pranav Pandey

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
<img src="./graphics/icon.png" height="160">

# Dynamic Toasts

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Build Status](https://travis-ci.org/pranavpandey/dynamic-toasts.svg?branch=master)](https://travis-ci.org/pranavpandey/dynamic-toasts)
[![Release](https://img.shields.io/maven-central/v/com.pranavpandey.android/dynamic-toasts)](https://search.maven.org/artifact/com.pranavpandey.android/dynamic-toasts)

**A simple library to display themed toasts with icon and text on Android 2.3 (API 9) and above.**

> [!IMPORTANT]
> Since v0.4.0, it uses [26.x.x support libraries][android-support] so, minimum SDK will be 
Android 4.0 (API 14).
<br/>Since v2.0.0, it uses [AndroidX][androidx] so, first [migrate][androidx-migrate] your 
project to AndroidX.
<br/>Since v4.1.0, it is dependent on Java 8 due to the dependency on
[Dynamic Utils][dynamic-utils].
<br/>Since v4.2.0, it is targeting Java 17 to provide maximum compatibility.
<br/>Since v4.3.0, the minimum SDK is Android 4.4 (API 19) to comply with the latest policies.

<img src="./graphics/preview.png">

---

## Contents

- [Installation](#installation)
- [Usage](#usage)
    - [Configuration](#configuration)
    - [Default toast](#default-toast)
    - [Default toast with duration](#default-toast-with-duration)
    - [Default toast with icon](#default-toast-with-icon)
    - [Default toast with icon and duration](#default-toast-with-icon-and-duration)
    - [Error toast](#error-toast)
    - [Error toast with duration](#error-toast-with-duration)
    - [Success toast](#success-toast)
    - [Success toast with duration](#success-toast-with-duration)
    - [Warning toast](#warning-toast)
    - [Warning toast with duration](#warning-toast-with-duration)
    - [Custom toast](#custom-toast)
    - [Custom toast with duration](#custom-toast-with-duration)
    - [Custom toast with icon](#custom-toast-with-icon)
    - [Custom toast with icon and duration](#custom-toast-with-icon-and-duration)
    - [Cheat sheets](#cheat-sheets)
    - [Dependency](#dependency)
- [License](#license)

---

## Installation

It can be installed by adding the following dependency to your `build.gradle` file:

```groovy
dependencies {
    // For AndroidX enabled projects.
    implementation 'com.pranavpandey.android:dynamic-toasts:4.3.0'

    // For legacy projects.
    implementation 'com.pranavpandey.android:dynamic-toasts:1.3.0'
}
```

---

## Usage

It has several method to display toasts based on the requirement. Each method returns a `Toast`
object which can be customised further.

Please call `show()` method to display the toast.

> For a complete reference, please read the [documentation][documentation].

### Configuration

Optional configuration to customise the toasts further like custom background color or drawable, 
custom text size, typeface or icon size, etc.

Various methods can be called anywhere in the app to do customisations.

```java
DynamicToast.Config.getInstance()
    // Background color for default toast.
    .setDefaultBackgroundColor(@ColorInt int defaultBackgroundColor)
    // Tint color for default toast.
    .setDefaultTintColor(@ColorInt int defaultTintColor)
    // Background color for error toast.
    .setErrorBackgroundColor(@ColorInt int errorBackgroundColor)
    // Background color for success toast.
    .setSuccessBackgroundColor(@ColorInt int successBackgroundColor)
    // Background color for warning toast.
    .setWarningBackgroundColor(@ColorInt int warningBackgroundColor)
    // Custom icon for error toast. Pass `null` to use default icon.
    .setErrorIcon(@Nullable Drawable errorIcon)
    // Custom icon for success toast. Pass `null` to use default icon.
    .setSuccessIcon(@Nullable Drawable successIcon)
    // Custom icon for warning toast. Pass `null` to use default icon.
    .setWarningIcon(@Nullable Drawable warningIcon)
    // Disable icon for all the toasts.
    .setDisableIcon(boolean disableIcon)
    // Custom icon size in `pixels` for all the toasts.
    .setIconSize(int iconSize)
    // Custom text size in `SP` for all the toasts.
    .setTextSize(int textSize)
    // Custom text typeface for all the toasts. Pass `null` to use system typeface.
    .setTextTypeface(@Nullable Typeface textTypeface)
    // Custom background drawable for all the toasts. Pass `null` to use default background.
    .setToastBackground(@Nullable Drawable toastBackground)
    // Apply customisations.
    .apply();
```

Call `reset()` method to reset all the customisations.

```java
// Reset customisations.
DynamicToast.Config.getInstance().reset();
```

### Default toast

Simple toast based on the vanilla Android theme for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.make(context, "Default toast").show();
```

### Default toast with duration

Simple toast based on the vanilla Android theme for supplied duration.

```java
DynamicToast.make(context, "Default toast with duration", duration).show();
```

### Default toast with icon

Simple toast based on the vanilla Android theme with a icon for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.make(context, "Default toast with icon", drawable).show();
```

### Default toast with icon and duration

Simple toast based on the vanilla Android theme with a icon for supplied duration.

```java
DynamicToast.make(context, "Default toast with icon and duration", drawable, duration).show();
```

### Error toast

Error toast with `#F44336` background for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.makeError(context, "Error toast").show();
```

### Error toast with duration

Error toast with `#F44336` background for supplied duration.

```java
DynamicToast.makeError(context, "Error toast with duration", duration).show();
```

### Success toast

Success toast with `#4CAF50` background for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.makeSuccess(context, "Success toast").show();
```

### Success toast with duration

Success toast with `#4CAF50` background for supplied duration.

```java
DynamicToast.makeSuccess(context, "Success toast with duration", duration).show();
```

### Warning toast

Warning toast with `#FFEB3B` background for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.makeWarning(context, "Warning toast").show();
```

### Warning toast with duration

Warning toast with `#FFEB3B` background for supplied duration.

```java
DynamicToast.makeWarning(context, "Warning toast with duration", duration).show();
```

### Custom toast

Custom toast based on the supplied background and tint color for `Toast.LENGTH_SHORT` duration.

```java
DynamicToast.make(context, "Custom toast", tintColor, backgroundColor).show();
```

### Custom toast with duration

Custom toast based on the supplied background and tint color for supplied duration.

```java
DynamicToast.make(context, "Custom toast with duration", tintColor, backgroundColor, duration).show();
```

### Custom toast with icon

Custom toast based on the supplied icon, background and tint color theme for `Toast.LENGTH_SHORT` 
duration.

```java
DynamicToast.make(context, "Custom toast with icon", drawable, tintColor, backgroundColor).show();
```

### Custom toast with icon and duration

Custom toast based on the supplied icon, background and tint color theme for supplied duration.

```java
DynamicToast.make(context, "Custom toast with icon and duration", drawable, 
        tintColor, backgroundColor, duration).show();
```

### Cheat sheets

Use dynamic hint to display cheat sheets for any `view`. All the methods are same as explained 
above, just replace `DynamicToast` with `DynamicHint` to create a cheat sheet.

> Use `DynamicHint.show(view, toast)` method to display it according to the anchor view position.

### Dependency

It depends on the [dynamic-utils][dynamic-utils] to perform various internal operations. 
So, its functions can also be used to perform other useful operations.

---

## Author

Pranav Pandey

[![GitHub](https://img.shields.io/github/followers/pranavpandey?label=GitHub&style=social)](https://github.com/pranavpandey)
[![Follow on Twitter](https://img.shields.io/twitter/follow/pranavpandeydev?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=pranavpandeydev)
[![Donate via PayPal](https://img.shields.io/static/v1?label=Donate&message=PayPal&color=blue)](https://paypal.me/pranavpandeydev)

---

## License

    Copyright 2017-2024 Pranav Pandey

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


[android-support]: https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0
[androidx]: https://developer.android.com/jetpack/androidx
[androidx core]: https://developer.android.com/jetpack/androidx/releases/core
[androidx-migrate]: https://developer.android.com/jetpack/androidx/migrate
[documentation]: https://pranavpandey.github.io/dynamic-toasts
[dynamic-utils]: https://github.com/pranavpandey/dynamic-utils


================================================
FILE: build.gradle
================================================
/*
 * Copyright 2017-2025 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

buildscript {
    ext.versions = [
            'compileSdk'      : 35,
            'minSdk'          : 21,
            'targetSdk'       : 35,
            'buildTools'      : '35.0.0',
            'constraintlayout': '2.1.4',
            'dynamic'         : '4.6.1',
            'dialogs'         : '4.5.0',
            'flexbox'         : '3.0.0',
            'kotlin'          : '1.9.24'
    ]

    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.7.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
    }
}

plugins {
    id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

allprojects {
    repositories {
        mavenCentral()
        google()
    }
}

tasks.register('clean', Delete) {
    delete rootProject.layout.buildDirectory
}

ext {
    projectName = 'dynamic-toasts'
    projectDesc = 'A simple library to display themed toasts with icon and text on Android.'
    versionDesc = 'A simple library to display themed toasts with icon and text on Android 4.0 ' +
            '(API 14) and above.'
    referenceTitle = 'Dynamic Toasts API reference'

    siteUrl = 'https://github.com/pranavpandey/dynamic-toasts'
    gitUrl = 'https://github.com/pranavpandey/dynamic-toasts'
    issueUrl = 'https://github.com/pranavpandey/dynamic-toasts/issues'
    githubUrl = 'pranavpandey/dynamic-toasts'

    mavenRepo = 'android'
    mavenGroup = 'com.pranavpandey.android'
    mavenDir = 'com/pranavpandey/android'
    mavenArtifactId = 'dynamic-toasts'
    mavenInceptionYear = '2017'
    mavenVersion = '4.3.0'
    mavenVersionCode = 34
    sampleVersionCode = 35

    developerId = 'pranavpandey'
    developerName = 'Pranav Pandey'
    developerEmail = 'dynamic@pranavpandey.com'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    licenseDistribution = 'repo'
    allLicenses = ["Apache-2.0"]

    publication = 'local.properties'

    ext["signing.keyId"] = ''
    ext["signing.password"] = ''
    ext["signing.secretKeyRingFile"] = ''

    ossrhUsername = ''
    ossrhPassword = ''
    sonatypeStagingProfileId = ''
}

apply plugin: 'io.github.gradle-nexus.publish-plugin'

File publish = project.rootProject.file("${publication}")
if (publish.exists()) {
    Properties properties = new Properties()
    new FileInputStream(publish).withCloseable { is -> properties.load(is) }
    properties.each { name, value -> ext[name] = value }
}

nexusPublishing {
    repositories {
        sonatype {
            username = ossrhUsername
            password = ossrhPassword
            stagingProfileId = sonatypeStagingProfileId
        }
    }
}


================================================
FILE: dynamic-toasts/build.gradle
================================================
/*
 * Copyright 2017-2024 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'com.android.library'

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion versions.buildTools
    namespace 'com.pranavpandey.android.dynamic.toasts'

    defaultConfig {
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
    }

    sourceSets {
        main.res.srcDirs 'res'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

dependencies {
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:${versions.kotlin}"))

    api "com.pranavpandey.android:dynamic-utils:${versions.dynamic}"
}

if (project.rootProject.file("${publication}").exists()) {
    apply from: 'maven.gradle'
}

tasks.register('generateJavadoc') {
    description "Generates Javadoc."
}

project.afterEvaluate {
    android.libraryVariants.configureEach { variant ->
        def task = project.tasks.create(
                "generate${variant.name.capitalize()}Javadoc", Javadoc) {
            title "${referenceTitle}<h4>${versionDesc}</h4><h5>${mavenVersion}</h5>"
            description "Generates Javadoc for $variant.name."
            destinationDir = new File(destinationDir, variant.baseName)

            source = variant.sourceSets.collect {
                it.java.sourceFiles
            }.inject {
                m, i -> m + i
            }
            doFirst {
                classpath = project.files(variant.javaCompileProvider.get().classpath.files,
                        project.android.getBootClasspath())
            }

            if (JavaVersion.current().isJava8Compatible()) {
                options.addStringOption('Xdoclint:none', '-quiet')
            }

            options.memberLevel = JavadocMemberLevel.PROTECTED
            exclude "**/R", "**/R.**", "**/R\$**", "**/BuildConfig*"

            options.windowTitle = "${referenceTitle}"
            options.links('http://docs.oracle.com/javase/8/docs/api',
                    'http://docs.oracle.com/javase/17/docs/api')
            options.links('https://developer.android.com/reference')
            options.linksOffline('https://developer.android.com/reference',
                    'https://developer.android.com/reference/androidx')
            options.links('https://pranavpandey.org/dynamic-utils')

            failOnError false
        }

        task.dependsOn "assemble${variant.name.capitalize()}"
        generateJavadoc.dependsOn task
    }
}


================================================
FILE: dynamic-toasts/maven.gradle
================================================
/*
 * Copyright 2017-2024 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'maven-publish'
apply plugin: 'signing'

group = mavenGroup
version = mavenVersion

// Android libraries
if (project.hasProperty("android")) {
    tasks.register('sourcesJar', Jar) {
        archiveClassifier.set("sources")
        from android.sourceSets.main.java.srcDirs
    }

    tasks.register('javadoc', Javadoc) {
        dependsOn "generateReleaseRFile"
        title "${referenceTitle}<h4>${versionDesc}</h4><h5>${mavenVersion}</h5>"
        failOnError = false

        source = android.sourceSets.main.java.sourceFiles
        doNotTrackState("Javadoc needs to be generated every time.")

        if (JavaVersion.current().isJava8Compatible()) {
            options.addStringOption('Xdoclint:none', '-quiet')
        }

        options.memberLevel = JavadocMemberLevel.PROTECTED
        exclude "**/R", "**/R.**", "**/R\$**", "**/BuildConfig*"

        options.windowTitle = "${referenceTitle}"
        options.links('http://docs.oracle.com/javase/8/docs/api',
                'http://docs.oracle.com/javase/17/docs/api')
        options.links('https://developer.android.com/reference')
        options.linksOffline('https://developer.android.com/reference',
                'https://developer.android.com/reference/androidx')
        options.links('https://pranavpandey.org/dynamic-utils')
    }
} else { // Java libraries
    tasks.register('sourcesJar', Jar) {
        dependsOn classes

        archiveClassifier.set("sources")
        from sourceSets.main.allSource
    }
}

tasks.register('javadocJar', Jar) {
    dependsOn javadoc

    archiveClassifier.set("javadoc")
    from javadoc.destinationDir
}

artifacts {
    archives javadocJar
    archives sourcesJar
}

// Maven
publishing {
    publications {
        library(MavenPublication) {
            groupId mavenGroup
            artifactId mavenArtifactId
            version mavenVersion

            artifact "$buildDir/outputs/aar/$mavenArtifactId-release.aar"
            artifact javadocJar
            artifact sourcesJar

            pom.withXml {
                // Project
                asNode().appendNode('name', projectName)
                asNode().appendNode('description', projectDesc)
                asNode().appendNode('url', siteUrl)
                asNode().appendNode('inceptionYear', mavenInceptionYear)

                // Licenses
                def license = asNode().appendNode('licenses').appendNode('license')
                license.appendNode('name', licenseName)
                license.appendNode('url', licenseUrl)
                license.appendNode('distribution', licenseDistribution)

                // Developers
                def developer = asNode().appendNode('developers').appendNode('developer')
                developer.appendNode('id', developerId)
                developer.appendNode('name', developerName)
                developer.appendNode('email', developerEmail)

                // SCM
                def scm = asNode().appendNode('scm')
                scm.appendNode('connection', "scm:git:${gitUrl}.git")
                scm.appendNode('developerConnection', gitUrl)
                scm.appendNode('url', siteUrl)

                // Dependencies
                def dependenciesNode = asNode()['dependencies'][0]
                if (dependenciesNode == null) {
                    dependenciesNode = asNode().appendNode('dependencies')
                }

                // Add all that are 'compile' dependencies.
                configurations.api.allDependencies.each {
                    def dependencyNode = dependenciesNode.appendNode('dependency')
                    dependencyNode.appendNode('groupId', it.group)
                    dependencyNode.appendNode('artifactId', it.name)
                    dependencyNode.appendNode('version', it.version)
                }
            }
        }
    }
}

ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]

signing {
    sign publishing.publications
}

afterEvaluate { project ->
    // Fix javadoc generation.
    javadoc.classpath += files(android.libraryVariants.collect { variant ->
        variant.javaCompileProvider.get().classpath.files
    })

    def pomTask = "generatePomFileForLibraryPublication"
    def dependencies = [javadocJar, sourcesJar, assembleRelease, pomTask]

    // Convenience task to prepare everything we need for releases.
    tasks.register('prepareArtifacts') {
        dependsOn dependencies
    }
}


================================================
FILE: dynamic-toasts/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<manifest />


================================================
FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicHint.java
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.pranavpandey.android.dynamic.toasts.internal.ToastCompat;
import com.pranavpandey.android.dynamic.util.DynamicColorUtils;
import com.pranavpandey.android.dynamic.util.DynamicDrawableUtils;
import com.pranavpandey.android.dynamic.util.DynamicUnitUtils;

/**
 * Helper class to display themed cheat sheets with icon and text by using {@link Toast}.
 * <p>If no color is supplied, it will display default hint based on the Android support library.
 */
public class DynamicHint {

    /**
     * The minimum top inset to mimic status bar.
     */
    private static final int ADT_INSET_TOP = 32;

    /**
     * The minimum height for anchor, in dips (density-independent pixels).
     * <p>It will be used to avoid overlapping for the smaller view height.
     */
    private static final int ADT_MIN_ANCHOR_HEIGHT = 48;

    /**
     * The toast offset, in dips (density-independent pixels).
     * <p>It will be used to determine whether the toast should appear above or below the UI element.
     */
    private static final int ADT_TOAST_OFFSET = 4;

    /**
     * Default background color for the toast.
     */
    private static final @ColorInt int ADT_DEFAULT_BG_COLOR =
            Color.parseColor("#454545");

    /**
     * Default tint color for the toast.
     */
    private static final @ColorInt int ADT_DEFAULT_TINT_COLOR =
            Color.parseColor("#FFFFFF");

    /**
     * Default background color for the error toast.
     */
    private static final @ColorInt int ADT_DEFAULT_ERROR_BG_COLOR =
            Color.parseColor("#F44336");

    /**
     * Default background color for the success toast.
     */
    private static final @ColorInt int ADT_DEFAULT_SUCCESS_BG_COLOR =
            Color.parseColor("#4CAF50");

    /**
     * Default background color for the warning toast.
     */
    private static final @ColorInt int ADT_DEFAULT_WARNING_BG_COLOR =
            Color.parseColor("#FFEB3B");

    /**
     * Default value for the {@link #disableIcon}.
     * <p>{@code false} to enable the toast icon.
     */
    private static final boolean ADT_DEFAULT_DISABLE_ICON = false;

    /**
     * Default value for the {@link #tintIcon}.
     * <p>{@code true} to tint the toast icon.
     */
    private static final boolean ADT_DEFAULT_TINT_ICON = true;

    /**
     * Default icon size for the toast in pixels.
     * <p>{@code -1} to use in-built icon size.
     */
    private static final @ColorInt int ADT_DEFAULT_ICON_SIZE = -1;

    /**
     * Default text size for the toast in SP.
     * <p>{@code -1} to use system text size.
     *
     * @see TypedValue#COMPLEX_UNIT_SP;
     */
    private static final @ColorInt int ADT_DEFAULT_TEXT_SIZE = -1;

    /**
     * Background color for the default toast.
     */
    private static @Nullable @ColorInt Integer defaultBackgroundColor = ADT_DEFAULT_BG_COLOR;

    /**
     * Tint color for the default toast.
     */
    private static @Nullable @ColorInt Integer defaultTintColor = ADT_DEFAULT_TINT_COLOR;

    /**
     * Background color for the error toast.
     */
    private static @Nullable @ColorInt Integer errorBackgroundColor = ADT_DEFAULT_ERROR_BG_COLOR;

    /**
     * Background color for the success toast.
     */
    private static @Nullable @ColorInt Integer successBackgroundColor =
            ADT_DEFAULT_SUCCESS_BG_COLOR;

    /**
     * Background color for the warning toast.
     */
    private static @Nullable @ColorInt Integer warningBackgroundColor =
            ADT_DEFAULT_WARNING_BG_COLOR;

    /**
     * Custom icon for the error toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable errorIcon = null;

    /**
     * Custom icon for the success toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable successIcon = null;

    /**
     * Custom icon for the warning toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable warningIcon = null;

    /**
     * {@code true} to disable icon for all the toasts.
     */
    private static boolean disableIcon = ADT_DEFAULT_DISABLE_ICON;

    /**
     * {@code true} to tint icon for all the toasts.
     */
    private static boolean tintIcon = ADT_DEFAULT_TINT_ICON;

    /**
     * Icon size for the toast in pixels.
     */
    private static int iconSize = ADT_DEFAULT_ICON_SIZE;

    /**
     * Text size for the toast in SP.
     *
     * @see TypedValue#COMPLEX_UNIT_SP;
     */
    private static int textSize = ADT_DEFAULT_TEXT_SIZE;

    /**
     * Custom typeface used by the toast.
     * <p>{@code null} to use the system typeface.
     */
    private static Typeface textTypeface = null;

    /**
     * Custom background used by the toast.
     * <p>{@code null} to use the default background.
     */
    private static Drawable toastBackground = null;

    /**
     * Generate tint color according to the supplied color, otherwise return the default value.
     *
     * @param color The color to be used to generate the tint color.
     * @param defaultColor The default value for the tint color.
     *
     * @return The generated tint color according to the supplied color, otherwise return the
     *         default value.
     */
    private static @Nullable @ColorInt Integer generateTintColor(
            @Nullable @ColorInt Integer color, @Nullable @ColorInt Integer defaultColor) {
        if (color != null) {
            return DynamicColorUtils.getTintColor(color);
        }

        return defaultColor;
    }

    /**
     * Make a standard toast that just contains a text view.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text) {
        return make(context, text, null, defaultTintColor,
                defaultBackgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a standard toast that just contains a text view.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, null, defaultTintColor,
                defaultBackgroundColor, duration);
    }

    /**
     * Make a error toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeError(@NonNull Context context, @Nullable CharSequence text) {
        return make(context, text, errorIcon != null ? errorIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_error),
                generateTintColor(errorBackgroundColor, defaultTintColor), errorBackgroundColor);
    }

    /**
     * Make a error toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeError(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_error),
                generateTintColor(errorBackgroundColor, defaultTintColor),
                errorBackgroundColor, duration);
    }

    /**
     * Make a success toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeSuccess(@NonNull Context context,
            @Nullable CharSequence text) {
        return make(context, text, successIcon != null ? successIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_success),
                generateTintColor(successBackgroundColor, defaultTintColor), successBackgroundColor);
    }

    /**
     * Make a success toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeSuccess(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_success),
                generateTintColor(successBackgroundColor, defaultTintColor),
                successBackgroundColor, duration);
    }

    /**
     * Make a warning toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeWarning(@NonNull Context context,
            @Nullable CharSequence text) {
        return make(context, text, warningIcon != null ? warningIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_warning),
                generateTintColor(warningBackgroundColor, defaultTintColor), warningBackgroundColor);
    }

    /**
     * Make a warning toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeWarning(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_warning),
                generateTintColor(warningBackgroundColor, defaultTintColor),
                warningBackgroundColor, duration);
    }

    /**
     * Make a error toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, @Nullable Drawable icon) {
        return make(context, text, icon, defaultTintColor,
                defaultBackgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, int duration) {
        return make(context, text, icon, defaultTintColor, defaultBackgroundColor, duration);
    }

    /**
     * Make a themed toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor) {
        return make(context, text, null, tintColor, backgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with text, background and the tint color.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor, int duration) {
        return make(context, text, null, tintColor, backgroundColor, duration);
    }

    /**
     * Make a themed toast with text, icon, background and the tint color.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor) {
        return make(context, text, icon, tintColor, backgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with text, icon, background and the tint color.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor, int duration) {
        if (context instanceof Activity && ((Activity) context).isFinishing()) {
            context = context.getApplicationContext();
        }

        @Nullable @ColorInt Integer toastTintColor = tintColor;
        if (tintColor != null && backgroundColor != null) {
            toastTintColor = DynamicColorUtils.getContrastColor(toastTintColor, backgroundColor);
        }

        ToastCompat toast = new ToastCompat(context, new Toast(context));
        View toastLayout = LayoutInflater.from(context).inflate(
                R.layout.adt_layout_hint, new LinearLayout(context), false);
        ImageView toastIcon = toastLayout.findViewById(R.id.adt_hint_icon);
        TextView toastText = toastLayout.findViewById(R.id.adt_hint_text);

        if (!disableIcon && icon != null) {
            if (iconSize != ADT_DEFAULT_ICON_SIZE) {
                toastIcon.getLayoutParams().width = iconSize;
                toastIcon.getLayoutParams().height = iconSize;
                toastIcon.requestLayout();
            }

            if (tintIcon && toastTintColor != null) {
                toastIcon.setColorFilter(toastTintColor);
            } else {
                toastIcon.clearColorFilter();
            }
            toastIcon.setImageDrawable(icon);
        } else {
            toastIcon.setVisibility(View.GONE);
        }

        if (textTypeface != null) {
            toastText.setTypeface(textTypeface);
        }
        if (textSize != ADT_DEFAULT_TEXT_SIZE) {
            toastText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
        }

        if (toastTintColor != null) {
            toastText.setTextColor(toastTintColor);
        }
        toastText.setText(text);

        if (toastBackground != null) {
            DynamicDrawableUtils.setBackground(toastLayout, backgroundColor != null
                    ? DynamicDrawableUtils.colorizeDrawable(toastBackground,
                    backgroundColor, PorterDuff.Mode.MULTIPLY) : toastBackground);
        } else {
            DynamicDrawableUtils.setBackground(toastLayout, backgroundColor != null
                    ? DynamicDrawableUtils.colorizeDrawable(ContextCompat.getDrawable(context,
                    R.drawable.adt_hint_background), backgroundColor, PorterDuff.Mode.MULTIPLY)
                    : ContextCompat.getDrawable(context, R.drawable.adt_hint_background));
        }

        toast.setDuration(duration);
        toast.setView(toastLayout);

        return toast;
    }

    /**
     * Configuration class to customise the {@link DynamicHint} attributes.
     */
    public static class Config {

        /**
         * Singleton instance of {@link Config}.
         */
        private static Config sInstance;

        /**
         * Background color for the default toast.
         */
        private @ColorInt Integer defaultBackgroundColor = DynamicHint.defaultBackgroundColor;

        /**
         * Tint color for the default toast.
         */
        private @ColorInt Integer defaultTintColor = DynamicHint.defaultTintColor;

        /**
         * Background color for the error toast.
         */
        private @ColorInt Integer errorBackgroundColor = DynamicHint.errorBackgroundColor;

        /**
         * Background color for the success toast.
         */
        private @ColorInt Integer successBackgroundColor = DynamicHint.successBackgroundColor;

        /**
         * Background color for the warning toast.
         */
        private @ColorInt Integer warningBackgroundColor = DynamicHint.warningBackgroundColor;

        /**
         * Custom icon for the error toast.
         */
        private Drawable errorIcon = DynamicHint.errorIcon;

        /**
         * Custom icon for the success toast.
         */
        private Drawable successIcon = DynamicHint.successIcon;

        /**
         * Custom icon for the warning toast.
         */
        private Drawable warningIcon = DynamicHint.warningIcon;

        /**
         * {@code true} to disable icon for all the toasts.
         */
        private boolean disableIcon = DynamicHint.disableIcon;

        /**
         * {@code true} to tint icon for all the toasts.
         */
        private boolean tintIcon = DynamicHint.tintIcon;

        /**
         * Icon size for the toast in pixels.
         */
        private int iconSize = DynamicHint.iconSize;

        /**
         * Text size for the toast in SP.
         *
         * @see TypedValue#COMPLEX_UNIT_SP;
         */
        private @ColorInt int textSize = DynamicHint.textSize;

        /**
         * Custom text typeface used by the toast.
         */
        private Typeface textTypeface = null;

        /**
         * Custom background used by the toast.
         */
        private Drawable toastBackground = null;

        /**
         * Making default constructor private to avoid instantiation.
         */
        private Config() { }

        /**
         * Get instance to access public methods. Must be called before accessing methods.
         *
         * @return The singleton instance of this class.
         */
        public static @NonNull Config getInstance() {
            if (sInstance == null) {
                sInstance = new Config();
            }

            return sInstance;
        }

        /**
         * Set the default background color.
         *
         * @param defaultBackgroundColor The background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDefaultBackgroundColor(
                @Nullable @ColorInt Integer defaultBackgroundColor) {
            this.defaultBackgroundColor = defaultBackgroundColor;

            return this;
        }

        /**
         * Set the default tint color.
         *
         * @param defaultTintColor The tint color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDefaultTintColor(@Nullable @ColorInt Integer defaultTintColor) {
            this.defaultTintColor = defaultTintColor;

            return this;
        }

        /**
         * Set the error background color.
         *
         * @param errorBackgroundColor The error background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setErrorBackgroundColor(
                @Nullable @ColorInt Integer errorBackgroundColor) {
            this.errorBackgroundColor = errorBackgroundColor;

            return this;
        }

        /**
         * Set the success background color.
         *
         * @param successBackgroundColor The success background color
         *         to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setSuccessBackgroundColor(
                @Nullable @ColorInt Integer successBackgroundColor) {
            this.successBackgroundColor = successBackgroundColor;

            return this;
        }

        /**
         * Set the warning background color.
         *
         * @param warningBackgroundColor The warning background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setWarningBackgroundColor(
                @Nullable @ColorInt Integer warningBackgroundColor) {
            this.warningBackgroundColor = warningBackgroundColor;

            return this;
        }

        /**
         * Set the error icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param errorIcon The error icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setErrorIcon(@Nullable Drawable errorIcon) {
            this.errorIcon = errorIcon;

            return this;
        }

        /**
         * Set the success icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param successIcon The success icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setSuccessIcon(@Nullable Drawable successIcon) {
            this.successIcon = successIcon;

            return this;
        }

        /**
         * Set the warning icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param warningIcon The warning icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setWarningIcon(@Nullable Drawable warningIcon) {
            this.warningIcon = warningIcon;

            return this;
        }

        /**
         * Set the icon visibility.
         *
         * @param disableIcon {@code true} to disable icon for all the toasts.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDisableIcon(boolean disableIcon) {
            this.disableIcon = disableIcon;

            return this;
        }

        /**
         * Set whether to tint the icon.
         *
         * @param tintIcon {@code true} to tint icon for all the toasts.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTintIcon(boolean tintIcon) {
            this.tintIcon = tintIcon;

            return this;
        }

        /**
         * Set the icon size.
         *
         * @param iconSize The icon size to be set in {@code pixels}.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setIconSize(int iconSize) {
            this.iconSize = iconSize;

            return this;
        }

        /**
         * Set the text size.
         *
         * @param textSize The text size to be set in {@code sp}.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTextSize(int textSize) {
            this.textSize = textSize;

            return this;
        }

        /**
         * Set the text typeface.
         * <p>Pass {@code null} to use the default typeface.
         *
         * @param textTypeface The text typeface to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTextTypeface(@Nullable Typeface textTypeface) {
            this.textTypeface = textTypeface;

            return this;
        }

        /**
         * Set the toast background.
         * <p>Pass {@code null} to use the default background.
         *
         * @param toastBackground The toast background to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setToastBackground(@Nullable Drawable toastBackground) {
            this.toastBackground = toastBackground;

            return this;
        }

        /**
         * Apply customisations.
         */
        public void apply() {
            DynamicHint.defaultBackgroundColor = defaultBackgroundColor;
            DynamicHint.defaultTintColor = defaultTintColor;
            DynamicHint.errorBackgroundColor = errorBackgroundColor;
            DynamicHint.successBackgroundColor = successBackgroundColor;
            DynamicHint.warningBackgroundColor = warningBackgroundColor;
            DynamicHint.errorIcon = errorIcon;
            DynamicHint.successIcon = successIcon;
            DynamicHint.warningIcon = warningIcon;
            DynamicHint.disableIcon = disableIcon;
            DynamicHint.tintIcon = tintIcon;
            DynamicHint.iconSize = iconSize;
            DynamicHint.textSize = textSize;
            DynamicHint.textTypeface = textTypeface;
            DynamicHint.toastBackground = toastBackground;

            sInstance = null;
        }

        /**
         * Reset customisations.
         */
        public void reset() {
            DynamicHint.defaultBackgroundColor = ADT_DEFAULT_BG_COLOR;
            DynamicHint.defaultTintColor = ADT_DEFAULT_TINT_COLOR;
            DynamicHint.errorBackgroundColor = ADT_DEFAULT_ERROR_BG_COLOR;
            DynamicHint.successBackgroundColor = ADT_DEFAULT_SUCCESS_BG_COLOR;
            DynamicHint.warningBackgroundColor = ADT_DEFAULT_WARNING_BG_COLOR;
            DynamicHint.errorIcon = null;
            DynamicHint.successIcon = null;
            DynamicHint.warningIcon = null;
            DynamicHint.disableIcon = ADT_DEFAULT_DISABLE_ICON;
            DynamicHint.tintIcon = ADT_DEFAULT_TINT_ICON;
            DynamicHint.iconSize = ADT_DEFAULT_ICON_SIZE;
            DynamicHint.textSize = ADT_DEFAULT_TEXT_SIZE;
            DynamicHint.textTypeface = null;
            DynamicHint.toastBackground = null;

            sInstance = null;
        }
    }

    /**
     * Show toast above or below according to the anchor view position.
     *
     * @param anchor The anchor view to show the toast.
     * @param toast The toast to be displayed.
     */
    public static void show(@NonNull View anchor, @NonNull Toast toast) {
        show(anchor, toast, ADT_TOAST_OFFSET);
    }

    /**
     * Show toast above or below according to the anchor view position.
     *
     * @param anchor The anchor view to show the toast.
     * @param toast The toast to be displayed.
     * @param offset The toast vertical offset in dips.
     */
    @SuppressWarnings("deprecation")
    public static void show(@NonNull View anchor, @NonNull Toast toast, int offset) {
        Rect displayFrame = new Rect();
        int[] screenLocation = new int[2];
        anchor.getWindowVisibleDisplayFrame(displayFrame);
        anchor.getLocationOnScreen(screenLocation);
        int anchorLeft = screenLocation[0];
        int anchorTop = Math.max(0, screenLocation[1]
                - DynamicUnitUtils.convertDpToPixels(ADT_INSET_TOP));
        int minAnchorHeight = DynamicUnitUtils.convertDpToPixels(ADT_MIN_ANCHOR_HEIGHT);
        int yOffset = DynamicUnitUtils.convertDpToPixels(offset);

        DisplayMetrics metrics = anchor.getResources().getDisplayMetrics();
        int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(
                metrics.widthPixels, View.MeasureSpec.UNSPECIFIED);
        int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(
                metrics.heightPixels, View.MeasureSpec.UNSPECIFIED);
        int toastWidth = DynamicUnitUtils.convertDpToPixels(ADT_MIN_ANCHOR_HEIGHT);

        if (toast.getView() != null) {
            toast.getView().measure(widthMeasureSpec, heightMeasureSpec);
            toastWidth = toast.getView().getMeasuredWidth();
        }

        if (anchorTop < displayFrame.top + yOffset) {
            toast.setGravity(Gravity.START | Gravity.TOP,
                    anchorLeft + (anchor.getWidth() - toastWidth) / 2,
                    anchorTop + Math.max(minAnchorHeight, anchor.getHeight()) + yOffset);
        } else {
            toast.setGravity(Gravity.START | Gravity.TOP,
                    anchorLeft + (anchor.getWidth() - toastWidth) / 2,
                    anchorTop - Math.max(minAnchorHeight, anchor.getHeight()) - yOffset);
        }

        toast.show();
    }
}


================================================
FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicToast.java
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.pranavpandey.android.dynamic.toasts.internal.ToastCompat;
import com.pranavpandey.android.dynamic.util.DynamicColorUtils;
import com.pranavpandey.android.dynamic.util.DynamicDrawableUtils;

/**
 * Helper class to display themed {@link Toast} with icon and text.
 * <p>If no color is supplied, it will display default toast based on the vanilla Android.
 */
public class DynamicToast {

    /**
     * Default background color for the toast.
     */
    private static final @ColorInt int ADT_DEFAULT_BG_COLOR =
            Color.parseColor("#454545");

    /**
     * Default tint color for the toast.
     */
    private static final @ColorInt int ADT_DEFAULT_TINT_COLOR =
            Color.parseColor("#FFFFFF");

    /**
     * Default background color for the error toast.
     */
    private static final @ColorInt int ADT_DEFAULT_ERROR_BG_COLOR =
            Color.parseColor("#F44336");

    /**
     * Default background color for the success toast.
     */
    private static final @ColorInt int ADT_DEFAULT_SUCCESS_BG_COLOR =
            Color.parseColor("#4CAF50");

    /**
     * Default background color for the warning toast.
     */
    private static final @ColorInt int ADT_DEFAULT_WARNING_BG_COLOR =
            Color.parseColor("#FFEB3B");

    /**
     * Default value for the {@link #disableIcon}.
     * <p>{@code false} to enable the toast icon.
     */
    private static final boolean ADT_DEFAULT_DISABLE_ICON = false;

    /**
     * Default value for the {@link #tintIcon}.
     * <p>{@code true} to tint the toast icon.
     */
    private static final boolean ADT_DEFAULT_TINT_ICON = true;

    /**
     * Default icon size for the toast in pixels.
     * <p>{@code -1} to use in-built icon size.
     */
    private static final @ColorInt int ADT_DEFAULT_ICON_SIZE = -1;

    /**
     * Default text size for the toast in SP.
     * <p>{@code -1} to use system text size.
     *
     * @see TypedValue#COMPLEX_UNIT_SP;
     */
    private static final @ColorInt int ADT_DEFAULT_TEXT_SIZE = -1;

    /**
     * Background color for the default toast.
     */
    private static @Nullable @ColorInt Integer defaultBackgroundColor = ADT_DEFAULT_BG_COLOR;

    /**
     * Tint color for the default toast.
     */
    private static @Nullable @ColorInt Integer defaultTintColor = ADT_DEFAULT_TINT_COLOR;

    /**
     * Background color for the error toast.
     */
    private static @Nullable @ColorInt Integer errorBackgroundColor = ADT_DEFAULT_ERROR_BG_COLOR;

    /**
     * Background color for the success toast.
     */
    private static @Nullable @ColorInt Integer successBackgroundColor =
            ADT_DEFAULT_SUCCESS_BG_COLOR;

    /**
     * Background color for the warning toast.
     */
    private static @Nullable @ColorInt Integer warningBackgroundColor =
            ADT_DEFAULT_WARNING_BG_COLOR;

    /**
     * Custom icon for the error toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable errorIcon = null;

    /**
     * Custom icon for the success toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable successIcon = null;

    /**
     * Custom icon for the warning toast.
     * <p>{@code null} to use the default icon.
     */
    private static Drawable warningIcon = null;

    /**
     * {@code true} to disable icon for all the toasts.
     */
    private static boolean disableIcon = ADT_DEFAULT_DISABLE_ICON;

    /**
     * {@code true} to tint icon for all the toasts.
     */
    private static boolean tintIcon = ADT_DEFAULT_TINT_ICON;

    /**
     * Icon size for the toast in pixels.
     */
    private static int iconSize = ADT_DEFAULT_ICON_SIZE;

    /**
     * Text size for the toast in SP.
     *
     * @see TypedValue#COMPLEX_UNIT_SP;
     */
    private static int textSize = ADT_DEFAULT_TEXT_SIZE;

    /**
     * Custom typeface used by the toast.
     * <p>{@code null} to use the system typeface.
     */
    private static Typeface textTypeface = null;

    /**
     * Custom background used by the toast.
     * <p>{@code null} to use the default background.
     */
    private static Drawable toastBackground = null;

    /**
     * Generate tint color according to the supplied color, otherwise return the default value.
     *
     * @param color The color to be used to generate the tint color.
     * @param defaultColor The default value for the tint color.
     *
     * @return The generated tint color according to the supplied color, otherwise return the
     *         default value.
     */
    private static @Nullable @ColorInt Integer generateTintColor(
            @Nullable @ColorInt Integer color, @Nullable @ColorInt Integer defaultColor) {
        if (color != null) {
            return DynamicColorUtils.getTintColor(color);
        }

        return defaultColor;
    }

    /**
     * Make a standard toast that just contains a text view.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text) {
        return make(context, text, null, defaultTintColor,
                defaultBackgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a standard toast that just contains a text view.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, null, defaultTintColor,
                defaultBackgroundColor, duration);
    }

    /**
     * Make a error toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeError(@NonNull Context context, @Nullable CharSequence text) {
        return make(context, text, errorIcon != null ? errorIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_error),
                generateTintColor(errorBackgroundColor, defaultTintColor), errorBackgroundColor);
    }

    /**
     * Make a error toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeError(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_error),
                generateTintColor(errorBackgroundColor, defaultTintColor),
                errorBackgroundColor, duration);
    }

    /**
     * Make a success toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeSuccess(@NonNull Context context,
            @Nullable CharSequence text) {
        return make(context, text, successIcon != null ? successIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_success),
                generateTintColor(successBackgroundColor, defaultTintColor), successBackgroundColor);
    }

    /**
     * Make a success toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeSuccess(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_success),
                generateTintColor(successBackgroundColor, defaultTintColor),
                successBackgroundColor, duration);
    }

    /**
     * Make a warning toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeWarning(@NonNull Context context,
            @Nullable CharSequence text) {
        return make(context, text, warningIcon != null ? warningIcon
                        : ContextCompat.getDrawable(context, R.drawable.adt_ic_warning),
                generateTintColor(warningBackgroundColor, defaultTintColor), warningBackgroundColor);
    }

    /**
     * Make a warning toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast makeWarning(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        return make(context, text, ContextCompat.getDrawable(context, R.drawable.adt_ic_warning),
                generateTintColor(warningBackgroundColor, defaultTintColor),
                warningBackgroundColor, duration);
    }

    /**
     * Make a error toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, @Nullable Drawable icon) {
        return make(context, text, icon, defaultTintColor,
                defaultBackgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with icon and the text.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, int duration) {
        return make(context, text, icon, defaultTintColor, defaultBackgroundColor, duration);
    }

    /**
     * Make a themed toast with icon and the text.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable @ColorInt Integer tintColor, @Nullable @ColorInt Integer backgroundColor) {
        return make(context, text, null, tintColor, backgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with text, background and the tint color.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context,
            @Nullable CharSequence text, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor, int duration) {
        return make(context, text, null, tintColor, backgroundColor, duration);
    }

    /**
     * Make a themed toast with text, icon, background and the tint color.
     * <p>The toast duration will be {@link Toast#LENGTH_SHORT}.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor) {
        return make(context, text, icon, tintColor, backgroundColor, Toast.LENGTH_SHORT);
    }

    /**
     * Make a themed toast with text, icon, background and the tint color.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param icon The toast icon to show.
     * @param tintColor The toast tint color based on the toast background.
     *                  <p>It will automatically check for the contrast to provide the
     *                  best visibility.
     * @param backgroundColor The toast background color.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The toast with the supplied parameters.
     *         <p>Use {@link Toast#show()} to display the toast.
     */
    public static @NonNull Toast make(@NonNull Context context, @Nullable CharSequence text,
            @Nullable Drawable icon, @Nullable @ColorInt Integer tintColor,
            @Nullable @ColorInt Integer backgroundColor, int duration) {
        if (context instanceof Activity && ((Activity) context).isFinishing()) {
            context = context.getApplicationContext();
        }

        @Nullable @ColorInt Integer toastTintColor = tintColor;
        if (tintColor != null && backgroundColor != null) {
            toastTintColor = DynamicColorUtils.getContrastColor(toastTintColor, backgroundColor);
        }

        ToastCompat toast = new ToastCompat(context, new Toast(context));
        View toastLayout = LayoutInflater.from(context).inflate(
                R.layout.adt_layout_toast, new LinearLayout(context), false);
        ImageView toastIcon = toastLayout.findViewById(R.id.adt_toast_icon);
        TextView toastText = toastLayout.findViewById(R.id.adt_toast_text);

        if (!disableIcon && icon != null) {
            if (iconSize != ADT_DEFAULT_ICON_SIZE) {
                toastIcon.getLayoutParams().width = iconSize;
                toastIcon.getLayoutParams().height = iconSize;
                toastIcon.requestLayout();
            }

            if (tintIcon && toastTintColor != null) {
                toastIcon.setColorFilter(toastTintColor);
            } else {
                toastIcon.clearColorFilter();
            }
            toastIcon.setImageDrawable(icon);
        } else {
            toastIcon.setVisibility(View.GONE);
        }

        if (textTypeface != null) {
            toastText.setTypeface(textTypeface);
        }
        if (textSize != ADT_DEFAULT_TEXT_SIZE) {
            toastText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
        }

        if (toastTintColor != null) {
            toastText.setTextColor(toastTintColor);
        }
        toastText.setText(text);

        if (toastBackground != null) {
            DynamicDrawableUtils.setBackground(toastLayout, backgroundColor != null
                    ? DynamicDrawableUtils.colorizeDrawable(toastBackground,
                    backgroundColor, PorterDuff.Mode.MULTIPLY) : toastBackground);
        } else {
            DynamicDrawableUtils.setBackground(toastLayout, backgroundColor != null
                    ? DynamicDrawableUtils.colorizeDrawable(ContextCompat.getDrawable(context,
                    R.drawable.adt_toast_background), backgroundColor, PorterDuff.Mode.MULTIPLY)
                    : ContextCompat.getDrawable(context, R.drawable.adt_toast_background));
        }

        toast.setDuration(duration);
        toast.setView(toastLayout);

        return toast;
    }

    /**
     * Configuration class to customise the {@link DynamicToast} attributes.
     */
    public static class Config {

        /**
         * Singleton instance of {@link Config}.
         */
        private static Config sInstance;

        /**
         * Background color for the default toast.
         */
        private @ColorInt Integer defaultBackgroundColor = DynamicToast.defaultBackgroundColor;

        /**
         * Tint color for the default toast.
         */
        private @ColorInt Integer defaultTintColor = DynamicToast.defaultTintColor;

        /**
         * Background color for the error toast.
         */
        private @ColorInt Integer errorBackgroundColor = DynamicToast.errorBackgroundColor;

        /**
         * Background color for the success toast.
         */
        private @ColorInt Integer successBackgroundColor = DynamicToast.successBackgroundColor;

        /**
         * Background color for the warning toast.
         */
        private @ColorInt Integer warningBackgroundColor = DynamicToast.warningBackgroundColor;

        /**
         * Custom icon for the error toast.
         */
        private Drawable errorIcon = DynamicToast.errorIcon;

        /**
         * Custom icon for the success toast.
         */
        private Drawable successIcon = DynamicToast.successIcon;

        /**
         * Custom icon for the warning toast.
         */
        private Drawable warningIcon = DynamicToast.warningIcon;

        /**
         * {@code true} to disable icon for all the toasts.
         */
        private boolean disableIcon = DynamicToast.disableIcon;

        /**
         * {@code true} to tint icon for all the toasts.
         */
        private boolean tintIcon = DynamicToast.tintIcon;

        /**
         * Icon size for the toast in pixels.
         */
        private int iconSize = DynamicToast.iconSize;

        /**
         * Text size for the toast in SP.
         *
         * @see TypedValue#COMPLEX_UNIT_SP;
         */
        private @ColorInt int textSize = DynamicToast.textSize;

        /**
         * Custom text typeface used by the toast.
         */
        private Typeface textTypeface = null;

        /**
         * Custom background used by the toast.
         */
        private Drawable toastBackground = null;

        /**
         * Making default constructor private to avoid instantiation.
         */
        private Config() { }

        /**
         * Get instance to access public methods. Must be called before accessing methods.
         *
         * @return The singleton instance of this class.
         */
        public static @NonNull Config getInstance() {
            if (sInstance == null) {
                sInstance = new Config();
            }

            return sInstance;
        }

        /**
         * Set the default background color.
         *
         * @param defaultBackgroundColor The background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDefaultBackgroundColor(
                @Nullable @ColorInt Integer defaultBackgroundColor) {
            this.defaultBackgroundColor = defaultBackgroundColor;

            return this;
        }

        /**
         * Set the default tint color.
         *
         * @param defaultTintColor The tint color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDefaultTintColor(@Nullable @ColorInt Integer defaultTintColor) {
            this.defaultTintColor = defaultTintColor;

            return this;
        }

        /**
         * Set the error background color.
         *
         * @param errorBackgroundColor The error background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setErrorBackgroundColor(
                @Nullable @ColorInt Integer errorBackgroundColor) {
            this.errorBackgroundColor = errorBackgroundColor;

            return this;
        }

        /**
         * Set the success background color.
         *
         * @param successBackgroundColor The success background color
         *         to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setSuccessBackgroundColor(
                @Nullable @ColorInt Integer successBackgroundColor) {
            this.successBackgroundColor = successBackgroundColor;

            return this;
        }

        /**
         * Set the warning background color.
         *
         * @param warningBackgroundColor The warning background color to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setWarningBackgroundColor(
                @Nullable @ColorInt Integer warningBackgroundColor) {
            this.warningBackgroundColor = warningBackgroundColor;

            return this;
        }

        /**
         * Set the error icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param errorIcon The error icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setErrorIcon(@Nullable Drawable errorIcon) {
            this.errorIcon = errorIcon;

            return this;
        }

        /**
         * Set the success icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param successIcon The success icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setSuccessIcon(@Nullable Drawable successIcon) {
            this.successIcon = successIcon;

            return this;
        }

        /**
         * Set the warning icon.
         * <p>Pass {@code null} to use the default icon.
         *
         * @param warningIcon The warning icon to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setWarningIcon(@Nullable Drawable warningIcon) {
            this.warningIcon = warningIcon;

            return this;
        }

        /**
         * Set the icon visibility.
         *
         * @param disableIcon {@code true} to disable icon for all the toasts.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setDisableIcon(boolean disableIcon) {
            this.disableIcon = disableIcon;

            return this;
        }

        /**
         * Set whether to tint the icon.
         *
         * @param tintIcon {@code true} to tint icon for all the toasts.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTintIcon(boolean tintIcon) {
            this.tintIcon = tintIcon;

            return this;
        }

        /**
         * Set the icon size.
         *
         * @param iconSize The icon size to be set in {@code pixels}.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setIconSize(int iconSize) {
            this.iconSize = iconSize;

            return this;
        }

        /**
         * Set the text size.
         *
         * @param textSize The text size to be set in {@code sp}.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTextSize(int textSize) {
            this.textSize = textSize;

            return this;
        }

        /**
         * Set the text typeface.
         * <p>Pass {@code null} to use the default typeface.
         *
         * @param textTypeface The text typeface to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setTextTypeface(@Nullable Typeface textTypeface) {
            this.textTypeface = textTypeface;

            return this;
        }

        /**
         * Set the toast background.
         * <p>Pass {@code null} to use the default background.
         *
         * @param toastBackground The toast background to be set.
         *
         * @return The {@link Config} object to allow for chaining of calls to set methods.
         */
        public @NonNull Config setToastBackground(@Nullable Drawable toastBackground) {
            this.toastBackground = toastBackground;

            return this;
        }

        /**
         * Apply customisations.
         */
        public void apply() {
            DynamicToast.defaultBackgroundColor = defaultBackgroundColor;
            DynamicToast.defaultTintColor = defaultTintColor;
            DynamicToast.errorBackgroundColor = errorBackgroundColor;
            DynamicToast.successBackgroundColor = successBackgroundColor;
            DynamicToast.warningBackgroundColor = warningBackgroundColor;
            DynamicToast.errorIcon = errorIcon;
            DynamicToast.successIcon = successIcon;
            DynamicToast.warningIcon = warningIcon;
            DynamicToast.disableIcon = disableIcon;
            DynamicToast.tintIcon = tintIcon;
            DynamicToast.iconSize = iconSize;
            DynamicToast.textSize = textSize;
            DynamicToast.textTypeface = textTypeface;
            DynamicToast.toastBackground = toastBackground;

            sInstance = null;
        }

        /**
         * Reset customisations.
         */
        public void reset() {
            DynamicToast.defaultBackgroundColor = ADT_DEFAULT_BG_COLOR;
            DynamicToast.defaultTintColor = ADT_DEFAULT_TINT_COLOR;
            DynamicToast.errorBackgroundColor = ADT_DEFAULT_ERROR_BG_COLOR;
            DynamicToast.successBackgroundColor = ADT_DEFAULT_SUCCESS_BG_COLOR;
            DynamicToast.warningBackgroundColor = ADT_DEFAULT_WARNING_BG_COLOR;
            DynamicToast.errorIcon = null;
            DynamicToast.successIcon = null;
            DynamicToast.warningIcon = null;
            DynamicToast.disableIcon = ADT_DEFAULT_DISABLE_ICON;
            DynamicToast.tintIcon = ADT_DEFAULT_TINT_ICON;
            DynamicToast.iconSize = ADT_DEFAULT_ICON_SIZE;
            DynamicToast.textSize = ADT_DEFAULT_TEXT_SIZE;
            DynamicToast.textTypeface = null;
            DynamicToast.toastBackground = null;

            sInstance = null;
        }
    }
}


================================================
FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastCompat.java
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts.internal;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;

import com.pranavpandey.android.dynamic.util.DynamicSdkUtils;

import java.lang.reflect.Field;

/**
 * A Toast to fix the bad token exception on API 25.
 */
@SuppressWarnings("deprecation")
public final class ToastCompat extends Toast {

    /**
     * Base toast used by this toast compat.
     */
    private final @NonNull Toast mToast;

    public ToastCompat(Context context, @NonNull Toast base) {
        super(context);

        this.mToast = base;
    }

    /**
     * Make a standard toast that just contains a text view.
     *
     * @param context The context to use.
     * @param text The text to show. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The standard toast that just contains a text view.
     */
    @SuppressLint("ShowToast")
    public static ToastCompat makeText(@NonNull Context context,
            @Nullable CharSequence text, int duration) {
        Toast toast = Toast.makeText(context, text, duration);
        setToastContext(toast.getView(), new ToastContext(context, toast));
        return new ToastCompat(context, toast);
    }

    /**
     * Make a standard toast that just contains a text view.
     *
     * @param context The context to use.
     * @param resId The resource id of the string resource to use. Can be formatted text.
     * @param duration The duration for the toast, either {@link Toast#LENGTH_SHORT}
     *                 or {@link Toast#LENGTH_LONG}.
     *
     * @return The standard toast that just contains a text view.
     */
    public static Toast makeText(@NonNull Context context, @StringRes int resId, int duration)
            throws Resources.NotFoundException {
        return makeText(context, context.getResources().getText(resId), duration);
    }

    /**
     * Sets the toast context to fix bad token exception.
     *
     * @param view The view used by the toast
     * @param context The context used by the toast.
     */
    @SuppressLint("DiscouragedPrivateApi")
    private static void setToastContext(@Nullable View view, @NonNull Context context) {
        if (view != null && DynamicSdkUtils.is25()) {
            try {
                Field field = View.class.getDeclaredField("mContext");
                field.setAccessible(true);
                field.set(view, context);
            } catch (Throwable throwable) {
                throwable.printStackTrace();
            }
        }
    }

    @Override
    public void show() {
        mToast.show();
    }

    @Override
    public void setDuration(int duration) {
        mToast.setDuration(duration);
    }

    @Override
    public void setGravity(int gravity, int xOffset, int yOffset) {
        mToast.setGravity(gravity, xOffset, yOffset);
    }

    @Override
    public void setMargin(float horizontalMargin, float verticalMargin) {
        mToast.setMargin(horizontalMargin, verticalMargin);
    }

    @Override
    public void setText(int resId) {
        mToast.setText(resId);
    }

    @Override
    public void setText(CharSequence s) {
        mToast.setText(s);
    }

    @Override
    public void setView(View view) {
        mToast.setView(view);
        setToastContext(view, new ToastContext(view.getContext(), this));
    }

    @Override
    public float getHorizontalMargin() {
        return mToast.getHorizontalMargin();
    }

    @Override
    public float getVerticalMargin() {
        return mToast.getVerticalMargin();
    }

    @Override
    public int getDuration() {
        return mToast.getDuration();
    }

    @Override
    public int getGravity() {
        return mToast.getGravity();
    }

    @Override
    public int getXOffset() {
        return mToast.getXOffset();
    }

    @Override
    public int getYOffset() {
        return mToast.getYOffset();
    }

    @Override
    public @Nullable View getView() {
        return mToast.getView();
    }

    public @NonNull Toast getToast() {
        return mToast;
    }
}


================================================
FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastContext.java
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts.internal;

import android.content.Context;
import android.content.ContextWrapper;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * A ContextWrapper to fix bad token exception.
 */
public final class ToastContext extends ContextWrapper {

    /**
     * Boast used by this context wrapper.
     */
    private @NonNull Toast toast;

    /**
     * Constructor to initialize an object of this class.
     *
     * @param base The base context for this wrapper.
     * @param toast The toast for this wrapper.
     */
    public ToastContext(@NonNull Context base, @NonNull Toast toast) {
        super(base);

        this.toast = toast;
    }

    @Override
    public Context getApplicationContext() {
        return new ApplicationContextWrapper(getBaseContext().getApplicationContext());
    }

    /**
     * A ContextWrapper to initialize window manager service.
     */
    static final class ApplicationContextWrapper extends ContextWrapper {

        /**
         * Constructor to initialize an object of this class.
         *
         * @param base The base context for this wrapper.
         */
        private ApplicationContextWrapper(@NonNull Context base) {
            super(base);
        }

        @Override
        public Object getSystemService(@NonNull String name) {
            @Nullable Object service = null;
            if (Context.WINDOW_SERVICE.equals(name)) {
                service = getBaseContext().getSystemService(name);
            }

            if (service != null) {
                return new WindowManagerWrapper((WindowManager) service);
            }

            return super.getSystemService(name);
        }
    }

    /**
     * A WindowManager to fix the bad token exception.
     */
    @SuppressWarnings("deprecation")
    static final class WindowManagerWrapper implements WindowManager {

        /**
         * The base window manager used by this wrapper.
         */
        private final @NonNull WindowManager base;

        /**
         * Constructor to initialize an object of this class.
         *
         * @param base The base window manager for this wrapper.
         */
        private WindowManagerWrapper(@NonNull WindowManager base) {
            this.base = base;
        }

        @Override
        public Display getDefaultDisplay() {
            return base.getDefaultDisplay();
        }

        @Override
        public void removeViewImmediate(View view) {
            base.removeViewImmediate(view);
        }

        @Override
        public void addView(View view, ViewGroup.LayoutParams params) {
            try {
                base.addView(view, params);
            } catch (BadTokenException e) {
                e.printStackTrace();
            } catch (Throwable throwable) {
                throwable.printStackTrace();
            }
        }

        @Override
        public void updateViewLayout(View view, ViewGroup.LayoutParams params) {
            base.updateViewLayout(view, params);
        }

        @Override
        public void removeView(View view) {
            base.removeView(view);
        }
    }
}


================================================
FILE: dynamic-toasts/src/main/res/drawable/adt_hint_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item>

        <shape android:dither="true">

            <corners android:radius="2dp" />

            <gradient
                android:angle="90"
                android:endColor="#00000000"
                android:startColor="#10000000" />

        </shape>

    </item>

    <item
        android:top="2dp"
        android:left="2dp"
        android:bottom="2dp"
        android:right="2dp">

        <shape>

            <solid android:color="#EFFFFFFF" />

            <corners android:radius="2dp" />

        </shape>

    </item>

</layer-list>


================================================
FILE: dynamic-toasts/src/main/res/drawable/adt_toast_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item>

        <shape android:dither="true">

            <corners android:radius="32dp" />

            <gradient
                android:angle="90"
                android:endColor="#00000000"
                android:startColor="#10000000" />

        </shape>

    </item>

    <item
        android:top="2dp"
        android:left="2dp"
        android:bottom="2dp"
        android:right="2dp">

        <shape>

            <solid android:color="#EFFFFFFF" />

            <corners android:radius="32dp" />

        </shape>

    </item>

</layer-list>


================================================
FILE: dynamic-toasts/src/main/res/layout/adt_layout_hint.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/adt_hint"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/adt_margin_hint_top_bottom"
        android:paddingBottom="@dimen/adt_margin_hint_top_bottom"
        android:paddingLeft="@dimen/adt_margin_hint_right_left"
        android:paddingRight="@dimen/adt_margin_hint_right_left"
        android:orientation="horizontal"
        android:gravity="center"
        android:background="@android:color/transparent">

        <ImageView
            android:id="@+id/adt_hint_icon"
            android:layout_width="@dimen/adt_icon_hint"
            android:layout_height="@dimen/adt_icon_hint"
            android:layout_marginRight="@dimen/adt_margin_hint_small"
            android:layout_marginEnd="@dimen/adt_margin_hint_small"
            android:contentDescription="@null" />

        <TextView
            android:id="@+id/adt_hint_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAlignment="viewStart"
            android:gravity="start"
            android:textSize="@dimen/adt_font_hint" />

    </LinearLayout>

</FrameLayout>


================================================
FILE: dynamic-toasts/src/main/res/layout/adt_layout_toast.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/adt_hint"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent">

    <LinearLayout
        android:id="@+id/adt_toast"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/adt_margin_toast_top_bottom"
        android:paddingBottom="@dimen/adt_margin_toast_top_bottom"
        android:paddingLeft="@dimen/adt_margin_toast_right_left"
        android:paddingRight="@dimen/adt_margin_toast_right_left"
        android:orientation="horizontal"
        android:gravity="center"
        android:background="@android:color/transparent">

        <ImageView
            android:id="@+id/adt_toast_icon"
            android:layout_width="@dimen/adt_icon_toast"
            android:layout_height="@dimen/adt_icon_toast"
            android:layout_marginRight="@dimen/adt_margin_toast_small"
            android:layout_marginEnd="@dimen/adt_margin_toast_small"
            android:contentDescription="@null" />

        <TextView
            android:id="@+id/adt_toast_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAlignment="viewStart"
            android:gravity="start"
            android:textSize="@dimen/adt_font_toast" />

    </LinearLayout>

</FrameLayout>


================================================
FILE: dynamic-toasts/src/main/res/values/dimens.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<resources>

    <!-- Toast dimensions -->
    <dimen name="adt_font_toast">15sp</dimen>
    <dimen name="adt_icon_toast">24dp</dimen>
    <dimen name="adt_margin_toast_top_bottom">12dp</dimen>
    <dimen name="adt_margin_toast_right_left">16dp</dimen>
    <dimen name="adt_margin_toast_small">8dp</dimen>

    <!-- Hint dimensions -->
    <dimen name="adt_font_hint">13sp</dimen>
    <dimen name="adt_icon_hint">20dp</dimen>
    <dimen name="adt_margin_hint_top_bottom">8dp</dimen>
    <dimen name="adt_margin_hint_right_left">12dp</dimen>
    <dimen name="adt_margin_hint_small">4dp</dimen>

</resources>


================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Thu Jan 28 10:36:42 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip


================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.nonTransitiveRClass=false


================================================
FILE: gradlew
================================================
#!/usr/bin/env bash

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
    echo "$*"
}

die ( ) {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
    JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"


================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: sample/build.gradle
================================================
/*
 * Copyright 2017-2023 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion versions.buildTools
    namespace 'com.pranavpandey.android.dynamic.toasts.sample'

    defaultConfig {
        applicationId "com.pranavpandey.android.dynamic.toasts.sample"
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
        versionCode sampleVersionCode
        versionName mavenVersion

        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

dependencies {
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:${versions.kotlin}"))

    implementation project(':dynamic-toasts')
    implementation "com.pranavpandey.android:dynamic-dialogs:${versions.dialogs}"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
    implementation "androidx.constraintlayout:constraintlayout:${versions.constraintlayout}"
    implementation "com.google.android.flexbox:flexbox:${versions.flexbox}"
}


================================================
FILE: sample/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ANDROID_HOME/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile


================================================
FILE: sample/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android">

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" />
        </intent>
    </queries>

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:supportsRtl="true">

        <meta-data android:name="android.max_aspect" android:value="2.1" />

        <activity
            android:name=".DynamicToastsActivity"
            android:theme="@style/AppTheme.NoActionBar"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>


================================================
FILE: sample/src/main/java/com/pranavpandey/android/dynamic/toasts/sample/DynamicToastsActivity.kt
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts.sample

import android.content.res.Configuration
import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.content.res.AppCompatResources
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.pranavpandey.android.dynamic.toasts.DynamicHint
import com.pranavpandey.android.dynamic.toasts.DynamicToast
import com.pranavpandey.android.dynamic.toasts.sample.dialog.AboutDialogFragment
import com.pranavpandey.android.dynamic.util.DynamicColorUtils
import com.pranavpandey.android.dynamic.util.DynamicLinkUtils
import com.pranavpandey.android.dynamic.util.DynamicPackageUtils
import com.pranavpandey.android.dynamic.util.DynamicUnitUtils

/**
 * Main activity to show the implementation of [DynamicToast].
 */
class DynamicToastsActivity : AppCompatActivity(), View.OnClickListener {

    companion object {

        /**
         * Open source repository url.
         */
        const val URL_GITHUB = "https://github.com/pranavpandey/dynamic-toasts"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_dynamic_toasts)
        val toolbar = findViewById<Toolbar>(R.id.toolbar)
        toolbar.setSubtitle(R.string.app_name_sample)
        setSupportActionBar(toolbar)

        val fab = findViewById<FloatingActionButton>(R.id.fab)
        fab.setColorFilter(DynamicColorUtils.getTintColor(
                ContextCompat.getColor(this, R.color.color_accent)))

        (findViewById<View>(R.id.gradle) as TextView).text = String.format(
                getString(R.string.format_version),
                DynamicPackageUtils.getVersionName(this))

        fab.setOnClickListener(this)
        findViewById<View>(R.id.toast_default).setOnClickListener(this)
        findViewById<View>(R.id.toast_default_icon).setOnClickListener(this)
        findViewById<View>(R.id.toast_success).setOnClickListener(this)
        findViewById<View>(R.id.toast_error).setOnClickListener(this)
        findViewById<View>(R.id.toast_success).setOnClickListener(this)
        findViewById<View>(R.id.toast_warning).setOnClickListener(this)
        findViewById<View>(R.id.toast_custom_icon).setOnClickListener(this)
        findViewById<View>(R.id.toast_custom).setOnClickListener(this)
        findViewById<View>(R.id.toast_error_color).setOnClickListener(this)
        findViewById<View>(R.id.toast_success_color).setOnClickListener(this)
        findViewById<View>(R.id.toast_warning_color).setOnClickListener(this)
        findViewById<View>(R.id.toast_default_color).setOnClickListener(this)
        findViewById<View>(R.id.toast_error_icon).setOnClickListener(this)
        findViewById<View>(R.id.toast_success_icon).setOnClickListener(this)
        findViewById<View>(R.id.toast_warning_icon).setOnClickListener(this)
        findViewById<View>(R.id.toast_error_icon_disable).setOnClickListener(this)
        findViewById<View>(R.id.toast_success_icon_disable).setOnClickListener(this)
        findViewById<View>(R.id.toast_warning_icon_disable).setOnClickListener(this)
        findViewById<View>(R.id.toast_error_icon_disable_tint).setOnClickListener(this)
        findViewById<View>(R.id.toast_success_icon_disable_tint).setOnClickListener(this)
        findViewById<View>(R.id.toast_warning_icon_disable_tint).setOnClickListener(this)
        findViewById<View>(R.id.toast_config_text).setOnClickListener(this)
        findViewById<View>(R.id.toast_config_background).setOnClickListener(this)
        findViewById<View>(R.id.toast_config_icon_size).setOnClickListener(this)
        findViewById<View>(R.id.hint_default).setOnClickListener(this)
        findViewById<View>(R.id.hint_custom).setOnClickListener(this)
    }

    /**
     * Fix for AppCompat 1.1.0.
     *
     * https://issuetracker.google.com/issues/140602653
     */
    override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) {
        if (overrideConfiguration != null) {
            val uiMode = overrideConfiguration.uiMode
            overrideConfiguration.setTo(baseContext.resources.configuration)
            overrideConfiguration.uiMode = uiMode
        }
        super.applyOverrideConfiguration(resources.configuration)
    }

    override fun onCreateOptionsMenu(menu: Menu): Boolean {
        menuInflater.inflate(R.menu.main, menu)
        return super.onCreateOptionsMenu(menu)

    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        if (item.itemId == R.id.menu_about) {
            AboutDialogFragment.newInstance().showDialog(this)

            return true
        }
        return super.onOptionsItemSelected(item)
    }

    override fun onClick(v: View) {
        when (v.id) {
            R.id.fab -> DynamicLinkUtils.viewUrl(this@DynamicToastsActivity, URL_GITHUB)

            // Default toast without icon.
            R.id.toast_default -> DynamicToast.make(
                    this, getString(R.string.without_icon_desc)).show()

            // Default toast with icon.
            R.id.toast_default_icon -> DynamicToast.make(
                    this, getString(R.string.with_icon_desc),
                    AppCompatResources.getDrawable(
                            this, R.drawable.ic_toast_icon)).show()

            // Error toast.
            R.id.toast_error -> DynamicToast.makeError(
                    this, getString(R.string.error_desc)).show()

            // Success toast.
            R.id.toast_success -> DynamicToast.makeSuccess(
                    this, getString(R.string.success_desc)).show()

            // Warning toast.
            R.id.toast_warning -> DynamicToast.makeWarning(
                    this, getString(R.string.warning_desc)).show()

            // Custom toast without icon.
            R.id.toast_custom -> DynamicToast.make(
                    this, getString(R.string.custom_desc),
                    Color.parseColor("#FFFFFF"), Color.parseColor("#000000"),
                    Toast.LENGTH_LONG).show()

            // Custom toast with icon.
            R.id.toast_custom_icon -> DynamicToast.make(
                    this, getString(R.string.custom_desc),
                    AppCompatResources.getDrawable(this, R.drawable.ic_social_github),
                    Color.parseColor("#FFFFFF"), Color.parseColor("#000000"),
                    Toast.LENGTH_LONG).show()

            // Error toast with custom color.
            R.id.toast_error_color -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setErrorBackgroundColor(Color.parseColor("#673AB7"))
                        .apply()

                DynamicToast.makeError(this, getString(R.string.error_color_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Success toast with custom color.
            R.id.toast_success_color -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setSuccessBackgroundColor(Color.parseColor("#2196F3"))
                        .apply()

                DynamicToast.makeSuccess(
                        this, getString(R.string.success_color_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Warning toast with custom color.
            R.id.toast_warning_color -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setWarningBackgroundColor(Color.parseColor("#8BC34A"))
                        .apply()

                DynamicToast.makeWarning(
                        this, getString(R.string.warning_color_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Default toast with custom color.
            R.id.toast_default_color -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setDefaultBackgroundColor(Color.parseColor("#607d8b"))
                        .setDefaultTintColor(DynamicColorUtils.getTintColor(
                                Color.parseColor("#607d8b")))
                        .apply()

                DynamicToast.make(
                        this, getString(R.string.default_color_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Error toast with custom icon.
            R.id.toast_error_icon -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setErrorIcon(AppCompatResources.getDrawable(
                                this, R.drawable.ic_toast_icon))
                        .apply()

                DynamicToast.makeError(this,
                        getString(R.string.error_icon_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Success toast with custom icon.
            R.id.toast_success_icon -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setSuccessIcon(AppCompatResources.getDrawable(
                                this, R.drawable.ic_toast_icon))
                        .apply()

                DynamicToast.makeSuccess(this,
                        getString(R.string.success_icon_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Warning toast with custom icon.
            R.id.toast_warning_icon -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setWarningIcon(AppCompatResources.getDrawable(
                                this, R.drawable.ic_toast_icon))
                        .apply()

                DynamicToast.makeWarning(this,
                        getString(R.string.warning_icon_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Error toast without icon.
            R.id.toast_error_icon_disable -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setDisableIcon(true)
                        .apply()

                DynamicToast.makeError(this,
                        getString(R.string.error_icon_disable_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Success toast without icon.
            R.id.toast_success_icon_disable -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setDisableIcon(true)
                        .apply()

                DynamicToast.makeSuccess(this,
                        getString(R.string.success_icon_disable_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Warning toast without icon.
            R.id.toast_warning_icon_disable -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setDisableIcon(true)
                        .apply()

                DynamicToast.makeWarning(this, getString(
                        R.string.warning_icon_disable_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Error toast without icon tint.
            R.id.toast_error_icon_disable_tint -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setErrorIcon(AppCompatResources.getDrawable(
                                this, R.mipmap.ic_launcher))
                        .setTintIcon(false)
                        .apply()

                DynamicToast.makeError(this,
                        getString(R.string.error_icon_disable_tint_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Success toast without icon tint.
            R.id.toast_success_icon_disable_tint -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setSuccessIcon(AppCompatResources.getDrawable(
                                this, R.mipmap.ic_launcher))
                        .setTintIcon(false)
                        .apply()

                DynamicToast.makeSuccess(this,
                        getString(R.string.success_icon_disable_tint_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Warning toast without icon tint.
            R.id.toast_warning_icon_disable_tint -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setWarningIcon(AppCompatResources.getDrawable(
                                this, R.mipmap.ic_launcher))
                        .setTintIcon(false)
                        .apply()

                DynamicToast.makeWarning(this, getString(
                        R.string.warning_icon_disable_tint_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Toast with custom text size and typeface.
            R.id.toast_config_text -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setTextSize(18)
                        .setErrorIcon(AppCompatResources.getDrawable(
                                this, R.drawable.ic_toast_icon))
                        .setTextTypeface(Typeface.create(
                                Typeface.SERIF, Typeface.BOLD_ITALIC))
                        .setErrorBackgroundColor(Color.parseColor("#2196F3"))
                        .apply()

                DynamicToast.makeError(this, getString(R.string.text_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Toast with custom background.
            R.id.toast_config_background -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setToastBackground(AppCompatResources.getDrawable(
                                this, R.drawable.bg_custom_toast))
                        .apply()

                DynamicToast.makeSuccess(this, getString(R.string.background_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Toast with custom icon size.
            R.id.toast_config_icon_size -> {
                // Customise toast.
                DynamicToast.Config.getInstance()
                        .setIconSize(DynamicUnitUtils.convertDpToPixels(48f))
                        .apply()

                DynamicToast.makeWarning(this, getString(R.string.icon_size_desc)).show()

                // Reset customisations.
                DynamicToast.Config.getInstance().reset()
            }

            // Default hint without icon.
            R.id.hint_default -> DynamicHint.show(v,
                    DynamicHint.make(this, getString(R.string.default_hint)))

            // Custom hint with icon.
            R.id.hint_custom -> {
                // Customise hint.
                DynamicHint.Config.getInstance()
                        .setDefaultBackgroundColor(Color.parseColor("#607d8b"))
                        .setDefaultTintColor(DynamicColorUtils.getTintColor(
                                Color.parseColor("#607d8b")))
                        .apply()

                DynamicHint.show(v, DynamicHint.make(this, getString(R.string.custom_hint),
                        AppCompatResources.getDrawable(this, R.drawable.adt_ic_warning)))

                // Reset customisations.
                DynamicHint.Config.getInstance().reset()
            }
        }
    }
}


================================================
FILE: sample/src/main/java/com/pranavpandey/android/dynamic/toasts/sample/dialog/AboutDialogFragment.kt
================================================
/*
 * Copyright 2017-2022 Pranav Pandey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pranavpandey.android.dynamic.toasts.sample.dialog

import android.os.Build
import android.os.Bundle
import android.text.Html
import android.text.Spanned
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.pranavpandey.android.dynamic.dialogs.DynamicDialog
import com.pranavpandey.android.dynamic.dialogs.fragment.DynamicDialogFragment
import com.pranavpandey.android.dynamic.toasts.sample.R
import com.pranavpandey.android.dynamic.util.DynamicLinkUtils

/**
 * About dialog to show library info.
 */
class AboutDialogFragment : DynamicDialogFragment() {

    companion object {

        /**
         * Url for other apps on Google Play.
         */
        const val URL_PLAY_STORE =
                "https://play.google.com/store/apps/dev?id=6608630615059087491"

        /**
         * Initialize the new instance of this fragment.
         *
         * @return An instance of [AboutDialogFragment].
         */
        fun newInstance(): AboutDialogFragment {
            return AboutDialogFragment()
        }

        /**
         * Method to handle [Html.fromHtml] deprecation.
         */
        @Suppress("DEPRECATION")
        private fun fromHtml(html: String): Spanned {
            return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY)
            } else {
                Html.fromHtml(html)
            }
        }
    }

    /**
     * Customise [DynamicDialog.Builder] by overriding this method.
     */
    override fun onCustomiseBuilder(
        alertDialogBuilder: DynamicDialog.Builder,
        savedInstanceState: Bundle?
    ): DynamicDialog.Builder {
        // Customise dialog builder to add neutral, positive and negative buttons.
        // Also, set a view root to add top and bottom scroll indicators.
        return alertDialogBuilder.setTitle(R.string.about)
            .setPositiveButton(R.string.more_apps) { _, _ ->
                DynamicLinkUtils.viewUrl(requireContext(), URL_PLAY_STORE)
            }
            .setNegativeButton(android.R.string.cancel, null)
            // Set custom view for the dialog.
            .setView(
                LayoutInflater.from(context).inflate(
                    R.layout.dialog_about,
                    LinearLayout(context), false
                )
            )
            // Set view root to automatically add scroll dividers.
            .setViewRoot(R.id.dialog_about_root)
    }

    /**
     * Customise [DynamicDialog] by overriding this method.
     */
    override fun onCustomiseDialog(
        alertDialog: DynamicDialog,
        view: View?, savedInstanceState: Bundle?
    ) {
        super.onCustomiseDialog(alertDialog, view, savedInstanceState)

        // Customise the custom view.
        val message = view?.findViewById<TextView>(R.id.dialog_about_text)

        message?.text = fromHtml(getString(R.string.about_content))
        message?.setLineSpacing(0f, 1.2f)
        message?.movementMethod = LinkMovementMethod.getInstance()
        message?.setLinkTextColor(ContextCompat.getColor(requireContext(), R.color.color_primary))
    }
}


================================================
FILE: sample/src/main/res/drawable/app_bar_shadow.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <gradient
        android:startColor="#05000000"
        android:centerColor="#20000000"
        android:endColor="#35000000"
        android:angle="90" />

</shape>


================================================
FILE: sample/src/main/res/drawable/bg_custom_toast.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item>

        <shape
            android:dither="true">

            <gradient
                android:angle="90"
                android:endColor="#00000000"
                android:startColor="#10000000" />

        </shape>

    </item>

    <item
        android:top="2dp"
        android:left="2dp"
        android:bottom="2dp"
        android:right="2dp">

        <shape>

            <solid android:color="#EFFFFFFF" />

        </shape>

    </item>

</layer-list>


================================================
FILE: sample/src/main/res/drawable/ic_info.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright Google Inc.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="24dp"
    android:width="24dp"
    android:viewportHeight="24"
    android:viewportWidth="24">

    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" />

</vector>


================================================
FILE: sample/src/main/res/drawable/ic_launcher_foreground.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportHeight="108"
    android:viewportWidth="108">

    <path
        android:fillColor="@color/color_primary"
        android:pathData="m93.06 5.13h-78.47c-5.4 0 -9.76 4.41 -9.76 9.81l-0.05 88.28l19.62 -19.62h68.66c5.39 0 9.81 -4.42 9.81 -9.81v-58.85c0 -5.4 -4.42 -9.81 -9.81 -9.81zm-34.33 44.14h-9.81v-29.43h9.81v29.43zm0 19.62h-9.81v-9.81h9.81v9.81z" />

</vector>


================================================
FILE: sample/src/main/res/drawable/ic_social_github.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="24dp"
    android:width="24dp"
    android:viewportHeight="512"
    android:viewportWidth="512">

    <path
        android:fillColor="#FF000000"
        android:pathData="M256 70.7c-102.6 0-185.9 83.2-185.9 185.9 0 82.1 53.3 151.8 127.1 176.4 9.3 1.7 12.3-4 12.3-8.9V389.4c-51.7 11.3-62.5-21.9-62.5-21.9 -8.4-21.5-20.6-27.2-20.6-27.2 -16.9-11.5 1.3-11.3 1.3-11.3 18.7 1.3 28.5 19.2 28.5 19.2 16.6 28.4 43.5 20.2 54.1 15.4 1.7-12 6.5-20.2 11.8-24.9 -41.3-4.7-84.7-20.6-84.7-91.9 0-20.3 7.3-36.9 19.2-49.9 -1.9-4.7-8.3-23.6 1.8-49.2 0 0 15.6-5 51.1 19.1 14.8-4.1 30.7-6.2 46.5-6.3 15.8 0.1 31.7 2.1 46.6 6.3 35.5-24 51.1-19.1 51.1-19.1 10.1 25.6 3.8 44.5 1.8 49.2 11.9 13 19.1 29.6 19.1 49.9 0 71.4-43.5 87.1-84.9 91.7 6.7 5.8 12.8 17.1 12.8 34.4 0 24.9 0 44.9 0 51 0 4.9 3 10.7 12.4 8.9 73.8-24.6 127-94.3 127-176.4C441.9 153.9 358.6 70.7 256 70.7z" />

</vector>


================================================
FILE: sample/src/main/res/drawable/ic_toast_icon.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright Google Inc.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:height="24dp"
    android:width="24dp"
    android:viewportHeight="24"
    android:viewportWidth="24"
    android:autoMirrored="true"
    tools:targetApi="kitkat">

    <path
        android:fillColor="#FF000000"
        android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM13,11h-2L11,5h2v6zM13,15h-2v-2h2v2z" />

</vector>


================================================
FILE: sample/src/main/res/layout/activity_dynamic_toasts.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.pranavpandey.android.dynamic.toasts.sample.DynamicToastsActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:elevation="0dp">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </com.google.android.material.appbar.AppBarLayout>

    <include layout="@layout/content_dynamic_toasts" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:contentDescription="@string/about"
        app:srcCompat="@drawable/ic_social_github" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>


================================================
FILE: sample/src/main/res/layout/content_dynamic_toasts.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"
        android:scrollbarStyle="outsideOverlay"
        android:clipToPadding="false">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="@dimen/activity_margin"
            android:paddingLeft="@dimen/activity_margin"
            android:paddingRight="@dimen/activity_margin"
            android:paddingBottom="@dimen/activity_margin_fab"
            android:orientation="vertical">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/gradle_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/gradle"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintStart_toStartOf="parent" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/gradle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="16sp"
                    app:layout_constraintTop_toBottomOf="@id/gradle_title"
                    app:layout_constraintStart_toStartOf="parent" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_default"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/default_toasts"
                    app:layout_constraintTop_toBottomOf="@id/gradle"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_default_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_default"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_default"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/without_icon" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_default_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/with_icon" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_inbuilt"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/inbuilt_toasts"
                    app:layout_constraintTop_toBottomOf="@id/toasts_default_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_inbuilt_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_inbuilt"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_error"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/error" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_success"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/success" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_warning"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/warning" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_custom"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/custom_toasts"
                    app:layout_constraintTop_toBottomOf="@id/toasts_inbuilt_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_custom_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_custom"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_custom"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/without_icon" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_custom_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/with_icon" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_colors"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/custom_colors"
                    app:layout_constraintTop_toBottomOf="@id/toasts_custom_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_colors_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_colors"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_error_color"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/error" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_success_color"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/success" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_warning_color"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/warning" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_default_color"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/default_custom" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_icons"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/custom_icons"
                    app:layout_constraintTop_toBottomOf="@id/toasts_colors_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_icons_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icons"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_error_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/error" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_success_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/success" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_warning_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/warning" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_icon_disable"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/disable_icon"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icons_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_icon_disable_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icon_disable"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_error_icon_disable"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/error" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_success_icon_disable"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/success" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_warning_icon_disable"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/warning" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_icon_disable_tint"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/disable_icon_tint"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icon_disable_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_icon_disable_tint_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icon_disable_tint"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_error_icon_disable_tint"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/error" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_success_icon_disable_tint"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/success" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_warning_icon_disable_tint"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/warning" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_config"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/config"
                    app:layout_constraintTop_toBottomOf="@id/toasts_icon_disable_tint_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_config_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_config"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_config_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/text" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_config_background"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/background" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/toast_config_icon_size"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/icon_size" />

                </com.google.android.flexbox.FlexboxLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/toasts_hint"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/activity_margin"
                    android:text="@string/cheat_sheets"
                    app:layout_constraintTop_toBottomOf="@id/toasts_config_content"
                    app:layout_constraintStart_toStartOf="parent" />

                <com.google.android.flexbox.FlexboxLayout
                    android:id="@+id/toasts_hint_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/toasts_hint"
                    app:layout_constraintStart_toStartOf="parent"
                    app:flexWrap="wrap"
                    app:alignItems="stretch"
                    app:alignContent="stretch">

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/hint_default"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/default_custom" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/hint_custom"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/custom" />

                </com.google.android.flexbox.FlexboxLayout>

            </androidx.constraintlayout.widget.ConstraintLayout>

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

    <View
        android:id="@+id/ads_app_bar_shadow"
        android:layout_width="match_parent"
        android:layout_height="4dp"
        android:background="@drawable/app_bar_shadow" />

</FrameLayout>


================================================
FILE: sample/src/main/res/layout/dialog_about.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<androidx.core.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dialog_about_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/dialog_about_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="@dimen/dialog_margin_horizontal"
        android:paddingRight="@dimen/dialog_margin_horizontal"
        android:layout_gravity="start"
        android:textAlignment="viewStart" />

</androidx.core.widget.NestedScrollView>


================================================
FILE: sample/src/main/res/menu/main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/menu_about"
        android:title="@string/about"
        android:icon="@drawable/ic_info"
        android:orderInCategory="1"
        app:showAsAction="always" />

</menu>


================================================
FILE: sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<adaptive-icon
    xmlns:android="http://schemas.android.com/apk/res/android">

    <background android:drawable="@android:color/white" />

    <foreground>

        <inset
            android:drawable="@drawable/ic_launcher_foreground"
            android:inset="27.92%" />

    </foreground>

</adaptive-icon>


================================================
FILE: sample/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<resources>

    <!-- App color palette. -->
    <color name="color_primary">#F44336</color>
    <color name="color_primary_dark">#D32F2F</color>
    <color name="color_accent">#673AB7</color>

</resources>


================================================
FILE: sample/src/main/res/values/dimens.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<resources>

    <!-- Default margins -->
    <dimen name="activity_margin">16dp</dimen>
    <dimen name="activity_margin_fab">64dp</dimen>
    <dimen name="fab_margin">16dp</dimen>

    <!-- Dialog margin -->
    <dimen name="dialog_margin_horizontal">24dp</dimen>

</resources>


================================================
FILE: sample/src/main/res/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright 2017-2022 Pranav Pandey

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<resources>

    <string name="app_name">Dynamic Toasts</string>
    <string name="app_name_sample">Sample</string>
    <string name="gradle">Gradle dependency</string>
    <string name="format_version">com.pranavpandey.android:dynamic-toasts:%1$s</string>

    <string name="sources">Sources</string>
    <string name="about">About</string>
    <string name="about_content"><![CDATA[
        <b>dynamic-toasts</b><br/>
        A simple library to display themed toasts with icon and text on Android.<br/><br/>
        <b>&#
Download .txt
gitextract_ks34k4c_/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE/
│   │   └── issue_template.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── build.yml
├── .gitignore
├── .travis.yml
├── CNAME
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── build.gradle
├── dynamic-toasts/
│   ├── build.gradle
│   ├── maven.gradle
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── pranavpandey/
│           │           └── android/
│           │               └── dynamic/
│           │                   └── toasts/
│           │                       ├── DynamicHint.java
│           │                       ├── DynamicToast.java
│           │                       └── internal/
│           │                           ├── ToastCompat.java
│           │                           └── ToastContext.java
│           └── res/
│               ├── drawable/
│               │   ├── adt_hint_background.xml
│               │   └── adt_toast_background.xml
│               ├── layout/
│               │   ├── adt_layout_hint.xml
│               │   └── adt_layout_toast.xml
│               └── values/
│                   └── dimens.xml
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── graphics/
│   ├── icon.psd
│   ├── legacy/
│   │   └── icon.psd
│   └── preview.psd
├── sample/
│   ├── build.gradle
│   ├── proguard-rules.pro
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           │   └── com/
│           │       └── pranavpandey/
│           │           └── android/
│           │               └── dynamic/
│           │                   └── toasts/
│           │                       └── sample/
│           │                           ├── DynamicToastsActivity.kt
│           │                           └── dialog/
│           │                               └── AboutDialogFragment.kt
│           └── res/
│               ├── drawable/
│               │   ├── app_bar_shadow.xml
│               │   ├── bg_custom_toast.xml
│               │   ├── ic_info.xml
│               │   ├── ic_launcher_foreground.xml
│               │   ├── ic_social_github.xml
│               │   └── ic_toast_icon.xml
│               ├── layout/
│               │   ├── activity_dynamic_toasts.xml
│               │   ├── content_dynamic_toasts.xml
│               │   └── dialog_about.xml
│               ├── menu/
│               │   └── main.xml
│               ├── mipmap-anydpi-v26/
│               │   └── ic_launcher.xml
│               └── values/
│                   ├── colors.xml
│                   ├── dimens.xml
│                   ├── strings.xml
│                   └── styles.xml
└── settings.gradle
Download .txt
SYMBOL INDEX (105 symbols across 4 files)

FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicHint.java
  class DynamicHint (line 50) | public class DynamicHint {
    method generateTintColor (line 213) | private static @Nullable @ColorInt Integer generateTintColor(
    method make (line 232) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 248) | public static @NonNull Toast make(@NonNull Context context,
    method makeError (line 264) | public static @NonNull Toast makeError(@NonNull Context context, @Null...
    method makeError (line 281) | public static @NonNull Toast makeError(@NonNull Context context,
    method makeSuccess (line 298) | public static @NonNull Toast makeSuccess(@NonNull Context context,
    method makeSuccess (line 316) | public static @NonNull Toast makeSuccess(@NonNull Context context,
    method makeWarning (line 333) | public static @NonNull Toast makeWarning(@NonNull Context context,
    method makeWarning (line 351) | public static @NonNull Toast makeWarning(@NonNull Context context,
    method make (line 369) | public static @NonNull Toast make(@NonNull Context context,
    method make (line 387) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 406) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 427) | public static @NonNull Toast make(@NonNull Context context,
    method make (line 448) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 470) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    class Config (line 537) | public static class Config {
      method Config (line 619) | private Config() { }
      method getInstance (line 626) | public static @NonNull Config getInstance() {
      method setDefaultBackgroundColor (line 641) | public @NonNull Config setDefaultBackgroundColor(
      method setDefaultTintColor (line 655) | public @NonNull Config setDefaultTintColor(@Nullable @ColorInt Integ...
      method setErrorBackgroundColor (line 668) | public @NonNull Config setErrorBackgroundColor(
      method setSuccessBackgroundColor (line 683) | public @NonNull Config setSuccessBackgroundColor(
      method setWarningBackgroundColor (line 697) | public @NonNull Config setWarningBackgroundColor(
      method setErrorIcon (line 712) | public @NonNull Config setErrorIcon(@Nullable Drawable errorIcon) {
      method setSuccessIcon (line 726) | public @NonNull Config setSuccessIcon(@Nullable Drawable successIcon) {
      method setWarningIcon (line 740) | public @NonNull Config setWarningIcon(@Nullable Drawable warningIcon) {
      method setDisableIcon (line 753) | public @NonNull Config setDisableIcon(boolean disableIcon) {
      method setTintIcon (line 766) | public @NonNull Config setTintIcon(boolean tintIcon) {
      method setIconSize (line 779) | public @NonNull Config setIconSize(int iconSize) {
      method setTextSize (line 792) | public @NonNull Config setTextSize(int textSize) {
      method setTextTypeface (line 806) | public @NonNull Config setTextTypeface(@Nullable Typeface textTypefa...
      method setToastBackground (line 820) | public @NonNull Config setToastBackground(@Nullable Drawable toastBa...
      method apply (line 829) | public void apply() {
      method reset (line 851) | public void reset() {
    method show (line 877) | public static void show(@NonNull View anchor, @NonNull Toast toast) {
    method show (line 888) | @SuppressWarnings("deprecation")

FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicToast.java
  class DynamicToast (line 46) | public class DynamicToast {
    method generateTintColor (line 192) | private static @Nullable @ColorInt Integer generateTintColor(
    method make (line 211) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 227) | public static @NonNull Toast make(@NonNull Context context,
    method makeError (line 243) | public static @NonNull Toast makeError(@NonNull Context context, @Null...
    method makeError (line 260) | public static @NonNull Toast makeError(@NonNull Context context,
    method makeSuccess (line 277) | public static @NonNull Toast makeSuccess(@NonNull Context context,
    method makeSuccess (line 295) | public static @NonNull Toast makeSuccess(@NonNull Context context,
    method makeWarning (line 312) | public static @NonNull Toast makeWarning(@NonNull Context context,
    method makeWarning (line 330) | public static @NonNull Toast makeWarning(@NonNull Context context,
    method make (line 348) | public static @NonNull Toast make(@NonNull Context context,
    method make (line 366) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 385) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 406) | public static @NonNull Toast make(@NonNull Context context,
    method make (line 427) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    method make (line 449) | public static @NonNull Toast make(@NonNull Context context, @Nullable ...
    class Config (line 516) | public static class Config {
      method Config (line 598) | private Config() { }
      method getInstance (line 605) | public static @NonNull Config getInstance() {
      method setDefaultBackgroundColor (line 620) | public @NonNull Config setDefaultBackgroundColor(
      method setDefaultTintColor (line 634) | public @NonNull Config setDefaultTintColor(@Nullable @ColorInt Integ...
      method setErrorBackgroundColor (line 647) | public @NonNull Config setErrorBackgroundColor(
      method setSuccessBackgroundColor (line 662) | public @NonNull Config setSuccessBackgroundColor(
      method setWarningBackgroundColor (line 676) | public @NonNull Config setWarningBackgroundColor(
      method setErrorIcon (line 691) | public @NonNull Config setErrorIcon(@Nullable Drawable errorIcon) {
      method setSuccessIcon (line 705) | public @NonNull Config setSuccessIcon(@Nullable Drawable successIcon) {
      method setWarningIcon (line 719) | public @NonNull Config setWarningIcon(@Nullable Drawable warningIcon) {
      method setDisableIcon (line 732) | public @NonNull Config setDisableIcon(boolean disableIcon) {
      method setTintIcon (line 745) | public @NonNull Config setTintIcon(boolean tintIcon) {
      method setIconSize (line 758) | public @NonNull Config setIconSize(int iconSize) {
      method setTextSize (line 771) | public @NonNull Config setTextSize(int textSize) {
      method setTextTypeface (line 785) | public @NonNull Config setTextTypeface(@Nullable Typeface textTypefa...
      method setToastBackground (line 799) | public @NonNull Config setToastBackground(@Nullable Drawable toastBa...
      method apply (line 808) | public void apply() {
      method reset (line 830) | public void reset() {

FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastCompat.java
  class ToastCompat (line 36) | @SuppressWarnings("deprecation")
    method ToastCompat (line 44) | public ToastCompat(Context context, @NonNull Toast base) {
    method makeText (line 60) | @SuppressLint("ShowToast")
    method makeText (line 78) | public static Toast makeText(@NonNull Context context, @StringRes int ...
    method setToastContext (line 89) | @SuppressLint("DiscouragedPrivateApi")
    method show (line 102) | @Override
    method setDuration (line 107) | @Override
    method setGravity (line 112) | @Override
    method setMargin (line 117) | @Override
    method setText (line 122) | @Override
    method setText (line 127) | @Override
    method setView (line 132) | @Override
    method getHorizontalMargin (line 138) | @Override
    method getVerticalMargin (line 143) | @Override
    method getDuration (line 148) | @Override
    method getGravity (line 153) | @Override
    method getXOffset (line 158) | @Override
    method getYOffset (line 163) | @Override
    method getView (line 168) | @Override
    method getToast (line 173) | public @NonNull Toast getToast() {

FILE: dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastContext.java
  class ToastContext (line 33) | public final class ToastContext extends ContextWrapper {
    method ToastContext (line 46) | public ToastContext(@NonNull Context base, @NonNull Toast toast) {
    method getApplicationContext (line 52) | @Override
    class ApplicationContextWrapper (line 60) | static final class ApplicationContextWrapper extends ContextWrapper {
      method ApplicationContextWrapper (line 67) | private ApplicationContextWrapper(@NonNull Context base) {
      method getSystemService (line 71) | @Override
    class WindowManagerWrapper (line 89) | @SuppressWarnings("deprecation")
      method WindowManagerWrapper (line 102) | private WindowManagerWrapper(@NonNull WindowManager base) {
      method getDefaultDisplay (line 106) | @Override
      method removeViewImmediate (line 111) | @Override
      method addView (line 116) | @Override
      method updateViewLayout (line 127) | @Override
      method removeView (line 132) | @Override
Condensed preview — 52 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (209K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 181,
    "preview": "# Funding links\n\ngithub: pranavpandey\nopen_collective: pranavpandeydev\nko_fi: pranavpandey\nbuy_me_a_coffee: pranavpandey"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/issue_template.md",
    "chars": 907,
    "preview": "---\nname: Issue\nabout: Create a issue to help us improve\ntitle: \"Short description of the issue\"\n---\n\n**Description:** F"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 184,
    "preview": "### Thanks for starting a pull request!\n\n## Changes\n\n  -\n  -\n\n## Testing\n\nDescribe how you tested your changes.\n\n## Issu"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 607,
    "preview": "name: Build\n\non:\n  push:\n    branches:\n      - master\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    timeout-minutes: 60"
  },
  {
    "path": ".gitignore",
    "chars": 399,
    "preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbi"
  },
  {
    "path": ".travis.yml",
    "chars": 792,
    "preview": "language: android\njdk: oraclejdk17\n\nbefore_install:\n  - mkdir \"$ANDROID_HOME/licenses\" || true\n  - echo -e \"\\n24333f8a63"
  },
  {
    "path": "CNAME",
    "chars": 16,
    "preview": "pranavpandey.org"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 5489,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
  },
  {
    "path": "LICENSE",
    "chars": 11349,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 9485,
    "preview": "<img src=\"./graphics/icon.png\" height=\"160\">\n\n# Dynamic Toasts\n\n[![License](https://img.shields.io/badge/license-Apache%"
  },
  {
    "path": "build.gradle",
    "chars": 3363,
    "preview": "/*\n * Copyright 2017-2025 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/build.gradle",
    "chars": 3087,
    "preview": "/*\n * Copyright 2017-2024 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/maven.gradle",
    "chars": 5197,
    "preview": "/*\n * Copyright 2017-2024 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/src/main/AndroidManifest.xml",
    "chars": 630,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicHint.java",
    "chars": 33994,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/DynamicToast.java",
    "chars": 30895,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastCompat.java",
    "chars": 5003,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/src/main/java/com/pranavpandey/android/dynamic/toasts/internal/ToastContext.java",
    "chars": 3946,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "dynamic-toasts/src/main/res/drawable/adt_hint_background.xml",
    "chars": 1254,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "dynamic-toasts/src/main/res/drawable/adt_toast_background.xml",
    "chars": 1256,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "dynamic-toasts/src/main/res/layout/adt_layout_hint.xml",
    "chars": 2054,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "dynamic-toasts/src/main/res/layout/adt_layout_toast.xml",
    "chars": 2101,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "dynamic-toasts/src/main/res/values/dimens.xml",
    "chars": 1224,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 230,
    "preview": "#Thu Jan 28 10:36:42 IST 2021\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "gradle.properties",
    "chars": 1106,
    "preview": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will ov"
  },
  {
    "path": "gradlew",
    "chars": 4971,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "gradlew.bat",
    "chars": 2314,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "sample/build.gradle",
    "chars": 1976,
    "preview": "/*\n * Copyright 2017-2023 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "sample/proguard-rules.pro",
    "chars": 914,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in AN"
  },
  {
    "path": "sample/src/main/AndroidManifest.xml",
    "chars": 1681,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/java/com/pranavpandey/android/dynamic/toasts/sample/DynamicToastsActivity.kt",
    "chars": 17432,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "sample/src/main/java/com/pranavpandey/android/dynamic/toasts/sample/dialog/AboutDialogFragment.kt",
    "chars": 3910,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "sample/src/main/res/drawable/app_bar_shadow.xml",
    "chars": 889,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/drawable/bg_custom_toast.xml",
    "chars": 1174,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/drawable/ic_info.xml",
    "chars": 985,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright Google Inc.\n\n\tLicensed under the Apache License, Version 2.0 (the"
  },
  {
    "path": "sample/src/main/res/drawable/ic_launcher_foreground.xml",
    "chars": 1124,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/drawable/ic_social_github.xml",
    "chars": 1572,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/drawable/ic_toast_icon.xml",
    "chars": 1122,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright Google Inc.\n\n\tLicensed under the Apache License, Version 2.0 (the"
  },
  {
    "path": "sample/src/main/res/layout/activity_dynamic_toasts.xml",
    "chars": 2099,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/layout/content_dynamic_toasts.xml",
    "chars": 20287,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/layout/dialog_about.xml",
    "chars": 1240,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/menu/main.xml",
    "chars": 952,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "chars": 929,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/values/colors.xml",
    "chars": 824,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/values/dimens.xml",
    "chars": 897,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/values/strings.xml",
    "chars": 4375,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "sample/src/main/res/values/styles.xml",
    "chars": 1445,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n\tCopyright 2017-2022 Pranav Pandey\n\n\tLicensed under the Apache License, Vers"
  },
  {
    "path": "settings.gradle",
    "chars": 640,
    "preview": "/*\n * Copyright 2017-2022 Pranav Pandey\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  }
]

// ... and 4 more files (download for full content)

About this extraction

This page contains the full source code of the pranavpandey/dynamic-toasts GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 52 files (193.8 KB), approximately 44.8k tokens, and a symbol index with 105 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!