Merge "Trapping backspace at EditText level to prevent popping Docs." into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2df618f4cd
@@ -22,6 +22,7 @@ import android.app.FragmentTransaction;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -91,6 +92,14 @@ public class SaveFragment extends Fragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returning false in this method will bubble the event up to
|
||||||
|
// {@link BaseActivity#onKeyDown}. In order to prevent backspace popping
|
||||||
|
// documents once the textView is empty, we are going to trap it here.
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_DEL
|
||||||
|
&& TextUtils.isEmpty(mDisplayName.getText())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_ENTER && mSave.isEnabled()) {
|
if (keyCode == KeyEvent.KEYCODE_ENTER && mSave.isEnabled()) {
|
||||||
performSave();
|
performSave();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user