Change icon in Header Navigation menu - SAPUI5 - sapui5

I need to change icon in the header Navigation Menu. I would like to customize the icon for "Master Data Display".

The items in the navigation menu, including the icons can be managed with the ShellUIService.
To change the icon you must call setHierarchy( aHierarchyLevels ) with the list of items that should be shown in the menu.
aHierarchyLevels is structured as follows:
[
{
title: "Main View",
icon: "sap-icon://documents",
intent: "#Action-sameApp"
},
{
title: "View 2",
subtitle: "Application view number 2",
intent: "#Action-sameApp&/View2/"
},
{
title: "View 3",
subtitle: "Application view number 3",
intent: "#Action-sameApp&/View3/"
}
]

Related

Add inline styles to links (something like link_class_list)

is there some way to add something like link_class_list, but make it use inline styles instead of classes?
I need to make it use styles, because some email clients block the <style> tag and we need to support most of the clients.
Werer loading the editor using JQuery. TinyMCE is on version 5.
Current config:
plugins: ["link, image"],
link_class_list: [
{ title: "None", value: "" },
{ title: "External Link", value: "ext_link" },
{
title: "Internal Links",
menu: [
{ title: "Internal Support Link", value: "int_sup_link" },
{ title: "Internal Marketing Link", value: "int_mark_link" },
{ title: "Other Internal Link", value: "int_other_link" },
],
},
]
Current output (with class):
<a data-mce-href="seznam.cz" href="seznam.cz" class="int_mark_link" data-mce-selected="inline-boundary">
Link example
</a>
Expected output (with style):
<a data-mce-href="seznam.cz" href="seznam.cz" style="color: red;" data-mce-selected="inline-boundary">
Link example
</a>

Flutter get language strings within a widget without changing context locale

I have been able to implement multiple language support in Flutter using the developer docs (https://flutter.dev/docs/development/accessibility-and-localization/internationalization)
I was wondering if there is a way to access the language strings we define within a widget but by not changing the locale of the context.
Here is my use case.
I am presenting a set of books as a grid of cards. The content is of different languages (e.g. English and Spanish). Now, based on the language I would like to use some of the text strings from the locale just for one card of the grid.
For example, if the data of each book is: language (en, es), title (...), no_pages (x). Then, when presenting the grid I would like to use the word "pages" from the string either as "Pages" or "Pagina".
How does one go about it? Thanks
Take a look at the language_builder package in pub.dev It is very easy to use. By wrapping your root widget with LanguageBuilder you can configure your app's language. Tell your app to use the phones' language or change it manually from the app.
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Language Builder Example',
home: LanguageBuilder(
useDeviceLanguage: false,
defaultLanguage: 'en',
languagesMap: Languages.languages,
child: MainPage(),
//splash: Container(),
),
),
);
}
class Languages {
static Map<String, String> languages = {
"tr": """{
"main_page": {
"title": "Ana Sayfa",
"second_page": "İkinci Sayfa"
},
"second_page": {
"title": "İkinci Sayfa",
"main_page": "Ana Sayfa",
"message":"Bu sayfa 2. sayfadır."
}
}""",
"en": """{
"main_page": {
"title": "Main Page",
"second_page": "Second Page"
},
"second_page": {
"title": "Second Page",
"main_page": "Main Page",
"message":"This is 2nd page."
}
}""",
"de": """{
"main_page": {
"title": "Hauptseite",
"second_page": "Zweite Seite"
},
"second_page": {
"title": "Zweite Seite",
"main_page": "Hauptseite",
"message":"Dies ist die 2. Seite."
}
}"""
};
}
//MainPage
Scaffold(
appBar: AppBar(
title: Text(
LanguageBuilder.texts['main_page']['title'],
),
),
),
You can configure the example above for your case. For more info take a look at language_builder:
language_builder

Is it possible to programmatically select an item from activity bar? [duplicate]

I am writing a VSCode extension which has a view container with a WebviewView added to it.
"contributes": {
"commands": [
{
"command": "showView",
"title": "Show view"
}
],
"viewsContainers": {
"panel": [
{
"id": "mycontainer",
"title": "My Container",
"icon": "media/app.svg"
}
]
},
"views": {
"mycontainer": [
{
"type": "webview",
"id": "myview",
"name": "MyView"
}
]
}
},
In showView command implementation. I want to programmatically make the view myview to display in VSCode UI. How to do that?
You can focus on a view in the sidebar by using the view's id and executing the focus command:
vscode.commands.executeCommand("myview.focus")
VSCode exposes a focus command on every view registered.
Your example view has ID myview so you want to call the myview.focus command.
You can verify this by opening File->Prefs->Keyboard Shortcuts and searching for myview.
To test the command, try adding the following in your extension activate function. It will create a clickable button on the bottom statusbar that will focus your sidebar view.
activate = function (workspace) {
const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 10);
statusBarItem.command = 'myview.focus';
statusBarItem.text = 'MYVIEW';
statusBarItem.show();
workspace.subscriptions.push(statusBarItem);
}

Identify the button clicked in Carousel of a facebook bot built on Gupshup

I am using Gupshup.io to build my bot on Facebook and I have a question regarding the carousel.
Suppose I have 4 items in the carousel each with a buy button then how do I know which item's button gets clicked in the carousel by the user?
When a user clicks the button in the carousel, the response sent back to the bot consist of the button name and the position of the item in that list.
For example:
In the below image if the user clicks on the buy button for the white t-shirt then bot receives the response as "Buy 1" and for the grey t-shirt the bot will receive the response as "Buy 2". For more details refer this guide
Complete sample code for Gupshup's IDE Bot Builder:
if(event.message=='t-shirt'){
var catalogue = {
"type": "catalogue",
"imageaspectratio": "horizontal",
"msgid": "cat_212",
"items": [
{
"title": "White T Shirt",
"subtitle": "Soft cotton t-shirt \nXs, S, M, L \n$10",
"imgurl": "http://petersapparel.parseapp.com/img/item100-thumb.png",
"options":[
{
"type":"url",
"title":"View Details",
"url":"http://petersapparel.parseapp.com/img/item100-thumb.png"
},
{
"type":"text",
"title":"Buy"
}
]
},
{
"title": "Grey T Shirt",
"subtitle": "Soft cotton t-shirt \nXs, S, M, L \n$12",
"imgurl": "http://petersapparel.parseapp.com/img/item101-thumb.png",
"options":[
{
"type":"url",
"title":"View Details",
"url":"http://petersapparel.parseapp.com/img/item101-thumb.png"
},
{
"type":"text",
"title":"Buy"
}
]
}
]
};
context.sendResponse(JSON.stringify(catalogue));
return;
}
if(event.message=='Buy 1' && event.messageobj.refmsgid=='cat_212'){
context.sendResponse("Your white t-shirt will be shipped within 1 working day.");
return;
}
if(event.message=='Buy 2' && event.messageobj.refmsgid=='cat_212'){
context.sendResponse("Your Grey t-shirt will be shipped within 1 working day.");
return;
}

How to run chrome extension in specific domain

Is there a way to limit a Chrome extension to only run on certain urls?
I build an extension that I won't to run only inside specific facebook app.
https://apps.facebook.com/appname/*
The extension add option to 'Right click menu' when clicking on image
How can I do that ?
manifest.json
{
"name": "profiler",
"description": "Show user profile page",
"version": "0.2",
"background": {
"scripts": ["dating.js"]
},
"manifest_version": 2,
"icons": {
"16": "icon.png",
"48": "icon.png",
"128": "icon.png"
}
}
Thanks in advance!
To add a menu option that shows only for images on a specific domain you can do the following:
On your manifest:
"permissions": [
"contextMenus"
],
On your background script:
chrome.contextMenus.create( {
title: 'My Menu Item',
contexts: ['image'],
documentUrlPatterns: ['https://apps.facebook.com/appname/*'],
onClick: function( info, tab ) {
...
}
});