项目作者: Commit451

项目描述 :
Quick setup for Long Press tooltips on views, similar to the default ActionBar/Toolbar behavior
高级语言: Java
项目地址: git://github.com/Commit451/CheatSheet.git
创建时间: 2016-06-08T01:54:09Z
项目社区:https://github.com/Commit451/CheatSheet

开源协议:Apache License 2.0

下载


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

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

or

  1. 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:

  1. CheatSheet.setFactory(new CheatSheet.Factory() {
  2. @NonNull
  3. @Override
  4. public Toast createToast(@NonNull View view, @NonNull CharSequence text) {
  5. //do all the custom things you want
  6. return Toast.makeText(view.getContext(), text, Toast.LENGTH_LONG)
  7. .setView(new CustomView(view.getContext()));
  8. }
  9. });

License

  1. Copyright 2016 Commit 451
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.