Daniel Sandler | a30b7035 | 2013-09-16 10:16:49 -0400 | [diff] [blame] | 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.app.Activity; |
| 20 | import android.content.ComponentName; |
| 21 | import android.content.pm.PackageManager; |
| 22 | import android.util.Slog; |
| 23 | |
| 24 | public class DessertCase extends Activity { |
Daniel Sandler | 8475a74 | 2013-09-26 00:24:57 -0400 | [diff] [blame] | 25 | DessertCaseView mView; |
Daniel Sandler | a30b7035 | 2013-09-16 10:16:49 -0400 | [diff] [blame] | 26 | |
| 27 | @Override |
| 28 | public void onStart() { |
| 29 | super.onStart(); |
| 30 | |
Daniel Sandler | a30b7035 | 2013-09-16 10:16:49 -0400 | [diff] [blame] | 31 | PackageManager pm = getPackageManager(); |
Daniel Sandler | 8475a74 | 2013-09-26 00:24:57 -0400 | [diff] [blame] | 32 | final ComponentName cn = new ComponentName(this, DessertCaseDream.class); |
| 33 | if (pm.getComponentEnabledSetting(cn) != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { |
| 34 | Slog.v("DessertCase", "ACHIEVEMENT UNLOCKED"); |
| 35 | pm.setComponentEnabledSetting(cn, |
Daniel Sandler | 5c6a781 | 2013-11-12 21:50:18 -0500 | [diff] [blame] | 36 | PackageManager.COMPONENT_ENABLED_STATE_ENABLED, |
| 37 | PackageManager.DONT_KILL_APP); |
Daniel Sandler | 8475a74 | 2013-09-26 00:24:57 -0400 | [diff] [blame] | 38 | } |
Daniel Sandler | a30b7035 | 2013-09-16 10:16:49 -0400 | [diff] [blame] | 39 | |
Daniel Sandler | 8475a74 | 2013-09-26 00:24:57 -0400 | [diff] [blame] | 40 | mView = new DessertCaseView(this); |
| 41 | |
| 42 | DessertCaseView.RescalingContainer container = new DessertCaseView.RescalingContainer(this); |
| 43 | |
| 44 | container.setView(mView); |
| 45 | |
| 46 | setContentView(container); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void onResume() { |
| 51 | super.onResume(); |
| 52 | mView.postDelayed(new Runnable() { |
| 53 | public void run() { |
| 54 | mView.start(); |
| 55 | } |
| 56 | }, 1000); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void onPause() { |
| 61 | super.onPause(); |
| 62 | mView.stop(); |
Daniel Sandler | a30b7035 | 2013-09-16 10:16:49 -0400 | [diff] [blame] | 63 | } |
| 64 | } |