Skip to content

Commit

Permalink
PIE 2.0
Browse files Browse the repository at this point in the history
Pie is an alternative navigation and system info interface. It replaces the
standard navbar/statusbar with a navigation arc decorated with statusbar info.

Important notes for developers:
* When PIE is enabled apps don't even have to support immersive mode, they just have
  to check for configuration updates (sadly not even this is done by all apps).
  When PIE is disabled, apps have to setup an "onSystemUiVisibilityChangeListener"
  (best practice for PIE enabled, too).
* Changed how ActivityInfo handles apps capabilities like recalculate screen
  size etc. Check code comment(s).

Some info:
* Quicksettings and notification panels are not available anymore, google now
  replace swipe up gesture.
* Switched to kitkat colors.
* General improvement to the code, reorganize classes.
* Cleanup a lot and remove useless code.
* Merge with immersive mode, they live in a homogenized state.
* Improve immersive code a bit.
* Upon first activation, toggling immersive tile, the user is presented with a dialog asking
  to enable or disable the feature. The preference can be resetted in "Backup & restore" in settings.
* Reduce and center its trigger area.
* While pie is triggered screen is keept on.
* Depending on immersive mode, will show full or lite pie.
* New circled snap points.
* Detach pie on every rotation and/or when screen goes off while you have it triggered.
* What else, what some slices?

Key contributors:
@bigbrother1984
@D4rKn3sSyS
@Anu6is
@David96
@drcmda

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: Jesus David <jesdga95@gmail.com>
Signed-off-by: Curtis Mayers <curtis.mayers@gmail.com>
Signed-off-by: David L.-W. <david.leppla.weber@gmail.com>
Signed-off-by: Paul Henschel <drcmda@gmail.com>
Change-Id: I6d09b1e2124d14e6cec48b40ea0c7948ebbb02b3
  • Loading branch information
drcmda authored and kaluoshi committed Mar 25, 2014
1 parent 8d6c7a9 commit 4a50429
Show file tree
Hide file tree
Showing 30 changed files with 2,336 additions and 64 deletions.
8 changes: 4 additions & 4 deletions core/java/android/content/pm/ActivityInfo.java
Expand Up @@ -475,10 +475,10 @@ public static int activityInfoConfigToNative(int input) {
* framework call here to get the real value.
*/
public int getRealConfigChanged() {
return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
| ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
: configChanges;
// If an app doesn't handle screen size changes or layout changes, just ignore it, don't kill them!
return configChanges | ActivityInfo.CONFIG_SCREEN_LAYOUT | ActivityInfo.CONFIG_SCREEN_SIZE
| (applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 ?
ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE : 0);
}

/**
Expand Down
31 changes: 30 additions & 1 deletion core/java/android/provider/Settings.java
Expand Up @@ -2587,6 +2587,34 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String LOCKSCREEN_MAXIMIZE_WIDGETS = "lockscreen_maximize_widgets";

/**
* Pie control panel. Meet him on the spot.
* 0 = off
* 1 = on
* Changes aspect depends on status bar visibility.
* @hide
*/
public static final String PIE_STATE = "pie_state";

/**
* Used by Phone Window Manager to tell PIE which mode to use
* depending on whether nav/statusbar is hidden
* 0 = off
* 1 = simple
* 2 = full
* @hide
*/
public static final String PIE_MODE = "pie_mode";

/**
* Location of the pie in the screen
* 0 = Gravity.BOTTOM (default)
* 1 = Gravity.LEFT
* 2 = Gravity.RIGHT
* @hide
*/
public static final String PIE_GRAVITY = "pie_gravity";

/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
Expand Down Expand Up @@ -2663,7 +2691,8 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String[] SETTINGS_TO_RESET = {
QUICK_SETTINGS_QUICK_PULL_DOWN,
SAFE_HEADSET_VOLUME
SAFE_HEADSET_VOLUME,
PIE_STATE
};

// Settings moved to Settings.Secure
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions packages/SystemUI/res/layout/pie_control_panel.xml
@@ -0,0 +1,20 @@
<!-- Copyright (C) 2014 ParanoidAndroid Project
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.
-->

<com.android.systemui.statusbar.pie.PieControlPanel
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pie_content_frame"
android:background="#00000000" />
6 changes: 4 additions & 2 deletions packages/SystemUI/res/values-es/pa_strings.xml
Expand Up @@ -19,8 +19,6 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="screenshot_delete_action">Borrar</string>
<string name="screenshot_delete_confirmation">Captura de pantalla eliminada</string>
<string name="quick_settings_quick_pull_down_title">Despliegue rápido</string>
<string name="quick_settings_quick_pull_down_message">¿Le gustaría que el borde de la barra de notificaciones despliegue el panel de ajustes rápidos?</string>
<string name="quick_settings_battery_charging">Cargando</string>
<string name="quick_settings_battery_discharging">Descargando</string>
<string name="quick_settings_immersive_global_on_label">Inmersión</string>
Expand Down Expand Up @@ -54,4 +52,8 @@
<string name="quick_settings_location_mode_high_label">Alta</string>
<string name="quick_settings_location_mode_battery_label">Batería</string>
<string name="quick_settings_location_mode_sensors_label">Dispositivo</string>
<string name="quick_settings_quick_pull_down_title">Despliegue rápido</string>
<string name="quick_settings_quick_pull_down_message">¿Le gustaría que el borde de la barra de notificaciones despliegue el panel de ajustes rápidos?</string>
<string name="enable_pie_control_title">Controles circulares</string>
<string name="enable_pie_control_message">¿Le gustaría utilizar los controles circulares en el modo inmersivo?</string>
</resources>
20 changes: 20 additions & 0 deletions packages/SystemUI/res/values-land/pa_dimens.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2014 ParanoidAndroid Project
*
* 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>
<dimen name="pie_panel_padding">100dp</dimen>
</resources>
19 changes: 19 additions & 0 deletions packages/SystemUI/res/values/pa_colors.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 ParanoidAndroid Project
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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Pie colors -->
<color name="pie_menu_background">#C0000000</color>
</resources>
40 changes: 40 additions & 0 deletions packages/SystemUI/res/values/pa_dimens.xml
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013,2014 ParanoidAndroid Project
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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Pie controls dimensions -->
<dimen name="pie_trigger_height">10dp</dimen>
<dimen name="pie_trigger_width">150dp</dimen>
<dimen name="pie_radius_start">65dp</dimen>
<dimen name="pie_radius_increment">80dp</dimen>
<dimen name="pie_outline">1.5dp</dimen>
<dimen name="pie_chevron_start">230dp</dimen>
<dimen name="pie_chevron_increment">2dp</dimen>
<dimen name="pie_battery_start">155dp</dimen>
<dimen name="pie_battery_increment">10dp</dimen>
<dimen name="pie_status_start">155dp</dimen>
<dimen name="pie_clock_size">54dp</dimen>
<dimen name="pie_clock_offset">-20dp</dimen>
<dimen name="pie_am_pm_size">14dp</dimen>
<dimen name="pie_am_pm_offset">-52dp</dimen>
<dimen name="pie_status_size">12dp</dimen>
<dimen name="pie_status_offset">-14dp</dimen>
<dimen name="pie_snap_radius">50dp</dimen>
<dimen name="pie_snap_thickness">6dp</dimen>
<dimen name="pie_touch_offset">15dp</dimen>
<dimen name="pie_tab_title_height">24dp</dimen>
<dimen name="pie_item_size">40dp</dimen>
<dimen name="pie_panel_padding">20dp</dimen>
</resources>
11 changes: 11 additions & 0 deletions packages/SystemUI/res/values/pa_strings.xml
Expand Up @@ -75,11 +75,22 @@
<string name="quick_settings_ringer_mode_normal_vibrate_label">Sound &amp; Vibration</string>
<string name="quick_settings_volume_label">Volume</string>

<!-- On-the-spot preferences -->

<!-- Quick pulldown confirmation dialog -->
<string name="quick_settings_quick_pull_down_title">Quick pull down</string>
<string name="quick_settings_quick_pull_down_message">Would you like the edge of the status bar to pull down quick settings?</string>

<!-- Pie controls -->
<string name="pie_date_format">ccc, dd MMM yyyy</string>
<string name="pie_hour_format_12">hh:mm</string>
<string name="pie_hour_format_24">HH:mm</string>
<string name="pie_am_pm">a</string>
<string name="enable_pie_control_title">Pie controls</string>
<string name="enable_pie_control_message">Would you like to use pie controls while in immersive mode?</string>

<!-- Names to be shown on settings, they must match with Settings.SETTINGS_TO_RESET array -->
<string name="quick_settings_quick_pull_down">@string/quick_settings_quick_pull_down_title</string>
<string name="safe_headset_volume">@*android:string/safe_headset_warning_title</string>
<string name="pie_state">@string/enable_pie_control_title</string>
</resources>
Expand Up @@ -35,6 +35,7 @@
import com.android.systemui.statusbar.StatusBarPanel;
import com.android.systemui.statusbar.phone.NavigationBarView;

import java.util.ArrayList;
import java.util.List;

public class RecentsActivity extends Activity {
Expand All @@ -48,8 +49,7 @@ public class RecentsActivity extends Activity {
public static final String WAITING_FOR_WINDOW_ANIMATION_PARAM = "com.android.systemui.recent.WAITING_FOR_WINDOW_ANIMATION";
private static final String WAS_SHOWING = "was_showing";

private static NavigationCallback mNavigationCallback;
private static NavigationBarView mNavigationBarView;
private static List<NavigationCallback> mNavigationCallbacks;
private static RecentsPanelView mRecentsPanel;
private static boolean mShowing;
private IntentFilter mIntentFilter;
Expand Down Expand Up @@ -125,12 +125,14 @@ public static boolean forceOpaqueBackground(Context context) {
}

public void setRecentHints(boolean show) {
// Check if we need to enable alternate drawable for recent apps key
if(mNavigationCallback == null) return; // Multiuser is not allowed
int navigationHints = mNavigationCallback.getNavigationIconHints();
mNavigationCallback.setNavigationIconHints(NavigationBarView.NAVBAR_RECENTS_HINT,
show ? (navigationHints | StatusBarManager.NAVIGATION_HINT_RECENT_ALT)
: (navigationHints & ~StatusBarManager.NAVIGATION_HINT_RECENT_ALT), true);
for(NavigationCallback callback : mNavigationCallbacks) {
// Check if we need to enable alternate drawable for recent apps key
if(callback == null) return; // Multiuser is not allowed
int navigationHints = callback.getNavigationIconHints();
callback.setNavigationIconHints(NavigationBarView.NAVBAR_RECENTS_HINT,
show ? (navigationHints | StatusBarManager.NAVIGATION_HINT_RECENT_ALT)
: (navigationHints & ~StatusBarManager.NAVIGATION_HINT_RECENT_ALT), true);
}
}

@Override
Expand All @@ -142,7 +144,6 @@ public void onStart() {
updateWallpaperVisibility(true);
}
mShowing = true;
setRecentHints(true);
if (mRecentsPanel != null) {
// Call and refresh the recent tasks list in case we didn't preload tasks
// or in case we don't get an onNewIntent
Expand Down Expand Up @@ -265,12 +266,10 @@ boolean isForeground() {
return mForeground;
}

public static void setNavigationBarView(NavigationBarView nav) {
mNavigationBarView = nav;
}

public static void setNavigationCallback(NavigationCallback callback) {
mNavigationCallback = callback;
public static void addNavigationCallback(NavigationCallback callback) {
if(mNavigationCallbacks == null)
mNavigationCallbacks= new ArrayList<NavigationCallback>();
mNavigationCallbacks.add(callback);
}

public static int getTasks() {
Expand Down

0 comments on commit 4a50429

Please sign in to comment.