Rework labels in transaction history

- Summary now updates after importing data
- Fix crash when exiting the details activity too quickly
This commit is contained in:
Tanguy Herbron 2018-08-22 21:27:58 +02:00
parent 518df666f4
commit dd9f4d2141
24 changed files with 250 additions and 223 deletions

View File

@ -71,7 +71,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>
@ -82,7 +82,7 @@
<option name="values">
<map>
<entry key="color" value="ffffff" />
<entry key="outputName" value="ic_arrow_drop_up_white_24dp" />
<entry key="outputName" value="ic_arrow_upward_white_24dp" />
<entry key="sourceFile" value="C:\Users\Guitoune" />
</map>
</option>

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;
@ -252,8 +252,8 @@ public class ChartsFragment extends Fragment implements CurrencyInfoUpdateNotifi
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 ChartsFragment extends Fragment implements CurrencyInfoUpdateNotifi
}
}
((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 ChartsFragment extends Fragment implements CurrencyInfoUpdateNotifi
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);

View File

@ -17,7 +17,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;
@ -73,6 +73,8 @@ public class InformationFragment extends Fragment {
private void dataCounter()
{
if(isTickerUpdated && isSnapshotUpdated)
{
if(getActivity() != null)
{
getActivity().runOnUiThread(new Runnable() {
@Override
@ -82,6 +84,7 @@ public class InformationFragment extends Fragment {
});
}
}
}
private void refreshInfoTab()
{
@ -120,12 +123,12 @@ public class InformationFragment 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 +142,15 @@ public class InformationFragment 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,7 +17,6 @@ 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;
@ -46,7 +39,6 @@ public class TransactionsFragment extends Fragment {
private boolean flag_loading;
private List<BinanceManager> binanceManagerList;
private DatabaseManager databaseManager;
private TradeListAdapter tradeListAdapter;
private ArrayList<com.herbron.moodl.DataManagers.CurrencyData.Trade> returnedTrades;
@Override

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

@ -37,7 +37,7 @@ 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;
@ -391,13 +391,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

@ -51,7 +51,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;
@ -500,7 +500,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 +517,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)

View File

@ -3,34 +3,23 @@ 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;
@ -44,7 +33,6 @@ 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;
@ -52,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 {
@ -187,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)
@ -242,7 +227,7 @@ 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);
@ -291,7 +276,7 @@ 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);
@ -435,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);
@ -566,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);
@ -685,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;
@ -452,8 +451,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);
@ -530,8 +529,8 @@ public class BuyFragment extends CustomRecordFragment {
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();

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;
@ -421,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);
@ -529,8 +529,8 @@ public class SellFragment extends CustomRecordFragment {
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();

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

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

View File

@ -20,6 +20,8 @@ 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;
@ -28,6 +30,8 @@ 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.
*/
@ -91,12 +95,12 @@ public class TransactionListAdapter extends ArrayAdapter<Object> {
View convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_transaction_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 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);
@ -135,12 +139,40 @@ public class TransactionListAdapter extends ArrayAdapter<Object> {
{
case "b":
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.increaseCandle));
topLeftTextView.setText(transaction.getSource());
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymbol(), transaction.getSymPair(), context));
break;
case "s":
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.decreaseCandle));
topLeftTextView.setText(transaction.getSource());
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymPair(), transaction.getSymbol(), 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;
}
@ -149,6 +181,8 @@ public class TransactionListAdapter extends ArrayAdapter<Object> {
return convertView;
}
private void setupSwipeView(View view)
{
SwipeLayout swipeLayout = view.findViewById(R.id.swipeLayout);

View File

@ -14,7 +14,6 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@ -29,7 +28,7 @@ import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
import com.herbron.moodl.DataManagers.DatabaseManager;
import com.herbron.moodl.DataManagers.PreferencesManager;
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;
@ -219,18 +218,18 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
private void updateCardViewInfos(Currency currency)
{
((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()));
.setText(PlaceholderUtils.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
@ -257,22 +256,22 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
double percentage = value / totalValue * 100;
((TextView) findViewById(R.id.currencyValueOwnedTextView))
.setText(PlaceholderManager.getValueParenthesisString(numberConformer(currency.getValue() * currency.getBalance()), getContext()));
.setText(PlaceholderUtils.getValueParenthesisString(numberConformer(currency.getValue() * currency.getBalance()), getContext()));
((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.currencyOwnedTextView))
.setText(PlaceholderManager.getBalanceString(numberConformer(currency.getBalance()), currency.getSymbol(), getContext()));
.setText(PlaceholderUtils.getBalanceString(numberConformer(currency.getBalance()), currency.getSymbol(), getContext()));
((TextView) findViewById(R.id.currencyFluctuationPercentageTextView))
.setText(PlaceholderManager.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
.setText(PlaceholderUtils.getPercentageString(numberConformer(currency.getDayFluctuationPercentage()), getContext()));
Drawable arrowDrawable = ((ImageView) findViewById(R.id.detailsArrow)).getDrawable();
arrowDrawable.mutate();
@ -290,7 +289,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
progressBarDrawable.invalidateSelf();
((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)
{

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.
*/
@ -672,12 +674,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 + "'";

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

@ -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,14 +18,9 @@
<LinearLayout
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:padding="5dp"
android:background="#ffffffff"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--What you want to show in SurfaceView-->
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -66,7 +62,6 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"

View File

@ -79,13 +79,13 @@
android:orientation="vertical">
<TextView
android:id="@+id/amountPurchased"
android:id="@+id/transactionTLTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"/>
<TextView
android:id="@+id/puchasedValue"
android:id="@+id/transactionBLTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"/>
@ -99,10 +99,20 @@
android:orientation="vertical">
<TextView
android:id="@+id/purchaseDate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"/>
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>

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>

View File

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