Skip to content

Commit

Permalink
Halo: Fix up header button icon, position and animation
Browse files Browse the repository at this point in the history
Change-Id: I119c754cb24ccc43ccd0c326225b25bb48667706

Conflicts:
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
  • Loading branch information
LorDClockaN authored and temasek committed Aug 7, 2016
1 parent efc531b commit d9b7348
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 14 deletions.
Binary file modified packages/SystemUI/res/drawable-hdpi/ic_notify_halo_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-hdpi/ic_notify_halo_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-mdpi/ic_notify_halo_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-mdpi/ic_notify_halo_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-xhdpi/ic_notify_halo_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-xhdpi/ic_notify_halo_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/SystemUI/res/drawable-xxhdpi/ic_notify_halo_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 12 additions & 10 deletions packages/SystemUI/res/layout/status_bar_expanded_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,27 @@

</com.android.systemui.statusbar.AlphaOptimizedFrameLayout>

<ImageButton
android:id="@+id/halo_button"
android:src="@drawable/ic_notify_halo"
android:contentDescription="@string/accessibility_halo"
android:layout_width="40dp"
android:layout_height="@dimen/status_bar_header_height"
android:layout_toStartOf="@id/settings_button_container"
style="@android:style/Widget.Material.Button.Borderless"
android:layout_marginStart="7dp"
android:background="@drawable/ripple_drawable" />

<com.android.keyguard.AlphaOptimizedImageButton android:id="@+id/task_manager_button"
style="@android:style/Widget.Material.Button.Borderless"
android:layout_toStartOf="@id/settings_button_container"
android:layout_toStartOf="@id/halo_button"
android:layout_width="48dp"
android:layout_marginStart="8dp"
android:layout_height="@dimen/status_bar_header_height"
android:background="@drawable/ripple_drawable"
android:src="@drawable/ic_tasklist_switch_normal"
android:visibility="gone"/>

<ImageButton
android:id="@+id/halo_button"
android:src="@drawable/ic_notify_halo"
android:contentDescription="@string/accessibility_halo"
android:layout_width="50dp"
android:layout_height="@dimen/status_bar_header_height"
android:layout_toStartOf="@id/task_manager_button"
style="@android:style/Widget.Material.Button.Borderless"
android:background="@drawable/ripple_drawable" />

<LinearLayout android:id="@+id/system_icons_super_container"
android:layout_width="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,11 +894,13 @@ private void captureLayoutValues(LayoutValues target) {
? 0
: mMultiUserSwitch.getLeft() - mSettingsContainer.getLeft();
target.haloButtonAlpha = getAlphaForVisibility(mHaloButton);
target.haloButtonTranslation = mExpanded ? 0 : mSettingsContainer.getLeft() - mHaloButton.getLeft();
target.haloButtonTranslation = mExpanded
? 0
: mSettingsContainer.getLeft() - mHaloButton.getLeft();
target.taskManagerAlpha = getAlphaForVisibility(mTaskManagerButton);
target.taskManagerTranslation = mExpanded
? 0
: mSettingsContainer.getLeft() - mTaskManagerButton.getLeft();
: mHaloButton.getLeft() - mTaskManagerButton.getLeft();
target.signalClusterAlpha = mSignalClusterDetached ? 0f : 1f;
target.settingsRotation = !mExpanded ? 90f : 0f;
}
Expand Down Expand Up @@ -959,7 +961,9 @@ private void applyLayoutValues(LayoutValues values) {
mTaskManagerButton.setTranslationY(mSystemIconsSuperContainer.getTranslationY());
mTaskManagerButton.setTranslationX(values.taskManagerTranslation);
mTaskManagerButton.setRotation(values.settingsRotation);
mHaloButton.setTranslationY(mSystemIconsSuperContainer.getTranslationY());
mHaloButton.setTranslationX(values.haloButtonTranslation);
mHaloButton.setRotation(values.settingsRotation);
applyAlpha(mEmergencyCallsOnly, values.emergencyCallsOnlyAlpha);
if (!mShowingDetail && !mDetailTransitioning) {
// Otherwise it needs to stay invisible
Expand Down Expand Up @@ -1071,7 +1075,7 @@ public void interpoloate(LayoutValues v1, LayoutValues v2, float t) {
v1.taskManagerTranslation * (1 - t) + v2.taskManagerTranslation * t;
settingsTranslation = v1.settingsTranslation * (1 - t) + v2.settingsTranslation * t;
weatherY = v1.weatherY * (1 - t) + v2.weatherY * t;
haloButtonTranslation = v1.haloButtonTranslation * (1 -t) + v2.haloButtonTranslation * t;
haloButtonTranslation = v1.haloButtonTranslation * (1 - t) + v2.haloButtonTranslation * t;

float t1 = Math.max(0, t - 0.5f) * 2;
settingsRotation = v1.settingsRotation * (1 - t1) + v2.settingsRotation * t1;
Expand Down Expand Up @@ -1220,7 +1224,7 @@ private boolean toggleHalo() {
return Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.HALO_ACTIVE, 1);
}

class SettingsObserver extends UserContentObserver {
SettingsObserver(Handler handler) {
super(handler);
Expand Down

0 comments on commit d9b7348

Please sign in to comment.