Search in sources :

Example 1 with LogUtil

use of dev.sagar.smsblocker.tech.utils.LogUtil in project SMSBlocker by sagarpawardev.

the class NewThreadActivity method addListeners.

public void addListeners() {
    final String methodName = "addListeners()";
    log.justEntered(methodName);
    etSearchContact.addTextChangedListener(new TextWatcher() {

        private LogUtil log = new LogUtil(this.getClass().getName());

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            final String methodName = "beforeTextChanged()";
            log.justEntered(methodName);
            log.info(methodName, "Nothing done here");
            log.returning(methodName);
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            final String methodName = "onTextChanged()";
            log.justEntered(methodName);
            log.info(methodName, "Nothing done here");
            log.returning(methodName);
        }

        @Override
        public void afterTextChanged(Editable editable) {
            final String methodName = "afterTextChanged()";
            log.justEntered(methodName);
            String searchStr = editable.toString();
            searchContacts(searchStr);
            log.returning(methodName);
        }
    });
    log.returning(methodName);
}
Also used : LogUtil(dev.sagar.smsblocker.tech.utils.LogUtil) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 2 with LogUtil

use of dev.sagar.smsblocker.tech.utils.LogUtil in project SMSBlocker by sagarpawardev.

the class HomeActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    // Inflate menu to add items to action bar if it is present.
    inflater.inflate(R.menu.menu_home, menu);
    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        // Log Initiate
        private LogUtil log = new LogUtil(this.getClass().getName());

        @Override
        public boolean onQueryTextSubmit(String query) {
            final String methodName = "onQueryTextSubmit()";
            log.justEntered(methodName);
            log.returning(methodName);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            final String methodName = "onQueryTextChange()";
            log.justEntered(methodName);
            // It is just standard procedure to check length before firing query
            log.info(methodName, "Filtering List with Query: " + newText);
            adapter.getFilter(RVHomeAdapter.FILTER_TEXT).filter(newText);
            // Uncheck switch
            // Otherwise searching in UnreadOnly mode will show results form read as well
            switchUnread.setChecked(false);
            log.returning(methodName);
            return true;
        }
    });
    return true;
}
Also used : LogUtil(dev.sagar.smsblocker.tech.utils.LogUtil) SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater) SearchManager(android.app.SearchManager)

Aggregations

LogUtil (dev.sagar.smsblocker.tech.utils.LogUtil)2 SearchManager (android.app.SearchManager)1 SearchView (android.support.v7.widget.SearchView)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 MenuInflater (android.view.MenuInflater)1