Giter Site home page Giter Site logo

faruktoptas / fancyshowcaseview Goto Github PK

View Code? Open in Web Editor NEW
1.9K 29.0 275.0 4.51 MB

An easy-to-use customisable show case view with circular reveal animation.

License: Apache License 2.0

Kotlin 99.94% Shell 0.06%
fancyshowcaseview android-ui circular-reveal android-development android android-library material-ui material-design animation kotlin

fancyshowcaseview's Introduction

FancyShowCaseView

An easy-to-use customizable show case view with circular reveal animation.

Status Download

@MaterialUp Best of the Day

Features

  • Circular reveal animation (API Level 21+)
  • Focus on a specific view or position
  • Background color
  • Circle and Rounded Rectangle focus shapes
  • Title style and position
  • Custom view inflation
  • Custom enter/exit animations
  • Chaining multiple FancyShowCaseView instances
  • Showing only one time

!gif!gif

Download

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Then, add the library to your module build.gradle

dependencies {
    implementation 'com.github.faruktoptas:FancyShowCaseView:1.3.9'
}

Sample Usage

new FancyShowCaseView.Builder(this)
        .focusOn(view)
        .title("Focus on View")
        .build()
        .show();

Supported Properties

Command Description
focusOn
title
typeface
titleStyle
titleGravity
titleSize
enableAutoTextPosition Center text position vertically.
backgroundColor
fitSystemWindows
focusShape
focusBorderColor
focusBorderSize
focusDashedBorder
roundRectRadius
showOnce
clickableOn
focusCircleRadiusFactor
focusRectSizeFactor
customView
closeOnTouch
enableTouchOnFocusedView
enterAnimation
exitAnimation
animationListener
disableFocusAnimation
focusAnimationMaxValue Focus animation max value. Bigger value makes larger focus area.
focusAnimationStep Step for focus animation. Default value is 1.
focusRectAtPosition
focusCircleAtPosition
dismissListener
delay Shows the FancyShowCaseView after a delay.

Please see wiki for more samples.

Already in use in following apps

(feel free to send me new projects)

Sample App

Latest Release

Xamarin Port

Thanks to DigitalSa1nt for the Xamarin ported version Xamarin.ShowcaseView

Contribute

You can contribute by opening a pull request to dev branch. Please try to push one feature in one commit for a clean commit history.

Buy Me a Coffee

Buy Me A Coffee

License

Apache License 2.0

fancyshowcaseview's People

Contributors

97balakrishnan avatar 97sbalakrishnan avatar adrianlxm avatar anuragupadhaya avatar askandrecieve avatar boymustafa avatar chimzycash avatar cypressious avatar daboome avatar efung avatar eric-muchiri avatar faruktoptas avatar gitter-badger avatar harshvardhan-takawale avatar hasbisevinc avatar ichurkin avatar jikolp95 avatar mflisar avatar mrjavaci avatar nickcondron avatar parasdtu avatar polyak01 avatar pozzoooo avatar rajnish23 avatar sfeatherstone avatar shynline avatar svinouze avatar tuhinadasgupta avatar yerenutku avatar yuetchan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fancyshowcaseview's Issues

program

can't work well in android 7.1.1!!

Action bar items are not getting focused

Action bar items are only getting focused if I call them inside onOptionsItemSelected() as per given sample program. But if I initialize the menu item view and then show casing it, show case focus is not getting visible / remains unfocused. Any way to fix it?

Overlapping focus view and title

I think it would make sense to add some logic to avoid this...

The text should be placed in the biggest remaining space on the screen by default imho...

Skip button

Hello there,
thank you for this amazing library!
I wonder if it is possible to add a skip button in order to close all the further FancyShowCaseView.
Can you suggest me how can I reach that?
Cheers!

Click on view in focus

Hey guys, quick question.

Is it possible to make only the target view (.focusOn) clickable even if .closeOnTouch is false?

Thanks!

Chaining show case views

Is this possible? There is no listener for on showcase closed (only for the animation).

Would be nice to have at least a callback which can be setup via the builder

Looping with custom animation

Hello! The library is great, but there is an error. I want to set your fade animation for every api version. I use this code to create an animation:
Animation animationOut = AnimationUtils.loadAnimation(this, R.anim.fscv_fade_out);
And then in the builder:
.exitAnimation(animationOut)

Now, if I tap the show case view, it appears again and again

very critical bug with android:windowTranslucentStatus true

Hello! Excellent library and thanks for the work. But I have found a very critical bug.

Try to add

<item name="android:windowTranslucentStatus">true</item>

to your v21+/style and check application.

Result:
photo_2017-08-18_19-16-03

How can we fix it as soon as possible?

Listener on complete of ShowCase Queue

Hi @faruktoptas,

It would be great if you can provide listener on complete of ShowCase Queue like below:

`FancyShowCaseQueue fq = new FancyShowCaseQueue()
.add(fancyShowCaseView1)
.add(fancyShowCaseView2)
.add(fancyShowCaseView3)
.add(fancyShowCaseView4)
.show();

    fq.setOnCompleteListener(new OnCompleteListener() {
        @Override
        public void onComplete() {
            //Queue completed
        }
    });`

Graphics problem when rotating screen

Thank you for this amazing repository!
I've noticed some problem after rotating screen:

  • wrong background
  • wrong circle position
    How can I fix it?
    Cheers!

Out of memory issue on createBitmap

Recenlty i started facing OOM issue on android 6.0.0 on createBitmap, did someone else face the same issue.
i have used RGB_565 in place of ARGB_888 to reduce the memory usage.

mCalculator = new Calculator(mActivity, mFocusShape, mView, mFocusCircleRadiusFactor, mFitSystemWindows); Bitmap bitmap = Bitmap.createBitmap(mCalculator.getBitmapWidth(), mCalculator.getBitmapHeight(), Bitmap.Config.RGB_565); bitmap.eraseColor(mBackgroundColor);

Title position is wrong

new Handler().postDelayed(new Runnable() {
          @Override
          public void run() {
              new FancyShowCaseView.Builder(getmActivity())
                      .focusOn(btnTwitterLogin)
                      .title("Etc etc")
                      .focusShape(FocusShape.ROUNDED_RECTANGLE)
                      .fitSystemWindows(true)
                      .titleSize(20, TypedValue.COMPLEX_UNIT_SP)
                      .titleStyle(0, Gravity.TOP | Gravity.CENTER_HORIZONTAL)
                      .build()
                      .show();
              sharedPrefManager.setIsLoginFragmmentAnimationsSeen(true);
          }
      }, 100);

First, in this code snippet (when i use titleStyle(...) ) fistsystemwindows(true) has no effect.

I tried to use titleGravity(..) with fitSystemWindows(true), in that case the title gets pushed outside the screen partially. I thought i could solve it by defining a style with marginTop and apply it and then the fitSystemWindows is eliminated and the button's focus is pushed upwards. :)

Any idea? Btw love the library.

Adding new shapes

What do you think about adding new shapes besides circle and rounded rectangle? The code reads as though rounded rectangle was added as an afterthought. Thinking about generalizing the code and supporting a couple more shapes (elipse, rectangle).

Add abort/cancel method to FancyShowCaseQueue

I used to call FancyShowCaseView.hideCurrent(activity) to hide a whole FancyShowCaseQueue of an Activity.
This doesn't seem to work anymore as it only closes the currently displayed FancyShowCaseView inside the Queue.

Is the current behavior a bug or intended? If it's intended, i think FancyShowCaseQueue should also
have a hideCurrent Method. Or is there already a way to accomplish that?

FancyShowCaseView.Builder.build() method performance

First of all, thanks for this awesome library. Here is a small performance enhancement request. The builder should check whether it has been shown before if showOnce flag is set and do thing if it has been shown before. No need to continue building the view in this case. Thanks.

Can't get right focus height with focusRectAtPosition()

I'm setting the view using .focusRectAtPosition() and get focus height multiplied by 2.

 // Calculate position
        val centerY = onScreenY + cityNameTV.height / 2
        val centerX = cityNameTV.left + cityNameTV.width / 2
        val width = activity.getScreenWidth()
        val height = resources.getDimensionPixelSize(R.dimen.city_showcase_height)

        // Create showcase
        FancyShowCaseView.Builder(activity)
                .backgroundColor(ContextCompat.getColor(context, R.color.showcase))
                .focusShape(FocusShape.ROUNDED_RECTANGLE)
                .focusRectAtPosition(centerX, centerY, width, height)
                .roundRectRadius(1) // Almost 0 :)
                .disableFocusAnimation()
                .customView(R.layout.layout_showcase_city) {
                    it.button.setOnClickListener { cityShowcase.hide() }
                }
                .closeOnTouch(false)
                .exitAnimation(AnimationUtils.loadAnimation(context, R.anim.fscv_fade_out).apply {
                    setAnimationListener(object : Animation.AnimationListener {
                        override fun onAnimationEnd(animation: Animation?) {
                            cityShowcase.removeView()
                        }

                        override fun onAnimationRepeat(animation: Animation?) {}
                        override fun onAnimationStart(animation: Animation?) {}
                    })
                })
                .build()

Height is from dimensions:

<dimen name="city_showcase_height">12dp</dimen>

And I get the visual height of focus exactly as the status bar (24dp).
Could you please help with this?

Focus not working with constraint layout

Hey Faruk, I'm trying to implement your lib with dagger and constraint layout.

    @Bind(R.id.login) AppCompatButton login;

 @Override public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
   
new FancyShowCaseView.Builder(getActivity())
        .focusOn(login)
        .title("Focus on View")
        .build()
        .show();
  }

Full size of screen is in focus all the time, can not focus on button or any other view.Can you help?
Thanks

Bottom bar items are not getting focused

I used it like this:
-=-=-=-=-=-=-=-
new FancyShowCaseView.Builder(this)
.focusOn(findViewById(R.id.tab_home))
.title("Focus on View")
.focusShape(FocusShape.CIRCLE)
.build()
.show();

how to show in fragment ?

i checked the code it seems library is finding views from an activity only . how can i display in fragment ?

Updating README.md

  • Explain all Builder parameters in README.md
  • Add more examples with screenshots

TabLayout custom view focus

Hi, I have a tab alyout with custom view

<ImageView
    android:id="@+id/notification_tab_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/selector_tab_notifications"
    xmlns:android="http://schemas.android.com/apk/res/android" />

My drawable/selector_tab_notifications looks like:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="true" android:drawable="@drawable/ic_ac_tab_notif_select"/>
    <item android:drawable="@drawable/ic_ac_tab_notif"/>
</selector>

I'm trying to use:

new FancyShowCaseView.Builder(this)
                .focusOn(toolbarTabLayout.getTabAt(1).getCustomView())
                .title("Focus text")
                .build()
                .show();
new FancyShowCaseView.Builder(this)             
            .focusOn((ImageView)toolbarTabLayout.getTabAt(1).getCustomView().findViewById(R.id.notification_tab_view))
                .title("Focus text")
                .build()
                .show();

and nothing works. Is there a solution to this problem?

Flag to disable Focus animation

The animation on the focus is nice, but probably more often than not, i don't want that and have
a static focus instead.
A flag to disable it on the Builder would be nice.

Reset showOnce

It would be nice to support resetting of the showOnce flag, indiviually and all at once

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.