diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java index efb9976..869ecbc 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/CurrencyDetailsActivity.java @@ -227,10 +227,24 @@ public class CurrencyDetailsActivity extends AppCompatActivity { ((ProgressBar) findViewById(R.id.percentageCoinEmited)) .setProgress((int) Math.round(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100)); - ((TextView) findViewById(R.id.txtViewAlgorithm)) - .setText(currency.getAlgorithm()); - ((TextView) findViewById(R.id.txtViewProofType)) - .setText(currency.getProofType()); + if(currency.getAlgorithm() != null && !currency.getAlgorithm().equals("")) + { + ((TextView) findViewById(R.id.txtViewAlgorithm)) + .setText(currency.getAlgorithm()); + } + + if(currency.getProofType() != null && !currency.getProofType().equals("")) + { + ((TextView) findViewById(R.id.txtViewProofType)) + .setText(currency.getProofType()); + } + + if(currency.getStartDate() != null && !currency.getStartDate().equals("")) + { + ((TextView) findViewById(R.id.txtViewStartDate)) + .setText(currency.getStartDate()); + } + ((TextView) findViewById(R.id.txtViewDescription)) .setText(Html.fromHtml(currency.getDescription())); ((TextView) findViewById(R.id.txtViewDescription)) @@ -303,7 +317,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity { } else { - setTitle(" " + currency.getName() + " | " + currency.getBalance()); + setTitle(" " + currency.getName() + " | " + numberConformer(currency.getBalance())); } getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | @@ -727,12 +741,12 @@ public class CurrencyDetailsActivity extends AppCompatActivity { if(!str.equals("Infinity")) { int counter = 0; - int i = str.indexOf(".") - 1; + int i = str.indexOf("."); if(i <= 0) { - i = str.length() - 1; + i = str.length(); } - for(; i > 0; i--) + for(i -= 1; i > 0; i--) { counter++; if(counter == 3) diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java index 2758dd7..1fc4415 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Summary.java @@ -445,7 +445,12 @@ public class Summary extends Fragment { } int counter = 0; - for(int i = str.indexOf(".") - 1; i > 0; i--) + int i = str.indexOf("."); + if(i <= 0) + { + i = str.length(); + } + for(i -= 1; i > 0; i--) { counter++; if(counter == 3) diff --git a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java index 469f41e..e157516 100644 --- a/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java +++ b/app/src/main/java/com/nauk/coinfolio/Activities/HomeActivityFragments/Watchlist.java @@ -664,7 +664,12 @@ public class Watchlist extends Fragment { } int counter = 0; - for(int i = str.indexOf(".") - 1; i > 0; i--) + int i = str.indexOf("."); + if(i <= 0) + { + i = str.length(); + } + for(i -= 1; i > 0; i--) { counter++; if(counter == 3) diff --git a/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/Currency.java b/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/Currency.java index 1024a9c..01194f8 100644 --- a/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/Currency.java +++ b/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/Currency.java @@ -40,6 +40,7 @@ public class Currency implements Parcelable { private int totalSupply; private double marketCapitalization; private int rank; + private String startDate; private List socialMediaLinks; //private String proofType @@ -161,6 +162,7 @@ public class Currency implements Parcelable { Currency.this.description = currencyInfo.description; Currency.this.maxCoinSupply = currencyInfo.maxCoinSupply; Currency.this.minedCoinSupply = currencyInfo.minedCoinSupply; + Currency.this.startDate = currencyInfo.startDate; callBack.onSuccess(Currency.this); } @@ -403,6 +405,14 @@ public class Currency implements Parcelable { this.tickerId = tickerId; } + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + private void updateDayFluctuation() { if(historyMinutes != null) diff --git a/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/CurrencyDataRetriever.java b/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/CurrencyDataRetriever.java index aa523b4..52ea3c4 100644 --- a/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/CurrencyDataRetriever.java +++ b/app/src/main/java/com/nauk/coinfolio/DataManagers/CurrencyData/CurrencyDataRetriever.java @@ -234,8 +234,18 @@ public class CurrencyDataRetriever { currency.setProofType(jsonObject.getString("ProofType")); currency.setAlgorithm(jsonObject.getString("Algorithm")); currency.setDescription(jsonObject.getString("Description")); - currency.setMaxCoinSupply(Double.parseDouble(jsonObject.getString("TotalCoinSupply"))); - currency.setMinedCoinSupply(Double.parseDouble(jsonObject.getString("TotalCoinsMined"))); + + if(!jsonObject.getString("TotalCoinSupply").equals("")) + { + currency.setMaxCoinSupply(Double.parseDouble(jsonObject.getString("TotalCoinSupply"))); + } + + if(!jsonObject.getString("TotalCoinsMined").equals("")) + { + currency.setMinedCoinSupply(Double.parseDouble(jsonObject.getString("TotalCoinsMined"))); + } + + currency.setStartDate(jsonObject.getString("StartDate")); } catch (JSONException e) { e.printStackTrace(); } diff --git a/app/src/main/java/com/nauk/coinfolio/DataManagers/ExchangeManager/BinanceManager.java b/app/src/main/java/com/nauk/coinfolio/DataManagers/ExchangeManager/BinanceManager.java index 6c76f82..4b103d0 100644 --- a/app/src/main/java/com/nauk/coinfolio/DataManagers/ExchangeManager/BinanceManager.java +++ b/app/src/main/java/com/nauk/coinfolio/DataManagers/ExchangeManager/BinanceManager.java @@ -11,6 +11,7 @@ import com.binance.api.client.domain.account.Trade; import com.binance.api.client.domain.account.request.OrderRequest; import com.binance.api.client.exception.BinanceApiException; import com.nauk.coinfolio.DataManagers.CurrencyData.Currency; +import com.nauk.coinfolio.R; import java.util.ArrayList; import java.util.HashMap; diff --git a/app/src/main/res/layout/activity_currency_details.xml b/app/src/main/res/layout/activity_currency_details.xml index d4c14fb..dd72f6d 100644 --- a/app/src/main/res/layout/activity_currency_details.xml +++ b/app/src/main/res/layout/activity_currency_details.xml @@ -376,7 +376,7 @@ @@ -443,7 +443,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="4dp" - android:orientation="horizontal"> + android:orientation="horizontal" + android:baselineAligned="false"> + android:orientation="horizontal" + android:baselineAligned="false"> + android:layout_height="wrap_content" + android:text="--"/> @@ -527,7 +530,36 @@ + android:layout_height="wrap_content" + android:text="--"/> + + + + + + + + + + + + @@ -611,12 +643,6 @@ - - - -