Merge "Removing the countdown timer and countdown progress bar from the Car User Picker." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
660a7639ca
@@ -39,23 +39,13 @@
|
||||
android:theme="@android:style/Theme"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<!-- This progress bar is the countdown timer. -->
|
||||
<ProgressBar
|
||||
android:id="@+id/countdown_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/car_user_switcher_progress_bar_height"
|
||||
style="@style/CarUserSwitcher.ProgressBar"
|
||||
android:layout_marginTop="@dimen/car_user_switcher_progress_bar_margin_top"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<com.android.systemui.statusbar.car.UserGridView
|
||||
android:id="@+id/user_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/car_margin"
|
||||
android:layout_marginRight="@dimen/car_margin"
|
||||
android:layout_marginBottom="@dimen/car_user_grid_margin_bottom"
|
||||
android:layout_centerInParent="true" />
|
||||
android:layout_centerInParent="true"/>
|
||||
|
||||
<com.android.systemui.statusbar.car.PageIndicator
|
||||
android:id="@+id/user_switcher_page_indicator"
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/car_margin"
|
||||
android:layout_marginRight="@dimen/car_margin"
|
||||
android:layout_marginBottom="@dimen/car_user_grid_margin_bottom"
|
||||
android:layout_above="@id/user_switcher_page_indicator" />
|
||||
|
||||
<com.android.systemui.statusbar.car.PageIndicator
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
<dimen name="car_page_indicator_dot_diameter">12dp</dimen>
|
||||
<dimen name="car_page_indicator_margin_bottom">24dp</dimen>
|
||||
|
||||
<dimen name="car_user_switcher_progress_bar_height">6dp</dimen>
|
||||
<dimen name="car_user_switcher_progress_bar_margin_top">@dimen/status_bar_height</dimen>
|
||||
<dimen name="car_start_driving_corner_radius">16dp</dimen>
|
||||
<dimen name="car_start_driving_padding_side">30dp</dimen>
|
||||
<dimen name="car_start_driving_height">80dp</dimen>
|
||||
@@ -57,7 +55,6 @@
|
||||
<dimen name="car_user_switcher_container_height">420dp</dimen>
|
||||
<!-- This must be the negative of car_user_switcher_container_height for the animation. -->
|
||||
<dimen name="car_user_switcher_container_anim_height">-420dp</dimen>
|
||||
<dimen name="car_user_grid_margin_bottom">28dp</dimen>
|
||||
|
||||
<dimen name="car_body2_size">26sp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -16,8 +16,5 @@
|
||||
-->
|
||||
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<integer name="car_user_switcher_timeout_ms">15000</integer>
|
||||
<!-- This values less than ProgressBar.PROGRESS_ANIM_DURATION for a smooth animation. -->
|
||||
<integer name="car_user_switcher_anim_update_ms">60</integer>
|
||||
<integer name="car_user_switcher_anim_cascade_delay_ms">27</integer>
|
||||
</resources>
|
||||
|
||||
@@ -16,14 +16,6 @@
|
||||
-->
|
||||
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<style name="CarUserSwitcher.ProgressBar" parent="@android:style/Widget.ProgressBar.Horizontal">
|
||||
<item name="android:progressDrawable">@drawable/car_progress_bar</item>
|
||||
<item name="android:min">0</item>
|
||||
<item name="android:max">@integer/car_user_switcher_timeout_ms</item>
|
||||
<item name="android:progress">0</item>
|
||||
<item name="android:interpolator">@android:anim/linear_interpolator</item>
|
||||
</style>
|
||||
|
||||
<style name="CarUserSwitcher.StartDrivingButton" parent="@android:style/Widget.Material.Button">
|
||||
<item name="android:background">@drawable/car_round_button</item>
|
||||
<item name="android:textSize">@dimen/car_start_driving_text_size</item>
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.car;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.res.Resources;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -36,16 +35,11 @@ public class FullscreenUserSwitcher {
|
||||
private final View mParent;
|
||||
private final UserGridView mUserGridView;
|
||||
private final UserSwitcherController mUserSwitcherController;
|
||||
private final ProgressBar mProgressBar;
|
||||
private final ProgressBar mSwitchingUsers;
|
||||
private final int mLoginTimeoutMs;
|
||||
private final int mAnimUpdateIntervalMs;
|
||||
private final int mShortAnimDuration;
|
||||
|
||||
private boolean mShowing;
|
||||
|
||||
private CountDownTimer mTimer;
|
||||
|
||||
public FullscreenUserSwitcher(StatusBar statusBar,
|
||||
UserSwitcherController userSwitcherController,
|
||||
ViewStub containerStub) {
|
||||
@@ -63,26 +57,13 @@ public class FullscreenUserSwitcher {
|
||||
PageIndicator pageIndicator = mContainer.findViewById(R.id.user_switcher_page_indicator);
|
||||
pageIndicator.setupWithViewPager(mUserGridView);
|
||||
|
||||
mProgressBar = mContainer.findViewById(R.id.countdown_progress);
|
||||
Resources res = mContainer.getResources();
|
||||
mLoginTimeoutMs = res.getInteger(R.integer.car_user_switcher_timeout_ms);
|
||||
mAnimUpdateIntervalMs = res.getInteger(R.integer.car_user_switcher_anim_update_ms);
|
||||
mShortAnimDuration = res.getInteger(android.R.integer.config_shortAnimTime);
|
||||
|
||||
mContainer.findViewById(R.id.start_driving).setOnClickListener(v -> {
|
||||
cancelTimer();
|
||||
automaticallySelectUser();
|
||||
});
|
||||
|
||||
// Any interaction with the screen should cancel the timer.
|
||||
mContainer.setOnClickListener(v -> {
|
||||
cancelTimer();
|
||||
});
|
||||
mUserGridView.setOnTouchListener((v, e) -> {
|
||||
cancelTimer();
|
||||
return false;
|
||||
});
|
||||
|
||||
mSwitchingUsers = mParent.findViewById(R.id.switching_users);
|
||||
}
|
||||
|
||||
@@ -127,44 +108,14 @@ public class FullscreenUserSwitcher {
|
||||
}
|
||||
mShowing = true;
|
||||
mParent.setVisibility(View.VISIBLE);
|
||||
cancelTimer();
|
||||
|
||||
// This would be the case if we were in the middle of a switch.
|
||||
if (mProgressBar.getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
mTimer = new CountDownTimer(mLoginTimeoutMs, mAnimUpdateIntervalMs) {
|
||||
@Override
|
||||
public void onTick(long msUntilFinished) {
|
||||
int elapsed = mLoginTimeoutMs - (int) msUntilFinished;
|
||||
mProgressBar.setProgress((int) elapsed, true /* animate */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
mProgressBar.setProgress(mLoginTimeoutMs, true /* animate */);
|
||||
automaticallySelectUser();
|
||||
}
|
||||
};
|
||||
mTimer.start();
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
mShowing = false;
|
||||
cancelTimer();
|
||||
toggleSwitchInProgress(false);
|
||||
mParent.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void cancelTimer() {
|
||||
if (mTimer != null) {
|
||||
mTimer.cancel();
|
||||
mTimer = null;
|
||||
mProgressBar.setProgress(0, true /* animate */);
|
||||
}
|
||||
}
|
||||
|
||||
private void automaticallySelectUser() {
|
||||
// TODO: Switch according to some policy. This implementation just tries to drop the
|
||||
// keyguard for the current user.
|
||||
|
||||
Reference in New Issue
Block a user