Search in sources :

Example 56 with SearchView

use of android.support.v7.widget.SearchView in project Bilal by cdjalel.

the class SearchCityActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_city);
    setTitle(getString(R.string.app_name));
    mDBHelper = new LocationsDBHelper(this);
    mDBHelper.openReadable();
    mLanguage = UserSettings.getLanguage(this).toUpperCase(Locale.ENGLISH);
    SearchView searchView = findViewById(R.id.search_city_box);
    searchView.setOnQueryTextListener(this);
    searchView.setIconified(false);
    // XML tag has a bug
    searchView.setQueryHint(getString(R.string.search_city));
    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    Timber.i("onCreate: intent.action = " + intent.getAction());
    handleIntent(getIntent());
}
Also used : SearchView(android.support.v7.widget.SearchView) LocationsDBHelper(com.djalel.android.bilal.databases.LocationsDBHelper) Intent(android.content.Intent)

Example 57 with SearchView

use of android.support.v7.widget.SearchView in project Android-NotesApp by HelloPraveen.

the class MainActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    mi = menu.findItem(R.id.menu_imp);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    search(searchView);
    EditText et = searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
    et.setHint(MainActivity.this.getString(R.string.search));
    return true;
}
Also used : EditText(android.widget.EditText) SearchView(android.support.v7.widget.SearchView)

Example 58 with SearchView

use of android.support.v7.widget.SearchView in project SeniorProject by 5731075221-PM.

the class HospitalNearbyFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_hospital_nearby, container, false);
    appBarLayout.setExpanded(true, true);
    // searchView = (SearchView) view.findViewById(R.id.searchNearbyHospital);
    // searchView.setIconifiedByDefault(false);
    // searchView.setIconified(false);
    // searchView.clearFocus();
    // searchView.setQueryHint("ค้นหา");
    // searchView.setOnQueryTextListener(this);
    title = getActivity().findViewById(R.id.textTool);
    title.setText("ค้นหาโรงพยาบาลใกล้เคียง");
    recyclerView = (RecyclerView) view.findViewById(R.id.nearbyHospitalRecyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    adapter = new RecyclerViewAdapter(hosList);
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    adapter.setOnLoadMoreListener(new LoadMore() {

        @Override
        public void onLoadMore() {
            if (hosList.size() <= hospitalList.size()) {
                isLoading = true;
                hosList.add(null);
                adapter.notifyItemInserted(hosList.size() - 1);
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        hosList.remove(hosList.size() - 1);
                        adapter.notifyItemRemoved(hosList.size());
                        // Generating more data
                        int index = hosList.size();
                        int end = index + 10;
                        for (int i = index; i < end; i++) {
                            hosList.add(hospitalList.get(i));
                        }
                        if (isGPS && isNetwork)
                            sortHospital();
                        adapter.notifyDataSetChanged();
                        isLoading = false;
                    // adapter.setLoaded();
                    }
                }, 5000);
            } else {
                Toast.makeText(getActivity(), "Loading data completed", Toast.LENGTH_SHORT).show();
            }
        }
    });
    return view;
}
Also used : Handler(android.os.Handler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) SearchView(android.widget.SearchView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 59 with SearchView

use of android.support.v7.widget.SearchView in project SeniorProject by 5731075221-PM.

the class SearchSymptomFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_search_symptom, container, false);
    appBarLayout.setExpanded(true, true);
    empty = (TextView) view.findViewById(R.id.textEmpty);
    if (diseaseName.isEmpty())
        empty.setVisibility(View.VISIBLE);
    else
        empty.setVisibility(View.INVISIBLE);
    searchView = (SearchView) view.findViewById(R.id.searchSymptom);
    searchView.setIconifiedByDefault(false);
    searchView.setIconified(false);
    searchView.clearFocus();
    searchView.setQueryHint("ค้นหา");
    searchView.setOnQueryTextListener(this);
    recyclerView = (RecyclerView) view.findViewById(R.id.searchSymptomList);
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    conslayout = (ConstraintLayout) view.findViewById(R.id.searchSymptomLayout);
    empty.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
            return true;
        }
    });
    return view;
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ImageView(android.widget.ImageView) View(android.view.View) SearchView(android.widget.SearchView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) MotionEvent(android.view.MotionEvent) Nullable(android.support.annotation.Nullable)

Example 60 with SearchView

use of android.support.v7.widget.SearchView in project SeniorProject by 5731075221-PM.

the class ShowHospitalByOrder method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_show_by_order, container, false);
    // searchView = (SearchView) view.findViewById(R.id.searchHospitalByOrder);
    // searchView.setIconifiedByDefault(false);
    // searchView.setIconified(false);
    // searchView.clearFocus();
    // searchView.setQueryHint("ค้นหา");
    // searchView.setOnQueryTextListener(this);
    recyclerView = (IndexFastScrollRecyclerView) view.findViewById(R.id.searchHospitalList);
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    recyclerView.setIndexBarColor("#f9f9f9");
    recyclerView.setIndexBarTextColor("#4d4d4d");
    recyclerView.setIndexBarHighLateTextVisibility(true);
    recyclerView.setIndexbarHighLateTextColor("#4cd29f");
    return view;
}
Also used : DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) SearchView(android.widget.SearchView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) IndexFastScrollRecyclerView(in.myinnos.alphabetsindexfastscrollrecycler.IndexFastScrollRecyclerView) Nullable(android.support.annotation.Nullable)

Aggregations

SearchView (android.support.v7.widget.SearchView)151 MenuItem (android.view.MenuItem)88 View (android.view.View)56 SearchManager (android.app.SearchManager)37 RecyclerView (android.support.v7.widget.RecyclerView)35 TextView (android.widget.TextView)26 MenuInflater (android.view.MenuInflater)24 ImageView (android.widget.ImageView)20 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)19 MenuItemCompat (android.support.v4.view.MenuItemCompat)18 Toolbar (android.support.v7.widget.Toolbar)16 SearchView (android.widget.SearchView)12 ArrayList (java.util.ArrayList)11 ViewGroup (android.view.ViewGroup)10 MaterialSearchView (com.miguelcatalan.materialsearchview.MaterialSearchView)10 Intent (android.content.Intent)9 ListView (android.widget.ListView)9 BindView (butterknife.BindView)9 AdapterView (android.widget.AdapterView)8 EditText (android.widget.EditText)8