项目作者: Commit451

项目描述 :
Fancy debouncing
高级语言: Java
项目地址: git://github.com/Commit451/Jounce.git
创建时间: 2016-04-28T22:55:49Z
项目社区:https://github.com/Commit451/Jounce

开源协议:Apache License 2.0

下载


Jounce

Fancy debouncing

Build Status

Usage

See the sample project for a comprehensive example.
In a simple form, it looks a little something like this:

  1. long oneSecond = TimeUnit.SECONDS.toMillis(1);
  2. //Void, since we are not keeping track of a value
  3. final Debouncer<Void> debouncer = new Debouncer<Void>(oneSecond) {
  4. @Override
  5. public void onValueSet(Void value) {
  6. Snackbar.make(getWindow().getDecorView(), "Toolbar was clicked 1 second ago", Snackbar.LENGTH_SHORT)
  7. .show();
  8. }
  9. };
  10. toolbar.setOnClickListener(new View.OnClickListener() {
  11. @Override
  12. public void onClick(View v) {
  13. //starts/restarts the deboucing
  14. debouncer.setValue(null);
  15. }
  16. });

The sample shows usage within a RecyclerView, as well as usage for search ahead within an example search activity

License

  1. Copyright 2017 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.