Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 19 | import android.content.Context; |
Daniel Sandler | 0ad460b | 2010-12-14 12:14:53 -0500 | [diff] [blame] | 20 | import android.content.res.Configuration; |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 21 | |
John Spurlock | de84f0e | 2013-06-12 12:41:00 -0400 | [diff] [blame] | 22 | import java.io.FileDescriptor; |
| 23 | import java.io.PrintWriter; |
John Spurlock | d08de37 | 2013-06-24 13:06:08 -0400 | [diff] [blame] | 24 | import java.util.Map; |
John Spurlock | de84f0e | 2013-06-12 12:41:00 -0400 | [diff] [blame] | 25 | |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 26 | public abstract class SystemUI { |
| 27 | public Context mContext; |
John Spurlock | d08de37 | 2013-06-24 13:06:08 -0400 | [diff] [blame] | 28 | public Map<Class<?>, Object> mComponents; |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 29 | |
| 30 | public abstract void start(); |
John Spurlock | 209bede | 2013-07-17 12:23:27 -0400 | [diff] [blame] | 31 | |
Daniel Sandler | 0ad460b | 2010-12-14 12:14:53 -0500 | [diff] [blame] | 32 | protected void onConfigurationChanged(Configuration newConfig) { |
| 33 | } |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 34 | |
| 35 | public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 36 | } |
John Spurlock | d08de37 | 2013-06-24 13:06:08 -0400 | [diff] [blame] | 37 | |
| 38 | @SuppressWarnings("unchecked") |
| 39 | public <T> T getComponent(Class<T> interfaceType) { |
| 40 | return (T) (mComponents != null ? mComponents.get(interfaceType) : null); |
| 41 | } |
| 42 | |
| 43 | public <T, C extends T> void putComponent(Class<T> interfaceType, C component) { |
| 44 | if (mComponents != null) { |
| 45 | mComponents.put(interfaceType, component); |
| 46 | } |
| 47 | } |
Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 48 | } |