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 isfeditIcon;
|
||||
BasalEditDialog basalEditDialog;
|
||||
LinearLayout ll;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
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);
|
||||
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
||||
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() {
|
||||
@Override
|
||||
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() {
|
||||
|
||||
|
@ -368,6 +394,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(null);
|
||||
ll.requestFocusFromTouch();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/circadianpercentageprofile_linearlayout"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/circadianpercentageprofile_profileview"
|
||||
|
|
Loading…
Reference in a new issue