blob: a627cf658136106489e2a01803838bb72ae24883 [file] [log] [blame]
Daniel Sandlera30b70352013-09-16 10:16:49 -04001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui;
18
19import android.service.dreams.DreamService;
20
21public class DessertCaseDream extends DreamService {
Daniel Sandler8475a742013-09-26 00:24:57 -040022 private DessertCaseView mView;
23 private DessertCaseView.RescalingContainer mContainer;
Daniel Sandlera30b70352013-09-16 10:16:49 -040024
25 @Override
26 public void onAttachedToWindow() {
27 super.onAttachedToWindow();
Daniel Sandler8475a742013-09-26 00:24:57 -040028 setInteractive(false);
29
30 mView = new DessertCaseView(this);
31
32 mContainer = new DessertCaseView.RescalingContainer(this);
33
34 mContainer.setView(mView);
35
36 setContentView(mContainer);
Daniel Sandlera30b70352013-09-16 10:16:49 -040037 }
38
39 @Override
40 public void onDreamingStarted() {
41 super.onDreamingStarted();
Daniel Sandler8475a742013-09-26 00:24:57 -040042 mView.postDelayed(new Runnable() {
43 public void run() {
44 mView.start();
45 }
46 }, 1000);
Daniel Sandlera30b70352013-09-16 10:16:49 -040047 }
48
49 @Override
50 public void onDreamingStopped() {
51 super.onDreamingStopped();
Daniel Sandler8475a742013-09-26 00:24:57 -040052 mView.stop();
Daniel Sandlera30b70352013-09-16 10:16:49 -040053 }
54}