Exchange config rework
- Fix crash when binance sync error - New exchange list UI - New exchange configuration UI - Fix gradient background for Settings activity The new exchange configuration interface allows you to add (it should work) multiple accounts for each exchange If an account's keys are incorrect, the account and disabled and it's notified in the exchange list You can edit the exchange account later from the exchange list activity
This commit is contained in:
parent
af2eeed241
commit
380716f7ea
10
.idea/assetWizardSettings.xml
generated
10
.idea/assetWizardSettings.xml
generated
@ -3,6 +3,11 @@
|
||||
<component name="WizardSettings">
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="imageWizard">
|
||||
<value>
|
||||
<PersistentState />
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="vectorWizard">
|
||||
<value>
|
||||
<PersistentState>
|
||||
@ -18,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/image/ic_panorama_fish_eye_black_24dp.xml" />
|
||||
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/editor/ic_money_off_black_24dp.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
@ -28,7 +33,8 @@
|
||||
</option>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="outputName" value="ic_panorama_fish_eye_24dp" />
|
||||
<entry key="color" value="ffffff" />
|
||||
<entry key="outputName" value="ic_money_off_24dp" />
|
||||
<entry key="sourceFile" value="C:\Users\Guitoune" />
|
||||
</map>
|
||||
</option>
|
||||
|
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -12,6 +12,10 @@ android {
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
additionalParameters "--no-version-vectors"
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
@ -34,12 +38,12 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||
implementation 'com.mcxiaoke.volley:library:1.0.19'
|
||||
implementation 'com.diogobernardino:williamchart:2.5.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:palette-v7:27.1.1'
|
||||
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
|
||||
@ -61,5 +65,5 @@ dependencies {
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
|
||||
implementation files('../libs/binance-api.jar')
|
||||
implementation files('../libs/commons-codec-1.11.jar');
|
||||
implementation files('../libs/commons-codec-1.11.jar')
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
<activity
|
||||
android:name=".Activities.RecordTransactionActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/RecordTransactionTheme">
|
||||
android:theme="@style/InputActivityTheme">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.herbron.moodl.Activities.HomeActivity" />
|
||||
@ -56,6 +56,12 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.herbron.moodl.Activities.HomeActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".Activities.ExchangeListActivity"
|
||||
android:label="@string/title_activity_exchange_list"
|
||||
android:theme="@style/InputActivityTheme"/>
|
||||
<activity android:name=".Activities.AddExchangeActivity"
|
||||
android:theme="@style/InputActivityTheme"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,173 @@
|
||||
package com.herbron.moodl.Activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.design.widget.TextInputEditText;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.herbron.moodl.DataManagers.DatabaseManager;
|
||||
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
|
||||
import com.herbron.moodl.R;
|
||||
|
||||
public class AddExchangeActivity extends AppCompatActivity {
|
||||
|
||||
private LinearLayout setupExchangeLayout;
|
||||
private Spinner exchangeSpinner;
|
||||
private DatabaseManager databaseManager;
|
||||
|
||||
private TextInputEditText accountLabelEditText;
|
||||
private TextInputEditText accountDescriptionEditText;
|
||||
private TextInputEditText publicKeyEditText;
|
||||
private TextInputEditText secretKeyEditText;
|
||||
private AppCompatButton saveExchangeButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_add_exchange);
|
||||
getApplicationContext().setTheme(R.style.InputActivityTheme);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
databaseManager = new DatabaseManager(getBaseContext());
|
||||
|
||||
exchangeSpinner = findViewById(R.id.exchange_spinner);
|
||||
|
||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
|
||||
R.array.supported_exchanges, R.layout.exchange_spinner_item);
|
||||
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
setupExchangeLayout = findViewById(R.id.exchange_setup_layout);
|
||||
|
||||
exchangeSpinner.setAdapter(adapter);
|
||||
|
||||
Intent callingIntent = getIntent();
|
||||
|
||||
if(callingIntent.getBooleanExtra("isEdit", false))
|
||||
{
|
||||
startExchangeEditionForId(callingIntent.getIntExtra("exchangeId", -1));
|
||||
}
|
||||
else
|
||||
{
|
||||
exchangeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
loadLayoutFor(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupBackButton();
|
||||
}
|
||||
|
||||
private void loadLayoutFor(int exchangeType)
|
||||
{
|
||||
setupExchangeLayout.removeAllViews();
|
||||
|
||||
switch (exchangeType)
|
||||
{
|
||||
case DatabaseManager.BINANCE_TYPE:
|
||||
setupExchangeLayout = (LinearLayout) LayoutInflater.from(getApplicationContext()).inflate(R.layout.binance_exchange_setup_layout, setupExchangeLayout, true);
|
||||
|
||||
bindSetupViews();
|
||||
break;
|
||||
case DatabaseManager.HITBTC_TYPE:
|
||||
setupExchangeLayout = (LinearLayout) LayoutInflater.from(getApplicationContext()).inflate(R.layout.hitbtc_exchange_setup_layout, setupExchangeLayout, true);
|
||||
|
||||
bindSetupViews();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void startExchangeEditionForId(int exchangeId)
|
||||
{
|
||||
Exchange exchangeInfos = databaseManager.getExchangeFromId(exchangeId);
|
||||
|
||||
loadLayoutFor(exchangeInfos.getType());
|
||||
|
||||
exchangeSpinner.setEnabled(false);
|
||||
|
||||
accountLabelEditText.setText(exchangeInfos.getName());
|
||||
accountDescriptionEditText.setText(exchangeInfos.getDescription());
|
||||
publicKeyEditText.setText(exchangeInfos.getPublicKey());
|
||||
secretKeyEditText.setText(exchangeInfos.getPrivateKey());
|
||||
|
||||
saveExchangeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
||||
{
|
||||
databaseManager.deleteExchangeAccountFromId(exchangeInfos.getId());
|
||||
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
||||
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
||||
, secretKeyEditText.getText().toString());
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void bindSetupViews()
|
||||
{
|
||||
accountLabelEditText = findViewById(R.id.account_label_editText);
|
||||
accountDescriptionEditText = findViewById(R.id.account_description_editText);
|
||||
publicKeyEditText = findViewById(R.id.publicKey_editText);
|
||||
secretKeyEditText = findViewById(R.id.secretKey_editText);
|
||||
|
||||
saveExchangeButton = findViewById(R.id.saveExchangeButton);
|
||||
|
||||
saveExchangeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(isEditTextFilled(accountLabelEditText) && isEditTextFilled(publicKeyEditText) && isEditTextFilled(secretKeyEditText))
|
||||
{
|
||||
databaseManager.addExchange(accountLabelEditText.getText().toString(), exchangeSpinner.getSelectedItemPosition()
|
||||
, accountDescriptionEditText.getText().toString(), publicKeyEditText.getText().toString()
|
||||
, secretKeyEditText.getText().toString());
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isEditTextFilled(TextInputEditText editText)
|
||||
{
|
||||
if(editText.getText().toString().equals("") || editText.getText().toString().equals(" "))
|
||||
{
|
||||
editText.setError(getResources().getString(R.string.must_be_filled));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setupBackButton()
|
||||
{
|
||||
ImageButton backButton = findViewById(R.id.back_button);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ public class Transactions extends Fragment {
|
||||
|
||||
currency = getActivity().getIntent().getParcelableExtra("currency");
|
||||
databaseManager = new DatabaseManager(getContext());
|
||||
binanceManager = new BinanceManager(preferencesManager.getBinancePublicKey(), preferencesManager.getBinancePrivateKey());
|
||||
//binanceManager = new BinanceManager(preferencesManager.getBinancePublicKey(), preferencesManager.getBinancePrivateKey());
|
||||
tradeLayout = view.findViewById(R.id.listTrades);
|
||||
transactionLayout = view.findViewById(R.id.listTransactions);
|
||||
|
||||
@ -63,8 +63,8 @@ public class Transactions extends Fragment {
|
||||
TransactionUpdater transactionUpdater = new TransactionUpdater();
|
||||
transactionUpdater.execute();
|
||||
|
||||
TradeUpdater updater = new TradeUpdater();
|
||||
updater.execute();
|
||||
/*TradeUpdater updater = new TradeUpdater();
|
||||
updater.execute();*/
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.herbron.moodl.Activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
@ -24,6 +25,7 @@ public class ExchangeListActivity extends AppCompatActivity {
|
||||
|
||||
private DatabaseManager databaseManager;
|
||||
private ListView exchangeListView;
|
||||
private ExchangeListAdapter exchangeListAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -37,11 +39,7 @@ public class ExchangeListActivity extends AppCompatActivity {
|
||||
|
||||
databaseManager = new DatabaseManager(this);
|
||||
|
||||
ArrayList<Exchange> exchangeList = new ArrayList<>();
|
||||
exchangeList.add(new Exchange(0, "Main account", BINANCE_TYPE, "Account with main balance & trading bot", "0000", "0000"));
|
||||
exchangeList.add(new Exchange(1, "Hit account", HITBTC_TYPE, "BCN account and HIT", "0001", "0001"));
|
||||
|
||||
ExchangeListAdapter exchangeListAdapter = new ExchangeListAdapter(getApplicationContext(), exchangeList);
|
||||
exchangeListAdapter = new ExchangeListAdapter(getApplicationContext(), databaseManager.getExchanges());
|
||||
|
||||
exchangeListView = findViewById(R.id.exchange_listView);
|
||||
exchangeListView.setAdapter(exchangeListAdapter);
|
||||
@ -50,12 +48,21 @@ public class ExchangeListActivity extends AppCompatActivity {
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
Intent intent = new Intent(ExchangeListActivity.this, AddExchangeActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
exchangeListAdapter.clear();
|
||||
exchangeListAdapter.addAll(databaseManager.getExchanges());
|
||||
exchangeListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
@ -585,7 +585,12 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
||||
@Override
|
||||
public void onBalanceError(String error)
|
||||
{
|
||||
generateSnackBarError(error);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
generateSnackBarError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void generateSnackBarError(String error)
|
||||
|
@ -10,6 +10,8 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -179,6 +181,10 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||
// Show the Up button in the action bar.
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
Drawable gradientDrawable = getResources().getDrawable(R.drawable.gradient_background);
|
||||
|
||||
actionBar.setBackgroundDrawable(gradientDrawable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,14 +26,6 @@ import java.util.List;
|
||||
|
||||
public class BalanceManager {
|
||||
|
||||
private String publicHitKey;
|
||||
private String publicBinanceKey;
|
||||
private String publicPoloniex;
|
||||
private String privateHitKey;
|
||||
private String privateBinanceKey;
|
||||
private String privatePoloniex;
|
||||
final private String hitBalanceUrl = "https://api.hitbtc.com/api/2/trading/balance";
|
||||
final private String detailUrl = "https://www.cryptocompare.com/api/data/coinlist/";
|
||||
private RequestQueue requestQueue;
|
||||
private List<Currency> binanceBalance;
|
||||
private List<Currency> hitBalance;
|
||||
@ -103,6 +95,8 @@ public class BalanceManager {
|
||||
binanceManagers.clear();
|
||||
|
||||
binanceManagers = databaseManager.getBinanceAccounts();
|
||||
|
||||
Log.d("moodl", "Number of binance accounts " + binanceManagers.size());
|
||||
}
|
||||
|
||||
public List<Currency> getTotalBalance()
|
||||
@ -113,6 +107,8 @@ public class BalanceManager {
|
||||
public void updateTotalBalance()
|
||||
{
|
||||
boolean isUpdated = false;
|
||||
|
||||
updateExchangeKeys();
|
||||
|
||||
balanceCounter = 0;
|
||||
|
||||
@ -124,6 +120,7 @@ public class BalanceManager {
|
||||
|
||||
for(int i = 0; i < binanceManagers.size(); i++)
|
||||
{
|
||||
final int index = i;
|
||||
binanceManagers.get(i).updateBalance(new BinanceManager.BinanceCallBack() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@ -132,6 +129,7 @@ public class BalanceManager {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
databaseManager.disableExchangeAccount(binanceManagers.get(index).getId());
|
||||
dataNotifierInterface.onBalanceError(error);
|
||||
}
|
||||
});
|
||||
@ -298,6 +296,8 @@ public class BalanceManager {
|
||||
currencyName = jsonObject.getString("CoinName");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
currencyName = symbol;
|
||||
}
|
||||
|
||||
return currencyName;
|
||||
@ -312,6 +312,8 @@ public class BalanceManager {
|
||||
id = jsonObject.getInt("Id");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
id = -1;
|
||||
}
|
||||
|
||||
return id;
|
||||
|
@ -10,6 +10,7 @@ import android.util.Log;
|
||||
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
|
||||
import com.herbron.moodl.DataManagers.CurrencyData.Transaction;
|
||||
import com.herbron.moodl.DataManagers.ExchangeManager.BinanceManager;
|
||||
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
|
||||
import com.herbron.moodl.DataManagers.ExchangeManager.HitBtcManager;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@ -28,7 +29,7 @@ import java.util.List;
|
||||
|
||||
public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
private static final int DATABASE_VERSION = 8;
|
||||
private static final int DATABASE_VERSION = 10;
|
||||
|
||||
private static final String DATABASE_NAME = "Currencies.db";
|
||||
|
||||
@ -51,14 +52,15 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
private static final String KEY_EXCHANGE_DESCRIPTION = "description";
|
||||
private static final String KEY_EXCHANGE_PUBLIC_KEY = "publicKey";
|
||||
private static final String KEY_EXCHANGE_SECRET_KEY = "secretKey";
|
||||
private static final String KEY_EXCHANGE_IS_ENABLED = "enabled";
|
||||
|
||||
private static final String KEY_WATCHLIST_ID = "idWatchlist";
|
||||
private static final String KEY_WATCHLIST_SYMBOL = "symbol";
|
||||
private static final String KEY_WATCHLIST_NAME = "name";
|
||||
private static final String KEY_WATCHLIST_POSITION = "position";
|
||||
|
||||
private static final int BINANCE_TYPE = 0;
|
||||
private static final int HITBTC_TYPE = 1;
|
||||
public static final int BINANCE_TYPE = 0;
|
||||
public static final int HITBTC_TYPE = 1;
|
||||
|
||||
public DatabaseManager(Context context)
|
||||
{
|
||||
@ -81,11 +83,12 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_EXCHANGE_KEYS + "("
|
||||
+ KEY_EXCHANGE_ID + " INTEGER PRIMARY KEY,"
|
||||
+ KEY_EXCHANGE_TYPE + " INTEGER,"
|
||||
+ KEY_EXCHANGE_NAME + " TEXT,"
|
||||
+ KEY_EXCHANGE_TYPE + " INTEGER,"
|
||||
+ KEY_EXCHANGE_DESCRIPTION + " TEXT,"
|
||||
+ KEY_EXCHANGE_PUBLIC_KEY + " TEXT,"
|
||||
+ KEY_EXCHANGE_SECRET_KEY + " TEXT"
|
||||
+ KEY_EXCHANGE_SECRET_KEY + " TEXT,"
|
||||
+ KEY_EXCHANGE_IS_ENABLED + " INTEGER"
|
||||
+ ");");
|
||||
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_WATCHLIST + "("
|
||||
@ -109,6 +112,12 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
case 7:
|
||||
db.execSQL("ALTER TABLE " + TABLE_EXCHANGE_KEYS
|
||||
+ " ADD " + KEY_EXCHANGE_TYPE + " INTEGER");
|
||||
case 8:
|
||||
db.execSQL("DROP TABLE " + TABLE_EXCHANGE_KEYS);
|
||||
onCreate(db);
|
||||
case 9:
|
||||
db.execSQL("ALTER TABLE " + TABLE_EXCHANGE_KEYS
|
||||
+ " ADD " + KEY_EXCHANGE_IS_ENABLED + " INTEGER");
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +160,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
cv.put(KEY_WATCHLIST_POSITION, position);
|
||||
|
||||
db.update(TABLE_WATCHLIST, cv, KEY_WATCHLIST_SYMBOL + "='" + symbol + "'", null);
|
||||
|
||||
}
|
||||
|
||||
private int getWatchlistRowCount(SQLiteDatabase db)
|
||||
@ -164,6 +172,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
return result.getInt(0);
|
||||
}
|
||||
|
||||
public void deleteExchangeAccountFromId(int id)
|
||||
{
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
db.delete(TABLE_EXCHANGE_KEYS, KEY_EXCHANGE_ID + " = " + id, null);
|
||||
db.close();
|
||||
}
|
||||
|
||||
public void deleteCurrencyFromWatchlist(String symbol)
|
||||
{
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
@ -172,6 +188,70 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
db.close();
|
||||
}
|
||||
|
||||
public void disableExchangeAccount(int id)
|
||||
{
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
ContentValues cv = new ContentValues();
|
||||
|
||||
cv.put(KEY_EXCHANGE_IS_ENABLED, 0);
|
||||
|
||||
db.update(TABLE_EXCHANGE_KEYS, cv, KEY_EXCHANGE_ID + "='" + id + "'", null);
|
||||
}
|
||||
|
||||
public Exchange getExchangeFromId(int exchangeId)
|
||||
{
|
||||
String selectQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_ID + " = " + exchangeId;
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor result = db.rawQuery(selectQuerry, null);
|
||||
|
||||
Exchange selectedExchange = null;
|
||||
|
||||
if(result.moveToFirst())
|
||||
{
|
||||
selectedExchange = new Exchange(result.getInt(0), result.getString(1)
|
||||
, result.getInt(2), result.getString(3)
|
||||
, result.getString(4), result.getString(5)
|
||||
, (result.getInt(6) == 1));
|
||||
}
|
||||
|
||||
return selectedExchange;
|
||||
}
|
||||
|
||||
public ArrayList<Exchange> getExchanges()
|
||||
{
|
||||
String selectQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS;
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor result = db.rawQuery(selectQuerry, null);
|
||||
|
||||
ArrayList<Exchange> exchanges = new ArrayList<>();
|
||||
|
||||
while(result.moveToNext())
|
||||
{
|
||||
exchanges.add(new Exchange(result.getInt(0), result.getString(1)
|
||||
, result.getInt(2), result.getString(3)
|
||||
, result.getString(4), result.getString(5)
|
||||
, (result.getInt(6) == 1)));
|
||||
}
|
||||
|
||||
return exchanges;
|
||||
}
|
||||
|
||||
public void addExchange(String name, int type, String description, String publicKey, String privateKey)
|
||||
{
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
values.put(KEY_EXCHANGE_NAME, name);
|
||||
values.put(KEY_EXCHANGE_TYPE, type);
|
||||
values.put(KEY_EXCHANGE_DESCRIPTION, description);
|
||||
values.put(KEY_EXCHANGE_PUBLIC_KEY, publicKey);
|
||||
values.put(KEY_EXCHANGE_SECRET_KEY, privateKey);
|
||||
values.put(KEY_EXCHANGE_IS_ENABLED, 1);
|
||||
|
||||
db.insert(TABLE_EXCHANGE_KEYS, null, values);
|
||||
db.close();
|
||||
}
|
||||
|
||||
public JSONArray getDatabaseBackup(Context context, String table, boolean encryptData)
|
||||
{
|
||||
String selectQuerry = "SELECT * FROM " + table;
|
||||
@ -346,7 +426,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
public List<HitBtcManager> getHitBtcAccounts(Context context)
|
||||
{
|
||||
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + HITBTC_TYPE + "'";
|
||||
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + HITBTC_TYPE + "' AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'";
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor resultList = db.rawQuery(searchQuerry, null);
|
||||
|
||||
@ -354,7 +434,11 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
while(resultList.moveToNext())
|
||||
{
|
||||
accountList.add(new HitBtcManager(context, resultList.getString(4), resultList.getString(5)));
|
||||
Exchange exchange = new Exchange(resultList.getInt(0), resultList.getString(1)
|
||||
, resultList.getInt(2), resultList.getString(3)
|
||||
, resultList.getString(4), resultList.getString(5)
|
||||
, (resultList.getInt(6) == 1));
|
||||
accountList.add(new HitBtcManager(context, exchange));
|
||||
}
|
||||
|
||||
resultList.close();
|
||||
@ -365,7 +449,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
public List<BinanceManager> getBinanceAccounts()
|
||||
{
|
||||
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + BINANCE_TYPE + "'";
|
||||
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + BINANCE_TYPE + "' AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'";
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
Cursor resultList = db.rawQuery(searchQuerry, null);
|
||||
|
||||
@ -373,7 +457,11 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
||||
|
||||
while(resultList.moveToNext())
|
||||
{
|
||||
accountList.add(new BinanceManager(resultList.getString(4), resultList.getString(5)));
|
||||
Exchange exchange = new Exchange(resultList.getInt(0), resultList.getString(1)
|
||||
, resultList.getInt(2), resultList.getString(3)
|
||||
, resultList.getString(4), resultList.getString(5)
|
||||
, (resultList.getInt(6) == 1));
|
||||
accountList.add(new BinanceManager(exchange));
|
||||
}
|
||||
|
||||
resultList.close();
|
||||
|
@ -17,19 +17,15 @@ import java.util.List;
|
||||
* Created by Guitoune on 26/02/2018.
|
||||
*/
|
||||
|
||||
public class BinanceManager {
|
||||
|
||||
private String publicKey;
|
||||
private String privateKey;
|
||||
public class BinanceManager extends Exchange {
|
||||
|
||||
private List<Currency> balance;
|
||||
private ArrayList<com.herbron.moodl.DataManagers.CurrencyData.Trade> trades;
|
||||
private List<String> pairSymbolList;
|
||||
private static List<String> pairSymbolList;
|
||||
|
||||
public BinanceManager(String publicKey, String privateKey)
|
||||
public BinanceManager(Exchange exchange)
|
||||
{
|
||||
this.publicKey = publicKey;
|
||||
this.privateKey = privateKey;
|
||||
super(exchange.id, exchange.name, exchange.type, exchange.description, exchange.publicKey, exchange.privateKey, exchange.isEnabled);
|
||||
|
||||
createPairSymbolList();
|
||||
}
|
||||
|
@ -8,8 +8,9 @@ public class Exchange {
|
||||
protected String description;
|
||||
protected String publicKey;
|
||||
protected String privateKey;
|
||||
protected boolean isEnabled;
|
||||
|
||||
public Exchange(int id, String name, int type, String description, String publicKey, String privateKey)
|
||||
public Exchange(int id, String name, int type, String description, String publicKey, String privateKey, boolean isEnabled)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -17,6 +18,27 @@ public class Exchange {
|
||||
this.description = description;
|
||||
this.publicKey = publicKey;
|
||||
this.privateKey = privateKey;
|
||||
this.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
public String getPublicKey()
|
||||
{
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey()
|
||||
{
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
public int getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
@ -28,4 +50,9 @@ public class Exchange {
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,8 @@ import java.util.Map;
|
||||
* Created by Guitoune on 26/02/2018.
|
||||
*/
|
||||
|
||||
public class HitBtcManager {
|
||||
public class HitBtcManager extends Exchange {
|
||||
|
||||
private String publicKey;
|
||||
private String privateKey;
|
||||
final private String hitBalanceUrl = "https://api.hitbtc.com/api/2/account/balance";
|
||||
final private String hitTradingBalanceUrl = "https://api.hitbtc.com/api/2/trading/balance";
|
||||
final private String tradeHistoryUrl = "https://api.hitbtc.com/api/2/history/trades?";
|
||||
@ -41,13 +39,12 @@ public class HitBtcManager {
|
||||
private List<Currency> balance;
|
||||
private android.content.Context context;
|
||||
|
||||
public HitBtcManager(android.content.Context context, String publicKey, String privateKey)
|
||||
public HitBtcManager(android.content.Context context, Exchange exchange)
|
||||
{
|
||||
super(exchange.id, exchange.name, exchange.type, exchange.description, exchange.publicKey, exchange.privateKey, exchange.isEnabled);
|
||||
|
||||
this.context = context;
|
||||
requestQueue = Volley.newRequestQueue(context);
|
||||
|
||||
this.publicKey = publicKey;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
private void createPairSymbolList()
|
||||
|
@ -68,7 +68,7 @@ public class CurrencyListAdapter extends BaseAdapter implements Filterable {
|
||||
}
|
||||
|
||||
if (position % 2 == 0)
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.listBackground2));
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.white));
|
||||
else
|
||||
convertView.setBackgroundColor(context.getResources().getColor(R.color.listBackground));
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.herbron.moodl.LayoutManagers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
@ -12,9 +13,13 @@ import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.herbron.moodl.Activities.AddExchangeActivity;
|
||||
import com.herbron.moodl.Activities.ExchangeListActivity;
|
||||
import com.herbron.moodl.DataManagers.CurrencyData.Currency;
|
||||
import com.herbron.moodl.DataManagers.CurrencyData.Trade;
|
||||
import com.herbron.moodl.DataManagers.DatabaseManager;
|
||||
import com.herbron.moodl.DataManagers.ExchangeManager.Exchange;
|
||||
import com.herbron.moodl.MoodlBox;
|
||||
import com.herbron.moodl.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -28,6 +33,7 @@ public class ExchangeListAdapter extends ArrayAdapter<Exchange> {
|
||||
public ExchangeListAdapter(Context context, ArrayList<Exchange> exchanges)
|
||||
{
|
||||
super(context, android.R.layout.simple_list_item_1, exchanges);
|
||||
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@ -41,12 +47,38 @@ public class ExchangeListAdapter extends ArrayAdapter<Exchange> {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.exchange_cell, parent, false);
|
||||
}
|
||||
|
||||
final View finalConvertView = convertView;
|
||||
|
||||
TextView exchangeNameTextView = convertView.findViewById(R.id.exchange_name);
|
||||
TextView exchangeDescriptionTextView = convertView.findViewById(R.id.exchange_description);
|
||||
|
||||
exchangeNameTextView.setText(exchange.getName());
|
||||
exchangeDescriptionTextView.setText(exchange.getDescription());
|
||||
|
||||
if(!exchange.isEnabled())
|
||||
{
|
||||
convertView.findViewById(R.id.exchange_account_off_imageView).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
convertView.findViewById(R.id.editExchangeInfosLayout).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent editExchangeAccountIntent = new Intent(context, AddExchangeActivity.class);
|
||||
editExchangeAccountIntent.putExtra("isEdit", true);
|
||||
editExchangeAccountIntent.putExtra("exchangeId", exchange.getId());
|
||||
context.startActivity(editExchangeAccountIntent);
|
||||
}
|
||||
});
|
||||
|
||||
convertView.findViewById(R.id.deleteExchangeInfosLayout).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DatabaseManager databaseManager = new DatabaseManager(getContext());
|
||||
databaseManager.deleteExchangeAccountFromId(exchange.getId());
|
||||
MoodlBox.collapseH(finalConvertView);
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
5
app/src/main/res/drawable/ic_add_white_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_add_white_24dp.xml
Normal 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="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
@ -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,10l5,5 5,-5z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/ic_money_off_24dp.xml
Normal file
5
app/src/main/res/drawable/ic_money_off_24dp.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
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="M12.5,6.9c1.78,0 2.44,0.85 2.5,2.1h2.21c-0.07,-1.72 -1.12,-3.3 -3.21,-3.81V3h-3v2.16c-0.53,0.12 -1.03,0.3 -1.48,0.54l1.47,1.47c0.41,-0.17 0.91,-0.27 1.51,-0.27zM5.33,4.06L4.06,5.33 7.5,8.77c0,2.08 1.56,3.21 3.91,3.91l3.51,3.51c-0.34,0.48 -1.05,0.91 -2.42,0.91 -2.06,0 -2.87,-0.92 -2.98,-2.1h-2.2c0.12,2.19 1.76,3.42 3.68,3.83V21h3v-2.15c0.96,-0.18 1.82,-0.55 2.45,-1.12l2.22,2.22 1.27,-1.27L5.33,4.06z"/>
|
||||
</vector>
|
21
app/src/main/res/drawable/spinner_background.xml
Normal file
21
app/src/main/res/drawable/spinner_background.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/softWhite"/>
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="5dp"
|
||||
android:topRightRadius="5dp"/>
|
||||
<padding
|
||||
android:left="3dp"
|
||||
android:right="3dp"
|
||||
android:top="3dp"
|
||||
android:bottom="3dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:gravity="center_vertical|right"
|
||||
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
|
||||
</layer-list>
|
74
app/src/main/res/layout/activity_add_exchange.xml
Normal file
74
app/src/main/res/layout/activity_add_exchange.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/gradient_background"
|
||||
style="@style/InputActivityTheme">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="125dp"
|
||||
app:layout_collapseMode="pin"
|
||||
app:elevation="0dp"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
app:layout_collapseMode="pin">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="@drawable/ic_arrow_back_white_24dp"
|
||||
android:text="@string/action_settings"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/title_add_exchange"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
</FrameLayout>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/exchange_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="22dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/spinner_background"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exchange_setup_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="125dp"
|
||||
android:background="@drawable/list_background"
|
||||
android:paddingTop="5dp"
|
||||
android:orientation="vertical"/>
|
||||
</android.support.constraint.ConstraintLayout>
|
93
app/src/main/res/layout/binance_exchange_setup_layout.xml
Normal file
93
app/src/main/res/layout/binance_exchange_setup_layout.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/InputActivityTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/informations"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textColor="@color/mainTextViewColor"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/separationLineSize"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/separationColor" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_account_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/account_label_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/account_label"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/account_description_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/description"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_publicKey"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/publicKey_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/apiKey"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_secretKey"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/secretKey_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/secretKey"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/saveExchangeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/save"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
style="@style/Widget.AppCompat.Button.Colored"/>
|
||||
|
||||
</RelativeLayout>
|
@ -40,7 +40,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/mainTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencySymbolTextView"
|
||||
@ -49,7 +49,7 @@
|
||||
android:layout_marginStart="2dp"
|
||||
android:gravity="left"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencyValueTextView"
|
||||
@ -57,7 +57,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
@ -88,7 +88,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/mainTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencyValueOwnedTextView"
|
||||
@ -97,7 +97,7 @@
|
||||
android:layout_marginStart="2dp"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -112,13 +112,13 @@
|
||||
android:id="@+id/currencyFluctuationPercentageTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencyFluctuationTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -143,7 +143,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/day_history"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -60,7 +60,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/mainTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencySymbolTextView"
|
||||
@ -70,7 +70,7 @@
|
||||
android:layout_marginLeft="2dp"
|
||||
android:gravity="left"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/secondaryTextViewColor"
|
||||
android:textSize="@dimen/cardViewMainText"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:layout_weight="0.5"/>
|
||||
|
||||
<LinearLayout
|
||||
@ -101,13 +101,13 @@
|
||||
android:id="@+id/currencyFluctuationPercentageTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewMainText" />
|
||||
android:textSize="@dimen/cardViewTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/currencyFluctuationTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -154,7 +154,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/day_history"
|
||||
android:textSize="@dimen/cardViewSecondaryText" />
|
||||
android:textSize="@dimen/cardViewCaption" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1,41 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_margin="@dimen/margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/exchange_icon_imageView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginEnd="@dimen/margin"/>
|
||||
|
||||
<LinearLayout
|
||||
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/swipeLayout">
|
||||
<!-- Bottom View Start-->
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_wrapper"
|
||||
android:layout_width="100dp"
|
||||
android:weightSum="1"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<!--What you want to show-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exchange_name"
|
||||
<LinearLayout
|
||||
android:id="@+id/editExchangeInfosLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/green">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_edit_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/deleteExchangeInfosLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:background="@color/red">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_delete_white_24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:textColor="@color/mainTextViewColor"/>
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exchange_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewCaption"
|
||||
android:textColor="@color/captionColor"/>
|
||||
<ImageView
|
||||
android:id="@+id/exchange_icon_imageView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginEnd="@dimen/margin"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toEndOf="@id/exchange_icon_imageView"
|
||||
android:layout_toStartOf="@id/exchange_account_off_imageView"
|
||||
android:gravity="center_vertical"
|
||||
android:foregroundGravity="center_vertical">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/exchange_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:textColor="@color/mainTextViewColor"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exchange_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/cardViewCaption"
|
||||
android:textColor="@color/captionColor"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/exchange_account_off_imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ic_money_off_24dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</com.daimajia.swipe.SwipeLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
9
app/src/main/res/layout/exchange_spinner_item.xml
Normal file
9
app/src/main/res/layout/exchange_spinner_item.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:padding="10dp"
|
||||
/>
|
93
app/src/main/res/layout/hitbtc_exchange_setup_layout.xml
Normal file
93
app/src/main/res/layout/hitbtc_exchange_setup_layout.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/InputActivityTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="@dimen/margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/informations"
|
||||
android:textSize="@dimen/cardViewTitle"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textColor="@color/mainTextViewColor"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/separationLineSize"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/separationColor" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_account_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/account_label_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/account_label"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/account_description_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/description"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_publicKey"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/publicKey_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/apiKey"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/input_secretKey"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/secretKey_editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/secretKey"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/saveExchangeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/save"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
style="@style/Widget.AppCompat.Button.Colored"/>
|
||||
|
||||
</RelativeLayout>
|
@ -139,4 +139,5 @@
|
||||
<string name="wipe_manual_entries">Supprimer les entrées manuelles actuelles</string>
|
||||
<string name="wipe_watchlist">Supprimer la liste suivie actuelle</string>
|
||||
<string name="wipe_api_keys">Supprimer les clefs API actuelles</string>
|
||||
<string name="title_add_exchange">Choose an exchange</string>
|
||||
</resources>
|
7
app/src/main/res/values/arrays.xml
Normal file
7
app/src/main/res/values/arrays.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="supported_exchanges">
|
||||
<item>Binance</item>
|
||||
<item>HitBTC</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -28,7 +28,6 @@
|
||||
<color name="decrease">#FFED143D</color>
|
||||
<color name="increase">#FF00E000</color>
|
||||
<color name="listBackground">#FFEEEEEE</color>
|
||||
<color name="listBackground2">#FFFFFFFF</color>
|
||||
<color name="separationColor">#66999999</color>
|
||||
<color name="red">#FFF44336</color>
|
||||
<color name="green">#FF4CAF50</color>
|
||||
@ -41,4 +40,8 @@
|
||||
<color name="blue">#FF689afe</color>
|
||||
<color name="transparent_blue">#22689afe</color>
|
||||
<color name="default_color">#FFAAAAAA</color>
|
||||
<color name="captionColor">#FF898989</color>
|
||||
<color name="softWhite">#66FFFFFF</color>
|
||||
|
||||
<color name="binance">#FFF5BC00</color>
|
||||
</resources>
|
@ -1,6 +1,6 @@
|
||||
<resources>
|
||||
<dimen name="cardViewMainText">15sp</dimen>
|
||||
<dimen name="cardViewSecondaryText">12sp</dimen>
|
||||
<dimen name="cardViewTitle">16sp</dimen>
|
||||
<dimen name="cardViewCaption">12sp</dimen>
|
||||
<dimen name="cardViewChartSize">150dp</dimen>
|
||||
|
||||
<dimen name="app_bar_height">172dp</dimen>
|
||||
@ -15,4 +15,5 @@
|
||||
<dimen name="cardview_elevation">8dp</dimen>
|
||||
|
||||
<dimen name="fragment_padding">15dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
|
@ -249,5 +249,12 @@
|
||||
<string name="wipe_manual_entries">Wipe current entries</string>
|
||||
<string name="wipe_watchlist">Wipe current watchlist</string>
|
||||
<string name="wipe_api_keys">Wipe current API keys</string>
|
||||
<string name="title_activity_exchange_list">ExchangeList</string>
|
||||
<string name="title_add_exchange">Choose an exchange</string>
|
||||
<string name="account_label">Account label</string>
|
||||
<string name="publicKey">Public key</string>
|
||||
<string name="apiKey">API Key</string>
|
||||
<string name="secretKey">Secret Key</string>
|
||||
<string name="informations">Informations</string>
|
||||
|
||||
</resources>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<item name="swirl_errorColor">@color/decrease</item>
|
||||
</style>
|
||||
|
||||
<style name="RecordTransactionTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<style name="InputActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user