--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="4" android:drawable="@drawable/ic_qs_battery_0" />
+ <item android:maxLevel="15" android:drawable="@drawable/ic_qs_battery_15" />
+ <item android:maxLevel="35" android:drawable="@drawable/ic_qs_battery_28" />
+ <item android:maxLevel="49" android:drawable="@drawable/ic_qs_battery_43" />
+ <item android:maxLevel="60" android:drawable="@drawable/ic_qs_battery_57" />
+ <item android:maxLevel="75" android:drawable="@drawable/ic_qs_battery_71" />
+ <item android:maxLevel="90" android:drawable="@drawable/ic_qs_battery_85" />
+ <item android:maxLevel="100" android:drawable="@drawable/ic_qs_battery_100" />
+</level-list>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="4" android:drawable="@drawable/ic_qs_battery_charge_0" />
+ <item android:maxLevel="15" android:drawable="@drawable/ic_qs_battery_charge_15" />
+ <item android:maxLevel="35" android:drawable="@drawable/ic_qs_battery_charge_28" />
+ <item android:maxLevel="49" android:drawable="@drawable/ic_qs_battery_charge_43" />
+ <item android:maxLevel="60" android:drawable="@drawable/ic_qs_battery_charge_57" />
+ <item android:maxLevel="75" android:drawable="@drawable/ic_qs_battery_charge_71" />
+ <item android:maxLevel="90" android:drawable="@drawable/ic_qs_battery_charge_85" />
+ <item android:maxLevel="100" android:drawable="@drawable/ic_qs_battery_charge_100" />
+</level-list>
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/airplane_mode_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/quick_settings_airplane_mode_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-->
-<TextView
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/battery_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
- android:gravity="center"
- android:drawableTop="@drawable/ic_qs_battery"
- android:text="@string/quick_settings_battery_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
- />
\ No newline at end of file
+ android:orientation="vertical">
+ <ImageView
+ android:id="@+id/battery_image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:paddingBottom="10dp"
+ />
+ <TextView
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:id="@+id/battery_textview"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ />
+</LinearLayout>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/bluetooth_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/quick_settings_bluetooth_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:drawableTop="@drawable/ic_sysbar_brightness"
+ android:drawableTop="@drawable/ic_qs_brightness_auto_off"
android:text="@string/quick_settings_brightness_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/ime_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:drawableTop="@drawable/stat_sys_roaming_cdma_0"
+ android:drawableTop="@drawable/ic_qs_ime"
android:text="@string/quick_settings_ime_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/location_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:drawableTop="@drawable/stat_sys_gps_acquiring"
+ android:drawableTop="@drawable/ic_qs_location"
android:text="@string/quick_settings_location_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/quick_settings_media_device_label"
android:singleLine="true"
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/rssi_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/quick_settings_rssi_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:drawableTop="@drawable/ic_notify_quicksettings"
+ android:drawableTop="@drawable/ic_qs_settings"
android:text="@string/quick_settings_settings_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
+ android:paddingTop="3dp"
+ android:paddingBottom="3dp"
android:singleLine="true"
/>
<com.android.systemui.statusbar.policy.QuickSettingsDateView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:drawableLeft="@drawable/stat_sys_alarm"
+ android:paddingTop="2dp"
+ android:paddingBottom="4dp"
+ android:drawableLeft="@drawable/ic_qs_alarm_on"
+ android:drawablePadding="4dp"
/>
</LinearLayout>
\ No newline at end of file
See the License for the specific language governing permissions and
limitations under the License.
-->
-<TextView
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/user_textview"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal|bottom"
- android:gravity="center"
- android:text="@string/quick_settings_user_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
- android:background="#33000000"
- />
\ No newline at end of file
+ android:layout_height="match_parent">
+ <TextView
+ style="@style/TextAppearance.QuickSettings.TileView"
+ android:id="@+id/user_textview"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal|bottom"
+ android:gravity="center"
+ android:text="@string/quick_settings_user_label"
+ android:background="#33000000"
+ />
+</FrameLayout>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/wifi_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/quick_settings_wifi_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
-->
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/TextAppearance.QuickSettings.TileView"
android:id="@+id/wifi_display_textview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:drawableTop="@drawable/ic_qs_wifi_normal"
+ android:drawableTop="@drawable/ic_qs_mirroring"
android:text="@string/quick_settings_wifi_display_label"
- android:textAppearance="@style/TextAppearance.QuickSettings.TileView"
/>
\ No newline at end of file
<!-- QuickSettings: Airplane mode [CHAR LIMIT=NONE] -->
<string name="quick_settings_airplane_mode_label">Airplane mode</string>
- <!-- QuickSettings: Battery [CHAR LIMIT=NONE] -->
- <string name="quick_settings_battery_label">Battery</string>
+ <!-- QuickSettings: Battery Charging [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_battery_charging_label">Charging, <xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g></string>
+ <!-- QuickSettings: Battery Charged [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_battery_charged_label">Charged</string>
<!-- QuickSettings: Bluetooth [CHAR LIMIT=NONE] -->
<string name="quick_settings_bluetooth_label">Bluetooth</string>
<!-- QuickSettings: Brightness [CHAR LIMIT=NONE] -->
<style name="TextAppearance.QuickSettings" />
<style name="TextAppearance.QuickSettings.TileView">
- <item name="android:padding">8dp</item>
- <item name="android:textSize">13dp</item>
+ <item name="android:paddingLeft">4dp</item>
+ <item name="android:paddingRight">4dp</item>
+ <item name="android:paddingBottom">2dp</item>
+ <item name="android:drawablePadding">12dp</item>
+ <item name="android:textSize">12dp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#ff8d908c</item>
<item name="android:singleLine">true</item>
</style>
<style name="TextAppearance.QuickSettings.Clock" parent="@style/TextAppearance.QuickSettings.TileView">
- <item name="android:textSize">24dp</item>
+ <item name="android:textSize">20dp</item>
<item name="android:textColor">@android:color/holo_blue_light</item>
</style>
</style>
<style name="TextAppearance.QuickSettings.Alarm" parent="@style/TextAppearance.QuickSettings.TileView">
- <item name="android:textSize">13dp</item>
+ <item name="android:textSize">14dp</item>
<item name="android:textColor">#ff3a3b39</item>
</style>
import android.content.Loader;
import android.content.res.Resources;
import android.database.Cursor;
-import android.graphics.drawable.ClipDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LevelListDrawable;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplay;
import android.hardware.display.WifiDisplayStatus;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
+import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.QuickSettingsModel.State;
+import com.android.systemui.statusbar.phone.QuickSettingsModel.UserState;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.BrightnessController;
private CursorLoader mUserInfoLoader;
+ private LevelListDrawable mBatteryLevels;
+ private LevelListDrawable mChargingBatteryLevels;
+
// The set of QuickSettingsTiles that have dynamic spans (and need to be updated on
// configuration change)
private final ArrayList<QuickSettingsTileView> mDynamicSpannedTiles =
mWifiDisplayStatus = new WifiDisplayStatus();
mWifiDisplayListAdapter = new WifiDisplayListAdapter(context);
+ Resources r = mContext.getResources();
+ mBatteryLevels = (LevelListDrawable) r.getDrawable(R.drawable.qs_sys_battery);
+ mChargingBatteryLevels =
+ (LevelListDrawable) r.getDrawable(R.drawable.qs_sys_battery_charging);
+
IntentFilter filter = new IntentFilter();
filter.addAction(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED);
mContext.registerReceiver(mReceiver, filter);
Cursor cursor) {
if (cursor != null && cursor.moveToFirst()) {
String name = cursor.getString(0); // DISPLAY_NAME
- mModel.setUserTileInfo(name);
+ mModel.setUserTileInfo(name, null);
/*
byte[] photoData = cursor.getBlob(0);
Bitmap b =
mModel.addUserTile(userTile, new QuickSettingsModel.RefreshCallback() {
@Override
public void refreshView(QuickSettingsTileView view, State state) {
+ UserState us = (UserState) state;
TextView tv = (TextView) view.findViewById(R.id.user_textview);
tv.setText(state.label);
+ if (us.avatar != null) {
+ tv.setCompoundDrawables(null, us.avatar, null, null);
+ }
}
});
parent.addView(userTile);
QuickSettingsModel.BatteryState batteryState =
(QuickSettingsModel.BatteryState) state;
TextView tv = (TextView) view.findViewById(R.id.battery_textview);
- ClipDrawable drawable = (ClipDrawable) tv.getCompoundDrawables()[1];
- drawable.setLevel((int) (10000 * (batteryState.batteryLevel / 100.0f)));
- // TODO: use format string
- tv.setText(batteryState.batteryLevel + "%");
+ ImageView iv = (ImageView) view.findViewById(R.id.battery_image);
+ Drawable d = batteryState.pluggedIn
+ ? mChargingBatteryLevels
+ : mBatteryLevels;
+ String t;
+ if (batteryState.batteryLevel == 100) {
+ t = mContext.getString(R.string.quick_settings_battery_charged_label);
+ } else {
+ t = batteryState.pluggedIn
+ ? mContext.getString(R.string.quick_settings_battery_charging_label,
+ batteryState.batteryLevel)
+ : mContext.getString(R.string.status_bar_settings_battery_meter_format,
+ batteryState.batteryLevel);
+ }
+ iv.setImageDrawable(d);
+ iv.setImageLevel(batteryState.batteryLevel);
+ tv.setText(t);
}
});
parent.addView(batteryTile);
lp.width = (int) ((colSpan * cellWidth) + (colSpan - 1) * mCellGap);
// Measure the child
- v.setMinimumWidth(lp.width);
- v.setMinimumHeight(lp.height);
- int newWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.AT_MOST);
- int newHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.AT_MOST);
+ int newWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
+ int newHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
v.measure(newWidthSpec, newHeightSpec);
// Save the cell height
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.ContentObserver;
+import android.graphics.drawable.Drawable;
import android.hardware.display.WifiDisplayStatus;
import android.os.Handler;
import android.provider.Settings;
int batteryLevel;
boolean pluggedIn;
}
+ static class UserState extends State {
+ Drawable avatar;
+ }
/** The callback to update a given tile. */
interface RefreshCallback {
private QuickSettingsTileView mUserTile;
private RefreshCallback mUserCallback;
- private State mUserState = new State();
+ private UserState mUserState = new UserState();
private QuickSettingsTileView mTimeTile;
private RefreshCallback mTimeAlarmCallback;
mUserCallback = cb;
mUserCallback.refreshView(mUserTile, mUserState);
}
- void setUserTileInfo(String name) {
+ void setUserTileInfo(String name, Drawable avatar) {
mUserState.label = name;
+ mUserState.avatar = avatar;
mUserCallback.refreshView(mUserTile, mUserState);
}
}
void onAlarmChanged(Intent intent) {
mTimeAlarmState.enabled = intent.getBooleanExtra("alarmSet", false);
- System.out.println("ALARM ENABLED: " + mTimeAlarmState.enabled);
mTimeAlarmCallback.refreshView(mTimeTile, mTimeAlarmState);
}
void onNextAlarmChanged() {
mTimeAlarmState.label = Settings.System.getString(mContext.getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED);
- System.out.println("ALARM LABEL: " + mTimeAlarmState.label);
mTimeAlarmCallback.refreshView(mTimeTile, mTimeAlarmState);
}
Resources r = mContext.getResources();
mAirplaneModeState.enabled = enabled;
mAirplaneModeState.iconId = (enabled ?
- R.drawable.ic_qs_airplane_enabled :
- R.drawable.ic_qs_airplane_normal);
+ R.drawable.ic_qs_airplane_on :
+ R.drawable.ic_qs_airplane_off);
mAirplaneModeCallback.refreshView(mAirplaneModeTile, mAirplaneModeState);
}
// TODO: Check if wifi is enabled
mWifiState.enabled = enabled;
mWifiState.iconId = (enabled ?
- R.drawable.ic_qs_wifi_enabled :
- R.drawable.ic_qs_wifi_normal);
+ R.drawable.ic_qs_wifi_4 :
+ R.drawable.ic_qs_wifi_not_connected);
mWifiState.label = (enabled ?
description :
r.getString(R.string.quick_settings_wifi_no_network));
// TODO: Check if RSSI is enabled
mRSSIState.enabled = enabled;
mRSSIState.iconId = (enabled ?
- R.drawable.ic_qs_rssi_enabled :
- R.drawable.ic_qs_rssi_normal);
+ R.drawable.ic_qs_signal_4 :
+ R.drawable.ic_qs_signal_0);
mRSSIState.label = (enabled ?
description :
r.getString(R.string.quick_settings_rssi_emergency_only));
Resources r = mContext.getResources();
mBluetoothState.enabled = on;
if (on) {
- mBluetoothState.iconId = R.drawable.ic_qs_bluetooth_enabled;
+ mBluetoothState.iconId = R.drawable.ic_qs_bluetooth_on;
} else {
- mBluetoothState.iconId = R.drawable.ic_qs_bluetooth_normal;
+ mBluetoothState.iconId = R.drawable.ic_qs_bluetooth_off;
}
mBluetoothCallback.refreshView(mBluetoothTile, mBluetoothState);
}