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

Commit 0794fc40 authored by Danny Baumann's avatar Danny Baumann
Browse files

Applying theming to more framework items.

All dialogs and notifications should be covered now.

Change-Id: If93f81991361165a00b5b1b03ffc323e3ab42c0b
parent ba3aebab
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content;

import com.android.internal.R;
import com.android.internal.app.ThemeUtils;
import com.android.internal.util.ArrayUtils;

import android.accounts.Account;
@@ -131,6 +132,7 @@ public class SyncManager implements OnAccountsUpdateListener {
    private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarm";

    private Context mContext;
    private Context mUiContext;

    private volatile Account[] mAccounts = INITIAL_ACCOUNTS_ARRAY;

@@ -185,6 +187,12 @@ public class SyncManager implements OnAccountsUpdateListener {
        }
    };

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
        }
    };

    private BroadcastReceiver mBackgroundDataSettingChanged = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            if (getConnectivityManager().getBackgroundDataSetting()) {
@@ -356,6 +364,8 @@ public class SyncManager implements OnAccountsUpdateListener {
        intentFilter.setPriority(100);
        context.registerReceiver(mShutdownIntentReceiver, intentFilter);

        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);

        if (!factoryTest) {
            mNotificationMgr = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);
@@ -868,6 +878,13 @@ public class SyncManager implements OnAccountsUpdateListener {
        }
    }

    private Context getUiContext() {
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
        }
        return mUiContext != null ? mUiContext : mContext;
    }

    /**
     * @hide
     */
@@ -2057,7 +2074,7 @@ public class SyncManager implements OnAccountsUpdateListener {
                new Notification(R.drawable.stat_notify_sync_error,
                        mContext.getString(R.string.contentServiceSync),
                        System.currentTimeMillis());
            notification.setLatestEventInfo(mContext,
            notification.setLatestEventInfo(getUiContext(),
                    mContext.getString(R.string.contentServiceSyncNotificationTitle),
                    String.format(tooManyDeletesDescFormat.toString(), authorityName),
                    pendingIntent);
+10 −9
Original line number Diff line number Diff line
@@ -81,6 +81,14 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
    private Context mUiContext;
    private ProgressDialog mCheckingDialog;

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
            mCheckingDialog = null;
        }
    };

    /**
     * AccountUnlockScreen constructor.
     * @param configuration
@@ -93,14 +101,6 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mCallback = callback;
        mLockPatternUtils = lockPatternUtils;

        ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                mUiContext = null;
                mCheckingDialog = null;
            }
        });

        LayoutInflater.from(context).inflate(
                R.layout.keyguard_screen_glogin_unlock, this, true);

@@ -153,7 +153,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree

    /** {@inheritDoc} */
    public void onPause() {

        mContext.unregisterReceiver(mThemeChangeReceiver);
    }

    /** {@inheritDoc} */
@@ -163,6 +163,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mPassword.setText("");
        mLogin.requestFocus();
        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    /** {@inheritDoc} */
+27 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.policy.impl;

import com.android.internal.R;
import com.android.internal.app.ThemeUtils;
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;

@@ -28,6 +29,7 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@@ -79,6 +81,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
    private View mLockScreen;
    private View mUnlockScreen;

    private Context mUiContext;

    private boolean mScreenOn = false;
    private boolean mEnableFallback = false; // assume no fallback UI until we know better

@@ -187,6 +191,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        }
    };

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
        }
    };

    /**
     * @return Whether we are stuck on the lock screen because the sim is
     *   missing.
@@ -541,9 +551,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        updateScreen(mMode);
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    @Override
    protected void onDetachedFromWindow() {
        removeCallbacks(mRecreateRunnable);
        mContext.unregisterReceiver(mThemeChangeReceiver);
        mUiContext = null;
        super.onDetachedFromWindow();
    }

@@ -836,7 +854,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
                timeoutInSeconds);
        }

        final AlertDialog dialog = new AlertDialog.Builder(mContext)
        final AlertDialog dialog = new AlertDialog.Builder(getUiContext())
                .setTitle(null)
                .setMessage(message)
                .setNeutralButton(R.string.ok, null)
@@ -852,6 +870,13 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
        dialog.show();
    }

    private Context getUiContext() {
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
        }
        return mUiContext != null ? mUiContext : mContext;
    }

    private void showAlmostAtAccountLoginDialog() {
        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
        String message;
@@ -872,7 +897,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
                timeoutInSeconds);
        }

        final AlertDialog dialog = new AlertDialog.Builder(mContext)
        final AlertDialog dialog = new AlertDialog.Builder(getUiContext())
                .setTitle(null)
                .setMessage(message)
                .setNeutralButton(R.string.ok, null)
+11 −9
Original line number Diff line number Diff line
@@ -72,6 +72,14 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie

    private static final char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    private BroadcastReceiver mThemeChangeReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
            mSimUnlockProgressDialog = null;
        }
    };

    public SimUnlockScreen(Context context, Configuration configuration,
            KeyguardUpdateMonitor updateMonitor, KeyguardScreenCallback callback,
            LockPatternUtils lockpatternutils) {
@@ -79,14 +87,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        mUpdateMonitor = updateMonitor;
        mCallback = callback;

        ThemeUtils.registerThemeChangeReceiver(context, new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                mUiContext = null;
                mSimUnlockProgressDialog = null;
            }
        });

        mCreationOrientation = configuration.orientation;
        mKeyboardHidden = configuration.hardKeyboardHidden;
        mLockPatternUtils = lockpatternutils;
@@ -127,7 +127,8 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie

    /** {@inheritDoc} */
    public void onPause() {

        mContext.unregisterReceiver(mThemeChangeReceiver);
        mUiContext = null;
    }

    /** {@inheritDoc} */
@@ -141,6 +142,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        mEnteredDigits = 0;

        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    /** {@inheritDoc} */
+20 −1
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@

package com.android.server;

import com.android.internal.app.ThemeUtils;
import com.android.server.am.ActivityManagerService;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -76,6 +79,7 @@ class DeviceStorageMonitorService extends Binder {
    private boolean mLowMemFlag=false;
    private boolean mMemFullFlag=false;
    private Context mContext;
    private Context mUiContext;
    private ContentResolver mContentResolver;
    private long mTotalMemory;  // on /data/data
    private StatFs mDataFileStats;
@@ -302,6 +306,14 @@ class DeviceStorageMonitorService extends Binder {
        mLastReportedFreeMemTime = 0;
        mContext = context;
        mContentResolver = mContext.getContentResolver();

        ThemeUtils.registerThemeChangeReceiver(mContext, new BroadcastReceiver() {
            @Override
            public void onReceive(Context content, Intent intent) {
                mUiContext = null;
            }
        });

        //create StatFs object
        mDataFileStats = new StatFs(DATA_PATH);
        mSystemFileStats = new StatFs(SYSTEM_PATH);
@@ -349,7 +361,7 @@ class DeviceStorageMonitorService extends Binder {
        notification.icon = com.android.internal.R.drawable.stat_notify_disk_full;
        notification.tickerText = title;
        notification.flags |= Notification.FLAG_NO_CLEAR;
        notification.setLatestEventInfo(mContext, title, details, intent);
        notification.setLatestEventInfo(getUiContext(), title, details, intent);
        mNotificationMgr.notify(LOW_MEMORY_NOTIFICATION_ID, notification);
        mContext.sendStickyBroadcast(mStorageLowIntent);
    }
@@ -394,4 +406,11 @@ class DeviceStorageMonitorService extends Binder {
        // force an early check
        postCheckMemoryMsg(true, 0);
    }

    private Context getUiContext() {
        if (mUiContext == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
        }
        return mUiContext != null ? mUiContext : mContext;
    }
}
Loading