Added Volume charts in detail activity
This commit is contained in:
parent
8282628841
commit
9ff13165c6
@ -14,7 +14,6 @@ import android.support.v4.content.ContextCompat;
|
|||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@ -25,14 +24,16 @@ import android.widget.TextView;
|
|||||||
import android.widget.ViewFlipper;
|
import android.widget.ViewFlipper;
|
||||||
|
|
||||||
import com.daimajia.swipe.SwipeLayout;
|
import com.daimajia.swipe.SwipeLayout;
|
||||||
import com.db.chart.model.LineSet;
|
|
||||||
import com.db.chart.tooltip.Tooltip;
|
import com.db.chart.tooltip.Tooltip;
|
||||||
|
import com.github.mikephil.charting.charts.BarChart;
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.data.BarData;
|
||||||
|
import com.github.mikephil.charting.data.BarDataSet;
|
||||||
|
import com.github.mikephil.charting.data.BarEntry;
|
||||||
import com.github.mikephil.charting.data.Entry;
|
import com.github.mikephil.charting.data.Entry;
|
||||||
import com.github.mikephil.charting.data.LineData;
|
import com.github.mikephil.charting.data.LineData;
|
||||||
import com.github.mikephil.charting.data.LineDataSet;
|
import com.github.mikephil.charting.data.LineDataSet;
|
||||||
import com.github.mikephil.charting.highlight.Highlight;
|
import com.github.mikephil.charting.highlight.Highlight;
|
||||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
import com.nauk.coinfolio.DataManagers.CurrencyData.Currency;
|
||||||
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDataChart;
|
import com.nauk.coinfolio.DataManagers.CurrencyData.CurrencyDataChart;
|
||||||
@ -128,17 +129,18 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if(currency.getHistoryMinutes().size() > 0)
|
if(currency.getHistoryMinutes().size() > 0)
|
||||||
{
|
{
|
||||||
drawChart(DAY, 1);
|
drawPriceChart(DAY, 1);
|
||||||
|
drawVolumeChart(DAY, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextView errorTextView = new TextView(this);
|
/*TextView errorTextView = new TextView(this);
|
||||||
errorTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 750));
|
errorTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 750));
|
||||||
errorTextView.setText("Not enough data");
|
errorTextView.setText("Not enough data");
|
||||||
errorTextView.setTag("chart_layout");
|
errorTextView.setTag("chart_layout");
|
||||||
errorTextView.setGravity(Gravity.CENTER);
|
errorTextView.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
chartLayout.addView(errorTextView, 0);
|
chartLayout.addView(errorTextView, 0);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(" " + currency.getName());
|
setTitle(" " + currency.getName());
|
||||||
@ -182,6 +184,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
private void buttonEvent(View v)
|
private void buttonEvent(View v)
|
||||||
{
|
{
|
||||||
v.setEnabled(false);
|
v.setEnabled(false);
|
||||||
|
v.setElevation(convertDpToPx(8));
|
||||||
|
|
||||||
LinearLayout buttonLayout = (LinearLayout) v.getParent();
|
LinearLayout buttonLayout = (LinearLayout) v.getParent();
|
||||||
|
|
||||||
@ -192,15 +195,22 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
if(button != v)
|
if(button != v)
|
||||||
{
|
{
|
||||||
button.setEnabled(true);
|
button.setEnabled(true);
|
||||||
|
button.setElevation(convertDpToPx(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chartEvent((Button) v);
|
chartEvent((Button) v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float convertDpToPx(float dp)
|
||||||
|
{
|
||||||
|
return dp * this.getResources().getDisplayMetrics().density;
|
||||||
|
}
|
||||||
|
|
||||||
private void chartEvent(Button button)
|
private void chartEvent(Button button)
|
||||||
{
|
{
|
||||||
findViewById(R.id.chartView).setVisibility(View.GONE);
|
findViewById(R.id.chartPriceView).setVisibility(View.GONE);
|
||||||
|
findViewById(R.id.chartVolumeView).setVisibility(View.GONE);
|
||||||
findViewById(R.id.progressLayoutChart).setVisibility(View.VISIBLE);
|
findViewById(R.id.progressLayoutChart).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String interval = button.getText().toString().substring(button.getText().toString().length()-2);
|
String interval = button.getText().toString().substring(button.getText().toString().length()-2);
|
||||||
@ -208,13 +218,16 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
switch (interval)
|
switch (interval)
|
||||||
{
|
{
|
||||||
case "1h":
|
case "1h":
|
||||||
drawChart(HOUR, 1);
|
drawPriceChart(HOUR, 1);
|
||||||
|
drawVolumeChart(HOUR, 1);
|
||||||
break;
|
break;
|
||||||
case "3h":
|
case "3h":
|
||||||
drawChart(HOUR, 3);
|
drawPriceChart(HOUR, 3);
|
||||||
|
drawVolumeChart(HOUR, 3);
|
||||||
break;
|
break;
|
||||||
case "1d":
|
case "1d":
|
||||||
drawChart(DAY, 1);
|
drawPriceChart(DAY, 1);
|
||||||
|
drawVolumeChart(DAY, 1);
|
||||||
break;
|
break;
|
||||||
case "3d":
|
case "3d":
|
||||||
currency.updateHistoryHours(this, new Currency.CurrencyCallBack() {
|
currency.updateHistoryHours(this, new Currency.CurrencyCallBack() {
|
||||||
@ -223,7 +236,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.DAY, 3);
|
drawPriceChart(CurrencyDetailsActivity.DAY, 3);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.DAY, 3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -236,7 +250,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.WEEK, 1);
|
drawPriceChart(CurrencyDetailsActivity.WEEK, 1);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.WEEK, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -249,7 +264,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.MONTH, 1);
|
drawPriceChart(CurrencyDetailsActivity.MONTH, 1);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.MONTH, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -262,7 +278,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.MONTH, 3);
|
drawPriceChart(CurrencyDetailsActivity.MONTH, 3);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.MONTH, 3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -275,7 +292,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.MONTH, 6);
|
drawPriceChart(CurrencyDetailsActivity.MONTH, 6);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.MONTH, 6);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -288,7 +306,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
drawChart(CurrencyDetailsActivity.YEAR, 1);
|
drawPriceChart(CurrencyDetailsActivity.YEAR, 1);
|
||||||
|
drawVolumeChart(CurrencyDetailsActivity.YEAR, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -297,9 +316,34 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawChart(int timeUnit, int amout)
|
private void drawVolumeChart(int timeUnit, int amout)
|
||||||
{
|
{
|
||||||
final LineChart lineChart = findViewById(R.id.chartView);
|
final BarChart barChart = findViewById(R.id.chartVolumeView);
|
||||||
|
|
||||||
|
barChart.setDrawGridBackground(false);
|
||||||
|
barChart.setDrawBorders(false);
|
||||||
|
barChart.setDrawMarkers(true);
|
||||||
|
barChart.setDoubleTapToZoomEnabled(true);
|
||||||
|
barChart.setPinchZoom(true);
|
||||||
|
barChart.setScaleEnabled(false);
|
||||||
|
barChart.setDragEnabled(true);
|
||||||
|
barChart.getDescription().setEnabled(false);
|
||||||
|
barChart.getAxisLeft().setEnabled(false);
|
||||||
|
barChart.getAxisRight().setEnabled(false);
|
||||||
|
barChart.getLegend().setEnabled(false);
|
||||||
|
barChart.getXAxis().setEnabled(false);
|
||||||
|
barChart.setViewPortOffsets(0, 0, 0, 0);
|
||||||
|
barChart.setFitBars(true);
|
||||||
|
|
||||||
|
barChart.setData(generateVolumeChartSet(timeUnit, amout));
|
||||||
|
barChart.invalidate();
|
||||||
|
|
||||||
|
findViewById(R.id.chartVolumeView).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawPriceChart(int timeUnit, int amout)
|
||||||
|
{
|
||||||
|
final LineChart lineChart = findViewById(R.id.chartPriceView);
|
||||||
|
|
||||||
lineChart.setDrawGridBackground(false);
|
lineChart.setDrawGridBackground(false);
|
||||||
lineChart.setDrawBorders(false);
|
lineChart.setDrawBorders(false);
|
||||||
@ -315,7 +359,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
lineChart.getXAxis().setEnabled(false);
|
lineChart.getXAxis().setEnabled(false);
|
||||||
lineChart.setViewPortOffsets(0, 0, 0, 0);
|
lineChart.setViewPortOffsets(0, 0, 0, 0);
|
||||||
|
|
||||||
lineChart.setData(generateChartSet(timeUnit, amout));
|
lineChart.setData(generatePriceChartSet(timeUnit, amout));
|
||||||
lineChart.getAxisLeft().setAxisMinValue(lineChart.getData().getYMin());
|
lineChart.getAxisLeft().setAxisMinValue(lineChart.getData().getYMin());
|
||||||
|
|
||||||
lineChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
|
lineChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
|
||||||
@ -346,11 +390,73 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
updateFluctuation(lineChart.getData().getDataSets().get(0).getEntryForIndex(0).getY(), lineChart.getData().getDataSets().get(0).getEntryForIndex(lineChart.getData().getDataSets().get(0).getEntryCount() - 1).getY());
|
updateFluctuation(lineChart.getData().getDataSets().get(0).getEntryForIndex(0).getY(), lineChart.getData().getDataSets().get(0).getEntryForIndex(lineChart.getData().getDataSets().get(0).getEntryCount() - 1).getY());
|
||||||
|
|
||||||
findViewById(R.id.chartView).setVisibility(View.VISIBLE);
|
findViewById(R.id.chartPriceView).setVisibility(View.VISIBLE);
|
||||||
findViewById(R.id.progressLayoutChart).setVisibility(View.GONE);
|
findViewById(R.id.progressLayoutChart).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LineData generateChartSet(int timeUnit, int amount)
|
private BarData generateVolumeChartSet(int timeUnit, int amount)
|
||||||
|
{
|
||||||
|
BarDataSet dataSet;
|
||||||
|
List<CurrencyDataChart> dataChartList = new ArrayList<>();
|
||||||
|
ArrayList<BarEntry> values = new ArrayList<>();
|
||||||
|
|
||||||
|
switch (timeUnit)
|
||||||
|
{
|
||||||
|
case HOUR:
|
||||||
|
dataChartList = currency.getHistoryMinutes().subList(currency.getHistoryMinutes().size()-(60*amount), currency.getHistoryMinutes().size());
|
||||||
|
break;
|
||||||
|
case DAY:
|
||||||
|
if(amount == 1)
|
||||||
|
{
|
||||||
|
dataChartList = currency.getHistoryMinutes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataChartList = currency.getHistoryHours().subList(currency.getHistoryHours().size()-(24*amount), currency.getHistoryHours().size());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WEEK:
|
||||||
|
dataChartList = currency.getHistoryHours().subList(currency.getHistoryHours().size()-168, currency.getHistoryHours().size());
|
||||||
|
break;
|
||||||
|
case MONTH:
|
||||||
|
switch (amount)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
dataChartList = currency.getHistoryHours();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dataChartList = currency.getHistoryDays().subList(currency.getHistoryDays().size()-93, currency.getHistoryDays().size());
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dataChartList = currency.getHistoryDays().subList(currency.getHistoryDays().size()-186, currency.getHistoryDays().size());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case YEAR:
|
||||||
|
dataChartList = currency.getHistoryDays();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = (int) Math.floor(dataChartList.size() / 50);
|
||||||
|
|
||||||
|
int loopNumber = 0;
|
||||||
|
for(int i = 0; i < dataChartList.size(); i += offset)
|
||||||
|
{
|
||||||
|
values.add(new BarEntry(loopNumber, (float) dataChartList.get(i).getVolumeTo()));
|
||||||
|
loopNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataSet = new BarDataSet(values, "Volume");
|
||||||
|
dataSet.setDrawIcons(false);
|
||||||
|
dataSet.setColor(Color.GRAY);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
dataSet.setHighlightEnabled(true);
|
||||||
|
dataSet.setHighLightColor(currency.getChartColor());
|
||||||
|
|
||||||
|
return new BarData(dataSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LineData generatePriceChartSet(int timeUnit, int amount)
|
||||||
{
|
{
|
||||||
LineDataSet dataSet;
|
LineDataSet dataSet;
|
||||||
List<CurrencyDataChart> dataChartList = new ArrayList<>();
|
List<CurrencyDataChart> dataChartList = new ArrayList<>();
|
||||||
@ -583,28 +689,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
((TextView) findViewById(R.id.txtViewPercentage)).setText(percentageFluctuation + "%");
|
((TextView) findViewById(R.id.txtViewPercentage)).setText(percentageFluctuation + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFluctuation(LineData lineData)
|
/*private LineSet generatePriceChartSet(int timeUnit, int amount)
|
||||||
{
|
|
||||||
ILineDataSet dataSet = lineData.getDataSets().get(0);
|
|
||||||
|
|
||||||
float fluctuation = dataSet.getEntryForIndex(dataSet.getEntryCount() - 1).getY() - dataSet.getEntryForIndex(0).getY();
|
|
||||||
float percentageFluctuation = (float) (fluctuation / dataSet.getEntryForIndex(0).getY() * 100);
|
|
||||||
|
|
||||||
if(percentageFluctuation < 0)
|
|
||||||
{
|
|
||||||
((TextView) findViewById(R.id.txtViewPercentage)).setTextColor(getResources().getColor(R.color.red));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((TextView) findViewById(R.id.txtViewPercentage)).setTextColor(getResources().getColor(R.color.green));
|
|
||||||
}
|
|
||||||
|
|
||||||
((TextView) findViewById(R.id.txtViewPriceStart)).setText("$" + dataSet.getEntryForIndex(0).getY());
|
|
||||||
((TextView) findViewById(R.id.txtViewPriceNow)).setText("$" + dataSet.getEntryForIndex(dataSet.getEntryCount() - 1).getY());
|
|
||||||
((TextView) findViewById(R.id.txtViewPercentage)).setText(percentageFluctuation + "%");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*private LineSet generateChartSet(int timeUnit, int amount)
|
|
||||||
{
|
{
|
||||||
List<CurrencyDataChart> dataChartList = new ArrayList<>();
|
List<CurrencyDataChart> dataChartList = new ArrayList<>();
|
||||||
LineSet lineSet = new LineSet();
|
LineSet lineSet = new LineSet();
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Outline;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -34,6 +35,7 @@ import android.view.MenuItem;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewOutlineProvider;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@ -139,9 +141,11 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
/**Interface setup**/
|
/**Interface setup**/
|
||||||
|
|
||||||
//Setup main interface
|
//Setup main interface
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
//requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
//getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
||||||
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
//this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
|
|
||||||
setContentView(R.layout.activity_currency_summary);
|
setContentView(R.layout.activity_currency_summary);
|
||||||
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
||||||
|
|
||||||
@ -293,7 +297,7 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
spaceNavigationView.addSpaceItem(new SpaceItem("Market Cap.", R.drawable.ic_pie_chart_black_24dp));
|
spaceNavigationView.addSpaceItem(new SpaceItem("Market Cap.", R.drawable.ic_pie_chart_black_24dp));
|
||||||
spaceNavigationView.setSpaceBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
spaceNavigationView.setSpaceBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||||
spaceNavigationView.setCentreButtonIcon(R.drawable.ic_view_list_white_24dp);
|
spaceNavigationView.setCentreButtonIcon(R.drawable.ic_view_list_white_24dp);
|
||||||
spaceNavigationView.setCentreButtonColor(getResources().getColor(R.color.colorAccent));
|
spaceNavigationView.setCentreButtonColor(getResources().getColor(R.color.colorPrimary));
|
||||||
spaceNavigationView.setCentreButtonIconColorFilterEnabled(false);
|
spaceNavigationView.setCentreButtonIconColorFilterEnabled(false);
|
||||||
spaceNavigationView.changeCurrentItem(-1);
|
spaceNavigationView.changeCurrentItem(-1);
|
||||||
|
|
||||||
@ -390,7 +394,7 @@ public class HomeActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
((LinearLayout) findViewById(R.id.linearLayoutWatchlist)).addView(view);
|
//((LinearLayout) findViewById(R.id.linearLayoutWatchlist)).addView(view);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
|
@ -14,14 +14,18 @@ public class CurrencyDataChart implements Parcelable {
|
|||||||
double high;
|
double high;
|
||||||
double low;
|
double low;
|
||||||
double open;
|
double open;
|
||||||
|
double volumeFrom;
|
||||||
|
double volumeTo;
|
||||||
|
|
||||||
public CurrencyDataChart(long timestamp, double close, double high, double low, double open)
|
public CurrencyDataChart(long timestamp, double close, double high, double low, double open, double volumeFrom, double volumeTo)
|
||||||
{
|
{
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
this.close = close;
|
this.close = close;
|
||||||
this.high = high;
|
this.high = high;
|
||||||
this.low = low;
|
this.low = low;
|
||||||
this.open = open;
|
this.open = open;
|
||||||
|
this.volumeFrom = volumeFrom;
|
||||||
|
this.volumeTo = volumeTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getOpen()
|
public double getOpen()
|
||||||
@ -34,6 +38,11 @@ public class CurrencyDataChart implements Parcelable {
|
|||||||
return close;
|
return close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getVolumeTo()
|
||||||
|
{
|
||||||
|
return volumeTo;
|
||||||
|
}
|
||||||
|
|
||||||
public long getTimestamp()
|
public long getTimestamp()
|
||||||
{
|
{
|
||||||
return timestamp;
|
return timestamp;
|
||||||
@ -51,6 +60,8 @@ public class CurrencyDataChart implements Parcelable {
|
|||||||
dest.writeDouble(this.high);
|
dest.writeDouble(this.high);
|
||||||
dest.writeDouble(this.low);
|
dest.writeDouble(this.low);
|
||||||
dest.writeDouble(this.open);
|
dest.writeDouble(this.open);
|
||||||
|
dest.writeDouble(this.volumeFrom);
|
||||||
|
dest.writeDouble(this.volumeTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CurrencyDataChart(Parcel in) {
|
protected CurrencyDataChart(Parcel in) {
|
||||||
@ -59,6 +70,8 @@ public class CurrencyDataChart implements Parcelable {
|
|||||||
this.high = in.readDouble();
|
this.high = in.readDouble();
|
||||||
this.low = in.readDouble();
|
this.low = in.readDouble();
|
||||||
this.open = in.readDouble();
|
this.open = in.readDouble();
|
||||||
|
this.volumeFrom = in.readDouble();
|
||||||
|
this.volumeTo = in.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<CurrencyDataChart> CREATOR = new Parcelable.Creator<CurrencyDataChart>() {
|
public static final Parcelable.Creator<CurrencyDataChart> CREATOR = new Parcelable.Creator<CurrencyDataChart>() {
|
||||||
|
@ -104,8 +104,10 @@ public class CurrencyDataRetriever {
|
|||||||
double high = Double.parseDouble(jsonObject.getString("high"));
|
double high = Double.parseDouble(jsonObject.getString("high"));
|
||||||
double low = Double.parseDouble(jsonObject.getString("low"));
|
double low = Double.parseDouble(jsonObject.getString("low"));
|
||||||
double open = Double.parseDouble(jsonObject.getString("open"));
|
double open = Double.parseDouble(jsonObject.getString("open"));
|
||||||
|
double volumeFrom = Double.parseDouble(jsonObject.getString("volumefrom"));
|
||||||
|
double volumeTo = Double.parseDouble(jsonObject.getString("volumeto"));
|
||||||
|
|
||||||
dataChart.add(new CurrencyDataChart(timestamp, close, high, low, open));
|
dataChart.add(new CurrencyDataChart(timestamp, close, high, low, open, volumeFrom, volumeTo));
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.d(context.getResources().getString(R.string.debug_volley), "API Request error: " + e + " index: " + i);
|
Log.d(context.getResources().getString(R.string.debug_volley), "API Request error: " + e + " index: " + i);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_checked="true" android:color="@color/colorAccent" />
|
<item android:state_checked="true" android:color="@color/colorAccent" />
|
||||||
<item android:state_checked="false" android:color="@color/colorPrimary" />
|
<item android:state_checked="false" android:color="@color/colorPrimaryDark" />
|
||||||
</selector>
|
</selector>
|
@ -1,9 +1,7 @@
|
|||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||||
<gradient
|
<gradient
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:centerX="60%"
|
android:startColor="@color/colorPrimary"
|
||||||
android:startColor="#FF1CB5E0"
|
android:endColor="@color/colorPrimaryDark"
|
||||||
android:centerColor="#FF000046"
|
android:angle="0"/>
|
||||||
android:endColor="#FF111124"
|
|
||||||
android:angle="90"/>
|
|
||||||
</shape>
|
</shape>
|
@ -21,7 +21,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/progressLayoutChart"
|
android:id="@+id/progressLayoutChart"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="300dp"
|
android:layout_height="305dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
@ -37,11 +37,17 @@
|
|||||||
|
|
||||||
|
|
||||||
<com.github.mikephil.charting.charts.LineChart
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
android:id="@+id/chartView"
|
android:id="@+id/chartPriceView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="300dp"
|
android:layout_height="250dp"
|
||||||
android:layout_marginTop="15dp" />
|
android:layout_marginTop="15dp" />
|
||||||
|
|
||||||
|
<com.github.mikephil.charting.charts.BarChart
|
||||||
|
android:id="@+id/chartVolumeView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="5dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layoutChartButtons"
|
android:id="@+id/layoutChartButtons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay"
|
android:theme="@style/AppTheme.AppBarOverlay"
|
||||||
android:background="@drawable/gradient_background"
|
android:background="@drawable/gradient_background"
|
||||||
app:elevation="0dp">
|
android:elevation="10dp">
|
||||||
|
|
||||||
<android.support.design.widget.CollapsingToolbarLayout
|
<android.support.design.widget.CollapsingToolbarLayout
|
||||||
android:id="@+id/toolbar_layout"
|
android:id="@+id/toolbar_layout"
|
||||||
@ -97,6 +97,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
app:borderWidth="0dp"
|
app:borderWidth="0dp"
|
||||||
|
android:backgroundTint="@color/colorPrimary"
|
||||||
android:background="@color/cardview_light_background"
|
android:background="@color/cardview_light_background"
|
||||||
android:src="@drawable/ic_add_white_24dp"
|
android:src="@drawable/ic_add_white_24dp"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp">
|
||||||
android:background="@drawable/gradient_second_background">
|
|
||||||
|
|
||||||
<ViewFlipper
|
<ViewFlipper
|
||||||
android:id="@+id/viewFlipperSummary"
|
android:id="@+id/viewFlipperSummary"
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#000046</color>
|
<color name="colorPrimary">#004e92</color>
|
||||||
<color name="colorPrimaryDark">#111124</color>
|
<color name="colorPrimaryDark">#000428</color>
|
||||||
<color name="colorAccent">#1CB5E0</color>
|
<color name="colorAccent">#1CB5E0</color>
|
||||||
<color name="mainTextViewColor">#FF000000</color>
|
<color name="mainTextViewColor">#FF000000</color>
|
||||||
<color name="secondaryTextViewColor">#FF222222</color>
|
<color name="secondaryTextViewColor">#FF222222</color>
|
||||||
|
@ -15,4 +15,6 @@
|
|||||||
<dimen name="swirl_size">60dp</dimen>
|
<dimen name="swirl_size">60dp</dimen>
|
||||||
<dimen name="fingerprint_dialog_height">125dp</dimen>
|
<dimen name="fingerprint_dialog_height">125dp</dimen>
|
||||||
<dimen name="fingerprint_dialog_width">250dp</dimen>
|
<dimen name="fingerprint_dialog_width">250dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="testOutline">1dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
<item name="swirl_ridgeColor">@color/separationLine</item>
|
<item name="swirl_ridgeColor">@color/separationLine</item>
|
||||||
<item name="swirl_errorColor">@color/decrease</item>
|
<item name="swirl_errorColor">@color/decrease</item>
|
||||||
<!--<item name="android:windowTranslucentStatus">true</item>
|
|
||||||
|
<!--<item name="android:windowTranslucentStatus">false</item>
|
||||||
<item name="android:windowTranslucentNavigation">true</item>
|
<item name="android:windowTranslucentNavigation">true</item>
|
||||||
<item name="android:statusBarColor">@color/transparent</item>-->
|
<item name="android:navigationBarColor">@color/transparent</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>-->
|
||||||
|
<!-- Support library compatibility -->
|
||||||
|
<!--<item name="actionBarStyle">@style/ThemeActionBar</item>
|
||||||
|
<item name="windowActionBarOverlay">true</item>-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<!--<item name="android:windowTranslucentStatus">true</item>
|
|
||||||
<item name="android:windowTranslucentNavigation">true</item>
|
|
||||||
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
|
|
||||||
<item name="android:windowActionBarOverlay">true</item>-->
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
@ -33,8 +36,9 @@
|
|||||||
|
|
||||||
<style name="ThemeActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid">
|
<style name="ThemeActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid">
|
||||||
<item name="android:background"> @null </item>
|
<item name="android:background"> @null </item>
|
||||||
|
<!-- Support library compatibility -->
|
||||||
<item name="background">@null</item>
|
<item name="background">@null</item>
|
||||||
<item name="android:displayOptions"> showHome|useLogo</item>
|
<item name="android:displayOptions">showHome|useLogo</item>
|
||||||
<item name="displayOptions">showHome|useLogo</item>
|
<item name="displayOptions">showHome|useLogo</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user