Home | History | Annotate | Download | only in systemui
      1 /*
      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 
     17 package com.android.systemui;
     18 
     19 import android.service.dreams.DreamService;
     20 
     21 public class DessertCaseDream extends DreamService {
     22     private DessertCaseView mView;
     23     private DessertCaseView.RescalingContainer mContainer;
     24 
     25     @Override
     26     public void onAttachedToWindow() {
     27         super.onAttachedToWindow();
     28         setInteractive(false);
     29 
     30         mView = new DessertCaseView(this);
     31 
     32         mContainer = new DessertCaseView.RescalingContainer(this);
     33 
     34         mContainer.setView(mView);
     35 
     36         setContentView(mContainer);
     37     }
     38 
     39     @Override
     40     public void onDreamingStarted() {
     41         super.onDreamingStarted();
     42         mView.postDelayed(new Runnable() {
     43             public void run() {
     44                 mView.start();
     45             }
     46         }, 1000);
     47     }
     48 
     49     @Override
     50     public void onDreamingStopped() {
     51         super.onDreamingStopped();
     52         mView.stop();
     53     }
     54 }
     55