@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); Log.i(TAG, "created"); // this.setContentView(R.layout.task_detail); this.setContentView(R.layout.edit_alarm); this.getActionBar().setDisplayHomeAsUpEnabled(true); oldAlarm = (TaskEntity) this.getIntent().getSerializableExtra("alarmTask"); if (oldAlarm != null) this.editAlarm = new TaskEntity(oldAlarm); else this.editAlarm = Utils.createTask(this); int[] repeat_lines = new int[] { R.id.repeat_monday_line, R.id.repeat_tuesday_line, R.id.repeat_wendsday_line, R.id.repeat_thursday_line, R.id.repeat_friday_line, R.id.repeat_saturday_line, R.id.repeat_sunday_line }; int[] repeat_txt = new int[] { R.id.repeat_monday, R.id.repeat_tuesday, R.id.repeat_wendsday, R.id.repeat_thursday, R.id.repeat_friday, R.id.repeat_saturday, R.id.repeat_sunday }; for (int i = 0; i < 7; i++) { FrameLayout localFrameLayout = (FrameLayout) this.findViewById(repeat_lines[i]); this.setUpRepeat(localFrameLayout, (TextView) this.findViewById(repeat_txt[i]), i + 1); } txtTimeView = (TextView) this.findViewById(R.id.edit_alarm_hour); txtTaskName = (TextView) this.findViewById(R.id.edit_alarm_label); TimeOnClickListener timeClickListener = new TimeOnClickListener(); txtTimeView.setOnClickListener(timeClickListener); TaskNameOnClickListener taskNameOnClickListener = new TaskNameOnClickListener(); txtTaskName.setOnClickListener(taskNameOnClickListener); radioOn = (RadioButton) this.findViewById(R.id.idRadioOn); radioOff = (RadioButton) this.findViewById(R.id.idRadioOff); if (this.editAlarm.isModeOn()) { radioOn.setChecked(true); radioOff.setChecked(false); } else { radioOn.setChecked(false); radioOff.setChecked(true); } txtTimeView.setText(this.editAlarm.getTimeStr(this)); txtTaskName.setText(this.editAlarm.getTitle()); }
private void setUpRepeat(FrameLayout paramFrameLayout, TextView paramTextView, int paramInt) { setTabSelected( paramFrameLayout, paramTextView, Utils.GetWeekdaysFromInt(this.editAlarm.getWeekdays(), paramInt)); assert (paramFrameLayout.getParent() != null); RelativeLayout relativeLayout = (RelativeLayout) paramFrameLayout.getParent(); relativeLayout.setOnClickListener( new RepeatOnClickListener(paramFrameLayout, paramTextView, paramInt)); }
@Override public void onClick(View v) { if (Utils.GetWeekdaysFromInt(TaskDetailActivity.this.editAlarm.getWeekdays(), paramInt)) { paramFrameLayout.setBackgroundColor( TaskDetailActivity.this.getResources().getColor(R.color.husky_underline_normal)); paramTextView.setTextColor( TaskDetailActivity.this.getResources().getColor(R.color.husky_underline_normal)); } else { paramFrameLayout.setBackgroundColor( TaskDetailActivity.this.getResources().getColor(R.color.husky_underline_selected)); paramTextView.setTextColor( TaskDetailActivity.this.getResources().getColor(R.color.husky_underline_selected)); } TaskDetailActivity.this.editAlarm.toggleWeekday(paramInt); // Log.i(TAG, "weekday: " + // TaskDetailActivity.this.editAlarm.toFormatString(TaskDetailActivity.this)); }