Skip to content

Commit 5fb850b

Browse files
kshitiz-kumarjddeep
authored andcommitted
NeuroSettingsFragment bug
1 parent ed9cd98 commit 5fb850b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/src/main/java/io/neurolab/fragments/NeuroSettingsFragment.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import android.view.inputmethod.EditorInfo;
99
import android.view.inputmethod.InputMethodManager;
1010
import android.widget.TextView;
11+
import android.widget.Toast;
1112

1213
import com.takisoft.fix.support.v7.preference.EditTextPreference;
13-
1414
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat;
1515

1616
import io.neurolab.R;
@@ -40,6 +40,19 @@ public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String r
4040

4141
@Override
4242
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+
}
4356
switch (key) {
4457
// TODO: Set limits to following preferences
4558
case KEY_SAMPLES:
@@ -91,7 +104,7 @@ private String pluralize(int count) {
91104

92105
@Override
93106
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
94-
if(actionId == EditorInfo.IME_ACTION_DONE){
107+
if (actionId == EditorInfo.IME_ACTION_DONE) {
95108
InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
96109
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
97110
return true;

0 commit comments

Comments
 (0)