How to change a Google Slides presentation theme via Slides API? - google-slides-api

This is a duplicate of this question. However, nobody has answered it.
So, how can you change a presentation's theme via the API? Is it even possible? I'm using Java, but that shouldn't affect the API.
Thanks

You can do two things:
Import a scheme from a master when creating your presentation - as suggested in the post you are refering to
Change the exsiting theme with a presentations.batchUpdate UpdatePagePropertiesRequest or UpdateShapePropertiesRequest request:
Thereby you can specify theme colors within the update request.
Sample from the documentation:
{
"requests": [
{
"updateShapeProperties": {
"objectId": copyElementId,
"fields": "shapeBackgroundFill.solidFill.color",
"shapeProperties": {
"shapeBackgroundFill": {
"solidFill": {
"color": {
"themeColor": "LIGHT2"
}
}
}
}
}
}
]
}
References:
Pages, Page Elements, and Properties
Kind of properties
ThemeColorType
ColorScheme
PageProperties
PredefinedLayout

Related

creating annotation in mirador programmatically from javascript function

I am trying to programmatically create an annotation on a canvas in mirador by calling a javascript function outside mirador.
Basically, I have a textual representation of a scanned text that includes descriptions of certain phenomenon on the scan, such as handwritten additions. If the user clicks on that description, I want the phenomenon in question to be highlighted with a box on the specified canvas in an already opened mirador instance mymirador that has several windows showing different scans.
For this, I try to pass the annotation as JSON using the receiveAnnotation action, but the annotation is not displayed at the correct place.
Javascript (added linebreaks for convenience):
function openAnnotationInMirador() {
var item = '{"id": "url-to-canvas/annotation",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"language": "en",
"value": "Some description"},
"target": "url-to-canvas/#xywh=100,100,200,200"}}';
mymirador.store.dispatch(Mirador.actions.receiveAnnotation('url-to-canvas/annotation', 'url-to-canvas', item));
}
Tha function is triggered by a simple html button with onclick: <button onclick="openAnnotationInMirador()">Mirador Test</button>.
I suspect the JSON to be incorrect, but I am quite at loss here. Any suggestions are very much appreciated!
The third parameter to the receiveAnnotation action creator function has to be a JavaScript object of a WebAnnotation AnnotationPage, with the actual annotation in its items array, in your case:
const annoPage = {
id: 'dummy://my.annotation/page',
type: 'AnnotationPage',
items: [
{
"id": "url-to-canvas/annotation",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"language": "en",
"value": "Some description"},
"target": "url-to-canvas/#xywh=100,100,200,200"
}
}
]
}
When working with the Redux actions in Mirador, it's very useful to install the Redux DevTools Browser Extension with which you can inspect the actions created by Mirador itself.

'requiresSelection' proprety not working for object page action extension?

For different facets in object page in List Report, when I add any custom action and add property "requiresSelection" to true, action remains disabled.
Tried adding below code in manifest.json
"Sections": {
"to_PDL::com.sap.vocabularies.UI.v1.LineItem": {
"id": "to_PDL::com.sap.vocabularies.UI.v1.LineItem",
"Actions": {
"TestAction_Deactivate": {
"id": "TestAction_Deactivate",
"text": "Deactivate",
"press": "onDeactivate",
"requiresSelection" : true
}
}
}
}
In the official SAP docu it says for property :
“Property that indicates whether the action requires a selection of items (true) or not (false). The default value is true.”
This means, that first you have to select a row in the table. Then the action becomes enabled.
Does it work for you this way?

JSON and Main.storyboard - swift 2

I want to create a website blocking app where parents can block any website they want by typing the link or any tags into UITextField. I can't work out how to have the user enter the links/tags into a UITextField ( i only know how to manually add the links/tags by accessing the .JSON file
in the code.
Any help would be appreciated,
thx,
Noja
P.S. The below code is in the .JSON file
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": "example"
}
}
]

BB10 Cascades: how it`s made?

How implement many custom ListItems, like its implemented in standart blackberry calendar app.
The following screenshot shows what I mean
Especially I interested what is the second control with right arrow.
Thanks.
You can have multiple "types" of list items.
Attach your different types of listItemComponents each with a different type. e.g.
listItemComponents: [
ListItemComponent {
type: "itemA"
Container {
Label {
text: ListItemData.title
textStyle.color: Color.Blue
}
}
},
ListItemComponent {
type: "itemB"
Container {
Label {
text: ListItemData.title
textStyle.color: Color.Red
}
}
}
]
Then add this function to your listview (I'm using a property of "mytype" but you could check any property of the data model or even base it on the indexpath):
function itemType(data, indexPath) {
if (data.mytype == "typea") {
return "itemA";
} else {
return "itemB";
}
}
Now when you add your data to your datamodel make sure you specify "mytype" and the listview will automatically use the ListItemComponent for the relative type.
You can easily have different sized list items, different designs even have them work with different data structures.

Anyway to have an onLoad function in qml when adding to NavigationPane?

I'm new to Blackberry 10 dev. So I'm wondering what's the best way to do this as I'm not getting any clear answers from the dev docs.
What I want is to start a separate view in my app from a navigation screen. The new page will then create a http request and update the UI based on the output.
The best way seems to be using the NavigationPane and add a qml view. However how do I invoke a C++ function when it's pushed onto the stack? Something similar to android onActivityCreated() in Fragments. There is the Http example docs, but the program started the http request from the constructor of the inherited QObject.
How to I have a function executed as the new qml is added to the navigation stack as
// navigationpane.qml
NavigationPane {
id: navigationPane
Page {
Container {
Label {
text: "First page"
}
}
actions: [
ActionItem {
title: "Next page"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
var page = pageDefinition.createObject();
navigationPane.push(page);
}
attachedObjects: ComponentDefinition {
id: pageDefinition;
source: "secondpage.qml"
}
}
]
}
onPopTransitionEnded: { page.destroy(); }
}
I think the onCreationCompleted function may be what you're looking for.
In the Page object of your secondpage.qml file, add this:
Page {
id: secondpage
onCreationCompleted: {
// use Javascript to call the exposed C++ function
}
}
If you want something more in the spirit of "onActivityCreated()", you can use the signal transitionEnded:
NavigationPane {
onPushTransitionEnded{
top.callYourPageFunction();
}
}

Resources