Changed layout of edit alarm screen

This commit is contained in:
Phillip Hsu 2016-07-12 01:16:58 -07:00
parent 058d6c86b7
commit c5558c211a
2 changed files with 241 additions and 2 deletions

View File

@ -148,7 +148,7 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
@Override
protected int layoutResId() {
return R.layout.activity_edit_alarm;
return R.layout.activity_edit_alarm_v2;
}
@Override
@ -523,7 +523,7 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
public void cancelAlarm(Alarm alarm, boolean showToast) {
// TODO: Rewrite XML layout to use CoordinatorLayout and
// pass in the snackbar anchor.
new AlarmController(this, null).cancelAlarm(alarm, true);
new AlarmController(this, findViewById(R.id.main_content)).cancelAlarm(alarm, true);
if (RingtoneActivity.isAlive()) {
LocalBroadcastHelper.sendBroadcast(this, RingtoneActivity.ACTION_FINISH);
}

View File

@ -0,0 +1,239 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- For elevation to apply, we set a non-transparent background -->
<LinearLayout
android:id="@+id/footer_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?android:colorBackground"
android:elevation="4dp"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/delete"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
<Button
android:id="@+id/save"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/save"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
</LinearLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/footer_buttons"
android:layout_alignParentTop="true">
<!-- We don't intend to use any scroll flags, but this is needed
so we can properly position our scrolling content below the appbar -->
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:elevation="4dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.SwitchCompat
android:id="@+id/on_off"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
<!-- TODO: Find out how to get a touch ripple; foreground attr didn't work -->
<EditText
android:id="@+id/input_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:background="@android:color/transparent"
android:hint="@string/default_alarm_time_12h"
android:textSize="56sp"
android:layout_toStartOf="@id/on_off"
android:inputType="time"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<ToggleButton
android:id="@+id/day0"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"/>
<ToggleButton
android:id="@+id/day1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
<ToggleButton
android:id="@+id/day2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
<ToggleButton
android:id="@+id/day3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
<ToggleButton
android:id="@+id/day4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
<ToggleButton
android:id="@+id/day5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
<ToggleButton
android:id="@+id/day6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAllCaps="true"
android:textStyle="bold"
android:background="?selectableItemBackground"
android:textColor="@color/toggle_alarm_days"
/>
</LinearLayout>
<EditText
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@android:color/transparent"
android:hint="Add label"
android:paddingStart="16dp"
android:paddingEnd="16dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="72dp"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<Button
android:id="@+id/ringtone"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:text="Ringtone"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="18sp"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/vibrate"/>
<CheckBox
android:id="@id/vibrate"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Vibrate"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
<com.philliphsu.clock2.editalarm.AlarmNumpad
android:id="@+id/numpad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:elevation="4dp"
android:layout_alignParentBottom="true"
android:visibility="gone"/>
</RelativeLayout>