import android.view.LayoutInflater;
import android.widget.CheckBox;
import android.widget.CompoundButton;
+import android.widget.ScrollView;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import java.text.SimpleDateFormat;
import java.util.Calendar;
-public class ZenModeDowntimeDaysSelection extends LinearLayout {
+public class ZenModeDowntimeDaysSelection extends ScrollView {
private static final int[] DAYS = {
Calendar.MONDAY, Calendar.TUESDAY, Calendar.WEDNESDAY, Calendar.THURSDAY, Calendar.FRIDAY,
Calendar.SATURDAY, Calendar.SUNDAY
private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("EEEE");
private final SparseBooleanArray mDays = new SparseBooleanArray();
+ private final LinearLayout mLayout;
public ZenModeDowntimeDaysSelection(Context context, String mode) {
super(context);
+ mLayout = new LinearLayout(mContext);
+ final int hPad = context.getResources().getDimensionPixelSize(R.dimen.zen_downtime_margin);
+ mLayout.setPadding(hPad, 0, hPad, 0);
+ addView(mLayout);
final int[] days = ZenModeConfig.tryParseDays(mode);
if (days != null) {
for (int i = 0; i < days.length; i++) {
mDays.put(days[i], true);
}
}
- setOrientation(VERTICAL);
+ mLayout.setOrientation(LinearLayout.VERTICAL);
final Calendar c = Calendar.getInstance();
final LayoutInflater inflater = LayoutInflater.from(context);
for (int i = 0; i < DAYS.length; i++) {
onChanged(getMode());
}
});
- addView(checkBox);
+ mLayout.addView(checkBox);
}
}