Show elevation on ExpandedAlarmViewHolder, changed name of AlarmViewHolder to CollapsedAlarmViewHolder
This commit is contained in:
parent
02db488065
commit
9561388425
@ -27,6 +27,7 @@ public class DaysOfWeek implements DaysOfWeekHelper {
|
||||
private static final int[] LABELS_RES = new int[NUM_DAYS];
|
||||
|
||||
static {
|
||||
// TODO: use `new DateFormatSymbols().getShortWeekdays()` to set texts
|
||||
LABELS_RES[SUNDAY] = R.string.sun;
|
||||
LABELS_RES[MONDAY] = R.string.mon;
|
||||
LABELS_RES[TUESDAY] = R.string.tue;
|
||||
|
||||
@ -25,13 +25,13 @@ public class CollapsedAlarmViewHolder extends BaseAlarmViewHolder implements Ala
|
||||
|
||||
@Deprecated // TODO: Delete this, the only usage is from AlarmsAdapter (SortedList), which is not used anymore.
|
||||
public CollapsedAlarmViewHolder(ViewGroup parent, OnListItemInteractionListener<Alarm> listener) {
|
||||
super(parent, R.layout.item_alarm, listener, null);
|
||||
super(parent, R.layout.item_collapsed_alarm, listener, null);
|
||||
mCountdown.setOnTickListener(this);
|
||||
}
|
||||
|
||||
public CollapsedAlarmViewHolder(ViewGroup parent, OnListItemInteractionListener<Alarm> listener,
|
||||
AlarmController alarmController) {
|
||||
super(parent, R.layout.item_alarm, listener, alarmController);
|
||||
super(parent, R.layout.item_collapsed_alarm, listener, alarmController);
|
||||
mCountdown.setOnTickListener(this);
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:name="com.philliphsu.clock.alarms.AlarmsFragment"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:context="com.philliphsu.clock2.alarms.AlarmsFragment"
|
||||
tools:listitem="@layout/item_alarm"
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<!-- Wrapped in a CardView to simulate elevation of the main view.
|
||||
- There will be margins around the card on devices that are pre-Lollipop,
|
||||
- and the margin size is proportional to the set cardElevation. As a result, the
|
||||
- default item animation when collapsing/expanding the ViewHolder shows the views
|
||||
- that are common to both VHs (primarily the time text and the on-off switch)
|
||||
- shifting slightly during the transition. We are neglecting this blight because
|
||||
- we don't expect many devices below Lollipop using our app.
|
||||
-->
|
||||
<!-- TODO: Write a layout for v21 that instead uses the elevation attribute normally.
|
||||
- You may have to set a non-transparent background on the main view.
|
||||
-->
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@ -133,6 +156,8 @@
|
||||
style="@style/Widget.AppCompat.Button.Colored"
|
||||
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.Horizontal"/>
|
||||
@ -159,4 +184,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
Loading…
Reference in New Issue
Block a user