Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ea760c8 authored by android-build-team Robot's avatar android-build-team Robot Committed by Android (Google) Code Review
Browse files

Merge changes I1539580e,I8452e799 into pi-dev

* changes:
  Volume dialog mulit-streams have 8dp padding
  Check if alarm and now times are in schedule
parents 188b642a 6cb4cafd
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -134,6 +134,24 @@ public class ScheduleCalendar {
        return isInSchedule(-1, time, start, end) || isInSchedule(0, time, start, end);
    }

    /**
     * @param alarm milliseconds since Epoch
     * @param now milliseconds since Epoch
     * @return true if alarm and now is within the schedule, else false
     */
    public boolean isAlarmInSchedule(long alarm, long now) {
        if (mSchedule == null || mDays.size() == 0) return false;
        final long start = getTime(alarm, mSchedule.startHour, mSchedule.startMinute);
        long end = getTime(alarm, mSchedule.endHour, mSchedule.endMinute);
        if (end <= start) {
            end = addDays(end, 1);
        }
        return (isInSchedule(-1, alarm, start, end)
                && isInSchedule(-1, now, start, end))
                || (isInSchedule(0, alarm, start, end)
                && isInSchedule(0, now, start, end));
    }

    /**
     * @param time milliseconds since Epoch
     * @return true if should exit at time for next alarm, else false
@@ -145,7 +163,7 @@ public class ScheduleCalendar {
        return mSchedule.exitAtAlarm
                && mSchedule.nextAlarm != 0
                && time >= mSchedule.nextAlarm
                && isInSchedule(mSchedule.nextAlarm);
                && isAlarmInSchedule(mSchedule.nextAlarm, time);
    }

    private boolean isInSchedule(int daysOffset, long time, long start, long end) {
+8 −2
Original line number Diff line number Diff line
@@ -53,7 +53,11 @@
                android:layout_gravity="center"
                android:soundEffectsEnabled="false" />

            <include layout="@layout/volume_dnd_icon"/>
            <include layout="@layout/volume_dnd_icon"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginRight="@dimen/volume_dialog_stream_padding"
                     android:layout_marginTop="6dp"/>
        </FrameLayout>

        <LinearLayout
@@ -71,7 +75,9 @@
                android:layout_height="wrap_content"
                android:minWidth="@dimen/volume_dialog_panel_width"
                android:gravity="center"
                android:orientation="horizontal" >
                android:orientation="horizontal"
                android:paddingRight="@dimen/volume_dialog_stream_padding"
                android:paddingLeft="@dimen/volume_dialog_stream_padding">
                    <!-- volume rows added and removed here! :-) -->
            </LinearLayout>
            <FrameLayout
+3 −4
Original line number Diff line number Diff line
@@ -17,13 +17,12 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dnd_icon"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:layout_marginTop="6dp">

    <ImageView
        android:layout_width="14dp"
        android:layout_height="14dp"
        android:layout_marginTop="6dp"
        android:layout_marginRight="6dp"
        android:layout_gravity="right|top"
        android:src="@drawable/ic_dnd"
        android:tint="?android:attr/textColorTertiary"/>
+2 −0
Original line number Diff line number Diff line
@@ -296,6 +296,8 @@

    <dimen name="volume_dialog_panel_transparent_padding">20dp</dimen>

    <dimen name="volume_dialog_stream_padding">8dp</dimen>

    <!-- the amount the volume panel should be offset at the end from the view next to it (or
    the screen edge, in portrait-->
    <dimen name="volume_dialog_base_margin">8dp</dimen>
+0 −20
Original line number Diff line number Diff line
@@ -695,26 +695,6 @@ public class VolumeDialogImpl implements VolumeDialog {
    private void enableVolumeRowViewsH(VolumeRow row, boolean enable) {
        boolean showDndIcon = !enable;
        row.dndIcon.setVisibility(showDndIcon ? VISIBLE : GONE);

        if (showDndIcon && getNumVisibleRows() == 1) {
            row.dndIcon.setLayoutParams(new FrameLayout.LayoutParams(
                    mContext.getResources().getDimensionPixelSize(
                            R.dimen.volume_dialog_panel_width),
                    FrameLayout.LayoutParams.WRAP_CONTENT));
        } else if (row.view.getVisibility() == VISIBLE) {
            row.dndIcon.setLayoutParams(new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));
        }
    }

    private int getNumVisibleRows() {
        int count = 0;
        for (int i = 0; i < mRows.size(); i++) {
            if (mRows.get(i).view.getVisibility() == VISIBLE) {
                count++;
            }
        }
        return count;
    }

    /**
Loading