Commit 9ae103cb authored by Grigory Fedorov's avatar Grigory Fedorov

ConferenceFilterActivity: single line edit text. "Next" and "done" events...

ConferenceFilterActivity: single line edit text. "Next" and "done" events returns results back to ConferenceSelect.
parent 09147980
......@@ -7,10 +7,12 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import com.xabber.android.R;
import com.xabber.android.data.intent.AccountIntentBuilder;
......@@ -25,7 +27,7 @@ import java.util.ArrayList;
import java.util.List;
public class ConferenceFilterActivity extends ManagedActivity implements TextWatcher, View.OnClickListener,
AdapterView.OnItemClickListener {
AdapterView.OnItemClickListener, TextView.OnEditorActionListener {
public static final String ARG_CONFERENCE_NAME = "com.xabber.android.ui.ConferenceFilterActivity.ARG_CONFERENCE_NAME";
public static final String ARG_CONFERENCE_LIST_NAMES = "com.xabber.android.ui.ConferenceFilterActivity.ARG_CONFERENCE_LIST_NAMES";
......@@ -53,14 +55,18 @@ public class ConferenceFilterActivity extends ManagedActivity implements TextWat
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
returnResult();
return true;
}
return super.dispatchKeyEvent(event);
}
private void returnResult() {
Intent data = new Intent();
data.putExtra(ARG_CONFERENCE_NAME, conferenceNameEditText.getText().toString());
setResult(RESULT_OK, data);
finish();
return true;
}
return super.dispatchKeyEvent(event);
}
@Override
......@@ -74,6 +80,7 @@ public class ConferenceFilterActivity extends ManagedActivity implements TextWat
conferenceNameEditText = (EditText)findViewById(R.id.room_name_edit_text);
conferenceNameEditText.addTextChangedListener(this);
conferenceNameEditText.setOnEditorActionListener(this);
setRoomClearButtonVisibility();
......@@ -153,4 +160,15 @@ public class ConferenceFilterActivity extends ManagedActivity implements TextWat
startActivity(ConferenceAdd.createIntent(this, account,
hostedConferencesAdapter.getItem(position).getJid()));
}
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) {
returnResult();
return true;
}
else {
return false;
}
}
}
......@@ -23,6 +23,7 @@
android:paddingLeft="16dp"
android:id="@+id/room_name_edit_text"
android:imeOptions="flagNoExtractUi"
android:singleLine="true"
/>
<ImageButton
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment