Only show quickadd controls on text changed, not on focus changed

pull/14/head
Sam Bosley 12 years ago
parent 2c8fee6597
commit 500e86ba83

@ -17,7 +17,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@ -138,12 +140,19 @@ public class QuickAddBar extends LinearLayout {
}
});
quickAddBox.setOnFocusChangeListener(new OnFocusChangeListener() {
quickAddBox.addTextChangedListener(new TextWatcher() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
boolean visible = !TextUtils.isEmpty(s) && quickAddBox.hasFocus();
boolean showControls = Preferences.getBoolean(R.string.p_show_quickadd_controls, true);
quickAddControlsContainer.setVisibility((showControls && hasFocus) ? View.VISIBLE : View.GONE);
quickAddControlsContainer.setVisibility((showControls && visible) ? View.VISIBLE : View.GONE);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {/**/}
@Override
public void afterTextChanged(Editable s) {/**/}
});
int fontSize = Preferences.getIntegerFromString(R.string.p_fontSize, 18);

@ -119,7 +119,7 @@ public class AstridLitePreferenceSpec extends AstridPreferenceSpec {
setPreference(prefs, editor, r, R.string.p_show_menu_sort, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_addons, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_quickadd_controls, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_quickadd_controls, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_task_edit_comments, false, ifUnset);

Loading…
Cancel
Save