Phaser 1.1.6
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses Pixi.js internally for fast 2D Canvas and WebGL rendering.
Version: 1.1.6 "Shienar" - Released: 24th February 2014
By Richard Davey, Photon Storm
- View the Official Website
- Follow on Twitter
- Join the Forum
- Try out 220+ Phaser Examples
- Read the documentation online
Subscribe to our new Phaser Newsletter. We'll email you when new versions are released as well as send you our regular Phaser game making magazine.
Welcome to Phaser
1.1.6 is the final point release before Phaser 2.0 is released this March.
As you may know we had planned to release 1.1.4 at the end of 2013. For various reasons this didn't quite happen, but we're happy to announce it's finally out! There have been some dramatic changes internally, and if you make use of either the physics systems or tilemaps then you are going to need to update your code. Hopefully only a little bit, but there have been a number of core API changes which we detail below. There are also a host of new features, the headliners being:
- New Physics system. Uses SAT.js internally so physics bodies can now be rectangles, circles or polygons and support rotation.
- New Tilemap system. Brand new collision system for tiles, much more advanced layer handling, tile properties, multiple tilesets of layer and more.
- New Timer. This handy new class lets you create timed events easily.
- Your Game can now be configured from an external configuration object.
- Over 150 new features and updates and over 30 reported bug fixes.
This release also brings the TypeScript definitions file as bang up to date as possible. There are still a few areas that need looking at, but with your help hopefully we can iron those final few bits out and have a 100% accruate defs file on offer.
There is a new Contributors Guide which we'd urge you to follow if you wish to help with Phaser development, and we've updated the doc files and added lots more details into key areas. The Examples have grown too! Now over 220 of them including several great ones from the community.
We're going to settle on this build for a short while as we do some quick iteration bug fixing, so expect to see some small point releases very soon that do nothing but address any issues you may find. But in parallel to this we are also now rebuilding our core to bring it in-line with the latest version of Pixi.js, which has had some dramatic changes under the hood, changes will impact a lot of what Phaser does internally. But the changes are all for the better and once we upgrade Pixi you'll have a significantly faster renderer and a smaller codebase too, as we do away with stacks of linked list code :)
As always we offer a heart-felt "Thank you!" to everyone who has encouraged us along the way. To those of you who worked with Phaser during its various incarnations. The number of games being released that were made with Phaser is staggering and we really love to see how you use it!  It's your kind words and enthusiasm that has keeps us going.
Phaser is everything we ever wanted from an HTML5 game framework. It powers all of our client work in build today and remains our single most important product, and we've still only just scratched the surface of what we have planned for it.
Help Test 2.0
Originally we were going to release Phaser 1.2 next, however after working solidly on it for a while we realise it's such a large and API breaking/changing update that we need to ste-up the version to 2.0 to avoid any possible confusion. Progress has been rapid and we'd love for you to help test it. You'll notice a new 1.2 branch on github - we're going to keep the branch name as 1.2 as we're nearly at the end of development now, but please understand this is what will actually be the 2.0 release.
Please help test out 1.2/2.0 as much as you can. It features the brand new Pixi 1.5 internally as well as nearly complete integration with p2.js for all physics (dropping ArcadePhysics entirely). New versions are being pushed several times a day, so be sure to update and pull often. Don't expect to just run old games right under it yet, but please do check out the new tests, experiment and poke it around as much as you can - thank you!
Getting Started Guides
We have a new Getting Started Guide which covers all you need to begin developing games with Phaser. From setting up a web server to picking an IDE. If you're new to HTML5 game development, or are coming from another language like AS3, then we recommend starting there.
There is a comprehensive How to Learn Phaser guide on the GameDevTuts+ site which is a great place to learn where to find tutorials, examples and support.
There is also an un-official Getting Started Guide.
Change Log
Version 1.1.6 - "Shienar" - 24th February 2014
Updates:
- Loader can now load JSON files natively (thanks lucas)
- TilemapParser now errors if the tileset isn't the right size
Bug Fixes:
- Updated Physics.Body.applyDamping so that velocity is reduced down to zero properly (thanks caezs)
- ArcadePhysics.collideSpriteVsTilemapLayer wouldn't call the process or collide callbacks if only 1 tile was involved in the check (thanks mandarinx)
- Lots of documentation fixes (thanks nhowell)
- Fix for PixiPatch so it renders masks again (thanks georgios)
- Modified ArcadePhysics.intersects so it returns a value as well as asigns (thanks bunnyhero)
- Lots of TypeScript defs fixes (thanks clark)
See the full Change Log for all the 1.1.4 and 1.1.5 updates and API changes (as there were a lot of them!)
You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
How to Build
We provide a fully compiled version of Phaser in the build
directory, in both plain and minified formats.
We also provide a Grunt script that will build Phaser from source along with all the examples.
Run grunt
in the phaser folder for a list of command-line options.
Koding
You can ![clone the Phaser repo in Koding]koding and then start editing and previewing code right away using their web based VM development system.
Bower
If you use bowser you can install phaser with:
bower install phaser
Nice and easy :)
CDNJS
Thanks to a community member Phaser is now available on CDNJS. You can include the following in your html:
http://cdnjs.cloudflare.com/ajax/libs/phaser/1.1.5/phaser.min.js
Or if you prefer you can leave the protocol off, so it works via http and https:
//cdnjs.cloudflare.com/ajax/libs/phaser/1.1.5/phaser.min.js
Requirements
Games created with Phaser require a modern web browser that supports the canvas tag. This includes Internet Explorer 9+, Firefox, Chrome, Safari and Opera. It also works on mobile web browsers including stock Android 2.x browser and above and iOS5 Mobile Safari and above.
For developing with Phaser you can use either a plain-vanilla JavaScript approach or TypeScript using the provided TypeScript definitions file. We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you.
Phaser is 321 KB minified and 72 KB gzipped.
Learn By Example
Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 200 of them and create new ones to test every new feature added. Inside the examples
folder you'll find the current set. If you write a particularly good example then please send it to us.
The examples need to be run through a local web server (in order to avoid file access permission errors from your browser). You can use your own web server, or start the included web server using grunt.
Using a locally installed web server browse to the examples folder:
examples/index.html
Alternatively in order to start the included web server, after you've cloned the repo, run npm install
to install all dependencies, then grunt connect
to start a local server. After running this command you should be able to access your local webserver at http://<IP_ADDRESS>:8000
. Then browse to the examples folder: http://<IP_ADDRESS>:8000/examples/index.html
There is a new 'Side View' example viewer as well. This loads all the examples into a left-hand frame for faster navigation.
You can also browse all Phaser Examples online.
Features
WebGL & Canvas
Phaser uses both a Canvas and WebGL renderer internally and can automatically swap between them based on browser support. This allows for lightning fast rendering across Desktop and Mobile. When running under WebGL Phaser now supports shaders, allowing for some incredible in-game effects. Phaser uses and contributes towards the excellent Pixi.js library for rendering.
Preloader
We've made the loading of assets as simple as one line of code. Images, Sounds, Sprite Sheets, Tilemaps, JSON data, XML and JavaScrtip files - all parsed and handled automatically, ready for use in game and stored in a global Cache for Sprites to share.
Physics
Phaser ships with our Arcade Physics system. A SAT based collision and physics library perfect for low-powered devices and fast collision response. Control velocity, acceleration, bounce, damping and full collision and separation control. As of version 1.1.4 we now support rectangles, circles and polygon collision with full rotation.
Sprites
Sprites are the life-blood of your game. Position them, tween them, rotate them, scale them, animate them, collide them, paint them onto custom textures and so much more! Sprites also have full Input support: click them, touch them, drag them around, snap them - even pixel perfect click detection if needed.
Groups
Group bundles of Sprites together for easy pooling and recycling, avoiding constant object creation. Groups can also be collided: for example a "Bullets" group checking for collision against the "Aliens" group, with a custom collision callback to handle the outcome.
Animation
Phaser supports classic Sprite Sheets with a fixed frame size, Texture Packer and Flash CS6/CC JSON files (both Hash and Array formats) and Starling XML files. All of these can be used to easily create animation for Sprites.
Particles
An Arcade Particle system is built-in, which allows you to create fun particle effects easily. Create explosions or constant streams for effects like rain or fire. Or attach the Emitter to a Sprite for a jet trail.
Camera
Phaser has a built-in Game World. Objects can be placed anywhere within the world and you've got access to a powerful Camera to look into that world. Pan around and follow Sprites with ease.
Input
Talk to a Phaser.Pointer and it doesn't matter if the input came from a touch-screen or mouse, it can even change mid-game without dropping a beat. Multi-touch, Mouse, Keyboard and lots of useful functions allow you to code custom gesture recognition.
Sound
Phaser supports both Web Audio and legacy HTML Audio. It automatically handles mobile device locking, easy Audio Sprite creation, looping, streaming and volume. We know how much of a pain dealing with audio on mobile is, so we did our best to resolve that!
Tilemaps
Phaser can load, render and collide with a tilemap with just a couple of lines of code. We support CSV and Tiled map data formats with multiple tile layers. There are lots of powerful tile manipulation functions: swap tiles, replace them, delete them, add them and update the map in realtime.
Device Scaling
Phaser has a built-in Scale Manager which allows you to scale your game to fit any size screen. Control aspect ratios, minimum and maximum scales and full-screen support.
Plugin system
We are trying hard to keep the core of Phaser limited to only essential classes, so we built a smart Plugin system to handle everything else. Create your own plugins easily and share them with the community.
Mobile Browser
Phaser was built specifically for Mobile web browsers. Of course it works blazingly fast on Desktop too, but unlike lots of frameworks mobile was our main focus. If it doesn't perform well on mobile then we don't add it into the Core.
Developer Support
We use Phaser every day on our many client projects. As a result it's constantly evolving and improving and we jump on bugs and pull requests quickly. This is a living, breathing framework maintained by a commercial company with custom feature development and support packages available. We live and breathe HTML5 games.
Battle Tested
Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest mobile HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved fast and we stay on-top of the changing browser landscape.
Road Map
Here is what's on our road map for the coming months:
March 2014 will see Phaser 2.0 ("Aes Sedai") Released. The new features and fixes already implemented are vast, and include:
- Update to Pixi 1.5 - this newly released build has lots of internal changes and new features we want to take advantage of.
- Integration of the p2.js physics system and removal of the old ArcadePhysics. Full body dynamics are go!
- Better CocoonJS packaging features (screencanvas, audio checks, etc)
- Fixed width bitmap font support, plus enhanced Bitmap font rendering.
- Significantly optimised render and update loops. We're seeing significant fps improvements across the board.
- Literally hundreds of bug fixes across all core classes.
Beyond version 2.0 here are some of the features planned for the future:
Version 2.1 ("Shienar")
- Enhance the State Management, so you can perform non-destructive State swaps and persistence.
- A more advanced Particle system, one that can render to a single canvas (rather than spawn hundreds of Sprites), more advanced effects, etc.
- Ability to control DOM elements from the core game and layer them into the game.
- Touch Gestures.
- Support for parallel asset loading.
Version 2.2 ("Tarabon")
- Comprehensive testing across Firefox OS devices, CocoonJS and Ejecta.
- Integration with third party services like Google Play Game Services and Amazon JS SDK.
- Flash CC HTML5 export integration.
- Massively enhance the audio side of Phaser. Take more advantage of Web Audio: echo effects, positional sound, etc.
Beyond version 2.2
- Test out packaging with Node-webkit.
- Game parameters stored in Google Docs.
- Look at HiDPI Canvas settings.
- Multiple Camera support.
- DragonBones support.
Contributing
We now have a full Contributors Guide which goes into the process in more detail, but here are the headlines:
If you find a bug then please report it on GitHub Issues or our Support Forum.
If you have a feature request, or have written a game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you! Either post to our forum or email<EMAIL_ADDRESS>If you issue a Pull Request for Phaser, please only do so againt the
dev
branch and not against themaster
branch.Before submitting a Pull Request please run your code through JSHint to check for stylistic or formatting errors. To use JSHint, first install it by running
npm install jshint
, then test your code by runningjshint src
. This isn't a strict requirement and we are happy to receive Pull Requests that haven't been JSHinted, so don't let it put you off contributing, but do know that we'll reformat your source before going live with it.
Bugs?
Please add them to the Issue Tracker with as much info as possible, especially source code demonstrating the issue.
"Being negative is not how we make progress" - Larry Page, Google
License
Phaser is released under the MIT License.


Located 10nm south of Ancona, this small port sits at the base of a cliff, on top of which is the main village.
Position 43°30.7'N, 13°37.5'E.
The harbour must be entered using the southern entrance.
Moor in the marina as directed.
This port is sheltered, but in strong winds with any east in them, as swell will penetrate the harbour.
Last updated March 2010.


--- title: Political Economy and Rock n' Roll in Pre-Pol Pot Cambodia date: 2014-09-20 09:18:16 Z categories: - Not data tags: - Cambodia - Music layout: post type: post status: publish author: Nathaniel ---
(A respite from data- - ) In the 1960s and 70s Cambodia was home an emergent rock scene, inspired by Western rock that was rolling its way into the region. The rise of the Khmer Rouge put a swift end to a subversive subculture. As in the clips below, youth culture isn't quite compatible with authoritarianism...much less a utopian regime attempting a hard reboot of society to "year zero."
A new documentary, "Don't Think I've Forgotten: Cambodia's Lost Rock and Roll", has captured the full story:
A nod to the archivist and digitization effort--and how (literal) records survived a regime that wiped out property and artists alike:
Photo from: KI Media blog.
Project, one of many: Don't Think I've Forgotten - Cambodia's Lost Rock & Roll


| Property Description | Item Age | Original Cost | Replacement Value | Amount Claimed | |
|---|---|---|---|---|---|
|
|
|
AUD$
|
AUD$
|
AUD$
|


HNG-Fun Project Site
Agbola Tobi
Slack Name:- tobiagbola
I am Agbola Tobi a Website and Mobile Applications Developer. I have been writing code for over 6 years and i have worked on various websites and mobile applications
I Graduated with a Bachelor of Science in Computer Information System from Babcock university.
Wanna know anything else about me? Do hit me up using my slack username


- 2017-12-10T11:04:41.542000-06:00
- Introducing Nerium
- 2016-12-22T15:11:04-06:00
- Stupid bash tricks No. 17: Editing on the fly
- 2016-11-29T10:15:02-06:00
- iAdOps and Second-System Effect
- 2016-11-17T15:38:53-06:00
- Stackdriver custom metrics
- 2016-11-08T12:07:58-06:00
- Postgres Monitoring Trial Findings
- 2016-10-11T18:04:22+00:00
- Postgres Monitoring
- 2016-07-19T03:31:03+00:00
- Stackdriver
- 2016-07-14T17:42:15+00:00
- Using pg_service.conf with Luigi
- 2016-07-13T16:13:30+00:00
- pg_service + psycopg2 = ❤
- 2016-06-29T22:54:20+00:00
- Corrupt database disk issue at GCE
- 2016-06-23T07:24:35-05:00
- Self-referential TODO
- 2016-05-18T00:00:00-05:00
- Distinct line items from DFP line item service
- 2016-05-11T07:24:35-05:00
- Handling fact updates
- 2016-05-09T00:00:00-05:00
- Slowly-changing dimension handling for dim_line_item


Animation, queue and delay methods
This example shows you how using gwtquery to make animation
start movement animation
stop movement animation
start color animation
stop color animation


Roger Mellor<EMAIL_ADDRESS>I've Gotta Horse (1965) (UK)
Billy (Fury) is mad about animals.  Instead he returns to the theatre in Great Yarmouth where he is rehearsing his summer show singing, for all the world to hear , 'I've gotta horse'. For behind the Landrover, spilling over with dogs, he is towing a horse box containing Armitage, a horse with a bleak future, which Billy considers a bargain 40 Guineas. In the stalls of the theatre, Billy's manager (Hymie, played by Michael Medwin),his secretary (Jo, Amanda Barrie) and the producer(Bartholomew, Bill Fraser) watch Billy singing a tender love song with mixed feelings. Bartholomew is simmering with rage over Billy's unpunctuality; Hymie is anxious for his client - and as for Jo - she is lost in world of dreams in which the words of love are being sung only for her.
Meanwhile Billy has vanished from the theatre to arrange for the beach donkey man and his grandson to stable and feed Armitage at his farm. Hymie's warning to Billy that his preoccupation with his dogs and now with his horse could have a dramatic effect on his contract with Bartholomew falls on stony ground. For,on the the same day, in spite of the protest of the stage manager Jock, Billy brings Armitage backstage to shelter from the rain. Chaos rensues when the horse becomes entangled with the lighting system to which his rein had been tied. Hymie, a racing man at heart, takes a new interest in Armitage, when, after being groomed and properly cared for, the horse is pronounced good enough to enter for the Yarmouth races. When Armitage comes in 3rd at tremendous odds, Jo, loyal to the core wins a small fortune from Hymie, who has backed the winner but taken her bet.
Billy invites the whole company of the show to a barbeque to celebrate Armitag's success. Jo is mortified when Billy fails to notice the eye catching gown she had brought with her winnings for his benefit. She relents later when he tells her in a quiet corner of the barn how his early life has led to his attachment to animals. Bert breaks the news that Armitage has caught pneumonia, and depressed, Billy loses all interest in his work. To lift his spirits, Hymie buys a Derby runner called 'Anselmo' with the proceeds of Billy's recording royalties. Billy announces that he intends to go to Epsom to see Anselmo run, even though the date coincides with the opening night of the show. Hymie's misgivings are matched by the prospect of having a front seat at the Derby as an owner's friend, and finally the whole company turns up at Epsom in a vintage coach, having stopped en route in London to be fitted out for the occasion.  Billy is a proud owner indeed when Anselmo, a complete outsider, comes 4th. On the return to Yarmouth, it is touch and go whether they will make it to the theatre on time. But they do, and Bartholomew is too relieved to see them to raise any objection. They open the show, still in their Derby suits, with Billy triumphantly singing "I'VE GOTTA HORSE"..............
Directed by Kenneth Hume, 'I've Gotta Horse'' is simply designed as a vehicle for early sixties pop singer BuIlly Fury and produced by his manager Larry Parnes, and whether you like it or not depends entirely on whether you like Fury or not. At the peak of his fame, Billy Fury used to play a summer season at the Windmill Theatre, Great Yarmouth in a Rock and Roll Revue with Marty Wilde and other Larry Parnes acts. Much of 'I've Gotta Horse' was actually shot in Great Yarmouth while Billy was appearing in the stage show during the evenings. The theatre used in the movie is the 'Royal Aquarium', a larger venue than the Windmill , and hence more suited to filming. Billy Fury's Stage show was much more rock and roll orientated than the movie, which is clearly designed to follow the precedent of the ABPC Cliff Richard musicals, and move Billy Fury more into the 'family entertainer' field. (see also Joe Brown in "Three Hats For Lisa" another British musical movie of this period, with songs by Leslie Bricusse). The songs (with music and lyrics mainly by David Heneker and John Taylor) include: "I've Gotta Horse" (Billy Fury), Stand by Me (BF), Do the Old Soft Shoe (BF, Sheila O'Neill ), I Cried All Night (The Gamblers),Far Far Away (The Bachelors), I Like Animals (BF), Find Your Dream (BF) (by John Taylor), Dressed Up for a Man (Amanda Barrie, Sheila O'Neill), He's Got The Whole World In His Hands (The Bachelors), Won't Somebody Tell Me Why? (BF) , Problems (Michael Medwin and Amanda Barrie), You've Got To Look Right For The Part (Billy Fury, Jon Pertwee, Amanda Barrie, Michael Medwin) and Wonderful Day (Song By Michael Leander). The pop material is blended with some attractive musical comedy songs by David Heneker and John Taylor, of which for me the standout number is "You've Got To Look Right For The Part" set in a studio fashion store, with a nifty bit of product placement for 'Cecil Gee' of Shaftesbury Avenue (a store where the really trendy young men of the sixties obtained their kit). Choreography is by Ross Taylor. It is an enjoyable mix of 60's pop and musical comedy mumbers, well photographed in attractive colour. As for Billy Fury: well, he does not always look entirely comfortable in the musical comedy numbers, as he always has the lean and hungry look of the rock and roller about him! Not charismatic outside of the pop numbers, he comes across as quite natural (he cannot act at all!) and shy, and this, together with handsome boyish looks, clearly accounted for the large number of teenage girls who wanted to mother him in the early 1960's. He receives excellent support from such reliable actors as Michael Medwin and Bill Fraser, both on excellent form, And Amanda Barrie performs well in an underwritten part - it is surely no co-incidence that Amanda Barrie resembles Una Stubbs (in Summer Holiday) hairstyle and everything! It was filmed on location in and near Great Yarmouth, Norfolk, at the Royal Aquarium Theatre Great Yarmouth, Great Yarmouth racecourse, Epsom racecourse (Derby Scenes) and at Shepperton Studios.
Roger Mellor<EMAIL_ADDRESS>Check out the British Musical Movies website at: http://britmusicalfilm.webjump.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Stage 0: Getting Started with HTML
Basic of the Web and html
World wide Web (WWW) consists of HTML pages that uses HyperText Markup Language (HTML) to markup the pages that the web browser interpets and renders to the user.
HTML pages are linked together with Hyper Links (links).
The web was invented in the early 1990s and have over 30 Billion pages.
Examples of files that can be found on the web:
- Plain text
- HTML
- Images
- Videos
- Music
Major Pieses of the web
- The user that consist of:
- Computer
- Browser
- A program that runs on the computer to display files found on the web.
- The Internet
- The worlds largest computer network.
- Servers
- Computers that host the files that make up the web.
- The browser communicates with the servers over the internet using HTTP.
- HTTP - the main protocol of the web.
HTML is mad up of
- Text content.
- Markup.
- References to other documents.
- Links to other pages.
HTML Markup
HTML Tags
<NAME>content</NAME>
Opening Tag: <NAME>
Closing Tag: </NAME>
Element Content: content
Element: <NAME>content</NAME> (The HTML element is everything from the Opening Tag to the Closing Tag.)
| Tag | Description | Example | Result |
|---|---|---|---|
|  | Defines bold text | This is normal text - and this is bold text. | This is normal text - and this is bold text. |
|  | Defines emphasized text | This is normal text - and this is emphasized text. | This is normal text - and this is emphasized text. |
|  | Defines a hyperlink | udacity.com | udacity.com |
|  | Defines an image (VOID Tag) |  | |
|
 | Defines a single line break (VOID Tag) | Line 1
Line 2 | Line 1 Line 2 |
|
 | Defines a single line break (VOID Tag) |
Paragraph 1

Paragraph 2
 | Paragraph 1 Paragraph 2 |
|
 | Defines a section in a document The tag defines a division or a section in an HTML document. The tag is used to group block-elements to format them with CSS. |

Paragraph 1

Paragraph 2

 | Paragraph 1 Paragraph 2 |
|  | Defines a section in a document The tag is used to group inline-elements in a document. The tag provides no visual change by itself. The tag provides a way to add a hook to a part of a text or a part of a document. |

Paragraph text
 | Paragraph text |
HTML Attributes
<TAG ATTR="value">Content</TAG>
Example: udacity.com
Attribute Name: href
Attribute Value: http://www.udacity.com
| Attribute | Description | Example |
|---|---|---|
| href | Specifies the URL of the page the link goes to. | udacity.com |
| src | Specifies the URL of the media file. |  |
| alt | Specifies an alternate text when the original element fails to display. |  |
Inline vs Block
Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.
Block-level Elements
A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).
Examples of block-level elements:
-

-
 -

-

- <form>
Inline Elements
An inline element does not start on a new line and only takes up as much width as necessary.
Examples of block-level elements:
-
-
-


CHAPTER 440D
NO RULES COMBAT OR SIMILAR CONTESTS
REPEALED. L 2007, c 279, §2.
Cross References
For present provisions, see chapter 440E.


UK Dividend Tax Calculator
Gross Salary (£):
Gross Other Income (£):
Net Dividend (£):
UK Dividend Tax Calculator – Results
Band
Rate
Lower Limit
Upper Limit
Tax
Basic Rate
7.5%
0
£32000
Higher Rate
32.5%
£32000
£150000
Additional Rate
38.1%
£150000
---
Total Tax:
powered by
goodcalculators.com


QBOX
How it works
You just made your group! Here's your pin, send it to your friends so that they can add songs.
OK
Cancel


A collection of popular tools hosted on Wikimedia Cloud Services infrastructure curated manually to inspired new contributors. These tools show a wide range of programming languages used to develop them and audiences (developers, editors, researchers, community organizers) they serve.
There are no tools to show :(
{{ app.title }}
{{ app.description }}
{% for topic in app.topics %}
{{ topic }}
{% endfor %}
{% if 'bitbucket' in app.source %}
{% elif 'gitlab' in app.source %}
{% else %}
{% endif %}


Last Sumatran rhino in Malaysia dies
KOTA KINABALU: The last Sumatran rhinoceros in Malaysia died on Saturday (Nov 23), Sabah's tourism, culture and environment minister Christina Liew said.
The female rhinoceros named Iman died at 5.35 pm after suffering from tumours in her uterus. The immediate cause of death was shock, Liew said, quoting the Sabah Wildlife Department.
"Iman was given the very best care and attention ever since her capture in March 2014 right up to the moment she passed. No one could have done more.
"She was actually quite close to death when sudden massive blood loss from the uterine tumours occurred on several occasions over the past few years,” Liew said in a statement.
"The team at Tabin provided round-the-clock intensive support and successfully brought her back to good health and egg cell production on several occasions," she added.
The state had hoped to obtain some egg cells from Iman for the proposed Malaysia-Indonesia collaboration on the species.
Liew said there are still ways in which the two countries can collaborate based on their different experiences over the past decade.
"For Sabah that includes management of female Sumatran rhinos with reproductive pathology, safe harvesting of gametes from living rhinos, and cell culture.
"Iman and Tam both live on as cell cultures in Malaysia," she said.
 He died in May following a bout of ill health.
Sabah Wildlife Department director Augustine Tuuga in the same statement said Iman’s death came sooner than the department expected, but they knew that the she was starting to suffer significant pain from the growing pressure of the tumour into her bladder.


Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.
Dialogs contain text and UI controls. They retain focus until dismissed or a required action has been taken. Use dialogs sparingly because they are interruptive.
Some dialog types include:
Dialogs should never be obscured, either by other elements or the screen edge. Dialogs always retain focus until dismissed or a required action has been taken.
Full-screen dialogs are best suited to complex tasks, or require an input method editor, as they group a series of tasks together before they can be saved.


AuthorizationResponse extends ApiResponse
Response from Authlete's /api/auth/authorization API.
Note: In the description below, "authorization server" is always used even where "OpenID provider" should be used.
Authlete's /api/auth/authorization
API returns JSON which can be mapped
to this class. The authorization server implementation should retrieve the
value of the action
response parameter (which can be obtained by
getAction()
method) from the response and take the following steps
according to the value.
When the value returned from getAction()
method is
AuthorizationAction::$INTERNAL_SERVER_ERROR
, it means that the request
from the authorization server implementation was wrong or that an error
occurred in Authlete. In either case, from a viewpoint of the client
application, it is an error on the server side. Therefore, the
authorization server implementation should generate a response to the
client application with the HTTP status of 500 Internal Server Error
.
Authlete recommends application/json
as the content type although OAuth
2.0 specification does not mention the format of the error response when
the redirect URI is not usable.
In this case, getResponseContent()
method returns a JSON string which
describes the error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server
implementation should generate and return to the client application.
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
AuthorizationAction::$BAD_REQUEST
, it means that the request from the
client application was invalid. The HTTP status of the response returned
to the client application should be 400 Bad Request
and Authlete
recommends application/json
as the content type although OAuth 2.0
specification does not mention the format of the error response when the
redirect URI is not usable.
In this case, getResponseContent()
method returns a JSON string which
describes the error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server
implementation should generate and return to the client application.
HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
AuthorizationAction::$LOCATION
, it means that the request from the
client application is invalid but the redirect URI to which the error
should be reported has been determined. The HTTP status of the response
returned to the client application should be 302 Found
and the Location
header must have a redirect URI with an error
response parameter.
In this case, getResponseContent()
method returns the redirect URI which
has the error
response parameter, so it can be used as the value of
Location
header. The following illustrates the response which the
authorization server implementation should generate and return to the
client application.
HTTP/1.1 302 Found
Location: (The value returned from getResponseContent())
Cache-Control: no-store
Pragma: no-cache
When the value returned from getAction()
method is
AuthorizationAction::$FORM
, it means that the request from the client
application is invalid but the redirect URI to which the error should be
reported has been determined, and that the request contains
response_mode=form_post
as is defined in
OAuth 2.0 Form Post Response Mode.
The HTTP status of the response returned to the client application should
be 200 OK
and the content type should be text/html;charset=UTF-8
.
In this case, getResponseContent()
method returns an HTML which satisfies
the requirements of response_mode=form_post
, so it can be used as the
entity body of the response. The following illustrates the response which
the authorization server implementation should generate and return to the
client application.
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
AuthorizationAction::$NO_INTERACTION
, it means that the request from the
client application has no problem and requires the authorization server to
process the request without displaying any user interface for authentication
and/or consent. This happens when the request contains prompt=none
.
In this case, the authorization server implementation should follow the steps below.
-
[END-USER AUTHENTICATION]
Check whether an end-user has already logged in. If an end-user has logged in, go to the next step ([MAX AGE]). Otherwise, call Authlete's
/api/auth/authorization/fail
API withreason=NOT_LOGGED_IN
and use the response from the API to generate a response to the client application.
+ **[MAX AGE]**
Get the value of the max age by `getMaxAge()` method. The value
represents the maximum authentication age which has come from the
`max_age` request parameter or the `default_max_age` configuration
parameter of the client application. If the value is 0, go to the
next step (**[SUBJECT]**). Otherwise, follow the sub steps described
below.
1. Get the time at which the end-user was authenticated. Note that
this value is not managed by Authlete, meaning that it is expected
that the authorization server implementation manages the value.
If the authorization server implementation does not manage
authentication time of end-users, call Authlete's
`/api/auth/authorization/fail` API with
`reason=MAX_AGE_NOT_SUPPORTED` and use the response from the API
to generate a response to the client application.
2. Add the value of the maximum authentication age (which is
represented in seconds to the authentication time.
3. Check whether the calculated value is equal to or greater than
the current time. If this condition is satisfied, go to the next
step (**[SUBJECT]**). Otherwise, call Authlete's
`/api/auth/authorization/fail` API with `reason=EXCEEDS_MAX_AGE`
and use the response from the API to generate a response to the
client application.
+ **[SUBJECT]**
Get the value of the requested subject by `getSubject()` method.
The value represents an end-user who the client application expects
to grant authorization. If the value is `null`, go to the next step
(**[ACRs]**). Otherwise, follow the sub steps described below.
1. Compare the value of the requested subject to the subject (=
unique user ID) of the current end-user.
2. If they are equal, go to the next step (**[ACRs]**).
3. If they are not equal, call Authlete's `/api/auth/authorization/fail`
API with `reason=DIFFERENT_SUBJECT` and use the response from the
API to generate a response to the client application.
+ **[ACRs]**
Get the value of ACRs (Authentication Context Class References) by
`getAcrs()` method. The value has come from (1) the `acr` claim in
the `claims` request parameter, (2) the `acr_values` request parameter,
or (3) the `default_acr_values` configuration parameter of the client
application.
It is ensured that all the ACRs returned by `getAcrs()` method are
supported by the authorization server implementation. In other words,
it is ensured that all the ACRs are listed in the
`acr_values_supported` configuration parameter of the authorization
server.
If the value of ACRs is `null`, go to the next step (**[SCOPES]**).
Otherwise, follow the sub steps described below.
1. Get the ACR performed for the authentication of the current
end-user. Note that this value is managed not by Authlete but by
the authorization server implementation. (If the authorization
server implementation cannot handle ACRs, it should not have
listed ACRs in the `acr_values_supported` configuration parameter.)
2. Compare the ACR value obtained in the above step to each element
in the ACR array obtained by `getAcrs()` method in the listed
order. If the ACR value was found in the array, go to the next
step (**[SCOPES]**).
3. If the ACR value was not found in the ACR array (= if the ACR
performed for the authentication of the current end-user did not
match any one of the ACRs requested by the client application),
check whether one of the requested ACRs must be satisfied or not
by calling `isAcrEssential()` method. If `isAcrEssential()`
returns `true`, call Authlete's `/api/auth/authorization/fail`
API with `reason=ACR_NOT_SATISFIED` and use the response from
the API to generate a response to the client application.
Otherwise, go to the next step (**[SCOPES]**).
+ **[SCOPES]**
Get the scopes by `getScopes()` method. If the array contains one or
more scopes which have not been granted to the client application by
the end-user in the past, call Authlete's
`/api/auth/authorization/fail` API with `reason=CONSENT_REQUIRED` and
use the response from the API to generate a response to the client
application. Otherwise, go to the next step (**[ISSUE]**).
Note that Authlete provides APIs to manage records of granted scopes
(`/api/client/granted_scopes/*` APIs), but the APIs work only in the
case the Authlete server you use is a dedicated Authlete server
(contact [sales<EMAIL_ADDRESS>for details).
In other words, the APIs of the shared Authlete server are disabled
intentionally (in order to prevent garbage data from being accumulated)
and they return `403 Forbidden`.
+ **[ISSUE]**
If all the above steps succeeded, the last step is to issue an
authorization code, an ID token and/or an access token
(`response_type=none` is a special case where nothing is issued).
The last step can be performed by calling Authlete's
`/api/auth/authorization/issue` API. The API requires the following
parameters, which are represented as properties of the
`AuthorizationIssueRequest` class. Prepare these parameters and call
the `/api/auth/authorization/issue` API.
* `ticket` (required): This parameter represents a ticket which is
exchanged with tokens at the `/api/auth/authorization/issue` API.
Use the value returned from `getTicket()` method as it is.
* `subject` (required): This parameter represents the unique identifier
of the current end-user. It is often called "User ID" and it may or
may not be visible to the end-user. In any case, it is a number or a
string assigned to the end-user by your service. Authlete does not
care about the format of the value of the subject, but it must
consist of only ASCII letters and its length must be equal to or less
than 100.
When `getSubject()` method of `AuthorizationResponse` class
returns a non-null value, the value of `subject` request parameter
to `/api/auth/authorization/issue` API is necessarily identical.
The value of this request parameter will be embedded in an ID token
as the value of the `sub` claim. When the value of the `subject_type`
configuration parameter of the client is `PAIRWISE`, the value of the
`sub` claim is different from the value specified here, but `PAIRWISE`
is not supported by Authlete yet. See
[8. Subject Identifier Types](https://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes)
of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)
for details about subject types.
You can use the `sub` request parameter to adjust the value of the
`sub` claim in an ID token. See the description of the `sub` request
parameter for details.
* `authTime` (optional): This parameter represents the time when the
end-user authentication occurred. Its value is the number of seconds
since the Unix epoch (1970-Jan-1). The value of this parameter will
be embedded in an ID token as the value of the `auth_time` claim.
* `acr` (optional): This parameter represents the ACR (Authentication
Context Class Reference) which the authentication of the end-user
satisifes. When `getAcrs()` method returns a non-empty array and
`isAcrEssential()` method returns `true`, the value of this parameter
must be one of the array elements. Otherwise, even `null` is allowed.
The value of this parameter will be embedded in an ID token as the
value of the `acr` claim.
* `claims` (optional): This parameter represents claims of the end-user.
"Claims" here are pieces of information about the end-user such as
`name`, `email` and `birthdate`. The authorization server
implementation is required to gather claims of the end-user, format
the claim values into JSON and set the JSON string as the value of
this parameter.
The claims which the authorization server implementation is required
to gather can be obtained by `getClaims()` method.
For example, if `getClaims()` method returns an array which contains
`name`, `email` and `birthdate`, the value of this parameter should
look like the following.
```
{
"name": "John Smith",
"email"<EMAIL_ADDRESS>"birthdate": "1974-05-06"
}
```
`getClaimsLocales()` methods lists the end-user's preferred languages
and scripts for claim values, ordered by preference. When
`getClaimsLocales()` method returns a non-empty array, its elements
should be taken into consideration when the authorization server
implementation gathers claim values. Especially, note the excerpt
below from
[5.2. Claims Languages and Scripts](https://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts)
of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html).
> *"When the OP determines, either through the `claims_locales`
> parameter, or by other means, that End-User and Client are
> requesting Claims in only one set of languages and scripts,
> it is RECOMMENDED that OPs return Claims without language
> tags when they employ this language and script. It is also
> RECOMMENDED that Clients be written in a manner that they
> can handle and utilize Claims using language tags."*
If `getClaims()` method returns `null` or an empty array, the value
of this parameter should be `null`.
See [5.1. Standard Claims](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims)
of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)
for claim names and their value formats. Note (1) that the
authorization server implementation may support its special claims
([5.1.2. Additional Claims](https://openid.net/specs/openid-connect-core-1_0.html#AdditionalClaims))
and (2) that claim names may be followed by a language tag
([5.2. Claims Languages and Scripts](https://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts)).
Read the specification of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)
for details.
The claim values in this parameter will be embedded in an ID token.
`getIdTokenClaims()` is available since version 1.7. The method
returns the value of the `id_token` property in the `claims`
request parameter or in the `claims` property in a request object.
The value returned from the method should be considered when you
prepare claim values. See the description of the method for details.
* `properties` (optional): Extra properties to be associated with an
access token and/or an authorization code that may be issued from
the Authlete API. Note that the `properties` request parameter is
accepted only when `Content-Type` of the request to Authlete's
`/api/auth/authorization/issue` API is `application/json`, so don't
use `application/x-www-form-urlencoded` if you want to use this
request parameter.
* `scopes` (optional): Scopes to be associated with an access token
and/or an authorization code. If this parameter is `null`, the
scopes specified in the original authorization request from the
client application are used. In other cases, the specified scopes
by this parameter will replace the scopes contained in the original
authorization request.
Even scopes that are not included in the original authorization
request can be specified. However, as an exception, the `openid`
scope is ignored on Authlete server side if it is not included in
the original request. It is because the existence of the `openid`
scope considerably changes the validation steps and because adding
`openid` triggers generation of an ID token (although the client
application has not requested it) and the behavior is a major
violation against the specification.
If you add the `offline_access` scope although it is not included
in the original request, keep in mind that the specification
requires explicit consent from the end-user for the scope
([11. Offline Access](https://openid.net/specs/openid-connect-core-1_0.html#OfflineAccess)
of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)).
When `offline_access` is included in the original authorization
request, the current implementation of Authlete's
`/api/auth/authorization` API checks whether the authorization
request has come along with the `prompt` request parameter and its
value includes `consent`. However, note that the implementation of
Authlete's `/api/auth/authorization/issue` API does not perform the
same validation even if the `offline_access` scope is added via this
`scopes` parameter.
* `sub` (optional): The value of the `sub` claim in an ID token which
may be issued. If the value of this request parameter is not empty,
it is used as the value of the `sub` claim. Otherwise, the value of
the `subject` request parameter is used as the value of the `sub`
claim. The main purpose of this parameter is to hide the actual
value of the subject from client applications.
`/api/auth/authorization/issue` API returns a response in JSON format
which can be mapped to `AuthorizationIssueResponse`. Use the response
from the API to generate a response to the client application. See the
description of `AuthorizationIssueResponse` for details.
When the value returned from getAction()
method is
AuthorizationAction::$INTERACTION
, it means that the request from the
client application has no problem and requires the authorization server
to process the request with user interaction by an HTML form.
The purpose of the UI displayed to the end-user is to ask the end-user to grant authorization to a client application. The items described below are some points which the authorization server implementation should take into consideration when it builds the UI.
-
[DISPLAY MODE]
AuthorizationResponse
containsdisplay
parameter. The value can be obtained bygetDisplay()
method and it is one ofPAGE
(default),POPUP
,TOUCH
andWAP
. The meanings of the values are described in <IP_ADDRESS>. Authentication Request of OpenID Connect Core 1.0. Basically, the authorization server implementation should display the UI which is suitable for the display mode, but it is okay for the authorization server implementation to "attempt to detect the capabilities of the User Agent and present an appropriate display."It is ensured that the value returned from
getDisplay()
method is one of the supported display values which are specified by thedisplay_values_supported
configuration parameter of the authorization server.
+ **[UI LOCALE]**
`AuthorizationResponse` contains `ui_locales` parameter. The value can
be obtained by `getUiLocales()` method and it is an array of language
tag values (such as `fr-CA` and `en`) ordered by preference. The
authorization server implementation should display the UI in one of
the languages listed in the `ui_locales` parameter when possible.
It is ensured that language tags returned from `getUiLocales()`
method are contained in the list of supported UI locales which are
specified by the `ui_locales_supported` configuration parameter of
the authorization server.
+ **[CLIENT INFORMATION]**
The authorization server implementation should show the end-user
information about the client application. The information can be
obtained by `getClient()` method.
+ **[SCOPES]**
A client application requires authorization for specific permissions.
In OAuth 2.0 specification, *"scope"* is a technical term which
represents a permission. `getScopes()` method returns scopes
requested by the client application. The authorization server
implementation should show the end-user the scopes.
The authorization server implementation may choose not to show scopes
to which the end-user has given consent in the past. To put it the
other way around, the authorization server implementation may show
only the scopes to which the end-user has not given consent yet.
However, if the value returned from `getPrompts()` method contains
`Prompt::$CONSENT`, the authorization server implementation has to
obtain explicit consent from the end-user even if the end-user has
given consent to all the requested scopes in the past.
Note that Authlete provides APIs to manage records of granted scopes
(`/api/client/granted_scopes/*` APIs), but the APIs work only in the
case the Authlete server you use is a dedicated Authlete server
(contact [sales<EMAIL_ADDRESS>for details).
In other words, the APIs of the shared Authlete server are disabled
intentionally (in order to prevent garbage data from being accumulated)
and they return `403 Forbidden`.
It is ensured that scopes returned from `getScopes()` method are
contained in the list of supported scopes parameter of the
authorization server.
+ **[END-USER AUTHENTICATION]**
Necessarily, the end-user must be authenticated (= must login your
service) before granting authorization to the client application.
Simply put, a login form is expected to be displayed for end-user
authentication. The authorization server implementation must follow
the steps described below to comply with OpenID Connect. (Or just
always show a login form if it's too much of a bother to follow the
steps below).
1. Get the value from `getPrompts()` method. It corresponds to the
value of the `prompt` request parameter. Details of the request
parameter are described in
[<IP_ADDRESS>. Authentication Request](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest)
of [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html).
2. If the value returned from `getPrompts()` method contains
`Prompt::$SELECT_ACCOUNT`, display a form to urge the end-user
to select one of his/her accounts for login. If `getSubject()`
method returns a non-null value, it is the end-user ID that the
client application expects, so the value should be used to
determine the value of the login ID. Note that a subject and a
login ID are not necessarily equal. If `getSubject()` method
returns `null`, the value returned from `getLoginHint()` method
should be referred to as a hint to determine the value of the
login ID. `getLoginHint()` method simply returns the value of
the `login_hint` request parameter.
3. If the value returned from `getPrompts()` method contains
`Prompt::$LOGIN`, display a form to urge the end-user to login
even if the end-user has already logged in. If `getSubject()`
method returns a non-null value, it is the end-user ID that the
client application expects, so the value should be used to
determine the value of the login ID. Note that a subject and a
login ID are not necessarily equal. If `getSubject()` method
returns `null`, the value returned from `getLoginHint()` should
be referred to as a hint to determine the value of the login ID.
`getLoginHint()` method simply returns the value of the
`login_hint` request parameter.
4. If the value returned from `getPrompts()` method does not contain
`Prompt::$LOGIN`, the authorization server implementation does not
have to authenticate the end-user if all the conditions described
below are satisfied. If any one of the condisionts is not satisfied,
show a login form to authenticate the end-user.
* An end-user has already logged in your service.
* The login ID of the current end-user matches the value returned
from the `getSubject()` method. This check is required only when
the `getSubject()` method returns a non-null value.
* The max age, which is the number of seconds obtained by
`getMaxAge()` method, has not passed since the current end-user
logged in your service. This check is required only when
`getMaxAge()` method returns a non-zero value.
If the authorization server implementation does not manage
authentication time of end-users (= if the authorization server
implementation cannot know when end-users logged in) and if
`getMaxAge()` method returns a non-zero value, a login form
should be displayed.
* The ACR (Authentication Context Class Reference) of the
authentication performed for the current end-user satisfies one
of the ACRs listed in the value returned from `getAcrs()` method.
This check is required only when `getAcrs()` method returns a
non-empty array.
In every case, the end-user authentication must satisfy one of the ACRs
listed in the value returned from `getAcrs()` method when the method
returns a non-empty array and `isAcrEssential()` method returns `true`.
+ **[GRANT/DENY BUTTONS]**
The end-user is supposed to choose either (1) to grant authorization
to the client application or (2) to deny the authorization request.
The UI must have UI components to accept the decision by the end-user.
Usually, a button to grant authorization and a button to deny the
request are provided.
When the subject returned from `getSubject()` method is not `null`, the end-user authentication must be performed for the subject, meaning that the authorization server implemetation should repeatedly show a login form until the subject is succesfully authenticated.
The end-user will choose either (1) to grant authorization to the client
application or (2) to deny the authorization request. When the end-user
chose to deny the authorization request, call Authlete's
/api/auth/authorization/fail
API with reason=DENIED
and use the
response from the API to generate a response to the client application.
When the end-user chose to grant authorization to the client application,
the authorization server implementation has to issue an authorization code,
an ID token, and/or an access token to the client application
(response_type=none
is a special case where nothing is issued). Issuing
the tokens can be performed by calling Authlete's
/api/auth/authorization/issue
API. Read [ISSUE] written above in the
description for the case of action=NO_INTERACTION
.
Table of Contents
- copyFromArray() : mixed
- Copy the content of the given array into this object.
- copyToArray() : mixed
- Copy the content of this object into the given array.
- fromArray() : static
- Convert an array into an instance of this class.
- fromJson() : static
- Convert a JSON string into an instance of this class.
- getAcrs() : array<string|int, string>
- Get the list of ACRs (Authentication Context Class References) requested by the client application.
- getAction() : AuthorizationAction
- Get the next action that the authorization server implementation should take.
- getClaims() : array<string|int, string>
- Get the list of claims that the client application requested to be embedded in an ID token.
- getClaimsLocales() : array<string|int, string>
- Get the list of preferred languages and scripts for claim values contained in an ID token.
- getClient() : Client
- Get the information about the client application that has made the authorization request.
- getDisplay() : Display
- Get the display mode which the client application requested by the `display` request parameter.
- getIdTokenClaims() : string
- Get the value of the "id_token" property in the "claims" request parameter or in the "claims" property in a request object.
- getLoginHint() : string
- Get the loogin hint specified by the "login_hint" request parameter.
- getMaxAge() : int|string
- Get the maximum authentication age which is the allowable elapsed time in seconds since the last time the end-user was actively authenticated by the authorization server implementation.
- getPrompts() : array<string|int, Prompt>
- Get the list of prompts contained in the authorization request.
- getPurpose() : string
- Get the value of the `purpose` request parameter.
- getRequestObjectPayload() : string
- Get the payload part of the request object.
- getResources() : array<string|int, string>
- Get the resources specified by the `resource` request parameters or by the `resource` property in the request object. If both are given, the values in the request object take precedence.
- getResponseContent() : string
- Get the response content which can be used to generate a response to the client application.
- getResultCode() : string
- Get the code of the result of an Authlete API call.
- getResultMessage() : string
- Get the message of the result of an Authlete API call.
- getScopes() : array<string|int, Scope>
- Get the scopes which the client application requested by the `scope` request parameter.
- getService() : Service
- Get the information about the service.
- getSubject() : string
- Get the subject (= unique identifier) of the end-user that the client application requested.
- getTicket() : string
- Get the ticket issued from Authlete's `/api/auth/authorization` API to the authorization server implementation.
- getUiLocales() : array<string|int, string>
- Get the list of preferred languages and scripts for the user interface.
- getUserInfoClaims() : string
- Get the value of the "userinfo" property in the "claims" request parameter or in the "claims" property in a request object.
- isAcrEssential() : bool
- Get the flag which indicates whether the end-user authentication must satisfy one of the requested ACRs.
- isClientIdAliasUsed() : bool
- Get the flag which indicates whether the value of the `client_id` request parameter included in the authorization request is the client ID alias or the original numeric client ID.
- setAcrEssential() : AuthorizationResponse
- Set the flag which indicates whether the end-user authentication must satisfy one of the requested ACRs.
- setAcrs() : mixed
- Set the list of ACRs (Authentication Context Class References) requested by the client application.
- setAction() : AuthorizationResponse
- Set the next action that the authorization server implementation should take.
- setClaims() : AuthorizationResponse
- Set the list of claims that the client application requested to be embedded in an ID token.
- setClaimsLocales() : AuthorizationResponse
- Set the list of preferred languages and scripts for claim values contained in an ID token.
- setClient() : AuthorizationResponse
- Set the information about the client application that has made the authorization request.
- setClientIdAliasUsed() : AuthorizationResponse
- Set the flag which indicates whether the value of the `client_id` request parameter included in the authorization request is the client ID alias or the original numeric client ID.
- setDisplay() : AuthorizationResponse
- Set the display mode which the client application requested by the `display` request parameter.
- setIdTokenClaims() : AuthorizationResponse
- Set the value of the `id_token` property in the `claims` request parameter or in the `claims` property in a request object.
- setLoginHint() : AuthorizationResponse
- Set the loogin hint specified by the "login_hint" request parameter.
- setMaxAge() : AuthorizationResponse
- Set the maximum authentication age which is the allowable elapsed time in seconds since the last time the end-user was actively authenticated by the authorization server implementation.
- setPrompts() : AuthorizationResponse
- Set the list of prompts contained in the authorization request.
- setPurpose() : AuthorizationResponse
- Set the value of the `purpose` request parameter.
- setRequestObjectPayload() : AuthorizationResponse
- Set the payload part of the request object.
- setResources() : AuthorizationResponse
- Set the resources specified by the `resource` request parameters or by the `resource` property in the request object. If both are given, the values in the request object should be set.
- setResponseContent() : AuthorizationResponse
- Set the response content which can be used to generate a response to the client application.
- setResultCode() : ApiResponse
- Set the code of the result of an Authlete API call.
- setResultMessage() : ApiResponse
- Set the message of the result of an Authlete API call.
- setScopes() : AuthorizationResponse
- Set the scopes which the client application requested by the `scope` request parameter.
- setService() : AuthorizationResponse
- Set the information about the service.
- setSubject() : AuthorizationResponse
- Set the subject (= unique identifier) of the end-user that the client application requested.
- setTicket() : AuthorizationResponse
- Set the ticket issued from Authlete's `/api/auth/authorization` API to the authorization server implementation.
- setUiLocales() : AuthorizationResponse
- Set the list of preferred languages and scripts for the user interface.
- setUserInfoClaims() : AuthorizationResponse
- Set the value of the `userinfo` property in the `claims` request parameter or in the `claims` property in a request object.
- toArray() : array<string|int, mixed>
- Convert this object into an array.
- toJson() : string
- Convert this object into a JSON string.
Methods
copyFromArray()
Copy the content of the given array into this object.
public
copyFromArray(array<string|int, mixed> &$array) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —copyToArray()
Copy the content of this object into the given array.
public
copyToArray(array<string|int, mixed> &$array) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —fromArray()
Convert an array into an instance of this class.
public
static fromArray([array<string|int, mixed> $array = null ]) : static
This static function returns a new instance of this class.
If $array
is null
, null
is returned.
Parameters
- $array : array<string|int, mixed> = null
-
An array
Return values
static —An instance of this class.
fromJson()
Convert a JSON string into an instance of this class.
public
static fromJson(string $json) : static
This static function returns a new instance of this class.
If $json
is null
or the type of $json
is not string
,
null
is returned.
Parameters
- $json : string
-
A JSON string.
Return values
static —An instance of this class.
getAcrs()
Get the list of ACRs (Authentication Context Class References) requested by the client application.
public
getAcrs() : array<string|int, string>
The value of this property comes from (1) the acr
claim in the
claims
request parameter, (2) the acr_values
request parameter,
or (3) the default_acr_values
configuration parameter of the client
application.
Regarding the claims
request parameter, see
5.5. Requesting Claims using the "claims" Request Parameter
of OpenID Connect Core 1.0.
Regarding the acr_values
request parameter, see
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Regarding the default_acr_values
configuration parameter of the
client application, see
2. Client Metadata
of OpenID Connect Dynamic Client Registration 1.0.
Return values
array<string|int, string> —The ACRs requested by the client application.
getAction()
Get the next action that the authorization server implementation should take.
public
getAction() : AuthorizationAction
Return values
AuthorizationAction —The next action that the authorization server implementation should take.
getClaims()
Get the list of claims that the client application requested to be embedded in an ID token.
public
getClaims() : array<string|int, string>
The value of this property comes from the scope
and/or claims
request parameters of the original authorization request.
Return values
array<string|int, string> —The list of claims requested by the client application.
getClaimsLocales()
Get the list of preferred languages and scripts for claim values contained in an ID token.
public
getClaimsLocales() : array<string|int, string>
The value of this property comes from the claims_locales
request
parameter. See
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Return values
array<string|int, string> —The list of preferred languages and scripts for claim values.
getClient()
Get the information about the client application that has made the authorization request.
public
getClient() : Client
Return values
Client —The information about the client application.
getDisplay()
Get the display mode which the client application requested by the `display` request parameter.
public
getDisplay() : Display
When the authorization request does not contain the display
request
parameter, this method returns Display::$PAGE
as the default value.
Return values
Display —The display mode.
getIdTokenClaims()
Get the value of the "id_token" property in the "claims" request parameter or in the "claims" property in a request object.
public
getIdTokenClaims() : string
A client application may request certain claims be embedded in an
ID token or in a response from the UserInfo endpoint. There are
several ways. Including the claims
request parameter and including
the claims
property in a request object are such examples. In both
the cases, the value of the claims
parameter/property is JSON. Its
format is described in
5.5. Requesting Claims using the "claims" Request Parameter
of
OpenID Connect Core 1.0.
The following is an excerpt from the specification. You can find
userinfo
and id_token
are top-level properties.
{
"userinfo":
{
"given_name": {"essential": true},
"nickname": null,
"email": {"essential": true},
"email_verified": {"essential": true},
"picture": null,
"http://example.info/claims/groups": null
},
"id_token":
{
"auth_time": {"essential": true},
"acr": {"values": ["urn:mace:incommon:iap:silver"] }
}
}
This method (getIdTokenClaims
) returns the value of the id_token
property in JSON format. For example, if the JSON above is included
in an authorization request, this method returns JSON equivalent to
the following.
{
"auth_time": {"essential": true},
"acr": {"values": ["urn:mace:incommon:iap:silver"] }
}
Note that if a request object is given and it contains the claims
property and if the claims
request parameter is also given, this
method returns the value in the former.
Tags
Return values
string —The value of the id_token
property in the claims
in JSON
format.
getLoginHint()
Get the loogin hint specified by the "login_hint" request parameter.
public
getLoginHint() : string
Regarding the login_hint
request parameter, see
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Return values
string —The value of the login_hint
request parameter.
getMaxAge()
Get the maximum authentication age which is the allowable elapsed time in seconds since the last time the end-user was actively authenticated by the authorization server implementation.
public
getMaxAge() : int|string
The value of this property comes from either (1) the max_age
request
parameter or (2) the default_max_age
configuration parameter of the
client application. 0 may be returned which means that the max age
constraint does not have to be imposed.
Regarding the max_age
request parameter, see
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Regarding the default_max_age
configuration parameter, see
2. Client Metadata
of OpenID Connect Dynamic Client Registration 1.0.
Return values
int|string —The maximum authentication age.
getPrompts()
Get the list of prompts contained in the authorization request.
public
getPrompts() : array<string|int, Prompt>
The value of this property comes from the prompt
request parameter.
See
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Return values
array<string|int, Prompt> —The list of prompts requested by the client application.
getPurpose()
Get the value of the `purpose` request parameter.
public
getPurpose() : string
Tags
Return values
string —The value of the purpose
request parameter.
getRequestObjectPayload()
Get the payload part of the request object.
public
getRequestObjectPayload() : string
This method returns null
if the authorization request does not
include a request object.
Tags
Return values
string —The payload part of the request object in JSON format.
getResources()
Get the resources specified by the `resource` request parameters or by the `resource` property in the request object. If both are given, the values in the request object take precedence.
public
getResources() : array<string|int, string>
Tags
Return values
array<string|int, string> —Resources to be associated with tokens being issued.
getResponseContent()
Get the response content which can be used to generate a response to the client application.
public
getResponseContent() : string
The format of the value varies depending on the value returned from
getAction()
method.
Return values
string —The response content.
getResultCode()
Get the code of the result of an Authlete API call.
public
getResultCode() : string
Return values
string —The result code.
getResultMessage()
Get the message of the result of an Authlete API call.
public
getResultMessage() : string
Return values
string —The result message.
getScopes()
Get the scopes which the client application requested by the `scope` request parameter.
public
getScopes() : array<string|int, Scope>
When the authorization request did not contain the scope
request
parameter, this property returns a list of scopes which are marked
as default. null
may be returned if the authorization request did
not contain valid scopes and none of registered scopes is marked as
default.
You may want to enable end-users to select/deselect scopes in the
authorization page. In other words, you may want to use a different
set of scopes than the set specified by the original authorization
request. You can replace scopes when you call Authlete's
/api/authorization/issue
API. See the description of
AuthorizationIssueRequest::setScopes()
for details.
Return values
array<string|int, Scope> —The scopes requested by the client application.
getService()
Get the information about the service.
public
getService() : Service
Return values
Service —The information about the service.
getSubject()
Get the subject (= unique identifier) of the end-user that the client application requested.
public
getSubject() : string
The value of this property comes from the sub
claim in the claims
request parameter.
Regarding the claims
request parameter, see
5.5. Requesting Claims using the "claims" Request Parameter
of OpenID Connect Core 1.0.
Return values
string —The subject of the end-user that the client application requested.
getTicket()
Get the ticket issued from Authlete's `/api/auth/authorization` API to the authorization server implementation.
public
getTicket() : string
This ticket is necessary to call the /api/auth/authorization/issue
API or the /api/auth/authorization/fail
API.
Return values
string —The ticket issued from /api/auth/authorization
API.
getUiLocales()
Get the list of preferred languages and scripts for the user interface.
public
getUiLocales() : array<string|int, string>
The value of this property comes from the ui_locales
request
parameter. See
<IP_ADDRESS>. Authentication Request
of OpenID Connect Core 1.0.
Return values
array<string|int, string> —The list of preferred languages and scripts for the user interface.
getUserInfoClaims()
Get the value of the "userinfo" property in the "claims" request parameter or in the "claims" property in a request object.
public
getUserInfoClaims() : string
A client application may request certain claims be embedded in an
ID token or in a response from the UserInfo endpoint. There are
several ways. Including the claims
request parameter and including
the claims
property in a request object are such examples. In both
the cases, the value of the claims
parameter/property is JSON. Its
format is described in
5.5. Requesting Claims using the "claims" Request Parameter
of
OpenID Connect Core 1.0.
The following is an excerpt from the specification. You can find
userinfo
and id_token
are top-level properties.
{
"userinfo":
{
"given_name": {"essential": true},
"nickname": null,
"email": {"essential": true},
"email_verified": {"essential": true},
"picture": null,
"http://example.info/claims/groups": null
},
"id_token":
{
"auth_time": {"essential": true},
"acr": {"values": ["urn:mace:incommon:iap:silver"] }
}
}
This method (getUserInfoClaims
) returns the value of the userinfo
property in JSON format. For example, if the JSON above is included
in an authorization request, this method returns JSON equivalent to
the following.
{
"given_name": {"essential": true},
"nickname": null,
"email": {"essential": true},
"email_verified": {"essential": true},
"picture": null,
"http://example.info/claims/groups": null
}
Note that if a request object is given and it contains the claims
property and if the claims
request parameter is also given, this
method returns the value in the former.
Tags
Return values
string —The value of the userinfo
property in the claims
in JSON
format.
isAcrEssential()
Get the flag which indicates whether the end-user authentication must satisfy one of the requested ACRs.
public
isAcrEssential() : bool
This method returns true
only when the authorization request from
the client application contains the claims
request parameter and it
contains an entry for the acr
claim with "essential":true
. See
5.5.1. Individual Claims Requests
of OpenID Connect Core 1.0
for details.
Return values
bool —true
if one of the requested ACRs must be satisfied.
isClientIdAliasUsed()
Get the flag which indicates whether the value of the `client_id` request parameter included in the authorization request is the client ID alias or the original numeric client ID.
public
isClientIdAliasUsed() : bool
Tags
Return values
bool —The flag which indicates whether the client ID alias was used.
setAcrEssential()
Set the flag which indicates whether the end-user authentication must satisfy one of the requested ACRs.
public
setAcrEssential(bool $essential) : AuthorizationResponse
Parameters
- $essential : bool
-
true
if one of the requested ACRs must be satisfied.
Return values
AuthorizationResponse —$this
object.
setAcrs()
Set the list of ACRs (Authentication Context Class References) requested by the client application.
public
setAcrs([array<string|int, string> $acrs = null ]) : mixed
Parameters
- $acrs : array<string|int, string> = null
-
The ACRs requested by the client application.
Return values
mixed —setAction()
Set the next action that the authorization server implementation should take.
public
setAction([AuthorizationAction $action = null ]) : AuthorizationResponse
Parameters
- $action : AuthorizationAction = null
-
The next action that the authorization server implementation should take.
Return values
AuthorizationResponse —$this
object.
setClaims()
Set the list of claims that the client application requested to be embedded in an ID token.
public
setClaims([array<string|int, string> $claims = null ]) : AuthorizationResponse
Parameters
- $claims : array<string|int, string> = null
-
The list of claims requested by the client application.
Return values
AuthorizationResponse —$this
object.
setClaimsLocales()
Set the list of preferred languages and scripts for claim values contained in an ID token.
public
setClaimsLocales([array<string|int, string> $claimsLocales = null ]) : AuthorizationResponse
Parameters
- $claimsLocales : array<string|int, string> = null
-
The list of preferred languages and scripts for claim values.
Return values
AuthorizationResponse —$this
object.
setClient()
Set the information about the client application that has made the authorization request.
public
setClient([Client $client = null ]) : AuthorizationResponse
Parameters
- $client : Client = null
-
The information about the client application.
Return values
AuthorizationResponse —$this
object.
setClientIdAliasUsed()
Set the flag which indicates whether the value of the `client_id` request parameter included in the authorization request is the client ID alias or the original numeric client ID.
public
setClientIdAliasUsed(bool $used) : AuthorizationResponse
Parameters
- $used : bool
-
The flag which indicates whether the client ID alias was used.
Tags
Return values
AuthorizationResponse —$this
object.
setDisplay()
Set the display mode which the client application requested by the `display` request parameter.
public
setDisplay([Display $display = null ]) : AuthorizationResponse
Parameters
- $display : Display = null
-
The display mode.
Return values
AuthorizationResponse —$this
object.
setIdTokenClaims()
Set the value of the `id_token` property in the `claims` request parameter or in the `claims` property in a request object.
public
setIdTokenClaims(string $claims) : AuthorizationResponse
Parameters
- $claims : string
-
The value of the
id_token
property in theclaims
in JSON format.
Tags
Return values
AuthorizationResponse —$this
object.
setLoginHint()
Set the loogin hint specified by the "login_hint" request parameter.
public
setLoginHint(string $hint) : AuthorizationResponse
Parameters
- $hint : string
-
The value of the
login_hint
request parameter.
Return values
AuthorizationResponse —$this
object.
setMaxAge()
Set the maximum authentication age which is the allowable elapsed time in seconds since the last time the end-user was actively authenticated by the authorization server implementation.
public
setMaxAge(int|string $maxAge) : AuthorizationResponse
Parameters
- $maxAge : int|string
-
The maximum authentication age.
Return values
AuthorizationResponse —$this
object.
setPrompts()
Set the list of prompts contained in the authorization request.
public
setPrompts([array<string|int, Prompt> $prompts = null ]) : AuthorizationResponse
Parameters
- $prompts : array<string|int, Prompt> = null
-
The list of prompts requested by the client application.
Return values
AuthorizationResponse —$this
object.
setPurpose()
Set the value of the `purpose` request parameter.
public
setPurpose(string $purpose) : AuthorizationResponse
Parameters
- $purpose : string
-
The value of the
purpose
request parameter.
Tags
Return values
AuthorizationResponse —$this
object.
setRequestObjectPayload()
Set the payload part of the request object.
public
setRequestObjectPayload(string $payload) : AuthorizationResponse
Parameters
- $payload : string
-
The payload part of the request object.
Tags
Return values
AuthorizationResponse —$this
object.
setResources()
Set the resources specified by the `resource` request parameters or by the `resource` property in the request object. If both are given, the values in the request object should be set.
public
setResources([array<string|int, string> $resources = null ]) : AuthorizationResponse
Parameters
- $resources : array<string|int, string> = null
-
Resources to be associated with tokens being issued.
Tags
Return values
AuthorizationResponse —$this
object.
setResponseContent()
Set the response content which can be used to generate a response to the client application.
public
setResponseContent(string $responseContent) : AuthorizationResponse
Parameters
- $responseContent : string
-
The response content.
Return values
AuthorizationResponse —$this
object.
setResultCode()
Set the code of the result of an Authlete API call.
public
setResultCode(string $resultCode) : ApiResponse
Parameters
- $resultCode : string
-
The result code.
Return values
ApiResponse —$this
object.
setResultMessage()
Set the message of the result of an Authlete API call.
public
setResultMessage(string $resultMessage) : ApiResponse
Parameters
- $resultMessage : string
-
The result message.
Return values
ApiResponse —$this
object.
setScopes()
Set the scopes which the client application requested by the `scope` request parameter.
public
setScopes([array<string|int, Scope> $scopes = null ]) : AuthorizationResponse
Parameters
- $scopes : array<string|int, Scope> = null
-
The scopes requested by the client application.
Return values
AuthorizationResponse —$this
object.
setService()
Set the information about the service.
public
setService([Service $service = null ]) : AuthorizationResponse
Parameters
- $service : Service = null
-
The information about the service.
Return values
AuthorizationResponse —$this
object.
setSubject()
Set the subject (= unique identifier) of the end-user that the client application requested.
public
setSubject(string $subject) : AuthorizationResponse
Parameters
- $subject : string
-
The subject of the end-user that the client application requested.
Return values
AuthorizationResponse —$this
object.
setTicket()
Set the ticket issued from Authlete's `/api/auth/authorization` API to the authorization server implementation.
public
setTicket(string $ticket) : AuthorizationResponse
Parameters
- $ticket : string
-
The ticket issued from
/api/auth/authorization
API.
Return values
AuthorizationResponse —$this
object.
setUiLocales()
Set the list of preferred languages and scripts for the user interface.
public
setUiLocales([array<string|int, string> $uiLocales = null ]) : AuthorizationResponse
Parameters
- $uiLocales : array<string|int, string> = null
-
The list of preferred languages and scripts for the user interface.
Return values
AuthorizationResponse —$this
object.
setUserInfoClaims()
Set the value of the `userinfo` property in the `claims` request parameter or in the `claims` property in a request object.
public
setUserInfoClaims(string $claims) : AuthorizationResponse
Parameters
- $claims : string
-
The value of the
userinfo
property in theclaims
in JSON format.
Tags
Return values
AuthorizationResponse —$this
object.
toArray()
Convert this object into an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array.
toJson()
Convert this object into a JSON string.
public
toJson(int $options) : string
Parameters
- $options : int
-
Options passed to
json_encode()
. This parameter is optional and its default value is 0.
Return values
string —A JSON string.


--- layout: post status: publish published: true title: How to Use Docker header-img: "img/docker-wp.png" author: display_name: Stefan Thorpe login: stefan email<EMAIL_ADDRESS>url: '' author_login: stefan author_email<EMAIL_ADDRESS>excerpt: This article is a great introduction to suggest some ways you can utilize Docker yourself without going mad and throwing all your applications at the program. The author provides several links to ideas to help simplify your architecture, a script for simple automated container upgrades, and tips to optimize deployment. wordpress_id: 30 wordpress_url: http://blog.caylent.com/?p=30 date: '2016-02-04 22:14:03 +0200' date_gmt: '2016-02-05 06:14:03 +0200' categories: - Digest - Docker tags: - Docker introduction comments: [] --- {% raw %}
This post was originally published here.
Docker is becoming increasingly popular. Developers and system administrators are discovering just how headache free it is to port applications. Container technology allows for the launch and configuration of all dependencies quickly and easily.
The open-source program takes its name from the shipping containers credited as the invention of a guy called Malcolm Mclean, a trucker, who came up with a standardized way of loading cargo from trucks to ships and warehouses. The strong uniform design was theft resistant and easy to load and unload. Docker has virtualized this principle with container technology. And developers can use Docker to ‘build, ship, and run’ applications on top of a Linux instance. And just like their large metal counterparts, they provide an isolated space for the whole team to work within.
Development, build, test and operations teams; they all stand to gain from using container software. The tech provides a virtual isolation area where things can move around without consideration of the contents. At a considerably quicker speed over VMs. They are more efficient in comparison to hypervisors, in terms of systems resources due to their shared operating systems. They each have their own isolated user space. This means you can run multiple containers (LXCs) together (without foregoing user space) on a single host. It is their standardization that stands them apart from other companies offering similar tech.
This article is a great introduction to suggest some ways you can utilize Docker yourself, without going mad and throwing all your applications at the program. The author provides several links to ideas to help simplify your architecture, a script for simple automated container upgrades, and tips to optimize deployment. The article recommends some initial steps new developers working with Docker can follow to boost workflow and make the most of the technology.
For more information on how to get the most from Docker, read our post on Creating a High-Availability WordPress Cluster with Docker Swarm and EFS.
{% endraw %}


Duration
15 minutes
Goals
The goal of this lab is to add a Toolbar to an Activity and set its logo and title.
You will be working on a supplied Recipes app. The image below shows the app's three Activities
as they exist in the supplied starter code. All your work will be done in the DetailsActivity.
You will rewrite the implementation of the highlighted area in the DetailsActivity
so it uses a Toolbar
. This rewrite will be done one piece at a time throughout the exercises
for this course.
The image below shows the completed app at the end of the course. Notice how the user actions
have been relocated to a Toolbar
(some of the actions are not visible because they
are in a sub-menu or in the Toolbar
's overflow area).
In this first exercise, you will add a Toolbar
to the DetailsActivity
and set its logo and title. This will let you remove the ImageView
and TextView
currenty used to display that information.
Required assets
The provided Exercise 1 folder contains a subfolder named Start with the starter project you will use for this lab. It also contains a Completed folder with a solution you can use to check your work. Please make sure you have this folder before you begin.
Challenge
- Open the provided Recipes solution in the Exercise 1/Start folder.
- In Details.axml, add a
Toolbar
as the first element - give it an id so it can be accessed from code. - Set the toolbar's
logo
to@drawable/ic_local_dining_white_24dp
. - In DetailsActivity.cs, store a reference to the toolbar in a field, then set its
Title
to theName
of the recipe. - Remove any unneeded UI elements and code.
Steps
Run the starter solution
- Open the provided Recipes solution in the Exercise 1/Start folder.
- Run the app.
- The MainActivity lists a few recipes. To keep the app simple, the recipe data is hardcoded.
- Select one of the recipes to navigate the app to the DetailsActivity.
- Use the About button to navigate to the AboutActivty then use the Android back button to return to the DetailsActivity.
- Try the "1", "2", and "4" buttons to change the number of servings and notice how the ingredient amounts are updated in the UI.
- Click the "heart" button to select this recipe as one of your favorites. Notice how the image used on the button changes.
- Click the "arrow" button to return to the MainActivity. Any recipes marked as "favorite" will have an asterisk included in their listing.
- To keep the app simple, your "favorites" are not persisted; that is, if you re-run the app, all the recipe data such as the Boolean used to indicate a "favorite" and the number of servings will be reset to the hardcoded values.
Add a Toolbar to the DetailsActivity
- Continue working in the provided Recipes solution from the Exercise 1/Start folder.
- Open the Resources/layout/Details.axml file using the Source editor.
-
Add an
android.support.v7.widget.Toolbar
as the first element inside the rootLinearLayout
. -
Set the toolbar's
layout_width
tomatch_parent
and itslayout_height
towrap_content
. -
Give the toolbar an id (
android:id="@+id/toolbar"
). -
The starter code has already defined the
app
prefix. Use it to set the toolbar'slogo
to@drawable/ic_local_dining_white_24dp
. - The completed code for the above steps is provided below.
-
Remove the first nested
LinearLayout
from the Details.axml file. You will be showing the logo and recipe name in the toolbar so this is no longer needed.
Set the Toolbar's title
- Open the DetailsActivity.cs file.
-
In
OnCreate
, useFindViewById
to get a reference to theToolbar
and store the reference in a field. The code is shown below. -
We will use the recipe name as the title of the toolbar. Since this will be different for each recipe,
we will set the title in code rather than in XML.
In
OnCreate
, set the toolbar'sTitle
to theName
of the recipe. The code is shown below. -
In
OnCreate
, remove the code that loaded the recipe name into aTextView
(see below).var name = FindViewById<TextView>(Resource.Id.nameTextView); name.Text = recipe.Name;
- Run the app to test your work. The logo and recipe name on the DetailsActivity should now be displayed in a toolbar (see below).
Summary
In this exercise, you added Toolbar
to an Activity. You set two properties on the toolbar:
the logo
was static so you could set it in XML while the Title
was
data-dependent so you needed to set it in code.