fedilab-Android-App/app/src/common/java/app/fedilab/android/activities/OwnerChartsActivity.java

451 lines
18 KiB
Java
Raw Normal View History

2019-07-28 15:55:25 +02:00
/* Copyright 2019 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
package app.fedilab.android.activities;
2020-06-15 19:14:11 +02:00
import android.annotation.SuppressLint;
2019-07-28 15:55:25 +02:00
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
2019-07-29 08:59:55 +02:00
import android.graphics.Color;
2019-11-13 12:54:01 +01:00
import android.graphics.drawable.ColorDrawable;
2019-07-28 15:55:25 +02:00
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.DatePicker;
2019-07-29 17:03:36 +02:00
import android.widget.ImageButton;
2019-07-28 15:55:25 +02:00
import android.widget.ImageView;
2019-08-18 17:41:10 +02:00
import android.widget.LinearLayout;
2019-07-29 17:03:36 +02:00
import android.widget.RelativeLayout;
2019-07-28 15:55:25 +02:00
import android.widget.TextView;
2019-07-29 15:18:41 +02:00
2019-07-28 15:55:25 +02:00
import androidx.appcompat.app.ActionBar;
import androidx.core.content.ContextCompat;
2019-09-06 17:55:14 +02:00
2019-07-28 15:55:25 +02:00
import com.github.mikephil.charting.charts.LineChart;
2019-07-29 14:48:53 +02:00
import com.github.mikephil.charting.components.Description;
import com.github.mikephil.charting.components.Legend;
2019-07-29 17:03:36 +02:00
import com.github.mikephil.charting.components.MarkerView;
2019-07-28 18:13:39 +02:00
import com.github.mikephil.charting.components.XAxis;
2019-07-29 14:48:53 +02:00
import com.github.mikephil.charting.components.YAxis;
2019-07-28 18:13:39 +02:00
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
2019-07-29 08:59:55 +02:00
import com.github.mikephil.charting.formatter.ValueFormatter;
2019-07-29 17:03:36 +02:00
import com.github.mikephil.charting.highlight.Highlight;
2019-07-28 18:13:39 +02:00
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
2019-07-29 17:03:36 +02:00
import com.github.mikephil.charting.utils.MPPointF;
2019-07-29 08:59:55 +02:00
import java.text.DateFormat;
import java.text.SimpleDateFormat;
2019-07-28 15:55:25 +02:00
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
2019-07-30 17:23:32 +02:00
import java.util.Iterator;
2019-07-28 15:55:25 +02:00
import java.util.List;
2019-07-29 08:59:55 +02:00
import java.util.Locale;
2019-07-30 17:23:32 +02:00
import java.util.Map;
2019-07-29 08:59:55 +02:00
2019-07-28 15:55:25 +02:00
import app.fedilab.android.R;
import app.fedilab.android.asynctasks.RetrieveChartsAsyncTask;
2019-07-29 15:18:41 +02:00
import app.fedilab.android.client.Entities.Account;
2019-07-28 15:55:25 +02:00
import app.fedilab.android.client.Entities.Charts;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.interfaces.OnRetrieveChartsInterface;
2019-07-29 15:18:41 +02:00
import app.fedilab.android.sqlite.AccountDAO;
2019-07-28 15:55:25 +02:00
import app.fedilab.android.sqlite.Sqlite;
import app.fedilab.android.sqlite.StatusCacheDAO;
/**
* Created by Thomas on 28/07/2019.
* Charts for owner activity
*/
public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChartsInterface {
private Button settings_time_from, settings_time_to;
private Date dateIni, dateEnd;
private LineChart chart;
2019-07-29 14:48:53 +02:00
private int theme;
2019-07-29 17:03:36 +02:00
private RelativeLayout loader;
private ImageButton validate;
2019-11-15 16:32:25 +01:00
private DatePickerDialog.OnDateSetListener iniDateSetListener =
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
Calendar c = Calendar.getInstance();
c.set(year, monthOfYear, dayOfMonth, 0, 0);
dateIni = new Date(c.getTimeInMillis());
settings_time_from.setText(Helper.shortDateToString(new Date(c.getTimeInMillis())));
}
};
private DatePickerDialog.OnDateSetListener endDateSetListener =
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
Calendar c = Calendar.getInstance();
c.set(year, monthOfYear, dayOfMonth, 23, 59);
dateEnd = new Date(c.getTimeInMillis());
settings_time_to.setText(Helper.shortDateToString(new Date(c.getTimeInMillis())));
}
};
2019-07-28 15:55:25 +02:00
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
2019-07-29 14:48:53 +02:00
theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
2019-09-06 17:55:14 +02:00
switch (theme) {
2019-07-28 15:55:25 +02:00
case Helper.THEME_LIGHT:
2019-11-09 15:47:38 +01:00
setTheme(R.style.AppTheme_Fedilab);
2019-07-28 15:55:25 +02:00
break;
case Helper.THEME_BLACK:
2019-07-29 14:48:53 +02:00
setTheme(R.style.AppThemeBlack);
2019-07-28 15:55:25 +02:00
break;
default:
2019-07-29 14:48:53 +02:00
setTheme(R.style.AppThemeDark);
2019-07-28 15:55:25 +02:00
}
2019-09-06 17:55:14 +02:00
if (getSupportActionBar() != null)
2019-07-29 14:48:53 +02:00
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
2019-07-28 15:55:25 +02:00
ActionBar actionBar = getSupportActionBar();
2019-09-06 17:55:14 +02:00
if (actionBar != null) {
2019-07-29 14:48:53 +02:00
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
2019-07-28 15:55:25 +02:00
assert inflater != null;
2020-04-08 12:42:15 +02:00
View view = inflater.inflate(R.layout.simple_action_bar, new LinearLayout(OwnerChartsActivity.this), false);
2019-11-15 19:36:39 +01:00
view.setBackground(new ColorDrawable(ContextCompat.getColor(OwnerChartsActivity.this, R.color.cyanea_primary)));
2019-07-28 15:55:25 +02:00
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
2019-07-29 15:18:41 +02:00
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.close_conversation);
ImageView pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
2019-07-29 14:48:53 +02:00
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
2019-07-29 15:18:41 +02:00
2020-04-09 18:57:12 +02:00
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
2019-07-29 15:18:41 +02:00
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
2020-04-08 12:42:15 +02:00
Account account = new AccountDAO(OwnerChartsActivity.this, db).getUniqAccount(userId, instance);
2019-09-06 17:55:14 +02:00
if (account != null) {
2020-04-08 12:42:15 +02:00
Helper.loadGiF(OwnerChartsActivity.this, account, pp_actionBar);
2019-07-29 15:18:41 +02:00
}
2020-03-08 09:15:12 +01:00
toolbar_close.setOnClickListener(v -> finish());
2019-09-06 17:55:14 +02:00
if (account != null) {
2020-03-08 09:15:12 +01:00
String titleStr = getString(R.string.owner_charts) + " - " + account.getUsername() + "@" + account.getInstance();
toolbar_title.setText(titleStr);
2019-09-06 17:55:14 +02:00
} else {
2019-07-29 15:18:41 +02:00
toolbar_title.setText(R.string.owner_charts);
}
2019-07-28 15:55:25 +02:00
}
2019-07-29 14:48:53 +02:00
setContentView(R.layout.activity_ower_charts);
2019-07-28 15:55:25 +02:00
chart = findViewById(R.id.chart);
settings_time_from = findViewById(R.id.settings_time_from);
settings_time_to = findViewById(R.id.settings_time_to);
2019-09-06 17:55:14 +02:00
loader = findViewById(R.id.loader);
2019-07-29 17:03:36 +02:00
validate = findViewById(R.id.validate);
2019-07-28 15:55:25 +02:00
2020-04-09 18:57:12 +02:00
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
2019-07-28 15:55:25 +02:00
dateIni = new StatusCacheDAO(OwnerChartsActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
2019-07-28 18:13:39 +02:00
2019-07-29 17:03:36 +02:00
2020-06-19 17:17:17 +02:00
if (dateIni == null) {
2020-06-15 19:14:11 +02:00
dateIni = new Date();
dateEnd = new Date();
}
2019-07-29 17:03:36 +02:00
int style;
2019-09-06 17:55:14 +02:00
if (theme == Helper.THEME_DARK) {
2019-07-29 17:03:36 +02:00
style = R.style.DialogDark;
2019-09-06 17:55:14 +02:00
} else if (theme == Helper.THEME_BLACK) {
2019-07-29 17:03:36 +02:00
style = R.style.DialogBlack;
2019-09-06 17:55:14 +02:00
} else {
2019-07-29 17:03:36 +02:00
style = R.style.Dialog;
}
Calendar c = Calendar.getInstance();
c.setTime(dateIni);
int yearIni = c.get(Calendar.YEAR);
int monthIni = c.get(Calendar.MONTH);
int dayIni = c.get(Calendar.DAY_OF_MONTH);
final DatePickerDialog dateIniPickerDialog = new DatePickerDialog(
OwnerChartsActivity.this, style, iniDateSetListener, yearIni, monthIni, dayIni);
2020-03-08 09:15:12 +01:00
settings_time_from.setOnClickListener(v -> dateIniPickerDialog.show());
2019-07-29 17:03:36 +02:00
Calendar ce = Calendar.getInstance();
c.setTime(dateEnd);
int yearEnd = ce.get(Calendar.YEAR);
int monthEnd = ce.get(Calendar.MONTH);
int dayEnd = ce.get(Calendar.DAY_OF_MONTH);
final DatePickerDialog dateEndPickerDialog = new DatePickerDialog(
OwnerChartsActivity.this, style, endDateSetListener, yearEnd, monthEnd, dayEnd);
2020-03-08 09:15:12 +01:00
settings_time_to.setOnClickListener(v -> dateEndPickerDialog.show());
2019-07-29 17:03:36 +02:00
dateIniPickerDialog.getDatePicker().setMinDate(dateIni.getTime());
dateIniPickerDialog.getDatePicker().setMaxDate(dateEnd.getTime());
dateEndPickerDialog.getDatePicker().setMinDate(dateIni.getTime());
dateEndPickerDialog.getDatePicker().setMaxDate(dateEnd.getTime());
2019-07-28 18:13:39 +02:00
Calendar cal = Calendar.getInstance();
cal.setTime(dateEnd);
cal.add(Calendar.MONTH, -1);
Date result = cal.getTime();
2019-07-29 08:59:55 +02:00
if (result.after(dateIni))
2019-07-28 18:13:39 +02:00
dateIni = result;
2019-07-29 08:59:55 +02:00
if (dateIni == null) {
2019-07-28 15:55:25 +02:00
dateIni = new Date();
}
2019-07-29 08:59:55 +02:00
if (dateEnd == null) {
2019-07-28 15:55:25 +02:00
dateEnd = new Date();
}
2020-04-08 12:42:15 +02:00
CustomMarkerView mv = new CustomMarkerView(OwnerChartsActivity.this, R.layout.markerview);
2019-07-29 17:03:36 +02:00
chart.setMarkerView(mv);
2020-03-08 09:15:12 +01:00
validate.setOnClickListener(v -> loadGraph(dateIni, dateEnd));
2019-07-29 17:03:36 +02:00
loadGraph(dateIni, dateEnd);
2019-07-28 15:55:25 +02:00
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
2019-11-10 10:24:38 +01:00
if (item.getItemId() == android.R.id.home) {
finish();
return true;
2019-07-28 15:55:25 +02:00
}
2019-11-10 10:24:38 +01:00
return super.onOptionsItemSelected(item);
2019-07-28 15:55:25 +02:00
}
2019-09-06 17:55:14 +02:00
private void loadGraph(Date dateIni, Date dateEnd) {
2019-07-29 17:03:36 +02:00
String dateInitString = Helper.shortDateToString(dateIni);
String dateEndString = Helper.shortDateToString(dateEnd);
settings_time_from.setText(dateInitString);
settings_time_to.setText(dateEndString);
chart.setVisibility(View.GONE);
loader.setVisibility(View.VISIBLE);
validate.setEnabled(false);
new RetrieveChartsAsyncTask(OwnerChartsActivity.this, dateIni, dateEnd, OwnerChartsActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
2019-07-28 15:55:25 +02:00
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onCharts(Charts charts) {
2019-07-28 18:13:39 +02:00
List<Entry> boostsEntry = new ArrayList<>();
2020-06-15 19:14:11 +02:00
Iterator<Map.Entry<Long, Integer>> it = charts.getBoosts().entrySet().iterator();
2019-07-30 17:23:32 +02:00
while (it.hasNext()) {
2020-06-15 19:14:11 +02:00
Map.Entry<Long, Integer> pair = it.next();
boostsEntry.add(new Entry(pair.getKey(), pair.getValue()));
2019-07-30 17:23:32 +02:00
it.remove();
2019-07-28 18:13:39 +02:00
}
List<Entry> repliesEntry = new ArrayList<>();
2019-07-30 17:23:32 +02:00
it = charts.getReplies().entrySet().iterator();
while (it.hasNext()) {
2020-06-15 19:14:11 +02:00
Map.Entry<Long, Integer> pair = it.next();
repliesEntry.add(new Entry(pair.getKey(), pair.getValue()));
2019-07-30 17:23:32 +02:00
it.remove();
2019-07-28 18:13:39 +02:00
}
2019-07-30 17:23:32 +02:00
2019-07-28 18:13:39 +02:00
List<Entry> statusesEntry = new ArrayList<>();
2019-07-30 17:23:32 +02:00
it = charts.getStatuses().entrySet().iterator();
while (it.hasNext()) {
2020-06-15 19:14:11 +02:00
Map.Entry<Long, Integer> pair = it.next();
statusesEntry.add(new Entry(pair.getKey(), pair.getValue()));
2019-07-30 17:23:32 +02:00
it.remove();
2019-07-28 18:13:39 +02:00
}
2019-07-30 17:23:32 +02:00
2019-07-28 18:13:39 +02:00
LineDataSet dataSetBoosts = new LineDataSet(boostsEntry, getString(R.string.reblog));
dataSetBoosts.setColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
2019-07-29 14:48:53 +02:00
dataSetBoosts.setValueTextSize(12f);
2019-07-28 18:13:39 +02:00
dataSetBoosts.setValueTextColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
2019-07-29 14:48:53 +02:00
dataSetBoosts.setFillColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
dataSetBoosts.setDrawValues(false);
dataSetBoosts.setDrawFilled(true);
dataSetBoosts.setDrawCircles(false);
dataSetBoosts.setDrawCircleHole(false);
2019-07-29 15:18:41 +02:00
dataSetBoosts.setLineWidth(2f);
2019-07-29 14:48:53 +02:00
dataSetBoosts.setMode(LineDataSet.Mode.CUBIC_BEZIER);
2019-07-28 18:13:39 +02:00
LineDataSet dateSetReplies = new LineDataSet(repliesEntry, getString(R.string.replies));
2019-07-29 14:48:53 +02:00
dateSetReplies.setColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_reply));
dateSetReplies.setValueTextSize(12f);
dateSetReplies.setValueTextColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_reply));
dateSetReplies.setFillColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_reply));
dateSetReplies.setDrawValues(false);
dateSetReplies.setDrawFilled(true);
dateSetReplies.setDrawCircles(false);
dateSetReplies.setDrawCircleHole(false);
2019-07-29 15:18:41 +02:00
dateSetReplies.setLineWidth(2f);
2019-07-29 14:48:53 +02:00
dateSetReplies.setMode(LineDataSet.Mode.CUBIC_BEZIER);
2019-07-28 18:13:39 +02:00
LineDataSet dataSetStatuses = new LineDataSet(statusesEntry, getString(R.string.statuses));
2019-07-29 14:48:53 +02:00
dataSetStatuses.setColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_status));
dataSetStatuses.setValueTextSize(12f);
dataSetStatuses.setValueTextColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_status));
dataSetStatuses.setFillColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_status));
dataSetStatuses.setDrawValues(false);
dataSetStatuses.setDrawFilled(true);
dataSetStatuses.setDrawCircles(false);
dataSetStatuses.setDrawCircleHole(false);
2019-07-29 15:18:41 +02:00
dataSetStatuses.setLineWidth(2f);
2019-07-29 14:48:53 +02:00
dataSetStatuses.setMode(LineDataSet.Mode.CUBIC_BEZIER);
2019-07-28 18:13:39 +02:00
2019-07-29 14:48:53 +02:00
List<ILineDataSet> dataSets = new ArrayList<>();
2019-07-28 18:13:39 +02:00
dataSets.add(dataSetBoosts);
dataSets.add(dateSetReplies);
dataSets.add(dataSetStatuses);
2019-07-29 14:48:53 +02:00
//X axis
2019-07-28 18:13:39 +02:00
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setLabelRotationAngle(45);
2019-07-29 14:48:53 +02:00
xAxis.setTextSize(14f);
//Legend
Legend legend = chart.getLegend();
legend.setTextSize(16f);
legend.setXEntrySpace(15f);
//Left axis
YAxis leftAxis = chart.getAxis(YAxis.AxisDependency.LEFT);
leftAxis.setTextSize(14f);
leftAxis.setAxisMinimum(0f);
leftAxis.setDrawAxisLine(true);
leftAxis.setDrawGridLines(true);
leftAxis.setDrawLabels(true);
//Remove right axis
chart.getAxis(YAxis.AxisDependency.RIGHT).setEnabled(false);
Description description = chart.getDescription();
description.setEnabled(false);
//Update colors
2019-09-06 17:55:14 +02:00
switch (theme) {
2019-07-29 14:48:53 +02:00
case Helper.THEME_LIGHT:
xAxis.setTextColor(Color.BLACK);
dataSetBoosts.setValueTextColor(Color.BLACK);
dateSetReplies.setValueTextColor(Color.BLACK);
dataSetStatuses.setValueTextColor(Color.BLACK);
legend.setTextColor(Color.BLACK);
leftAxis.setTextColor(Color.BLACK);
break;
case Helper.THEME_DARK:
case Helper.THEME_BLACK:
int color = ContextCompat.getColor(OwnerChartsActivity.this, R.color.dark_text);
xAxis.setTextColor(color);
dataSetBoosts.setValueTextColor(color);
dateSetReplies.setValueTextColor(color);
dataSetStatuses.setValueTextColor(color);
legend.setTextColor(color);
leftAxis.setTextColor(color);
}
2019-07-28 18:13:39 +02:00
xAxis.setDrawAxisLine(true);
xAxis.setDrawGridLines(false);
2019-07-29 08:59:55 +02:00
xAxis.setValueFormatter(new MyXAxisValueFormatter());
2019-07-28 18:13:39 +02:00
LineData data = new LineData(dataSets);
chart.setData(data);
2019-07-29 17:03:36 +02:00
chart.setVisibility(View.VISIBLE);
loader.setVisibility(View.GONE);
validate.setEnabled(true);
2019-07-28 18:13:39 +02:00
chart.invalidate();
2019-07-28 15:55:25 +02:00
}
2019-07-29 08:59:55 +02:00
2020-06-15 19:14:11 +02:00
@SuppressLint("ViewConstructor")
2020-03-08 09:15:12 +01:00
public static class CustomMarkerView extends MarkerView {
2019-11-15 16:32:25 +01:00
private TextView tvContent;
private MPPointF mOffset;
public CustomMarkerView(Context context, int layoutResource) {
super(context, layoutResource);
tvContent = findViewById(R.id.tvContent);
tvContent.setTextColor(ContextCompat.getColor(context, R.color.cyanea_accent_reference));
}
@Override
public void refreshContent(Entry e, Highlight highlight) {
Date date = new Date(((long) e.getX()));
2020-03-08 09:15:12 +01:00
String tvContentStr = Helper.shortDateToString(date) + " - " + (int) e.getY();
tvContent.setText(tvContentStr);
2019-11-15 16:32:25 +01:00
super.refreshContent(e, highlight);
}
@Override
public MPPointF getOffset() {
if (mOffset == null) {
2020-06-19 17:17:17 +02:00
mOffset = new MPPointF(-((float) getWidth() / 2), -getHeight());
2019-11-15 16:32:25 +01:00
}
return mOffset;
}
}
2019-07-29 08:59:55 +02:00
2020-03-08 09:15:12 +01:00
public static class MyXAxisValueFormatter extends ValueFormatter {
2019-07-29 08:59:55 +02:00
private DateFormat mDataFormat;
private Date mDate;
MyXAxisValueFormatter() {
this.mDataFormat = new SimpleDateFormat("dd.MM", Locale.getDefault());
this.mDate = new Date();
}
2019-09-06 17:55:14 +02:00
2019-07-29 08:59:55 +02:00
@Override
public String getFormattedValue(float value) {
return getDateString((long) value);
}
private String getDateString(long timestamp) {
try {
mDate.setTime(timestamp);
return mDataFormat.format(mDate);
2019-09-06 17:55:14 +02:00
} catch (Exception ex) {
2019-07-29 08:59:55 +02:00
return "xx";
}
}
}
2019-07-28 15:55:25 +02:00
}