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

Commit 3d210b87 authored by Christofer Åkersten's avatar Christofer Åkersten Committed by android-build-merger
Browse files

Merge "Inherit theme dark/light scheme for MediaRouter dialogs/button" into oc-mr1-dev

am: 8466b017

Change-Id: I20d05a76666eeb9e8a720f41f71da120feb6fb46
parents 82b99238 8466b017
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.media.MediaRouter;
import android.media.MediaRouter.RouteInfo;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -130,7 +131,8 @@ public class MediaRouteChooserDialog extends Dialog {

        // Must be called after setContentView.
        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
                R.drawable.ic_media_route_off_holo_dark);
                isLightTheme(getContext()) ? R.drawable.ic_media_route_off_holo_light
                    : R.drawable.ic_media_route_off_holo_dark);

        mAdapter = new RouteAdapter(getContext());
        mListView = (ListView)findViewById(R.id.media_route_list);
@@ -176,6 +178,12 @@ public class MediaRouteChooserDialog extends Dialog {
        }
    }

    static boolean isLightTheme(Context context) {
        TypedValue value = new TypedValue();
        return context.getTheme().resolveAttribute(R.attr.isLightTheme, value, true)
                && value.data != 0;
    }

    private final class RouteAdapter extends ArrayAdapter<MediaRouter.RouteInfo>
            implements ListView.OnItemClickListener {
        private final LayoutInflater mInflater;
+5 −1
Original line number Diff line number Diff line
@@ -43,8 +43,12 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
     * </p>
     */
    public MediaRouteChooserDialogFragment() {
        int theme = MediaRouteChooserDialog.isLightTheme(getContext())
                ? android.R.style.Theme_DeviceDefault_Light_Dialog
                : android.R.style.Theme_DeviceDefault_Dialog;

        setCancelable(true);
        setStyle(STYLE_NORMAL, android.R.style.Theme_DeviceDefault_Dialog);
        setStyle(STYLE_NORMAL, theme);
    }

    public int getRouteTypes() {
+6 −4
Original line number Diff line number Diff line
@@ -71,16 +71,18 @@ public abstract class MediaRouteDialogPresenter {
        final MediaRouter router = (MediaRouter)context.getSystemService(
                Context.MEDIA_ROUTER_SERVICE);

        int theme = MediaRouteChooserDialog.isLightTheme(context)
                ? android.R.style.Theme_DeviceDefault_Light_Dialog
                : android.R.style.Theme_DeviceDefault_Dialog;

        MediaRouter.RouteInfo route = router.getSelectedRoute();
        if (route.isDefault() || !route.matchesTypes(routeTypes)) {
            final MediaRouteChooserDialog d = new MediaRouteChooserDialog(
                    context, android.R.style.Theme_DeviceDefault_Dialog);
            final MediaRouteChooserDialog d = new MediaRouteChooserDialog(context, theme);
            d.setRouteTypes(routeTypes);
            d.setExtendedSettingsClickListener(extendedSettingsClickListener);
            return d;
        } else {
            MediaRouteControllerDialog d = new MediaRouteControllerDialog(
                    context, android.R.style.Theme_DeviceDefault_Dialog);
            MediaRouteControllerDialog d = new MediaRouteControllerDialog(context, theme);
            return d;
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -47,6 +47,10 @@
        <item>@drawable/ic_clear_material</item>
        <item>@drawable/ic_dialog_alert_material</item>
        <item>@drawable/ic_go_search_api_material</item>
        <item>@drawable/ic_media_route_connecting_dark_material</item>
        <item>@drawable/ic_media_route_connecting_light_material</item>
        <item>@drawable/ic_media_route_dark_material</item>
        <item>@drawable/ic_media_route_light_material</item>
        <item>@drawable/ic_menu_copy_material</item>
        <item>@drawable/ic_menu_cut_material</item>
        <item>@drawable/ic_menu_moreoverflow_material</item>
+1 −3
Original line number Diff line number Diff line
@@ -1306,10 +1306,8 @@
  <java-symbol type="drawable" name="unlock_wave" />
  <java-symbol type="drawable" name="notification_template_icon_bg" />
  <java-symbol type="drawable" name="notification_template_icon_low_bg" />
  <java-symbol type="drawable" name="ic_media_route_on_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_off_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_connecting_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_off_holo_light" />
  <java-symbol type="drawable" name="cling_button" />
  <java-symbol type="drawable" name="cling_arrow_up" />
  <java-symbol type="drawable" name="cling_bg" />
Loading