Several fixes
- CurrencySelectionActivity renamed to CurrencyListActivity - Allow refresh from the Update snackbar button in Summary after an error - Code cleaning - Typo
This commit is contained in:
parent
cb428937d4
commit
aa8717946a
75
.gitignore
vendored
75
.gitignore
vendored
@ -1,10 +1,69 @@
|
|||||||
*.iml
|
|
||||||
.gradle
|
|
||||||
/local.properties
|
|
||||||
/.idea/workspace.xml
|
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
|
||||||
/captures
|
# Built application files
|
||||||
.externalNativeBuild
|
|
||||||
*.apk
|
*.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
|
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -34,7 +34,7 @@
|
|||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activities.CurrencySelectionActivity"
|
android:name=".Activities.CurrencyListActivity"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.herbron.moodl.Activities;
|
package com.herbron.moodl.Activities;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
@ -16,6 +16,8 @@ import android.widget.ListView;
|
|||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
import android.widget.Toast;
|
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.DataNotifiers.CryptocompareNotifierInterface;
|
||||||
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
|
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
|
||||||
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
|
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
|
||||||
@ -25,15 +27,22 @@ import com.herbron.moodl.CustomAdapters.CoinWatchlistAdapter;
|
|||||||
import com.herbron.moodl.R;
|
import com.herbron.moodl.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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.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 CoinWatchlistAdapter adapter;
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private android.widget.Filter filter;
|
private android.widget.Filter filter;
|
||||||
private CryptocompareApiManager cryptocompareApiManager;
|
private CryptocompareApiManager cryptocompareApiManager;
|
||||||
private boolean isWatchList;
|
private CoinmarketCapAPIManager coinmarketCapAPIManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -42,15 +51,15 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
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 = CryptocompareApiManager.getInstance(this);
|
||||||
cryptocompareApiManager.addListener(this);
|
cryptocompareApiManager.addListener(this);
|
||||||
|
|
||||||
setTitle(getString(R.string.select_coin));
|
coinmarketCapAPIManager = CoinmarketCapAPIManager.getInstance(this);
|
||||||
|
coinmarketCapAPIManager.addListener(this);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
setTitle(getString(R.string.select_coin));
|
||||||
isWatchList = intent.getBooleanExtra("isWatchList", false);
|
|
||||||
|
|
||||||
ListLoader listLoader = new ListLoader();
|
ListLoader listLoader = new ListLoader();
|
||||||
listLoader.execute();
|
listLoader.execute();
|
||||||
@ -68,17 +77,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
|
|
||||||
private void setupAdapter()
|
private void setupAdapter()
|
||||||
{
|
{
|
||||||
List<String> currencyNames = cryptocompareApiManager.getCurrenciesName();
|
adapter = new CoinWatchlistAdapter(this, new ArrayList<>(coinmarketCapAPIManager.getTotalListing()));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupList()
|
private void setupList()
|
||||||
@ -93,8 +92,6 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
Currency selectedCurrency = (Currency) adapterView.getItemAtPosition(i);
|
Currency selectedCurrency = (Currency) adapterView.getItemAtPosition(i);
|
||||||
|
|
||||||
if(isWatchList)
|
|
||||||
{
|
|
||||||
PreferencesManager preferencesManager = new PreferencesManager(getApplicationContext());
|
PreferencesManager preferencesManager = new PreferencesManager(getApplicationContext());
|
||||||
DatabaseManager databaseManager = new DatabaseManager(getApplicationContext());
|
DatabaseManager databaseManager = new DatabaseManager(getApplicationContext());
|
||||||
|
|
||||||
@ -104,15 +101,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Toast.makeText(getApplicationContext(), getString(R.string.already_watchlisr), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), getString(R.string.already_watchlist), Toast.LENGTH_SHORT).show();
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Intent intent = new Intent(CurrencySelectionActivity.this, RecordTransactionActivity.class);
|
|
||||||
intent.putExtra("coin", selectedCurrency.getName());
|
|
||||||
intent.putExtra("symbol", selectedCurrency.getSymbol());
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
@ -165,6 +154,8 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void detailsEvent()
|
private void detailsEvent()
|
||||||
|
{
|
||||||
|
if(coinmarketCapAPIManager.isUpToDate() && cryptocompareApiManager.isDetailsUpToDate())
|
||||||
{
|
{
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -178,6 +169,7 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetailsUpdated() {
|
public void onDetailsUpdated() {
|
||||||
@ -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>
|
private class ListLoader extends AsyncTask<Void, Integer, Void>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -211,10 +223,18 @@ public class CurrencySelectionActivity extends AppCompatActivity implements Sear
|
|||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!cryptocompareApiManager.isDetailsUpToDate() || !coinmarketCapAPIManager.isUpToDate())
|
||||||
|
{
|
||||||
if(!cryptocompareApiManager.isDetailsUpToDate())
|
if(!cryptocompareApiManager.isDetailsUpToDate())
|
||||||
{
|
{
|
||||||
cryptocompareApiManager.updateDetails();
|
cryptocompareApiManager.updateDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!coinmarketCapAPIManager.isUpToDate())
|
||||||
|
{
|
||||||
|
coinmarketCapAPIManager.updateListing();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
detailsEvent();
|
detailsEvent();
|
@ -72,13 +72,14 @@ import static java.lang.Math.abs;
|
|||||||
|
|
||||||
public class Summary extends Fragment implements BalanceSwitchManagerInterface, BalanceUpdateNotifierInterface, CryptocompareNotifierInterface, CoinmarketcapNotifierInterface {
|
public class Summary extends Fragment implements BalanceSwitchManagerInterface, BalanceUpdateNotifierInterface, CryptocompareNotifierInterface, CoinmarketcapNotifierInterface {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private LinearLayout currencyLayout;
|
private LinearLayout currencyLayout;
|
||||||
private PreferencesManager preferencesManager;
|
private PreferencesManager preferencesManager;
|
||||||
private BalanceManager balanceManager;
|
private BalanceManager balanceManager;
|
||||||
private SwipeRefreshLayout refreshLayout;
|
private SwipeRefreshLayout refreshLayout;
|
||||||
private Dialog loadingDialog;
|
private Dialog loadingDialog;
|
||||||
private String defaultCurrency;
|
private String defaultCurrency;
|
||||||
private CoinmarketCapAPIManager coinmarketCapAPIManager;
|
|
||||||
|
|
||||||
private TextView toolbarSubtitle;
|
private TextView toolbarSubtitle;
|
||||||
private CollapsingToolbarLayout toolbarLayout;
|
private CollapsingToolbarLayout toolbarLayout;
|
||||||
@ -87,7 +88,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
private Runnable updateRunnable;
|
private Runnable updateRunnable;
|
||||||
|
|
||||||
private int coinCounter;
|
private int coinCounter;
|
||||||
private int iconCounter;
|
|
||||||
private float totalValue;
|
private float totalValue;
|
||||||
private boolean detailsChecker;
|
private boolean detailsChecker;
|
||||||
private boolean tickersChecker;
|
private boolean tickersChecker;
|
||||||
@ -95,6 +95,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
private long lastTimestamp;
|
private long lastTimestamp;
|
||||||
|
|
||||||
private BalanceUpdateInterface balanceUpdateInterface;
|
private BalanceUpdateInterface balanceUpdateInterface;
|
||||||
|
private CoinmarketCapAPIManager coinmarketCapAPIManager;
|
||||||
private CryptocompareApiManager cryptocompareApiManager;
|
private CryptocompareApiManager cryptocompareApiManager;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ -318,7 +319,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
.setAction(getString(R.string.update), new View.OnClickListener() {
|
.setAction(getString(R.string.update), new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
updateAll(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
@ -327,7 +328,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
private void resetCounters()
|
private void resetCounters()
|
||||||
{
|
{
|
||||||
coinCounter = 0;
|
coinCounter = 0;
|
||||||
iconCounter = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adaptView(float totalValue, float totalFluctuation)
|
private void adaptView(float totalValue, float totalFluctuation)
|
||||||
@ -753,6 +753,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
|
|
||||||
private class DataUpdater extends AsyncTask<Void, Integer, Void>
|
private class DataUpdater extends AsyncTask<Void, Integer, Void>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params)
|
protected Void doInBackground(Void... params)
|
||||||
{
|
{
|
||||||
|
@ -12,14 +12,14 @@ import android.os.Bundle;
|
|||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
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.CoinmarketcapNotifierInterface;
|
||||||
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
|
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
|
||||||
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
|
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
|
||||||
@ -42,7 +42,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import static com.herbron.moodl.MoodlBox.collapseW;
|
import static com.herbron.moodl.MoodlBox.collapseW;
|
||||||
import static com.herbron.moodl.MoodlBox.expandW;
|
import static com.herbron.moodl.MoodlBox.expandW;
|
||||||
import static com.herbron.moodl.MoodlBox.getColor;
|
|
||||||
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
|
import static com.herbron.moodl.MoodlBox.getIconDominantColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +249,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
|
|||||||
disableEdition();
|
disableEdition();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent selectionIntent = new Intent(getActivity(), CurrencySelectionActivity.class);
|
Intent selectionIntent = new Intent(getActivity(), CurrencyListActivity.class);
|
||||||
selectionIntent.putExtra("isWatchList", true);
|
selectionIntent.putExtra("isWatchList", true);
|
||||||
startActivity(selectionIntent);
|
startActivity(selectionIntent);
|
||||||
}
|
}
|
||||||
@ -355,6 +354,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
|
|||||||
public void run() {
|
public void run() {
|
||||||
dragLinearLayout.removeAllViews();
|
dragLinearLayout.removeAllViews();
|
||||||
view.findViewById(R.id.progressBarWatchlist).setVisibility(View.GONE);
|
view.findViewById(R.id.progressBarWatchlist).setVisibility(View.GONE);
|
||||||
|
view.findViewById(R.id.buttonAddWatchlist).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
for(Currency currency : watchlistManager.getWatchlist())
|
for(Currency currency : watchlistManager.getWatchlist())
|
||||||
{
|
{
|
||||||
@ -390,6 +390,9 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
|
|||||||
id = jsonObject.getInt("Id");
|
id = jsonObject.getInt("Id");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Log.d("moodl", "ID not found");
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@ -435,28 +438,15 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
|
|||||||
public void onPriceUpdated(Currency successCurrency) {
|
public void onPriceUpdated(Currency successCurrency) {
|
||||||
String iconUrl = MoodlBox.getIconUrl(currency.getSymbol(), cryptocompareApiManager);
|
String iconUrl = MoodlBox.getIconUrl(currency.getSymbol(), cryptocompareApiManager);
|
||||||
|
|
||||||
if(iconUrl != null)
|
|
||||||
{
|
|
||||||
MoodlBox.getBitmapFromURL(iconUrl, currency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
|
MoodlBox.getBitmapFromURL(iconUrl, currency.getSymbol(), getResources(), getActivity().getBaseContext(), new MoodlboxNotifierInterface() {
|
||||||
@Override
|
@Override
|
||||||
public void onBitmapDownloaded(Bitmap bitmapIcon) {
|
public void onBitmapDownloaded(Bitmap bitmapIcon) {
|
||||||
currency.setIcon(bitmapIcon);
|
currency.setIcon(bitmapIcon);
|
||||||
currency.setChartColor(getIconDominantColor(getContext(), bitmapIcon));
|
currency.setChartColor(getIconDominantColor(getContext(), bitmapIcon));
|
||||||
countWatchlist();
|
countWatchlist();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_moodl);
|
|
||||||
icon = Bitmap.createScaledBitmap(icon, 50, 50, false);
|
|
||||||
|
|
||||||
currency.setIcon(icon);
|
|
||||||
currency.setChartColor(getIconDominantColor(getContext(), icon));
|
|
||||||
countWatchlist();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -203,6 +203,11 @@ public class CoinmarketCapAPIManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Currency> getTotalListing()
|
||||||
|
{
|
||||||
|
return currencyTickerList;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateTopCurrencies(final String toSymbol)
|
public void updateTopCurrencies(final String toSymbol)
|
||||||
{
|
{
|
||||||
String requestString = topCurrenciesUrl + toSymbol;
|
String requestString = topCurrenciesUrl + toSymbol;
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Canvas;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v7.graphics.Palette;
|
import android.support.v7.graphics.Palette;
|
||||||
@ -208,10 +209,13 @@ public class MoodlBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void getBitmapFromURL(String src, String symbol, Resources resources, Context context, MoodlboxNotifierInterface callBack)
|
public static void getBitmapFromURL(String src, String symbol, Resources resources, Context context, MoodlboxNotifierInterface callBack)
|
||||||
|
{
|
||||||
|
Bitmap result;
|
||||||
|
|
||||||
|
if(src != null)
|
||||||
{
|
{
|
||||||
String size = src.substring(src.lastIndexOf("=") + 1, src.length());
|
String size = src.substring(src.lastIndexOf("=") + 1, src.length());
|
||||||
String filepath = context.getCacheDir() + "/" + symbol + "x" + size + ".png";
|
String filepath = context.getCacheDir() + "/" + symbol + "x" + size + ".png";
|
||||||
Bitmap result;
|
|
||||||
|
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||||
@ -234,11 +238,23 @@ public class MoodlBox {
|
|||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d("moodl", "Error while downloading " + symbol + " icon > " + e.getMessage());
|
Log.d("moodl", "Error while downloading " + symbol + " icon > " + e.getMessage());
|
||||||
result = BitmapFactory.decodeResource(resources,
|
Drawable defautlDrawable = resources.getDrawable(R.drawable.ic_panorama_fish_eye_24dp);
|
||||||
R.mipmap.ic_launcher_moodl);
|
result = Bitmap.createBitmap(defautlDrawable.getIntrinsicWidth(), defautlDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||||
result = Bitmap.createScaledBitmap(result, Integer.valueOf(size), Integer.valueOf(size), false);
|
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);
|
callBack.onBitmapDownloaded(result);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,8 @@
|
|||||||
android:background="@drawable/button_dashed_background"
|
android:background="@drawable/button_dashed_background"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:textColor="@color/separationColor"
|
android:textColor="@color/separationColor"
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"/>
|
android:visibility="gone"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="com.herbron.moodl.Activities.CurrencySelectionActivity">
|
tools:context="com.herbron.moodl.Activities.CurrencyListActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
@ -149,7 +149,7 @@
|
|||||||
<string name="cannot_resole_host">Impossible de résoudre l\'hôte</string>
|
<string name="cannot_resole_host">Impossible de résoudre l\'hôte</string>
|
||||||
<string name="unexpected">Erreur inconnue</string>
|
<string name="unexpected">Erreur inconnue</string>
|
||||||
<string name="select_coin">Selectionner une monnaie</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="create_backup">Créer une sauvegarde</string>
|
||||||
<string name="wrong_password">Mauvais mot de passe</string>
|
<string name="wrong_password">Mauvais mot de passe</string>
|
||||||
<string name="error">Erreur</string>
|
<string name="error">Erreur</string>
|
||||||
|
@ -261,7 +261,7 @@
|
|||||||
<string name="cannot_resole_host">Can\'t resolve host</string>
|
<string name="cannot_resole_host">Can\'t resolve host</string>
|
||||||
<string name="unexpected">Unexpected error</string>
|
<string name="unexpected">Unexpected error</string>
|
||||||
<string name="select_coin">Select a coin</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="create_backup">Create backup</string>
|
||||||
<string name="wrong_password">Wrong password</string>
|
<string name="wrong_password">Wrong password</string>
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Sun Jun 17 03:10:32 CEST 2018
|
#Tue Oct 02 22:45:37 CEST 2018
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user