Commit 13612a4c authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

[WebLayer] Fix Site Settings widget colors

This CL fixes the coloring on some Site Settings widgets, most
importantly the switch. The issue is that the fake Activity we have
in WebLayer's classloader doesn't extend AppCompatActivity, so some
appcompat functionality doesn't get initialized. I ran into issues
making the Activity extend AppCompatActivity instead of
FragmentActivity, but was able to perform get the necessary
initialization by creating a new AppCompatDelegate.

Bug: 1085553
Change-Id: I268f14d616db77cf35ff73edc54d85bf173dfa4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2258428
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781202}
parent bf0e0029
...@@ -16,6 +16,7 @@ import android.view.View.OnAttachStateChangeListener; ...@@ -16,6 +16,7 @@ import android.view.View.OnAttachStateChangeListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentController; import androidx.fragment.app.FragmentController;
import androidx.fragment.app.FragmentHostCallback; import androidx.fragment.app.FragmentHostCallback;
...@@ -81,6 +82,12 @@ public class SiteSettingsFragmentImpl extends RemoteFragmentImpl { ...@@ -81,6 +82,12 @@ public class SiteSettingsFragmentImpl extends RemoteFragmentImpl {
private PassthroughFragmentActivity(SiteSettingsFragmentImpl fragmentImpl) { private PassthroughFragmentActivity(SiteSettingsFragmentImpl fragmentImpl) {
mFragmentImpl = fragmentImpl; mFragmentImpl = fragmentImpl;
attachBaseContext(mFragmentImpl.getWebLayerContext()); attachBaseContext(mFragmentImpl.getWebLayerContext());
// This class doesn't extend AppCompatActivity, so some appcompat functionality doesn't
// get initialized, which leads to some appcompat widgets (like switches) rendering
// incorrectly. There are some resource issues with having this class extend
// AppCompatActivity, but until we sort those out, creating an AppCompatDelegate will
// perform the necessary initialization.
AppCompatDelegate.create(this, null);
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment