Skip to content

Commit

Permalink
prevent autodocus
Browse files Browse the repository at this point in the history
  • Loading branch information
midorikocak committed Oct 24, 2017
1 parent d7e46ff commit 05f4466
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

mTextView = (TextView) view.findViewById(R.id.selectedCurrencyPreference);
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
preferences.registerOnSharedPreferenceChangeListener(this);
mCurrencyPicker.setCurrenciesList(preferences.getStringSet("selectedCurrencies", new HashSet<String>()));
String selectedCurrency = preferences.getString("selectedCurrency", getString(R.string.default_currency));
mTextView.setText(selectedCurrency);
Expand All @@ -81,16 +82,26 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if(key.equals("selectedCurrency")){
mTextView.setText(sharedPreferences.getString(key, "CZK"));
mTextView.setText(sharedPreferences.getString(key, ""));
}
if (key.equals("selectedCurrencies")) {
mCurrencyPicker.setCurrenciesList(preferences.getStringSet("selectedCurrencies", new HashSet<String>()));
}
}

@Override
public void onResume() {
super.onResume();
preferences.registerOnSharedPreferenceChangeListener(this);
mTextView.setText(preferences.getString("selectedCurrency", "CZK"));
}

@Override
public void onPause() {
super.onPause();
preferences.registerOnSharedPreferenceChangeListener(this);
}

@Override
public void onSelectCurrency(String name, String code, String symbol,
int flagDrawableResID) {
Expand Down
6 changes: 5 additions & 1 deletion currencypicker/src/main/res/layout/currency_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
android:id="@+id/linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">

<EditText
Expand All @@ -13,7 +15,9 @@
android:drawableLeft="@drawable/ic_search"
android:hint="@string/search"
android:imeOptions="actionSearch"
android:maxLines="1" />
android:maxLines="1"
android:nextFocusLeft="@+id/currency_code_picker_search"
android:nextFocusUp="@+id/currency_code_picker_search" />

<ListView
android:id="@+id/currency_code_picker_listview"
Expand Down

0 comments on commit 05f4466

Please sign in to comment.