Skip to content

Commit

Permalink
Galaxy S Style Power Widget
Browse files Browse the repository at this point in the history
- Finally Ready - Review at will
- This Depends on the following:
    CMParts: http://review.cyanogenmod.com/2063
  • Loading branch information
Pedlar authored and hyperb1iss committed Oct 17, 2010
1 parent c5efffd commit eb0e397
Show file tree
Hide file tree
Showing 108 changed files with 2,638 additions and 73 deletions.
2 changes: 1 addition & 1 deletion api/current.xml
Expand Up @@ -74892,7 +74892,7 @@
type="float"
transient="false"
volatile="false"
value="0.0010f"
value="0.001f"
static="true"
final="true"
deprecated="not deprecated"
Expand Down
5 changes: 5 additions & 0 deletions core/java/android/content/ContentResolver.java
Expand Up @@ -173,6 +173,11 @@ public ContentResolver(Context context) {
mContext = context;
}

/** @hide */
public final Context getContext() {
return mContext;
}

/** @hide */
protected abstract IContentProvider acquireProvider(Context c, String name);
/** @hide */
Expand Down
1 change: 1 addition & 0 deletions core/java/android/content/ContentService.java
Expand Up @@ -139,6 +139,7 @@ public void notifyChange(Uri uri, IContentObserver observer,
ObserverCall oc = calls.get(i);
try {
oc.mObserver.onChange(oc.mSelfNotify);
oc.mObserver.onChangeUri(uri, oc.mSelfNotify);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Notified " + oc.mObserver + " of " + "update at " + uri);
}
Expand Down
14 changes: 7 additions & 7 deletions core/java/android/content/res/Resources.java
Expand Up @@ -595,22 +595,22 @@ public Drawable getDrawable(int id) throws NotFoundException {
* Various types of objects will be returned depending on the underlying
* resource -- for example, a solid color, PNG image, scalable image, etc.
* The Drawable API hides these implementation details.
*
*
* mtwebster:
* This version also applies a Porter Duff color mask onto the object before
* This version also applies a Porter Duff color mask onto the object before
* returning the object. Put in Resources to give reusability, I plan on
* applying this to other parts of the gui
*
*
* @param id The desired resource identifier, as generated by the aapt
* tool. This integer encodes the package, type, and resource
* entry. The value 0 is an invalid identifier.
*
* @param mask The color mask to use (alpha-r-g-b)
*
*
* @param masktype The Porter Duff filter mode
*
*
* @throws NotFoundException Throws NotFoundException if the given ID does not exist.
*
*
* @return Drawable An object that can be used to draw this resource.
* @hide
*/
Expand All @@ -623,7 +623,7 @@ public Drawable getDrawable(int id, int mask, Mode maskType) throws NotFoundExce
return tmpDrawable;
}
}

/**
* Return a movie object associated with the particular resource ID.
* @param id The desired resource identifier, as generated by the aapt
Expand Down
32 changes: 31 additions & 1 deletion core/java/android/database/ContentObserver.java
Expand Up @@ -17,6 +17,7 @@
package android.database;

import android.os.Handler;
import android.net.Uri;

/**
* Receives call backs for changes to content. Must be implemented by objects which are added
Expand All @@ -34,13 +35,23 @@ public abstract class ContentObserver {
private final class NotificationRunnable implements Runnable {

private boolean mSelf;
private Uri mUri = null;

public NotificationRunnable(boolean self) {
mSelf = self;
}

public NotificationRunnable(Uri uri, boolean self) {
mSelf = self;
mUri = uri;
}

public void run() {
ContentObserver.this.onChange(mSelf);
if(mUri != null) {
ContentObserver.this.onChangeUri(mUri, mSelf);
} else {
ContentObserver.this.onChange(mSelf);
}
}
}

Expand All @@ -66,6 +77,13 @@ public void onChange(boolean selfChange) {
}
}

public void onChangeUri(Uri uri, boolean selfChange) {
ContentObserver contentObserver = mContentObserver;
if (contentObserver != null) {
contentObserver.dispatchChange(uri, selfChange);
}
}

public void releaseContentObserver() {
mContentObserver = null;
}
Expand Down Expand Up @@ -127,6 +145,8 @@ public boolean deliverSelfNotifications() {
* cursor that is being observed.
*/
public void onChange(boolean selfChange) {}
/** @hide */
public void onChangeUri(Uri uri, boolean selfChange) {}

public final void dispatchChange(boolean selfChange) {
if (mHandler == null) {
Expand All @@ -135,4 +155,14 @@ public final void dispatchChange(boolean selfChange) {
mHandler.post(new NotificationRunnable(selfChange));
}
}
/** @hide */
public final void dispatchChange(Uri uri, boolean selfChange) {
if (mHandler == null) {
onChangeUri(uri, selfChange);
} else {
mHandler.post(new NotificationRunnable(uri, selfChange));
}
}


}
3 changes: 3 additions & 0 deletions core/java/android/database/IContentObserver.aidl
Expand Up @@ -17,6 +17,8 @@

package android.database;

import android.net.Uri;

/**
* @hide
*/
Expand All @@ -28,4 +30,5 @@ interface IContentObserver
* commit on the cursor that is being observed.
*/
oneway void onChange(boolean selfUpdate);
oneway void onChangeUri(in Uri uri, boolean selfUpdate);
}
56 changes: 52 additions & 4 deletions core/java/android/provider/Settings.java
Expand Up @@ -27,6 +27,7 @@
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.IContentProvider;
import android.content.Intent;
import android.content.pm.ActivityInfo;
Expand Down Expand Up @@ -57,8 +58,14 @@
* The Settings provider contains global system-level device preferences.
*/
public final class Settings {
/** Intent actions for Settings
* @hide
*/
public static final String SETTINGS_CHANGED = "android.settings.SETTINGS_CHANGED_ACTION";

// Intent actions for Settings
public Settings() {
/* Empty for API conflicts */
}

/**
* Activity Action: Show system settings.
Expand Down Expand Up @@ -2150,13 +2157,13 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
* Trackball Notification Colors. The value is String pkg=color|pkg=color
* @hide
*/
public static final String NOTIFICATION_PACKAGE_COLORS = "|";
public static final String NOTIFICATION_PACKAGE_COLORS = "pref_package_colors";

/**
* Trackball Notification List. The value is String pkg|pkg
* @hide
*/
public static final String NOTIFICATION_PACKAGE_LIST = "|";
public static final String NOTIFICATION_PACKAGE_LIST = "pref_package_list";

/**
* Trackball Notification Colors Debugging. The value is boolean (1 or 0)
Expand Down Expand Up @@ -2213,6 +2220,36 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
*/
public static final String NOTIF_EXPANDED_BAR_CUSTOM = "notif_expanded_bar_custom";

/**
* Use the Notification Power Widget? (Who wouldn't!)
* @hide
*/
public static final String EXPANDED_VIEW_WIDGET = "expanded_view_widget";

/**
* Notification Indicator Color
* @hide
*/
public static final String EXPANDED_VIEW_WIDGET_COLOR = "expanded_widget_color";

/**
* Widget Buttons to Use
* @hide
*/
public static final String WIDGET_BUTTONS = "expanded_widget_buttons";

/** @hide */
public static final String EXPANDED_BRIGHTNESS_MODE = "expanded_brightness_mode";

/** @hide */
public static final String EXPANDED_NETWORK_MODE = "expanded_network_mode";

/** @hide */
public static final String EXPANDED_SCREENTIMEOUT_MODE = "expanded_screentimeout_mode";

/** @hide */
public static final String EXPANDED_RING_MODE = "expanded_ring_mode";

/**
* Whether to keep the home app at a higher OOM adjustement
* @hide
Expand Down Expand Up @@ -4104,12 +4141,13 @@ public static final boolean isLocationProviderEnabled(ContentResolver cr, String

/**
* Thread-safe method for enabling or disabling a single location provider.
* @param cr the content resolver to use
* @param cr the content resolver from the calling application
* @param provider the location provider to enable or disable
* @param enabled true if the provider should be enabled
*/
public static final void setLocationProviderEnabled(ContentResolver cr,
String provider, boolean enabled) {
Context context = cr.getContext();
// to ensure thread safety, we write the provider name with a '+' or '-'
// and let the SettingsProvider handle it rather than reading and modifying
// the list of enabled providers.
Expand All @@ -4119,6 +4157,16 @@ public static final void setLocationProviderEnabled(ContentResolver cr,
provider = "-" + provider;
}
putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
try {
Intent i = new Intent();
i.setAction(Settings.SETTINGS_CHANGED);
i.putExtra("SETTING", "GPS");
i.putExtra("GPS_STATUS_CHANGE", enabled);
context.sendBroadcast(i);
} catch(Exception e) {
//This is ignored, as this try-catch is just incase this is called
//Before the system is read.
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions core/java/android/view/KeyEvent.java
Expand Up @@ -129,10 +129,16 @@ public class KeyEvent implements Parcelable {
public static final int KEYCODE_FUNC_7 = 98;
public static final int KEYCODE_FUNC_8 = 99;
public static final int KEYCODE_QUECHAR = 100;

/** @hide */
public static final int KEYCODE_USER1 = 101;
/** @hide */
public static final int KEYCODE_USER2 = 102;
/** @hide */
public static final int KEYCODE_USER3 = 103;
/** @hide */
public static final int KEYCODE_USER4 = 104;
/** @hide */
public static final int KEYCODE_USER5 = 105;

// NOTE: If you add a new keycode here you must also add it to:
Expand Down
Binary file added core/res/res/drawable-hdpi/stat_2g3g_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_2g3g_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_3g_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_airplane_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_airplane_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_bgoff.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_bgon.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_bgon_custom.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_bluetooth_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_bluetooth_on.png
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.
Binary file added core/res/res/drawable-hdpi/stat_brightness_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_data_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_data_on.png
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.
Binary file added core/res/res/drawable-hdpi/stat_flashlight_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_gps_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_gps_on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_ing_off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_inner_focus.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added core/res/res/drawable-hdpi/stat_inner_press.9.png
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.
Binary file added core/res/res/drawable-hdpi/stat_ring_on.png
Binary file added core/res/res/drawable-hdpi/stat_silent.png
Binary file added core/res/res/drawable-hdpi/stat_sync_off.png
Binary file added core/res/res/drawable-hdpi/stat_sync_on.png
Binary file added core/res/res/drawable-hdpi/stat_vibrate_off.png
Binary file added core/res/res/drawable-hdpi/stat_vibrate_on.png
Binary file added core/res/res/drawable-hdpi/stat_wifi_ap_off.png
Binary file added core/res/res/drawable-hdpi/stat_wifi_ap_on.png
Binary file added core/res/res/drawable-hdpi/stat_wifi_off.png
Binary file added core/res/res/drawable-hdpi/stat_wifi_on.png
Binary file added core/res/res/drawable-mdpi/stat_2g3g_off.png
Binary file added core/res/res/drawable-mdpi/stat_2g3g_on.png
Binary file added core/res/res/drawable-mdpi/stat_3g_on.png
Binary file added core/res/res/drawable-mdpi/stat_airplane_off.png
Binary file added core/res/res/drawable-mdpi/stat_airplane_on.png
Binary file added core/res/res/drawable-mdpi/stat_bgoff.9.png
Binary file added core/res/res/drawable-mdpi/stat_bgon.9.png
Binary file added core/res/res/drawable-mdpi/stat_bgon_custom.9.png
Binary file added core/res/res/drawable-mdpi/stat_bluetooth_off.png
Binary file added core/res/res/drawable-mdpi/stat_bluetooth_on.png
Binary file added core/res/res/drawable-mdpi/stat_brightness_on.png
Binary file added core/res/res/drawable-mdpi/stat_data_off.png
Binary file added core/res/res/drawable-mdpi/stat_data_on.png
Binary file added core/res/res/drawable-mdpi/stat_flashlight_on.png
Binary file added core/res/res/drawable-mdpi/stat_gps_off.png
Binary file added core/res/res/drawable-mdpi/stat_gps_on.png
Binary file added core/res/res/drawable-mdpi/stat_inner_focus.9.png
Binary file added core/res/res/drawable-mdpi/stat_inner_press.9.png
Binary file added core/res/res/drawable-mdpi/stat_ock_screen_on.png
Binary file added core/res/res/drawable-mdpi/stat_power_bg.9.png
Binary file added core/res/res/drawable-mdpi/stat_ring_off.png
Binary file added core/res/res/drawable-mdpi/stat_ring_on.png
Binary file added core/res/res/drawable-mdpi/stat_silent.png
Binary file added core/res/res/drawable-mdpi/stat_sync_off.png
Binary file added core/res/res/drawable-mdpi/stat_sync_on.png
Binary file added core/res/res/drawable-mdpi/stat_vibrate_off.png
Binary file added core/res/res/drawable-mdpi/stat_vibrate_on.png
Binary file added core/res/res/drawable-mdpi/stat_wifi_ap_off.png
Binary file added core/res/res/drawable-mdpi/stat_wifi_ap_on.png
Binary file added core/res/res/drawable-mdpi/stat_wifi_off.png
Binary file added core/res/res/drawable-mdpi/stat_wifi_on.png
28 changes: 28 additions & 0 deletions core/res/res/drawable/stat_power_bg.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true"
android:drawable="@drawable/stat_inner_press" />

<item android:state_focused="true" android:state_enabled="true"
android:state_window_focused="true"
android:drawable="@drawable/stat_inner_focus" />

<item
android:drawable="@drawable/stat_power_background" />
</selector>

0 comments on commit eb0e397

Please sign in to comment.