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

Side by Side Diff: sky/sdk/lib/mojo/activity.dart

Issue 1209423008: Make the TaskDescription background color match the ToolBar on Android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Updated per review 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
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 'package:mojom/intents/intents.mojom.dart'; 6 import 'package:mojom/intents/intents.mojom.dart';
6 import 'package:sky/mojo/shell.dart' as shell; 7 import 'package:sky/mojo/shell.dart' as shell;
7 8
8 const int NEW_DOCUMENT = 0x00080000; 9 const int NEW_DOCUMENT = 0x00080000;
9 const int NEW_TASK = 0x10000000; 10 const int NEW_TASK = 0x10000000;
10 const int MULTIPLE_TASK = 0x08000000; 11 const int MULTIPLE_TASK = 0x08000000;
11 12
12 ActivityManagerProxy _initActivityManager() { 13 ActivityManagerProxy _initActivityManager() {
13 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); 14 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound();
14 shell.requestService('mojo:sky_viewer', activityManager); 15 shell.requestService('mojo:sky_viewer', activityManager);
15 return activityManager; 16 return activityManager;
16 } 17 }
17 18
18 final ActivityManagerProxy _activityManager = _initActivityManager(); 19 final ActivityManagerProxy _activityManager = _initActivityManager();
19 20
21 Color _cachedPrimaryColor;
22 String _cachedLabel;
23
24
20 void finishCurrentActivity() { 25 void finishCurrentActivity() {
21 _activityManager.ptr.finishCurrentActivity(); 26 _activityManager.ptr.finishCurrentActivity();
22 } 27 }
23 28
24 void startActivity(Intent intent) { 29 void startActivity(Intent intent) {
25 _activityManager.ptr.startActivity(intent); 30 _activityManager.ptr.startActivity(intent);
26 } 31 }
32
33 void updateTaskDescription(String label, Color color) {
34 if (_cachedPrimaryColor == color && _cachedLabel == label)
35 return;
36
37 _cachedPrimaryColor = color;
38 _cachedLabel = label;
39
40 TaskDescription description = new TaskDescription()
41 ..label = label
42 ..primaryColor = (color != null ? color.value : null);
43
44 _activityManager.ptr.setTaskDescription(description);
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698