// Path: app/src/main/java/de/dorianscholz/openlibre/model/AlgorithmUtil.java
// public static final DateFormat mFormatDateTime = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
// 
// Path: app/src/main/java/de/dorianscholz/openlibre/model/GlucoseData.java
// public static String formatValue(float value) {
//     return GLUCOSE_UNIT_IS_MMOL ?
//             new DecimalFormat("##.0").format(value) :
//             new DecimalFormat("###").format(value);
// }
// 
// Path: app/src/main/java/de/dorianscholz/openlibre/model/GlucoseData.java
// public static String getDisplayUnit() {
//     return GLUCOSE_UNIT_IS_MMOL ? "mmol/l" : "mg/dl";
// }


import android.content.Context;
import android.util.Log;
import android.widget.TextView;
import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import de.dorianscholz.openlibre.R;
import static de.dorianscholz.openlibre.model.AlgorithmUtil.mFormatDateTime;
import static de.dorianscholz.openlibre.model.GlucoseData.formatValue;
import static de.dorianscholz.openlibre.model.GlucoseData.getDisplayUnit;
import static java.lang.Math.max;
import static java.lang.Math.min;
package de.dorianscholz.openlibre.ui;






public class DateTimeMarkerView extends MarkerView {

    private TextView tvContent;
    private long mFirstDate;

    public DateTimeMarkerView(Context context, int layoutResource) {
        super(context, layoutResource);
        tvContent = (TextView) findViewById(R.id.tvContent);
    }

    public void setFirstDate(long firstDate) {
        mFirstDate = firstDate;
    }

    private long convertXAxisValueToDate(float value) {
        return mFirstDate + (long) (value * TimeUnit.MINUTES.toMillis(1L));
    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
// Path: app/src/main/java/de/dorianscholz/openlibre/model/AlgorithmUtil.java
// public static final DateFormat mFormatDateTime = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
// 
// Path: app/src/main/java/de/dorianscholz/openlibre/model/GlucoseData.java
// public static String formatValue(float value) {
//     return GLUCOSE_UNIT_IS_MMOL ?
//             new DecimalFormat("##.0").format(value) :
//             new DecimalFormat("###").format(value);
// }
// 
// Path: app/src/main/java/de/dorianscholz/openlibre/model/GlucoseData.java
// public static String getDisplayUnit() {
//     return GLUCOSE_UNIT_IS_MMOL ? "mmol/l" : "mg/dl";
// }


// Path: app/src/main/java/de/dorianscholz/openlibre/ui/DateTimeMarkerView.java
import android.content.Context;
import android.util.Log;
import android.widget.TextView;
import com.github.mikephil.charting.charts.Chart;
import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import de.dorianscholz.openlibre.R;
import static de.dorianscholz.openlibre.model.AlgorithmUtil.mFormatDateTime;
import static de.dorianscholz.openlibre.model.GlucoseData.formatValue;
import static de.dorianscholz.openlibre.model.GlucoseData.getDisplayUnit;
import static java.lang.Math.max;
import static java.lang.Math.min;

package de.dorianscholz.openlibre.ui;






public class DateTimeMarkerView extends MarkerView {

    private TextView tvContent;
    private long mFirstDate;

    public DateTimeMarkerView(Context context, int layoutResource) {
        super(context, layoutResource);
        tvContent = (TextView) findViewById(R.id.tvContent);
    }

    public void setFirstDate(long firstDate) {
        mFirstDate = firstDate;
    }

    private long convertXAxisValueToDate(float value) {
        return mFirstDate + (long) (value * TimeUnit.MINUTES.toMillis(1L));
    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
        tvContent.setText(formatValue(e.getY()) + " " + getDisplayUnit() + " at " + mFormatDateTime.format(new Date(convertXAxisValueToDate(e.getX()))));