Commit451 / CheatSheet

Quick setup for Long Press tooltips on views, similar to the default ActionBar/Toolbar behavior

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CheatSheet

Quick setup for Long Press tooltips on views, similar to the default ActionBar/Toolbar behavior. Originally contained within AOSP, this version found within Telecine

Deprecated

This is now supported as of API 26, using the Tooltip API or TooltipCompat

Build Status

Image

Usage

CheatSheet.setup(fab, "This is how you favorite");

or

CheatSheet.setup(fab, R.string.favorite);

This will establish a long click listener on the fab view, and any time it is long clicked, a Toast will appear near the view (similar to what happens when you long press an item in a typical ActionBar/Toolbar

If you want to customize the style of the Toasts that appear, use a factory:

CheatSheet.setFactory(new CheatSheet.Factory() {
    @NonNull
    @Override
    public Toast createToast(@NonNull View view, @NonNull CharSequence text) {
        //do all the custom things you want
        return Toast.makeText(view.getContext(), text, Toast.LENGTH_LONG)
            .setView(new CustomView(view.getContext()));
    }
});

License

Copyright 2016 Commit 451

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.

About

Quick setup for Long Press tooltips on views, similar to the default ActionBar/Toolbar behavior

License:Apache License 2.0


Languages

Language:Java 100.0%