cleanup
This commit is contained in:
parent
96edac5ddf
commit
3d58fe6bb5
2 changed files with 10 additions and 14 deletions
|
@ -39,16 +39,15 @@ import info.nightscout.androidaps.R;
|
||||||
public class TimeListEdit {
|
public class TimeListEdit {
|
||||||
private static Logger log = LoggerFactory.getLogger(TimeListEdit.class);
|
private static Logger log = LoggerFactory.getLogger(TimeListEdit.class);
|
||||||
|
|
||||||
final int ONEHOURINSECONDS = 60 * 60;
|
private final int ONEHOURINSECONDS = 60 * 60;
|
||||||
|
|
||||||
private LinearLayout layout;
|
|
||||||
private View[] intervals = new View[24];
|
private View[] intervals = new View[24];
|
||||||
private Spinner[] spinners = new Spinner[24];
|
private Spinner[] spinners = new Spinner[24];
|
||||||
private NumberPicker[] numberPickers1 = new NumberPicker[24];
|
private NumberPicker[] numberPickers1 = new NumberPicker[24];
|
||||||
private NumberPicker[] numberPickers2 = new NumberPicker[24];
|
private NumberPicker[] numberPickers2 = new NumberPicker[24];
|
||||||
private ImageView[] addButtons = new ImageView[24];
|
private ImageView[] addButtons = new ImageView[24];
|
||||||
private ImageView[] removeButtons = new ImageView[24];
|
private ImageView[] removeButtons = new ImageView[24];
|
||||||
ImageView finalAdd;
|
private ImageView finalAdd;
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private View view;
|
private View view;
|
||||||
|
@ -74,11 +73,11 @@ public class TimeListEdit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildView() {
|
private void buildView() {
|
||||||
layout = (LinearLayout) view.findViewById(resLayoutId);
|
LinearLayout layout = (LinearLayout) view.findViewById(resLayoutId);
|
||||||
|
|
||||||
TextView textlabel = new TextView(context);
|
TextView textlabel = new TextView(context);
|
||||||
textlabel.setText(label);
|
textlabel.setText(label);
|
||||||
textlabel.setGravity(Gravity.LEFT);
|
textlabel.setGravity(Gravity.START);
|
||||||
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
llp.setMargins(10, 0, 0, 0); // llp.setMargins(left, top, right, bottom);
|
llp.setMargins(10, 0, 0, 0); // llp.setMargins(left, top, right, bottom);
|
||||||
textlabel.setLayoutParams(llp);
|
textlabel.setLayoutParams(llp);
|
||||||
|
@ -99,7 +98,6 @@ public class TimeListEdit {
|
||||||
addButtons[i].setOnClickListener(new View.OnClickListener() {
|
addButtons[i].setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
log.debug("ccccc");
|
|
||||||
int seconds = secondFromMidnight(fixedPos);
|
int seconds = secondFromMidnight(fixedPos);
|
||||||
addItem(fixedPos, seconds, 0, 0);
|
addItem(fixedPos, seconds, 0, 0);
|
||||||
// for here for the rest of values
|
// for here for the rest of values
|
||||||
|
@ -119,7 +117,6 @@ public class TimeListEdit {
|
||||||
removeButtons[i].setOnClickListener(new View.OnClickListener() {
|
removeButtons[i].setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
log.debug("dddd");
|
|
||||||
removeItem(fixedPos);
|
removeItem(fixedPos);
|
||||||
callSave();
|
callSave();
|
||||||
log();
|
log();
|
||||||
|
@ -131,7 +128,6 @@ public class TimeListEdit {
|
||||||
new AdapterView.OnItemSelectedListener() {
|
new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
log.debug("eeeeee");
|
|
||||||
int seconds = DateUtil.toSeconds(spinners[fixedPos].getSelectedItem().toString());
|
int seconds = DateUtil.toSeconds(spinners[fixedPos].getSelectedItem().toString());
|
||||||
editItem(fixedPos, seconds, value1(fixedPos), value2(fixedPos));
|
editItem(fixedPos, seconds, value1(fixedPos), value2(fixedPos));
|
||||||
log();
|
log();
|
||||||
|
@ -148,7 +144,6 @@ public class TimeListEdit {
|
||||||
numberPickers1[i].setTextWatcher(new TextWatcher() {
|
numberPickers1[i].setTextWatcher(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
log.debug("aaaa");
|
|
||||||
editItem(fixedPos, secondFromMidnight(fixedPos), SafeParse.stringToDouble(numberPickers1[fixedPos].getText()), value2(fixedPos));
|
editItem(fixedPos, secondFromMidnight(fixedPos), SafeParse.stringToDouble(numberPickers1[fixedPos].getText()), value2(fixedPos));
|
||||||
callSave();
|
callSave();
|
||||||
log();
|
log();
|
||||||
|
@ -169,7 +164,6 @@ public class TimeListEdit {
|
||||||
numberPickers2[i].setTextWatcher(new TextWatcher() {
|
numberPickers2[i].setTextWatcher(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
log.debug("bbbbb");
|
|
||||||
editItem(fixedPos, secondFromMidnight(fixedPos), value1(fixedPos), SafeParse.stringToDouble(numberPickers2[fixedPos].getText()));
|
editItem(fixedPos, secondFromMidnight(fixedPos), value1(fixedPos), SafeParse.stringToDouble(numberPickers2[fixedPos].getText()));
|
||||||
callSave();
|
callSave();
|
||||||
log();
|
log();
|
||||||
|
@ -200,7 +194,6 @@ public class TimeListEdit {
|
||||||
finalAdd.setOnClickListener(new View.OnClickListener() {
|
finalAdd.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
log.debug("gggggggg");
|
|
||||||
addItem(itemsCount(), itemsCount() > 0 ? secondFromMidnight(itemsCount() - 1) + ONEHOURINSECONDS : 0, 0, 0);
|
addItem(itemsCount(), itemsCount() > 0 ? secondFromMidnight(itemsCount() - 1) + ONEHOURINSECONDS : 0, 0, 0);
|
||||||
callSave();
|
callSave();
|
||||||
log();
|
log();
|
||||||
|
@ -239,8 +232,6 @@ public class TimeListEdit {
|
||||||
if (i == 0) next = ONEHOURINSECONDS;
|
if (i == 0) next = ONEHOURINSECONDS;
|
||||||
fillSpinner(timeSpinner, secondFromMidnight(i), previous, next);
|
fillSpinner(timeSpinner, secondFromMidnight(i), previous, next);
|
||||||
|
|
||||||
final int fixedPos = i;
|
|
||||||
|
|
||||||
editText1.setParams(value1(i), 0.1d, 100d, step, formatter, false);
|
editText1.setParams(value1(i), 0.1d, 100d, step, formatter, false);
|
||||||
editText2.setParams(value2(i), 0.1d, 100d, step, formatter, false);
|
editText2.setParams(value2(i), 0.1d, 100d, step, formatter, false);
|
||||||
|
|
||||||
|
|
|
@ -51,30 +51,35 @@
|
||||||
android:id="@+id/localprofile_dia"
|
android:id="@+id/localprofile_dia"
|
||||||
android:layout_width="130dp"
|
android:layout_width="130dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center_horizontal" />
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="10dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/localprofile_ic"
|
android:id="@+id/localprofile_ic"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/localprofile_isf"
|
android:id="@+id/localprofile_isf"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/localprofile_basal"
|
android:id="@+id/localprofile_basal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/localprofile_target"
|
android:id="@+id/localprofile_target"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue