Major updates

- Fix code typos
- Add a 'fromSym' field in the transactions table
- Fix translation in the drawer

[RecordTransactionActivity rework]
- New currency selection
- Add Exchange selection
- Add corresponding Pair selection
- Add tabs to select Buy/Sell/Transaction
> Buy fragment
- Add note field
- Add fee format selection
- Limit date selection to the past (it's no longer possible to add a futur transaction)
- Auto fill the price after date selection
This commit is contained in:
Tanguy Herbron 2018-08-14 04:14:18 +02:00
parent 7b5fd6e786
commit 3a1ac3c80b
33 changed files with 723 additions and 310 deletions

View File

@ -23,7 +23,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/alert/ic_error_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_drop_up_black_24dp.xml" />
</map>
</option>
</PersistentState>
@ -34,7 +34,7 @@
<option name="values">
<map>
<entry key="color" value="ffffff" />
<entry key="outputName" value="ic_error_24dp" />
<entry key="outputName" value="ic_arrow_drop_up_white_24dp" />
<entry key="sourceFile" value="C:\Users\Guitoune" />
</map>
</option>

Binary file not shown.

View File

@ -56,7 +56,7 @@ dependencies {
implementation 'org.apache.commons:commons-lang3:3.6'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.mattprecious.swirl:swirl:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:3.5.2'
implementation 'com.wdullaer:materialdatetimepicker:3.6.3'
implementation 'com.jmedeisis:draglinearlayout:1.1.0'
implementation 'com.applandeo:material-file-picker:1.0.0'
implementation 'com.daasuu:EasingInterpolator:1.0.0'

View File

@ -616,7 +616,7 @@ public class Charts extends Fragment implements CurrencyInfoUpdateNotifierInterf
}
@Override
public void onTimestampPriveUpdated(String price) {
public void onTimestampPriceUpdated(String price) {
}

View File

@ -560,7 +560,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
{
balance.get(i).updatePrice(getActivity(), defaultCurrency, new CurrencyInfoUpdateNotifierInterface() {
@Override
public void onTimestampPriveUpdated(String price) {
public void onTimestampPriceUpdated(String price) {
}

View File

@ -435,7 +435,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
currency.setId(getCurrencyId(currency.getSymbol()));
currency.updatePrice(getActivity(), preferencesManager.getDefaultCurrency(), new CurrencyInfoUpdateNotifierInterface() {
@Override
public void onTimestampPriveUpdated(String price) {
public void onTimestampPriceUpdated(String price) {
}

View File

@ -3,10 +3,12 @@ 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;
@ -15,6 +17,9 @@ 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;
@ -23,11 +28,13 @@ 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.CurrencyInfoUpdateNotifierInterface;
import com.herbron.moodl.CustomAdapters.PairRecordListAdapter;
import com.herbron.moodl.CustomLayouts.CustomRecordFragment;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
@ -47,27 +54,11 @@ 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 {
private String coin;
private String symbol;
private TextView symbolTxtView;
private TextInputLayout purchasedDateLayout;
private EditText purchaseDate;
private TextView feesTxtView;
private EditText amountTxtView;
private Button buyButton;
private Button sellButton;
private Button transferButton;
private DatabaseManager databaseManager;
private Calendar calendar;
private SimpleDateFormat sdf;
private PreferencesManager preferenceManager;
private EditText purchasedPriceEditText;
private int transactionId;
private Toolbar toolbar;
private ImageView currencyIconImageView;
@ -81,51 +72,19 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
private AutoCompleteTextView exchange_autoCompleteTextView;
private AutoCompleteTextView pair_autoCompleteTextView;
private SearchView mainSearchView;
private CustomTabLayout tabLayout;
private ViewPager viewPager;
/*@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_record:
private RecordTransactionPageAdapter pageAdapter;
if(checkAmountText() && checkPriceText())
{
double amount = Double.parseDouble(amountTxtView.getText().toString());
double purchasedPrice = Double.parseDouble(purchasedPriceEditText.getText().toString());
double fees = Double.parseDouble(feesTxtView.getText().toString());
private Animation revealAnimation;
private Animation dismissAnimation;
if(!sellButton.isEnabled())
{
amount *= -1;
}
private LinearLayout globalTabLayouts;
if(transactionId != -1)
{
databaseManager.updateTransactionWithId(transactionId, amount, calendar.getTime(), purchasedPrice, fees);
}
else
{
databaseManager.addCurrencyToManualCurrency(symbol, amount, calendar.getTime(), purchasedPrice, fees);
}
private boolean isGlobalLayoutVisible;
preferenceManager.setMustUpdateSummary(true);
Intent intent = new Intent(RecordTransactionActivity.this, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
finish();
}
break;
case android.R.id.home:
//NavUtils.navigateUpFromSameTask(this);
finish();
break;
default:
break;
}
return true;
}*/
private boolean checkPriceText()
/*private boolean checkPriceText()
{
String purchasedPriceText = purchasedPriceEditText.getText().toString();
double purchasedPrice;
@ -173,27 +132,13 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
}
return true;
}
}*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record_transaction);
Intent intent = getIntent();
sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.UK);
calendar = Calendar.getInstance();
databaseManager = new DatabaseManager(this);
preferenceManager = new PreferencesManager(this);
coin = intent.getStringExtra("coin");
symbol = intent.getStringExtra("symbol");
transactionId = intent.getIntExtra("transactionId", -1);
toolbar = findViewById(R.id.toolbar);
currencyIconImageView = findViewById(R.id.currencyIconImageView);
@ -220,16 +165,23 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
setupBackButton();
}
public Currency getCurrency()
{
return currency;
}
private void setupTabLayout()
{
CustomTabLayout tabLayout = findViewById(R.id.transactionsTabLayout);
globalTabLayouts = findViewById(R.id.globalTabLayouts);
tabLayout = findViewById(R.id.transactionsTabLayout);
tabLayout.addTab(0, "Buy");
tabLayout.addTab(1, "Sell");
//tabLayout.addTab(2, "Transfer");
tabLayout.addTab(2, "Transfer");
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
final ViewPager viewPager = findViewById(R.id.transactionsViewPager);
final RecordTransactionPageAdapter pageAdapter = new RecordTransactionPageAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager = findViewById(R.id.transactionsViewPager);
pageAdapter = new RecordTransactionPageAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(pageAdapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@ -248,6 +200,33 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
}
});
LinearLayout tabLayoutChildren = (LinearLayout) tabLayout.getChildAt(0);
for(int i = 0; i < tabLayoutChildren.getChildCount(); i++)
{
tabLayoutChildren.getChildAt(i).setEnabled(false);
}
revealAnimation = AnimationUtils.loadAnimation(this, R.anim.reveal);
dismissAnimation = AnimationUtils.loadAnimation(this, R.anim.dismiss);
dismissAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
isGlobalLayoutVisible = false;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
private void setupPairAutoCompleteTextView()
@ -255,6 +234,27 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
pair_autoCompleteTextView.setThreshold(0);
pair_autoCompleteTextView.setTextColor(getResources().getColor(R.color.white));
pair_autoCompleteTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(0).setEnabled(false);
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(1).setEnabled(false);
tabLayout.getTabAt(2).select();
}
@Override
public void afterTextChanged(Editable s) {
}
});
pair_autoCompleteTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -284,6 +284,12 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
pair_autoCompleteTextView.setText(PlaceholderManager.getPairString(pair.getFrom(), pair.getTo(), getBaseContext()));
toolbar.requestFocus();
hideSoftKeyboard(RecordTransactionActivity.this);
updatePairData();
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(0).setEnabled(true);
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(1).setEnabled(true);
tabLayout.getTabAt(0).select();
}
});
}
@ -303,6 +309,10 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
public void onTextChanged(CharSequence s, int start, int before, int count) {
pair_autoCompleteTextView.setEnabled(false);
pair_autoCompleteTextView.setText("");
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(0).setEnabled(false);
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(1).setEnabled(false);
tabLayout.getTabAt(2).select();
}
@Override
@ -343,6 +353,8 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
updatePairAdapter();
pair_autoCompleteTextView.setEnabled(true);
updateExchangeData();
}
});
}
@ -363,7 +375,7 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
private void setupCoinAutoCompleteTextView()
{
CoinRecordListAdapter adapter = new CoinRecordListAdapter(this, R.layout.custom_summary_coin_row, new ArrayList<>(cryptocompareApiManager.getCurrenciesDenomination()));
CoinRecordListAdapter adapter = new CoinRecordListAdapter(getBaseContext(), R.layout.custom_summary_coin_row, new ArrayList<>(cryptocompareApiManager.getCurrenciesDenomination()));
coin_autoCompleteTextView.setThreshold(0);
coin_autoCompleteTextView.setAdapter(adapter);
@ -379,6 +391,13 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
currencyIconImageView.setImageBitmap(null);
exchange_autoCompleteTextView.setEnabled(false);
exchange_autoCompleteTextView.setText("");
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(2).setEnabled(false);
if(isGlobalLayoutVisible && globalTabLayouts.getAnimation().hasEnded())
{
globalTabLayouts.startAnimation(dismissAnimation);
}
}
@Override
@ -424,13 +443,53 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
IconDownloaderTask iconDownloaderTask = new IconDownloaderTask();
iconDownloaderTask.execute();
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(0).setEnabled(false);
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(1).setEnabled(false);
((LinearLayout) tabLayout.getChildAt(0)).getChildAt(2).setEnabled(true);
tabLayout.getTabAt(2).select();
updateCurrencyData();
if(globalTabLayouts.getVisibility() == View.GONE)
{
globalTabLayouts.setVisibility(View.VISIBLE);
}
globalTabLayouts.startAnimation(revealAnimation);
isGlobalLayoutVisible = true;
}
});
}
private void updateCurrencyData()
{
for(int i = 0; i < pageAdapter.getCount(); i++)
{
((CustomRecordFragment) pageAdapter.getItem(i)).setCurrency(currency);
}
}
private void updateExchangeData()
{
for(int i = 0; i < pageAdapter.getCount(); i++)
{
((CustomRecordFragment) pageAdapter.getItem(i)).setExchange(exchange);
}
}
private void updatePairData()
{
for(int i = 0; i < pageAdapter.getCount(); i++)
{
((CustomRecordFragment) pageAdapter.getItem(i)).setPair(pair);
}
}
@Override
public void onTimestampPriveUpdated(String price) {
purchasedPriceEditText.setText(price);
public void onTimestampPriceUpdated(String price) {
//purchasedPriceEditText.setText(price);
}
@Override
@ -543,54 +602,6 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
activity.getCurrentFocus().getWindowToken(), 0);
}
/*private void initializeButtons()
{
buyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
buyButton.setEnabled(false);
sellButton.setEnabled(true);
transferButton.setEnabled(true);
findViewById(R.id.input_purchase_price).setVisibility(View.VISIBLE);
findViewById(R.id.input_fees).setVisibility(View.GONE);
}
});
sellButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
buyButton.setEnabled(true);
sellButton.setEnabled(false);
transferButton.setEnabled(true);
findViewById(R.id.input_purchase_price).setVisibility(View.GONE);
findViewById(R.id.input_fees).setVisibility(View.VISIBLE);
}
});
transferButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
buyButton.setEnabled(true);
sellButton.setEnabled(true);
transferButton.setEnabled(false);
// Prepare transfer interface
}
});
}
private void initializeViewElements()
{
symbolTxtView = findViewById(R.id.currencySymbol);
amountTxtView = findViewById(R.id.currencyAmount);
feesTxtView = findViewById(R.id.feesTextView);
purchasedDateLayout = findViewById(R.id.input_purchase_date);
purchaseDate = findViewById(R.id.purchaseDate);
purchasedPriceEditText = findViewById(R.id.purchasePrice);
buyButton = findViewById(R.id.buyButton);
sellButton = findViewById(R.id.sellButton);
transferButton = findViewById(R.id.transfertButton);
}*/
private void setupBackButton()
{
ImageButton backButton = findViewById(R.id.back_button);
@ -601,44 +612,4 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
}
});
}
private void createDatePicker()
{
new android.app.DatePickerDialog(
RecordTransactionActivity.this,
new android.app.DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
purchaseDate.setText(sdf.format(calendar.getTime()));
createTimePicker();
}
},
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
).show();
}
private void createTimePicker()
{
new android.app.TimePickerDialog(
RecordTransactionActivity.this,
new android.app.TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hour, int minute) {
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
purchaseDate.setText(sdf.format(calendar.getTime()));
currency.getTimestampPrice(RecordTransactionActivity.this, preferenceManager.getDefaultCurrency(),calendar.getTimeInMillis() / 1000);
}
},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
true
).show();
}
}

View File

@ -1,37 +1,312 @@
package com.herbron.moodl.Activities.RecordTransactionFragments;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
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;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.Spinner;
import android.widget.TimePicker;
import com.herbron.moodl.DataNotifiers.CryptocompareNotifierInterface;
import com.herbron.moodl.DataManagers.InfoAPIManagers.CryptocompareApiManager;
import com.herbron.moodl.Activities.HomeActivity;
import com.herbron.moodl.CustomLayouts.CustomRecordFragment;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
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.R;
public class BuyFragment extends Fragment implements CryptocompareNotifierInterface {
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
private CryptocompareApiManager cryptocompareApiManager;
public class BuyFragment extends CustomRecordFragment {
private TextInputEditText amoutEditText;
private TextInputEditText buyPriceEditText;
private TextInputEditText buyDateEditText;
private TextInputEditText totalValueEditText;
private TextInputEditText fees_editText;
private TextInputEditText note_editText;
private AppCompatButton saveBuyButton;
private static Spinner feesCurrencySpinner;
private static View view;
private ArrayAdapter<String> currencyAdapter;
private SimpleDateFormat sdf;
private Calendar calendar;
private PreferencesManager preferenceManager;
private static Context context;
private static Currency fragmentCurrency;
private static Exchange fragmentExchange;
private static Pair fragmentPair;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_buy, container, false);
view = inflater.inflate(R.layout.fragment_buy, container, false);
context = getActivity().getApplicationContext();
calendar = Calendar.getInstance();
sdf = new SimpleDateFormat(" HH:mm dd/MM/yyyy", Locale.UK);
preferenceManager = new PreferencesManager(getContext());
initializeViewElements();
return view;
}
@Override
public void onDetailsUpdated() {
private void initializeViewElements()
{
totalValueEditText = view.findViewById(R.id.totalValue_editText);
amoutEditText = view.findViewById(R.id.amount_editText);
amoutEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(isFieldCorrectlyFilled(buyPriceEditText, false) && isFieldCorrectlyFilled(amoutEditText, false))
{
if(Double.parseDouble(amoutEditText.getText().toString()) > 0)
{
Double totalValue = Double.parseDouble(buyPriceEditText.getText().toString()) * Double.parseDouble(s.toString());
totalValueEditText.setText(String.format("%f", totalValue));
}
else
{
totalValueEditText.setText("0");
}
}
else
{
totalValueEditText.setText("");
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
buyPriceEditText = view.findViewById(R.id.buyPrice_editText);
buyDateEditText = view.findViewById(R.id.buyDate_editText);
buyDateEditText.setText(sdf.format(calendar.getTime()));
buyDateEditText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
createDatePicker();
}
});
feesCurrencySpinner = view.findViewById(R.id.feesCurrency_editText);
currencyAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feesCurrencySpinner.setAdapter(currencyAdapter);
if(fragmentPair != null)
{
updateAdapter();
}
saveBuyButton = view.findViewById(R.id.saveBuyButton);
saveBuyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(isFieldCorrectlyFilled(amoutEditText, true) && isFieldCorrectlyFilled(buyPriceEditText, true) && isFieldCorrectlyFilled(totalValueEditText, true))
{
double amount = Double.parseDouble(amoutEditText.getText().toString());
double purchasedPrice = Double.parseDouble(buyPriceEditText.getText().toString());
double fees;
if(fees_editText.getText().toString().equals(""))
{
fees = 0;
}
else
{
fees = Double.parseDouble(fees_editText.getText().toString());
}
String note = note_editText.getText().toString();
DatabaseManager databaseManager = new DatabaseManager(getContext());
databaseManager.addTransaction(fragmentCurrency.getSymbol()
, amount
, calendar.getTime()
, purchasedPrice
, fees
, note
, fragmentPair.getFrom().equals(fragmentCurrency.getSymbol()) ? fragmentPair.getTo() : fragmentPair.getFrom());
preferenceManager.setMustUpdateSummary(true);
Intent intent = new Intent(getActivity(), HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
getActivity().finish();
}
}
});
fees_editText = view.findViewById(R.id.fees_editText);
note_editText = view.findViewById(R.id.note_editText);
}
private boolean isFieldCorrectlyFilled(TextInputEditText editText, boolean displayError)
{
String purchasedPriceText = editText.getText().toString();
double purchasedPrice;
try {
purchasedPrice = Double.parseDouble(purchasedPriceText);
if(purchasedPrice < 0)
{
if(displayError) editText.setError(getResources().getString(R.string.field_negative));
return false;
}
} catch (NumberFormatException e) {
if(displayError) editText.setError(getResources().getString(R.string.field_nan));
return false;
}
if(purchasedPriceText.equals(""))
{
if(displayError) editText.setError(getResources().getString(R.string.field_empty));
return false;
}
return true;
}
private void updateAdapter()
{
List<String> symbolStrings = new ArrayList<>();
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getFrom(), getSecureContext()));
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(fragmentPair.getTo(), getSecureContext()));
currencyAdapter.clear();
currencyAdapter.addAll(symbolStrings);
currencyAdapter.notifyDataSetChanged();
}
private void createDatePicker()
{
DatePickerDialog datePickerDialog = new DatePickerDialog(
getContext(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
buyDateEditText.setText(sdf.format(calendar.getTime()));
createTimePicker();
}
},
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
);
datePickerDialog.getDatePicker().setMaxDate(Calendar.getInstance().getTimeInMillis());
datePickerDialog.show();
}
private void createTimePicker()
{
new android.app.TimePickerDialog(
getContext(),
new android.app.TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hour, int minute) {
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
buyDateEditText.setText(sdf.format(calendar.getTime()));
if(fragmentCurrency != null)
{
fragmentCurrency.getTimestampPrice(getContext(), preferenceManager.getDefaultCurrency(),calendar.getTimeInMillis() / 1000);
}
}
},
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
true
).show();
}
private static Context getSecureContext()
{
return context;
}
@Override
public void onExchangesUpdated() {
public void onCurrencyUpdated() {
fragmentCurrency = currency;
}
@Override
public void onExchangeUpdated() {
fragmentExchange = exchange;
}
@Override
public void onPairUpdated() {
fragmentPair = pair;
fragmentCurrency.setOnTimestampPriceUpdatedListener(new Currency.OnTimestampPriceUpdatedListener() {
@Override
public void onTimeStampPriceUpdated(String price) {
((TextInputEditText) view.findViewById(R.id.buyPrice_editText)).setText(price);
if(currencyAdapter != null)
{
updateAdapter();
}
}
});
if(preferenceManager == null)
{
preferenceManager = new PreferencesManager(getSecureContext());
}
if(calendar == null)
{
calendar = Calendar.getInstance();
}
fragmentCurrency.getTimestampPrice(getSecureContext(), preferenceManager.getDefaultCurrency(), calendar.getTimeInMillis() / 1000);
}
}

View File

@ -8,9 +8,10 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.herbron.moodl.CustomLayouts.CustomRecordFragment;
import com.herbron.moodl.R;
public class SellFragment extends Fragment {
public class SellFragment extends CustomRecordFragment {
@Nullable
@Override
@ -18,4 +19,19 @@ public class SellFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_sell, container, false);
return view;
}
@Override
public void onCurrencyUpdated() {
}
@Override
public void onExchangeUpdated() {
}
@Override
public void onPairUpdated() {
}
}

View File

@ -8,9 +8,10 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.herbron.moodl.CustomLayouts.CustomRecordFragment;
import com.herbron.moodl.R;
public class TransferFragment extends Fragment {
public class TransferFragment extends CustomRecordFragment {
@Nullable
@Override
@ -18,4 +19,19 @@ public class TransferFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_transfer, container, false);
return view;
}
@Override
public void onCurrencyUpdated() {
}
@Override
public void onExchangeUpdated() {
}
@Override
public void onPairUpdated() {
}
}

View File

@ -4,7 +4,7 @@ import com.herbron.moodl.DataManagers.CurrencyData.Currency;
public interface CurrencyInfoUpdateNotifierInterface {
void onTimestampPriveUpdated(String price);
void onTimestampPriceUpdated(String price);
void onHistoryDataUpdated();

View File

@ -0,0 +1,41 @@
package com.herbron.moodl.CustomLayouts;
import android.support.v4.app.Fragment;
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
import com.herbron.moodl.DataManagers.InfoAPIManagers.Pair;
public abstract class CustomRecordFragment extends Fragment {
protected Currency currency;
protected Exchange exchange;
protected Pair pair;
public void setCurrency(Currency currency)
{
this.currency = currency;
onCurrencyUpdated();
}
public void setExchange(Exchange exchange)
{
this.exchange = exchange;
onExchangeUpdated();
}
public void setPair(Pair pair)
{
this.pair = pair;
onPairUpdated();
}
public abstract void onCurrencyUpdated();
public abstract void onExchangeUpdated();
public abstract void onPairUpdated();
}

View File

@ -27,39 +27,44 @@ public class CustomTabLayout extends TabLayout {
private StateListDrawable getSellStateListDrawable() {
StateListDrawable sld = new StateListDrawable();
sld.addState(new int[] {android.R.attr.state_pressed},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_sell));
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] {android.R.attr.state_selected},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_sell));
sld.addState(new int[] { },
sld.addState(new int[] {android.R.attr.state_enabled },
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] { },
ContextCompat.getDrawable(context, R.drawable.disabled_tab_background));
return sld;
}
private StateListDrawable getBuyStateListDrawable() {
StateListDrawable sld = new StateListDrawable();
sld.addState(new int[] {android.R.attr.state_pressed},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_buy));
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] {android.R.attr.state_selected},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_buy));
sld.addState(new int[] { },
sld.addState(new int[] {android.R.attr.state_enabled },
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] { },
ContextCompat.getDrawable(context, R.drawable.disabled_tab_background));
return sld;
}
private StateListDrawable getTransferStateListDrawable() {
StateListDrawable sld = new StateListDrawable();
sld.addState(new int[] {android.R.attr.state_pressed},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_transfer));
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] {android.R.attr.state_selected},
ContextCompat.getDrawable(context, R.drawable.record_transaction_tab_background_transfer));
sld.addState(new int[] { },
sld.addState(new int[] {android.R.attr.state_enabled },
ContextCompat.getDrawable(context, R.drawable.unselected_tab_background));
sld.addState(new int[] { },
ContextCompat.getDrawable(context, R.drawable.disabled_tab_background));
return sld;
}
public void addTab(int index, String label) {
TextView textView = new TextView(context);
textView.setTextColor(getResources().getColor(R.color.white));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setText(label);
textView.setGravity(GRAVITY_CENTER);

View File

@ -4,13 +4,9 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import com.herbron.moodl.CurrencyInfoUpdateNotifierInterface;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
@ -48,6 +44,7 @@ public class Currency implements Parcelable {
private int rank;
private String startDate;
private List<String> socialMediaLinks;
private OnTimestampPriceUpdatedListener onTimestampPriceUpdatedListener;
//private String proofType
private CurrencyInfoUpdateNotifierInterface currencyInfoUpdateNotifierInterface;
@ -97,7 +94,12 @@ public class Currency implements Parcelable {
@Override
public void onSuccess(String price) {
currencyInfoUpdateNotifierInterface.onTimestampPriveUpdated(price);
currencyInfoUpdateNotifierInterface.onTimestampPriceUpdated(price);
if(onTimestampPriceUpdatedListener != null)
{
onTimestampPriceUpdatedListener.onTimeStampPriceUpdated(price);
}
}
}, timestamp);
}
@ -534,4 +536,14 @@ public class Currency implements Parcelable {
return new Currency[size];
}
};
public interface OnTimestampPriceUpdatedListener
{
void onTimeStampPriceUpdated(String price);
}
public void setOnTimestampPriceUpdatedListener(OnTimestampPriceUpdatedListener onTimestampPriceUpdatedListener)
{
this.onTimestampPriceUpdatedListener = onTimestampPriceUpdatedListener;
}
}

View File

@ -357,7 +357,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
}
@Override
public void onTimestampPriveUpdated(String price) {
public void onTimestampPriceUpdated(String price) {
}

View File

@ -19,6 +19,7 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@ -29,7 +30,7 @@ import java.util.List;
public class DatabaseManager extends SQLiteOpenHelper{
private static final int DATABASE_VERSION = 10;
private static final int DATABASE_VERSION = 13;
private static final String DATABASE_NAME = "Currencies.db";
@ -39,8 +40,9 @@ public class DatabaseManager extends SQLiteOpenHelper{
private static final String KEY_CURRENCY_ID = "idCurrency";
private static final String KEY_CURRENCY_SYMBOL = "symbol";
private static final String KEY_CURRENCY_NAME = "name";
private static final String KEY_CURRENCY_NOTES = "notes";
private static final String KEY_CURRENCY_BALANCE = "balance";
private static final String KEY_CURRENCY_FROM = "symFrom";
private static final String KEY_CURRENCY_DATE = "addDate";
private static final String KEY_CURRENCY_PURCHASED_PRICE = "purchasedPrice";
private static final String KEY_CURRENCY_IS_MINED = "isMined";
@ -73,12 +75,13 @@ public class DatabaseManager extends SQLiteOpenHelper{
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_MANUAL_CURRENCIES + "("
+ KEY_CURRENCY_ID + " INTEGER PRIMARY KEY,"
+ KEY_CURRENCY_SYMBOL + " VARCHAR(4),"
+ KEY_CURRENCY_NAME + " VARCHAR(45),"
+ KEY_CURRENCY_BALANCE + " TEXT,"
+ KEY_CURRENCY_DATE + " TEXT,"
+ KEY_CURRENCY_PURCHASED_PRICE + " REAL,"
+ KEY_CURRENCY_IS_MINED + " INTEGER,"
+ KEY_CURRENCY_FEES + " REAL"
+ KEY_CURRENCY_FEES + " REAL,"
+ KEY_CURRENCY_NOTES + " TEXT,"
+ KEY_CURRENCY_FROM + " VARCHAR(4)"
+ ");");
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_EXCHANGE_KEYS + "("
@ -118,6 +121,44 @@ public class DatabaseManager extends SQLiteOpenHelper{
case 9:
db.execSQL("ALTER TABLE " + TABLE_EXCHANGE_KEYS
+ " ADD " + KEY_EXCHANGE_IS_ENABLED + " INTEGER");
case 10:
db.execSQL("CREATE TEMPORARY TABLE " + TABLE_MANUAL_CURRENCIES + "_back("
+ KEY_CURRENCY_ID + " INTEGER PRIMARY KEY,"
+ KEY_CURRENCY_SYMBOL + " VARCHAR(4),"
+ KEY_CURRENCY_BALANCE + " TEXT,"
+ KEY_CURRENCY_DATE + " TEXT,"
+ KEY_CURRENCY_PURCHASED_PRICE + " REAL,"
+ KEY_CURRENCY_IS_MINED + " INTEGER,"
+ KEY_CURRENCY_FEES + " REAL"
+ ");");
db.execSQL("INSERT INTO " + TABLE_MANUAL_CURRENCIES + "_back SELECT "
+ KEY_CURRENCY_ID + ","
+ KEY_CURRENCY_SYMBOL + ","
+ KEY_CURRENCY_BALANCE + ","
+ KEY_CURRENCY_DATE + ","
+ KEY_CURRENCY_PURCHASED_PRICE + ","
+ KEY_CURRENCY_IS_MINED + ","
+ KEY_CURRENCY_FEES + " FROM " + TABLE_MANUAL_CURRENCIES);
db.execSQL("DROP TABLE " + TABLE_MANUAL_CURRENCIES);
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_MANUAL_CURRENCIES + "("
+ KEY_CURRENCY_ID + " INTEGER PRIMARY KEY,"
+ KEY_CURRENCY_SYMBOL + " VARCHAR(4),"
+ KEY_CURRENCY_BALANCE + " TEXT,"
+ KEY_CURRENCY_DATE + " TEXT,"
+ KEY_CURRENCY_PURCHASED_PRICE + " REAL,"
+ KEY_CURRENCY_IS_MINED + " INTEGER,"
+ KEY_CURRENCY_FEES + " REAL"
+ ");");
db.execSQL("INSERT INTO " + TABLE_MANUAL_CURRENCIES + " SELECT * FROM " + TABLE_MANUAL_CURRENCIES + "_back");
db.execSQL("DROP TABLE " + TABLE_MANUAL_CURRENCIES + "_back");
case 11:
db.execSQL("ALTER TABLE " + TABLE_MANUAL_CURRENCIES
+ " ADD " + KEY_CURRENCY_NOTES + " TEXT");
case 12:
db.execSQL("ALTER TABLE " + TABLE_MANUAL_CURRENCIES
+ " ADD " + KEY_CURRENCY_FROM + " VARCHAR(4)");
db.execSQL("UPDATE " + TABLE_MANUAL_CURRENCIES
+ " SET " + KEY_CURRENCY_FROM + "= 'USD'");
}
}
@ -152,6 +193,23 @@ public class DatabaseManager extends SQLiteOpenHelper{
return false;
}
public void addTransaction(String symbol, Double amount, Date date, Double purchasedPrice, Double fees, String note, String symbolFrom)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_CURRENCY_SYMBOL, symbol);
values.put(KEY_CURRENCY_BALANCE, amount);
values.put(KEY_CURRENCY_DATE, date.getTime());
values.put(KEY_CURRENCY_PURCHASED_PRICE, purchasedPrice);
values.put(KEY_CURRENCY_FEES, fees);
values.put(KEY_CURRENCY_NOTES, note);
values.put(KEY_CURRENCY_FROM, symbolFrom);
db.insert(TABLE_MANUAL_CURRENCIES, null, values);
db.close();
}
public void updateWatchlistPosition(String symbol, int position)
{
SQLiteDatabase db = this.getWritableDatabase();
@ -397,7 +455,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
if(decrypt)
{
values.put(KEY_CURRENCY_SYMBOL, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_SYMBOL)));
values.put(KEY_CURRENCY_NAME, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_NAME)));
values.put(KEY_CURRENCY_BALANCE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_BALANCE)));
values.put(KEY_CURRENCY_DATE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_DATE)));
values.put(KEY_CURRENCY_PURCHASED_PRICE, DataCrypter.decrypt(context, rawValues.getString(KEY_CURRENCY_PURCHASED_PRICE)));
@ -407,7 +464,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
else
{
values.put(KEY_CURRENCY_SYMBOL, rawValues.getString(KEY_CURRENCY_SYMBOL));
values.put(KEY_CURRENCY_NAME, rawValues.getString(KEY_CURRENCY_NAME));
values.put(KEY_CURRENCY_BALANCE, rawValues.getString(KEY_CURRENCY_BALANCE));
values.put(KEY_CURRENCY_DATE, rawValues.getString(KEY_CURRENCY_DATE));
values.put(KEY_CURRENCY_PURCHASED_PRICE, rawValues.getString(KEY_CURRENCY_PURCHASED_PRICE));
@ -497,7 +553,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
while(resultatList.moveToNext())
{
currencyList.add(new Currency(resultatList.getString(1), resultatList.getDouble(3) - resultatList.getDouble(7)));
currencyList.add(new Currency(resultatList.getString(1), resultatList.getDouble(2) - resultatList.getDouble(6)));
}
resultatList.close();
@ -551,7 +607,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
while (resultatList.moveToNext())
{
transactionList.add(new Transaction(resultatList.getInt(0), resultatList.getString(1), resultatList.getDouble(3), resultatList.getLong(4), resultatList.getLong(5), resultatList.getDouble(7)));
transactionList.add(new Transaction(resultatList.getInt(0), resultatList.getString(1), resultatList.getDouble(2), resultatList.getLong(3), resultatList.getLong(4), resultatList.getDouble(6)));
}
resultatList.close();

View File

@ -68,7 +68,7 @@ public class BinanceManager extends Exchange {
if(Double.parseDouble(assets.get(i).getFree()) > 0 || Double.parseDouble(assets.get(i).getLocked()) > 0)
{
//balance.add(new Currency(assets.get(i).getAsset(), Double.parseDouble(assets.get(i).getFree()) + Double.parseDouble(assets.get(i).getLocked())));
if(!assets.get(i).getAsset().equals("VET"))
if(!assets.get(i).getAsset().equals("VEN"))
{
balance.add(new Currency(assets.get(i).getAsset(), Double.parseDouble(assets.get(i).getFree()) + Double.parseDouble(assets.get(i).getLocked())));
}

View File

@ -38,31 +38,6 @@ public class PreferencesManager {
return settingPreferences.getString("default_currency", "USD");
}
public String getHitBTCPublicKey()
{
return settingPreferences.getString("hitbtc_publickey", null);
}
public String getHitBTCPrivateKey()
{
return settingPreferences.getString("hitbtc_privatekey", null);
}
public String getBinancePublicKey()
{
return settingPreferences.getString("binance_publickey", null);
}
public String getBinancePrivateKey()
{
return settingPreferences.getString("binance_privatekey", null);
}
public boolean isHitBTCActivated()
{
return settingPreferences.getBoolean("enable_hitbtc", false);
}
public boolean switchBalanceHiddenState()
{
SharedPreferences.Editor editor = settingPreferences.edit();

View File

@ -4,6 +4,9 @@ import android.content.Context;
import com.herbron.moodl.DataManagers.PreferencesManager;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Tiji on 19/04/2018.
*/
@ -34,6 +37,16 @@ public class PlaceholderManager {
return formattedString;
}
public static List<String> getFeeOptionsForSymbol(String symbol, Context context)
{
List<String> options = new ArrayList<>();
options.add(context.getResources().getString(R.string.fixedFee, symbol));
options.add(context.getResources().getString(R.string.percentageFee, symbol));
return options;
}
public static String getPairString(String pair1, String pair2, Context context)
{
return context.getResources().getString(R.string.pairPlaceholder, pair1, pair2);

View File

@ -0,0 +1,10 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:fillAfter="true">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="200%"
android:duration="400" />
</set>

View File

@ -0,0 +1,10 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:fillAfter="true">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="200%" android:toYDelta="0%"
android:duration="400"/>
</set>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<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>
</layer-list>

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="M7,14l5,-5 5,5z"/>
</vector>

View File

@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<corners android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<solid android:color="@color/increaseCandle"/>
</shape>
</item>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/increaseCandle"/>
<item android:state_selected="false" android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:topRightRadius="5dp"
android:topLeftRadius="5dp"/>
<solid android:color="@color/hardWhite"/>
</shape>
</item>
</selector>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<corners android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<solid android:color="@color/decreaseCandle"/>
</shape>
</item>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/decreaseCandle"/>
<item android:state_selected="false" android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:topRightRadius="5dp"
android:topLeftRadius="5dp"/>
<solid android:color="@color/hardWhite"/>
</shape>
</item>
</selector>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
</layer-list>

View File

@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<corners android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<solid android:color="@color/blue"/>
</shape>
</item>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/blue"/>
<item android:state_selected="false" android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:topRightRadius="5dp"
android:topLeftRadius="5dp"/>
<solid android:color="@color/hardWhite"/>
</shape>
</item>
</selector>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
</layer-list>

View File

@ -111,11 +111,13 @@
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="@+id/globalTabLayouts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/double_toolbarSpinner_size"
android:paddingTop="5dp"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="invisible">
<com.herbron.moodl.CustomLayouts.CustomTabLayout
android:id="@+id/transactionsTabLayout"

View File

@ -19,6 +19,7 @@
android:id="@+id/amount_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="@string/activity_add_amount"/>
</android.support.design.widget.TextInputLayout>
@ -26,7 +27,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_buyPrice"
@ -38,6 +40,7 @@
android:id="@+id/buyPrice_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="@string/activity_purchase_price"/>
</android.support.design.widget.TextInputLayout>
@ -68,6 +71,7 @@
android:id="@+id/totalValue_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="@string/total_value"/>
</android.support.design.widget.TextInputLayout>
@ -81,21 +85,22 @@
android:id="@+id/input_fees"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.15">
android:layout_weight="0.7">
<android.support.design.widget.TextInputEditText
android:id="@+id/fees_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="@string/activity_fees"/>
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="@+id/feesUnit_Spinner"
android:id="@+id/feesCurrency_editText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.85"/>
android:layout_weight="1"/>
</LinearLayout>
@ -116,7 +121,7 @@
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/saveExchangeButton"
android:id="@+id/saveBuyButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"

View File

@ -16,7 +16,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_moodl"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"/>
<TextView
@ -42,7 +41,7 @@
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="20sp"
android:text="Total portfolio value :"/>
android:text="@string/total_portfolio_value"/>
<TextView
android:id="@+id/balanceTextView"
@ -54,12 +53,4 @@
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/totalValueDrawer"
android:textColor="@color/white"
android:textSize="20sp"/>
</LinearLayout>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@android:drawable/ic_menu_search"
android:title="Search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="ifRoom|collapseActionView" />
</menu>

View File

@ -153,4 +153,8 @@
<string name="notes">Notes</string>
<string name="select_exchange">Sélectionner un échange</string>
<string name="select_pair">Paire</string>
<string name="total_portfolio_value">Valeur totale :</string>
<string name="fixedFee">Pourcentage de %1$s</string>
<string name="percentageFee">%1$s fixe</string>
</resources>

View File

@ -268,5 +268,9 @@
<string name="notes">Notes</string>
<string name="select_exchange">Select an exchange</string>
<string name="select_pair">Pair</string>
<string name="total_portfolio_value">Total portfolio value :</string>
<string name="fixedFee">%1$s percentage</string>
<string name="percentageFee">%1$s fixed</string>
</resources>

View File

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