Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: sky/sdk/example/demo_launcher/lib/main.dart

Issue 1212343009: SkyDemo.apk should show thumbmails when offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:sky'; 5 import 'dart:sky';
6 6
7 import 'package:mojom/intents/intents.mojom.dart'; 7 import 'package:mojom/intents/intents.mojom.dart';
8 import 'package:sky/mojo/asset_bundle.dart';
8 import 'package:sky/mojo/shell.dart' as shell; 9 import 'package:sky/mojo/shell.dart' as shell;
9 import 'package:sky/painting/box_painter.dart'; 10 import 'package:sky/painting/box_painter.dart';
10 import 'package:sky/theme/colors.dart' as colors; 11 import 'package:sky/theme/colors.dart' as colors;
11 import 'package:sky/theme/typography.dart' as typography; 12 import 'package:sky/theme/typography.dart' as typography;
12 import 'package:sky/widgets/basic.dart'; 13 import 'package:sky/widgets/basic.dart';
13 import 'package:sky/widgets/card.dart'; 14 import 'package:sky/widgets/card.dart';
14 import 'package:sky/widgets/fixed_height_scrollable.dart'; 15 import 'package:sky/widgets/fixed_height_scrollable.dart';
15 import 'package:sky/widgets/flat_button.dart'; 16 import 'package:sky/widgets/flat_button.dart';
16 import 'package:sky/widgets/material.dart'; 17 import 'package:sky/widgets/material.dart';
17 import 'package:sky/widgets/scaffold.dart'; 18 import 'package:sky/widgets/scaffold.dart';
18 import 'package:sky/widgets/theme.dart'; 19 import 'package:sky/widgets/theme.dart';
19 import 'package:sky/widgets/tool_bar.dart'; 20 import 'package:sky/widgets/tool_bar.dart';
20 21
22 AssetBundle _initBundle() {
23 if (rootBundle != null)
24 return rootBundle;
25 const String _kAssetBase = '..';
26 return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
27 }
28
29 final AssetBundle _bundle = _initBundle();
30
21 void launch(String relativeUrl, String bundle) { 31 void launch(String relativeUrl, String bundle) {
22 Uri url = Uri.base.resolve(relativeUrl); 32 Uri url = Uri.base.resolve(relativeUrl);
23 33
24 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); 34 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound();
25 ComponentName component = new ComponentName() 35 ComponentName component = new ComponentName()
26 ..packageName = 'org.domokit.sky.demo' 36 ..packageName = 'org.domokit.sky.demo'
27 ..className = 'org.domokit.sky.demo.SkyDemoActivity'; 37 ..className = 'org.domokit.sky.demo.SkyDemoActivity';
28 Intent intent = new Intent() 38 Intent intent = new Intent()
29 ..action = 'android.intent.action.VIEW' 39 ..action = 'android.intent.action.VIEW'
30 ..component = component 40 ..component = component
(...skipping 22 matching lines...) Expand all
53 63
54 List<Widget> demos = [ 64 List<Widget> demos = [
55 new SkyDemo( 65 new SkyDemo(
56 name: 'Stocks', 66 name: 'Stocks',
57 href: '../../stocks/lib/main.dart', 67 href: '../../stocks/lib/main.dart',
58 bundle: 'stocks.skyx', 68 bundle: 'stocks.skyx',
59 description: 'Multi-screen app with scrolling list', 69 description: 'Multi-screen app with scrolling list',
60 textTheme: typography.black, 70 textTheme: typography.black,
61 decoration: new BoxDecoration( 71 decoration: new BoxDecoration(
62 backgroundImage: new BackgroundImage( 72 backgroundImage: new BackgroundImage(
63 src: '../assets/stocks_thumbnail.png', 73 image: _bundle.loadImage('assets/stocks_thumbnail.png'),
64 fit: BackgroundFit.cover 74 fit: BackgroundFit.cover
65 ) 75 )
66 ) 76 )
67 ), 77 ),
68 new SkyDemo( 78 new SkyDemo(
69 name: 'Asteroids', 79 name: 'Asteroids',
70 href: '../../game/main.dart', 80 href: '../../game/main.dart',
71 description: '2D game using sprite sheets to achieve high performance', 81 description: '2D game using sprite sheets to achieve high performance',
72 textTheme: typography.white, 82 textTheme: typography.white,
73 decoration: new BoxDecoration( 83 decoration: new BoxDecoration(
74 backgroundImage: new BackgroundImage( 84 backgroundImage: new BackgroundImage(
75 src: '../assets/game_thumbnail.png', 85 image: _bundle.loadImage('assets/game_thumbnail.png'),
76 fit: BackgroundFit.cover 86 fit: BackgroundFit.cover
77 ) 87 )
78 ) 88 )
79 ), 89 ),
80 new SkyDemo( 90 new SkyDemo(
81 name: 'Interactive Flex', 91 name: 'Interactive Flex',
82 href: '../../rendering/interactive_flex.dart', 92 href: '../../rendering/interactive_flex.dart',
83 bundle: 'interactive_flex.skyx', 93 bundle: 'interactive_flex.skyx',
84 description: 'Swipe to adjust the layout of the app', 94 description: 'Swipe to adjust the layout of the app',
85 textTheme: typography.white, 95 textTheme: typography.white,
86 decoration: new BoxDecoration( 96 decoration: new BoxDecoration(
87 backgroundColor: const Color(0xFF0081C6) 97 backgroundColor: const Color(0xFF0081C6)
88 ) 98 )
89 ), 99 ),
90 new SkyDemo( 100 new SkyDemo(
91 name: 'Sector', 101 name: 'Sector',
92 href: '../../widgets/sector.dart', 102 href: '../../widgets/sector.dart',
93 bundle: 'sector.skyx', 103 bundle: 'sector.skyx',
94 description: 'Demo of alternative layouts', 104 description: 'Demo of alternative layouts',
95 textTheme: typography.black, 105 textTheme: typography.black,
96 decoration: new BoxDecoration( 106 decoration: new BoxDecoration(
97 backgroundColor: colors.Black, 107 backgroundColor: colors.Black,
98 backgroundImage: new BackgroundImage( 108 backgroundImage: new BackgroundImage(
99 src: '../assets/sector_thumbnail.png', 109 image: _bundle.loadImage('assets/sector_thumbnail.png'),
100 fit: BackgroundFit.cover 110 fit: BackgroundFit.cover
101 ) 111 )
102 ) 112 )
103 ), 113 ),
104 // new SkyDemo( 114 // new SkyDemo(
105 // 'Touch Demo', '../../rendering/touch_demo.dart', 'Simple example showing handling of touch events at a low level'), 115 // 'Touch Demo', '../../rendering/touch_demo.dart', 'Simple example showing handling of touch events at a low level'),
106 new SkyDemo( 116 new SkyDemo(
107 name: 'Minedigger Game', 117 name: 'Minedigger Game',
108 href: '../../mine_digger/lib/main.dart', 118 href: '../../mine_digger/lib/main.dart',
109 bundle: 'mine_digger.skyx', 119 bundle: 'mine_digger.skyx',
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 child: new DemoList() 185 child: new DemoList()
176 ) 186 )
177 ) 187 )
178 ); 188 );
179 } 189 }
180 } 190 }
181 191
182 void main() { 192 void main() {
183 runApp(new SkyHome()); 193 runApp(new SkyHome());
184 } 194 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698