Loading data/keyboards/Vendor_045e_Product_02fd.kl +6 −1 Original line number Diff line number Diff line Loading @@ -53,5 +53,10 @@ key 158 BUTTON_SELECT # Hamburger - 3 parallel lines key 315 BUTTON_START # Xbox key # There are at least two versions of firmware out for this controller. # They send different linux keys for the "Xbox" button. # Xbox key (original firmware) key 172 BUTTON_MODE # Xbox key (newer firmware) key 316 BUTTON_MODE packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java +14 −25 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ import android.annotation.ColorInt; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.text.BidiFormatter; import android.text.format.Formatter; import android.text.format.Formatter.BytesResult; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; Loading @@ -38,10 +41,6 @@ import java.text.DecimalFormat; */ public class DataUsageDetailView extends LinearLayout { private static final double KB = 1000; private static final double MB = 1000 * KB; private static final double GB = 1000 * MB; private final DecimalFormat FORMAT = new DecimalFormat("#.##"); public DataUsageDetailView(Context context, AttributeSet attrs) { Loading Loading @@ -74,23 +73,23 @@ public class DataUsageDetailView extends LinearLayout { titleId = R.string.quick_settings_cellular_detail_data_usage; bytes = info.usageLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_warning, formatBytes(info.warningLevel)); formatDataUsage(info.warningLevel)); } else if (info.usageLevel <= info.limitLevel) { // over warning, under limit titleId = R.string.quick_settings_cellular_detail_remaining_data; bytes = info.limitLevel - info.usageLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_used, formatBytes(info.usageLevel)); formatDataUsage(info.usageLevel)); bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit, formatBytes(info.limitLevel)); formatDataUsage(info.limitLevel)); } else { // over limit titleId = R.string.quick_settings_cellular_detail_over_limit; bytes = info.usageLevel - info.limitLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_used, formatBytes(info.usageLevel)); formatDataUsage(info.usageLevel)); bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit, formatBytes(info.limitLevel)); formatDataUsage(info.limitLevel)); usageColor = Utils.getColorAttr(mContext, android.R.attr.colorError); } Loading @@ -101,7 +100,7 @@ public class DataUsageDetailView extends LinearLayout { final TextView title = findViewById(android.R.id.title); title.setText(titleId); final TextView usage = findViewById(R.id.usage_text); usage.setText(formatBytes(bytes)); usage.setText(formatDataUsage(bytes)); usage.setTextColor(usageColor); final DataUsageGraph graph = findViewById(R.id.usage_graph); graph.setLevels(info.limitLevel, info.warningLevel, info.usageLevel); Loading @@ -123,20 +122,10 @@ public class DataUsageDetailView extends LinearLayout { } private String formatBytes(long bytes) { final long b = Math.abs(bytes); double val; String suffix; if (b > 100 * MB) { val = b / GB; suffix = "GB"; } else if (b > 100 * KB) { val = b / MB; suffix = "MB"; } else { val = b / KB; suffix = "KB"; } return FORMAT.format(val * (bytes < 0 ? -1 : 1)) + " " + suffix; private CharSequence formatDataUsage(long byteValue) { final BytesResult res = Formatter.formatBytes(mContext.getResources(), byteValue, Formatter.FLAG_IEC_UNITS); return BidiFormatter.getInstance().unicodeWrap(mContext.getString( com.android.internal.R.string.fileSizeSuffix, res.value, res.units)); } } Loading
data/keyboards/Vendor_045e_Product_02fd.kl +6 −1 Original line number Diff line number Diff line Loading @@ -53,5 +53,10 @@ key 158 BUTTON_SELECT # Hamburger - 3 parallel lines key 315 BUTTON_START # Xbox key # There are at least two versions of firmware out for this controller. # They send different linux keys for the "Xbox" button. # Xbox key (original firmware) key 172 BUTTON_MODE # Xbox key (newer firmware) key 316 BUTTON_MODE
packages/SystemUI/src/com/android/systemui/qs/tiles/DataUsageDetailView.java +14 −25 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ import android.annotation.ColorInt; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.text.BidiFormatter; import android.text.format.Formatter; import android.text.format.Formatter.BytesResult; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; Loading @@ -38,10 +41,6 @@ import java.text.DecimalFormat; */ public class DataUsageDetailView extends LinearLayout { private static final double KB = 1000; private static final double MB = 1000 * KB; private static final double GB = 1000 * MB; private final DecimalFormat FORMAT = new DecimalFormat("#.##"); public DataUsageDetailView(Context context, AttributeSet attrs) { Loading Loading @@ -74,23 +73,23 @@ public class DataUsageDetailView extends LinearLayout { titleId = R.string.quick_settings_cellular_detail_data_usage; bytes = info.usageLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_warning, formatBytes(info.warningLevel)); formatDataUsage(info.warningLevel)); } else if (info.usageLevel <= info.limitLevel) { // over warning, under limit titleId = R.string.quick_settings_cellular_detail_remaining_data; bytes = info.limitLevel - info.usageLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_used, formatBytes(info.usageLevel)); formatDataUsage(info.usageLevel)); bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit, formatBytes(info.limitLevel)); formatDataUsage(info.limitLevel)); } else { // over limit titleId = R.string.quick_settings_cellular_detail_over_limit; bytes = info.usageLevel - info.limitLevel; top = res.getString(R.string.quick_settings_cellular_detail_data_used, formatBytes(info.usageLevel)); formatDataUsage(info.usageLevel)); bottom = res.getString(R.string.quick_settings_cellular_detail_data_limit, formatBytes(info.limitLevel)); formatDataUsage(info.limitLevel)); usageColor = Utils.getColorAttr(mContext, android.R.attr.colorError); } Loading @@ -101,7 +100,7 @@ public class DataUsageDetailView extends LinearLayout { final TextView title = findViewById(android.R.id.title); title.setText(titleId); final TextView usage = findViewById(R.id.usage_text); usage.setText(formatBytes(bytes)); usage.setText(formatDataUsage(bytes)); usage.setTextColor(usageColor); final DataUsageGraph graph = findViewById(R.id.usage_graph); graph.setLevels(info.limitLevel, info.warningLevel, info.usageLevel); Loading @@ -123,20 +122,10 @@ public class DataUsageDetailView extends LinearLayout { } private String formatBytes(long bytes) { final long b = Math.abs(bytes); double val; String suffix; if (b > 100 * MB) { val = b / GB; suffix = "GB"; } else if (b > 100 * KB) { val = b / MB; suffix = "MB"; } else { val = b / KB; suffix = "KB"; } return FORMAT.format(val * (bytes < 0 ? -1 : 1)) + " " + suffix; private CharSequence formatDataUsage(long byteValue) { final BytesResult res = Formatter.formatBytes(mContext.getResources(), byteValue, Formatter.FLAG_IEC_UNITS); return BidiFormatter.getInstance().unicodeWrap(mContext.getString( com.android.internal.R.string.fileSizeSuffix, res.value, res.units)); } }