mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-08 22:51:37 +02:00
7c597b325a
- model package contains mostly shared interfaces (UI+service), not named GB* - impl package contains implementations of those interfaces, named GB* the impl classes should not be used by the service (not completely done) - the service classes should mostly use classes inside the service and deviceevents packages (tbd) Every device now has two packages: - devices/[device name] for UI related functionality - service[device name] for lowlevel communication
43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
package nodomain.freeyourgadget.gadgetbridge.activities.charts;
|
|
|
|
import android.graphics.Typeface;
|
|
|
|
import com.github.mikephil.charting.components.Legend;
|
|
import com.github.mikephil.charting.data.ChartData;
|
|
import com.github.mikephil.charting.renderer.LegendRenderer;
|
|
import com.github.mikephil.charting.utils.ViewPortHandler;
|
|
|
|
/**
|
|
* A legend renderer that does *not* calculate the labels and colors automatically
|
|
* from the data sets or the data entries.
|
|
* <p/>
|
|
* Instead, they have to be provided manually, because otherwise the legend will
|
|
* be empty.
|
|
*/
|
|
public class CustomLegendRenderer extends LegendRenderer {
|
|
public CustomLegendRenderer(ViewPortHandler viewPortHandler, Legend legend) {
|
|
super(viewPortHandler, legend);
|
|
}
|
|
|
|
@Override
|
|
public void computeLegend(ChartData<?> data) {
|
|
if (!mLegend.isEnabled()) {
|
|
return;
|
|
}
|
|
|
|
// don't call super to avoid computing colors and labels
|
|
// super.computeLegend(data);
|
|
|
|
Typeface tf = mLegend.getTypeface();
|
|
|
|
if (tf != null)
|
|
mLegendLabelPaint.setTypeface(tf);
|
|
|
|
mLegendLabelPaint.setTextSize(mLegend.getTextSize());
|
|
mLegendLabelPaint.setColor(mLegend.getTextColor());
|
|
|
|
// calculate all dimensions of the mLegend
|
|
mLegend.calculateDimensions(mLegendLabelPaint);
|
|
}
|
|
}
|