Search in sources :

Example 1 with ActionModeHelper

use of com.ushahidi.android.app.helpers.ActionModeHelper in project Ushahidi_Android by ushahidi.

the class ListMapFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setHasOptionsMenu(true);
    mListMapModel = new ListMapModel();
    this.dialog = new ProgressDialog(getActivity());
    this.dialog.setCancelable(true);
    this.dialog.setIndeterminate(true);
    this.dialog.setMessage(getString(R.string.please_wait));
    if (Util.isHoneycomb()) {
        listView.setLongClickable(true);
        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView.setOnItemLongClickListener(new ActionModeHelper(this, listView));
    } else {
        registerForContextMenu(listView);
    }
    // filter map list
    if (view != null) {
        if (view.mSearchMap != null) {
            view.mSearchMap.addTextChangedListener(new TextWatcher() {

                public void afterTextChanged(Editable arg0) {
                }

                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                }

                public void onTextChanged(CharSequence s, int start, int before, int count) {
                    if (!(TextUtils.isEmpty(s.toString()))) {
                        filter = s.toString();
                        mHandler.post(filterMapList);
                    } else {
                        mHandler.post(fetchMapList);
                    }
                }
            });
        }
    }
    if (savedInstanceState != null) {
        int position = savedInstanceState.getInt(STATE_CHECKED, -1);
        if (position > -1) {
            listView.setItemChecked(position, true);
        }
    }
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) ListMapModel(com.ushahidi.android.app.models.ListMapModel) ProgressDialog(android.app.ProgressDialog) ActionModeHelper(com.ushahidi.android.app.helpers.ActionModeHelper)

Aggregations

ProgressDialog (android.app.ProgressDialog)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 ActionModeHelper (com.ushahidi.android.app.helpers.ActionModeHelper)1 ListMapModel (com.ushahidi.android.app.models.ListMapModel)1