Fix exchange connexion status not showing properly

This commit is contained in:
Tanguy Herbron 2018-08-01 13:56:54 +02:00
parent b7d10011ef
commit 2d12cc3dbe
4 changed files with 14 additions and 9 deletions

View File

@ -336,7 +336,6 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
} }
lastTimestamp = System.currentTimeMillis() / 1000; lastTimestamp = System.currentTimeMillis() / 1000;
balanceManager.updateExchangeKeys();
resetCounters(); resetCounters();
DataUpdater updater = new DataUpdater(); DataUpdater updater = new DataUpdater();

View File

@ -443,7 +443,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
public List<HitBtcManager> getHitBtcAccounts(Context context) public List<HitBtcManager> getHitBtcAccounts(Context context)
{ {
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + HITBTC_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + HITBTC_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = 1";
SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = this.getWritableDatabase();
Cursor resultList = db.rawQuery(searchQuerry, null); Cursor resultList = db.rawQuery(searchQuerry, null);
@ -466,7 +466,7 @@ public class DatabaseManager extends SQLiteOpenHelper{
public List<BinanceManager> getBinanceAccounts() public List<BinanceManager> getBinanceAccounts()
{ {
String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + BINANCE_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + BINANCE_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = 1";
SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = this.getWritableDatabase();
Cursor resultList = db.rawQuery(searchQuerry, null); Cursor resultList = db.rawQuery(searchQuerry, null);

View File

@ -2,8 +2,12 @@ package com.herbron.moodl.LayoutManagers;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -11,6 +15,8 @@ import android.widget.ArrayAdapter;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Filter; import android.widget.Filter;
import android.widget.Filterable; import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.herbron.moodl.Activities.AddExchangeActivity; import com.herbron.moodl.Activities.AddExchangeActivity;
@ -47,17 +53,16 @@ public class ExchangeListAdapter extends ArrayAdapter<Exchange> {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.exchange_cell, parent, false); convertView = LayoutInflater.from(getContext()).inflate(R.layout.exchange_cell, parent, false);
} }
final View finalConvertView = convertView;
TextView exchangeNameTextView = convertView.findViewById(R.id.exchange_name); TextView exchangeNameTextView = convertView.findViewById(R.id.exchange_name);
TextView exchangeDescriptionTextView = convertView.findViewById(R.id.exchange_description); TextView exchangeDescriptionTextView = convertView.findViewById(R.id.exchange_description);
ImageView accountOffImageView = convertView.findViewById(R.id.exchange_account_off_imageView);
exchangeNameTextView.setText(exchange.getName()); exchangeNameTextView.setText(exchange.getName());
exchangeDescriptionTextView.setText(exchange.getDescription()); exchangeDescriptionTextView.setText(exchange.getDescription());
if(!exchange.isEnabled()) if(!exchange.isEnabled())
{ {
convertView.findViewById(R.id.exchange_account_off_imageView).setVisibility(View.VISIBLE); accountOffImageView.setVisibility(View.VISIBLE);
} }
convertView.findViewById(R.id.editExchangeInfosLayout).setOnClickListener(new View.OnClickListener() { convertView.findViewById(R.id.editExchangeInfosLayout).setOnClickListener(new View.OnClickListener() {
@ -75,7 +80,8 @@ public class ExchangeListAdapter extends ArrayAdapter<Exchange> {
public void onClick(View v) { public void onClick(View v) {
DatabaseManager databaseManager = new DatabaseManager(getContext()); DatabaseManager databaseManager = new DatabaseManager(getContext());
databaseManager.deleteExchangeAccountFromId(exchange.getId()); databaseManager.deleteExchangeAccountFromId(exchange.getId());
MoodlBox.collapseH(finalConvertView); remove(exchange);
notifyDataSetChanged();
} }
}); });

View File

@ -93,10 +93,10 @@
android:id="@+id/exchange_account_off_imageView" android:id="@+id/exchange_account_off_imageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/ic_money_off_24dp" android:src="@drawable/ic_money_off_24dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:visibility="invisible"/> android:visibility="gone"/>
</RelativeLayout> </RelativeLayout>
</com.daimajia.swipe.SwipeLayout> </com.daimajia.swipe.SwipeLayout>