Loading res/layout-land/time_setup_view.xml +3 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="horizontal"> <!-- This nested ltr layout cannot be combined with the parent because Loading @@ -32,8 +33,7 @@ android:layout_marginBottom="@dimen/footer_button_size" android:layoutDirection="ltr" android:gravity="center" android:orientation="vertical" > android:orientation="vertical"> <com.android.deskclock.timer.TimerView android:id="@+id/timer_time_text" Loading Loading @@ -88,6 +88,6 @@ </LinearLayout> <include layout="@layout/timer_cancel_button" /> <include layout="@layout/timer_setup_buttons" /> </FrameLayout> No newline at end of file res/layout/desk_clock.xml +8 −9 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:baselineAligned="false" android:orientation="horizontal" app:layout_behavior="com.android.deskclock.widget.toast.LinearLayoutWithSnackbarBehavior"> Loading @@ -68,9 +69,9 @@ <ImageButton android:id="@+id/left_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> Loading Loading @@ -100,14 +101,12 @@ <ImageButton android:id="@+id/right_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> </FrameLayout> </LinearLayout> </android.support.design.widget.CoordinatorLayout> No newline at end of file res/layout/time_setup_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,6 @@ android:id="@+id/fourth" layout="@layout/three_keys_view" /> <include layout="@layout/timer_cancel_button" /> <include layout="@layout/timer_setup_buttons" /> </LinearLayout> res/layout/timer_cancel_button.xml→res/layout/timer_setup_buttons.xml +67 −0 Original line number Diff line number Diff line Loading @@ -16,25 +16,52 @@ <LinearLayout 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="@dimen/footer_button_size" android:layout_height="wrap_content" android:layout_gravity="bottom" android:orientation="horizontal"> <ImageButton android:id="@+id/timer_cancel" <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:layout_weight="1"> <ImageButton android:id="@+id/timer_cancel" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@string/timer_cancel" android:paddingEnd="20dp" android:scaleType="center" android:src="@drawable/ic_cancel" android:textSize="@dimen/button_font_size" /> android:src="@drawable/ic_cancel" /> </FrameLayout> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="start|center_vertical" android:layout_weight="1"> <android.support.design.widget.FloatingActionButton android:id="@+id/timer_create" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="@dimen/fab_margin" android:contentDescription="@string/timer_start" android:src="@drawable/ic_start_white_24dp" android:visibility="invisible" app:borderWidth="0dp" app:elevation="@dimen/fab_elevation" /> </FrameLayout> <Space android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" /> android:layout_weight="1" /> </LinearLayout> src/com/android/deskclock/timer/TimerFragment.java +53 −47 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public class TimerFragment extends DeskClockFragment { mCancelCreateButton = (ImageButton) view.findViewById(R.id.timer_cancel); mCancelCreateButton.setOnClickListener(new CancelCreateListener()); view.findViewById(R.id.timer_create).setOnClickListener(new CreateListener()); final Resources resources = getResources(); mShortAnimationDuration = resources.getInteger(android.R.integer.config_shortAnimTime); mMediumAnimationDuration = resources.getInteger(android.R.integer.config_mediumAnimTime); Loading Loading @@ -217,7 +219,8 @@ public class TimerFragment extends DeskClockFragment { // If the timer creation view is visible, store the input for later restoration. if (mCurrentView == mCreateTimerView) { outState.putSerializable(KEY_TIMER_SETUP_STATE, mCreateTimerView.getState()); mTimerSetupState = mCreateTimerView.getState(); outState.putSerializable(KEY_TIMER_SETUP_STATE, mTimerSetupState); } } Loading Loading @@ -252,33 +255,15 @@ public class TimerFragment extends DeskClockFragment { } } else if (mCurrentView == mCreateTimerView) { mFab.setVisibility(VISIBLE); mCreateTimerView.registerStartButton(mFab); mCreateTimerView.initializeStartButtonVisibility(); mFab.setImageResource(R.drawable.ic_start_white_24dp); mFab.setContentDescription(getString(R.string.timer_start)); mFab.setVisibility(INVISIBLE); } } @Override public void onFabClick(View view) { if (mCurrentView == mCreateTimerView) { // Create the new timer. final long length = mCreateTimerView.getTimeInMillis(); final Timer timer = DataModel.getDataModel().addTimer(length, "", false); Events.sendTimerEvent(R.string.action_create, R.string.label_deskclock); // Start the new timer. DataModel.getDataModel().startTimer(timer); Events.sendTimerEvent(R.string.action_start, R.string.label_deskclock); // Display the freshly created timer view. mViewPager.setCurrentItem(0); // Return to the list of timers. animateToView(mTimersView, null); } else { final Timer timer = getTimer(); // If no timer is currently showing a fab action is meaningless. if (timer == null) { return; } Loading @@ -298,7 +283,6 @@ public class TimerFragment extends DeskClockFragment { break; } } } @Override public void setLeftRightButtonAppearance() { Loading Loading @@ -432,14 +416,6 @@ public class TimerFragment extends DeskClockFragment { mTimersView.setVisibility(GONE); mCreateTimerView.setVisibility(VISIBLE); // Prepare the state of the create view. mCreateTimerView.reset(); mCreateTimerView.updateDeleteButtonAndDivider(); mCreateTimerView.registerStartButton(mFab); if (getSelectedTab() == DeskClock.TIMER_TAB_INDEX) { mCreateTimerView.initializeStartButtonVisibility(); } // Record the fact that the create view is visible. mCurrentView = mCreateTimerView; Loading Loading @@ -678,12 +654,42 @@ public class TimerFragment extends DeskClockFragment { } } /** * Clicking the play icon on the timer creation page creates a new timer and returns to the * timers list. */ private class CreateListener implements OnClickListener { @Override public void onClick(View v) { // Create the new timer. final long length = mCreateTimerView.getTimeInMillis(); final Timer timer = DataModel.getDataModel().addTimer(length, "", false); Events.sendTimerEvent(R.string.action_create, R.string.label_deskclock); // Start the new timer. DataModel.getDataModel().startTimer(timer); Events.sendTimerEvent(R.string.action_start, R.string.label_deskclock); // Reset the state of the create view. mCreateTimerView.reset(); // Display the freshly created timer view. mViewPager.setCurrentItem(0); // Return to the list of timers. animateToView(mTimersView, null); } } /** * Clicking the X icon on the timer creation page returns to the timers list. */ private class CancelCreateListener implements OnClickListener { @Override public void onClick(View view) { // Reset the state of the create view. mCreateTimerView.reset(); if (hasTimers()) { animateToView(mTimersView, null); } Loading Loading
res/layout-land/time_setup_view.xml +3 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="horizontal"> <!-- This nested ltr layout cannot be combined with the parent because Loading @@ -32,8 +33,7 @@ android:layout_marginBottom="@dimen/footer_button_size" android:layoutDirection="ltr" android:gravity="center" android:orientation="vertical" > android:orientation="vertical"> <com.android.deskclock.timer.TimerView android:id="@+id/timer_time_text" Loading Loading @@ -88,6 +88,6 @@ </LinearLayout> <include layout="@layout/timer_cancel_button" /> <include layout="@layout/timer_setup_buttons" /> </FrameLayout> No newline at end of file
res/layout/desk_clock.xml +8 −9 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:baselineAligned="false" android:orientation="horizontal" app:layout_behavior="com.android.deskclock.widget.toast.LinearLayoutWithSnackbarBehavior"> Loading @@ -68,9 +69,9 @@ <ImageButton android:id="@+id/left_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> Loading Loading @@ -100,14 +101,12 @@ <ImageButton android:id="@+id/right_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@null" android:scaleType="center" /> </FrameLayout> </LinearLayout> </android.support.design.widget.CoordinatorLayout> No newline at end of file
res/layout/time_setup_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -66,6 +66,6 @@ android:id="@+id/fourth" layout="@layout/three_keys_view" /> <include layout="@layout/timer_cancel_button" /> <include layout="@layout/timer_setup_buttons" /> </LinearLayout>
res/layout/timer_cancel_button.xml→res/layout/timer_setup_buttons.xml +67 −0 Original line number Diff line number Diff line Loading @@ -16,25 +16,52 @@ <LinearLayout 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="@dimen/footer_button_size" android:layout_height="wrap_content" android:layout_gravity="bottom" android:orientation="horizontal"> <ImageButton android:id="@+id/timer_cancel" <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:layout_gravity="start|center_vertical" android:layout_weight="1"> <ImageButton android:id="@+id/timer_cancel" android:layout_width="@dimen/design_fab_size_normal" android:layout_height="@dimen/design_fab_size_normal" android:layout_gravity="center" android:contentDescription="@string/timer_cancel" android:paddingEnd="20dp" android:scaleType="center" android:src="@drawable/ic_cancel" android:textSize="@dimen/button_font_size" /> android:src="@drawable/ic_cancel" /> </FrameLayout> <FrameLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="start|center_vertical" android:layout_weight="1"> <android.support.design.widget.FloatingActionButton android:id="@+id/timer_create" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="@dimen/fab_margin" android:contentDescription="@string/timer_start" android:src="@drawable/ic_start_white_24dp" android:visibility="invisible" app:borderWidth="0dp" app:elevation="@dimen/fab_elevation" /> </FrameLayout> <Space android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" /> android:layout_weight="1" /> </LinearLayout>
src/com/android/deskclock/timer/TimerFragment.java +53 −47 Original line number Diff line number Diff line Loading @@ -119,6 +119,8 @@ public class TimerFragment extends DeskClockFragment { mCancelCreateButton = (ImageButton) view.findViewById(R.id.timer_cancel); mCancelCreateButton.setOnClickListener(new CancelCreateListener()); view.findViewById(R.id.timer_create).setOnClickListener(new CreateListener()); final Resources resources = getResources(); mShortAnimationDuration = resources.getInteger(android.R.integer.config_shortAnimTime); mMediumAnimationDuration = resources.getInteger(android.R.integer.config_mediumAnimTime); Loading Loading @@ -217,7 +219,8 @@ public class TimerFragment extends DeskClockFragment { // If the timer creation view is visible, store the input for later restoration. if (mCurrentView == mCreateTimerView) { outState.putSerializable(KEY_TIMER_SETUP_STATE, mCreateTimerView.getState()); mTimerSetupState = mCreateTimerView.getState(); outState.putSerializable(KEY_TIMER_SETUP_STATE, mTimerSetupState); } } Loading Loading @@ -252,33 +255,15 @@ public class TimerFragment extends DeskClockFragment { } } else if (mCurrentView == mCreateTimerView) { mFab.setVisibility(VISIBLE); mCreateTimerView.registerStartButton(mFab); mCreateTimerView.initializeStartButtonVisibility(); mFab.setImageResource(R.drawable.ic_start_white_24dp); mFab.setContentDescription(getString(R.string.timer_start)); mFab.setVisibility(INVISIBLE); } } @Override public void onFabClick(View view) { if (mCurrentView == mCreateTimerView) { // Create the new timer. final long length = mCreateTimerView.getTimeInMillis(); final Timer timer = DataModel.getDataModel().addTimer(length, "", false); Events.sendTimerEvent(R.string.action_create, R.string.label_deskclock); // Start the new timer. DataModel.getDataModel().startTimer(timer); Events.sendTimerEvent(R.string.action_start, R.string.label_deskclock); // Display the freshly created timer view. mViewPager.setCurrentItem(0); // Return to the list of timers. animateToView(mTimersView, null); } else { final Timer timer = getTimer(); // If no timer is currently showing a fab action is meaningless. if (timer == null) { return; } Loading @@ -298,7 +283,6 @@ public class TimerFragment extends DeskClockFragment { break; } } } @Override public void setLeftRightButtonAppearance() { Loading Loading @@ -432,14 +416,6 @@ public class TimerFragment extends DeskClockFragment { mTimersView.setVisibility(GONE); mCreateTimerView.setVisibility(VISIBLE); // Prepare the state of the create view. mCreateTimerView.reset(); mCreateTimerView.updateDeleteButtonAndDivider(); mCreateTimerView.registerStartButton(mFab); if (getSelectedTab() == DeskClock.TIMER_TAB_INDEX) { mCreateTimerView.initializeStartButtonVisibility(); } // Record the fact that the create view is visible. mCurrentView = mCreateTimerView; Loading Loading @@ -678,12 +654,42 @@ public class TimerFragment extends DeskClockFragment { } } /** * Clicking the play icon on the timer creation page creates a new timer and returns to the * timers list. */ private class CreateListener implements OnClickListener { @Override public void onClick(View v) { // Create the new timer. final long length = mCreateTimerView.getTimeInMillis(); final Timer timer = DataModel.getDataModel().addTimer(length, "", false); Events.sendTimerEvent(R.string.action_create, R.string.label_deskclock); // Start the new timer. DataModel.getDataModel().startTimer(timer); Events.sendTimerEvent(R.string.action_start, R.string.label_deskclock); // Reset the state of the create view. mCreateTimerView.reset(); // Display the freshly created timer view. mViewPager.setCurrentItem(0); // Return to the list of timers. animateToView(mTimersView, null); } } /** * Clicking the X icon on the timer creation page returns to the timers list. */ private class CancelCreateListener implements OnClickListener { @Override public void onClick(View view) { // Reset the state of the create view. mCreateTimerView.reset(); if (hasTimers()) { animateToView(mTimersView, null); } Loading