diff --git a/app/src/main/java/com/example/dcav2gui/ui/home/HomeFragment.java b/app/src/main/java/com/example/dcav2gui/ui/home/HomeFragment.java index 08dbd3b..4211a89 100644 --- a/app/src/main/java/com/example/dcav2gui/ui/home/HomeFragment.java +++ b/app/src/main/java/com/example/dcav2gui/ui/home/HomeFragment.java @@ -412,27 +412,29 @@ public class HomeFragment extends Fragment { } private void fetchExchangeDetails(String exchange) { - new Thread(() -> { - try { - InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); - new Handler(Looper.getMainLooper()).post(() -> showInstanceDetailsDialog(result)); - } catch (IOException e) { - e.printStackTrace(); - new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); - } - }).start(); + showInstanceDetailsDialog(MainActivity.getInstanceCache(exchange).getGlobalStats()); +// new Thread(() -> { +// try { +// InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); +// new Handler(Looper.getMainLooper()).post(() -> showInstanceDetailsDialog(result)); +// } catch (IOException e) { +// e.printStackTrace(); +// new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); +// } +// }).start(); } private void fetchPausedTraders(String exchange) { - new Thread(() -> { - try { - InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); - new Handler(Looper.getMainLooper()).post(() -> showPausedTradersDialog(result)); - } catch (IOException e) { - e.printStackTrace(); - new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); - } - }).start(); + showPausedTradersDialog(MainActivity.getInstanceCache(exchange).getGlobalStats()); +// new Thread(() -> { +// try { +// InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); +// new Handler(Looper.getMainLooper()).post(() -> showPausedTradersDialog(result)); +// } catch (IOException e) { +// e.printStackTrace(); +// new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); +// } +// }).start(); } private void fetchMissingPairs(String exchange) { @@ -472,15 +474,16 @@ public class HomeFragment extends Fragment { } private void fetchExchangeConfig(String exchange) { - new Thread(() -> { - try { - InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); - new Handler(Looper.getMainLooper()).post(() -> showInstanceConfigDialog(result)); - } catch (IOException e) { - e.printStackTrace(); - new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); - } - }).start(); + showInstanceConfigDialog(MainActivity.getInstanceCache(exchange).getGlobalStats()); +// new Thread(() -> { +// try { +// InstanceInterface.InstanceGlobalStatsData result = InstanceInterface.getInstanceGlobalStatus(exchange, true); +// new Handler(Looper.getMainLooper()).post(() -> showInstanceConfigDialog(result)); +// } catch (IOException e) { +// e.printStackTrace(); +// new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(getContext(), "Failed to fetch details", Toast.LENGTH_SHORT).show()); +// } +// }).start(); } private void showInstanceDetailsDialog(InstanceInterface.InstanceGlobalStatsData result) {