use validation lib in cpp - better event handling
This commit is contained in:
parent
11d0f1aebf
commit
48a158b036
2 changed files with 48 additions and 18 deletions
|
@ -65,12 +65,14 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
ImageView iceditIcon;
|
ImageView iceditIcon;
|
||||||
ImageView isfeditIcon;
|
ImageView isfeditIcon;
|
||||||
BasalEditDialog basalEditDialog;
|
BasalEditDialog basalEditDialog;
|
||||||
|
LinearLayout ll;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
|
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
|
||||||
|
ll = (LinearLayout) layout.findViewById(R.id.circadianpercentageprofile_linearlayout);
|
||||||
diaView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
|
diaView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
|
||||||
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
||||||
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
|
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
|
||||||
|
@ -138,23 +140,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
timeshiftView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onFocusChange(View view, boolean b) {
|
|
||||||
if (b)
|
|
||||||
ToastUtils.showToastInUiThread(getContext(), getString(R.string.timeshift_hint));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
percentageView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onFocusChange(View view, boolean b) {
|
|
||||||
if (b)
|
|
||||||
ToastUtils.showToastInUiThread(getContext(), getString(R.string.percentagefactor_hint));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
timeIcon.setOnClickListener(new View.OnClickListener() {
|
timeIcon.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -202,6 +187,47 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
timeshiftView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
timeshiftView.setError(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
percentageView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
percentageView.setError(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
timeshiftView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
|
if (!hasFocus) {
|
||||||
|
timeshiftView.clearFocus();
|
||||||
|
ll.requestFocusFromTouch();
|
||||||
|
timeshiftView.setError(null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timeshiftView.setError(getString(R.string.timeshift_hint), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
percentageView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
|
if (!hasFocus) {
|
||||||
|
percentageView.clearFocus();
|
||||||
|
ll.requestFocusFromTouch();
|
||||||
|
percentageView.setError(null);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
percentageView.setError(getString(R.string.percentagefactor_hint), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
TextWatcher textWatch = new TextWatcher() {
|
TextWatcher textWatch = new TextWatcher() {
|
||||||
|
|
||||||
|
@ -368,6 +394,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
||||||
super.onResume();
|
super.onResume();
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
onStatusEvent(null);
|
onStatusEvent(null);
|
||||||
|
ll.requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/circadianpercentageprofile_linearlayout"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/circadianpercentageprofile_profileview"
|
android:id="@+id/circadianpercentageprofile_profileview"
|
||||||
|
|
Loading…
Reference in a new issue