|
8 | 8 | import android.view.inputmethod.EditorInfo;
|
9 | 9 | import android.view.inputmethod.InputMethodManager;
|
10 | 10 | import android.widget.TextView;
|
| 11 | +import android.widget.Toast; |
11 | 12 |
|
12 | 13 | import com.takisoft.fix.support.v7.preference.EditTextPreference;
|
13 |
| - |
14 | 14 | import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat;
|
15 | 15 |
|
16 | 16 | import io.neurolab.R;
|
@@ -40,6 +40,19 @@ public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String r
|
40 | 40 |
|
41 | 41 | @Override
|
42 | 42 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
| 43 | + |
| 44 | + if (samplesPref.getText().isEmpty()) { |
| 45 | + samplesPref.setText("3"); |
| 46 | + Toast.makeText(getActivity(), "Enter valid input !", Toast.LENGTH_SHORT).show(); |
| 47 | + } |
| 48 | + if (binsPref.getText().isEmpty()) { |
| 49 | + binsPref.setText("4"); |
| 50 | + Toast.makeText(getActivity(), "Enter valid input !", Toast.LENGTH_SHORT).show(); |
| 51 | + } |
| 52 | + if (channelsPref.getText().isEmpty()) { |
| 53 | + channelsPref.setText("2"); |
| 54 | + Toast.makeText(getActivity(), "Enter valid input !", Toast.LENGTH_SHORT).show(); |
| 55 | + } |
43 | 56 | switch (key) {
|
44 | 57 | // TODO: Set limits to following preferences
|
45 | 58 | case KEY_SAMPLES:
|
@@ -91,7 +104,7 @@ private String pluralize(int count) {
|
91 | 104 |
|
92 | 105 | @Override
|
93 | 106 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
94 |
| - if(actionId == EditorInfo.IME_ACTION_DONE){ |
| 107 | + if (actionId == EditorInfo.IME_ACTION_DONE) { |
95 | 108 | InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
96 | 109 | imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
97 | 110 | return true;
|
|
0 commit comments