Commit 5d04d88f authored by Hazem Ashmawy's avatar Hazem Ashmawy Committed by Commit Bot

AW: Fix presubmit warning use setTextAppearance instead of setTextColor

Use setTextAppearance to set URL text color instead of setTextColor.
This defines new style resources used by setTextAppearance.

Fixed: 1059458
Test: Run presubmit upload checks, no warnings show up
Test: Run the shell and open valid and invalid URLs and notice URL text color
Change-Id: I55feb310f3315cdd126a46e6f3bd5802b1e5779e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095550Reviewed-by: default avatarTim Volodine <timvolodine@chromium.org>
Commit-Queue: Hazem Ashmawy <hazems@chromium.org>
Auto-Submit: Hazem Ashmawy <hazems@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749787}
parent 9bae9cb2
......@@ -4,6 +4,6 @@
found in the LICENSE file. -->
<resources>
<color name="url_color">#080808</color>
<color name="url_color">#080808</color>
<color name="url_error_color">#F20000</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<style name="UrlText">
<item name="android:textColor">@color/url_color</item>
</style>
<style name="UrlTextError">
<item name="android:textColor">@color/url_error_color</item>
</style>
</resources>
......@@ -52,7 +52,6 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.PackageManagerUtils;
......@@ -744,9 +743,11 @@ public class WebViewBrowserActivity extends AppCompatActivity {
}
private void setUrlFail(boolean fail) {
mUrlBar.setTextColor(fail ?
ApiCompatibilityUtils.getColor(getResources(), R.color.url_error_color) :
ApiCompatibilityUtils.getColor(getResources(), R.color.url_color));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mUrlBar.setTextAppearance(fail ? R.style.UrlTextError : R.style.UrlText);
} else {
mUrlBar.setTextAppearance(this, fail ? R.style.UrlTextError : R.style.UrlText);
}
}
/**
......
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