New ringtone activity layout

This commit is contained in:
Phillip Hsu
2016-08-06 00:06:15 -07:00
parent 6ae9c3511c
commit d845f241e9
9 changed files with 246 additions and 66 deletions
@@ -1,8 +1,7 @@
package com.philliphsu.clock2.alarms;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.view.ViewGroup;
import com.philliphsu.clock2.Alarm;
import com.philliphsu.clock2.R;
@@ -21,26 +20,6 @@ public class AlarmActivity extends RingtoneActivity<Alarm> {
// TODO: If the upcoming alarm notification isn't present, verify other notifications aren't affected.
// This could be the case if we're starting a new instance of this activity after leaving the first launch.
mAlarmController.removeUpcomingAlarmNotification(getRingingObject());
// TODO: Butterknife binding
Button snooze = (Button) findViewById(R.id.btn_snooze);
snooze.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
snooze();
}
});
Button dismiss = (Button) findViewById(R.id.btn_dismiss);
dismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
@Override
public int layoutResource() {
return R.layout.activity_ringtone;
}
@Override
@@ -48,14 +27,50 @@ public class AlarmActivity extends RingtoneActivity<Alarm> {
return AlarmRingtoneService.class;
}
private void snooze() {
@Override
protected CharSequence getHeaderTitle() {
return getRingingObject().label();
}
@Override
protected void getHeaderContent(ViewGroup parent) {
// TODO: Consider applying size span on the am/pm label
getLayoutInflater().inflate(R.layout.content_header_alarm_activity, parent, true);
}
@Override
protected int getAutoSilencedDrawable() {
// TODO: correct icon
return R.drawable.ic_half_day_1_black_24dp;
}
@Override
protected int getAutoSilencedText() {
return R.string.alarm_auto_silenced_text;
}
@Override
protected int getLeftButtonDrawable() {
// TODO: correct icon
return R.drawable.ic_half_day_1_black_24dp;
}
@Override
protected int getRightButtonDrawable() {
// TODO: correct icon
return R.drawable.ic_half_day_1_black_24dp;
}
@Override
protected void onLeftButtonClick() {
mAlarmController.snoozeAlarm(getRingingObject());
// Can't call dismiss() because we don't want to also call cancelAlarm()! Why? For example,
// we don't want the alarm, if it has no recurrence, to be turned off right now.
stopAndFinish();
}
private void dismiss() {
@Override
protected void onRightButtonClick() {
// TODO do we really need to cancel the intent and alarm?
mAlarmController.cancelAlarm(getRingingObject(), false);
stopAndFinish();