use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.
the class NetworkRadioSegment method createComponentsList.
@Override
public void createComponentsList(@NotNull List<Animatable> animatables) {
EnumMap<RadioState, Color> colorsMap = getRadioStateColor();
EnumMap<RadioState, String> labelsMap = getRadioStateLabel();
mRadioChart = new StateChart(colorsMap);
mRadioChart.addSeries(new RangedSeries<>(myTimeCurrentRangeUs, new DataStoreSeries<>(mDataStore, SeriesDataType.NETWORK_RADIO)));
mNetworkTypeChart = new StateChart<>(getNetworkTypeColor());
mNetworkTypeChart.setRenderMode(StateChart.RenderMode.TEXT);
mNetworkTypeChart.addSeries(new RangedSeries<>(myTimeCurrentRangeUs, new DataStoreSeries<>(mDataStore, SeriesDataType.NETWORK_TYPE)));
List<LegendRenderData> legendRenderDataList = new ArrayList<>();
for (RadioState state : RadioState.values()) {
LegendRenderData renderData = new LegendRenderData(LegendRenderData.IconType.LINE, colorsMap.get(state), labelsMap.get(state));
legendRenderDataList.add(renderData);
}
mLegendComponent = new LegendComponent(LegendComponent.Orientation.HORIZONTAL, 100);
mLegendComponent.setLegendData(legendRenderDataList);
animatables.add(mNetworkTypeChart);
animatables.add(mRadioChart);
animatables.add(mLegendComponent);
}
use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.
the class ThreadsSegment method initializeLegendComponent.
private void initializeLegendComponent() {
List<LegendRenderData> legendRenderDataList = new ArrayList<>();
// Running state
legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, getThreadStateColor().get(CpuProfiler.ThreadActivity.State.RUNNING), RUNNING_LABEL));
// Sleeping state
legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, getThreadStateColor().get(CpuProfiler.ThreadActivity.State.SLEEPING), SLEEPING_LABEL));
// Blocked state. TODO: support this state later if we actually should do so
legendRenderDataList.add(new LegendRenderData(LegendRenderData.IconType.BOX, new JBColor(new Color(199, 65, 101), new Color(199, 65, 101)), BLOCKED_LABEL));
mLegendComponent = new LegendComponent(LegendComponent.Orientation.HORIZONTAL, Integer.MAX_VALUE);
mLegendComponent.setLegendData(legendRenderDataList);
}
use of com.android.tools.adtui.LegendRenderData in project android by JetBrains.
the class NetworkRadioView method getLegendData.
@NotNull
private static List<LegendRenderData> getLegendData() {
List<LegendRenderData> legendData = new ArrayList<>();
for (RadioState state : RadioState.values()) {
if (state == RadioState.NONE) {
continue;
} else if (state == RadioState.LOW) {
// consider removing this state entirely.
continue;
}
LegendRenderData renderData = new LegendRenderData(LegendRenderData.IconType.LINE, RADIO_STATE_COLOR.get(state), state.toString());
legendData.add(renderData);
}
return legendData;
}
Aggregations