Details Activity placeholders
This commit is contained in:
parent
360c41751e
commit
b211a4f698
@ -42,9 +42,6 @@ import com.nauk.coinfolio.DataManagers.CurrencyData.Transaction;
|
|||||||
import com.nauk.coinfolio.DataManagers.DatabaseManager;
|
import com.nauk.coinfolio.DataManagers.DatabaseManager;
|
||||||
import com.nauk.coinfolio.R;
|
import com.nauk.coinfolio.R;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
@ -62,7 +59,6 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private ViewFlipper viewFlipper;
|
private ViewFlipper viewFlipper;
|
||||||
private LinearLayout transactionLayout;
|
private LinearLayout transactionLayout;
|
||||||
private LinearLayout chartLayout;
|
|
||||||
private DatabaseManager databaseManager;
|
private DatabaseManager databaseManager;
|
||||||
//private String symbol;
|
//private String symbol;
|
||||||
private Currency currency;
|
private Currency currency;
|
||||||
@ -129,10 +125,11 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
viewFlipper = findViewById(R.id.vfCurrencyDetails);
|
viewFlipper = findViewById(R.id.vfCurrencyDetails);
|
||||||
transactionLayout = findViewById(R.id.listTransactions);
|
transactionLayout = findViewById(R.id.listTransactions);
|
||||||
chartLayout = findViewById(R.id.chartsLayout);
|
|
||||||
lineChart = findViewById(R.id.chartPriceView);
|
lineChart = findViewById(R.id.chartPriceView);
|
||||||
barChart = findViewById(R.id.chartVolumeView);
|
barChart = findViewById(R.id.chartVolumeView);
|
||||||
|
|
||||||
|
((BottomNavigationView) findViewById(R.id.navigation_details)).getMenu().getItem(1).setEnabled(false);
|
||||||
|
|
||||||
drawTransactionList();
|
drawTransactionList();
|
||||||
|
|
||||||
initializeButtons();
|
initializeButtons();
|
||||||
@ -150,6 +147,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
private void setupActionBar()
|
private void setupActionBar()
|
||||||
{
|
{
|
||||||
setTitle(" " + currency.getName() + " | " + currency.getBalance());
|
setTitle(" " + currency.getName() + " | " + currency.getBalance());
|
||||||
|
|
||||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
|
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
|
||||||
ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
|
ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
|
||||||
|
|
||||||
@ -437,9 +435,12 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void valueSelectedEvent(Entry e)
|
private void valueSelectedEvent(Entry e)
|
||||||
{
|
{
|
||||||
//updateFluctuation(lineChart.getData().getDataSets().get(0).getEntryForIndex(0).getY(), e.getY());
|
|
||||||
int index = lineChart.getData().getDataSets().get(0).getEntryIndex(e);
|
int index = lineChart.getData().getDataSets().get(0).getEntryIndex(e);
|
||||||
String date = null;
|
String date;
|
||||||
|
String volumePlaceholder;
|
||||||
|
String pricePlaceholder;
|
||||||
|
String timestampPlaceholder;
|
||||||
|
|
||||||
barChart.highlightValue(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getX(), 0, index);
|
barChart.highlightValue(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getX(), 0, index);
|
||||||
|
|
||||||
if(dataChartList.size() > 200)
|
if(dataChartList.size() > 200)
|
||||||
@ -451,9 +452,13 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
date = getDate(dataChartList.get(index).getTimestamp() * 1000);
|
date = getDate(dataChartList.get(index).getTimestamp() * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.volumeHightlight)).setText("Volume\nUS$" + numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()));
|
volumePlaceholder = getResources().getString(R.string.volumePlaceholder, numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()));
|
||||||
((TextView) findViewById(R.id.priceHightlight)).setText("Price\nUS$" + numberConformer(e.getY()));
|
pricePlaceholder = getResources().getString(R.string.pricePlaceholder, numberConformer(e.getY()));
|
||||||
((TextView) findViewById(R.id.timestampHightlight)).setText("Date\n" + date);
|
timestampPlaceholder = getResources().getString(R.string.timestampPlaceholder, date);
|
||||||
|
|
||||||
|
((TextView) findViewById(R.id.volumeHightlight)).setText(volumePlaceholder);
|
||||||
|
((TextView) findViewById(R.id.priceHightlight)).setText(pricePlaceholder);
|
||||||
|
((TextView) findViewById(R.id.timestampHightlight)).setText(timestampPlaceholder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +485,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
private String getDate(long timeStamp){
|
private String getDate(long timeStamp){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy");
|
//SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.getDefault());
|
||||||
Date netDate = (new Date(timeStamp));
|
Date netDate = (new Date(timeStamp));
|
||||||
return sdf.format(netDate);
|
return sdf.format(netDate);
|
||||||
}
|
}
|
||||||
@ -582,8 +588,8 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
updateFluctuation(start, end);
|
updateFluctuation(start, end);
|
||||||
|
|
||||||
((TextView) findViewById(R.id.txtViewPriceStart)).setText("$" + numberConformer(start));
|
((TextView) findViewById(R.id.txtViewPriceStart)).setText(getResources().getString(R.string.currencyDollarPlaceholder, numberConformer(start)));
|
||||||
((TextView) findViewById(R.id.txtViewPriceNow)).setText("$" + numberConformer(end));
|
((TextView) findViewById(R.id.txtViewPriceNow)).setText(getResources().getString(R.string.currencyDollarPlaceholder, numberConformer(end)));
|
||||||
|
|
||||||
for(int i = 1; i < dataChartList.size(); i++)
|
for(int i = 1; i < dataChartList.size(); i++)
|
||||||
{
|
{
|
||||||
@ -600,9 +606,9 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.totalVolume)).setText("US$" + numberConformer(totalVolume));
|
((TextView) findViewById(R.id.totalVolume)).setText(getResources().getString(R.string.currencyDollarPlaceholder, numberConformer(totalVolume)));
|
||||||
((TextView) findViewById(R.id.highestPrice)).setText("US$" + numberConformer(highestPrice));
|
((TextView) findViewById(R.id.highestPrice)).setText(getResources().getString(R.string.currencyDollarPlaceholder, numberConformer(highestPrice)));
|
||||||
((TextView) findViewById(R.id.lowestPrice)).setText("US$" + numberConformer(lowestPrice));
|
((TextView) findViewById(R.id.lowestPrice)).setText(getResources().getString(R.string.currencyDollarPlaceholder, numberConformer(lowestPrice)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFluctuation(float start, float end)
|
private void updateFluctuation(float start, float end)
|
||||||
@ -619,7 +625,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
((TextView) findViewById(R.id.txtViewPercentage)).setTextColor(getResources().getColor(R.color.green));
|
((TextView) findViewById(R.id.txtViewPercentage)).setTextColor(getResources().getColor(R.color.green));
|
||||||
}
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.txtViewPercentage)).setText(numberConformer(percentageFluctuation) + "%");
|
((TextView) findViewById(R.id.txtViewPercentage)).setText(getResources().getString(R.string.currencyPercentagePlaceholder, numberConformer(percentageFluctuation)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getColorWithAlpha(int color, float ratio)
|
private int getColorWithAlpha(int color, float ratio)
|
||||||
@ -664,7 +670,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
amountTxtView.setText(transactionList.get(i).getAmount() + "");
|
amountTxtView.setText(String.valueOf(transactionList.get(i).getAmount()));
|
||||||
|
|
||||||
setupSwipeView(view);
|
setupSwipeView(view);
|
||||||
|
|
||||||
|
@ -146,6 +146,12 @@
|
|||||||
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
|
<string name="currencyDollarParenthesisPlaceholder">(US$%1$s)</string>
|
||||||
<string name="currencyDollarPlaceholder">US$%1$s</string>
|
<string name="currencyDollarPlaceholder">US$%1$s</string>
|
||||||
<string name="currencyPercentagePlaceholder">%1$s%%</string>
|
<string name="currencyPercentagePlaceholder">%1$s%%</string>
|
||||||
|
|
||||||
|
<!--DetailsActivity placeholders-->
|
||||||
|
<string name="volumePlaceholder">Volume\nUS$%1$s</string>
|
||||||
|
<string name="pricePlaceholder">Price\nUS$%1$s</string>
|
||||||
|
<string name="timestampPlaceholder">Date\n%1$s</string>
|
||||||
|
|
||||||
<string name="title_activity_main">MainActivity</string>
|
<string name="title_activity_main">MainActivity</string>
|
||||||
|
|
||||||
<string name="fingerprint_dialog_cancel">Cancel</string>
|
<string name="fingerprint_dialog_cancel">Cancel</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user