firefox add-on sdk ToggleButton badgeColor displayed default red color - firefox

when I resized the firefox window to just not display my add-on's toggleButton, then resized the firefox window to display my add-on's toggleButton. The badgeColor was displayed with default color(red).
How should I do and solve this problem? And is this the firefox's bug?
var {ToggleButton} = require("sdk/ui/button/toggle");
var button = ToggleButton({
id:"aaaa",
label:"aaaa",
icon:{
"16":"./aaaa-16.png",
"32":"./aaaa-32.png",
"64":"./aaaa-64.png",
},
onChange:changed,
badge:"0",
badgeColor:"#A9A9A9",
});
function changed(state) {
if (button.badge == "1") {
// code
button.badge = "0";
} else {
button.badge = "1";
}
if (state.checked) {
// code
button.badgeColor = "#20B2AA";
}
else {
button.badgeColor = "#A9A9A9";
}
}

Related

How can I set the font-family of large titles on iOS?

By attaching an event listener to the loaded-event on Page and getting the NativeView-object I've been able to set the prefersLargeTitle to true:
loaded(event){
const page = event.object;
if (isIOS) {
page.frame.ios.controller.navigationBar.prefersLargeTitles = true;
}
}
This works, but I would like to change the font-family of the large title. How can I do this in Nativescript?
Try adding the code below to your app.js
import {
isIOS
} from "tns-core-modules/platform";
import {
ActionBar
} from "tns-core-modules/ui/action-bar";
import {
Font
} from "tns-core-modules/ui/styling/font";
if (isIOS) {
ActionBar.prototype.originalSetColor = ActionBar.prototype.setColor;
ActionBar.prototype.setColor = function (navBar, color) {
ActionBar.prototype.originalSetColor.call(this, navBar, color);
var newDict = {
[NSFontAttributeName]: Font
.default
.withFontFamily(
"yourFontFamily")
.withFontSize(yourFontSize)
.getUIFont(UIFont
.systemFontOfSize(20)),
};
if (navBar.largeTitleTextAttributes) {
newDict[NSForegroundColorAttributeName] = navBar.largeTitleTextAttributes.valueForKey(NSForegroundColorAttributeName);
}
navBar.largeTitleTextAttributes = newDict;
};
}
You may still set the prefersLargeTitles flags as you are doing already.

Webview OnProgressChanged and progressbar

In a Xamarin application I have a CustomWebView renderer; I'm injecting in the view and displaying a progressbar in OnProgressChanged event of the WebChromeClient with the following code.
Init:
var progressBar = new Android.Widget.ProgressBar(_context, null, Android.Resource.Attribute.ProgressBarStyleHorizontal);
Control.SetWebViewClient(new CusWebViewClient($"javascript: {JavascriptFunction}"));
Control.SetWebChromeClient(new CusWebChromeClient(progressBar));
Control.AddView(progressBar);
CusWebChromeClient:
public class CusWebChromeClient : WebChromeClient
{
Android.Widget.ProgressBar progressBar;
public CusWebChromeClient(Android.Widget.ProgressBar progressBar)
{
this.progressBar = progressBar;
}
public override void OnProgressChanged(Android.Webkit.WebView view, int newProgress)
{
if (newProgress < 100 && progressBar.Visibility == ViewStates.Gone)
{
progressBar.Visibility = ViewStates.Visible;
}
progressBar.SetProgress(newProgress, true);
if (newProgress == 100)
{
//progressBar.Visibility = ViewStates.Gone;
}
}
}
The issue is that the progress bar is displayed really small like:
I need to display it with full display width and with a more heigth.
You forgot to set the width of progress bar.
You could use the screen width to set the progress bar in custom renderer. After that, it would be okay.
var width = (int)Application.Current.MainPage.Width;
Please note, 'Application' is an ambiguous reference between 'Android.App.Application' and 'Xamarin.Forms.Application'. You could add reference like below to fix it.
using Application = Xamarin.Forms.Application;
Change:
Control.AddView(progressBar);
To:
Control.AddView(progressBar, width, 30);

Qt Framework Installer : blue rect gfx appear on my Licence Agreement page (MacOSX)

I have a glitch/bug on the Licence Agreement page of my installer. This bug only happens on Mac.I removed all non-mandary pages. Does someone can help me ?
rem : It looks like a bad selection/focus of the TextZone. When I click on the radio buttons or on the text the blue rect disappears
This is the screenshot : Installer Licence Page gfx bug screenshot
This is my script :
function Component()
{
installer.setDefaultPageVisible(QInstaller.Introduction, false); // needed to avoid double introduction page
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
//installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); // commented cuz we have a non-informative error (E_FAIL) when the disk is already full
}
Component.prototype.createOperationsForArchive = function(archive)
{
if (installer.value("os") === "mac")
{
component.addOperation("Extract", archive, "#ApplicationsDir#");
}
else
{
component.addOperation("Extract", archive, "#TargetDir#");
}
}
Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
} catch (e) {
console.log(e);
}
if (installer.value("os") === "win")
{
component.addOperation("CreateShortcut", "#TargetDir#/bin/game-launcher.exe", "#DesktopDir#/game.lnk");
}
if (installer.value("os") === "x11")
{
component.addOperation("CreateDesktopEntry", "/usr/share/applications/YourApp.desktop", "Version=1.0\nType=Application\nTerminal=false\nExec=#TargetDir#/YourApp.sh\nName=YourApp_name\nIcon=#TargetDir#YourApp_icon.png\nName[en_US]=YourApp_name");
component.addElevatedOperation("Copy", "/usr/share/applications/YourApp.desktop", "#HomeDir#/Desktop/YourApp.desktop");
}
}
Component.prototype.isDefault = function()
{
// select the component by default
return true;
}

How to remove firefox 36 badge text

Since firefox 36 it is possible to set badge text for a firefox add-on icon:
var { ToggleButton } = require("sdk/ui/button/toggle");
var button = ToggleButton({
id: "my-button1",
label: "my button1",
icon: "./icon-16.png",
onChange: changed,
badge: 0,
badgeColor: "#00AAAA"
});
function changed(state) {
button.badge = state.badge + 1;
if (state.checked) {
button.badgeColor = "#AA00AA";
}
else {
button.badgeColor = "#00AAAA";
}
}
However, it is not clear to me how to remove the badge text. Just setting its color to transparent does not work, since the text is still displayed and the background of the badge has a gradient (which is even in transparent mode visible).
To fully remove the badge text set it to an empty string, i.e. button.badge = "";

Why don't InfoCards work in IE8?

What changed in IE8 that makes detecting InfoCard Selector support in javascript stop working unless IE8 is put in Compatibility Mode?
And more to the point, what is the new JavaScript code to detect the presence of InfoCard support?
Here is the script that worked up through IE7, including FireFox with a plug-in in some cases:
function AreCardsSupported() {
var IEVer = -1;
if (navigator.appName == 'Microsoft Internet Explorer') {
if (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null) {
IEVer = parseFloat(RegExp.$1);
}
}
// Look for IE 7+.
if (IEVer >= 7) {
var embed = document.createElement("object");
embed.setAttribute("type", "application/x-informationcard");
return "" + embed.issuerPolicy != "undefined" && embed.isInstalled;
}
// not IE (any version)
if (IEVer < 0 && navigator.mimeTypes && navigator.mimeTypes.length) {
// check to see if there is a mimeType handler.
x = navigator.mimeTypes['application/x-informationcard'];
if (x && x.enabledPlugin) {
return true;
}
// check for the IdentitySelector event handler is there.
if (document.addEventListener) {
var event = document.createEvent("Events");
event.initEvent("IdentitySelectorAvailable", true, true);
top.dispatchEvent(event);
if (top.IdentitySelectorAvailable == true) {
return true;
}
}
}
return false;
}
I got an answer out of band from the IE8 team:
Change
embed.setAttribute("type", "application/x-informationcard");
to
embed.type = "application/x-informationcard";

Resources