From 9218d5426121837a6de66c51f6ed0e54d3b71047 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sat, 26 May 2018 17:17:33 +0200 Subject: [PATCH] Add active markets/cryptocurrencies at marketcap activity --- .../MarketCapitalization.java | 10 +++++ .../moodl/DataManagers/MarketCapManager.java | 15 ++++++- .../fragment_marketcap_homeactivity.xml | 40 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nauk/moodl/Activities/HomeActivityFragments/MarketCapitalization.java b/app/src/main/java/com/nauk/moodl/Activities/HomeActivityFragments/MarketCapitalization.java index 7764e15..1d5d22c 100644 --- a/app/src/main/java/com/nauk/moodl/Activities/HomeActivityFragments/MarketCapitalization.java +++ b/app/src/main/java/com/nauk/moodl/Activities/HomeActivityFragments/MarketCapitalization.java @@ -321,6 +321,10 @@ public class MarketCapitalization extends Fragment { pieChart.setEntryLabelColor(Color.WHITE); updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), "Global", 0); + ((TextView) view.findViewById(R.id.textViewActiveCrypto)) + .setText(marketCapManager.getActive_crypto()); + ((TextView) view.findViewById(R.id.textViewActiveMarkets)) + .setText(marketCapManager.getActive_markets()); pieChart.setOnTouchListener(new View.OnTouchListener() { @Override @@ -350,6 +354,9 @@ public class MarketCapitalization extends Fragment { @Override public void run() { + view.findViewById(R.id.layoutActiveCrypto).setVisibility(View.GONE); + view.findViewById(R.id.layoutActiveMarkets).setVisibility(View.GONE); + if(!e.getData().equals("others")) { Currency currency = marketCapManager.getCurrencyFromSymbol((String) e.getData()); @@ -390,6 +397,9 @@ public class MarketCapitalization extends Fragment { view.findViewById(R.id.currencyIcon).setVisibility(View.GONE); view.findViewById(R.id.layoutPercentageDominance).setVisibility(View.GONE); + view.findViewById(R.id.layoutActiveCrypto).setVisibility(View.VISIBLE); + view.findViewById(R.id.layoutActiveMarkets).setVisibility(View.VISIBLE); + updateDetails(marketCapManager.getMarketCap(), marketCapManager.getDayVolume(), "Global", 0); pieChart.setDrawCenterText(true); diff --git a/app/src/main/java/com/nauk/moodl/DataManagers/MarketCapManager.java b/app/src/main/java/com/nauk/moodl/DataManagers/MarketCapManager.java index 2809607..0dc783b 100644 --- a/app/src/main/java/com/nauk/moodl/DataManagers/MarketCapManager.java +++ b/app/src/main/java/com/nauk/moodl/DataManagers/MarketCapManager.java @@ -33,6 +33,8 @@ public class MarketCapManager { private List topCurrencies; private long marketCap; private long dayVolume; + private String active_crypto; + private String active_markets; public MarketCapManager(android.content.Context context) { @@ -99,14 +101,25 @@ public class MarketCapManager { JSONObject quotesJsonObject = dataJsonObject.getJSONObject("quotes"); JSONObject valuesJsonObject = quotesJsonObject.getJSONObject(toSymbol); + active_crypto = dataJsonObject.getString("active_cryptocurrencies"); + active_markets = dataJsonObject.getString("active_markets"); marketCap = valuesJsonObject.getLong("total_market_cap"); - dayVolume = valuesJsonObject.getLong("total_volume_24h"); } catch (JSONException e) { e.printStackTrace(); } } + public String getActive_crypto() + { + return active_crypto; + } + + public String getActive_markets() + { + return active_markets; + } + public List getTopCurrencies() { return topCurrencies; diff --git a/app/src/main/res/layout/fragment_marketcap_homeactivity.xml b/app/src/main/res/layout/fragment_marketcap_homeactivity.xml index 2ef03f7..96529c0 100644 --- a/app/src/main/res/layout/fragment_marketcap_homeactivity.xml +++ b/app/src/main/res/layout/fragment_marketcap_homeactivity.xml @@ -167,6 +167,26 @@ + + + + + + + + + + + + + + + +