florent37/ViewTooltip

Getting rid of on(final View view) method

Closed this issue · 1 comments

Read.me file and examples feature on(final View view) by default. But using it is dangerous because context is casted to Activity, which may fail with ClassCastException.

public static ViewTooltip on(final View view) {
    return new ViewTooltip(new MyContext((Activity) view.getContext()), view);
}

My app started to fail once I switched base theme to Theme.AppCompat.DayNight.DarkActionBar.
And after this my ActionBar MenyItem.getContext() was returning ContextThemeWrapper.

It maybe beneficial to users to change examples and readme to on(Activity activity, final View view) instead and maybe get rid of on(final View view) at all.

yes thanks