• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.dialer.main.impl.toolbar;
18 
19 import android.app.Activity;
20 import android.support.v7.app.AppCompatActivity;
21 import android.view.MenuItem;
22 
23 /** Useful callback for {@link SearchBarView} listeners. */
24 public interface SearchBarListener {
25 
26   /** Called when the user clicks on the search bar. */
onSearchBarClicked()27   void onSearchBarClicked();
28 
29   /** Called when the search query updates. */
onSearchQueryUpdated(String query)30   void onSearchQueryUpdated(String query);
31 
32   /** Called when the back button is clicked in the search bar. */
onSearchBackButtonClicked()33   void onSearchBackButtonClicked();
34 
35   /** Called when the voice search button is clicked. */
onVoiceButtonClicked(VoiceSearchResultCallback voiceSearchResultCallback)36   void onVoiceButtonClicked(VoiceSearchResultCallback voiceSearchResultCallback);
37 
38   /** Called when a toolbar menu item is clicked. */
onMenuItemClicked(MenuItem menuItem)39   boolean onMenuItemClicked(MenuItem menuItem);
40 
41   /** Called when {@link Activity#onPause()} is called. */
onActivityPause()42   void onActivityPause();
43 
44   /** Called when {@link AppCompatActivity#onUserLeaveHint()} is called. */
onUserLeaveHint()45   void onUserLeaveHint();
46 
47   /** Called when the user places a call from search (regular or dialpad). */
onCallPlacedFromSearch()48   void onCallPlacedFromSearch();
49 
50   /** Called when a permission is about to be requested. */
requestingPermission()51   void requestingPermission();
52 
53   /** Interface for returning voice results to the search bar. */
54   interface VoiceSearchResultCallback {
55 
56     /** Sets the voice results in the search bar and expands the search UI. */
setResult(String result)57     void setResult(String result);
58   }
59 }
60