diff --git a/.gitignore b/.gitignore
index e8267b1..a02421c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,69 @@
-*.iml
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/libraries
.DS_Store
-/build
-/captures
-.externalNativeBuild
+
+# Built application files
*.apk
+*.ap_
+*.aab
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# IntelliJ
+*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/gradle.xml
+.idea/assetWizardSettings.xml
+.idea/dictionaries
+.idea/libraries
+.idea/caches
+
+# Keystore files
+# Uncomment the following lines if you do not want to check your keystore files in.
+#*.jks
+#*.keystore
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# Google Services (e.g. APIs or Firebase)
+google-services.json
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
\ No newline at end of file
diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml
index ddc44c0..62e00cc 100644
--- a/.idea/assetWizardSettings.xml
+++ b/.idea/assetWizardSettings.xml
@@ -13,6 +13,36 @@
+
@@ -71,7 +106,7 @@
@@ -81,9 +116,10 @@
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index ade5747..92dcb68 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/app/build.gradle b/app/build.gradle
index e3946f2..a9ebb6c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "com.herbron.moodl"
minSdkVersion 19
targetSdkVersion 27
- versionCode 6
- versionName "0.0.6"
+ versionCode 7
+ versionName "0.1.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4620055..24b4107 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -34,7 +34,7 @@
android:label="@string/title_activity_settings"
android:screenOrientation="portrait" />
currencyNames = cryptocompareApiManager.getCurrenciesName();
- List currencySymbols = cryptocompareApiManager.getCurrenciesSymbol();
-
- ArrayList currencyArrayList = new ArrayList<>();
-
- for(int i = 0; i < currencyNames.size(); i++)
- {
- currencyArrayList.add(new Currency(currencyNames.get(i), currencySymbols.get(i)));
- }
-
- adapter = new CoinWatchlistAdapter(this, currencyArrayList);
+ adapter = new CoinWatchlistAdapter(this, new ArrayList<>(coinmarketCapAPIManager.getTotalListing()));
}
private void setupList()
@@ -93,26 +92,16 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
Currency selectedCurrency = (Currency) adapterView.getItemAtPosition(i);
- if(isWatchList)
- {
- PreferencesManager preferencesManager = new PreferencesManager(getApplicationContext());
- DatabaseManager databaseManager = new DatabaseManager(getApplicationContext());
+ PreferencesManager preferencesManager = new PreferencesManager(getApplicationContext());
+ DatabaseManager databaseManager = new DatabaseManager(getApplicationContext());
- if(databaseManager.addCurrencyToWatchlist(selectedCurrency))
- {
- preferencesManager.setMustUpdateWatchlist(true);
- }
- else
- {
- Toast.makeText(getApplicationContext(), getString(R.string.already_watchlisr), Toast.LENGTH_SHORT).show();
- }
+ if(databaseManager.addCurrencyToWatchlist(selectedCurrency))
+ {
+ preferencesManager.setMustUpdateWatchlist(true);
}
else
{
- Intent intent = new Intent(CurrencySelectionActivity.this, RecordTransactionActivity.class);
- intent.putExtra("coin", selectedCurrency.getName());
- intent.putExtra("symbol", selectedCurrency.getSymbol());
- startActivity(intent);
+ Toast.makeText(getApplicationContext(), getString(R.string.already_watchlist), Toast.LENGTH_SHORT).show();
}
finish();
@@ -166,17 +155,20 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
private void detailsEvent()
{
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- setupAdapter();
- setupList();
- setupSearchView();
+ if(coinmarketCapAPIManager.isUpToDate() && cryptocompareApiManager.isDetailsUpToDate())
+ {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ setupAdapter();
+ setupList();
+ setupSearchView();
- expand(findViewById(R.id.listContainerLayout));
- findViewById(R.id.currencyListProgressBar).setVisibility(View.GONE);
- }
- });
+ expand(findViewById(R.id.listContainerLayout));
+ findViewById(R.id.currencyListProgressBar).setVisibility(View.GONE);
+ }
+ });
+ }
}
@Override
@@ -189,6 +181,26 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
}
+ @Override
+ public void onCurrenciesRetrieved(List currencyList) {
+
+ }
+
+ @Override
+ public void onTopCurrenciesUpdated() {
+
+ }
+
+ @Override
+ public void onMarketCapUpdated() {
+
+ }
+
+ @Override
+ public void onListingUpdated() {
+ detailsEvent();
+ }
+
private class ListLoader extends AsyncTask
{
@Override
@@ -211,9 +223,17 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
Looper.prepare();
}
- if(!cryptocompareApiManager.isDetailsUpToDate())
+ if(!cryptocompareApiManager.isDetailsUpToDate() || !coinmarketCapAPIManager.isUpToDate())
{
- cryptocompareApiManager.updateDetails();
+ if(!cryptocompareApiManager.isDetailsUpToDate())
+ {
+ cryptocompareApiManager.updateDetails();
+ }
+
+ if(!coinmarketCapAPIManager.isUpToDate())
+ {
+ coinmarketCapAPIManager.updateListing();
+ }
}
else
{
diff --git a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Charts.java b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/ChartsFragment.java
similarity index 93%
rename from app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Charts.java
rename to app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/ChartsFragment.java
index 5758398..8aedb3d 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Charts.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/ChartsFragment.java
@@ -36,7 +36,7 @@ import com.herbron.moodl.DataManagers.CurrencyData.CurrencyDataChart;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.CustomLayouts.CustomViewPager;
import com.herbron.moodl.MoodlBox;
-import com.herbron.moodl.PlaceholderManager;
+import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.util.ArrayList;
@@ -49,7 +49,7 @@ import static com.herbron.moodl.MoodlBox.numberConformer;
* Created by Tiji on 13/05/2018.
*/
-public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterface {
+public class ChartsFragment extends Fragment implements CurrencyInfoUpdateNotifierInterface {
private final static int HOUR = 0;
private final static int DAY = 1;
@@ -252,8 +252,8 @@ public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterf
updateFluctuation(start, end);
- ((TextView) view.findViewById(R.id.txtViewPriceStart)).setText(PlaceholderManager.getValueString(numberConformer(start), getActivity().getBaseContext()));
- ((TextView) view.findViewById(R.id.txtViewPriceNow)).setText(PlaceholderManager.getValueString(numberConformer(end), getActivity().getBaseContext()));
+ ((TextView) view.findViewById(R.id.txtViewPriceStart)).setText(PlaceholderUtils.getValueString(numberConformer(start), getActivity().getBaseContext()));
+ ((TextView) view.findViewById(R.id.txtViewPriceNow)).setText(PlaceholderUtils.getValueString(numberConformer(end), getActivity().getBaseContext()));
for(int i = 1; i < dataChartList.size(); i++)
{
@@ -270,9 +270,9 @@ public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterf
}
}
- ((TextView) view.findViewById(R.id.totalVolume)).setText(PlaceholderManager.getValueString(numberConformer(totalVolume), getActivity().getBaseContext()));
- ((TextView) view.findViewById(R.id.highestPrice)).setText(PlaceholderManager.getValueString(numberConformer(highestPrice), getActivity().getBaseContext()));
- ((TextView) view.findViewById(R.id.lowestPrice)).setText(PlaceholderManager.getValueString(numberConformer(lowestPrice), getActivity().getBaseContext()));
+ ((TextView) view.findViewById(R.id.totalVolume)).setText(PlaceholderUtils.getValueString(numberConformer(totalVolume), getActivity().getBaseContext()));
+ ((TextView) view.findViewById(R.id.highestPrice)).setText(PlaceholderUtils.getValueString(numberConformer(highestPrice), getActivity().getBaseContext()));
+ ((TextView) view.findViewById(R.id.lowestPrice)).setText(PlaceholderUtils.getValueString(numberConformer(lowestPrice), getActivity().getBaseContext()));
}
private void updateFluctuation(float start, float end)
@@ -457,9 +457,9 @@ public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterf
date = getDateFromTimestamp(dataChartList.get(index).getTimestamp() * 1000);
}
- volumePlaceholder = PlaceholderManager.getVolumeString(numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()), getActivity().getBaseContext());
- pricePlaceholder = PlaceholderManager.getPriceString(numberConformer((lineChart.getHighlighted())[0].getY()), getActivity().getBaseContext());
- timestampPlaceholder = PlaceholderManager.getTimestampString(date, getActivity().getBaseContext());
+ volumePlaceholder = PlaceholderUtils.getVolumeString(numberConformer(barChart.getData().getDataSets().get(0).getEntryForIndex(index).getY()), getActivity().getBaseContext());
+ pricePlaceholder = PlaceholderUtils.getPriceString(numberConformer((lineChart.getHighlighted())[0].getY()), getActivity().getBaseContext());
+ timestampPlaceholder = PlaceholderUtils.getTimestampString(date, getActivity().getBaseContext());
((TextView) view.findViewById(R.id.volumeHightlight)).setText(volumePlaceholder);
view.findViewById(R.id.volumeHightlight).setVisibility(View.VISIBLE);
@@ -628,31 +628,31 @@ public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterf
switch (timeIntervalSpinner.getSelectedItemPosition())
{
case 0:
- updateChartTab(Charts.HOUR, 1);
+ updateChartTab(ChartsFragment.HOUR, 1);
break;
case 1:
- updateChartTab(Charts.HOUR, 3);
+ updateChartTab(ChartsFragment.HOUR, 3);
break;
case 2:
- updateChartTab(Charts.DAY, 1);
+ updateChartTab(ChartsFragment.DAY, 1);
break;
case 3:
- updateChartTab(Charts.DAY, 3);
+ updateChartTab(ChartsFragment.DAY, 3);
break;
case 4:
- updateChartTab(Charts.WEEK, 11);
+ updateChartTab(ChartsFragment.WEEK, 11);
break;
case 5:
- updateChartTab(Charts.MONTH, 1);
+ updateChartTab(ChartsFragment.MONTH, 1);
break;
case 6:
- updateChartTab(Charts.MONTH, 3);
+ updateChartTab(ChartsFragment.MONTH, 3);
break;
case 7:
- updateChartTab(Charts.MONTH, 6);
+ updateChartTab(ChartsFragment.MONTH, 6);
break;
case 8:
- updateChartTab(Charts.YEAR, 1);
+ updateChartTab(ChartsFragment.YEAR, 1);
break;
}
}
diff --git a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/InformationFragment.java
similarity index 79%
rename from app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java
rename to app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/InformationFragment.java
index 5653191..595c241 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Informations.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/InformationFragment.java
@@ -9,6 +9,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.text.method.LinkMovementMethod;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -17,7 +18,7 @@ import android.widget.TextView;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.PreferencesManager;
-import com.herbron.moodl.PlaceholderManager;
+import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import static com.herbron.moodl.MoodlBox.numberConformer;
@@ -26,7 +27,7 @@ import static com.herbron.moodl.MoodlBox.numberConformer;
* Created by Tiji on 13/05/2018.
*/
-public class Informations extends Fragment {
+public class InformationFragment extends Fragment {
private Currency currency;
private View view;
@@ -74,12 +75,16 @@ public class Informations extends Fragment {
{
if(isTickerUpdated && isSnapshotUpdated)
{
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- refreshInfoTab();
- }
- });
+ try {
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ refreshInfoTab();
+ }
+ });
+ } catch (NullPointerException e) {
+ Log.d("moodl", "Information tab do not needs to be updated anymore");
+ }
}
}
@@ -120,12 +125,12 @@ public class Informations extends Fragment {
((TextView) view.findViewById(R.id.txtViewDescription))
.setMovementMethod(LinkMovementMethod.getInstance());
((TextView) view.findViewById(R.id.txtViewPercentageCoinEmited))
- .setText(PlaceholderManager.getEmitedPercentageString(numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100), getActivity().getBaseContext()));
+ .setText(PlaceholderUtils.getEmitedPercentageString(numberConformer(currency.getMinedCoinSupply() / currency.getMaxCoinSupply() * 100), getActivity().getBaseContext()));
if(currency.getMarketCapitalization() != 0)
{
((TextView) view.findViewById(R.id.txtViewMarketCapitalization))
- .setText(PlaceholderManager.getValueString(numberConformer(currency.getMarketCapitalization()), getActivity().getBaseContext()));
+ .setText(PlaceholderUtils.getValueString(numberConformer(currency.getMarketCapitalization()), getActivity().getBaseContext()));
view.findViewById(R.id.linearMarketCap).setVisibility(View.VISIBLE);
}
@@ -139,15 +144,15 @@ public class Informations extends Fragment {
if(currency.getMaxCoinSupply() == 0)
{
((TextView) view.findViewById(R.id.txtViewTotalSupply))
- .setText(PlaceholderManager.getSymbolString(getString(R.string.infinity), getActivity()));
+ .setText(PlaceholderUtils.getSymbolString(getString(R.string.infinity), getActivity()));
}
else
{
((TextView) view.findViewById(R.id.txtViewTotalSupply))
- .setText(PlaceholderManager.getSymbolString(numberConformer(currency.getMaxCoinSupply()), getActivity()));
+ .setText(PlaceholderUtils.getSymbolString(numberConformer(currency.getMaxCoinSupply()), getActivity()));
}
((TextView) view.findViewById(R.id.txtViewCirculatingSupply))
- .setText(PlaceholderManager.getSymbolString(numberConformer(currency.getMinedCoinSupply()), getActivity()));
+ .setText(PlaceholderUtils.getSymbolString(numberConformer(currency.getMinedCoinSupply()), getActivity()));
}
}
diff --git a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/TransactionsFragment.java
similarity index 58%
rename from app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java
rename to app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/TransactionsFragment.java
index 007e136..ecace94 100644
--- a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java
+++ b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/TransactionsFragment.java
@@ -1,20 +1,14 @@
package com.herbron.moodl.Activities.DetailsActivityFragments;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
-import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AbsListView;
import android.widget.ListView;
-import android.widget.ProgressBar;
import com.herbron.moodl.DataNotifiers.BinanceUpdateNotifierInterface;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
@@ -23,27 +17,28 @@ import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.ExchangeManager.BinanceManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
-import com.herbron.moodl.CustomAdapters.TradeListAdapter;
import com.herbron.moodl.CustomAdapters.TransactionListAdapter;
import com.herbron.moodl.R;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
/**
* Created by Tiji on 13/05/2018.
*/
-public class Transactions extends Fragment {
+public class TransactionsFragment extends Fragment {
private Currency currency;
private View loadingFooter;
private View view;
- private ListView tradeLayout;
+ //private ListView tradeLayout;
private ListView transactionLayout;
private boolean flag_loading;
- private BinanceManager binanceManager;
+ private List binanceManagerList;
private DatabaseManager databaseManager;
- private TradeListAdapter tradeListAdapter;
private ArrayList returnedTrades;
@Override
@@ -55,8 +50,8 @@ public class Transactions extends Fragment {
currency = getActivity().getIntent().getParcelableExtra("currency");
databaseManager = new DatabaseManager(getActivity().getBaseContext());
- //binanceManager = new BinanceManager(preferencesManager.getBinancePublicKey(), preferencesManager.getBinancePrivateKey());
- tradeLayout = view.findViewById(R.id.listTrades);
+ binanceManagerList = databaseManager.getBinanceAccounts();
+ //tradeLayout = view.findViewById(R.id.listTrades);
transactionLayout = view.findViewById(R.id.listTransactions);
flag_loading = false;
@@ -64,13 +59,295 @@ public class Transactions extends Fragment {
TransactionUpdater transactionUpdater = new TransactionUpdater();
transactionUpdater.execute();
- /*TradeUpdater updater = new TradeUpdater();
- updater.execute();*/
-
return view;
}
- private void loadingIndicatorGenerator()
+ private class TransactionUpdater extends AsyncTask implements BinanceUpdateNotifierInterface
+ {
+ private ArrayList