John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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.qs.tiles; |
| 18 | |
| 19 | import android.content.Intent; |
| 20 | |
| 21 | import com.android.systemui.R; |
| 22 | import com.android.systemui.qs.QSTile; |
| 23 | import com.android.systemui.statusbar.policy.TetheringController; |
| 24 | |
| 25 | /** Quick settings tile: Hotspot **/ |
| 26 | public class HotspotTile extends QSTile<QSTile.State> { |
| 27 | private static final Intent TETHER_SETTINGS = new Intent() |
| 28 | .setClassName("com.android.settings", "com.android.settings.TetherSettings"); |
| 29 | |
| 30 | // TODO: implement. see com.android.settings.TetherSettings |
| 31 | |
| 32 | private final TetheringController mController; |
| 33 | |
| 34 | public HotspotTile(Host host) { |
| 35 | super(host); |
| 36 | mController = host.getTetheringController(); |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | protected State newTileState() { |
| 41 | return new State(); |
| 42 | } |
| 43 | |
| 44 | @Override |
John Spurlock | ccb6b9a | 2014-05-17 15:54:40 -0400 | [diff] [blame^] | 45 | public void setListening(boolean listening) { |
John Spurlock | af8d6c4 | 2014-05-07 17:49:08 -0400 | [diff] [blame] | 46 | |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | protected void handleClick() { |
| 51 | mHost.startSettingsActivity(TETHER_SETTINGS); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | protected void handleUpdateState(State state, Object arg) { |
| 56 | state.visible = mController != null; |
| 57 | state.label = mContext.getString(R.string.quick_settings_hotspot_label); |
| 58 | state.icon = mHost.getVectorDrawable(R.drawable.ic_qs_hotspot); |
| 59 | } |
| 60 | } |