Merge pull request #9 from TanguyHerbron/master

Update Master's hot fixes
This commit is contained in:
Tanguy Herbron 2018-11-19 16:59:36 +01:00 committed by GitHub
commit ac7db53812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 1915 additions and 1339 deletions

75
.gitignore vendored
View File

@ -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

View File

@ -13,6 +13,36 @@
<PersistentState>
<option name="children">
<map>
<entry key="actionbar">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="image">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="paddingPercent" value="-10" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="assetType" value="IMAGE" />
<entry key="imageAsset" value="D:\Projets Adobe\Photoshop\Moodl_background_textonly.png" />
<entry key="outputName" value="moodl_background" />
<entry key="theme" value="CUSTOM" />
<entry key="themeColor" value="ffffff" />
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="launcher">
<value>
<PersistentState>
@ -48,6 +78,11 @@
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputIconType" value="ACTIONBAR" />
</map>
</option>
</PersistentState>
</value>
</entry>
@ -71,7 +106,7 @@
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/navigation/ic_arrow_drop_up_black_24dp.xml" />
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/navigation/ic_arrow_upward_black_24dp.xml" />
</map>
</option>
</PersistentState>
@ -81,9 +116,10 @@
</option>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="color" value="ffffff" />
<entry key="outputName" value="ic_arrow_drop_up_white_24dp" />
<entry key="sourceFile" value="C:\Users\Guitoune" />
<entry key="outputName" value="exchange_logo_hitbtc" />
<entry key="sourceFile" value="D:\Téléchargement\hitbtc.svg" />
</map>
</option>
</PersistentState>

Binary file not shown.

View File

@ -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
}

View File

@ -34,7 +34,7 @@
android:label="@string/title_activity_settings"
android:screenOrientation="portrait" />
<activity
android:name=".Activities.CurrencySelectionActivity"
android:name=".Activities.CurrencyListActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"

View File

@ -1,11 +1,11 @@
package com.herbron.moodl.Activities;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@ -16,6 +16,8 @@ import android.widget.ListView;
import android.widget.SearchView;
import android.widget.Toast;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CoinmarketCapAPIManager;
import com.herbron.moodl.DataNotifiers.CoinmarketcapNotifierInterface;
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
@ -25,15 +27,22 @@ import com.herbron.moodl.CustomAdapters.CoinWatchlistAdapter;
import com.herbron.moodl.R;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
public class CurrencySelectionActivity extends AppCompatActivity implements SearchView.OnQueryTextListener, CryptocompareNotifierInterface {
public class CurrencyListActivity extends AppCompatActivity implements SearchView.OnQueryTextListener, CryptocompareNotifierInterface, CoinmarketcapNotifierInterface {
private CoinWatchlistAdapter adapter;
private ListView listView;
private android.widget.Filter filter;
private CryptocompareApiManager cryptocompareApiManager;
private boolean isWatchList;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -42,15 +51,15 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_add_currency);
setContentView(R.layout.activity_currency_list);
cryptocompareApiManager = CryptocompareApiManager.getInstance(this);
cryptocompareApiManager.addListener(this);
setTitle(getString(R.string.select_coin));
coinmarketCapAPIManager = CoinmarketCapAPIManager.getInstance(this);
coinmarketCapAPIManager.addListener(this);
Intent intent = getIntent();
isWatchList = intent.getBooleanExtra("isWatchList", false);
setTitle(getString(R.string.select_coin));
ListLoader listLoader = new ListLoader();
listLoader.execute();
@ -68,17 +77,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
private void setupAdapter()
{
List<String> currencyNames = cryptocompareApiManager.getCurrenciesName();
List<String> currencySymbols = cryptocompareApiManager.getCurrenciesSymbol();
ArrayList<Currency> 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<Currency> currencyList) {
}
@Override
public void onTopCurrenciesUpdated() {
}
@Override
public void onMarketCapUpdated() {
}
@Override
public void onListingUpdated() {
detailsEvent();
}
private class ListLoader extends AsyncTask<Void, Integer, Void>
{
@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
{

View File

@ -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;
}
}

View File

@ -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()));
}
}

View File

@ -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<BinanceManager> binanceManagerList;
private DatabaseManager databaseManager;
private TradeListAdapter tradeListAdapter;
private ArrayList<com.herbron.moodl.DataManagers.CurrencyData.Trade> 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<Void, Integer, Void> implements BinanceUpdateNotifierInterface
{
private ArrayList<Object> displayedTransactions;
private int nbTradeAccountUpdated;
private int nbTransactionAccountUpdated;
@Override
protected void onPreExecute() {
super.onPreExecute();
displayedTransactions = new ArrayList<>();
nbTradeAccountUpdated = 0;
nbTransactionAccountUpdated = 0;
}
@Override
protected Void doInBackground(Void... voids) {
if(Looper.myLooper() == null)
{
Looper.prepare();
}
displayedTransactions.addAll(databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol()));
for(int i = 0; i < binanceManagerList.size(); i++)
{
binanceManagerList.get(i).addListener(this);
binanceManagerList.get(i).updateTrades(currency.getSymbol());
binanceManagerList.get(i).updateTransactions(currency.getSymbol());
}
if(nbTradeAccountUpdated == binanceManagerList.size())
{
drawTransactionList(displayedTransactions);
}
return null;
}
@Override
public void onBinanceTradesUpdated(List<Trade> trades) {
nbTradeAccountUpdated++;
displayedTransactions.addAll(trades);
if(nbTradeAccountUpdated == binanceManagerList.size())
{
drawTransactionList(displayedTransactions);
}
}
@Override
public void onBinanceBalanceUpdateSuccess() {
}
@Override
public void onBinanceBalanceUpdateError(int accountId, String error) {
}
private void drawTransactionList(ArrayList<Object> transactions)
{
Collections.sort(transactions, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
Long time1;
Long time2;
if(o1 instanceof Transaction)
{
time1 = ((Transaction) o1).getTimestamp();
}
else
{
time1 = ((Trade) o1).getTime();
}
if(o2 instanceof Transaction)
{
time2 = ((Transaction) o2).getTimestamp();
}
else
{
time2 = ((Trade) o2).getTime();
}
return time2.compareTo(time1);
}
});
if(getActivity() != null)
{
TransactionListAdapter transactionListAdapter = new TransactionListAdapter(getActivity(), transactions);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
transactionLayout.setAdapter(transactionListAdapter);
transactionLayout.setTextFilterEnabled(false);
}
});
}
}
}
/*public class TransactionUpdater extends AsyncTask<Void, Integer, Void>
{
@Override
protected Void doInBackground(Void... voids) {
if(Looper.myLooper() == null)
{
Looper.prepare();
}
//binanceManager.updateTransactions(currency.getSymbol());
final ArrayList<Transaction> transactionList = databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
drawTransactionList(transactionList);
}
});
return null;
}
}*/
/*private class TradeAdder extends AsyncTask<Void, Integer, Void>
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
loadingIndicatorGenerator();
}
@Override
protected Void doInBackground(Void... voids) {
final ArrayList<Trade> trades = new ArrayList<>();
for(int i = tradeLayout.getCount(); i < tradeLayout.getCount() + 20 && i < returnedTrades.size(); i++)
{
trades.add(returnedTrades.get(i));
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
tradeListAdapter.addAll(trades);
tradeListAdapter.notifyDataSetChanged();
flag_loading = false;
tradeLayout.removeFooterView(loadingFooter);
}
});
binanceManager.updateTrades(new BinanceManager.BinanceCallBack() {
@Override
public void onSuccess() {
ArrayList<com.nauk.moodl.DataManagers.CurrencyData.Trade> trades = binanceManager.getTrades();
final ArrayList<com.nauk.moodl.DataManagers.CurrencyData.Trade> returnedTrades = new ArrayList<>();
for(int i = trades.size() - 1; i > 0 ; i--)
{
returnedTrades.add(trades.get(i));
}
runOnUiThread(new Runnable() {
@Override
public void run() {
tradeListAdapter.addAll(returnedTrades);
tradeListAdapter.notifyDataSetChanged();
flag_loading = false;
tradeLayout.removeFooterView(loadingFooter);
}
});
}
@Override
public void onError(String error) {
}
}, currency.getSymbol(), tradeListAdapter.getItem(tradeListAdapter.getCount() - 1).getId());
return null;
}
}*/
/*private void drawTransactionList(ArrayList<Transaction> transactions)
{
TransactionListAdapter transactionListAdapter = new TransactionListAdapter(getActivity(), transactions);
transactionLayout.setAdapter(transactionListAdapter);
transactionLayout.setTextFilterEnabled(false);
}
private class TradeUpdater extends AsyncTask<Void, Integer, Void> implements BinanceUpdateNotifierInterface
{
private List<Trade> trades;
private int nbResponse;
@Override
protected void onPreExecute()
{
super.onPreExecute();
trades = new ArrayList<>();
nbResponse = 0;
}
@Override
protected void onProgressUpdate(Integer... values)
{
super.onProgressUpdate(values);
}
@Override
protected Void doInBackground(Void... params)
{
for(int i = 0; i < binanceManagerList.size(); i++)
{
binanceManagerList.get(i).addListener(this);
binanceManagerList.get(i).updateTrades(currency.getSymbol());
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
}
@Override
public void onBinanceTradesUpdated(List<Trade> newTrades) {
trades.addAll(newTrades);
nbResponse++;
if(nbResponse == binanceManagerList.size())
{
returnedTrades = new ArrayList<>();
for(int i = trades.size() - 1; i >= 0 ; i--)
{
returnedTrades.add(trades.get(i));
}
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ArrayList<Trade> trades = new ArrayList<>();
for(int i = 0; i < 20 && i < returnedTrades.size(); i++)
{
trades.add(returnedTrades.get(i));
}
//drawTradeList(trades);
}
});
} catch (NullPointerException e) {
Log.d("moodl", "TransactionsFragment do not need to be updated anymore");
}
}
}
@Override
public void onBinanceBalanceUpdateSuccess() {
}
@Override
public void onBinanceBalanceUpdateError(int accountId, String error) {
}
}*/
/*private void loadingIndicatorGenerator()
{
loadingFooter = LayoutInflater.from(getActivity().getBaseContext()).inflate(R.layout.listview_loading_indicator, null, false);
@ -114,168 +391,5 @@ public class Transactions extends Fragment {
tradeLayout.setTextFilterEnabled(false);
view.findViewById(R.id.tradeLoaderIndicator).setVisibility(View.GONE);
}
private class TradeAdder extends AsyncTask<Void, Integer, Void>
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
loadingIndicatorGenerator();
}
@Override
protected Void doInBackground(Void... voids) {
final ArrayList<Trade> trades = new ArrayList<>();
for(int i = tradeLayout.getCount(); i < tradeLayout.getCount() + 20 && i < returnedTrades.size(); i++)
{
trades.add(returnedTrades.get(i));
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
tradeListAdapter.addAll(trades);
tradeListAdapter.notifyDataSetChanged();
flag_loading = false;
tradeLayout.removeFooterView(loadingFooter);
}
});
/*binanceManager.updateTrades(new BinanceManager.BinanceCallBack() {
@Override
public void onSuccess() {
ArrayList<com.nauk.moodl.DataManagers.CurrencyData.Trade> trades = binanceManager.getTrades();
final ArrayList<com.nauk.moodl.DataManagers.CurrencyData.Trade> returnedTrades = new ArrayList<>();
for(int i = trades.size() - 1; i > 0 ; i--)
{
returnedTrades.add(trades.get(i));
}
runOnUiThread(new Runnable() {
@Override
public void run() {
tradeListAdapter.addAll(returnedTrades);
tradeListAdapter.notifyDataSetChanged();
flag_loading = false;
tradeLayout.removeFooterView(loadingFooter);
}
});
}
@Override
public void onError(String error) {
}
}, currency.getSymbol(), tradeListAdapter.getItem(tradeListAdapter.getCount() - 1).getId());*/
return null;
}
}
private void drawTransactionList(ArrayList<Transaction> transactions)
{
TransactionListAdapter transactionListAdapter = new TransactionListAdapter(getActivity(), transactions);
transactionLayout.setAdapter(transactionListAdapter);
transactionLayout.setTextFilterEnabled(false);
}
public class TransactionUpdater extends AsyncTask<Void, Integer, Void>
{
@Override
protected Void doInBackground(Void... voids) {
if(Looper.myLooper() == null)
{
Looper.prepare();
}
//binanceManager.updateTransactions(currency.getSymbol());
final ArrayList<Transaction> transactionList = databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
drawTransactionList(transactionList);
}
});
return null;
}
}
private class TradeUpdater extends AsyncTask<Void, Integer, Void> implements BinanceUpdateNotifierInterface
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected void onProgressUpdate(Integer... values)
{
super.onProgressUpdate(values);
}
@Override
protected Void doInBackground(Void... params)
{
binanceManager.updateTrades(currency.getSymbol());
return null;
}
@Override
protected void onPostExecute(Void result)
{
}
@Override
public void onBinanceTradesUpdated() {
ArrayList<Trade> trades = binanceManager.getTrades();
returnedTrades = new ArrayList<>();
for(int i = trades.size() - 1; i >= 0 ; i--)
{
returnedTrades.add(trades.get(i));
}
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ArrayList<Trade> trades = new ArrayList<>();
for(int i = 0; i < 20 && i < returnedTrades.size(); i++)
{
trades.add(returnedTrades.get(i));
}
drawTradeList(trades);
}
});
} catch (NullPointerException e) {
Log.d("moodl", "Transactions do not need to be updated anymore");
}
}
@Override
public void onBinanceBalanceUpdateSuccess() {
}
@Override
public void onBinanceBalanceUpdateError(int accountId, String error) {
}
}
}*/
}

View File

@ -3,13 +3,11 @@ package com.herbron.moodl.Activities;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
@ -19,14 +17,12 @@ import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
@ -38,7 +34,7 @@ import com.herbron.moodl.BalanceSwitchManagerInterface;
import com.herbron.moodl.BalanceUpdateInterface;
import com.herbron.moodl.DataManagers.DatabaseManager;
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;
@ -247,11 +243,11 @@ public class HomeActivity extends AppCompatActivity implements BalanceUpdateInte
if(preferencesManager.isBalanceHidden())
{
drawerBalanceTextView.setText(PlaceholderManager.getPercentageString(numberConformer(value), getApplicationContext()));
drawerBalanceTextView.setText(PlaceholderUtils.getPercentageString(numberConformer(value), getApplicationContext()));
}
else
{
drawerBalanceTextView.setText(PlaceholderManager.getValueString(numberConformer(value), getApplicationContext()));
drawerBalanceTextView.setText(PlaceholderUtils.getValueString(numberConformer(value), getApplicationContext()));
}
}
}

View File

@ -9,6 +9,7 @@ import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.NestedScrollView;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.graphics.Palette;
import android.text.SpannableString;
@ -36,13 +37,14 @@ import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.CustomLayouts.CustomPieChart;
import com.herbron.moodl.MoodlBox;
import com.herbron.moodl.DataNotifiers.MoodlboxNotifierInterface;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.util.ArrayList;
import java.util.List;
import static com.herbron.moodl.MoodlBox.getColor;
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
import static java.lang.Math.abs;
/**
@ -54,6 +56,7 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
private PreferencesManager preferencesManager;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
private SwipeRefreshLayout refreshLayout;
private NestedScrollView nestedScrollView;
private long lastTimestamp;
private String defaultCurrency;
private CryptocompareApiManager cryptocompareApiManager;
@ -89,6 +92,8 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
defaultCurrency = preferencesManager.getDefaultCurrency();
lastTimestamp = 0;
nestedScrollView = view.findViewById(R.id.nestedMarketCap);
setupRefreshLayout();
setupDrawerButton();
@ -261,10 +266,8 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
MoodlBox.getBitmapFromURL(iconUrl, localCurrency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
@Override
public void onBitmapDownloaded(Bitmap bitmapIcon) {
Palette.Builder builder = Palette.from(bitmapIcon);
coinmarketCapAPIManager.getTopCurrencies().get(index).setIcon(bitmapIcon);
coinmarketCapAPIManager.getTopCurrencies().get(index).setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getActivity().getBaseContext())));
coinmarketCapAPIManager.getTopCurrencies().get(index).setChartColor(getIconDominantColor(getContext(), bitmapIcon));
countIcons();
@ -304,12 +307,12 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
switch (motionEvent.getAction())
{
case MotionEvent.ACTION_DOWN:
refreshLayout.setEnabled(false);
nestedScrollView.setEnabled(false);
break;
case MotionEvent.ACTION_MOVE:
break;
default:
refreshLayout.setEnabled(true);
nestedScrollView.setEnabled(true);
break;
}
@ -387,13 +390,13 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
private void updateDetails(double marketCap, double volume, String title, double percentage)
{
((TextView) view.findViewById(R.id.textViewMarketCap))
.setText(PlaceholderManager.getValueString(MoodlBox.numberConformer(marketCap), getActivity().getBaseContext()));
.setText(PlaceholderUtils.getValueString(MoodlBox.numberConformer(marketCap), getActivity().getBaseContext()));
((TextView) view.findViewById(R.id.textViewVolume))
.setText(PlaceholderManager.getValueString(MoodlBox.numberConformer(volume), getActivity().getBaseContext()));
.setText(PlaceholderUtils.getValueString(MoodlBox.numberConformer(volume), getActivity().getBaseContext()));
((TextView) view.findViewById(R.id.textViewTitle))
.setText(title);
((TextView) view.findViewById(R.id.textViewDominancePercentage))
.setText(PlaceholderManager.getPercentageString(MoodlBox.numberConformer(percentage), getActivity().getBaseContext()));
.setText(PlaceholderUtils.getPercentageString(MoodlBox.numberConformer(percentage), getActivity().getBaseContext()));
}
private SpannableString generateCenterSpannableText() {

View File

@ -30,6 +30,7 @@ import com.herbron.moodl.R;
import java.util.List;
import static com.herbron.moodl.MoodlBox.getDrawable;
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
/**
* Created by Administrator on 27/05/2018.
@ -121,20 +122,6 @@ public class Overview extends Fragment implements CoinmarketcapNotifierInterface
currencyLoader.execute();
}
private void updateChartColor(Currency currency)
{
if(currency.getIcon() != null)
{
Palette.Builder builder = Palette.from(currency.getIcon());
currency.setChartColor(builder.generate().getDominantColor(0));
}
else
{
currency.setChartColor(12369084);
}
}
private void loadingIndicatorGenerator()
{
loadingFooter = LayoutInflater.from(getActivity().getBaseContext()).inflate(R.layout.listview_loading_indicator, null, false);
@ -198,7 +185,7 @@ public class Overview extends Fragment implements CoinmarketcapNotifierInterface
@Override
public void onBitmapDownloaded(Bitmap bitmap) {
currency.setIcon(bitmap);
updateChartColor(currency);
currency.setChartColor(getIconDominantColor(getContext(), bitmap));
countIcons(currencies[0]);
}
});
@ -216,7 +203,7 @@ public class Overview extends Fragment implements CoinmarketcapNotifierInterface
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
currency.setIcon(icon);
updateChartColor(currency);
currency.setChartColor(getIconDominantColor(getContext(), icon));
countIcons(currencies[0]);
}
}

View File

@ -3,6 +3,7 @@ package com.herbron.moodl.Activities.HomeActivityFragments;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@ -51,7 +52,7 @@ import com.herbron.moodl.BalanceSwitchManagerInterface;
import com.herbron.moodl.DataNotifiers.BalanceUpdateNotifierInterface;
import com.herbron.moodl.MoodlBox;
import com.herbron.moodl.DataNotifiers.MoodlboxNotifierInterface;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.io.File;
@ -61,6 +62,7 @@ import java.util.Random;
import static com.herbron.moodl.MoodlBox.getColor;
import static com.herbron.moodl.MoodlBox.getDrawable;
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
import static com.herbron.moodl.MoodlBox.numberConformer;
import static java.lang.Math.abs;
@ -70,23 +72,22 @@ import static java.lang.Math.abs;
public class Summary extends Fragment implements BalanceSwitchManagerInterface, BalanceUpdateNotifierInterface, CryptocompareNotifierInterface, CoinmarketcapNotifierInterface {
private LinearLayout currencyLayout;
private PreferencesManager preferencesManager;
private BalanceManager balanceManager;
private SwipeRefreshLayout refreshLayout;
private Dialog loadingDialog;
private String defaultCurrency;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
private TextView toolbarSubtitle;
private CollapsingToolbarLayout toolbarLayout;
private Handler handler;
private Runnable updateRunnable;
private Runnable layoutRefresherRunnable;
private int coinCounter;
private int iconCounter;
private float totalValue;
private boolean detailsChecker;
private boolean tickersChecker;
@ -94,6 +95,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
private long lastTimestamp;
private BalanceUpdateInterface balanceUpdateInterface;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
private CryptocompareApiManager cryptocompareApiManager;
@NonNull
@ -124,8 +126,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
initiateUpdateRunnable();
initiateLayoutRefresherRunnable();
refreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
@ -201,48 +201,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
};
}
private void initiateLayoutRefresherRunnable()
{
layoutRefresherRunnable = new Runnable() {
@Override
public void run() {
final List<Currency> renderedCurrencies = new ArrayList<>();
if (balanceManager.getTotalBalance() != null)
{
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++) {
final Currency currency = balanceManager.getTotalBalance().get(i);
if (!currency.getSymbol().equals("USD") && (Math.abs(currency.getBalance() * currency.getValue()) >= preferencesManager.getMinimumAmount())) {
//currencyView.add(layoutGenerator.getInfoLayout(currency, totalValue, preferencesManager.isBalanceHidden()));
renderedCurrencies.add(currency);
}
}
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
currencyLayout.removeAllViews();
for(int i = 0; i < renderedCurrencies.size(); i++)
{
//currencyLayout.addView(currencyView.get(i));
currencyLayout.addView(new CurrencyCardview(getActivity(), renderedCurrencies.get(i), getActivity(), totalValue, preferencesManager.isBalanceHidden()));
}
if(loadingDialog.isShowing())
{
loadingDialog.dismiss();
}
handler.removeCallbacks(updateRunnable);
}
});
}
};
}
private void setupAddCurrencyButton(View fragmentView)
{
Button addCurrencyButton = fragmentView.findViewById(R.id.buttonAddTransaction);
@ -304,8 +262,8 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
}
else
{
TextView appNameTextView = splashLayout.findViewById(R.id.appNameTextView);
appNameTextView.setVisibility(View.VISIBLE);
/*ImageView appNameImageView = splashLayout.findViewById(R.id.appNameImageView);
appNameImageView.setVisibility(View.VISIBLE);*/
animatedLayout.setVisibility(View.GONE);
}
@ -361,7 +319,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
.setAction(getString(R.string.update), new View.OnClickListener() {
@Override
public void onClick(View view) {
updateAll(true);
}
})
.show();
@ -370,15 +328,46 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
private void resetCounters()
{
coinCounter = 0;
iconCounter = 0;
totalValue = 0;
totalFluctuation = 0;
}
private void adaptView()
private void adaptView(float totalValue, float totalFluctuation)
{
layoutRefresherRunnable.run();
this.totalValue = totalValue;
this.totalFluctuation = totalFluctuation;
final List<Currency> renderedCurrencies = new ArrayList<>();
if (balanceManager.getTotalBalance() != null)
{
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++) {
final Currency currency = balanceManager.getTotalBalance().get(i);
if ((Math.abs(currency.getBalance() * currency.getValue()) >= preferencesManager.getMinimumAmount())) {
//currencyView.add(layoutGenerator.getInfoLayout(currency, totalValue, preferencesManager.isBalanceHidden()));
renderedCurrencies.add(currency);
}
}
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
currencyLayout.removeAllViews();
for(int i = 0; i < renderedCurrencies.size(); i++)
{
currencyLayout.addView(new CurrencyCardview(getActivity(), renderedCurrencies.get(i), getActivity(), preferencesManager.isBalanceHidden()));
}
if(loadingDialog.isShowing())
{
loadingDialog.dismiss();
}
updateTitle();
handler.removeCallbacks(updateRunnable);
}
});
}
private void countCoins(boolean isCoin, boolean isDetails, boolean isTickers)
@ -402,46 +391,22 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
{
if(balanceManager.getTotalBalance().size() == 0)
{
countIcons();
updateNoBalance();
}
else
{
if(coinCounter >= balanceManager.getTotalBalance().size() && detailsChecker && tickersChecker)
{
IconDownloader iconDownloader = new IconDownloader();
iconDownloader.execute();
}
}
}
}
private void countIcons()
{
int offset = 0;
for(int i = 0; i < balanceManager.getTotalBalance().size(); i++)
{
if(balanceManager.getTotalBalance().get(i).getSymbol().equals("USD"))
{
offset++;
}
}
iconCounter++;
if(balanceManager.getTotalBalance() != null)
{
if(balanceManager.getTotalBalance().size() == 0)
{
updateNoBalance();
}
else
{
if(iconCounter == balanceManager.getTotalBalance().size() - offset)
{
UiHeavyLoadCalculator uiHeavyLoadCalculator = new UiHeavyLoadCalculator();
uiHeavyLoadCalculator.execute();
uiHeavyLoadCalculator.setOnUiEndListener(new UiHeavyLoadCalculator.OnUiEndListener() {
@Override
public void onEnd(float totalValue, float totalFluctuation) {
refreshLayout.setRefreshing(false);
adaptView(totalValue, totalFluctuation);
}
});
uiHeavyLoadCalculator.execute(getActivity().getBaseContext(), balanceManager, coinmarketCapAPIManager);
}
}
}
@ -466,8 +431,21 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
});
}
private void computeTotalValue()
{
for(int i = 0; i < currencyLayout.getChildCount(); i++)
{
if(currencyLayout.getChildAt(i) instanceof CurrencyCardview)
{
((CurrencyCardview) currencyLayout.getChildAt(i)).updateOwnedValues(totalValue, preferencesManager.isBalanceHidden());
}
}
}
protected void updateTitle()
{
computeTotalValue();
float totalFluctuationPercentage = totalFluctuation / (totalValue - totalFluctuation) * 100;
if(preferencesManager.isBalanceHidden())
@ -500,7 +478,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
public void updateBalanceDisplayedTitle(float totalFluctuationPercentage)
{
toolbarLayout.setTitle(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
toolbarLayout.setTitle(PlaceholderUtils.getValueString(numberConformer(totalValue), getActivity()));
toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
toolbarLayout.setExpandedTitleColor(Color.WHITE);
@ -517,18 +495,18 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
if(totalFluctuation == 0)
{
toolbarSubtitle.setText(PlaceholderManager.getValueString(numberConformer(totalValue), getActivity()));
toolbarSubtitle.setText(PlaceholderUtils.getValueString(numberConformer(totalValue), getActivity()));
toolbarSubtitle.setTextColor(-1275068417);
}
else
{
toolbarSubtitle.setText(PlaceholderManager.getValuePercentageString(numberConformer(totalFluctuation), numberConformer(totalFluctuationPercentage), getActivity()));
toolbarSubtitle.setText(PlaceholderUtils.getValuePercentageString(numberConformer(totalFluctuation), numberConformer(totalFluctuationPercentage), getActivity()));
}
}
private void updateHideBalanceTitle(float totalFluctuationPercentage)
{
toolbarLayout.setTitle(PlaceholderManager.getPercentageString(numberConformer(totalFluctuationPercentage), getActivity()));
toolbarLayout.setTitle(PlaceholderUtils.getPercentageString(numberConformer(totalFluctuationPercentage), getActivity()));
toolbarSubtitle.setVisibility(View.GONE);
if(totalFluctuation > 0)
@ -553,7 +531,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
public void onBalanceDataUpdated() {
final List<Currency> balance = balanceManager.getTotalBalance();
if(balance.size() > 0)
if(balance != null && balance.size() > 0)
{
for(int i = 0; i < balance.size(); i++)
{
@ -666,9 +644,22 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
countCoins(false, false, true);
}
private class UiHeavyLoadCalculator extends AsyncTask<Void, Integer, Void>
private static class UiHeavyLoadCalculator extends AsyncTask<Object, Integer, Void>
{
private float totalValue = 0;
private float totalFluctuation = 0;
private BalanceManager balanceManager;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
private OnUiEndListener onUiEndListener;
public void setOnUiEndListener(OnUiEndListener onUiEndListener)
{
this.onUiEndListener = onUiEndListener;
}
@Override
protected void onPreExecute()
{
@ -684,39 +675,19 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
super.onProgressUpdate(values);
}
private void updateChartColor(Currency currency)
{
if(currency.getIcon() != null)
{
Palette.Builder builder = Palette.from(currency.getIcon());
currency.setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getActivity().getBaseContext())));
}
else
{
currency.setChartColor(getColor(R.color.default_color, getActivity().getBaseContext()));
}
}
private void loadCurrency(Currency currency)
{
if(!currency.getSymbol().equals("USD"))
{
currency.setName(balanceManager.getCurrencyName(currency.getSymbol()));
currency.setId(balanceManager.getCurrencyId(currency.getSymbol()));
totalValue += currency.getValue() * currency.getBalance();
totalFluctuation += (currency.getValue() * currency.getBalance()) * (currency.getDayFluctuationPercentage() / 100);
}
}
@Override
protected Void doInBackground(Void... params)
protected Void doInBackground(Object... params)
{
if(Looper.myLooper() == null)
{
Looper.prepare();
}
Context baseContext = (Context) params[0];
balanceManager = (BalanceManager) params[1];
coinmarketCapAPIManager = (CoinmarketCapAPIManager) params[2];
balanceManager.sortCoins();
for(int i = 0; i < balanceManager.getTotalBalance().size(); i++)
@ -725,40 +696,34 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
localCurrency.setTickerId(coinmarketCapAPIManager.getTickerIdForSymbol(localCurrency.getSymbol()));
updateChartColor(localCurrency);
localCurrency.setChartColor(getIconDominantColor(baseContext, localCurrency.getIcon()));
loadCurrency(localCurrency);
totalValue += localCurrency.getValue() * localCurrency.getBalance();
totalFluctuation += localCurrency.getValue() * localCurrency.getBalance() * (localCurrency.getDayFluctuationPercentage() / 100);
balanceManager.getTotalBalance().set(i, localCurrency);
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
updateTitle();
}
});
return null;
}
private void loadCurrency(Currency currency)
{
currency.setName(balanceManager.getCurrencyName(currency.getSymbol()));
currency.setId(balanceManager.getCurrencyId(currency.getSymbol()));
}
@Override
protected void onPostExecute(Void result)
{
refreshLayout.setRefreshing(false);
new AsyncTask<Void, Integer, Void>() {
onUiEndListener.onEnd(totalValue, totalFluctuation);
}
@Override
protected Void doInBackground(Void... voids) {
if(Looper.myLooper() == null)
{
Looper.prepare();
}
adaptView();
return null;
}
}.execute();
public interface OnUiEndListener
{
void onEnd(float totalValue, float totalFluctuation);
}
}
@ -786,63 +751,9 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
}
}
private class IconDownloader extends AsyncTask<Void, Integer, Void>
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected void onProgressUpdate(Integer... values)
{
super.onProgressUpdate(values);
}
@Override
protected Void doInBackground(Void... params)
{
for (int i = 0; i < balanceManager.getTotalBalance().size(); i++)
{
final Currency localCurrency = balanceManager.getTotalBalance().get(i);
String iconUrl = MoodlBox.getIconUrl(localCurrency.getSymbol(), balanceManager.getCryptocompareApiManager());
if(iconUrl != null)
{
MoodlBox.getBitmapFromURL(iconUrl, localCurrency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
@Override
public void onBitmapDownloaded(Bitmap bitmapIcon) {
localCurrency.setIcon(bitmapIcon);
countIcons();
}
});
}
else
{
Drawable drawable = getDrawable(R.drawable.ic_panorama_fish_eye_24dp, getActivity().getBaseContext());
Bitmap icon = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(icon);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
localCurrency.setIcon(icon);
countIcons();
}
}
return null;
}
}
private class DataUpdater extends AsyncTask<Void, Integer, Void>
{
@Override
protected Void doInBackground(Void... params)
{

View File

@ -12,14 +12,14 @@ import android.os.Bundle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.graphics.Palette;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import com.herbron.moodl.Activities.CurrencySelectionActivity;
import com.herbron.moodl.Activities.CurrencyListActivity;
import com.herbron.moodl.DataNotifiers.CoinmarketcapNotifierInterface;
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
@ -42,7 +42,7 @@ import java.util.List;
import static com.herbron.moodl.MoodlBox.collapseW;
import static com.herbron.moodl.MoodlBox.expandW;
import static com.herbron.moodl.MoodlBox.getColor;
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
/**
* Created by Tiji on 13/04/2018.
@ -249,7 +249,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
disableEdition();
}
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
Intent selectionIntent = new Intent(getActivity(), CurrencyListActivity.class);
selectionIntent.putExtra("isWatchList", true);
startActivity(selectionIntent);
}
@ -354,6 +354,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
public void run() {
dragLinearLayout.removeAllViews();
view.findViewById(R.id.progressBarWatchlist).setVisibility(View.GONE);
view.findViewById(R.id.buttonAddWatchlist).setVisibility(View.VISIBLE);
for(Currency currency : watchlistManager.getWatchlist())
{
@ -380,20 +381,6 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
}
}
private void updateChartColor(Currency currency)
{
if(currency.getIcon() != null)
{
Palette.Builder builder = Palette.from(currency.getIcon());
currency.setChartColor(builder.generate().getDominantColor(getColor(R.color.default_color, getActivity().getBaseContext())));
}
else
{
currency.setChartColor(getColor(R.color.default_color, getActivity().getBaseContext()));
}
}
public int getCurrencyId(String symbol)
{
int id = 0;
@ -403,6 +390,9 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
id = jsonObject.getInt("Id");
} catch (JSONException e) {
e.printStackTrace();
} catch (NullPointerException e) {
Log.d("moodl", "ID not found");
e.printStackTrace();
}
return id;
@ -448,27 +438,14 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
public void onPriceUpdated(Currency successCurrency) {
String iconUrl = MoodlBox.getIconUrl(currency.getSymbol(), cryptocompareApiManager);
if(iconUrl != null)
{
MoodlBox.getBitmapFromURL(iconUrl, currency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
@Override
public void onBitmapDownloaded(Bitmap bitmapIcon) {
currency.setIcon(bitmapIcon);
updateChartColor(currency);
countWatchlist();
}
});
}
else
{
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
currency.setIcon(icon);
updateChartColor(currency);
countWatchlist();
}
MoodlBox.getBitmapFromURL(iconUrl, currency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
@Override
public void onBitmapDownloaded(Bitmap bitmapIcon) {
currency.setIcon(bitmapIcon);
currency.setChartColor(getIconDominantColor(getContext(), bitmapIcon));
countWatchlist();
}
});
}
});
}

View File

@ -3,47 +3,36 @@ package com.herbron.moodl.Activities;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.opengl.Visibility;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TimePicker;
import com.herbron.moodl.Activities.RecordTransactionFragments.BuyFragment;
import com.herbron.moodl.Activities.RecordTransactionFragments.SellFragment;
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
import com.herbron.moodl.CustomAdapters.PairRecordListAdapter;
import com.herbron.moodl.CustomLayouts.CustomRecordFragment;
import com.herbron.moodl.CustomLayouts.CustomViewPager;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.InfoAPIManagers.Pair;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
import com.herbron.moodl.CustomAdapters.CoinRecordListAdapter;
import com.herbron.moodl.CustomLayouts.CustomTabLayout;
@ -51,14 +40,11 @@ import com.herbron.moodl.CustomAdapters.ExchangeRecordListAdapter;
import com.herbron.moodl.CustomAdapters.RecordTransactionPageAdapter;
import com.herbron.moodl.MoodlBox;
import com.herbron.moodl.DataNotifiers.MoodlboxNotifierInterface;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
public class RecordTransactionActivity extends AppCompatActivity implements CurrencyInfoUpdateNotifierInterface, CryptocompareNotifierInterface {
@ -76,7 +62,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
private AutoCompleteTextView pair_autoCompleteTextView;
private CustomTabLayout tabLayout;
private ViewPager viewPager;
private CustomViewPager viewPager;
private RecordTransactionPageAdapter pageAdapter;
@ -186,7 +172,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
IconDownloaderTask iconDownloaderTask = new IconDownloaderTask();
iconDownloaderTask.execute();
coin_autoCompleteTextView.removeTextChangedListener(coinTextWatcher);
coin_autoCompleteTextView.setText(PlaceholderManager.getDenomination(currency.getName(), currency.getSymbol(), getBaseContext()));
coin_autoCompleteTextView.setText(PlaceholderUtils.getDenomination(currency.getName(), currency.getSymbol(), getBaseContext()));
coin_autoCompleteTextView.setEnabled(false);
if(globalTabLayouts.getVisibility() == View.GONE)
@ -241,12 +227,12 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
{
pair = pairList.get(index);
pair_autoCompleteTextView.setText(PlaceholderManager.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
pair_autoCompleteTextView.setText(PlaceholderUtils.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
pair_autoCompleteTextView.setEnabled(true);
((BuyFragment) pageAdapter.getItem(0)).updatePair(pair);
updatePairData();
//updatePairData();
found = true;
}
@ -255,6 +241,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
}
tabLayout.getTabAt(0).select();
((TextView) tabLayout.getTabAt(0).getCustomView()).setTextColor(getResources().getColor(R.color.white));
break;
case "s":
@ -289,12 +276,12 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
{
pair = pairList.get(index);
pair_autoCompleteTextView.setText(PlaceholderManager.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
pair_autoCompleteTextView.setText(PlaceholderUtils.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
pair_autoCompleteTextView.setEnabled(true);
((SellFragment) pageAdapter.getItem(1)).updatePair(pair);
updatePairData();
//updatePairData();
found = true;
}
@ -303,9 +290,11 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
}
tabLayout.getTabAt(1).select();
((TextView) tabLayout.getTabAt(1).getCustomView()).setTextColor(getResources().getColor(R.color.white));
break;
case "t":
tabLayout.getTabAt(2).select();
((TextView) tabLayout.getTabAt(2).getCustomView()).setTextColor(getResources().getColor(R.color.white));
break;
}
}
@ -330,6 +319,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
pageAdapter = new RecordTransactionPageAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(pageAdapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
viewPager.setPagingEnabled(false);
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
@ -430,7 +420,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
pair = (Pair) pair_autoCompleteTextView.getAdapter().getItem(position);
pair_autoCompleteTextView.setText(PlaceholderManager.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
pair_autoCompleteTextView.setText(PlaceholderUtils.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
toolbar.requestFocus();
hideSoftKeyboard(RecordTransactionActivity.this);
@ -561,7 +551,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
currency = (Currency) coin_autoCompleteTextView.getAdapter().getItem(position);
coin_autoCompleteTextView.setText(PlaceholderManager.getDenomination(currency.getName(), currency.getSymbol(), getBaseContext()));
coin_autoCompleteTextView.setText(PlaceholderUtils.getDenomination(currency.getName(), currency.getSymbol(), getBaseContext()));
toolbar.requestFocus();
hideSoftKeyboard(RecordTransactionActivity.this);
@ -680,7 +670,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
/*if(transactionId != -1)
{
setTitle(PlaceholderManager.getEditTransactionString(coin, getBaseContext()));
setTitle(PlaceholderUtils.getEditTransactionString(coin, getBaseContext()));
DatabaseManager databaseManager = new DatabaseManager(this);
Transaction transaction = databaseManager.getCurrencyTransactionById(transactionId);

View File

@ -10,7 +10,6 @@ import android.support.design.widget.TextInputEditText;
import android.support.v7.widget.AppCompatButton;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -28,7 +27,7 @@ import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
import com.herbron.moodl.DataManagers.InfoAPIManagers.Pair;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.text.SimpleDateFormat;
@ -64,7 +63,7 @@ public class BuyFragment extends CustomRecordFragment {
private List<String> symbolStrings;
private int transactionId;
private Transaction transaction;
private static Transaction transaction;
private boolean isAmountLastUpdated;
@ -276,6 +275,7 @@ public class BuyFragment extends CustomRecordFragment {
totalValueEditText.setText(String.valueOf(transaction.getAmount() * transaction.getPrice()));
fees_editText.setText(String.valueOf(transaction.getFees()));
note_editText.setText(transaction.getNote());
deductHoldingsSwitch.setChecked(transaction.isDeducted());
}
private void initializeViewElements()
@ -296,8 +296,8 @@ public class BuyFragment extends CustomRecordFragment {
});
feesCurrencySpinner = view.findViewById(R.id.feesCurrency_editText_buy);
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
currencyFeeAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
deductHoldingsSwitch = view.findViewById(R.id.deductHoldingsBuy);
@ -452,8 +452,8 @@ public class BuyFragment extends CustomRecordFragment {
private void updateAdapter()
{
symbolStrings = new ArrayList<>();
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getTo(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(fragmentPair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(fragmentPair.getTo(), getSecureContext()));
currencyFeeAdapter.clear();
currencyFeeAdapter.addAll(symbolStrings);
@ -523,15 +523,43 @@ public class BuyFragment extends CustomRecordFragment {
public void updatePair(Pair pair)
{
fragmentPair = pair;
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
symbolStrings = new ArrayList<>();
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(pair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
currencyFeeAdapter.addAll(symbolStrings);
currencyFeeAdapter.notifyDataSetChanged();
if(transaction != null)
{
if(transaction.getFeeCurrency().equals(fragmentPair.getFrom()))
{
if(transaction.getFeeFormat().equals("p"))
{
feesCurrencySpinner.setSelection(0);
}
else
{
feesCurrencySpinner.setSelection(1);
}
}
else
{
if(transaction.getFeeFormat().equals("p"))
{
feesCurrencySpinner.setSelection(2);
}
else
{
feesCurrencySpinner.setSelection(3);
}
}
}
}
@Override

View File

@ -27,7 +27,7 @@ import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
import com.herbron.moodl.DataManagers.InfoAPIManagers.Pair;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.text.SimpleDateFormat;
@ -63,7 +63,7 @@ public class SellFragment extends CustomRecordFragment {
private List<String> symbolStrings;
private int transactionId;
private Transaction transaction;
private static Transaction transaction;
private boolean isAmountLastUpdated;
@ -133,6 +133,105 @@ public class SellFragment extends CustomRecordFragment {
}
};
private TextWatcher feesTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
totalValueEditText.removeTextChangedListener(totalValueTextWatcher);
amoutEditText.removeTextChangedListener(amountTextWatcher);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if((isFieldCorrectlyFilled(amoutEditText, false) || isFieldCorrectlyFilled(totalValueEditText, false)) && isFieldCorrectlyFilled(sellPriceEditText, false))
{
double amount = Double.parseDouble(amoutEditText.getText().toString());
double purchasePrice = Double.parseDouble(sellPriceEditText.getText().toString());
double fees;
double totalValue = Double.parseDouble(totalValueEditText.getText().toString());
String feeCurrency;
if(isAmountLastUpdated)
{
totalValue = amount * purchasePrice;
}
else
{
amount = totalValue / purchasePrice;
}
if(fees_editText.getText().toString().equals("0") || (start == 0 && before == 1 && count == 0))
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(amount * purchasePrice));
}
else
{
amoutEditText.setText(String.valueOf(totalValue / purchasePrice));
}
}
else
{
if(feesCurrencySpinner.getSelectedItemPosition() < 2)
{
feeCurrency = fragmentPair.getFrom();
}
else
{
feeCurrency = fragmentPair.getTo();
}
fees = getFees(feeCurrency, amount, purchasePrice);
if(feesCurrencySpinner.getSelectedItemPosition() % 2 == 0)
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - fees));
}
else
{
amoutEditText.setText(String.valueOf(amount + (fees / purchasePrice)));
}
}
else
{
if(fragmentCurrency.getSymbol().equals(feeCurrency))
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - (fees * purchasePrice)));
}
else
{
amoutEditText.setText(String.valueOf((totalValue / purchasePrice) + fees));
}
}
else
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - fees));
}
else
{
amoutEditText.setText(String.valueOf((totalValue + fees) / purchasePrice));
}
}
}
}
}
}
@Override
public void afterTextChanged(Editable s) {
totalValueEditText.addTextChangedListener(totalValueTextWatcher);
amoutEditText.addTextChangedListener(amountTextWatcher);
}
};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -153,10 +252,8 @@ public class SellFragment extends CustomRecordFragment {
private void initializeViewElements()
{
totalValueEditText = view.findViewById(R.id.totalValue_editText_sell);
totalValueEditText.addTextChangedListener(totalValueTextWatcher);
amoutEditText = view.findViewById(R.id.amount_editText_sell);
amoutEditText.addTextChangedListener(amountTextWatcher);
sellPriceEditText = view.findViewById(R.id.sellPrice_editText);
sellDateEditText = view.findViewById(R.id.sellDate_editText);
@ -171,7 +268,7 @@ public class SellFragment extends CustomRecordFragment {
feesCurrencySpinner = view.findViewById(R.id.feesCurrency_editText_sell);
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
currencyFeeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
if(fragmentPair != null)
@ -252,108 +349,19 @@ public class SellFragment extends CustomRecordFragment {
});
fees_editText = view.findViewById(R.id.fees_editText_sell);
fees_editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
totalValueEditText.removeTextChangedListener(totalValueTextWatcher);
amoutEditText.removeTextChangedListener(amountTextWatcher);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if((isFieldCorrectlyFilled(amoutEditText, false) || isFieldCorrectlyFilled(totalValueEditText, false)) && isFieldCorrectlyFilled(sellPriceEditText, false))
{
double amount = Double.parseDouble(amoutEditText.getText().toString());
double purchasePrice = Double.parseDouble(sellPriceEditText.getText().toString());
double fees;
double totalValue = Double.parseDouble(totalValueEditText.getText().toString());
String feeCurrency;
if(isAmountLastUpdated)
{
totalValue = amount * purchasePrice;
}
else
{
amount = totalValue / purchasePrice;
}
if(fees_editText.getText().toString().equals("0") || (start == 0 && before == 1 && count == 0))
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(amount * purchasePrice));
}
else
{
amoutEditText.setText(String.valueOf(totalValue / purchasePrice));
}
}
else
{
if(feesCurrencySpinner.getSelectedItemPosition() < 2)
{
feeCurrency = fragmentPair.getFrom();
}
else
{
feeCurrency = fragmentPair.getTo();
}
fees = getFees(feeCurrency, amount, purchasePrice);
if(feesCurrencySpinner.getSelectedItemPosition() % 2 == 0)
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - fees));
}
else
{
amoutEditText.setText(String.valueOf(amount + (fees / purchasePrice)));
}
}
else
{
if(fragmentCurrency.getSymbol().equals(feeCurrency))
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - (fees * purchasePrice)));
}
else
{
amoutEditText.setText(String.valueOf((totalValue / purchasePrice) + fees));
}
}
else
{
if(isAmountLastUpdated)
{
totalValueEditText.setText(String.valueOf(totalValue - fees));
}
else
{
amoutEditText.setText(String.valueOf((totalValue + fees) / purchasePrice));
}
}
}
}
}
}
@Override
public void afterTextChanged(Editable s) {
totalValueEditText.addTextChangedListener(totalValueTextWatcher);
amoutEditText.addTextChangedListener(amountTextWatcher);
}
});
note_editText = view.findViewById(R.id.note_editText_sell);
checkCallingIntent();
setupTextWatchers();
}
private void setupTextWatchers()
{
totalValueEditText.addTextChangedListener(totalValueTextWatcher);
amoutEditText.addTextChangedListener(amountTextWatcher);
fees_editText.addTextChangedListener(feesTextWatcher);
}
private double getFees(String feeCurrency, double amount, double purchasedPrice)
@ -413,8 +421,8 @@ public class SellFragment extends CustomRecordFragment {
private void updateAdapter()
{
symbolStrings = new ArrayList<>();
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getTo(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(fragmentPair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(fragmentPair.getTo(), getSecureContext()));
currencyFeeAdapter.clear();
currencyFeeAdapter.addAll(symbolStrings);
@ -514,15 +522,43 @@ public class SellFragment extends CustomRecordFragment {
public void updatePair(Pair pair)
{
fragmentPair = pair;
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
symbolStrings = new ArrayList<>();
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(pair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderUtils.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
currencyFeeAdapter.addAll(symbolStrings);
currencyFeeAdapter.notifyDataSetChanged();
if(transaction != null)
{
if(transaction.getFeeCurrency().equals(fragmentPair.getFrom()))
{
if(transaction.getFeeFormat().equals("p"))
{
feesCurrencySpinner.setSelection(0);
}
else
{
feesCurrencySpinner.setSelection(1);
}
}
else
{
if(transaction.getFeeFormat().equals("p"))
{
feesCurrencySpinner.setSelection(2);
}
else
{
feesCurrencySpinner.setSelection(3);
}
}
}
}
@Override

View File

@ -262,15 +262,15 @@ public class TransferFragment extends CustomRecordFragment {
private void setupSpinnesr()
{
ArrayAdapter<String> fromAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.from_transfer_options_string_array));
fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
fromAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
fromSpinner.setAdapter(fromAdapter);
ArrayAdapter<String> toAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.to_transfer_options_string_array));
toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
toAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
toSpinner.setAdapter(toAdapter);
ArrayAdapter<String> feeAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.fees_options));
feeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feeSpinner.setAdapter(feeAdapter);
fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

View File

@ -44,6 +44,7 @@ import com.applandeo.listeners.OnSelectFileListener;
import com.herbron.moodl.BuildConfig;
import com.herbron.moodl.DataManagers.DataCrypter;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.FingerprintToolkit.FingerprintDialogFragment;
import com.herbron.moodl.FingerprintToolkit.FingerprintHandler;
import com.herbron.moodl.MoodlBox;
@ -782,6 +783,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
}
}
PreferencesManager preferencesManager = new PreferencesManager(getContext());
preferencesManager.setMustUpdateSummary(true);
}
else
{

View File

@ -18,6 +18,9 @@ import com.herbron.moodl.R;
import java.util.ArrayList;
import static com.herbron.moodl.DataManagers.DatabaseManager.BINANCE_TYPE;
import static com.herbron.moodl.DataManagers.DatabaseManager.HITBTC_TYPE;
public class ExchangeDescriptionListAdapter extends ArrayAdapter<Exchange> {
private Context context;
@ -42,10 +45,21 @@ public class ExchangeDescriptionListAdapter extends ArrayAdapter<Exchange> {
TextView exchangeNameTextView = convertView.findViewById(R.id.exchange_name);
TextView exchangeDescriptionTextView = convertView.findViewById(R.id.exchange_description);
ImageView accountOffImageView = convertView.findViewById(R.id.exchange_account_off_imageView);
ImageView exchangeImageView = convertView.findViewById(R.id.exchange_icon_imageView);
exchangeNameTextView.setText(exchange.getName());
exchangeDescriptionTextView.setText(exchange.getDescription());
switch (exchange.getType())
{
case BINANCE_TYPE:
exchangeImageView.setImageDrawable(context.getResources().getDrawable(R.drawable.exchange_logo_binance));
break;
case HITBTC_TYPE:
exchangeImageView.setImageDrawable(context.getResources().getDrawable(R.drawable.exchange_logo_hitbtc));
break;
}
if(!exchange.isEnabled())
{
accountOffImageView.setVisibility(View.VISIBLE);

View File

@ -11,7 +11,7 @@ import android.widget.Filter;
import android.widget.TextView;
import com.herbron.moodl.DataManagers.InfoAPIManagers.Pair;
import com.herbron.moodl.PlaceholderManager;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.R;
import java.util.ArrayList;
@ -68,7 +68,7 @@ public class PairRecordListAdapter extends ArrayAdapter<Pair> {
TextView pairTxtView = convertView.findViewById(R.id.textView);
pairTxtView.setTextColor(getContext().getResources().getColor(android.R.color.tab_indicator_text));
pairTxtView.setText(PlaceholderManager.getPairString(pair.getFrom(), pair.getTo(), getContext()));
pairTxtView.setText(PlaceholderUtils.getPairString(pair.getFrom(), pair.getTo(), getContext()));
return convertView;
}

View File

@ -1,65 +0,0 @@
package com.herbron.moodl.CustomAdapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.herbron.moodl.DataManagers.CurrencyData.Trade;
import com.herbron.moodl.R;
import java.util.ArrayList;
import static com.herbron.moodl.MoodlBox.getDateFromTimestamp;
/**
* Created by Guitoune on 24/04/2018.
*/
public class TradeListAdapter extends ArrayAdapter<Trade> {
private Context context;
public TradeListAdapter(Context context, ArrayList<Trade> trades)
{
super(context, android.R.layout.simple_list_item_1, trades);
this.context = context;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
Trade trade = getItem(position);
if(convertView == null)
{
convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_trade_row, parent, false);
}
TextView amountTxtView = convertView.findViewById(R.id.amountPurchased);
TextView purchasedPrice = convertView.findViewById(R.id.purchasedPrice);
TextView tradePair = convertView.findViewById(R.id.pair);
TextView dateTxtView = convertView.findViewById(R.id.tradeDate);
View tradeIndicator = convertView.findViewById(R.id.tradeIndicator);
amountTxtView.setText(String.valueOf(trade.getQty()));
purchasedPrice.setText(trade.getPrice());
dateTxtView.setText(getDateFromTimestamp(trade.getTime()));
tradePair.setText(trade.getSymbol() + "/" + trade.getPairSymbol());
if(trade.isBuyer())
{
tradeIndicator.setBackgroundColor(context.getColor(R.color.green));
}
else
{
tradeIndicator.setBackgroundColor(context.getColor(R.color.red));
}
return convertView;
}
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -14,10 +15,13 @@ import android.widget.TextView;
import com.daimajia.swipe.SwipeLayout;
import com.herbron.moodl.Activities.RecordTransactionActivity;
import com.herbron.moodl.DataManagers.CurrencyData.Trade;
import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.R;
import com.herbron.moodl.Utils.PlaceholderUtils;
import com.herbron.moodl.Utils.TransferUtils;
import java.util.ArrayList;
@ -26,15 +30,17 @@ import static com.herbron.moodl.MoodlBox.getDateFromTimestamp;
import static com.herbron.moodl.MoodlBox.numberConformer;
import static java.lang.Math.abs;
import static com.herbron.moodl.Utils.TransferUtils.isBalanceRelated;
/**
* Created by Guitoune on 24/04/2018.
*/
public class TransactionListAdapter extends ArrayAdapter<Transaction> {
public class TransactionListAdapter extends ArrayAdapter<Object> {
private Context context;
public TransactionListAdapter(Context context, ArrayList<Transaction> transactions)
public TransactionListAdapter(Context context, ArrayList<Object> transactions)
{
super(context, android.R.layout.simple_list_item_1, transactions);
this.context = context;
@ -43,19 +49,58 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
final Transaction transaction = getItem(position);
if(convertView == null)
if(getItem(position) instanceof Transaction)
{
convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_transaction_row, parent, false);
return generateTransactionLayout(position, parent);
}
else
{
return generateTradeLayout(position, parent);
}
}
private View generateTradeLayout(int position, ViewGroup parent)
{
Trade trade = (Trade) getItem(position);
View convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_trade_row, parent, false);
TextView amountTxtView = convertView.findViewById(R.id.amountPurchased);
TextView valueTxtView = convertView.findViewById(R.id.puchasedValue);
TextView dateTxtView = convertView.findViewById(R.id.purchaseDate);
TextView purchasedPrice = convertView.findViewById(R.id.purchasePrice);
TextView tradePair = convertView.findViewById(R.id.pair);
TextView dateTxtView = convertView.findViewById(R.id.tradeDate);
View tradeIndicator = convertView.findViewById(R.id.tradeIndicator);
amountTxtView.setText(String.valueOf(trade.getQty()));
purchasedPrice.setText(trade.getPrice());
dateTxtView.setText(getDateFromTimestamp(trade.getTime()));
tradePair.setText(trade.getSymbol() + "/" + trade.getPairSymbol());
if(trade.isBuyer())
{
tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.green));
}
else
{
tradeIndicator.setBackgroundColor(context.getResources().getColor(R.color.red));
}
return convertView;
}
private View generateTransactionLayout(int position, ViewGroup parent)
{
final Transaction transaction = (Transaction) getItem(position);
View convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_transaction_row, parent, false);
TextView topLeftTextView = convertView.findViewById(R.id.transactionTLTV);
TextView bottomLeftTextView = convertView.findViewById(R.id.transactionBLTV);
TextView dateTxtView = convertView.findViewById(R.id.transactionDateTextView);
TextView amountTxtView = convertView.findViewById(R.id.transactionAmountTextView);
amountTxtView.setText(String.valueOf(transaction.getAmount()));
valueTxtView.setText(numberConformer(transaction.getPrice() * transaction.getAmount()));
dateTxtView.setText(getDateFromTimestamp(transaction.getTimestamp()));
LinearLayout deleteLayout = convertView.findViewById(R.id.deleteTransactionLayout);
@ -88,11 +133,56 @@ public class TransactionListAdapter extends ArrayAdapter<Transaction> {
}
});
View transactionIndicator = convertView.findViewById(R.id.transactionIndicator);
switch (transaction.getType())
{
case "b":
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.increaseCandle));
topLeftTextView.setText(transaction.getSource());
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymPair(), transaction.getSymbol(), context));
break;
case "s":
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.decreaseCandle));
topLeftTextView.setText(transaction.getSource());
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymbol(), transaction.getSymPair(), context));
break;
case "t":
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.blue));
if(isBalanceRelated(transaction.getDestination()) && isBalanceRelated(transaction.getSource()))
{
topLeftTextView.setText(context.getString(R.string.transferText));
bottomLeftTextView.setText(PlaceholderUtils.getFromToString(TransferUtils.getLabelFor(context, transaction.getSource()), TransferUtils.getLabelFor(context, transaction.getDestination()), context));
}
else
{
if(isBalanceRelated(transaction.getDestination()))
{
topLeftTextView.setText(context.getString(R.string.depositText));
bottomLeftTextView.setText(PlaceholderUtils.getFromString(TransferUtils.getLabelFor(context, transaction.getSource()), context));
}
else
{
if(isBalanceRelated(transaction.getSource()))
{
topLeftTextView.setText(context.getString(R.string.withdrawText));
bottomLeftTextView.setText(PlaceholderUtils.getToString(TransferUtils.getLabelFor(context, transaction.getDestination()), context));
}
}
}
break;
}
setupSwipeView(convertView);
return convertView;
}
private void setupSwipeView(View view)
{
SwipeLayout swipeLayout = view.findViewById(R.id.swipeLayout);

View File

@ -0,0 +1,51 @@
package com.herbron.moodl.CustomLayouts;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.design.widget.TextInputEditText;
import android.text.TextPaint;
import android.util.AttributeSet;
public class TextInputEditTextSuffix extends TextInputEditText {
private TextPaint textPaint = new TextPaint();
private String suffix = "";
public TextInputEditTextSuffix(Context context) {
super(context);
}
public TextInputEditTextSuffix(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TextInputEditTextSuffix(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(!getText().toString().equals(""))
{
int suffixXPosition = (int) textPaint.measureText(getText().toString() + getPaddingLeft());
canvas.drawText(suffix, Math.max(suffixXPosition, 0), getBaseline(), textPaint);
}
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
textPaint.setColor(getCurrentTextColor());
textPaint.setTextSize(getTextSize());
textPaint.setTextAlign(Paint.Align.LEFT);
}
public void setSuffix(String suffix)
{
this.suffix = suffix;
}
}

View File

@ -1,6 +1,7 @@
package com.herbron.moodl.DataManagers;
import com.herbron.moodl.Activities.HomeActivity;
import com.herbron.moodl.DataManagers.CurrencyData.Trade;
import com.herbron.moodl.DataNotifiers.BinanceUpdateNotifierInterface;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
@ -29,7 +30,6 @@ public class BalanceManager implements BinanceUpdateNotifierInterface, HitBTCUpd
private int balanceCounter;
//NEW IMPLEMENTATION
private List<HitBtcManager> hitBtcManagers;
private List<BinanceManager> binanceManagers;
@ -87,7 +87,7 @@ public class BalanceManager implements BinanceUpdateNotifierInterface, HitBTCUpd
for(int i = 0; i < binanceManagers.size(); i++)
{
final BinanceManager binanceManager = binanceManagers.get(i);
BinanceManager binanceManager = binanceManagers.get(i);
binanceManager.addListener(this);
binanceManager.updateBalance();
}
@ -169,7 +169,7 @@ public class BalanceManager implements BinanceUpdateNotifierInterface, HitBTCUpd
}
@Override
public void onBinanceTradesUpdated() {
public void onBinanceTradesUpdated(List<Trade> trades) {
}

View File

@ -4,17 +4,27 @@ import android.app.Activity;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnticipateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@ -27,9 +37,11 @@ import com.github.mikephil.charting.data.LineDataSet;
import com.herbron.moodl.Activities.CurrencyDetailsActivity;
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.DataNotifiers.MoodlboxNotifierInterface;
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;
@ -37,6 +49,7 @@ import java.util.List;
import static com.herbron.moodl.MoodlBox.collapseH;
import static com.herbron.moodl.MoodlBox.expandH;
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
import static com.herbron.moodl.MoodlBox.numberConformer;
/**
@ -45,8 +58,11 @@ import static com.herbron.moodl.MoodlBox.numberConformer;
public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNotifierInterface {
private static final int FADE_IN_DURATION = 300;
private Currency currency;
private Activity parentActivity;
private Context context;
private OnClickListener detailsClickListener = new OnClickListener() {
@Override
@ -68,6 +84,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
public CurrencyCardview(@NonNull Context context) {
super(context);
this.context = context;
}
public CurrencyCardview(@NonNull final Context context, final Currency currency, final Activity activity)
@ -78,6 +95,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
this.currency = currency;
this.parentActivity = activity;
this.context = context;
LayoutInflater.from(context).inflate(R.layout.cardview_watchlist, this, true);
@ -85,32 +103,9 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
setupCardView();
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
PreferencesManager preferencesManager = new PreferencesManager(context);
setOnClickListeners();
if (view.findViewById(R.id.collapsableLayout).getVisibility() == View.VISIBLE) {
collapseH(view.findViewById(R.id.collapsableLayout));
} else {
view.findViewById(R.id.linearLayoutSubCharts).setVisibility(View.GONE);
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.VISIBLE);
expandH(view.findViewById(R.id.collapsableLayout));
if (currency.getHistoryMinutes() == null) {
currency.updateHistoryMinutes(context, preferencesManager.getDefaultCurrency());
}
else
{
expandH(view.findViewById(R.id.collapsableLayout));
view.findViewById(R.id.progressBarLinechartWatchlist).setVisibility(View.GONE);
view.findViewById(R.id.linearLayoutSubCharts).setVisibility(View.VISIBLE);
}
}
}
});
updateCardViewInfos(currency);
updateCardviewInfos();
findViewById(R.id.deleteCardWatchlist).setOnClickListener(new OnClickListener() {
@Override
@ -121,13 +116,12 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
}
});
findViewById(R.id.linearLayoutSubCharts).setOnClickListener(detailsClickListener);
findViewById(R.id.LineChartView).setOnClickListener(detailsClickListener);
updateColor();
updateColor(currency);
startIconUpdater();
}
public CurrencyCardview(@NonNull final Context context, final Currency currency, Activity activity, float totalValue, boolean isBalanceHidden)
public CurrencyCardview(@NonNull final Context context, final Currency currency, Activity activity, boolean isBalanceHidden)
{
super(context);
@ -135,6 +129,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
this.currency = currency;
this.parentActivity = activity;
this.context = context;
LayoutInflater.from(context).inflate(R.layout.cardview_currency, this, true);
@ -142,6 +137,74 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
setupCardView();
setOnClickListeners();
updateCardviewInfos();
updateColor();
startIconUpdater();
}
private void startIconUpdater()
{
IconDownloader iconDownloader = new IconDownloader();
iconDownloader.execute(context, currency);
iconDownloader.setOnBitmapDownloadedListener(new IconDownloader.OnBitmapDownloadedListener() {
@Override
public void onDownloaded(Bitmap icon) {
currency.setIcon(icon);
currency.setChartColor(getIconDominantColor(context, icon));
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
updateCurrencyColorRelatedLayouts();
}
});
}
});
}
private void updateCurrencyColorRelatedLayouts()
{
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new AccelerateInterpolator());
fadeIn.setDuration(FADE_IN_DURATION);
ImageView currencyIconImageView = findViewById(R.id.currencyIcon);
currencyIconImageView.setImageBitmap(currency.getIcon());
currencyIconImageView.startAnimation(fadeIn);
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
arrowDrawable.mutate();
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
arrowDrawable.invalidateSelf();
Drawable progressDrawable = ((ProgressBar) findViewById(R.id.progressBarLinechart)).getIndeterminateDrawable();
progressDrawable.mutate();
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressDrawable.invalidateSelf();
if(findViewById(R.id.currencyPortfolioDominance) != null)
{
Drawable progressBarDrawable = ((ProgressBar) findViewById(R.id.currencyPortfolioDominance)).getProgressDrawable();
progressBarDrawable.mutate();
progressBarDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressBarDrawable.invalidateSelf();
}
LineChart lineChart = findViewById(R.id.LineChartView);
if(currency.getHistoryMinutes() != null)
{
lineChart.setData(generateData());
lineChart.invalidate();
}
}
private void setOnClickListeners()
{
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
@ -151,7 +214,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
collapseH(view.findViewById(R.id.collapsableLayout));
} else {
view.findViewById(R.id.linearLayoutSubCharts).setVisibility(View.GONE);
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.VISIBLE);
view.findViewById(R.id.progressBarLinechart).setVisibility(View.VISIBLE);
expandH(view.findViewById(R.id.collapsableLayout));
if (currency.getHistoryMinutes() == null) {
@ -160,19 +223,16 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
else
{
expandH(view.findViewById(R.id.collapsableLayout));
view.findViewById(R.id.progressBarLinechartSummary).setVisibility(View.GONE);
view.findViewById(R.id.progressBarLinechart).setVisibility(View.GONE);
view.findViewById(R.id.linearLayoutSubCharts).setVisibility(View.VISIBLE);
}
}
}
});
updateCardViewInfos(currency, totalValue, isBalanceHidden);
findViewById(R.id.linearLayoutSubCharts).setOnClickListener(detailsClickListener);
findViewById(R.id.LineChartView).setOnClickListener(detailsClickListener);
updateColor(currency);
}
public Currency getCurrency()
@ -213,84 +273,36 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
lineChart.getLegend().setEnabled(false);
lineChart.getXAxis().setEnabled(false);
lineChart.setViewPortOffsets(0, 0, 0, 0);
lineChart.setData(generateData(currency));
lineChart.setData(generateData());
}
private void updateCardViewInfos(Currency currency)
private void updateCardviewInfos()
{
((TextView) findViewById(R.id.currencyFluctuationTextView))
.setText(PlaceholderManager.getValueParenthesisString(numberConformer(currency.getDayFluctuation()), getContext()));
.setText(PlaceholderUtils.getValueParenthesisString(numberConformer(currency.getDayFluctuation()), getContext()));
((TextView) findViewById(R.id.currencyValueTextView))
.setText(PlaceholderManager.getValueString(numberConformer(currency.getValue()), getContext()));
.setText(PlaceholderUtils.getValueString(numberConformer(currency.getValue()), getContext()));
((ImageView) findViewById(R.id.currencyIcon))
.setImageBitmap(currency.getIcon());
((TextView) findViewById(R.id.currencyNameTextView))
.setText(currency.getName());
((TextView) findViewById(R.id.currencySymbolTextView))
.setText(PlaceholderManager.getSymbolString(currency.getSymbol(), getContext()));
.setText(PlaceholderUtils.getSymbolString(currency.getSymbol(), getContext()));
((TextView) findViewById(R.id.currencyFluctuationPercentageTextView))
.setText(PlaceholderManager.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
if(arrowDrawable != null)
{
arrowDrawable.mutate();
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
arrowDrawable.invalidateSelf();
}
Drawable progressDrawable = ((ProgressBar) findViewById(R.id.progressBarLinechartWatchlist)).getIndeterminateDrawable();
if(progressDrawable != null)
{
progressDrawable.mutate();
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressDrawable.invalidateSelf();
}
.setText(PlaceholderUtils.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
}
private void updateCardViewInfos(Currency currency, float totalValue, boolean isBalanceHidden)
public void updateOwnedValues(float totalValue, boolean isBalanceHidden)
{
double value = currency.getValue() * currency.getBalance();
double percentage = value / totalValue * 100;
((TextView) findViewById(R.id.currencyValueOwnedTextView))
.setText(PlaceholderManager.getValueParenthesisString(numberConformer(currency.getValue() * currency.getBalance()), getContext()));
((TextView) findViewById(R.id.currencyFluctuationTextView))
.setText(PlaceholderManager.getValueParenthesisString(numberConformer(currency.getDayFluctuation()), getContext()));
((TextView) findViewById(R.id.currencyValueTextView))
.setText(PlaceholderManager.getValueString(numberConformer(currency.getValue()), getContext()));
((ImageView) findViewById(R.id.currencyIcon))
.setImageBitmap(currency.getIcon());
((TextView) findViewById(R.id.currencyNameTextView))
.setText(currency.getName());
((TextView) findViewById(R.id.currencySymbolTextView))
.setText(PlaceholderManager.getSymbolString(currency.getSymbol(), getContext()));
.setText(PlaceholderUtils.getValueParenthesisString(numberConformer(currency.getValue() * currency.getBalance()), getContext()));
((TextView) findViewById(R.id.currencyOwnedTextView))
.setText(PlaceholderManager.getBalanceString(numberConformer(currency.getBalance()), currency.getSymbol(), getContext()));
((TextView) findViewById(R.id.currencyFluctuationPercentageTextView))
.setText(PlaceholderManager.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
arrowDrawable.mutate();
arrowDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
arrowDrawable.invalidateSelf();
Drawable progressDrawable = ((ProgressBar) findViewById(R.id.progressBarLinechartSummary)).getIndeterminateDrawable();
progressDrawable.mutate();
progressDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressDrawable.invalidateSelf();
Drawable progressBarDrawable = ((ProgressBar) findViewById(R.id.currencyPortfolioDominance)).getProgressDrawable();
progressBarDrawable.mutate();
progressBarDrawable.setColorFilter(new PorterDuffColorFilter(currency.getChartColor(), PorterDuff.Mode.SRC_IN));
progressBarDrawable.invalidateSelf();
.setText(PlaceholderUtils.getBalanceString(numberConformer(currency.getBalance()), currency.getSymbol(), getContext()));
((ProgressBar) findViewById(R.id.currencyPortfolioDominance)).setProgress((int) Math.round(percentage));
((TextView) findViewById(R.id.percentageOwnedTextView)).setText(PlaceholderManager.getPercentageString(numberConformer(percentage), getContext()));
((TextView) findViewById(R.id.percentageOwnedTextView)).setText(PlaceholderUtils.getPercentageString(numberConformer(percentage), getContext()));
if(isBalanceHidden)
{
@ -306,7 +318,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
}
}
private LineData generateData(Currency currency)
private LineData generateData()
{
LineDataSet dataSet;
List<CurrencyDataChart> dataChartList = currency.getHistoryMinutes();
@ -333,7 +345,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
return new LineData(dataSet);
}
private void updateColor(Currency currency)
private void updateColor()
{
if(currency.getDayFluctuationPercentage() >= 0)
{
@ -372,18 +384,9 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
@Override
public void onHistoryDataUpdated() {
View progressWatchlistView = findViewById(R.id.progressBarLinechartWatchlist);
View progressSummaryView = findViewById(R.id.progressBarLinechartSummary);
View progressView = findViewById(R.id.progressBarLinechart);
if(progressWatchlistView != null)
{
progressWatchlistView.setVisibility(View.GONE);
}
if(progressSummaryView != null)
{
progressSummaryView.setVisibility(View.GONE);
}
progressView.setVisibility(View.GONE);
findViewById(R.id.linearLayoutSubCharts).setVisibility(View.VISIBLE);
@ -397,4 +400,46 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
public void onPriceUpdated(Currency currency) {
}
private static class IconDownloader extends AsyncTask<Object, Integer, Void> implements MoodlboxNotifierInterface
{
private Bitmap icon = null;
private OnBitmapDownloadedListener onBitmapDownloadedListener;
public Bitmap getIcon()
{
return icon;
}
public void setOnBitmapDownloadedListener(OnBitmapDownloadedListener onBitmapDownloadedListener) {
this.onBitmapDownloadedListener = onBitmapDownloadedListener;
}
@Override
protected Void doInBackground(Object... objects) {
Context context = (Context) objects[0];
Currency currency = (Currency) objects[1];
CryptocompareApiManager cryptocompareApiManager = CryptocompareApiManager.getInstance(context);
String iconUrl = MoodlBox.getIconUrl(currency.getSymbol(), cryptocompareApiManager);
if(iconUrl != null)
{
MoodlBox.getBitmapFromURL(iconUrl, currency.getSymbol(), context.getResources(), context, this);
}
return null;
}
@Override
public void onBitmapDownloaded(Bitmap bitmap) {
icon = bitmap;
onBitmapDownloadedListener.onDownloaded(bitmap);
}
public interface OnBitmapDownloadedListener {
void onDownloaded(Bitmap icon);
}
}
}

View File

@ -73,10 +73,12 @@ public class DataCrypter {
IvParameterSpec ivParameterSpec = new IvParameterSpec(context.getString(R.string.ivKey).getBytes("UTF-8"));
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, aesKey, ivParameterSpec);
cipher.init(Cipher.DECRYPT_MODE, aesKey, ivParameterSpec);
byte[] dataBytes = Base64.decode(data, Base64.DEFAULT);
decryptedData = new String(dataBytes, StandardCharsets.UTF_8);
byte[] decryptedBytes = cipher.doFinal(data.getBytes("UTF-8"));
//byte[] dataBytes = Base64.decode(data, Base64.DEFAULT);
decryptedData = new String(decryptedBytes, StandardCharsets.UTF_8);
} catch(NoSuchPaddingException | NoSuchAlgorithmException
| InvalidKeyException | UnsupportedEncodingException

View File

@ -26,6 +26,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static com.herbron.moodl.Utils.TransferUtils.isBalanceRelated;
/**
* Created by Guitoune on 14/01/2018.
*/
@ -497,8 +499,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
Log.d("moodl", "Error while inserting transaction " + e.getMessage());
}
Log.d("mood", "Raw " + rawValues.toString());
db.insert(TABLE_MANUAL_TRANSACTIONS, null, values);
db.close();
}
@ -603,6 +603,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
if(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1)
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
, -(resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
* resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
+ resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES)))));
}
break;
case "s":
if(symbol.equals(feeSym))
@ -615,6 +623,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
if(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1)
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
* resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
- resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES))));
}
break;
case "t":
if(isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))) && isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))))
@ -624,7 +640,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
if(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1)
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)) - resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES))));
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
else
{
@ -638,14 +654,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
if(isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))))
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)) - resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES))));
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
else
{
if(isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))))
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)) - resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES))));
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
}
}
@ -674,12 +690,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
return currencyList;
}
private boolean isBalanceRelated(String str)
{
Set<String> set = new HashSet<>(Arrays.asList(TransferFragment.EXCHANGE_CODE, TransferFragment.WALLET_CODE));
return set.contains(str);
}
public Transaction getCurrencyTransactionById(int id)
{
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_TRANSACTIONS + " WHERE " + KEY_TRANSACTION_ID + "='" + id + "'";
@ -690,15 +700,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
if(resultatList.moveToFirst())
{
boolean deduct = false;
if(!resultatList.isNull(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)))
{
deduct = resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1;
}
Log.d("moodl", "> " + resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)));
transaction = new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
@ -712,11 +713,9 @@ public class DatabaseManager extends SQLiteOpenHelper{
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_FORMAT))
, deduct);
, resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1);
}
Log.d("moodl", "> " + DatabaseUtils.dumpCurrentRowToString(resultatList));
resultatList.close();
db.close();
@ -726,7 +725,8 @@ public class DatabaseManager extends SQLiteOpenHelper{
public ArrayList<Transaction> getCurrencyTransactionsForSymbol(String symbol)
{
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_TRANSACTIONS + " WHERE " + KEY_TRANSACTION_SYMBOL + "='" + symbol.toUpperCase() + "'";
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_TRANSACTIONS + " WHERE " + KEY_TRANSACTION_SYMBOL + "='" + symbol.toUpperCase()
+ "' OR " + KEY_TRANSACTION_PAIR + "='" + symbol.toUpperCase() + "' AND " + KEY_TRANSACTION_DEDUCT + "=1";
SQLiteDatabase db = this.getWritableDatabase();
Cursor resultatList = db.rawQuery(searchQuerry, null);
@ -734,16 +734,38 @@ public class DatabaseManager extends SQLiteOpenHelper{
while (resultatList.moveToNext())
{
boolean deduct = false;
String type = "t";
String pair = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
String sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL));
if(!resultatList.isNull(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)))
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)).equals(symbol.toUpperCase()))
{
deduct = resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1;
type = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE));
}
else
{
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)).equals("s"))
{
type = "b";
pair = sym;
sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
}
else
{
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)).equals("b"))
{
type = "s";
pair = sym;
sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
}
}
}
transactionList.add(new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
, sym
, pair
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
, resultatList.getLong(resultatList.getColumnIndex(KEY_TRANSACTION_DATE))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
@ -752,9 +774,9 @@ public class DatabaseManager extends SQLiteOpenHelper{
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_CURRENCY))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE))
, type
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_FORMAT))
, deduct));
, resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1));
}
resultatList.close();

View File

@ -101,7 +101,7 @@ public class BinanceManager extends Exchange {
for(BinanceUpdateNotifierInterface binanceUpdateNotifierInterface : binanceUpdateNotifierInterfaceList)
{
binanceUpdateNotifierInterface.onBinanceTradesUpdated();
binanceUpdateNotifierInterface.onBinanceTradesUpdated(trades);
}
}

View File

@ -203,6 +203,11 @@ public class CoinmarketCapAPIManager {
}
}
public List<Currency> getTotalListing()
{
return currencyTickerList;
}
public void updateTopCurrencies(final String toSymbol)
{
String requestString = topCurrenciesUrl + toSymbol;

View File

@ -1,8 +1,12 @@
package com.herbron.moodl.DataNotifiers;
import com.herbron.moodl.DataManagers.CurrencyData.Trade;
import java.util.List;
public interface BinanceUpdateNotifierInterface {
void onBinanceTradesUpdated();
void onBinanceTradesUpdated(List<Trade> trades);
void onBinanceBalanceUpdateSuccess();

View File

@ -4,9 +4,9 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.herbron.moodl.Activities.DetailsActivityFragments.Charts;
import com.herbron.moodl.Activities.DetailsActivityFragments.Informations;
import com.herbron.moodl.Activities.DetailsActivityFragments.Transactions;
import com.herbron.moodl.Activities.DetailsActivityFragments.ChartsFragment;
import com.herbron.moodl.Activities.DetailsActivityFragments.InformationFragment;
import com.herbron.moodl.Activities.DetailsActivityFragments.TransactionsFragment;
/**
* Created by Tiji on 13/05/2018.
@ -27,11 +27,11 @@ public class DetailsActivityPagerAdapter extends FragmentStatePagerAdapter {
switch (position)
{
case 0:
return new Charts();
return new ChartsFragment();
case 1:
return new Informations();
return new InformationFragment();
case 2:
return new Transactions();
return new TransactionsFragment();
default:
return null;
}

View File

@ -4,8 +4,10 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.View;
@ -208,36 +210,51 @@ public class MoodlBox {
public static void getBitmapFromURL(String src, String symbol, Resources resources, Context context, MoodlboxNotifierInterface callBack)
{
String size = src.substring(src.lastIndexOf("=") + 1, src.length());
String filepath = context.getCacheDir() + "/" + symbol + "x" + size + ".png";
Bitmap result;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
result = BitmapFactory.decodeFile(filepath, options);
if(result == null)
if(src != null)
{
try {
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
result = BitmapFactory.decodeStream(input);
String size = src.substring(src.lastIndexOf("=") + 1, src.length());
String filepath = context.getCacheDir() + "/" + symbol + "x" + size + ".png";
FileOutputStream out = new FileOutputStream(filepath);
result.compress(Bitmap.CompressFormat.PNG, 100, out);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
} catch (IOException e) {
Log.d("moodl", "Error while downloading " + symbol + " icon > " + e.getMessage());
result = BitmapFactory.decodeResource(resources,
R.mipmap.ic_launcher_moodl);
result = Bitmap.createScaledBitmap(result, Integer.valueOf(size), Integer.valueOf(size), false);
result = BitmapFactory.decodeFile(filepath, options);
if(result == null)
{
try {
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
result = BitmapFactory.decodeStream(input);
FileOutputStream out = new FileOutputStream(filepath);
result.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (IOException e) {
Log.d("moodl", "Error while downloading " + symbol + " icon > " + e.getMessage());
Drawable defautlDrawable = resources.getDrawable(R.drawable.ic_panorama_fish_eye_24dp);
result = Bitmap.createBitmap(defautlDrawable.getIntrinsicWidth(), defautlDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
defautlDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
defautlDrawable.draw(canvas);
}
}
}
else
{
Log.d("moodl", "No URL for " + symbol);
Drawable defautlDrawable = resources.getDrawable(R.drawable.ic_panorama_fish_eye_24dp);
result = Bitmap.createBitmap(defautlDrawable.getIntrinsicWidth(), defautlDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
defautlDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
defautlDrawable.draw(canvas);
}
callBack.onBitmapDownloaded(result);
}
@ -297,4 +314,18 @@ public class MoodlBox {
return url;
}
public static int getIconDominantColor(Context context, Bitmap icon)
{
if(icon != null)
{
Palette.Builder builder = Palette.from(icon);
return builder.generate().getDominantColor(getColor(R.color.default_color, context));
}
else
{
return getColor(R.color.default_color, context);
}
}
}

View File

@ -1,8 +1,9 @@
package com.herbron.moodl;
package com.herbron.moodl.Utils;
import android.content.Context;
import com.herbron.moodl.DataManagers.PreferencesManager;
import com.herbron.moodl.R;
import java.util.ArrayList;
import java.util.List;
@ -11,7 +12,7 @@ import java.util.List;
* Created by Tiji on 19/04/2018.
*/
public class PlaceholderManager {
public class PlaceholderUtils {
public static String getValueString(String value, android.content.Context context)
{
@ -182,4 +183,24 @@ public class PlaceholderManager {
{
return context.getResources().getString(R.string.timestampPlaceholder, date);
}
public static String getToString(String to, android.content.Context context)
{
return context.getResources().getString(R.string.toPlaceholder, to);
}
public static String getFromString(String from, android.content.Context context)
{
return context.getResources().getString(R.string.fromPlaceholder, from);
}
public static String getFromToString(String from, String to, android.content.Context context)
{
return context.getResources().getString(R.string.fromToPlaceholder, from, to);
}
public static String getToPairString(String from, String to, Context context)
{
return context.getResources().getString(R.string.toPairPlaceholder, from, to);
}
}

View File

@ -0,0 +1,42 @@
package com.herbron.moodl.Utils;
import android.content.Context;
import com.herbron.moodl.Activities.RecordTransactionFragments.TransferFragment;
import com.herbron.moodl.R;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class TransferUtils {
public static boolean isBalanceRelated(String str)
{
Set<String> set = new HashSet<>(Arrays.asList(TransferFragment.EXCHANGE_CODE, TransferFragment.WALLET_CODE));
return set.contains(str);
}
public static String getLabelFor(Context context, String str)
{
switch (str)
{
case "stra:e":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[0].toLowerCase();
case "stra:mw":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[1].toLowerCase();
case "stra:m":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[2].toLowerCase();
case "stra:smew":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[3].toLowerCase();
case "stra:a":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[4].toLowerCase();
case "stra:unk":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[5].toLowerCase();
case "stra:fo":
return context.getResources().getStringArray(R.array.from_transfer_options_string_array)[6].toLowerCase();
}
return null;
}
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/hardWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
<item android:state_enabled="false">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/softWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
</selector>

View File

@ -0,0 +1,13 @@
<vector android:height="24dp" android:viewportHeight="2000"
android:viewportWidth="2000" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#f3ba2e"
android:pathData="M953,1986c-13,-7 -149,-139 -303,-294 -199,-201 -280,-289 -280,-304 0,-16 39,-61 120,-143l121,-121 194,195 195,196 195,-196 194,-195 127,127c69,69 124,133 122,140 -1,8 -139,148 -304,312 -321,317 -321,316 -381,283z" android:strokeColor="#00000000"/>
<path android:fillColor="#f3ba2e"
android:pathData="M117,1157c-51,-51 -98,-103 -105,-115 -14,-26 -16,-82 -2,-82 6,0 10,-5 10,-11 0,-15 185,-199 201,-199 18,0 254,232 254,250 0,18 -236,250 -254,250 -7,0 -54,-42 -104,-93z" android:strokeColor="#00000000"/>
<path android:fillColor="#f3ba2e"
android:pathData="M867,1132c-64,-64 -117,-124 -117,-132 0,-20 231,-250 250,-250 20,0 250,231 250,250 0,20 -231,250 -250,250 -9,0 -68,-53 -133,-118z" android:strokeColor="#00000000"/>
<path android:fillColor="#f3ba2e"
android:pathData="M1638,1125l-127,-125 125,-123c70,-67 132,-122 139,-122 8,0 56,41 107,92 157,154 157,151 0,306 -51,51 -98,93 -105,94 -7,2 -69,-53 -139,-122z" android:strokeColor="#00000000"/>
<path android:fillColor="#f3ba2e"
android:pathData="M490,755c-81,-82 -120,-127 -120,-143 0,-15 82,-105 283,-307 156,-157 289,-285 295,-285 7,0 12,-4 12,-10 0,-5 20,-10 45,-10 25,0 44,3 43,8 -1,4 131,137 293,297 161,160 295,296 297,304 2,7 -53,71 -122,140l-127,127 -194,-195 -195,-196 -195,196 -194,195 -121,-121z" android:strokeColor="#00000000"/>
</vector>

View File

@ -0,0 +1,23 @@
<vector android:height="24dp" android:viewportHeight="1950"
android:viewportWidth="1950" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#0072a0"
android:pathData="M656,1510l-208,-370 -224,-127c-124,-70 -223,-131 -221,-137 2,-5 160,-107 351,-226l348,-216 251,32c139,18 252,32 253,31 1,-1 13,-21 27,-43 21,-34 46,-52 131,-97 102,-54 107,-56 223,-66 192,-18 172,-9 270,-128 48,-58 89,-100 91,-93 2,6 -4,61 -13,121l-18,109 -151,87c-145,83 -154,91 -228,179l-78,93 95,157c52,87 93,159 91,161 -2,2 -98,-31 -189,-66l-28,-11 25,43 25,42 72,5 72,5 53,200c29,110 54,201 54,202 0,1 -21,5 -46,9l-46,7 36,20c20,12 36,23 36,26 -1,9 -271,176 -289,179 -10,1 -91,-77 -201,-192 -102,-107 -188,-192 -191,-188 -4,4 -35,126 -69,272 -81,348 -81,350 -89,350 -4,0 -101,-166 -215,-370z" android:strokeColor="#00000000"/>
<path android:fillColor="#008ebf"
android:pathData="M1231,1225c-101,-228 -187,-415 -191,-415 -4,0 -53,77 -110,171l-103,171 -191,-7 -191,-7 -223,-126c-122,-69 -221,-130 -219,-136 2,-5 160,-107 351,-226l348,-216 251,32c139,18 252,32 253,31 1,-1 13,-21 27,-43 21,-34 46,-52 131,-97 102,-54 107,-56 223,-66 192,-18 172,-9 270,-128 48,-58 89,-100 91,-93 2,6 -4,61 -13,121l-18,109 -151,87c-145,83 -154,91 -228,179l-78,93 95,157c52,87 93,159 91,161 -2,2 -16,-1 -32,-8 -16,-6 -64,-24 -107,-39l-77,-29 25,42 24,42 72,5 72,5 53,200c29,110 54,201 54,202 0,1 -24,5 -52,9 -58,8 -63,11 -193,157l-70,77 -184,-415z" android:strokeColor="#00000000"/>
<path android:fillColor="#57bbe6"
android:pathData="M1420,1263c0,-197 -4,-364 -8,-370 -4,-7 -83,-31 -175,-53l-167,-40 -225,0c-124,0 -225,3 -225,6 0,3 45,80 100,170 55,90 100,166 100,168 0,3 -33,3 -72,0 -40,-2 -127,-6 -193,-7l-120,-4 -218,-123c-119,-68 -216,-128 -214,-134 2,-5 160,-107 351,-226l348,-216 251,32c139,18 252,32 253,31 1,-1 13,-21 27,-43 21,-34 46,-52 131,-97 102,-54 107,-56 223,-66 192,-18 172,-9 270,-128 48,-58 89,-100 91,-93 2,6 -4,61 -13,121l-18,109 -151,87c-145,83 -154,91 -228,179l-78,93 95,157c52,87 93,159 91,161 -2,2 -98,-31 -189,-66l-28,-11 25,43 25,42 72,5 72,5 53,200c29,110 51,201 49,203 -1,2 -28,6 -58,9l-56,6 -91,103c-51,57 -94,104 -96,104 -2,0 -4,-161 -4,-357z" android:strokeColor="#00000000"/>
<path android:fillColor="#15a6db"
android:pathData="M1421,1270c0,-195 3,-350 5,-345 2,6 46,116 98,245l93,235 -48,55c-26,30 -70,80 -98,110l-50,55 0,-355z" android:strokeColor="#00000000"/>
<path android:fillColor="#15a6db"
android:pathData="M1625,1233c-49,-81 -103,-169 -119,-195l-28,-49 72,3 73,3 49,184c26,102 47,188 46,193 -2,4 -43,-58 -93,-139z" android:strokeColor="#00000000"/>
<path android:fillColor="#15a6db"
android:pathData="M779,1146c-2,-2 -78,-5 -169,-7 -174,-3 -171,-2 -265,-60 -16,-11 -41,-24 -55,-31 -14,-7 -28,-17 -32,-23 -4,-5 -8,-6 -8,-2 0,5 -12,-1 -26,-12 -15,-12 -31,-21 -36,-21 -5,0 -33,-15 -61,-34 -29,-18 -69,-41 -90,-51 -21,-10 -36,-19 -34,-21 4,-4 610,-85 612,-81 15,21 205,339 205,342 0,6 -35,7 -41,1z" android:strokeColor="#00000000"/>
<path android:fillColor="#15a6db"
android:pathData="M1524,937c-79,-30 -109,-46 -106,-56 3,-8 0,-11 -6,-7 -8,5 -309,-61 -359,-79 -8,-3 17,-54 68,-140 45,-75 80,-137 78,-139 -2,-2 -132,59 -288,135 -157,76 -287,137 -289,134 -3,-2 15,-82 39,-178l43,-173 250,32c189,25 253,30 259,21 4,-7 15,-25 23,-40 8,-16 19,-27 24,-25 4,2 49,54 98,116 68,85 92,108 96,95 3,-10 8,-89 12,-176 4,-86 10,-157 14,-157 16,0 217,-20 254,-25l40,-6 -20,23 -19,23 22,-19c12,-10 21,-21 20,-25 -1,-3 36,-53 83,-110 46,-57 86,-98 88,-91 3,7 -4,61 -13,121l-18,109 -147,85c-81,47 -151,85 -155,85 -4,0 -1,-8 6,-17 13,-16 12,-17 -4,-4 -9,7 -16,19 -15,25 2,6 -30,50 -70,98l-72,87 84,140c102,169 109,181 99,180 -4,0 -58,-19 -119,-42z" android:strokeColor="#00000000"/>
<path android:fillColor="#7bcff4"
android:pathData="M1625,1233c-49,-81 -103,-169 -119,-195l-28,-49 73,3 72,3 48,185c27,102 48,188 46,192 -1,4 -42,-58 -92,-139z" android:strokeColor="#00000000"/>
<path android:fillColor="#7bcff4"
android:pathData="M1528,938c-124,-46 -118,-34 -92,-182 8,-48 13,-90 11,-92 -2,-2 -91,25 -197,61 -107,36 -198,65 -202,65 -3,0 30,-61 74,-136 44,-74 79,-136 77,-138 -2,-2 -132,59 -288,135 -157,76 -287,137 -289,134 -3,-2 15,-82 39,-178l43,-173 216,28c118,15 232,30 252,33 36,5 39,3 58,-36 12,-22 25,-39 30,-37 4,2 49,54 98,116 68,85 92,108 96,95 3,-10 8,-89 12,-176 4,-86 10,-157 14,-157 18,0 229,-21 258,-26 27,-4 48,-24 119,-110 47,-57 88,-102 91,-100 10,10 -30,234 -42,230 -6,-2 -39,-8 -73,-12l-62,-9 -83,96c-46,53 -83,100 -83,106 0,6 -33,49 -73,97l-73,86 85,140c102,170 109,182 99,181 -4,0 -56,-19 -115,-41z" android:strokeColor="#00000000"/>
<path android:fillColor="#8cdbff"
android:pathData="M1531,939c-58,-21 -107,-41 -109,-44 -3,-2 3,-57 13,-121 14,-93 20,-113 30,-102 9,10 156,252 182,301 7,11 -6,8 -116,-34z" android:strokeColor="#00000000"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#010101" android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -16,9 +16,6 @@
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
@ -38,9 +35,6 @@
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
</selector>

View File

@ -29,9 +29,9 @@
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
android:layout_width="@dimen/currency_icon_cardview_size"
android:layout_height="@dimen/currency_icon_cardview_size"
android:layout_margin="1dp"/>
<TextView
android:id="@+id/currencyNameTextView"
@ -165,7 +165,7 @@
android:focusable="true">
<ProgressBar
android:id="@+id/progressBarLinechartSummary"
android:id="@+id/progressBarLinechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -49,9 +49,9 @@
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
android:layout_width="@dimen/currency_icon_cardview_size"
android:layout_height="@dimen/currency_icon_cardview_size"
android:layout_margin="1dp"/>
<TextView
android:id="@+id/currencyNameTextView"
@ -177,7 +177,7 @@
android:visibility="visible">
<ProgressBar
android:id="@+id/progressBarLinechartWatchlist"
android:id="@+id/progressBarLinechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -50,173 +50,181 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@drawable/gradient_background">
<LinearLayout android:id="@+id/layoutMarketCap"
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp"
android:background="@drawable/list_background">
<ProgressBar
android:id="@+id/progressBarMarketCap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar" />
<LinearLayout
android:id="@+id/layoutProgressMarketCap"
<LinearLayout android:id="@+id/layoutMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="20dp"
android:background="@drawable/list_background">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_marginTop="5dp">
<com.herbron.moodl.CustomLayouts.CustomPieChart
android:id="@+id/marketCapPieChart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:layout_gravity="center"
android:visibility="gone"
android:maxHeight="110dp"
android:maxWidth="110dp"
android:adjustViewBounds="true"/>
</FrameLayout>
<LinearLayout
android:id="@+id/layoutMarketDetails"
<ProgressBar
android:id="@+id/progressBarMarketCap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="10dp">
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textViewTitle"
android:textStyle="bold"
android:textSize="20sp"/>
<LinearLayout
android:id="@+id/layoutProgressMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
<View
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:background="@color/separationColor" />
android:layout_height="350dp"
android:layout_marginTop="5dp">
<com.herbron.moodl.CustomLayouts.CustomPieChart
android:id="@+id/marketCapPieChart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:layout_gravity="center"
android:visibility="gone"
android:maxHeight="110dp"
android:maxWidth="110dp"
android:adjustViewBounds="true"/>
</FrameLayout>
<LinearLayout
android:id="@+id/layoutMarketDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
android:orientation="vertical"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textViewTitle"
android:textStyle="bold"
android:textSize="20sp"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:background="@color/separationColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/market_capitalization"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewMarketCap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/layoutPercentageDominance"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:layout_marginTop="5dp">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dominance_percentage"
android:text="@string/market_capitalization"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewDominancePercentage"
android:id="@+id/textViewMarketCap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/layoutPercentageDominance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dominance_percentage"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewDominancePercentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutActiveCrypto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_cryptocurrencies"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveCrypto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutActiveCrypto"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_cryptocurrencies"
android:text="@string/volume_24h"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveCrypto"
android:id="@+id/textViewVolume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/volume_24h"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewVolume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/layoutActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
<LinearLayout
android:id="@+id/layoutActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_marketes"
android:textStyle="bold"/>
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
android:id="@+id/textViewActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_marketes"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
@ -228,6 +236,6 @@
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -94,7 +94,8 @@
android:background="@drawable/button_dashed_background"
android:layout_margin="10dp"
android:textColor="@color/separationColor"
style="@style/Widget.AppCompat.Button.Borderless"/>
android:visibility="gone"
style="@style/Widget.AppCompat.Button.Borderless" />
</LinearLayout>

View File

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.herbron.moodl.Activities.CurrencySelectionActivity">
tools:context="com.herbron.moodl.Activities.CurrencyListActivity">
<LinearLayout
android:layout_width="match_parent"

View File

@ -126,7 +126,7 @@
app:tabMode="fixed"
app:tabIndicatorColor="@color/transparent"/>
<android.support.v4.view.ViewPager
<com.herbron.moodl.CustomLayouts.CustomViewPager
android:id="@+id/transactionsViewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

View File

@ -30,9 +30,9 @@
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
android:layout_width="@dimen/currency_icon_cardview_size"
android:layout_height="@dimen/currency_icon_cardview_size"
android:layout_margin="1dp"/>
<TextView
android:id="@+id/currencyNameTextView"
@ -166,7 +166,7 @@
android:focusable="true">
<ProgressBar
android:id="@+id/progressBarLinechartSummary"
android:id="@+id/progressBarLinechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -51,9 +51,9 @@
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp" />
android:layout_width="@dimen/currency_icon_cardview_size"
android:layout_height="@dimen/currency_icon_cardview_size"
android:layout_margin="1dp"/>
<TextView
android:id="@+id/currencyNameTextView"
@ -180,7 +180,7 @@
android:visibility="visible">
<ProgressBar
android:id="@+id/progressBarLinechartWatchlist"
android:id="@+id/progressBarLinechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="#ffffffff">
<LinearLayout
android:layout_width="match_parent"
@ -17,53 +18,47 @@
<LinearLayout
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp">
<LinearLayout
android:padding="5dp"
android:background="#ffffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--What you want to show in SurfaceView-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="@+id/amountPurchased"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/amountPurchased"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/purchasedPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
<TextView
android:id="@+id/purchasePrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical"
android:gravity="end">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical"
android:gravity="end">
<TextView
android:id="@+id/pair"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/pair"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/tradeDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
<TextView
android:id="@+id/tradeDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -1,102 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="50dp"
android:orientation="vertical">
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/swipeLayout">
<!-- Bottom View Start-->
<LinearLayout
android:id="@+id/bottom_wrapper"
android:layout_width="100dp"
android:weightSum="1"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--What you want to show-->
android:layout_height="49dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/editTransactionLayout"
android:layout_width="wrap_content"
android:layout_weight="0.5"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/green">
<View
android:id="@+id/transactionIndicator"
android:layout_width="5dp"
android:layout_height="match_parent"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/ic_edit_white_24dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/deleteTransactionLayout"
android:layout_width="wrap_content"
android:layout_weight="0.5"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/red">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/ic_delete_white_24dp"/>
</LinearLayout>
</LinearLayout>
<!-- Bottom View End-->
<!-- Surface View Start -->
<LinearLayout
android:padding="5dp"
android:background="#ffffff"
<com.daimajia.swipe.SwipeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--What you want to show in SurfaceView-->
android:layout_height="match_parent"
android:id="@+id/swipeLayout">
<!-- Bottom View Start-->
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/bottom_wrapper"
android:layout_width="100dp"
android:weightSum="1"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
android:orientation="horizontal"
android:baselineAligned="false">
<!--What you want to show-->
<TextView
android:id="@+id/amountPurchased"
<LinearLayout
android:id="@+id/editTransactionLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
android:layout_weight="0.5"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/green">
<TextView
android:id="@+id/puchasedValue"
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/ic_edit_white_24dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/deleteTransactionLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
android:layout_weight="0.5"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/red">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/ic_delete_white_24dp"/>
</LinearLayout>
</LinearLayout>
<!-- Bottom View End-->
<!-- Surface View Start -->
<LinearLayout
android:padding="5dp"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="@+id/purchaseDate"
android:layout_height="match_parent">
<!--What you want to show in SurfaceView-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"/>
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="@+id/transactionTLTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/transactionBLTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="@+id/transactionAmountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:textSize="15dp"/>
<TextView
android:id="@+id/transactionDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:textSize="10dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Surface View End -->
</com.daimajia.swipe.SwipeLayout>
<!-- Surface View End -->
</com.daimajia.swipe.SwipeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"

View File

@ -6,6 +6,7 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/mainMenuLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -128,7 +129,7 @@
android:paddingEnd="4dp"
android:baselineAligned="false"
android:gravity="bottom"
android:layout_alignParentBottom="true">
android:layout_below="@id/mainMenuLayout">
<LinearLayout
android:layout_width="match_parent"

View File

@ -5,7 +5,15 @@
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<ListView
android:id="@+id/listTransactions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:divider="@null"
android:dividerHeight="0dp"/>
<!--<TextView
android:text="@string/transaction_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -65,6 +73,6 @@
android:divider="@null"
android:dividerHeight="0dp"/>
</LinearLayout>
</LinearLayout>-->
</LinearLayout>

View File

@ -62,7 +62,7 @@
android:id="@+id/exchange_icon_imageView"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginEnd="@dimen/margin"/>
android:layout_margin="5dp"/>
<LinearLayout
android:layout_width="match_parent"
@ -71,7 +71,8 @@
android:layout_toEndOf="@id/exchange_icon_imageView"
android:layout_toStartOf="@id/exchange_account_off_imageView"
android:gravity="center_vertical"
android:foregroundGravity="center_vertical">
android:foregroundGravity="center_vertical"
android:layout_marginTop="5dp">
<TextView
android:id="@+id/exchange_name"

View File

@ -51,173 +51,180 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@drawable/gradient_background">
<LinearLayout android:id="@+id/layoutMarketCap"
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp"
android:background="@drawable/list_background">
<ProgressBar
android:id="@+id/progressBarMarketCap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar" />
<LinearLayout
android:id="@+id/layoutProgressMarketCap"
<LinearLayout android:id="@+id/layoutMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="20dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_marginTop="5dp">
<com.herbron.moodl.CustomLayouts.CustomPieChart
android:id="@+id/marketCapPieChart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:layout_gravity="center"
android:visibility="gone"
android:maxHeight="110dp"
android:maxWidth="110dp"
android:adjustViewBounds="true"/>
</FrameLayout>
<LinearLayout
android:id="@+id/layoutMarketDetails"
<ProgressBar
android:id="@+id/progressBarMarketCap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="10dp">
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textViewTitle"
android:textStyle="bold"
android:textSize="20sp"/>
<LinearLayout
android:id="@+id/layoutProgressMarketCap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:orientation="vertical">
<View
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:background="@color/separationColor" />
android:layout_height="350dp"
android:layout_marginTop="5dp">
<com.herbron.moodl.CustomLayouts.CustomPieChart
android:id="@+id/marketCapPieChart"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/currencyIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:layout_gravity="center"
android:visibility="gone"
android:maxHeight="110dp"
android:maxWidth="110dp"
android:adjustViewBounds="true"/>
</FrameLayout>
<LinearLayout
android:id="@+id/layoutMarketDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
android:orientation="vertical"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textViewTitle"
android:textStyle="bold"
android:textSize="20sp"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:background="@color/separationColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/market_capitalization"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewMarketCap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/layoutPercentageDominance"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:layout_marginTop="5dp">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dominance_percentage"
android:text="@string/market_capitalization"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewDominancePercentage"
android:id="@+id/textViewMarketCap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/layoutPercentageDominance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dominance_percentage"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewDominancePercentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutActiveCrypto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_cryptocurrencies"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveCrypto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutActiveCrypto"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_cryptocurrencies"
android:text="@string/volume_24h"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveCrypto"
android:id="@+id/textViewVolume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/volume_24h"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewVolume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/layoutActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
<LinearLayout
android:id="@+id/layoutActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_marketes"
android:textStyle="bold"/>
android:orientation="vertical"
android:layout_marginTop="5dp">
<TextView
android:id="@+id/textViewActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/active_marketes"
android:textStyle="bold"/>
<TextView
android:id="@+id/textViewActiveMarkets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
@ -229,6 +236,6 @@
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -100,7 +100,7 @@
android:id="@+id/feesCurrency_editText_buy"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
android:layout_weight="1" />
</LinearLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee"
android:textColor="#000000"/>

View File

@ -2,15 +2,16 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/colorPrimaryDark">
android:background="@color/colorPrimaryDark"
android:orientation="vertical">
<TextView
android:id="@+id/appNameTextView"
android:text="@string/app_name"
<ImageView
android:id="@+id/appNameImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:visibility="gone"
android:layout_gravity="center"/>
android:src="@mipmap/ic_launcher_moodl"/>
<LinearLayout
android:id="@+id/animatedViewsLayout"

View File

@ -6,7 +6,7 @@
<string name="pref_title_default_currency">Monnaie par défaut</string>
<string name="buyText">Achat</string>
<string name="sellText">Vente</string>
<string name="transferText">Transfère</string>
<string name="transferText">Transfert</string>
<string name="transaction_record">Enregistrer</string>
<string name="pref_header_exchange">Réglages des échanges</string>
<string name="pref_title_enable_synchronization_hitbtc">Activer la synchronisation</string>
@ -118,19 +118,19 @@
</string-array>
<string-array name="from_transfer_options_string_array">
<item>Site d'échange</item>
<item>Site d\'échange</item>
<item>Mon portefeuille</item>
<item>Minage</item>
<item>Le portefeuille de quelqu'un d'autre</item>
<item>Le portefeuille de quelqu\'un d\'autre</item>
<item>Airdrop</item>
<item>Autre / Inconnu</item>
<item>Fork</item>
</string-array>
<string-array name="to_transfer_options_string_array">
<item>Site d'échange</item>
<item>Site d\'échange</item>
<item>Mon portefeuille</item>
<item>Le portefeuille de quelqu'un d'autre</item>
<item>Le portefeuille de quelqu\'un d\'autre</item>
<item>Autre / Inconnu</item>
</string-array>
@ -149,7 +149,7 @@
<string name="cannot_resole_host">Impossible de résoudre l\'hôte</string>
<string name="unexpected">Erreur inconnue</string>
<string name="select_coin">Selectionner une monnaie</string>
<string name="already_watchlisr">Monnaie déjà présente dans la liste suivie</string>
<string name="already_watchlist">Monnaie déjà présente dans la liste suivie</string>
<string name="create_backup">Créer une sauvegarde</string>
<string name="wrong_password">Mauvais mot de passe</string>
<string name="error">Erreur</string>

View File

@ -21,4 +21,6 @@
<dimen name="double_toolbarSpinner_size">180dp</dimen>
<dimen name="spinner_toolbar_height">50dp</dimen>
<dimen name="currency_icon_cardview_size">17dp</dimen>
</resources>

View File

@ -79,7 +79,7 @@
<string name="trade_loading">Looking for trades&#8230;</string>
<string name="default_value" translatable="false">--</string>
<!--Charts activity-->
<!--ChartsFragment activity-->
<string name="drawer">Drawer</string>
<string name="dominance_percentage">Dominance percentage</string>
<string name="active_cryptocurrencies">Active cryptocurrencies</string>
@ -261,7 +261,7 @@
<string name="cannot_resole_host">Can\'t resolve host</string>
<string name="unexpected">Unexpected error</string>
<string name="select_coin">Select a coin</string>
<string name="already_watchlisr">Currency already in watchlist</string>
<string name="already_watchlist">Currency already in watchlist</string>
<string name="create_backup">Create backup</string>
<string name="wrong_password">Wrong password</string>
<string name="error">Error</string>
@ -299,5 +299,11 @@
<string name="error_no_valid_from_to">This transaction is not valid</string>
<string name="deductFromHoldings">Deduct from holdings</string>
<string name="addToHoldings">Add to holdings</string>
<string name="withdrawText">Withdraw</string>
<string name="depositText">Deposit</string>
<string name="fromToPlaceholder">From %1$s to %2$s</string>
<string name="fromPlaceholder">From %1$s</string>
<string name="toPlaceholder">To %1$s</string>
<string name="toPairPlaceholder">%1$s to %2$s</string>
</resources>

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Sun Jun 17 03:10:32 CEST 2018
#Tue Oct 02 22:45:37 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip