pairs color
This commit is contained in:
parent
7cf1beaf4c
commit
692f833ec5
|
|
@ -628,6 +628,8 @@ public class InstanceInterface {
|
|||
workerStatsData.getNextSoPrice(),
|
||||
workerStatsData.getPrice(),
|
||||
workerStatsData.getTakeProfitPrice(),
|
||||
workerStatsData.getQuoteSpent(),
|
||||
workerStatsData.getBaseBought(),
|
||||
workerStatsData.getIsShort(),
|
||||
//Let's deal with this later
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ public class WorkerData {
|
|||
private final double nextSoPrice;
|
||||
private final double price;
|
||||
private final double takeProfitPrice;
|
||||
private final double totalAmountOfQuote;
|
||||
private final double totalAmountOfBase;
|
||||
private final boolean isShort;
|
||||
private final boolean isBoosted;
|
||||
private final boolean isAuto;
|
||||
|
|
@ -17,7 +19,7 @@ public class WorkerData {
|
|||
private final InstanceInterface.OldLongDictionary oldLongDictionary;
|
||||
|
||||
public WorkerData(String pair, int amountOfSafetyOrders, int maxSafetyOrders, double uptime,
|
||||
double nextSoPrice, double price, double takeProfitPrice, boolean isShort,
|
||||
double nextSoPrice, double price, double takeProfitPrice, double totalAmountOfQuote, double totalAmountOfBase, boolean isShort,
|
||||
boolean isBoosted, boolean isAuto, boolean isPaused,
|
||||
InstanceInterface.OldLongDictionary oldLongDictionary) {
|
||||
|
||||
|
|
@ -29,6 +31,8 @@ public class WorkerData {
|
|||
this.nextSoPrice = nextSoPrice;
|
||||
this.price = price;
|
||||
this.takeProfitPrice = takeProfitPrice;
|
||||
this.totalAmountOfQuote = totalAmountOfQuote;
|
||||
this.totalAmountOfBase = totalAmountOfBase;
|
||||
this.isShort = isShort;
|
||||
this.isBoosted = isBoosted;
|
||||
this.isAuto = isAuto;
|
||||
|
|
@ -43,6 +47,8 @@ public class WorkerData {
|
|||
public double getNextSoPrice() { return nextSoPrice; }
|
||||
public double getPrice() { return price; }
|
||||
public double getTakeProfitPrice() { return takeProfitPrice; }
|
||||
public double getTotalAmountOfQuote() { return totalAmountOfQuote; }
|
||||
public double getTotalAmountOfBase() { return totalAmountOfBase; }
|
||||
public boolean isShort() { return isShort; }
|
||||
public boolean isBoosted() { return isBoosted; }
|
||||
public boolean isAuto() { return isAuto; }
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ package com.example.dcav2gui.ui.exchanges.adapters;
|
|||
import static java.lang.Math.abs;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ClipDrawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.shapes.Shape;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -10,6 +16,8 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.example.dcav2gui.R;
|
||||
import com.example.dcav2gui.ui.exchanges.WorkerData;
|
||||
|
|
@ -17,6 +25,8 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class WorkerCardAdapter extends RecyclerView.Adapter<WorkerCardAdapter.WorkerViewHolder> {
|
||||
|
||||
private List<WorkerData> workerDataList;
|
||||
|
|
@ -34,8 +44,18 @@ public class WorkerCardAdapter extends RecyclerView.Adapter<WorkerCardAdapter.Wo
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull WorkerViewHolder holder, int position) {
|
||||
//TODO: progress bar color
|
||||
//TODO: auto-switch
|
||||
//TODO: is_boosted
|
||||
|
||||
WorkerData worker = workerDataList.get(position);
|
||||
holder.pair.setText(worker.getPair());
|
||||
if (worker.isShort()) {
|
||||
holder.pair.setTextColor(Color.parseColor("#FFA500"));
|
||||
} else {
|
||||
//Cyan
|
||||
holder.pair.setTextColor(Color.parseColor("#008B8B"));
|
||||
}
|
||||
holder.price.setText(String.format(Locale.ROOT, "%.8f", worker.getPrice()));
|
||||
holder.nextSoPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getNextSoPrice()));
|
||||
holder.takeProfitPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getTakeProfitPrice()));
|
||||
|
|
@ -51,7 +71,22 @@ public class WorkerCardAdapter extends RecyclerView.Adapter<WorkerCardAdapter.Wo
|
|||
double progressBarPercentage = (worker.getPrice()-worker.getNextSoPrice())/(worker.getTakeProfitPrice()-worker.getNextSoPrice());
|
||||
holder.progressBar.setProgress((int) (progressBarPercentage * 100));
|
||||
|
||||
|
||||
double breakEven = worker.getTotalAmountOfQuote()/worker.getTotalAmountOfBase();
|
||||
System.err.println("breakEven: "+breakEven);
|
||||
// int color;
|
||||
// if (worker.getNextSoPrice()< worker.getTakeProfitPrice()) {
|
||||
// if (worker.getPrice()>=breakEven){
|
||||
// color = Color.GREEN;
|
||||
// } else {
|
||||
// color = Color.RED;
|
||||
// }
|
||||
// } else {
|
||||
// if (worker.getPrice()<breakEven){
|
||||
// color = Color.GREEN;
|
||||
// } else {
|
||||
// color = Color.RED;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static String formatSeconds(double seconds) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/worker_bar">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
|
|
@ -9,7 +10,7 @@
|
|||
<clip>
|
||||
<shape >
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#4CAF50" /> <!-- Progress color -->
|
||||
<solid android:color="#4CAF50" android:id="@+id/worker_bar_color"/> <!-- Progress color -->
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Reference in New Issue