Convert Figma logo to code with AI

sjwall logoMaterialTapTargetPrompt

⛔️ DEPRECATED Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/

1,522
211
1,522
6

Top Related Projects

[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

Animations for Android L drawer, back, dismiss and check icons

Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

This is a library with components of Android L to you use in android 2.2

A library to bring fully animated Material Design components to pre-Lolipop Android.

Quick Overview

MaterialTapTargetPrompt is a library for Android that provides a Material Design-styled tap target prompt, which is a UI element that guides the user to perform a specific action. It is designed to be highly customizable and easy to integrate into Android applications.

Pros

  • Material Design Compliance: The library follows the Material Design guidelines, ensuring a consistent and visually appealing user experience.
  • Customizability: The library offers a wide range of customization options, allowing developers to tailor the prompt to their specific needs.
  • Easy Integration: The library is easy to integrate into existing Android projects, with clear documentation and sample code.
  • Accessibility: The library includes features to ensure the tap target prompt is accessible to users with disabilities.

Cons

  • Android-specific: The library is designed specifically for the Android platform, limiting its cross-platform applicability.
  • Dependency on Material Design: The library is heavily dependent on the Material Design principles, which may not align with the design language of all Android applications.
  • Potential Performance Impact: Depending on the complexity of the prompt and the device's hardware, the library may have a slight performance impact on the application.
  • Limited Functionality: The library is focused on the tap target prompt feature and may not provide additional functionality that some developers might require.

Code Examples

// Create a new MaterialTapTargetPrompt
val prompt = MaterialTapTargetPrompt.Builder(this)
    .setTarget(findViewById(R.id.my_button))
    .setPrimaryText("Tap this button")
    .setSecondaryText("This will perform an important action")
    .setIcon(R.drawable.ic_my_icon)
    .create()

// Show the prompt
prompt.show()

This code creates a new MaterialTapTargetPrompt and configures it with a target view, primary and secondary text, and an icon. The prompt is then shown to the user.

// Customize the prompt's appearance
val prompt = MaterialTapTargetPrompt.Builder(this)
    .setTarget(findViewById(R.id.my_button))
    .setPrimaryText("Tap this button")
    .setSecondaryText("This will perform an important action")
    .setIcon(R.drawable.ic_my_icon)
    .setBackgroundColour(Color.BLUE)
    .setFocalColour(Color.GREEN)
    .create()

This code demonstrates how to customize the appearance of the MaterialTapTargetPrompt by setting the background and focal colors.

// Handle prompt events
val prompt = MaterialTapTargetPrompt.Builder(this)
    .setTarget(findViewById(R.id.my_button))
    .setPrimaryText("Tap this button")
    .setSecondaryText("This will perform an important action")
    .setIcon(R.drawable.ic_my_icon)
    .setOnHidePromptListener { reason ->
        // Handle prompt dismissal
    }
    .create()

prompt.show()

This code shows how to handle events related to the MaterialTapTargetPrompt, such as when the prompt is dismissed.

Getting Started

To use the MaterialTapTargetPrompt library in your Android project, follow these steps:

  1. Add the library to your project's build.gradle file:
dependencies {
    implementation 'com.github.sjwall:MaterialTapTargetPrompt:2.17.0'
}
  1. Create a new MaterialTapTargetPrompt instance and configure it with the desired settings:
val prompt = MaterialTapTargetPrompt.Builder(this)
    .setTarget(findViewById(R.id.my_button))
    .setPrimaryText("Tap this button")
    .setSecondaryText("This will perform an important action")
    .setIcon(R.drawable.ic_my_icon)
    .create()
  1. Show the prompt to the user:
prompt.show()

That's it! You've now integrated the MaterialTapTargetPrompt library into your Android application.

Competitor Comparisons

[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

Pros of ShowcaseView

  • Customizable Appearance: ShowcaseView provides a wide range of customization options, allowing you to adjust the appearance of the showcase to match your app's design.
  • Flexible Positioning: The library offers flexibility in positioning the showcase, enabling you to display it at various locations on the screen.
  • Smooth Animations: ShowcaseView features smooth and visually appealing animations, enhancing the user experience.

Cons of ShowcaseView

  • Limited Targeting: Unlike MaterialTapTargetPrompt, ShowcaseView does not provide a specific feature for targeting UI elements, which can be a limitation in some use cases.
  • Dependency on External Libraries: ShowcaseView relies on external libraries, such as Guava, which may increase the overall project size and complexity.

Code Comparison

MaterialTapTargetPrompt

MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(this)
    .setPrimaryText("Tap me!")
    .setSecondaryText("I'm a MaterialTapTargetPrompt")
    .setTarget(findViewById(R.id.my_view));

builder.show();

ShowcaseView

ShowcaseView showcaseView = new ShowcaseView.Builder(this)
    .setTarget(new ViewTarget(R.id.my_view, this))
    .setContentTitle("Showcase View")
    .setContentText("This is a ShowcaseView")
    .build();

showcaseView.show();

Animations for Android L drawer, back, dismiss and check icons

Pros of Material Menu

  • Customizable Animations: Material Menu provides a variety of animation options, allowing you to create unique and visually appealing menu interactions.
  • Flexible Layout: The library offers flexibility in terms of menu layout, enabling you to position the menu in different locations relative to the trigger element.
  • Smooth Transitions: Material Menu ensures smooth transitions between the menu's open and closed states, providing a polished user experience.

Cons of Material Menu

  • Limited Functionality: Compared to MaterialTapTargetPrompt, Material Menu focuses primarily on menu interactions and may lack the broader functionality and features provided by the MaterialTapTargetPrompt library.
  • Dependency on External Libraries: Material Menu relies on external libraries, such as Kotlin and Android Jetpack, which may increase the complexity of integrating the library into your project.

Code Comparison

MaterialTapTargetPrompt (sjwall/MaterialTapTargetPrompt)

MaterialTapTargetPrompt.Builder(this)
    .setTarget(view)
    .setPrimaryText("This is the primary text")
    .setSecondaryText("This is the secondary text")
    .setIcon(R.drawable.ic_android)
    .show()

Material Menu (balysv/material-menu)

val menu = MaterialMenu(this)
menu.attachTo(view)
menu.setOnClickListener { /* Handle menu item click */ }
menu.show()
menu.hide()

Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Pros of Material Icon Library

  • Provides a wide range of material design icons that can be easily integrated into Android apps.
  • Supports vector drawables, which allows for scalable and high-quality icons.
  • Includes a convenient search function to quickly find the desired icon.

Cons of Material Icon Library

  • Lacks the specific functionality of a tap target prompt, which is the primary focus of MaterialTapTargetPrompt.
  • May not be as customizable as MaterialTapTargetPrompt in terms of the appearance and behavior of the icons.
  • Requires additional dependencies to be included in the project, which may increase the overall project size.

Code Comparison

MaterialTapTargetPrompt:

MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(this)
    .setPrimaryText("Hello, World!")
    .setSecondaryText("This is a Material Tap Target Prompt")
    .setIcon(R.drawable.ic_android_black_24dp)
    .setBackgroundColour(ContextCompat.getColor(this, R.color.colorPrimary))
    .setFocalColour(ContextCompat.getColor(this, R.color.colorAccent));

Material Icon Library:

ImageView imageView = findViewById(R.id.my_image_view);
imageView.setImageResource(R.drawable.ic_android_black_24dp);

This is a library with components of Android L to you use in android 2.2

Pros of MaterialDesignLibrary

  • Provides a wider range of Material Design components and widgets, including buttons, cards, dialogs, and more.
  • Offers more customization options and theming capabilities.
  • Includes additional features like navigation drawers and bottom navigation bars.

Cons of MaterialDesignLibrary

  • Larger codebase and potentially more complex to integrate into a project.
  • May have a steeper learning curve compared to MaterialTapTargetPrompt.
  • Potential performance impact due to the increased number of components and features.

Code Comparison

MaterialTapTargetPrompt:

MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(this)
    .setPrimaryText("Hello, World!")
    .setSecondaryText("This is a Material Tap Target Prompt");
builder.show();

MaterialDesignLibrary:

MaterialButton button = new MaterialButton(this);
button.setText("Click me");
button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // Handle button click
    }
});

A library to bring fully animated Material Design components to pre-Lolipop Android.

Pros of Material

  • Wider Feature Set: Material provides a more comprehensive set of UI components and features compared to MaterialTapTargetPrompt, including buttons, cards, dialogs, and more.
  • Active Development: Material has seen more recent activity and updates, with the last commit being less than a month ago, indicating active maintenance and development.
  • Larger Community: Material has a larger user base and more contributors, which can lead to better support, more documentation, and more community-driven improvements.

Cons of Material

  • Larger Codebase: Material's broader feature set and larger community involvement result in a more complex and larger codebase, which may be less suitable for projects with more specific or lightweight UI requirements.
  • Potential Overhead: The additional features and complexity of Material may introduce more overhead and dependencies, which could impact performance or project size, especially for smaller applications.
  • Learning Curve: The wider feature set and more extensive documentation of Material may present a steeper learning curve for developers who are new to the library.

Code Comparison

MaterialTapTargetPrompt:

MaterialTapTargetPrompt.Builder builder = new MaterialTapTargetPrompt.Builder(this)
    .setPrimaryText("This is the primary text")
    .setSecondaryText("This is the secondary text")
    .setTarget(findViewById(R.id.my_view));

MaterialTapTargetPrompt prompt = builder.show();

Material:

val button = findViewById<Button>(R.id.my_button)
MaterialButton(button).apply {
    icon = ContextCompat.getDrawable(context, R.drawable.my_icon)
    iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
}

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

DEPRECATED

Android is moving towards compose, for an alternative library in compose have a look at intro-showcase-view.

Bug fix pull requests will be accepted for this library for the immediate future but there will be no active development or new features and it will eventually be archived.

Thank you to everyone who has contributed to the library over the years!

Material Tap Target Prompt

library-logo
A Tap Target implementation in Android based on Material Design Onboarding guidelines. For more information on tap targets check out the guidelines.

sjwall.github.io/MaterialTapTargetPrompt

Quick start · Examples · Sample app

No Maintenance Intended Build Status codecov Maintainability Download JavaDoc License PRs Welcome

FAB Example App Bar Example Card Example Centre Example

The sample app is available to download on the Google Play Store: Get it on Google Play

Quick start

Gradle

Add the following to build.gradle using Maven Central:

dependencies {
    implementation 'uk.co.samuelwall:material-tap-target-prompt:3.3.2'
}

Supports Android minSdkVersion 14

Version 2.15.0 works with Android Support Library

Also available from GitHub packages

Usage

Basic usage is shown below with more examples in the sample app and documentation:

new MaterialTapTargetPrompt.Builder(MainActivity.this)
        .setTarget(R.id.fab)
        .setPrimaryText("Send your first email")
        .setSecondaryText("Tap the envelope to start composing your first email")
        .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener()
        {
            @Override
            public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state)
            {
                if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED)
                {
                    // User has pressed the prompt target
                }
            }
        })
        .show();

Note

If a target is not set or the target view could not be found or both the primary and secondary text are null then builder.show and builder.create will return null.

Other shapes

The default shape is a circle but any other shape can be rendered by extending the PromptBackground and PromptFocal classes. Custom shapes such as a rectangle can be set by calling setPromptBackground and/or setPromptFocal. Documentation and examples are available here.

Rectangle Example

License

Copyright (C) 2016-2021 Samuel Wall

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.