GithubHelp home page GithubHelp logo

searchdialog's Introduction

SearchDialog

仿bilibili搜索框效果(只需要三句话即可实现)

先看预览图(转换后有一点点失真):

前言

1,支持搜索历史(已经做了数据库存储了)

2,基本与bilibili的搜索效果差不多了

3,需要修改更多内容可以下载library自己修改

4,本人非大牛,有不妥之处请Issues指出,谢谢

5,参考了该po的文章 ,感谢

6,感谢各位提交Issues,隔了这么久才更新,对8起

Update log

  • 1.0.1版本:修复对aapt2支持,增添判断二次打开问题。

Usage

With Gradle:

  implementation 'com.wenwenwen888:searchbox:1.0.1'

How to use

第一句 , 实例化:

 SearchFragment searchFragment = SearchFragment.newInstance();

第二句 , 设置回调:

 searchFragment.setOnSearchClickListener(new IOnSearchClickListener() {
            @Override
            public void OnSearchClick(String keyword) {
                //这里处理逻辑
                Toast.makeText(ToolBarActivity.this, keyword, Toast.LENGTH_SHORT).show();
            }
        });

第三句 , 显示搜索框:

  searchFragment.showFragment(getSupportFragmentManager(),SearchFragment.TAG);

License

Copyright 2016 wenwenwen888

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.

searchdialog's People

Contributors

wenwenwen888 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

searchdialog's Issues

~~

用surfaceView 就更好了

写的很好,提一个意见

控件写的非常的棒,但是提一个小的意见,请把语言全部放到steings.xml里面,这样我不需要下载代码存放本地就可以修改语言

fastclick problem

it will toggle multiply the IOnSearchClickListener.OnSearchClick(String str) if you try click many times fastly cancelbutton or each itemview keywords of searchHistoryAdapter as possible as you can, it is a suggestion can get over it :

private long lastClickTime;

/**
 * judge  there is  mulitclick's action between last click time and  now's time
 */
public boolean isFastDoubleClick() {
    long time = System.currentTimeMillis();
    long timeD = time - lastClickTime;
    if (0 < timeD && timeD < 500) { // this number isn't must be valued 500,just insteal your animation's duration    
        return true;
    }
    lastClickTime = time;
    return false;
}

And use it in functions of OnItemClick() and hideAnim()

Maybe you already found this issues, this is my gratitude for your SearchFragment ! ↖(^ω^)↗

感谢大佬的分享,下一步还继续优化么,提一些建议。

1、历史记录的数量可以进行限制,保存最新的N条搜索记录。
2、历史记录目前只能竖直排列,可以考虑新增横向排列,这样显示的数量就能多一些。类似哔哩哔哩。
3、app里面有多个页面的搜索,但是页面内容不是同一类东西。能不能分别保存和读取他们的搜索记录。比如目前我在班级搜索页面进行搜索,会提示之前在学生搜索页面搜索的学生名字。

大佬

项目还在维护么 能适配一下 appt2 么 如果还在维护希望您能回复

请问这是什么问题?

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java)
at android.support.v4.app.DialogFragment.dismissInternal(DialogFragment.java)
at android.support.v4.app.DialogFragment.dismiss(DialogFragment.java)
at com.wyt.searchbox.SearchFragment.onHideAnimationEnd(SearchFragment.java)
at com.wyt.searchbox.custom.CircularRevealAnim$1.onAnimationEnd(CircularRevealAnim.java)
at android.view.RenderNodeAnimator.onFinished(RenderNodeAnimator.java:376)
at android.animation.RevealAnimator.onFinished(RevealAnimator.java:43)
at android.view.RenderNodeAnimator.callOnFinished(RenderNodeAnimator.java:483)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:153)
at android.os.Looper.loop(Looper.java:178)
at android.app.ActivityThread.main(ActivityThread.java:5911)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

大佬

image
你可能要更新一下

感谢大佬的分享,下一步还继续优化么,提一些建议。

1、历史记录的数量可以进行限制,保存最新的N条搜索记录。
2、历史记录目前只能竖直排列,可以考虑新增横向排列,这样显示的数量就能多一些。类似哔哩哔哩。
3、app里面有多个页面的搜索,但是页面内容不是同一类东西。能不能分别保存和读取他们的搜索记录。比如目前我在班级搜索页面进行搜索,会提示之前在学生搜索页面搜索的学生名字。

使用过之后的小建议

整体的效果很棒。但是还是有几个小问题:
1.搜索记录应该过滤掉重复的数据,比如我一直重复搜索相同的内容,记录里会一直存相同的,正常应该只显示一个。
2.能开放一下最多保存几条数据的方法就好了,因为现在有很多项目会限制显示记录的条数。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.