Skip to content

Allow spanable text on tooltip.#2

Merged
hossain-khan merged 1 commit intomasterfrom
feature/use_simplified_api_to_use_charsequence
Apr 1, 2018
Merged

Allow spanable text on tooltip.#2
hossain-khan merged 1 commit intomasterfrom
feature/use_simplified_api_to_use_charsequence

Conversation

@hossain-khan
Copy link
Owner

Cleanup API to allow user to use the spannable text. Updated sample app with usage.

Changelog

  • [UPDATE] Use ToolTip.Builder() with CharSequence message that is more inclusive than String and Spannable.
  • [REMOVED] Redundant ToolTip.Builder() with Spannable message after the API update, and updated code accordingly.
  • [ADDED] First time tooltip message with span to showcase the possibility.
  • [ADDED] @Nullable and @NonNull to be future proof (kotlin tsk tsk).

Screenshot

API 26

device-2018-04-01-141512

NOTE: This is an extension of #1

API 16

screenshot_1522607356

Reference Usage - Google+ App

device-2018-04-01-135626

…more inclusive than `String` and `Spannable`.

[REMOVED] Redundant `ToolTip.Builder()` with `Spannable` message after the API update, and updated code accordingly.
[ADDED] First time tooltip message with span to showcase the possibility.
[ADDED] `@Nullable` and `@NonNull` to be future proof _(kotlin tsk tsk)_.
@hossain-khan hossain-khan force-pushed the feature/use_simplified_api_to_use_charsequence branch from 41bc329 to 85911c9 Compare April 1, 2018 18:46
private @NonNull Context mContext;
private @NonNull View mAnchorView;
private @NonNull ViewGroup mRootViewGroup;
private @NonNull CharSequence mMessage;
Copy link
Owner Author

@hossain-khan hossain-khan Apr 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key API change.

* @param message spannable message to show
* @param position put the tip above / below / left to / right to
*/
public Builder(Context context, View anchorView, ViewGroup root, Spannable message, @Position int position) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Spannable does not cover everything. For example Html.fromHtml() returns Spanned which is super class of Spannable, hence can't be used here.

@hossain-khan hossain-khan merged commit ee4724e into master Apr 1, 2018
@hossain-khan hossain-khan deleted the feature/use_simplified_api_to_use_charsequence branch April 1, 2018 18:48
hossain-khan added a commit that referenced this pull request Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant