All Projects → sahildave → Search View Layout

sahildave / Search View Layout

Licence: apache-2.0
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Search View Layout

Ripple Without Js
Create Material Design ripple effect in your HTML without using a single line of JS.
Stars: ✭ 53 (-95.21%)
Mutual labels:  material-design
Espresso
🚚 Espresso is an express delivery tracking app designed with Material Design style, built on MVP(Model-View-Presenter) architecture with RxJava2, Retrofit2, Realm database and ZXing
Stars: ✭ 1,084 (-2.08%)
Mutual labels:  material-design
Youtube Play Icon
Material style morphing play-pause drawable for Android
Stars: ✭ 57 (-94.85%)
Mutual labels:  material-design
Neteasemusic
Material Design NetEase Music Player In MVP Pattern Design 网易云音乐
Stars: ✭ 53 (-95.21%)
Mutual labels:  material-design
Open Semantic Search Apps
Python/Django based webapps and web user interfaces for search, structure (meta data management like thesaurus, ontologies, annotations and named entities) and data import (ETL like text extraction, OCR and crawling filesystems or websites)
Stars: ✭ 55 (-95.03%)
Mutual labels:  search-interface
Typesense Instantsearch Adapter
A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
Stars: ✭ 56 (-94.94%)
Mutual labels:  search-interface
Fancytoast Android
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.
Stars: ✭ 1,067 (-3.61%)
Mutual labels:  material-design
Expenses
💰Expense tracker using Google Sheets 📉 as a storage written in React
Stars: ✭ 1,105 (-0.18%)
Mutual labels:  material-design
Paper Ripple
Material Design Ripple effect in pure JS & CSS.
Stars: ✭ 55 (-95.03%)
Mutual labels:  material-design
Battery Meter View
🔋 Material design battery meter (i.e. level, state) view for Android
Stars: ✭ 57 (-94.85%)
Mutual labels:  material-design
Material Ui Password Field
A password field using Material-UI.
Stars: ✭ 54 (-95.12%)
Mutual labels:  material-design
Instantsearch Ios Examples
Example apps built with InstantSearch iOS
Stars: ✭ 55 (-95.03%)
Mutual labels:  search-interface
Materialtaptargetprompt Ios
A iOS version of Material Tap Target Prompt
Stars: ✭ 56 (-94.94%)
Mutual labels:  material-design
Mdi Vue
Material design icons for vue.js
Stars: ✭ 53 (-95.21%)
Mutual labels:  material-design
Ct Vue Material Dashboard Pro
Vue Material Dashboard Pro - Material Design Admin
Stars: ✭ 58 (-94.76%)
Mutual labels:  material-design
Material Typecho
🎨 简洁 material 风格 typecho 主题
Stars: ✭ 53 (-95.21%)
Mutual labels:  material-design
Expandable Fab
A highly customizable 'speed dial' FloatingActionButton implementation.
Stars: ✭ 56 (-94.94%)
Mutual labels:  material-design
Materialfiles
Material Design file manager for Android
Stars: ✭ 1,092 (-1.36%)
Mutual labels:  material-design
Datetimepicker
Material themed DateTimePickers from the Android framework for all API levels (API 14+)
Stars: ✭ 58 (-94.76%)
Mutual labels:  material-design
Ct Material Kit Pro React Native
Material Kit PRO React Native is a fully coded app template built over Galio.io, React Native and Expo
Stars: ✭ 57 (-94.85%)
Mutual labels:  material-design

THIS PROJECT IS DEPRECATED

Component is not maintained anymore.

Implementation of Lollipop+ Dialer and Google Maps.

DEMO

Screenshot

Add in View

Add to your layout by using the include tag.

<include layout="@layout/widget_search_bar"/>

API

This overlays the full activity and shows the fragment which you have assigned by using setExpandedContentFragment.

searchViewLayout.setExpandedContentFragment(this, new SearchStaticFragment());

If you want to animate your Toolbar too like the demo gif, you can enable it by using handleToolbarAnimation.

searchViewLayout.handleToolbarAnimation(toolbar);

Setting Background colors for Transition. Default should also work just fine:

// Create Drawable for collapsed state. Default color is android.R.color.transparent
ColorDrawable collapsed = new ColorDrawable(
    ContextCompat.getColor(this, R.color.colorPrimary));

// Create Drawable for expanded state. Default color is #F0F0F0
ColorDrawable expanded = new ColorDrawable(
    ContextCompat.getColor(this, R.color.default_color_expanded));

// Send both colors to searchViewLayout
searchViewLayout.setTransitionDrawables(collapsed, expanded);

Listen to search complete by:

searchViewLayout.setSearchListener(new SearchViewLayout.SearchListener() {
    @Override
    public void onFinished(String searchKeyword) {
        searchViewLayout.collapse();
        Snackbar.make(searchViewLayout, "Search Done - " + searchKeyword, Snackbar.LENGTH_LONG).show();
    }
});

Listen to collapse/expand animation by using setOnToggleAnimationListener. For eg the FAB in demo hides on expanded and shows on collapse.

searchViewLayout.setOnToggleAnimationListener(new SearchViewLayout.OnToggleAnimationListener() {
    @Override
    public void onStart(boolean expanded) {
        if(expanded) {
            fab.hide();
        } else {
            fab.show();
        }
    }

    @Override
    public void onFinish(boolean expanded) { }
});

Listen to search box complete by:

searchViewLayout.setSearchBoxListener(new SearchViewLayout.SearchBoxListener() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
    @Override
    public void afterTextChanged(Editable s) {
    }
});

Setting Hints

If you want to set hints in the view, there are three APIs. setCollapsedHint would come up in the default/collapsed state. setExpandedHint would work for expanded state i.e. after click the view and the keyboard is up. setHint would set both the hints in one go, use this you want to show the same hint in both the states.

searchViewLayout.setCollapsedHint("Collapsed Hint");
searchViewLayout.setExpandedHint("Expanded Hint");
searchViewLayout.setHint("Global Hint");

Setting Icons Use setCollapsedIcon, setExpandedBackIcon, setExpandedSearchIcon to setup icons according to your choice. The argument should be a DrawableRes

NOTES

  1. If you want to add a scrolling widget in your setExpandedContentFragment, add a onTouchListener and disallow the parent intercept by usingv.getParent().requestDisallowInterceptTouchEvent(true);Check out fragments in sample for the implement of ListView, RecyclerView and ScrollView.

    recyclerView.setOnTouchListener(new View.OnTouchListener() {
        // Setting on Touch Listener for handling the touch inside ScrollView
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // Disallow the touch request for parent scroll on touch of child view
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
    
    
  2. The default height of the view is 120dp which is also present in the dimens.xml file as

    <dimen name="search_view_layout_approx_height">120dp</dimen>
    

    You can use it for adding margin on top of your main content layout.

GET

Available at jCenter and mavenCentral.

dependencies {
    compile 'xyz.sahildave:searchviewlayout:0.6'
}

CHANGELOG

0.6

  • Added support for API 15

0.5

  • Added support for fragment-v4

0.4

  • Moved anim files to /animator res dir

0.3

  • Added search edit text API
  • Larger touch target

0.2

  • Added APIs for setting icons
  • Improved animations by using onAnimationUpdate

0.1

  • Added hints API.
  • Added search_view_layout_approx_height

0.0.2

  • Added API setTransitionDrawables which solves crashes in < API 19

Contribute

Contribute by creating issues (tagged enhancement, bugs) in the repo or create a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].