com.arlib.floatingsearchview.FloatingSearchView Java Examples

The following examples show how to use com.arlib.floatingsearchview.FloatingSearchView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchResultsActivity.java    From foodie-app with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_result);
    query = getIntent().getStringExtra("query");
    mFloatingSearchView = (FloatingSearchView) findViewById(R.id.floating_search_view);
    mFloatingSearchView.setOnHomeActionClickListener(new FloatingSearchView.OnHomeActionClickListener() {
        @Override
        public void onHomeClicked() {
            onBackPressed();
        }
    });
    mFloatingSearchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {
        @Override
        public void onActionMenuItemSelected(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.id_action_search:
                    doSearch(mFloatingSearchView.getQuery().toString());
                    break;
            }
        }
    });
    //搜索结果
    Fragment SearchResultFragment = DishListFragment.newInstance(query);
    getSupportFragmentManager().beginTransaction().add(R.id.search_result, SearchResultFragment).commit();
}
 
Example #2
Source File: SlidingSearchViewExampleFragment.java    From floatingsearchview with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
    mHeaderView = view.findViewById(R.id.header_view);

    mDimSearchViewBackground = view.findViewById(R.id.dim_background);
    mDimDrawable = new ColorDrawable(Color.BLACK);
    mDimDrawable.setAlpha(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mDimSearchViewBackground.setBackground(mDimDrawable);
    } else {
        mDimSearchViewBackground.setBackgroundDrawable(mDimDrawable);
    }

    setupFloatingSearch();
    setupDrawer();
}
 
Example #3
Source File: MainActivity.java    From GooglePlayCloned with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    CustomViewPager viewPager = findViewById(R.id.mainViewPager);
    setupViewPager(viewPager);

    TabLayout tabLayout = findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    final FloatingSearchView mSearchView = findViewById(R.id.search_view);

    mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
        @Override
        public void onSearchTextChanged(String oldQuery, final String newQuery) {

        }
    });

    final DrawerLayout drawer = findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer,
            null,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setItemIconTintList(null);

    de.hdodenhof.circleimageview.CircleImageView profileImageView = navigationView.getHeaderView(0).findViewById(R.id.profile_image);
    Glide.with(this)
            .load(R.drawable.profile_image)
            .into(profileImageView);

    mSearchView.attachNavigationDrawerToMenuButton(drawer);
}
 
Example #4
Source File: FreightTrackBaiduMapFragment.java    From ESeal with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    String token = PreferencesHelper.getTOKEN(getContext());
    if (token != null) {
        suggestionList.clear();
        //获取所有设备货物信息
        RetrofitManager.builder(PathType.WEB_SERVICE_V2_TEST)
                .getAllDeviceFreightListObservable(token)
                .subscribe(new Subscriber<List<DeviceSearchSuggestion>>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        Log.d(TAG, "onError: getAllDeviceFreightListObservable()");
                    }

                    @Override
                    public void onNext(List<DeviceSearchSuggestion> deviceSearchSuggestions) {
                        if (deviceSearchSuggestions != null && !deviceSearchSuggestions.isEmpty()) {
                            suggestionList.addAll(deviceSearchSuggestions);
                        }
                    }
                });
    }

    setupBaiduMap();

    mHandler = new Handler();

    floatingSearchView = (FloatingSearchView) view.findViewById(R.id.floatingSearchview);
    setupFloatingSearch();
}
 
Example #5
Source File: SearchFragment.java    From MaterialWeCenter with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mAdapter = new SearchViewAdapter(getActivity(), mList);
    mRecyclerView.setAdapter(mAdapter);
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
        @Override
        public void onSearchTextChanged(String oldQuery, String newQuery) {
            q = newQuery;
            new SearchTask().execute();
        }
    });
    searchView.setOnLeftMenuClickListener(new FloatingSearchView.OnLeftMenuClickListener() {
        @Override
        public void onMenuOpened() {

        }

        @Override
        public void onMenuClosed() {

        }
    });
    if (drawerLayout != null)
        searchView.attachNavigationDrawerToMenuButton(drawerLayout);
}
 
Example #6
Source File: ScrollingSearchExampleFragment.java    From floatingsearchview with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
    mAppBar = (AppBarLayout) view.findViewById(R.id.appbar);

    mAppBar.addOnOffsetChangedListener(this);

    setupDrawer();
    setupSearchBar();
}
 
Example #7
Source File: RxFloatingSearchView.java    From floatingsearchview with Apache License 2.0 5 votes vote down vote up
@CheckResult
@NonNull
public static InitialValueObservable<CharSequence> queryChanges(
        @NonNull FloatingSearchView view, int characterLimit) {
    checkNotNull(view, "view == null");
    return new QueryObservable(view, characterLimit);
}
 
Example #8
Source File: SlidingSearchResultsExampleFragment.java    From floatingsearchview with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
    mSearchResultsList = (RecyclerView) view.findViewById(R.id.search_results_list);

    setupFloatingSearch();
    setupResultsList();
    setupDrawer();
}
 
Example #9
Source File: SearchListener.java    From android-auto-call-recorder with MIT License 4 votes vote down vote up
public FloatingSearchView.OnQueryChangeListener init() {
    return this;
}
 
Example #10
Source File: QueryObservable.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
public Listener(FloatingSearchView view, Observer<? super CharSequence> observer, int minQueryLength) {
    this.view = view;
    this.observer = observer;
    this.minQueryLength = minQueryLength;
}
 
Example #11
Source File: QueryObservable.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
public QueryObservable(FloatingSearchView view, int minQueryLength) {
    this.view = view;
    this.minQueryLength = minQueryLength;
}
 
Example #12
Source File: QueryObservable.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
public QueryObservable(FloatingSearchView view) {
    this(view, 1);
}
 
Example #13
Source File: RxFloatingSearchView.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
@CheckResult
@NonNull
public static InitialValueObservable<CharSequence> queryChanges(
        @NonNull FloatingSearchView view) {
    return queryChanges(view, 1);
}
 
Example #14
Source File: MainActivity.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
@Override
public void onAttachSearchViewToDrawer(FloatingSearchView searchView) {
    searchView.attachNavigationDrawerToMenuButton(mDrawerLayout);
}
 
Example #15
Source File: BaseExampleFragment.java    From floatingsearchview with Apache License 2.0 4 votes vote down vote up
protected void attachSearchViewActivityDrawer(FloatingSearchView searchView){
    if(mCallbacks != null){
        mCallbacks.onAttachSearchViewToDrawer(searchView);
    }
}
 
Example #16
Source File: SearchActivity.java    From POCenter with MIT License 4 votes vote down vote up
/**
 * set listeners
 */
private void initEvent() {
    // refresh listener
    bind.vContent.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            loadData(true);
        }
    });
    // load more listener
    searchAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
        @Override
        public void onLoadMoreRequested() {
            bind.rv.post(new Runnable() {
                @Override
                public void run() {
                    loadMore();
                }
            });
        }
    });

    // item click listener
    bind.rv.addOnItemTouchListener(new OnItemClickListener() {
        @Override
        public void SimpleOnItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
            // get item url
            ProjectBean project = (ProjectBean) baseQuickAdapter.getItem(i);
            // start detail activity
            Intent intent = new Intent(SearchActivity.this, DetailActivity.class);
            intent.putExtra(DetailActivity.EXTRA_URL, project.url);
            intent.putExtra(DetailActivity.EXTRA_TITLE, project.title);
            intent.putExtra(DetailActivity.EXTRA_DESCRIPTION, project.description);
            startActivity(intent);
        }
    });

    // search listener
    bind.fsv.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
        @Override
        public void onSuggestionClicked(SearchSuggestion searchSuggestion) {

        }

        @Override
        public void onSearchAction(String currentQuery) {
            if (!TextUtils.isEmpty(currentQuery)) {
                presenter.setSearchString(currentQuery);
                loadData(false);
            }
        }
    });
}
 
Example #17
Source File: SearchListener.java    From android-auto-call-recorder with MIT License 4 votes vote down vote up
public FloatingSearchView.OnQueryChangeListener init(Bundle args) {
    mArguments = args;
    return this;
}
 
Example #18
Source File: RecordsListFragment.java    From android-auto-call-recorder with MIT License 4 votes vote down vote up
public FloatingSearchView.OnQueryChangeListener getOnQueryChangeListener() {
    return this;
}
 
Example #19
Source File: BaseExampleFragment.java    From floatingsearchview with Apache License 2.0 votes vote down vote up
void onAttachSearchViewToDrawer(FloatingSearchView searchView);