minor adjustments
This commit is contained in:
parent
c018532098
commit
fd4e5aa77f
|
|
@ -2,9 +2,6 @@ package com.example.dcav2gui;
|
||||||
|
|
||||||
import static com.example.dcav2gui.MainActivity.globalSettings;
|
import static com.example.dcav2gui.MainActivity.globalSettings;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
@ -13,13 +10,9 @@ import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -186,7 +179,7 @@ public class InstanceInterface {
|
||||||
allDeals.addAll(okxDeals);
|
allDeals.addAll(okxDeals);
|
||||||
|
|
||||||
//Sort deals by timestamp
|
//Sort deals by timestamp
|
||||||
Collections.sort(allDeals, Comparator.comparingDouble(DealData::getTimestamp));
|
allDeals.sort(Comparator.comparingDouble(DealData::getTimestamp));
|
||||||
Collections.reverse(allDeals);
|
Collections.reverse(allDeals);
|
||||||
|
|
||||||
return allDeals.subList(0,globalSettings.amountOfLastTrades);
|
return allDeals.subList(0,globalSettings.amountOfLastTrades);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import com.example.dcav2gui.R;
|
||||||
import com.example.dcav2gui.TickerTracker;
|
import com.example.dcav2gui.TickerTracker;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
@ -67,10 +66,10 @@ public class HomeFragment extends Fragment {
|
||||||
private ImageView exchange3Status;
|
private ImageView exchange3Status;
|
||||||
private ImageView exchange4Status;
|
private ImageView exchange4Status;
|
||||||
|
|
||||||
private TextView exchange1Name;
|
// private TextView exchange1Name;
|
||||||
private TextView exchange2Name;
|
// private TextView exchange2Name;
|
||||||
private TextView exchange3Name;
|
// private TextView exchange3Name;
|
||||||
private TextView exchange4Name;
|
// private TextView exchange4Name;
|
||||||
|
|
||||||
private TextView exchange1Funds;
|
private TextView exchange1Funds;
|
||||||
private TextView exchange2Funds;
|
private TextView exchange2Funds;
|
||||||
|
|
@ -137,10 +136,10 @@ public class HomeFragment extends Fragment {
|
||||||
exchange3Status = root.findViewById(R.id.exchangeStats3Icon);
|
exchange3Status = root.findViewById(R.id.exchangeStats3Icon);
|
||||||
exchange4Status = root.findViewById(R.id.exchangeStats4Icon);
|
exchange4Status = root.findViewById(R.id.exchangeStats4Icon);
|
||||||
|
|
||||||
exchange1Name = root.findViewById(R.id.exchangeStats1Label);
|
// exchange1Name = root.findViewById(R.id.exchangeStats1Label);
|
||||||
exchange2Name = root.findViewById(R.id.exchangeStats2Label);
|
// exchange2Name = root.findViewById(R.id.exchangeStats2Label);
|
||||||
exchange3Name = root.findViewById(R.id.exchangeStats3Label);
|
// exchange3Name = root.findViewById(R.id.exchangeStats3Label);
|
||||||
exchange4Name = root.findViewById(R.id.exchangeStats4Label);
|
// exchange4Name = root.findViewById(R.id.exchangeStats4Label);
|
||||||
|
|
||||||
exchange1Funds = root.findViewById(R.id.exchangeStats1Funds);
|
exchange1Funds = root.findViewById(R.id.exchangeStats1Funds);
|
||||||
exchange2Funds = root.findViewById(R.id.exchangeStats2Funds);
|
exchange2Funds = root.findViewById(R.id.exchangeStats2Funds);
|
||||||
|
|
@ -227,10 +226,10 @@ public class HomeFragment extends Fragment {
|
||||||
exchange3Status.setImageResource(R.drawable.ic_green_circle_48);
|
exchange3Status.setImageResource(R.drawable.ic_green_circle_48);
|
||||||
exchange4Status.setImageResource(R.drawable.ic_green_circle_48);
|
exchange4Status.setImageResource(R.drawable.ic_green_circle_48);
|
||||||
|
|
||||||
exchange1Name.setText(R.string.exchange_1_name);
|
// exchange1Name.setText(R.string.exchange_1_name);
|
||||||
exchange2Name.setText(R.string.exchange_2_name);
|
// exchange2Name.setText(R.string.exchange_2_name);
|
||||||
exchange3Name.setText(R.string.exchange_3_name);
|
// exchange3Name.setText(R.string.exchange_3_name);
|
||||||
exchange4Name.setText(R.string.exchange_4_name);
|
// exchange4Name.setText(R.string.exchange_4_name);
|
||||||
|
|
||||||
exchange1Funds.setText(R.string.exchange_funds_example);
|
exchange1Funds.setText(R.string.exchange_funds_example);
|
||||||
exchange2Funds.setText(R.string.exchange_funds_example);
|
exchange2Funds.setText(R.string.exchange_funds_example);
|
||||||
|
|
@ -313,7 +312,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return TickerTracker.getPriceChanges(getString(R.string.ticker_1),true);
|
return TickerTracker.getPriceChanges(getString(R.string.ticker_1),true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -321,7 +320,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return TickerTracker.getPriceChanges(getString(R.string.ticker_2), true);
|
return TickerTracker.getPriceChanges(getString(R.string.ticker_2), true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -329,7 +328,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return TickerTracker.getPriceChanges(getString(R.string.ticker_3), true);
|
return TickerTracker.getPriceChanges(getString(R.string.ticker_3), true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -337,7 +336,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getProfitStatsData(true);
|
return InstanceInterface.getProfitStatsData(true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -345,7 +344,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getLastLogs("binance", true);
|
return InstanceInterface.getLastLogs("binance", true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -353,7 +352,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getLastLogs("gateio", true);
|
return InstanceInterface.getLastLogs("gateio", true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -361,7 +360,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getLastLogs("kucoin", true);
|
return InstanceInterface.getLastLogs("kucoin", true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -369,7 +368,7 @@ public class HomeFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getLastLogs("okex", true);
|
return InstanceInterface.getLastLogs("okex", true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -524,8 +523,8 @@ public class HomeFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Exchange stats
|
//Exchange stats
|
||||||
int timeoutForYellow = 30*1000; //30 seconds
|
int timeoutForYellow = 15*1000; //15 seconds - Should be in the config file
|
||||||
int timeoutForRed = 300*1000; //300 seconds
|
int timeoutForRed = 120*1000; //2 minutes - Should be in the config file
|
||||||
//Icons
|
//Icons
|
||||||
if (binanceStats!=null){
|
if (binanceStats!=null){
|
||||||
if (binanceStats.getLastSeen()*1000+timeoutForRed < System.currentTimeMillis()) {
|
if (binanceStats.getLastSeen()*1000+timeoutForRed < System.currentTimeMillis()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue