From 3ca3db7d02e5d1c3ce451ddda5b47191437772b8 Mon Sep 17 00:00:00 2001 From: vivek Date: Fri, 3 Oct 2014 12:29:00 +0200 Subject: [PATCH] Bug 1007436 - "Revamp visual design of about:feedback". r=margaret.leibovic f=alam --- .../android/chrome/content/aboutFeedback.js | 45 +++-- .../chrome/content/aboutFeedback.xhtml | 26 ++- .../locales/en-US/chrome/aboutFeedback.dtd | 13 +- mobile/android/themes/core/aboutFeedback.css | 160 +++++++++++++----- .../themes/core/images/icon_floaty_hdpi.png | Bin 0 -> 5517 bytes .../themes/core/images/icon_floaty_mdpi.png | Bin 0 -> 4525 bytes .../themes/core/images/icon_floaty_xhdpi.png | Bin 0 -> 6588 bytes .../themes/core/images/icon_floaty_xxhdpi.png | Bin 0 -> 8705 bytes .../themes/core/images/icon_heart_hdpi.png | Bin 0 -> 5181 bytes .../themes/core/images/icon_heart_mdpi.png | Bin 0 -> 4212 bytes .../themes/core/images/icon_heart_xhdpi.png | Bin 0 -> 6003 bytes .../themes/core/images/icon_heart_xxhdpi.png | Bin 0 -> 7938 bytes mobile/android/themes/core/jar.mn | 8 + 13 files changed, 182 insertions(+), 70 deletions(-) create mode 100644 mobile/android/themes/core/images/icon_floaty_hdpi.png create mode 100644 mobile/android/themes/core/images/icon_floaty_mdpi.png create mode 100644 mobile/android/themes/core/images/icon_floaty_xhdpi.png create mode 100644 mobile/android/themes/core/images/icon_floaty_xxhdpi.png create mode 100644 mobile/android/themes/core/images/icon_heart_hdpi.png create mode 100644 mobile/android/themes/core/images/icon_heart_mdpi.png create mode 100644 mobile/android/themes/core/images/icon_heart_xhdpi.png create mode 100644 mobile/android/themes/core/images/icon_heart_xxhdpi.png diff --git a/mobile/android/chrome/content/aboutFeedback.js b/mobile/android/chrome/content/aboutFeedback.js index d9576346780..4f48dcbe6fa 100644 --- a/mobile/android/chrome/content/aboutFeedback.js +++ b/mobile/android/chrome/content/aboutFeedback.js @@ -10,6 +10,15 @@ const FEEDBACK_PRODUCT_STRING = "Firefox for Android"; let Cc = Components.classes; let Ci = Components.interfaces; let Cu = Components.utils; +const HEARTY_ICON_MDPI = "chrome://browser/skin/images/icon_heart_mdpi.png"; +const HEARTY_ICON_HDPI = "chrome://browser/skin/images/icon_heart_hdpi.png"; +const HEARTY_ICON_XHDPI = "chrome://browser/skin/images/icon_heart_xhdpi.png"; +const HEARTY_ICON_XXHDPI = "chrome://browser/skin/images/icon_heart_xxhdpi.png"; + +const FLOATY_ICON_MDPI = "chrome://browser/skin/images/icon_floaty_mdpi.png"; +const FLOATY_ICON_HDPI = "chrome://browser/skin/images/icon_floaty_hdpi.png"; +const FLOATY_ICON_XHDPI = "chrome://browser/skin/images/icon_floaty_xhdpi.png"; +const FLOATY_ICON_XXHDPI = "chrome://browser/skin/images/icon_floaty_xxhdpi.png"; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Messaging.jsm"); @@ -32,6 +41,23 @@ function init() { switchSection("sad"); }, false); + let helpSectionIcon = FLOATY_ICON_XXHDPI; + let sadThanksIcon = HEARTY_ICON_XXHDPI; + + if (window.devicePixelRatio <= 1) { + helpSectionIcon = FLOATY_ICON_MDPI; + sadThanksIcon = HEARTY_ICON_MDPI; + } else if (window.devicePixelRatio <= 1.5) { + helpSectionIcon = FLOATY_ICON_HDPI; + sadThanksIcon = HEARTY_ICON_HDPI; + } else if (window.devicePixelRatio <= 2) { + helpSectionIcon = FLOATY_ICON_XHDPI; + sadThanksIcon = HEARTY_ICON_XHDPI; + } + + document.getElementById("sumo-icon").src = helpSectionIcon; + document.getElementById("sad-thanks-icon").src = sadThanksIcon; + window.addEventListener("unload", uninit, false); document.getElementById("open-play-store").addEventListener("click", openPlayStore, false); @@ -49,7 +75,11 @@ function init() { // Fill "Last visited site" input with most recent history entry URL. Services.obs.addObserver(function observer(aSubject, aTopic, aData) { - document.getElementById("last-url").value = aData; + document.getElementById("last-url").value = aData; + // Enable the parent div iff the URL is valid. + if (aData.length != 0) { + document.getElementById("last-url-div").style.display="block"; + } }, "Feedback:LastUrl", false); Messaging.sendRequest({ type: "Feedback:LastUrl" }); @@ -96,24 +126,15 @@ function sendFeedback(aEvent) { let sectionElement = document.getElementById(section); let descriptionElement = sectionElement.querySelector(".description"); - // Bail if the description value isn't valid. HTML5 form validation will take care - // of showing an error message for us. - if (!descriptionElement.validity.valid) - return; - let data = {}; data["happy"] = false; data["description"] = descriptionElement.value; data["product"] = FEEDBACK_PRODUCT_STRING; + let urlCheckBox = document.getElementById("last-checkbox"); let urlElement = document.getElementById("last-url"); - // Bail if the URL value isn't valid. HTML5 form validation will take care - // of showing an error message for us. - if (!urlElement.validity.valid) - return; - // Only send a URL string if the user provided one. - if (urlElement.value) { + if (urlCheckBox.checked) { data["url"] = urlElement.value; } diff --git a/mobile/android/chrome/content/aboutFeedback.xhtml b/mobile/android/chrome/content/aboutFeedback.xhtml index afe5159b6ea..c7c0984cc03 100644 --- a/mobile/android/chrome/content/aboutFeedback.xhtml +++ b/mobile/android/chrome/content/aboutFeedback.xhtml @@ -43,7 +43,7 @@

&happy.header;

&happy.message;
-
&happy.finePrint;
+
&happy.finePrint;