Merge branch 'draw_charts' into develop
# Conflicts: # app/build.gradle
This commit is contained in:
commit
1769ac4e27
|
@ -122,4 +122,5 @@ dependencies {
|
||||||
implementation 'com.github.duanhong169:colorpicker:1.1.6'
|
implementation 'com.github.duanhong169:colorpicker:1.1.6'
|
||||||
|
|
||||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.0.0'
|
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.0.0'
|
||||||
|
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,12 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
/>
|
/>
|
||||||
|
<activity android:name="app.fedilab.android.activities.OwnerChartsActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
/>
|
||||||
<activity android:name="app.fedilab.android.activities.LanguageActivity"
|
<activity android:name="app.fedilab.android.activities.LanguageActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -0,0 +1,474 @@
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Color;
|
||||||
|
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;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.components.Description;
|
||||||
|
import com.github.mikephil.charting.components.IMarker;
|
||||||
|
import com.github.mikephil.charting.components.Legend;
|
||||||
|
import com.github.mikephil.charting.components.MarkerView;
|
||||||
|
import com.github.mikephil.charting.components.XAxis;
|
||||||
|
import com.github.mikephil.charting.components.YAxis;
|
||||||
|
import com.github.mikephil.charting.data.Entry;
|
||||||
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
import com.github.mikephil.charting.data.LineDataSet;
|
||||||
|
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||||
|
import com.github.mikephil.charting.highlight.Highlight;
|
||||||
|
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||||
|
import com.github.mikephil.charting.utils.MPPointF;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import app.fedilab.android.R;
|
||||||
|
import app.fedilab.android.asynctasks.RetrieveChartsAsyncTask;
|
||||||
|
import app.fedilab.android.client.Entities.Account;
|
||||||
|
import app.fedilab.android.client.Entities.Charts;
|
||||||
|
import app.fedilab.android.helper.Helper;
|
||||||
|
import app.fedilab.android.interfaces.OnRetrieveChartsInterface;
|
||||||
|
import app.fedilab.android.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
import app.fedilab.android.sqlite.StatusCacheDAO;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 28/07/2019.
|
||||||
|
* Charts for owner activity
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChartsInterface {
|
||||||
|
|
||||||
|
|
||||||
|
LinearLayoutManager mLayoutManager;
|
||||||
|
private Button settings_time_from, settings_time_to;
|
||||||
|
private Date dateIni, dateEnd;
|
||||||
|
private LineChart chart;
|
||||||
|
private int theme;
|
||||||
|
private RelativeLayout loader;
|
||||||
|
private ImageButton validate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
switch (theme){
|
||||||
|
case Helper.THEME_LIGHT:
|
||||||
|
setTheme(R.style.AppTheme);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_DARK:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
break;
|
||||||
|
case Helper.THEME_BLACK:
|
||||||
|
setTheme(R.style.AppThemeBlack);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setTheme(R.style.AppThemeDark);
|
||||||
|
}
|
||||||
|
if( getSupportActionBar() != null)
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if( actionBar != null ) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
assert inflater != null;
|
||||||
|
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.simple_action_bar, null);
|
||||||
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
|
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.close_conversation);
|
||||||
|
ImageView pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
|
||||||
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
|
Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance);
|
||||||
|
if( account != null) {
|
||||||
|
String url = account.getAvatar();
|
||||||
|
if (url.startsWith("/")) {
|
||||||
|
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
|
||||||
|
}
|
||||||
|
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if( account != null) {
|
||||||
|
toolbar_title.setText(getString(R.string.owner_charts) + " - " + account.getUsername() + "@" + account.getInstance());
|
||||||
|
}else{
|
||||||
|
toolbar_title.setText(R.string.owner_charts);
|
||||||
|
}
|
||||||
|
if (theme == Helper.THEME_LIGHT){
|
||||||
|
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||||
|
Helper.colorizeToolbar(toolbar, R.color.black, OwnerChartsActivity.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setContentView(R.layout.activity_ower_charts);
|
||||||
|
|
||||||
|
|
||||||
|
chart = findViewById(R.id.chart);
|
||||||
|
settings_time_from = findViewById(R.id.settings_time_from);
|
||||||
|
settings_time_to = findViewById(R.id.settings_time_to);
|
||||||
|
loader = findViewById(R.id.loader);
|
||||||
|
validate = findViewById(R.id.validate);
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(OwnerChartsActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
dateIni = new StatusCacheDAO(OwnerChartsActivity.this, db).getSmallerDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
|
dateEnd = new StatusCacheDAO(OwnerChartsActivity.this, db).getGreaterDate(StatusCacheDAO.ARCHIVE_CACHE);
|
||||||
|
|
||||||
|
|
||||||
|
int style;
|
||||||
|
if( theme == Helper.THEME_DARK){
|
||||||
|
style = R.style.DialogDark;
|
||||||
|
}else if( theme == Helper.THEME_BLACK){
|
||||||
|
style = R.style.DialogBlack;
|
||||||
|
}else {
|
||||||
|
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);
|
||||||
|
settings_time_from.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dateIniPickerDialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
settings_time_to.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
dateEndPickerDialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dateIniPickerDialog.getDatePicker().setMinDate(dateIni.getTime());
|
||||||
|
dateIniPickerDialog.getDatePicker().setMaxDate(dateEnd.getTime());
|
||||||
|
|
||||||
|
dateEndPickerDialog.getDatePicker().setMinDate(dateIni.getTime());
|
||||||
|
dateEndPickerDialog.getDatePicker().setMaxDate(dateEnd.getTime());
|
||||||
|
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(dateEnd);
|
||||||
|
cal.add(Calendar.MONTH, -1);
|
||||||
|
Date result = cal.getTime();
|
||||||
|
if (result.after(dateIni))
|
||||||
|
dateIni = result;
|
||||||
|
|
||||||
|
if (dateIni == null) {
|
||||||
|
dateIni = new Date();
|
||||||
|
}
|
||||||
|
if (dateEnd == null) {
|
||||||
|
dateEnd = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CustomMarkerView mv = new CustomMarkerView(getApplicationContext(), R.layout.markerview);
|
||||||
|
chart.setMarkerView(mv);
|
||||||
|
|
||||||
|
validate.setOnClickListener(v->{
|
||||||
|
loadGraph(dateIni, dateEnd);
|
||||||
|
});
|
||||||
|
|
||||||
|
loadGraph(dateIni, dateEnd);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CustomMarkerView extends MarkerView {
|
||||||
|
private TextView tvContent;
|
||||||
|
|
||||||
|
public CustomMarkerView(Context context, int layoutResource) {
|
||||||
|
super(context, layoutResource);
|
||||||
|
tvContent = findViewById(R.id.tvContent);
|
||||||
|
if( theme == Helper.THEME_DARK){
|
||||||
|
tvContent.setTextColor(ContextCompat.getColor(context, R.color.dark_text));
|
||||||
|
}else if( theme == Helper.THEME_BLACK){
|
||||||
|
tvContent.setTextColor(ContextCompat.getColor(context, R.color.dark_text));
|
||||||
|
}else {
|
||||||
|
tvContent.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void refreshContent(Entry e, Highlight highlight) {
|
||||||
|
Date date = new Date(((long) e.getX()));
|
||||||
|
tvContent.setText(String.valueOf(Helper.shortDateToString(date) + " - " +(int)e.getY()));
|
||||||
|
super.refreshContent(e, highlight);
|
||||||
|
}
|
||||||
|
private MPPointF mOffset;
|
||||||
|
@Override
|
||||||
|
public MPPointF getOffset() {
|
||||||
|
if(mOffset == null) {
|
||||||
|
mOffset = new MPPointF(-(getWidth() / 2), -getHeight());
|
||||||
|
}
|
||||||
|
return mOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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())));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadGraph(Date dateIni, Date dateEnd){
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCharts(Charts charts) {
|
||||||
|
|
||||||
|
List<Entry> boostsEntry = new ArrayList<>();
|
||||||
|
int i = 0;
|
||||||
|
for (int boost : charts.getBoosts()) {
|
||||||
|
boostsEntry.add(new Entry(charts.getxValues().get(i), boost));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Entry> repliesEntry = new ArrayList<>();
|
||||||
|
i = 0;
|
||||||
|
for (int reply : charts.getReplies()) {
|
||||||
|
repliesEntry.add(new Entry(charts.getxValues().get(i), reply));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
List<Entry> statusesEntry = new ArrayList<>();
|
||||||
|
i = 0;
|
||||||
|
for (int status : charts.getStatuses()) {
|
||||||
|
statusesEntry.add(new Entry(charts.getxValues().get(i), status));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
LineDataSet dataSetBoosts = new LineDataSet(boostsEntry, getString(R.string.reblog));
|
||||||
|
dataSetBoosts.setColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
|
||||||
|
dataSetBoosts.setValueTextSize(12f);
|
||||||
|
dataSetBoosts.setValueTextColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
|
||||||
|
dataSetBoosts.setFillColor(ContextCompat.getColor(OwnerChartsActivity.this, R.color.chart_boost));
|
||||||
|
dataSetBoosts.setDrawValues(false);
|
||||||
|
dataSetBoosts.setDrawFilled(true);
|
||||||
|
dataSetBoosts.setDrawCircles(false);
|
||||||
|
dataSetBoosts.setDrawCircleHole(false);
|
||||||
|
dataSetBoosts.setLineWidth(2f);
|
||||||
|
dataSetBoosts.setMode(LineDataSet.Mode.CUBIC_BEZIER);
|
||||||
|
|
||||||
|
LineDataSet dateSetReplies = new LineDataSet(repliesEntry, getString(R.string.replies));
|
||||||
|
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);
|
||||||
|
dateSetReplies.setLineWidth(2f);
|
||||||
|
dateSetReplies.setMode(LineDataSet.Mode.CUBIC_BEZIER);
|
||||||
|
|
||||||
|
LineDataSet dataSetStatuses = new LineDataSet(statusesEntry, getString(R.string.statuses));
|
||||||
|
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);
|
||||||
|
dataSetStatuses.setLineWidth(2f);
|
||||||
|
dataSetStatuses.setMode(LineDataSet.Mode.CUBIC_BEZIER);
|
||||||
|
|
||||||
|
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
dataSets.add(dataSetBoosts);
|
||||||
|
dataSets.add(dateSetReplies);
|
||||||
|
dataSets.add(dataSetStatuses);
|
||||||
|
|
||||||
|
//X axis
|
||||||
|
XAxis xAxis = chart.getXAxis();
|
||||||
|
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
|
||||||
|
xAxis.setLabelRotationAngle(45);
|
||||||
|
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
|
||||||
|
switch (theme){
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
xAxis.setDrawAxisLine(true);
|
||||||
|
xAxis.setDrawGridLines(false);
|
||||||
|
|
||||||
|
xAxis.setValueFormatter(new MyXAxisValueFormatter());
|
||||||
|
LineData data = new LineData(dataSets);
|
||||||
|
chart.setData(data);
|
||||||
|
chart.setVisibility(View.VISIBLE);
|
||||||
|
loader.setVisibility(View.GONE);
|
||||||
|
validate.setEnabled(true);
|
||||||
|
chart.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class MyXAxisValueFormatter extends ValueFormatter {
|
||||||
|
private DateFormat mDataFormat;
|
||||||
|
private Date mDate;
|
||||||
|
|
||||||
|
MyXAxisValueFormatter() {
|
||||||
|
this.mDataFormat = new SimpleDateFormat("dd.MM", Locale.getDefault());
|
||||||
|
this.mDate = new Date();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getFormattedValue(float value) {
|
||||||
|
return getDateString((long) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDateString(long timestamp) {
|
||||||
|
try {
|
||||||
|
mDate.setTime(timestamp);
|
||||||
|
return mDataFormat.format(mDate);
|
||||||
|
} catch(Exception ex) {
|
||||||
|
return "xx";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -43,6 +43,7 @@ import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
@ -547,6 +548,12 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
||||||
TextView first_toot_date = statsDialogView.findViewById(R.id.first_toot_date);
|
TextView first_toot_date = statsDialogView.findViewById(R.id.first_toot_date);
|
||||||
TextView tags = statsDialogView.findViewById(R.id.tags);
|
TextView tags = statsDialogView.findViewById(R.id.tags);
|
||||||
|
|
||||||
|
ImageButton charts = statsDialogView.findViewById(R.id.charts);
|
||||||
|
charts.setOnClickListener(w ->{
|
||||||
|
Intent intent = new Intent(OwnerStatusActivity.this, OwnerChartsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
total_statuses.setText(String.valueOf(statistics.getTotal_statuses()));
|
total_statuses.setText(String.valueOf(statistics.getTotal_statuses()));
|
||||||
number_boosts.setText(String.valueOf(statistics.getNumber_boosts()));
|
number_boosts.setText(String.valueOf(statistics.getNumber_boosts()));
|
||||||
number_replies.setText(String.valueOf(statistics.getNumber_replies()));
|
number_replies.setText(String.valueOf(statistics.getNumber_replies()));
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* 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.asynctasks;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import app.fedilab.android.client.Entities.Charts;
|
||||||
|
import app.fedilab.android.interfaces.OnRetrieveChartsInterface;
|
||||||
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
import app.fedilab.android.sqlite.StatusCacheDAO;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 28/07/2019.
|
||||||
|
* Creates charts for an account
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RetrieveChartsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
|
|
||||||
|
private OnRetrieveChartsInterface listener;
|
||||||
|
private WeakReference<Context> contextReference;
|
||||||
|
private Charts charts;
|
||||||
|
private Date dateIni;
|
||||||
|
private Date dateEnd;
|
||||||
|
|
||||||
|
public RetrieveChartsAsyncTask(Context context, Date dateIni, Date dateEnd, OnRetrieveChartsInterface onRetrieveChartsInterface){
|
||||||
|
this.contextReference = new WeakReference<>(context);
|
||||||
|
this.listener = onRetrieveChartsInterface;
|
||||||
|
this.dateIni = dateIni;
|
||||||
|
this.dateEnd = dateEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
charts = new StatusCacheDAO(contextReference.get(), db).getCharts(dateIni, dateEnd);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
|
listener.onCharts(charts);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package app.fedilab.android.client.Entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/* 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>. */
|
||||||
|
|
||||||
|
public class Charts {
|
||||||
|
|
||||||
|
private List<String> xLabels;
|
||||||
|
private List<String> yLabels;
|
||||||
|
private List<Long> xValues;
|
||||||
|
private List<Integer> statuses;
|
||||||
|
private List<Integer> boosts;
|
||||||
|
private List<Integer> replies;
|
||||||
|
|
||||||
|
public List<String> getxLabels() {
|
||||||
|
return xLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setxLabels(List<String> xLabels) {
|
||||||
|
this.xLabels = xLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getyLabels() {
|
||||||
|
return yLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setyLabels(List<String> yLabels) {
|
||||||
|
this.yLabels = yLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> getxValues() {
|
||||||
|
return xValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setxValues(List<Long> xValues) {
|
||||||
|
this.xValues = xValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getStatuses() {
|
||||||
|
return statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatuses(List<Integer> statuses) {
|
||||||
|
this.statuses = statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getBoosts() {
|
||||||
|
return boosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBoosts(List<Integer> boosts) {
|
||||||
|
this.boosts = boosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getReplies() {
|
||||||
|
return replies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReplies(List<Integer> replies) {
|
||||||
|
this.replies = replies;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* 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.interfaces;
|
||||||
|
|
||||||
|
import app.fedilab.android.client.Entities.Charts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Thomas on 28/07/2019.
|
||||||
|
* Interface when retrieving charts
|
||||||
|
*/
|
||||||
|
public interface OnRetrieveChartsInterface {
|
||||||
|
void onCharts(Charts charts);
|
||||||
|
}
|
|
@ -21,11 +21,13 @@ import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import app.fedilab.android.client.Entities.Charts;
|
||||||
import app.fedilab.android.client.Entities.Statistics;
|
import app.fedilab.android.client.Entities.Statistics;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.Entities.Tag;
|
import app.fedilab.android.client.Entities.Tag;
|
||||||
|
@ -434,6 +436,77 @@ public class StatusCacheDAO {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Charts getCharts(Date dateIni, Date dateEnd){
|
||||||
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
|
String instance = Helper.getLiveInstance(context);
|
||||||
|
Charts charts = new Charts();
|
||||||
|
|
||||||
|
Calendar start = Calendar.getInstance();
|
||||||
|
start.setTime(dateIni);
|
||||||
|
start.set(Calendar.HOUR_OF_DAY,0);
|
||||||
|
start.set(Calendar.MINUTE,0);
|
||||||
|
start.set(Calendar.SECOND,0);
|
||||||
|
|
||||||
|
Calendar end = Calendar.getInstance();
|
||||||
|
end.setTime(dateEnd);
|
||||||
|
end.set(Calendar.HOUR_OF_DAY,23);
|
||||||
|
end.set(Calendar.MINUTE,59);
|
||||||
|
end.set(Calendar.SECOND,59);
|
||||||
|
|
||||||
|
StringBuilder selection = new StringBuilder(Sqlite.COL_CACHED_ACTION + " = '" + ARCHIVE_CACHE + "' AND " + Sqlite.COL_INSTANCE + " = '" + instance + "' AND " + Sqlite.COL_USER_ID + " = '" + userId + "'");
|
||||||
|
selection.append(" AND " + Sqlite.COL_CREATED_AT + " >= '").append(Helper.dateToString(start.getTime())).append("'");
|
||||||
|
selection.append(" AND " + Sqlite.COL_CREATED_AT + " <= '").append(Helper.dateToString(end.getTime())).append("'");
|
||||||
|
|
||||||
|
List<Status> data = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
Cursor c = db.query(Sqlite.TABLE_STATUSES_CACHE, null, selection.toString(), null, null, null, Sqlite.COL_CREATED_AT + " ASC");
|
||||||
|
data = cursorToListStatuses(c);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
int inc = 0;
|
||||||
|
List<String> xLabel = new ArrayList<>();
|
||||||
|
List<Long> xValues = new ArrayList<>();
|
||||||
|
List<Integer> statuses = new ArrayList<>();
|
||||||
|
List<Integer> boosts = new ArrayList<>();
|
||||||
|
List<Integer> replies = new ArrayList<>();
|
||||||
|
if( data != null && data.size() > 0) {
|
||||||
|
while (!start.after(end)) {
|
||||||
|
Date targetDay = start.getTime();
|
||||||
|
Date dateLimite = new Date(targetDay.getTime() + TimeUnit.DAYS.toMillis(1));
|
||||||
|
xLabel.add(Helper.shortDateToString(targetDay));
|
||||||
|
xValues.add(targetDay.getTime());
|
||||||
|
int boostsCount = 0;
|
||||||
|
int repliesCount = 0;
|
||||||
|
int statusesCount = 0;
|
||||||
|
for(Status status: data){
|
||||||
|
if(status.getCreated_at().after(targetDay) && status.getCreated_at().before(dateLimite)){
|
||||||
|
if( status.getReblog() != null){
|
||||||
|
boostsCount++;
|
||||||
|
}else if( status.getIn_reply_to_id() != null && !status.getIn_reply_to_id().trim().equals("null")){
|
||||||
|
repliesCount++;
|
||||||
|
}else {
|
||||||
|
statusesCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boosts.add(boostsCount);
|
||||||
|
replies.add(repliesCount);
|
||||||
|
statuses.add(statusesCount);
|
||||||
|
start.add(Calendar.DATE, 1);
|
||||||
|
inc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
charts.setxLabels(xLabel);
|
||||||
|
charts.setxValues(xValues);
|
||||||
|
charts.setBoosts(boosts);
|
||||||
|
charts.setReplies(replies);
|
||||||
|
charts.setStatuses(statuses);
|
||||||
|
return charts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a cached status by id in db
|
* Returns a cached status by id in db
|
||||||
* @return stored status StoredStatus
|
* @return stored status StoredStatus
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM9,17L7,17v-7h2v7zM13,17h-2L11,7h2v10zM17,17h-2v-4h2v4z"/>
|
||||||
|
</vector>
|
|
@ -21,7 +21,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<LinearLayout
|
||||||
|
style="?attr/shapeBorder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:text="@string/settings_time_from"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
android:id="@+id/settings_time_from"
|
||||||
|
style="?attr/borderlessColored"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<TextView
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:text="@string/settings_time_to"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
|
style="?attr/borderlessColored"
|
||||||
|
android:id="@+id/settings_time_to"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/validate"
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:src="@drawable/ic_check_white_24"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:contentDescription="@string/validate" />
|
||||||
|
</LinearLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loader"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/collecting_data_wait"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_below="@+id/text"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="true" />
|
||||||
|
</RelativeLayout>
|
||||||
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
|
android:id="@+id/chart"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvContent"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:text=""
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -33,6 +33,27 @@
|
||||||
android:paddingEnd="@dimen/activity_vertical_margin"
|
android:paddingEnd="@dimen/activity_vertical_margin"
|
||||||
android:paddingRight="@dimen/activity_vertical_margin"
|
android:paddingRight="@dimen/activity_vertical_margin"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:text="@string/display_charts"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/charts"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
|
android:src="@drawable/ic_insert_chart"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:contentDescription="@string/validate" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
|
|
|
@ -152,4 +152,11 @@
|
||||||
<color name="quick_reply_background_dark">#2d313c</color>
|
<color name="quick_reply_background_dark">#2d313c</color>
|
||||||
<color name="quick_reply_background_black">#1A1A1A</color>
|
<color name="quick_reply_background_black">#1A1A1A</color>
|
||||||
<color name="quick_reply_background_light">#E0E0E0</color>
|
<color name="quick_reply_background_light">#E0E0E0</color>
|
||||||
|
|
||||||
|
|
||||||
|
<color name="chart_boost">#D32F2F</color>
|
||||||
|
<color name="chart_reply">#388E3C</color>
|
||||||
|
<color name="chart_status">#0288D1</color>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1140,6 +1140,9 @@
|
||||||
<string name="action_groups">Groups</string>
|
<string name="action_groups">Groups</string>
|
||||||
<string name="no_messages">No groups!</string>
|
<string name="no_messages">No groups!</string>
|
||||||
<string name="set_disable_animated_emoji">Disable custom animated emojis</string>
|
<string name="set_disable_animated_emoji">Disable custom animated emojis</string>
|
||||||
|
<string name="owner_charts">Charts</string>
|
||||||
|
<string name="display_charts">Display charts</string>
|
||||||
|
<string name="collecting_data_wait">The application collects your local data, please wait...</string>
|
||||||
<plurals name="number_of_vote">
|
<plurals name="number_of_vote">
|
||||||
<item quantity="one">%d vote</item>
|
<item quantity="one">%d vote</item>
|
||||||
<item quantity="other">%d votes</item>
|
<item quantity="other">%d votes</item>
|
||||||
|
|
Loading…
Reference in New Issue