mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Get rid of the Checkedtextview because they weren't in line with the our style
This commit is contained in:
parent
900511760c
commit
371a7bb4af
@ -5,8 +5,7 @@ import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBAlarm;
|
||||
@ -17,17 +16,14 @@ public class AlarmDetails extends Activity {
|
||||
|
||||
private GBAlarm alarm;
|
||||
private TimePicker timePicker;
|
||||
//using CheckedTextView allows for vertically aligned text
|
||||
private CheckedTextView ctvSmartWakeup;
|
||||
private CheckedTextView ctvMonday;
|
||||
private CheckedTextView ctvTuesday;
|
||||
private CheckedTextView ctvWednesday;
|
||||
private CheckedTextView ctvThursday;
|
||||
private CheckedTextView ctvFriday;
|
||||
private CheckedTextView ctvSaturday;
|
||||
private CheckedTextView ctvSunday;
|
||||
|
||||
|
||||
private CheckBox cbSmartWakeup;
|
||||
private CheckBox cbMonday;
|
||||
private CheckBox cbTuesday;
|
||||
private CheckBox cbWednesday;
|
||||
private CheckBox cbThursday;
|
||||
private CheckBox cbFriday;
|
||||
private CheckBox cbSaturday;
|
||||
private CheckBox cbSunday;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -38,77 +34,28 @@ public class AlarmDetails extends Activity {
|
||||
alarm = (GBAlarm) p;
|
||||
|
||||
timePicker = (TimePicker) findViewById(R.id.alarm_time_picker);
|
||||
ctvSmartWakeup = (CheckedTextView) findViewById(R.id.alarm_ctv_smart_wakeup);
|
||||
ctvMonday = (CheckedTextView) findViewById(R.id.alarm_ctv_mon);
|
||||
ctvTuesday = (CheckedTextView) findViewById(R.id.alarm_ctv_tue);
|
||||
ctvWednesday = (CheckedTextView) findViewById(R.id.alarm_ctv_wed);
|
||||
ctvThursday = (CheckedTextView) findViewById(R.id.alarm_ctv_thu);
|
||||
ctvFriday = (CheckedTextView) findViewById(R.id.alarm_ctv_fri);
|
||||
ctvSaturday = (CheckedTextView) findViewById(R.id.alarm_ctv_sat);
|
||||
ctvSunday = (CheckedTextView) findViewById(R.id.alarm_ctv_sun);
|
||||
cbSmartWakeup = (CheckBox) findViewById(R.id.alarm_cb_smart_wakeup);
|
||||
cbMonday = (CheckBox) findViewById(R.id.alarm_cb_mon);
|
||||
cbTuesday = (CheckBox) findViewById(R.id.alarm_cb_tue);
|
||||
cbWednesday = (CheckBox) findViewById(R.id.alarm_cb_wed);
|
||||
cbThursday = (CheckBox) findViewById(R.id.alarm_cb_thu);
|
||||
cbFriday = (CheckBox) findViewById(R.id.alarm_cb_fri);
|
||||
cbSaturday = (CheckBox) findViewById(R.id.alarm_cb_sat);
|
||||
cbSunday = (CheckBox) findViewById(R.id.alarm_cb_sun);
|
||||
|
||||
timePicker.setIs24HourView(DateFormat.is24HourFormat(GBApplication.getContext()));
|
||||
timePicker.setCurrentHour(alarm.getHour());
|
||||
timePicker.setCurrentMinute(alarm.getMinute());
|
||||
|
||||
ctvSmartWakeup.setChecked(alarm.isSmartWakeup());
|
||||
ctvSmartWakeup.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
cbSmartWakeup.setChecked(alarm.isSmartWakeup());
|
||||
|
||||
ctvMonday.setChecked(alarm.getRepetition(GBAlarm.ALARM_MON));
|
||||
ctvTuesday.setChecked(alarm.getRepetition(GBAlarm.ALARM_TUE));
|
||||
ctvWednesday.setChecked(alarm.getRepetition(GBAlarm.ALARM_WED));
|
||||
ctvThursday.setChecked(alarm.getRepetition(GBAlarm.ALARM_THU));
|
||||
ctvFriday.setChecked(alarm.getRepetition(GBAlarm.ALARM_FRI));
|
||||
ctvSaturday.setChecked(alarm.getRepetition(GBAlarm.ALARM_SAT));
|
||||
ctvSunday.setChecked(alarm.getRepetition(GBAlarm.ALARM_SUN));
|
||||
|
||||
ctvMonday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvTuesday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvWednesday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvThursday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvFriday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvSaturday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
ctvSunday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((CheckedTextView) v).toggle();
|
||||
}
|
||||
});
|
||||
cbMonday.setChecked(alarm.getRepetition(GBAlarm.ALARM_MON));
|
||||
cbTuesday.setChecked(alarm.getRepetition(GBAlarm.ALARM_TUE));
|
||||
cbWednesday.setChecked(alarm.getRepetition(GBAlarm.ALARM_WED));
|
||||
cbThursday.setChecked(alarm.getRepetition(GBAlarm.ALARM_THU));
|
||||
cbFriday.setChecked(alarm.getRepetition(GBAlarm.ALARM_FRI));
|
||||
cbSaturday.setChecked(alarm.getRepetition(GBAlarm.ALARM_SAT));
|
||||
cbSunday.setChecked(alarm.getRepetition(GBAlarm.ALARM_SUN));
|
||||
|
||||
}
|
||||
|
||||
@ -125,8 +72,8 @@ public class AlarmDetails extends Activity {
|
||||
}
|
||||
|
||||
private void updateAlarm() {
|
||||
alarm.setSmartWakeup(ctvSmartWakeup.isChecked());
|
||||
alarm.setRepetition(ctvMonday.isChecked(), ctvTuesday.isChecked(), ctvWednesday.isChecked(), ctvThursday.isChecked(), ctvFriday.isChecked(), ctvSaturday.isChecked(), ctvSunday.isChecked());
|
||||
alarm.setSmartWakeup(cbSmartWakeup.isChecked());
|
||||
alarm.setRepetition(cbMonday.isChecked(), cbTuesday.isChecked(), cbWednesday.isChecked(), cbThursday.isChecked(), cbFriday.isChecked(), cbSaturday.isChecked(), cbSunday.isChecked());
|
||||
alarm.setHour(timePicker.getCurrentHour());
|
||||
alarm.setMinute(timePicker.getCurrentMinute());
|
||||
alarm.store();
|
||||
|
@ -22,17 +22,31 @@
|
||||
android:timePickerMode="clock"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/alarm_smart_wakeup"
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_smart_wakeup"
|
||||
android:checked="false"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_weight="1" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_smart_wakeup"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_smart_wakeup"
|
||||
android:id="@+id/alarm_label_smart_wakeup"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_smart_wakeup"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -41,103 +55,196 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/dowSelector">
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_mon_short"
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_mon"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_tue_short"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_tue"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_mon"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_wed_short"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_wed"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_mon_short"
|
||||
android:id="@+id/alarm_label_cb_mon"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_mon"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_thu_short"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_thu"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_fri_short"
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_fri"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_sat_short"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_sat"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_tue"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<CheckedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:text="@string/alarm_sun_short"
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_tue_short"
|
||||
android:id="@+id/alarm_label_cb_tue"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_tue"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/alarm_ctv_sun"
|
||||
android:checked="false"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:drawableTop="@drawable/abc_btn_check_material"
|
||||
android:layout_weight="1"
|
||||
android:enabled="true"
|
||||
android:gravity="center_horizontal" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_wed"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_wed_short"
|
||||
android:id="@+id/alarm_label_cb_wed"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_wed"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_thu"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_thu_short"
|
||||
android:id="@+id/alarm_label_cb_thu"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_thu"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_fri"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_fri_short"
|
||||
android:id="@+id/alarm_label_cb_fri"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_fri"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_sat"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_sat_short"
|
||||
android:id="@+id/alarm_label_cb_sat"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_sat"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/alarm_cb_sun"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/alarm_sun_short"
|
||||
android:id="@+id/alarm_label_cb_sun"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:labelFor="@id/alarm_cb_sun"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user