Add fade out/fade in animation in PS setup auto advancing screen
As per the UX requirement below changes are made in the screen: - Position of "Setting up Pirvate Space" text is left aligned to layout - Lading progress bar next to text removed - Add fade out and fade in animation for header and image in auto advance screen Bug: 310218201 Test: Manual Change-Id: Iaf9c27761ce7f25368aac8f9a7d43eba20d66353
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
android:id="@+id/privatesapce_autoadvance_screen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:sucHeaderText="@string/privatespace_lock_protected_title"
|
||||
android:icon="@drawable/ic_privatespace_icon">
|
||||
<LinearLayout style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
@@ -34,26 +33,14 @@
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/privatespace_setup_flow_placeholder"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/setup_progress"
|
||||
<TextView
|
||||
android:id="@+id/createMessage"
|
||||
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_margin="16dp"
|
||||
android:orientation="horizontal">
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_cyclic"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"/>
|
||||
<TextView
|
||||
android:id="@+id/createMessage"
|
||||
style="@style/PrivateSpaceSetupTextFontStyle"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/privatespace_setting_up_text"
|
||||
android:layout_margin="8dp"/>
|
||||
</LinearLayout>
|
||||
android:textSize="14sp"
|
||||
android:text="@string/privatespace_setting_up_text"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.setupdesign.GlifLayout>
|
||||
|
@@ -1270,12 +1270,12 @@
|
||||
<string name="privatespace_apps_permission_text">Private Space apps won\u2019t appear in permission manager, privacy dashboard, and other settings when Private Space is locked</string>
|
||||
<!-- Text shown at the bottom in Private Space auto advancing screens. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_setting_up_text">Setting up Private Space\u2026</string>
|
||||
<!-- Title for Private Space setup in auto advancing screen informing private space is protected by a lock. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_lock_protected_title">Private Space is protected by a lock</string>
|
||||
<!-- Title for Private Space setup in auto advancing screen informing private space is hidden when locked. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_apps_hidden_title">Usage info for Private Space apps is hidden when it\u2019s locked</string>
|
||||
<!-- Title for Private Space setup in auto advancing screen informing private space can be accessed from apps list. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_access_from_apps_title">Access Private Space from your apps list</string>
|
||||
<!-- Title for Private Space setup in auto advancing screen informing some system apps are already installed in Private Space. [CHAR LIMIT=NONE] -->
|
||||
<string name="privatespace_system_apps_installed_title">Some system apps are already installed in Private Space</string>
|
||||
<!-- Title for Private Space creation error screen. [CHAR LIMIT=60] -->
|
||||
<string name="privatespace_error_screen_title">Couldn\u2019t set up Private Space</string>
|
||||
<!-- Summary for the Private Space creation error screen. [CHAR LIMIT=60] -->
|
||||
|
@@ -19,6 +19,11 @@ package com.android.settings.privatespace;
|
||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.ACCOUNT_LOGIN_ACTION;
|
||||
import static com.android.settings.privatespace.PrivateSpaceSetupActivity.EXTRA_ACTION_TYPE;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -51,16 +56,17 @@ public class AutoAdvanceSetupFragment extends Fragment {
|
||||
private static final String TAG = "AutoAdvanceFragment";
|
||||
private static final String TITLE_INDEX = "title_index";
|
||||
private static final int DELAY_BETWEEN_SCREENS = 5000; // 5 seconds in millis
|
||||
private static final int ANIMATION_DURATION_MILLIS = 500;
|
||||
private GlifLayout mRootView;
|
||||
private Handler mHandler;
|
||||
private int mScreenTitleIndex;
|
||||
private static final List<Pair<Integer, Integer>> HEADER_IMAGE_PAIRS =
|
||||
ImmutableList.of(
|
||||
new Pair(R.string.privatespace_lock_protected_title,
|
||||
R.drawable.privatespace_setup_flow_placeholder),
|
||||
new Pair(R.string.privatespace_apps_hidden_title,
|
||||
R.drawable.privatespace_setup_flow_placeholder),
|
||||
new Pair(R.string.privatespace_access_from_apps_title,
|
||||
R.drawable.privatespace_setup_flow_placeholder),
|
||||
new Pair(R.string.privatespace_system_apps_installed_title,
|
||||
R.drawable.privatespace_setup_flow_placeholder));
|
||||
|
||||
private Runnable mUpdateScreenResources =
|
||||
@@ -69,7 +75,7 @@ public class AutoAdvanceSetupFragment extends Fragment {
|
||||
public void run() {
|
||||
if (getActivity() != null) {
|
||||
if (++mScreenTitleIndex < HEADER_IMAGE_PAIRS.size()) {
|
||||
updateHeaderAndImage();
|
||||
startFadeOutAnimation();
|
||||
mHandler.postDelayed(mUpdateScreenResources, DELAY_BETWEEN_SCREENS);
|
||||
} else {
|
||||
PrivateSpaceMaintainer privateSpaceMaintainer = PrivateSpaceMaintainer
|
||||
@@ -148,5 +154,32 @@ public class AutoAdvanceSetupFragment extends Fragment {
|
||||
mRootView.setHeaderText(HEADER_IMAGE_PAIRS.get(mScreenTitleIndex).first);
|
||||
((ImageView) mRootView.findViewById(R.id.placeholder_image))
|
||||
.setImageResource(HEADER_IMAGE_PAIRS.get(mScreenTitleIndex).second);
|
||||
startFadeInAnimation();
|
||||
}
|
||||
|
||||
private void startFadeInAnimation() {
|
||||
ValueAnimator textView = ObjectAnimator.ofFloat(
|
||||
mRootView.getHeaderTextView(), View.ALPHA, 0f, 1f);
|
||||
ValueAnimator imageView = ObjectAnimator.ofFloat(
|
||||
mRootView.findViewById(R.id.placeholder_image), View.ALPHA, 0, 1f);
|
||||
AnimatorSet fadeIn = new AnimatorSet();
|
||||
fadeIn.playTogether(textView, imageView);
|
||||
fadeIn.setDuration(ANIMATION_DURATION_MILLIS).start();
|
||||
}
|
||||
|
||||
private void startFadeOutAnimation() {
|
||||
AnimatorSet fadeOut = new AnimatorSet();
|
||||
ValueAnimator textView = ObjectAnimator.ofFloat(
|
||||
mRootView.getHeaderTextView(), View.ALPHA, 1f, 0f);
|
||||
ValueAnimator imageView = ObjectAnimator.ofFloat(
|
||||
mRootView.findViewById(R.id.placeholder_image), View.ALPHA, 1f, 0f);
|
||||
fadeOut.playTogether(textView, imageView);
|
||||
fadeOut.setDuration(ANIMATION_DURATION_MILLIS).start();
|
||||
fadeOut.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
updateHeaderAndImage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user