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

Commit e4ccad2b 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...

Merge "Inherit theme dark/light scheme for MediaRouter dialogs/button" into oc-mr1-dev am: 8466b017
am: 3d210b87

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


        // Must be called after setContentView.
        // Must be called after setContentView.
        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
        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());
        mAdapter = new RouteAdapter(getContext());
        mListView = (ListView)findViewById(R.id.media_route_list);
        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>
    private final class RouteAdapter extends ArrayAdapter<MediaRouter.RouteInfo>
            implements ListView.OnItemClickListener {
            implements ListView.OnItemClickListener {
        private final LayoutInflater mInflater;
        private final LayoutInflater mInflater;
+5 −1
Original line number Original line Diff line number Diff line
@@ -43,8 +43,12 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
     * </p>
     * </p>
     */
     */
    public MediaRouteChooserDialogFragment() {
    public MediaRouteChooserDialogFragment() {
        int theme = MediaRouteChooserDialog.isLightTheme(getContext())
                ? android.R.style.Theme_DeviceDefault_Light_Dialog
                : android.R.style.Theme_DeviceDefault_Dialog;

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


    public int getRouteTypes() {
    public int getRouteTypes() {
+6 −4
Original line number Original line Diff line number Diff line
@@ -71,16 +71,18 @@ public abstract class MediaRouteDialogPresenter {
        final MediaRouter router = (MediaRouter)context.getSystemService(
        final MediaRouter router = (MediaRouter)context.getSystemService(
                Context.MEDIA_ROUTER_SERVICE);
                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();
        MediaRouter.RouteInfo route = router.getSelectedRoute();
        if (route.isDefault() || !route.matchesTypes(routeTypes)) {
        if (route.isDefault() || !route.matchesTypes(routeTypes)) {
            final MediaRouteChooserDialog d = new MediaRouteChooserDialog(
            final MediaRouteChooserDialog d = new MediaRouteChooserDialog(context, theme);
                    context, android.R.style.Theme_DeviceDefault_Dialog);
            d.setRouteTypes(routeTypes);
            d.setRouteTypes(routeTypes);
            d.setExtendedSettingsClickListener(extendedSettingsClickListener);
            d.setExtendedSettingsClickListener(extendedSettingsClickListener);
            return d;
            return d;
        } else {
        } else {
            MediaRouteControllerDialog d = new MediaRouteControllerDialog(
            MediaRouteControllerDialog d = new MediaRouteControllerDialog(context, theme);
                    context, android.R.style.Theme_DeviceDefault_Dialog);
            return d;
            return d;
        }
        }
    }
    }
+4 −0
Original line number Original line Diff line number Diff line
@@ -47,6 +47,10 @@
        <item>@drawable/ic_clear_material</item>
        <item>@drawable/ic_clear_material</item>
        <item>@drawable/ic_dialog_alert_material</item>
        <item>@drawable/ic_dialog_alert_material</item>
        <item>@drawable/ic_go_search_api_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_copy_material</item>
        <item>@drawable/ic_menu_cut_material</item>
        <item>@drawable/ic_menu_cut_material</item>
        <item>@drawable/ic_menu_moreoverflow_material</item>
        <item>@drawable/ic_menu_moreoverflow_material</item>
+1 −3
Original line number Original line Diff line number Diff line
@@ -1306,10 +1306,8 @@
  <java-symbol type="drawable" name="unlock_wave" />
  <java-symbol type="drawable" name="unlock_wave" />
  <java-symbol type="drawable" name="notification_template_icon_bg" />
  <java-symbol type="drawable" name="notification_template_icon_bg" />
  <java-symbol type="drawable" name="notification_template_icon_low_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_off_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_connecting_holo_dark" />
  <java-symbol type="drawable" name="ic_media_route_off_holo_light" />
  <java-symbol type="drawable" name="ic_media_route_disabled_holo_dark" />
  <java-symbol type="drawable" name="cling_button" />
  <java-symbol type="drawable" name="cling_button" />
  <java-symbol type="drawable" name="cling_arrow_up" />
  <java-symbol type="drawable" name="cling_arrow_up" />
  <java-symbol type="drawable" name="cling_bg" />
  <java-symbol type="drawable" name="cling_bg" />
Loading