Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40d3e503 authored by Madison Koenig's avatar Madison Koenig Committed by Steve Kondik
Browse files

Notification Power Widget

Ported over from CM 7.1 into CM9

Rewrite by cvpcs
Requires configuration settings from CMParts. Will be done when settings app available.

Disabled WiMax button until WiMax support is added back in.

ToDo: Change default color to Cyan to match ICS default color Scheme.
      Make indicator bar smaller?

Requires:
      http://review.cyanogenmod.com/#change,10578    - Light Sensor Information.

Also requires CMSettings for Configuration:
      https://github.com/Pedlar/android_packages_apps_CMSettings

Change-Id: I657f459969c784164730e6b0660db40822d8c491
parent 164fcfb8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -15363,6 +15363,12 @@ package android.preference {
    method public void setValueIndex(int);
  }
  public class ListPreferenceMultiSelect extends android.preference.ListPreference {
    ctor public ListPreferenceMultiSelect(android.content.Context);
    ctor public ListPreferenceMultiSelect(android.content.Context, android.util.AttributeSet);
    method public static java.lang.String[] parseStoredValue(java.lang.CharSequence);
  }
  public class MultiSelectListPreference extends android.preference.DialogPreference {
    ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet);
    ctor public MultiSelectListPreference(android.content.Context);
+5 −0
Original line number Diff line number Diff line
@@ -184,6 +184,11 @@ public abstract class ContentResolver {
        mContext = context;
    }

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

    /** @hide */
    protected abstract IContentProvider acquireProvider(Context c, String name);
    /** Providing a default implementation of this, to avoid having to change
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ public final class ContentService extends IContentService.Stub {
                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);
                    }
+31 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.graphics.Movie;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.PorterDuff.Mode;
import android.os.Build;
import android.os.Bundle;
import android.util.AttributeSet;
@@ -709,6 +710,36 @@ public class Resources {
        }
    }

     /**
     * Return a drawable object associated with a particular resource ID.
     * 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
     * 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
     */
    public Drawable getDrawable(int id, int mask, Mode maskType) throws NotFoundException {
        synchronized (mTmpValue) {
            TypedValue value = mTmpValue;
            getValue(id, value, true);
            Drawable tmpDrawable = loadDrawable(value, id);
            tmpDrawable.setColorFilter(mask, maskType);
            return tmpDrawable;
        }
    }

    /**
     * Return a movie object associated with the particular resource ID.
     * @param id The desired resource identifier, as generated by the aapt
+35 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.database;

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

/**
@@ -34,15 +35,26 @@ 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() { 
            if (mUri != null) {
                ContentObserver.this.onChangeUri(mUri, mSelf);
            } else {
                ContentObserver.this.onChange(mSelf);
            }
        }
    }

    private static final class Transport extends IContentObserver.Stub {
        ContentObserver mContentObserver;
@@ -59,6 +71,13 @@ public abstract class ContentObserver {
            return false;
        }

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

        public void onChange(boolean selfChange) {
            ContentObserver contentObserver = mContentObserver;
            if (contentObserver != null) {
@@ -128,6 +147,9 @@ public abstract class ContentObserver {
     */
    public void onChange(boolean selfChange) {}

    /** @hide */
    public void onChangeUri(Uri uri, boolean selfChange) {}

    public final void dispatchChange(boolean selfChange) {
        if (mHandler == null) {
            onChange(selfChange);
@@ -135,4 +157,15 @@ public abstract class ContentObserver {
            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));
        }
    }

}
Loading