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

Commit 8172bfd7 authored by Sergey Ten's avatar Sergey Ten
Browse files

A fix for ESPRESSO-8 and ESPRESSO-9.

Use approach we have used already to theme status bar
and Power Off dialog. This time we are theming all
alert dialogs. Strictly speaking, the change is only
necessary if an alert dialog includes a list view.

NP: Most likely this change will be backed out after
we figure out how to properly modify system context's
asset manager.

CR:JoshG.
parent fd2649b1
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -18,14 +18,18 @@ package com.android.internal.app;

import static android.view.ViewGroup.LayoutParams.FILL_PARENT;
import android.app.AlertDialog;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.content.res.CustomTheme;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -49,6 +53,7 @@ import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import android.util.AttributeSet;
import android.util.Log;

import com.android.internal.R;

@@ -166,6 +171,15 @@ public class AlertController {
    }

    public AlertController(Context context, DialogInterface di, Window window) {
        try {
            CustomTheme theme = ActivityManagerNative.getDefault().getConfiguration().customTheme;
            int styleId = CustomTheme.getStyleId(context, theme.getThemePackageName(), theme.getThemeId());
            ContextThemeWrapper themeContext = new ContextThemeWrapper(context, styleId);
            themeContext.useThemedResources(theme.getThemePackageName());
            context = themeContext;
        } catch (RemoteException e) {
            Log.e("AlertController", "Failed to get current theme", e);
        }
        mContext = context;
        mInflater = LayoutInflater.from(context);
        mDialogInterface = di;