Skip to content
Permalink
Browse files

Pixel Navbar, reverse engineered from smali.

Notes:
- This is forcing the Pixel Home button on people,
  and it looks ugly with the other nav buttons being hollow

- There MAY still be a few fixes yet to be found in this code
  because it WAS a big file to RE from smali. I have yet to find
  any, but time is the best tester.

- Shoutout to @bigrushdog for providing a decompiled form used
  to verify the smali and as a guideline for the more obsure
  smali sections. It was a big help.

- Tagging myself here to see adoption rate. @USA-RedDragon

CarbonROM Edits: Strip out the different Navbar Icons.
We use the AOSP ones, but add the Pixel features.

Adjusted for R33s smaller navbar buttons.

Fix landscape pixel animation view

Cleanup pixel navbar code

*cleaned up alot of leftovers from jadx and some else statements

CarbonROM Edits: Strip out the different Navbar Icons.
We use the AOSP ones, but add the Pixel features.

fwb: Pixel Navbar: Hide opa when not pressed, also remove halo

Since we use the AOSP Navbar Icon, that is transparent in the middle,
we don't want the opa to always show. Instead, only show them when a
press is getting executed (when they need to be shown for the animation).

fadeInButton and fadeOutButton are based on this Stackoverflow answer:
http://stackoverflow.com/a/22669115

Pixel navbar: allow disabling based on config

Create new config_allowOpaLayout bool to allow themers to disable the Pixel Navbar

Fixes the dreaded "yellow" home button...that doesn't exist for CarbonROM.
Oh well, still useful!

Pixel Navbar animation toggle [1/2]

*made to work with the exposure for themers to disable navbar animation

[1/2] Reload Pixel Home Animation without reboot

@beanstown104 this shit hot

fwb: Pixel Navbar: hide OPA after initialisation

This fixes a certain case where the OPAs are not hidden in idle-state

OpaLayout: setLandscape -> setVertical

OpaLayout: fix logic behind setVertical

PixelNavbar: Fixed to work with oreo

PixelNavbar: Fix colors for light colored navbar

OpaLayout: Evaluate intensity correctly

- R.color.dark_mode_icon_color_single_tone already has reduced intensity.
  Calculating intensity from dark_mode_icon_color_single_tone and
   light_mode_icon_color_single_tone results in a much lighter shade
   on the home button.
- Instead, evaluate color from intensity using black and white to
   have all icons display the same shade.

Before: https://i.imgur.com/SwBjxYt.jpg
After: https://i.imgur.com/tjFPEz0.jpg

PixelNavbar: layout: Fix home button size

- On 8.1, the home button appears larger than the other buttons
   in the navigation bar, with OpaLayout.
- To the home button ImageView,
   Add top and bottom padding to fix size in portrait mode
   Add left and right padding to fix size in landscape mode
- Also clean up while we're at it.

Before: https://i.imgur.com/D1WB41o.jpg
After: https://i.imgur.com/toAHDpS.jpg
  • Loading branch information...
USA-RedDragon committed Nov 26, 2016
1 parent 0ef8698 commit 29b2606eef40bbc5741d10577737899e8d4e1c8b
@@ -3683,6 +3683,12 @@ public boolean validate(String value) {
/** @hide */
public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;

/**
* Whether to enable the pixel navbar animation
* @hide
*/
public static final String PIXEL_NAV_ANIMATION = "pixel_nav_animation";

/**
* Whether the notification LED should repeatedly flash when a notification is
* pending. The value is boolean (1 or 0).
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="ring" android:useLevel="false" android:innerRadius="@dimen/halo_inner_radius" android:thickness="@dimen/halo_thickness"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<size android:height="@dimen/halo_diameter" android:width="@dimen/halo_diameter" />
</shape>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ff4285f4" />
</shape>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ff34a853" />
</shape>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ffea4335" />
</shape>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#fffbbc05" />
</shape>
@@ -13,19 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<com.android.systemui.statusbar.policy.KeyButtonView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/home"
android:layout_width="@dimen/navigation_key_width"
android:layout_height="match_parent"
android:layout_weight="0"
systemui:keyCode="3"
android:scaleType="fitCenter"
android:contentDescription="@string/accessibility_home"
android:paddingTop="@dimen/home_padding"
android:paddingBottom="@dimen/home_padding"
android:paddingStart="@dimen/navigation_key_padding"
android:paddingEnd="@dimen/navigation_key_padding"
/>

<com.google.android.systemui.OpaLayout android:id="@+id/home" android:clipChildren="false" android:clipToPadding="false" android:layout_width="@dimen/navigation_key_width" android:layout_height="fill_parent" android:layout_weight="0.0" android:paddingStart="@dimen/navigation_key_padding" android:paddingEnd="@dimen/navigation_key_padding"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/red" android:src="@drawable/ic_sysbar_opa_red" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/blue" android:src="@drawable/ic_sysbar_opa_blue" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/green" android:src="@drawable/ic_sysbar_opa_green" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/yellow" android:src="@drawable/ic_sysbar_opa_yellow" android:importantForAccessibility="no" style="@style/DotStyle" />
</RelativeLayout>
<ImageView android:layout_gravity="center" android:id="@+id/white" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sysbar_home" android:importantForAccessibility="no" android:paddingTop="@dimen/home_padding" android:paddingBottom="@dimen/home_padding" android:paddingLeft="@dimen/home_padding" android:paddingRight="@dimen/home_padding" />
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="center" android:id="@+id/home_button" android:layout_width="@dimen/navigation_key_width" android:layout_height="fill_parent" android:scaleType="fitCenter" android:contentDescription="@string/accessibility_home" systemui:keyCode="3" android:paddingTop="@dimen/home_padding" android:paddingBottom="@dimen/home_padding" />
</com.google.android.systemui.OpaLayout>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CarbonROM
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Allow Opa (Pixel navbar) layout -->
<bool name="config_allowOpaLayout">true</bool>
</resources>
@@ -858,4 +858,18 @@
<!-- Home button padding for sizing -->
<dimen name="home_padding">15dp</dimen>

<!-- OPA home dimens -->
<dimen name="halo_inner_radius">10.0dip</dimen>
<dimen name="halo_thickness">1.0dip</dimen>
<dimen name="halo_diameter">22.0dip</dimen>
<dimen name="opa_dot_diam">10.0dip</dimen>
<dimen name="opa_diamond_translation">16.0dip</dimen>
<dimen name="opa_line_y_translation">16.0dip</dimen>
<dimen name="opa_line_x_trans_ry">15.0dip</dimen>
<dimen name="opa_line_x_trans_bg">30.0dip</dimen>
<dimen name="opa_line_x_collapse_bg">46.0dip</dimen>
<dimen name="opa_line_x_collapse_ry">15.0dip</dimen>
<dimen name="opa_overshoot_translation">8.0dip</dimen>
<dimen name="opa_return_translation">-1.0dip</dimen>
<dimen name="opa_rest_to_collapse">7.0dip</dimen>
</resources>
@@ -489,4 +489,11 @@
<item name="android:colorBackground">?android:attr/colorSecondary</item>
</style>

<style name="DotStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
</style>

</resources>
@@ -0,0 +1,9 @@
package com.google.android.systemui;

public class Constants {

public static final String OPA_COMPONENT_NAME = "com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService";
public static final String OPA_ENABLED = "OPA_ENABLED";
public static final String OPA_ENABLE_ACTION = "com.google.android.systemui.OPA_ENABLED";

}
Oops, something went wrong.

0 comments on commit 29b2606

Please sign in to comment.
You can’t perform that action at this time.