Redisplay a hidden button after it entered the screen again.

Bug: 7600384
Change-Id: I6cd18fd7584b6e98260cb432956f08ba9886580b
This commit is contained in:
Jean Chalard 2013-04-16 21:54:22 +09:00
parent f8014eea34
commit 825da76c72

View file

@ -68,6 +68,7 @@ public final class WordListPreference extends DialogPreference {
static final private int ANIMATION_OUT = 2; static final private int ANIMATION_OUT = 2;
private static int sLastClickedIndex = NOT_AN_INDEX; private static int sLastClickedIndex = NOT_AN_INDEX;
private static String sLastClickedWordlistId = null;
private final OnWordListPreferenceClick mPreferenceClickHandler = private final OnWordListPreferenceClick mPreferenceClickHandler =
new OnWordListPreferenceClick(); new OnWordListPreferenceClick();
private final OnActionButtonClick mActionButtonClickHandler = private final OnActionButtonClick mActionButtonClickHandler =
@ -199,7 +200,8 @@ public final class WordListPreference extends DialogPreference {
((ViewGroup)view).setLayoutTransition(null); ((ViewGroup)view).setLayoutTransition(null);
final Button button = (Button)view.findViewById(R.id.wordlist_button); final Button button = (Button)view.findViewById(R.id.wordlist_button);
button.setText(getButtonLabel(mStatus)); button.setText(getButtonLabel(mStatus));
button.setVisibility(View.INVISIBLE); // String identity match. This is an ==, not an .equals, on purpose.
button.setVisibility(mWordlistId == sLastClickedWordlistId ? View.VISIBLE : View.INVISIBLE);
button.setOnClickListener(mActionButtonClickHandler); button.setOnClickListener(mActionButtonClickHandler);
view.setOnClickListener(mPreferenceClickHandler); view.setOnClickListener(mPreferenceClickHandler);
} }
@ -218,6 +220,7 @@ public final class WordListPreference extends DialogPreference {
animateButton(getButtonForIndex(listView, sLastClickedIndex), ANIMATION_OUT); animateButton(getButtonForIndex(listView, sLastClickedIndex), ANIMATION_OUT);
} }
sLastClickedIndex = myIndex; sLastClickedIndex = myIndex;
sLastClickedWordlistId = mWordlistId;
} }
} }