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

Unified Diff: sky/sdk/lib/widgets/task_description.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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/services/intents/intents.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/task_description.dart
diff --git a/sky/sdk/lib/widgets/task_description.dart b/sky/sdk/lib/widgets/task_description.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7419759db0c28bf9f268774a1e0d9ff6da28ba8f
--- /dev/null
+++ b/sky/sdk/lib/widgets/task_description.dart
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:mojom/intents/intents.mojom.dart' as intents;
+import 'package:sky/mojo/shell.dart' as shell;
+import 'package:sky/widgets/widget.dart';
+import 'package:sky/widgets/theme.dart';
+
+class TaskDescription extends StatefulComponent {
+ Widget child;
+ String label;
+ Color _cachedPrimaryColor;
+ String _cachedLabel;
+
+ TaskDescription({this.label, this.child});
+
+ void syncFields(TaskDescription source) {
+ child = source.child;
+ label = source.label;
+ }
+
+ void updateTaskDescription(String label, Color color) {
abarth-chromium 2015/07/07 19:57:45 Can we put this code in sky/sdk/lib/mojo/activity.
+ if (_cachedPrimaryColor == color && _cachedLabel == label)
+ return;
+
+ _cachedPrimaryColor = color;
+ _cachedLabel = label;
+
+ intents.ActivityManagerProxy activityManager =
+ new intents.ActivityManagerProxy.unbound();
+ intents.TaskDescription description = new intents.TaskDescription()
+ ..label = label
+ ..primaryColor = (color != null ? color.value : null);
+
+ shell.requestService(null, activityManager);
+ activityManager.ptr.setTaskDescription(description);
+ }
+
+ Widget build() {
+ updateTaskDescription(label, Theme.of(this).primaryColor);
+ return child;
+ }
+}
« no previous file with comments | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/services/intents/intents.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698