Commit 2114033b authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPKs] Make resources not conflict with chrome_public_test_apk

This CL refactors the |webapk_java| resources so that their names do not
conflict with other resources in |chrome_public_test_apk|

The CL:
1) Makes the resources target that |webapk_java| depends on no
longer import app_icon.png This is useful because
|chrome_public_test_apk| depends on |webapk_java| and the WebAPK
app_icon.png resource conflicts with app_icon.png imported by
|chrome_public_apk_resources|.
2) Adds the 'webapk_' prefix to the following resources"
   - color_black_38
   - color_black_54
   - color_black_87
   - text_size_large
   - text_size_medium_dense

BUG=1093825

Change-Id: Ib8b648dce6ef5008957552df269fe0bc386a94f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2371403
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarGlenn Hartmann <hartmanng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802448}
parent 804e38b5
......@@ -105,6 +105,7 @@ template("webapk_tmpl") {
_generated_res_background_dir =
"${target_gen_dir}/${_generate_res_background_xml_target_name}/res"
_resources_target_name = "${target_name}_resources"
_app_icon_resources_target_name = "${target_name}_app_icon_resources"
if (defined(invoker.manifest_output)) {
_manifest_output = invoker.manifest_output
......@@ -136,6 +137,17 @@ template("webapk_tmpl") {
output = "${_generated_res_background_dir}/values/background_color.xml"
}
android_resources(_app_icon_resources_target_name) {
create_srcjar = false
sources = [
"res_app_icon/mipmap-hdpi/app_icon.xml",
"res_app_icon/mipmap-mdpi/app_icon.xml",
"res_app_icon/mipmap-xhdpi/app_icon.xml",
"res_app_icon/mipmap-xxhdpi/app_icon.xml",
"res_app_icon/mipmap-xxxhdpi/app_icon.xml",
]
}
android_resources(_resources_target_name) {
create_srcjar = false
sources = [
......@@ -173,10 +185,8 @@ template("webapk_tmpl") {
"res/layout/choose_host_browser_dialog.xml",
"res/layout/host_browser_list_item.xml",
"res/mipmap-anydpi-v26/ic_launcher.xml",
"res/mipmap-hdpi/app_icon.xml",
"res/mipmap-hdpi/ic_launcher.xml",
"res/mipmap-hdpi/maskable_app_icon.xml",
"res/mipmap-mdpi/app_icon.xml",
"res/mipmap-mdpi/ic_launcher.xml",
"res/mipmap-mdpi/ic_launcher_background.png",
"res/mipmap-mdpi/ic_launcher_foreground.png",
......@@ -195,13 +205,10 @@ template("webapk_tmpl") {
"res/mipmap-nodpi/maskable_splash_icon_xxxhdpi.png",
"res/mipmap-nodpi/splash_icon_xxhdpi.png",
"res/mipmap-nodpi/splash_icon_xxxhdpi.png",
"res/mipmap-xhdpi/app_icon.xml",
"res/mipmap-xhdpi/ic_launcher.xml",
"res/mipmap-xhdpi/maskable_app_icon.xml",
"res/mipmap-xxhdpi/app_icon.xml",
"res/mipmap-xxhdpi/ic_launcher.xml",
"res/mipmap-xxhdpi/maskable_app_icon.xml",
"res/mipmap-xxxhdpi/app_icon.xml",
"res/mipmap-xxxhdpi/ic_launcher.xml",
"res/mipmap-xxxhdpi/maskable_app_icon.xml",
"res/values-hdpi/is_splash_icon_maskable_bool.xml",
......@@ -244,7 +251,10 @@ template("webapk_tmpl") {
"apk_name",
"testonly",
])
deps = [ ":$_java_with_services_target_name" ]
deps = [
":$_app_icon_resources_target_name",
":$_java_with_services_target_name",
]
android_manifest = _manifest_output
android_manifest_dep = ":$_manifest_target_name"
......
......@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk
current_shell_apk_version = 131
current_shell_apk_version = 132
......@@ -28,6 +28,11 @@ copy_dir("copy_res_to_upload_dir") {
destination_dir = "${upload_dir}/res"
}
copy_dir("copy_res_app_icon_to_upload_dir") {
source_dir = "//chrome/android/webapk/shell_apk/res_app_icon"
destination_dir = "${upload_dir}/res"
}
copy_dir("copy_res_template_to_upload_dir") {
source_dir = "//chrome/android/webapk/shell_apk/res_template"
destination_dir = "${upload_dir}/res"
......@@ -63,6 +68,7 @@ group("prepare_webapk_shell_upload_dir") {
deps = [
":copy_extra_files_to_upload_dir",
":copy_libs_common_res_splash_to_upload_dir",
":copy_res_app_icon_to_upload_dir",
":copy_res_template_to_upload_dir",
":copy_res_to_upload_dir",
]
......
......@@ -13,8 +13,8 @@
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_large"
android:textColor="@color/black_alpha_54"
android:textSize="@dimen/webapk_text_size_large"
android:textColor="@color/webapk_black_alpha_54"
android:layout_marginBottom="12dp" />
<ListView
......@@ -25,4 +25,4 @@
android:dividerHeight="0dp"
android:layout_marginTop="4dp" />
</LinearLayout>
\ No newline at end of file
</LinearLayout>
......@@ -25,8 +25,8 @@
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_alpha_87"
android:textSize="@dimen/text_size_large"
android:textColor="@color/webapk_black_alpha_87"
android:textSize="@dimen/webapk_text_size_large"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" />
</LinearLayout>
\ No newline at end of file
</LinearLayout>
......@@ -5,8 +5,8 @@
<resources>
<!-- Common colors-->
<color name="black_alpha_38">#61000000</color>
<color name="black_alpha_54">#8A000000</color>
<color name="black_alpha_87">#DE000000</color>
<color name="webapk_black_alpha_38">#61000000</color>
<color name="webapk_black_alpha_54">#8A000000</color>
<color name="webapk_black_alpha_87">#DE000000</color>
<color name="white_adaptive_ic_launcher_background">#FFFFFF</color>
</resources>
......@@ -6,8 +6,8 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Common text sizes -->
<dimen name="headline_size_medium">20sp</dimen>
<dimen name="text_size_large">16sp</dimen>
<dimen name="text_size_medium_dense">12sp</dimen>
<dimen name="webapk_text_size_large">16sp</dimen>
<dimen name="webapk_text_size_medium_dense">12sp</dimen>
<!-- Refers to https://material.googleplex.com/components/dialogs.html#dialogs-specs. -->
<dimen name="dialog_content_padding">24dp</dimen>
......
......@@ -212,19 +212,20 @@ public class ChooseHostBrowserDialog {
name.setEnabled(item.enable());
if (item.enable()) {
name.setText(item.getApplicationName());
name.setTextColor(WebApkUtils.getColor(res, R.color.black_alpha_87));
name.setTextColor(WebApkUtils.getColor(res, R.color.webapk_black_alpha_87));
icon.setAlpha(SUPPORTED_ICON_OPACITY);
} else {
String text = mContext.getString(R.string.host_browser_item_not_supporting_webapks,
item.getApplicationName());
SpannableString spannableName = new SpannableString(text);
float descriptionProportion = res.getDimension(R.dimen.text_size_medium_dense)
/ res.getDimension(R.dimen.text_size_large);
float descriptionProportion =
res.getDimension(R.dimen.webapk_text_size_medium_dense)
/ res.getDimension(R.dimen.webapk_text_size_large);
spannableName.setSpan(new RelativeSizeSpan(descriptionProportion),
item.getApplicationName().length() + 1, spannableName.length(), 0);
name.setText(spannableName);
name.setSingleLine(false);
name.setTextColor(WebApkUtils.getColor(res, R.color.black_alpha_38));
name.setTextColor(WebApkUtils.getColor(res, R.color.webapk_black_alpha_38));
icon.setAlpha(UNSUPPORTED_ICON_OPACITY);
}
icon.setImageDrawable(item.getApplicationIcon());
......
......@@ -162,7 +162,7 @@ public class WebApkUtils {
public static void applyAlertDialogContentStyle(
Context context, View contentView, TextView titleView) {
Resources res = context.getResources();
titleView.setTextColor(getColor(res, R.color.black_alpha_87));
titleView.setTextColor(getColor(res, R.color.webapk_black_alpha_87));
titleView.setTextSize(
TypedValue.COMPLEX_UNIT_PX, res.getDimension(R.dimen.headline_size_medium));
int dialogContentPadding = res.getDimensionPixelSize(R.dimen.dialog_content_padding);
......
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