Apply new icons
This commit is contained in:
parent
7ae7c0f174
commit
e408a7467a
@ -74,14 +74,12 @@ public class AlarmActivity extends RingtoneActivity<Alarm> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLeftButtonDrawable() {
|
protected int getLeftButtonDrawable() {
|
||||||
// TODO: correct icon
|
return R.drawable.ic_snooze_24dp;
|
||||||
return R.drawable.ic_half_day_1_black_24dp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getRightButtonDrawable() {
|
protected int getRightButtonDrawable() {
|
||||||
// TODO: correct icon
|
return R.drawable.ic_dismiss_alarm_24dp;
|
||||||
return R.drawable.ic_half_day_1_black_24dp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package com.philliphsu.clock2.alarms;
|
package com.philliphsu.clock2.alarms;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.SwitchCompat;
|
import android.support.v7.widget.SwitchCompat;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@ -35,6 +37,9 @@ import static com.philliphsu.clock2.util.DateFormatUtils.formatTime;
|
|||||||
public abstract class BaseAlarmViewHolder extends BaseViewHolder<Alarm> {
|
public abstract class BaseAlarmViewHolder extends BaseViewHolder<Alarm> {
|
||||||
|
|
||||||
private final AlarmController mAlarmController;
|
private final AlarmController mAlarmController;
|
||||||
|
// TODO: Should we use VectorDrawable type?
|
||||||
|
private final Drawable mDismissNowDrawable;
|
||||||
|
private final Drawable mCancelSnoozeDrawable;
|
||||||
|
|
||||||
@Bind(R.id.time) TextView mTime;
|
@Bind(R.id.time) TextView mTime;
|
||||||
@Bind(R.id.on_off_switch) SwitchCompat mSwitch;
|
@Bind(R.id.on_off_switch) SwitchCompat mSwitch;
|
||||||
@ -46,6 +51,10 @@ public abstract class BaseAlarmViewHolder extends BaseViewHolder<Alarm> {
|
|||||||
AlarmController controller) {
|
AlarmController controller) {
|
||||||
super(parent, layoutRes, listener);
|
super(parent, layoutRes, listener);
|
||||||
mAlarmController = controller;
|
mAlarmController = controller;
|
||||||
|
// Because of VH binding, setting drawable resources on views would be bad for performance.
|
||||||
|
// Instead, we create and cache the Drawables once.
|
||||||
|
mDismissNowDrawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_dismiss_alarm_24dp);
|
||||||
|
mCancelSnoozeDrawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_cancel_snooze);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,12 +172,18 @@ public abstract class BaseAlarmViewHolder extends BaseViewHolder<Alarm> {
|
|||||||
|
|
||||||
private void bindDismissButton(Alarm alarm) {
|
private void bindDismissButton(Alarm alarm) {
|
||||||
int hoursBeforeUpcoming = AlarmUtils.hoursBeforeUpcoming(getContext());
|
int hoursBeforeUpcoming = AlarmUtils.hoursBeforeUpcoming(getContext());
|
||||||
boolean visible = alarm.isEnabled() && (alarm.ringsWithinHours(hoursBeforeUpcoming) || alarm.isSnoozed());
|
boolean upcoming = alarm.ringsWithinHours(hoursBeforeUpcoming);
|
||||||
String buttonText = alarm.isSnoozed()
|
boolean snoozed = alarm.isSnoozed();
|
||||||
|
boolean visible = alarm.isEnabled() && (upcoming || snoozed);
|
||||||
|
String buttonText = snoozed
|
||||||
? getContext().getString(R.string.title_snoozing_until, formatTime(getContext(), alarm.snoozingUntil()))
|
? getContext().getString(R.string.title_snoozing_until, formatTime(getContext(), alarm.snoozingUntil()))
|
||||||
: getContext().getString(R.string.dismiss_now);
|
: getContext().getString(R.string.dismiss_now);
|
||||||
setVisibility(mDismissButton, visible);
|
setVisibility(mDismissButton, visible);
|
||||||
mDismissButton.setText(buttonText);
|
mDismissButton.setText(buttonText);
|
||||||
|
// Set drawable start
|
||||||
|
mDismissButton.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||||
|
upcoming ? mDismissNowDrawable : mCancelSnoozeDrawable,
|
||||||
|
null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindLabel(String label) {
|
private void bindLabel(String label) {
|
||||||
|
|||||||
@ -90,8 +90,7 @@ public class TimesUpActivity extends RingtoneActivity<Timer> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getRightButtonDrawable() {
|
protected int getRightButtonDrawable() {
|
||||||
// TODO: correct icon
|
return R.drawable.ic_stop_24dp;
|
||||||
return R.drawable.ic_half_day_1_black_24dp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
9
app/src/main/res/drawable/ic_add_lap_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_lap_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- drawable/flag_variant.xml -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M6,3A1,1 0 0,1 7,4V4.88C8.06,4.44 9.5,4 11,4C14,4 14,6 16,6C19,6 20,4 20,4V12C20,12 19,14 16,14C13,14 13,12 11,12C8,12 7,14 7,14V21H5V4A1,1 0 0,1 6,3Z" />
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/ic_cancel_snooze.xml
Normal file
8
app/src/main/res/drawable/ic_cancel_snooze.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!-- drawable/sleep_off.xml -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M2,5.27L3.28,4L20,20.72L18.73,22L12.73,16H9V14L9.79,13.06L2,5.27M23,12H17V10L20.39,6H17V4H23V6L19.62,10H23V12M9.82,8H15V10L13.54,11.72L9.82,8M7,20H1V18L4.39,14H1V12H7V14L3.62,18H7V20Z" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_dismiss_alarm_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_dismiss_alarm_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,6c3.87,0 7,3.13 7,7 0,0.84 -0.16,1.65 -0.43,2.4l1.52,1.52c0.58,-1.19 0.91,-2.51 0.91,-3.92 0,-4.97 -4.03,-9 -9,-9 -1.41,0 -2.73,0.33 -3.92,0.91L9.6,6.43C10.35,6.16 11.16,6 12,6zM22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM2.92,2.29L1.65,3.57 2.98,4.9l-1.11,0.93 1.42,1.42 1.11,-0.94 0.8,0.8C3.83,8.69 3,10.75 3,13c0,4.97 4.02,9 9,9 2.25,0 4.31,-0.83 5.89,-2.2l2.2,2.2 1.27,-1.27L3.89,3.27l-0.97,-0.98zM16.47,18.39C15.26,19.39 13.7,20 12,20c-3.87,0 -7,-3.13 -7,-7 0,-1.7 0.61,-3.26 1.61,-4.47l9.86,9.86zM8.02,3.28L6.6,1.86l-0.86,0.71 1.42,1.42 0.86,-0.71z"/>
|
||||||
|
</vector>
|
||||||
10
app/src/main/res/drawable/ic_ringtone_black_24dp.xml
Normal file
10
app/src/main/res/drawable/ic_ringtone_black_24dp.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:fillAlpha="0.87"
|
||||||
|
android:pathData="M12,3v10.55c-0.59,-0.34 -1.27,-0.55 -2,-0.55 -2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4V7h4V3h-6z"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/ic_snooze_24dp.xml
Normal file
8
app/src/main/res/drawable/ic_snooze_24dp.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!-- drawable/sleep.xml -->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M23,12H17V10L20.39,6H17V4H23V6L19.62,10H23V12M15,16H9V14L12.39,10H9V8H15V10L11.62,14H15V16M7,20H1V18L4.39,14H1V12H7V14L3.62,18H7V20Z" />
|
||||||
|
</vector>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="1:20"
|
android:text="1:20"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
style="@style/TextAppearance.AppCompat"
|
||||||
android:textSize="@dimen/alarm_time_text_size"/>
|
android:textSize="@dimen/alarm_time_text_size"/>
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
android:id="@+id/new_lap"
|
android:id="@+id/new_lap"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_half_day_1_black_24dp"
|
android:src="@drawable/ic_add_lap_24dp"
|
||||||
android:tint="@android:color/white"
|
android:tint="@android:color/white"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
|
|||||||
@ -49,12 +49,15 @@
|
|||||||
android:layout_below="@id/label"
|
android:layout_below="@id/label"
|
||||||
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
|
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
|
||||||
|
|
||||||
|
<!-- The drawable is added programmatically -->
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/dismiss"
|
android:id="@+id/dismiss"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/recurring_days"
|
android:layout_below="@id/recurring_days"
|
||||||
android:text="@string/dismiss_now"
|
android:text="@string/dismiss_now"
|
||||||
|
android:drawablePadding="@dimen/text_compound_drawable_padding"
|
||||||
|
android:paddingEnd="@dimen/button_text_right_padding"
|
||||||
style="@style/Widget.AppCompat.Button.Colored"/>
|
style="@style/Widget.AppCompat.Button.Colored"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@ -133,7 +133,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="8dp">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/ringtone"
|
android:id="@+id/ringtone"
|
||||||
@ -144,7 +145,9 @@
|
|||||||
android:text="Ringtone"
|
android:text="Ringtone"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
android:textAppearance="@style/TextAppearance.AppCompat"
|
||||||
android:textSize="18sp"/>
|
android:textSize="18sp"
|
||||||
|
android:drawableStart="@drawable/ic_ringtone_black_24dp"
|
||||||
|
android:drawablePadding="@dimen/text_compound_drawable_padding"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@id/vibrate"
|
android:id="@id/vibrate"
|
||||||
@ -160,7 +163,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/dismiss_now"
|
android:text="@string/dismiss_now"
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
|
android:layout_marginBottom="@dimen/item_margin_between_elements"
|
||||||
|
android:drawablePadding="@dimen/text_compound_drawable_padding"
|
||||||
|
android:paddingEnd="@dimen/button_text_right_padding"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -190,7 +195,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
@ -31,6 +31,13 @@
|
|||||||
This is large enough to accommodate most, if not all, of our layouts. -->
|
This is large enough to accommodate most, if not all, of our layouts. -->
|
||||||
<dimen name="peek_height_upper_limit">500dp</dimen>
|
<dimen name="peek_height_upper_limit">500dp</dimen>
|
||||||
|
|
||||||
|
<!-- AlarmViewHolder -->
|
||||||
|
<dimen name="text_compound_drawable_padding">10dp</dimen>
|
||||||
|
|
||||||
|
<!-- Material Button -->
|
||||||
|
<dimen name="button_text_left_padding">16dp</dimen>
|
||||||
|
<dimen name="button_text_right_padding">16dp</dimen>
|
||||||
|
|
||||||
<dimen name="text_size_body_1">14sp</dimen>
|
<dimen name="text_size_body_1">14sp</dimen>
|
||||||
<dimen name="text_size_body_2">14sp</dimen>
|
<dimen name="text_size_body_2">14sp</dimen>
|
||||||
<dimen name="text_size_button">14sp</dimen>
|
<dimen name="text_size_button">14sp</dimen>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user