Permalink
Browse files

update patches

  • Loading branch information...
1 parent c997028 commit 3e269a9ffec5bfb9ae7c4e2cd0bbe956cac5e6b7 @KonstaT committed Jan 1, 2013
@@ -0,0 +1,51 @@
+From 3bbeb67deef5e1a0d7732b8fd4725dac1e62d7f5 Mon Sep 17 00:00:00 2001
+From: Konsta <konsta09@gmail.com>
+Date: Tue, 18 Dec 2012 14:43:15 +0200
+Subject: [PATCH 1/7] add option to display navbar (1/2)
+
+Change-Id: Id0b09d22bfec899cd706e65d73feb7d907c0c101
+---
+ core/java/android/provider/Settings.java | 6 ++++++
+ .../internal/policy/impl/PhoneWindowManager.java | 9 +++++++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
+index a11eb1f..85b0a5d 100644
+--- a/core/java/android/provider/Settings.java
++++ b/core/java/android/provider/Settings.java
+@@ -3039,6 +3039,12 @@ public final class Settings {
+ public static final String UI_FORCE_OVERFLOW_BUTTON = "ui_force_overflow_button";
+
+ /**
++ * Option to display navigation bar
++ * @hide
++ */
++ public static final String KONSTA_NAVBAR = "konsta_navbar";
++
++ /**
+ * Volume keys control cursor in text fields (default is 0)
+ * 0 - Disabled
+ * 1 - Volume up/down moves cursor left/right
+diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+index 4af592d..1f2fe2c 100755
+--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
++++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+@@ -1257,8 +1257,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
+ }
+
+ if (!mHasSystemNavBar) {
+- mHasNavigationBar = mContext.getResources().getBoolean(
+- com.android.internal.R.bool.config_showNavigationBar);
++ if (mContext.getResources().getBoolean(
++ com.android.internal.R.bool.config_showNavigationBar)) {
++ mHasNavigationBar = true;
++ } else {
++ mHasNavigationBar = (Settings.System.getInt(mContext.getContentResolver(),
++ Settings.System.KONSTA_NAVBAR, 0) == 1);
++ }
+ // Allow a system property to override this. Used by the emulator.
+ // See also hasNavigationBar().
+ String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
+--
+1.7.9.5
+
@@ -0,0 +1,274 @@
+From af603f6b546568b8ee972101f0dee82e9280c78b Mon Sep 17 00:00:00 2001
+From: Konsta <konsta09@gmail.com>
+Date: Tue, 18 Dec 2012 14:48:22 +0200
+Subject: [PATCH 2/7] add battery bar (thanks to spitemare) (1/2)
+
+Change-Id: I6a3f3028946829e4117a519c827bdd6d88912e1d
+---
+ core/java/android/provider/Settings.java | 1 +
+ packages/SystemUI/res/drawable/battery_bar.xml | 29 ++++
+ packages/SystemUI/res/layout/status_bar.xml | 5 +
+ packages/SystemUI/res/values/styles.xml | 6 +
+ .../systemui/statusbar/phone/BatteryBar.java | 173 ++++++++++++++++++++
+ 5 files changed, 214 insertions(+)
+ create mode 100644 packages/SystemUI/res/drawable/battery_bar.xml
+ create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/phone/BatteryBar.java
+
+diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
+index 85b0a5d..5f171bc 100644
+--- a/core/java/android/provider/Settings.java
++++ b/core/java/android/provider/Settings.java
+@@ -2727,6 +2727,7 @@ public final class Settings {
+ * 2: Display cm circle battery implementation without percentage
+ * 3: Display cm circle battery implementation with percentage
+ * 4: Hide the battery information
++ * 5: Show MIUI-style battery bar on the status bar
+ * default: 0
+ * @hide
+ */
+diff --git a/packages/SystemUI/res/drawable/battery_bar.xml b/packages/SystemUI/res/drawable/battery_bar.xml
+new file mode 100644
+index 0000000..a1243df
+--- /dev/null
++++ b/packages/SystemUI/res/drawable/battery_bar.xml
+@@ -0,0 +1,29 @@
++<?xml version="1.0" encoding="utf-8"?>
++<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
++
++ <item android:id="@android:id/background"
++ android:drawable="@android:color/transparent" />
++
++ <item android:id="@android:id/secondaryProgress"
++ android:drawable="@android:color/transparent" />
++
++ <item android:id="@android:id/progress">
++ <clip>
++ <level-list xmlns:android="http://schemas.android.com/apk/res/android">
++ <item android:maxLevel="1500">
++ <shape>
++ <corners android:radius="5dip" />
++ <solid android:color="@android:color/holo_red_dark" />
++ </shape>
++ </item>
++ <item android:maxLevel="10000">
++ <shape>
++ <corners android:radius="5dip" />
++ <solid android:color="@android:color/holo_blue_light" />
++ </shape>
++ </item>
++ </level-list>
++ </clip>
++ </item>
++
++</layer-list>
+diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
+index 2a4af96..b336ff8 100644
+--- a/packages/SystemUI/res/layout/status_bar.xml
++++ b/packages/SystemUI/res/layout/status_bar.xml
+@@ -183,4 +183,9 @@
+ />
+ </com.android.systemui.statusbar.phone.TickerView>
+ </LinearLayout>
++
++ <com.android.systemui.statusbar.phone.BatteryBar
++ style="@style/StatusBar.BatteryBar"
++ android:layout_width="match_parent"
++ android:layout_height="1dip" />
+ </com.android.systemui.statusbar.phone.PhoneStatusBarView>
+diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
+index cd108b1..9276c2d 100644
+--- a/packages/SystemUI/res/values/styles.xml
++++ b/packages/SystemUI/res/values/styles.xml
+@@ -198,4 +198,10 @@
+ <item name="android:lineSpacingMultiplier">1.1</item>
+ </style>
+
++ <style name="StatusBar.BatteryBar"
++ parent="@android:style/Widget.ProgressBar.Horizontal">
++ <item name="android:progressDrawable">@drawable/battery_bar</item>
++ <item name="android:minHeight">1dip</item>
++ <item name="android:maxHeight">1dip</item>
++ </style>
+ </resources>
+diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BatteryBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BatteryBar.java
+new file mode 100644
+index 0000000..082a0a0
+--- /dev/null
++++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BatteryBar.java
+@@ -0,0 +1,173 @@
++package com.android.systemui.statusbar.phone;
++
++import android.content.BroadcastReceiver;
++import android.content.ContentResolver;
++import android.content.Context;
++import android.content.Intent;
++import android.content.IntentFilter;
++import android.database.ContentObserver;
++import android.graphics.drawable.Animatable;
++import android.os.BatteryManager;
++import android.os.Handler;
++import android.provider.Settings;
++import android.util.AttributeSet;
++import android.widget.ProgressBar;
++
++public class BatteryBar extends ProgressBar implements Animatable, Runnable {
++
++ private static final String TAG = BatteryBar.class.getSimpleName();
++
++ // Total animation duration
++ private static final int ANIM_DURATION = 10000; // 10 seconds
++
++ // Duration between frames of charging animation
++ private static final int FRAME_DURATION = ANIM_DURATION / 100;
++
++ // Are we listening for actions?
++ private boolean mAttached = false;
++
++ // Should we show this?
++ private boolean mShowBatteryBar = false;
++
++ // Current battery level
++ private int mBatteryLevel = 0;
++
++ // Current "step" of charging animation
++ private int mChargingLevel = -1;
++
++ // Are we charging?
++ private boolean mBatteryCharging = false;
++
++ private Handler mHandler = new Handler();
++
++ class SettingsObserver extends ContentObserver {
++
++ public SettingsObserver(Handler handler) {
++ super(handler);
++ }
++
++ void observer() {
++ ContentResolver resolver = mContext.getContentResolver();
++ resolver.registerContentObserver(
++ Settings.System.getUriFor(Settings.System.STATUS_BAR_BATTERY), false, this);
++ }
++
++ @Override
++ public void onChange(boolean selfChange) {
++ updateSettings();
++ }
++ }
++
++ public BatteryBar(Context context) {
++ this(context, null);
++ }
++
++ public BatteryBar(Context context, AttributeSet attrs) {
++ this(context, attrs, 0);
++ }
++
++ public BatteryBar(Context context, AttributeSet attrs, int defStyle) {
++ super(context, attrs, defStyle);
++
++ SettingsObserver observer = new SettingsObserver(mHandler);
++ observer.observer();
++ updateSettings();
++ }
++
++ @Override
++ protected void onAttachedToWindow() {
++ super.onAttachedToWindow();
++
++ if (!mAttached) {
++ mAttached = true;
++ IntentFilter filter = new IntentFilter();
++ filter.addAction(Intent.ACTION_BATTERY_CHANGED);
++ filter.addAction(Intent.ACTION_SCREEN_OFF);
++ filter.addAction(Intent.ACTION_SCREEN_ON);
++ getContext().registerReceiver(mIntentReceiver, filter, null, getHandler());
++ }
++ }
++
++ @Override
++ protected void onDetachedFromWindow() {
++ super.onDetachedFromWindow();
++
++ if (mAttached) {
++ mAttached = false;
++ getContext().unregisterReceiver(mIntentReceiver);
++ }
++ }
++
++ private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
++ @Override
++ public void onReceive(Context context, Intent intent) {
++ String action = intent.getAction();
++ if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
++ mBatteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
++ mBatteryCharging = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0) == BatteryManager.BATTERY_STATUS_CHARGING;
++ if (mBatteryCharging && mBatteryLevel < 100) {
++ start();
++ } else {
++ stop();
++ }
++ } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
++ stop();
++ } else if (Intent.ACTION_SCREEN_ON.equals(action)) {
++ if (mBatteryCharging && mBatteryLevel < 100) {
++ start();
++ }
++ }
++ }
++ };
++
++ private void updateSettings() {
++ ContentResolver resolver = mContext.getContentResolver();
++ mShowBatteryBar = (Settings.System.getInt(resolver,
++ Settings.System.STATUS_BAR_BATTERY, 0) == 5);
++ if (mShowBatteryBar) {
++ setVisibility(VISIBLE);
++ } else {
++ setVisibility(GONE);
++ }
++
++ if (mBatteryCharging && mBatteryLevel < 100) {
++ start();
++ } else {
++ stop();
++ }
++ }
++
++ @Override
++ public void run() {
++ mChargingLevel++;
++ if (mChargingLevel > 100) {
++ mChargingLevel = mBatteryLevel;
++ }
++ setProgress(mChargingLevel);
++ mHandler.postDelayed(this, FRAME_DURATION);
++ }
++
++ @Override
++ public void start() {
++ if (!isRunning()) {
++ mHandler.removeCallbacks(this);
++ mChargingLevel = mBatteryLevel;
++ mHandler.postDelayed(this, FRAME_DURATION);
++ }
++ }
++
++ @Override
++ public void stop() {
++ if (isRunning()) {
++ mHandler.removeCallbacks(this);
++ mChargingLevel = -1;
++ }
++ setProgress(mBatteryLevel);
++ }
++
++ @Override
++ public boolean isRunning() {
++ return mChargingLevel != -1;
++ }
++
++}
+--
+1.7.9.5
+
@@ -0,0 +1,35 @@
+From cd2df267128aa48b772d05a05f3a1b0f8a993a8d Mon Sep 17 00:00:00 2001
+From: Konsta <konsta09@gmail.com>
+Date: Tue, 18 Dec 2012 14:50:54 +0200
+Subject: [PATCH 3/7] silence low battery sound & fix typo
+
+Change-Id: I446f6c431494e26719a6260156a384d5ce112cb1
+---
+ data/sounds/OldAudio.mk | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/data/sounds/OldAudio.mk b/data/sounds/OldAudio.mk
+index adced91..44b7697 100644
+--- a/data/sounds/OldAudio.mk
++++ b/data/sounds/OldAudio.mk
+@@ -24,7 +24,7 @@ PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/effects/old/KeypressSpacebar.ogg:system/media/audio/ui/KeypressSpacebar.ogg \
+ $(LOCAL_PATH)/effects/old/KeypressStandard.ogg:system/media/audio/ui/KeypressStandard.ogg \
+ $(LOCAL_PATH)/effects/old/Lock.ogg:system/media/audio/ui/Lock.ogg \
+- $(LOCAL_PATH)/effects/old/LowBattery.ogg:system/media/audio/ui/LowBattery.ogg \
++ $(LOCAL_PATH)/effects/old/LowBattery.ogg:system/media/audio/ui/LowBattery.old \
+ $(LOCAL_PATH)/effects/old/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
+ $(LOCAL_PATH)/effects/old/Undock.ogg:system/media/audio/ui/Undock.ogg \
+ $(LOCAL_PATH)/effects/old/Unlock.ogg:system/media/audio/ui/Unlock.ogg \
+@@ -40,7 +40,7 @@ PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/notifications/old/F1_MissedCall.ogg:system/media/audio/notifications/F1_MissedCall.ogg \
+ $(LOCAL_PATH)/notifications/old/F1_New_MMS.ogg:system/media/audio/notifications/F1_New_MMS.ogg \
+ $(LOCAL_PATH)/notifications/old/F1_New_SMS.ogg:system/media/audio/notifications/F1_New_SMS.ogg \
+- $(LOCAL_PATH)/notifications/old/F1_NewVoicemail.ogg:system/media/audio/notifications/F1_NewVoicemail \
++ $(LOCAL_PATH)/notifications/old/F1_NewVoicemail.ogg:system/media/audio/notifications/F1_NewVoicemail.ogg \
+ $(LOCAL_PATH)/notifications/old/Heaven.ogg:system/media/audio/notifications/Heaven.ogg \
+ $(LOCAL_PATH)/notifications/old/IM_Me.ogg:system/media/audio/notifications/IM_Me.ogg \
+ $(LOCAL_PATH)/notifications/old/Moonbeam.ogg:system/media/audio/notifications/Moonbeam.ogg \
+--
+1.7.9.5
+
@@ -0,0 +1,25 @@
+From 27f7570dbc94f9aec6ed93a810c8fe63d2e94f60 Mon Sep 17 00:00:00 2001
+From: Konsta <konsta09@gmail.com>
+Date: Tue, 18 Dec 2012 16:35:48 +0200
+Subject: [PATCH 4/7] back icon doesnt scale when changing navbar height
+
+Change-Id: I722f947838c72123af966d44c49c2ea9c069a715
+---
+ packages/SystemUI/res/layout/navigation_bar.xml | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
+index 440a4e1..de4c220 100644
+--- a/packages/SystemUI/res/layout/navigation_bar.xml
++++ b/packages/SystemUI/res/layout/navigation_bar.xml
+@@ -54,7 +54,6 @@
+ android:src="@drawable/ic_sysbar_back"
+ systemui:keyCode="4"
+ android:layout_weight="0"
+- android:scaleType="center"
+ systemui:glowBackground="@drawable/ic_sysbar_highlight"
+ android:contentDescription="@string/accessibility_back"
+ />
+--
+1.7.9.5
+
Oops, something went wrong.

0 comments on commit 3e269a9

Please sign in to comment.