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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/mojo/activity.dart
diff --git a/sky/sdk/lib/mojo/activity.dart b/sky/sdk/lib/mojo/activity.dart
index 7abd84d06f95bd7bdcc1537dd14ce49b35411a36..9136494e61a71c23828a2a7b71880c7b412157d6 100644
--- a/sky/sdk/lib/mojo/activity.dart
+++ b/sky/sdk/lib/mojo/activity.dart
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'dart:sky';
import 'package:mojom/intents/intents.mojom.dart';
import 'package:sky/mojo/shell.dart' as shell;
@@ -17,6 +18,10 @@ ActivityManagerProxy _initActivityManager() {
final ActivityManagerProxy _activityManager = _initActivityManager();
+Color _cachedPrimaryColor;
+String _cachedLabel;
+
+
void finishCurrentActivity() {
_activityManager.ptr.finishCurrentActivity();
}
@@ -24,3 +29,17 @@ void finishCurrentActivity() {
void startActivity(Intent intent) {
_activityManager.ptr.startActivity(intent);
}
+
+void updateTaskDescription(String label, Color color) {
+ if (_cachedPrimaryColor == color && _cachedLabel == label)
+ return;
+
+ _cachedPrimaryColor = color;
+ _cachedLabel = label;
+
+ TaskDescription description = new TaskDescription()
+ ..label = label
+ ..primaryColor = (color != null ? color.value : null);
+
+ _activityManager.ptr.setTaskDescription(description);
+}

Powered by Google App Engine
This is Rietveld 408576698