Commit graph

174 commits

Author SHA1 Message Date
Adam Barth c420d2c3f4 Fix sky_tool's installing of SkyShell.apk
We were walking over to the realdir too quickly, which meant we lost which
version of the sky_engine package we were supposed to use.
2015-07-27 10:05:16 -07:00
Adam Barth 623bc3efd6 Rev Sky package 2015-07-27 09:13:01 -07:00
Hixie 60177a71ab Scoped focus, so you can have a dialog with input controls and not lose your focus in the background.
This introduces a GlobalKey registry so that you can tell when a key
has gone away (so you can unfocus dead dialogs).

Also I added an assert that you're not calling setState() during a
build. It turns out that doing so means you have a bug, because since
you're dirty already (you're building), you won't get rebuilt.

The focus code itself is gnarly. It uses a Component and an internal
Inherited TagNode to manage the focus state, and does crazy things
like updating its state during build to pretend retroactively that it
was built with some other state, once someone asks for focus the first
time (i.e. the first time it's examined, so you can't tell that it was
in a different state before). It does this so that it can autofocus
controls which otherwise wouldn't be focused.

This moves all the focus management into Navigator and showDialog(),
so the complexity is all buried deep and not visible to apps,
hopefully.

To do something like two tabs that each have an Input widget that
needs to be focused when you switch panes, you'd need to have two
Focus objects, one in each tab, and you need to set their autofocus to
true (maybe that should be the default?).
2015-07-24 18:18:04 -07:00
Hixie f13f8894e4 Fix review feedback from previous checkin.
@abarth doesn't like Futures that explicitly point out they're type-unsafe. :-P
2015-07-24 18:08:04 -07:00
Hixie 1b7aa1153e Fix the lerp the RIGHT way. 2015-07-24 18:05:14 -07:00
Ian Hickson 4f9f5656c7 Merge pull request #281 from Hixie/buttons
Fix the crash for buttons.
2015-07-24 17:55:13 -07:00
Hixie be5545cf28 Fix the crash for buttons.
Turns out there was a typo in lerpColor.

Fixes #277.
2015-07-24 17:44:20 -07:00
Hixie df7fdb5b12 pushDialog(navigator, (navigator) => new Dialog(...)).then((result) => process(result)); 2015-07-24 17:40:41 -07:00
Collin Jackson 82f5f14b98 Move dialog into its own class 2015-07-24 15:16:40 -07:00
Ian Hickson 051655fa6d Merge pull request #278 from Hixie/nav-dialogs
Use the navigator to stack dialogs.
2015-07-24 15:02:20 -07:00
Hixie db63850e42 Fix test breakage (stocks test imports stocks app differently than a recent checkin expected). 2015-07-24 14:54:56 -07:00
Hixie ac6342ab8a Use the navigator to stack dialogs.
This removes the need to manually include the dialog builder in the main window's build() function.
It also removes the need to track if a dialog is visible.

Other changes:
- I made dialog.dart a bit more readable.
- I renamed transitionFinished to fullyOpaque since that's what actually matters.
- I made Routes track if they're opaque. Eventually this should probably be more configurable when creating the route.

Directions for Future Research:
- Use this for focus management somehow.
- The popup menu should use something like this.
- We should factor the following out into a showDialog() function that returns a future for the dialog's exit result:
    navigator.push(new DialogRoute(builder: (navigator, route) { ... }));
- Maybe navigator.pop() should take a value to return to that Future.
2015-07-24 14:33:09 -07:00
Adam Barth c6fe01eda3 Merge pull request #274 from jimsimon/examples-as-libraries
Examples as libraries
2015-07-24 14:23:39 -07:00
Viktor Lidholt 80f8435916 Merge pull request #273 from vlidholt/master
Optimizations for Particle Systems
2015-07-24 13:04:34 -07:00
Viktor Lidholt 45399c7a53 Fixes formatting and abstraction in GameMath 2015-07-24 12:59:08 -07:00
Adam Barth 544e19d48c Merge pull request #265 from abarth/workbench
Create //sky/packages/workbench
2015-07-24 12:50:51 -07:00
Viktor Lidholt ab2b791866 Optimizes ColorSequence 2015-07-24 12:39:02 -07:00
Jim Simon 3089686eeb Converted examples to libraries
Converted demo launcher example to library

Converted fitness example to library

Converted hello world example to library

Converted mine digger example to library

Converted stocks example to library
2015-07-24 12:27:27 -07:00
Viktor Lidholt 2e2331ab5e Merge branch 'master' of github.com:domokit/sky_engine
Conflicts:
	sky/sdk/example/game/lib/particle_system.dart
2015-07-24 12:17:18 -07:00
Viktor Lidholt 53c66a5f4c Optimizations to particle systems. Uses single instance of Random and faster atan2 function. 2015-07-24 12:14:22 -07:00
Eric Seidel 4f8de2ee82 Merge pull request #271 from eseidelGoogle/draw_atlas
Use Skia's drawAtlas now that we've rolled to a newer Skia
2015-07-24 11:27:15 -07:00
Hans Muller 9ac347da62 Dismissable animation simplifications; added backgrounds to CardCollection cards 2015-07-24 11:15:37 -07:00
Eric Seidel 7a1e3bb389 Use Skia's drawAtlas now that we've rolled to a newer Skia
Roll was ff8bbe4e1674ae57f2ea3a2841a37a9c099beac8
This is another step in fixing #138

R=viktork@google.com
2015-07-24 11:11:30 -07:00
Collin Jackson 9f6fc78ceb Fix the new item dialog for fitness app 2015-07-24 10:27:16 -07:00
Adam Barth a3b44a566c Create //sky/packages/workbench
The workbench package exists to pull in pub packages from both pub.dartlang.org
and from the source tree (using dependency overrides). The idea is that
workbench will reflect a typical Sky developer's environment so that we can use
the same tools as a typical sky developer by running them with the workbench as
the cwd.
2015-07-23 22:20:07 -07:00
Adam Barth cb8e1b58cb Add back some DEPS
Turns out if we don't have these deps, nothing builds these packages.
2015-07-23 19:07:20 -07:00
Adam Barth edd9ddccb4 Remove the magic from the Sky package
We now just symlink the lib directory into the packages directory in the output
directory.
2015-07-23 16:52:32 -07:00
Adam Barth 40913d0363 Add sky_services pub package
This package contains the mojom.dart files we generate from the sky_engine
repository.
2015-07-23 15:51:37 -07:00
Adam Barth e2db025317 Merge pull request #250 from abarth/material_package
Move Material Design Icons to their own package
2015-07-23 14:57:52 -07:00
Adam Barth 1892149897 Move Material Design Icons to their own package
After this patch, we use pub to manage versioning and fetching the material
design icons.
2015-07-23 14:54:59 -07:00
Viktor Lidholt 2bccb1890d Merge pull request #249 from vlidholt/master
Adds test case for drawAtlas in games
2015-07-23 14:44:37 -07:00
Viktor Lidholt f3e51d9f05 Adds test case for drawAtlas in games 2015-07-23 14:39:39 -07:00
Ian Hickson 9ac6830770 Merge pull request #244 from Hixie/focus
Add a dialog to the address book app to test scoped focus.
2015-07-23 14:19:42 -07:00
Adam Barth 1570b17237 Merge pull request #245 from abarth/sky_engine_package
Add a sky_engine package to contain the dart:sky SDK extensions
2015-07-23 14:18:05 -07:00
Adam Barth dfce6c7191 Add a sky_engine package to contain the dart:sky SDK extensions 2015-07-23 14:17:35 -07:00
Hixie 2694d67551 Add a dialog to the address book app to test scoped focus. 2015-07-23 14:06:12 -07:00
Adam Barth 8a64baca3d Merge pull request #241 from abarth/sky_shell_apk
Create a SkyShell.apk
2015-07-23 13:32:15 -07:00
Viktor Lidholt 765881f264 Merge pull request #223 from vlidholt/master
Adds custom play button with texture to demo game
2015-07-23 13:30:25 -07:00
Viktor Lidholt 9a834384f1 Adds custom play button with texture to demo game 2015-07-23 13:27:17 -07:00
Adam Barth c14ba33667 Create a SkyShell.apk
This CL introduces a SkyShell.apk that is separate from the SkyDemo.apk that we
upload to the store to show our demos.  The SkyShell.apk is just an empty shell
that can run Sky applications on Android.
2015-07-23 13:26:01 -07:00
Hixie 4e2893802d Remove the scheduleBuild() API.
I've noticed an anti-pattern emerge where people call scheduleBuild()
when they think they've changed enough state that they should rebuild,
instead of just wrapping their changes in setState(). This leads to
them missing state changes, having extraneous scheduleBuild() calls,
and other similar bugs.

By removing scheduleBuild(), the only way to actually schedule a build
now is to call setState(), and hopefully that'll make it much clearer
that you're only supposed to do this when you change state.
2015-07-23 12:55:48 -07:00
Hixie eb90899aab Track global keys globally.
Assert that there are no duplicates.
Export GlobalKey from basic.dart, so that people don't have to import widgets.dart just for that.
Fix the "initialFocus" feature which actually didn't work.
2015-07-23 11:10:04 -07:00
Adam Barth 7224089c9f Merge pull request #230 from abarth/use_dart_http_server
Switch sky_tool to use a Dart-based HTTP server
2015-07-23 09:28:40 -07:00
Eric Seidel 8998132d94 Add C++ based support for drawAtlas
This is supposed to make Viktor's game faster, but it's not clear
to me that it actually does.  I've left the code
using the dart version of drawAtlas for now until Viktor can
verify that it looks correct.

I also added a wrapper for SkFilterQuality in the process of
debugging SkCanvas.drawAtlas since all drawAtlas examples
in Skia use FilterQuality.low.  The bug which blocked me for
so long turned out to be that SkCanvas.drawAtlas doesn't
draw anything if antialiasing is turned on.

Issue #138.

R=abarth@google.com
2015-07-23 09:25:10 -07:00
Hixie 144fe36e25 RenderConstrainedBox was ignoring its additional constraints for its intrinsic size logic when it had no child. 2015-07-23 09:06:34 -07:00
Adam Barth 5aeff1ac1d Merge pull request #233 from abarth/fix_analyzer
Fix analyzer warnings
2015-07-23 08:56:10 -07:00
Adam Barth 59798b982e Fix analyzer warnings
- Remove unused imports
 - Remove unused, broken constructor for MineDiggerApp
2015-07-23 08:54:51 -07:00
Hixie 3aa0437ff2 Rename defaultFocus to initialFocus. 2015-07-23 08:43:40 -07:00
Eric Seidel 4da276710f Focus support.
This patch provides a class to manage focus, Focus, and a class to
manage ownership of the keyboard, KeyboardHandle.

Inherited (in widgets.dart) is adjusted to support subclasses that
need to copy state from instance to instance.

A GlobalKey key type is introduced that is basically the same as
UniqueKey. Component classes that need a globally-unique key can
specify that their 'key' constructor argument is a GlobalKey.

Focus
-----

You can use `Focus.at(this)` to determine if you, a Component, are
currently focused.

You can use `Focus.moveTo(this)` to take the focus or give it to a
particular component.

For this to work, there has to be a Focus class in the widget
hierarchy.

Currently, there can only be one Focus class, because nested scopes
aren't supported. We should add support for that in a future patch.
See issue #229.

KeyboardHandle
--------------

Instead of directly interacting with the keyboard service, you now ask
for a KeyboardHandle using `_keyboard.show(client)`. This returns a
KeyboardHandle class. On that class, you can call `handle.release()`
when you want to hide the keyboard. If `handle.attached` is still
true, and you need to reshow the keyboard after the user hid it, then
you can can `handle.showByRequest()`.

The point of this is that the `keyboard.show()` method maintains the
invariant that only one KeyboardHandle is live at a time.

There are some issues with the keyboard service that I filed as a
result of doing this patch: #226 #227
2015-07-23 08:43:40 -07:00
Adam Barth 3331d44f2d Don't try to access the network in Stocks test
Accessing the network created a race condition that would sometimes cause other
tests to fail.
2015-07-23 08:39:42 -07:00