progress bar colors
This commit is contained in:
parent
231fb297f8
commit
d47567e226
|
|
@ -4,7 +4,7 @@
|
|||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-12-17T22:52:32.286553137Z">
|
||||
<DropdownSelection timestamp="2024-12-18T13:29:16.439093075Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/home/nicolas/.android/avd/Pixel_6_Pro_API_34.avd" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.example.dcav2gui.ui.exchanges.adapters;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -66,11 +68,6 @@ public class WorkerCardAdapter{
|
|||
nextSoPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getNextSoPrice()));
|
||||
takeProfitPrice.setText(String.format(Locale.ROOT, "%.8f", worker.getTakeProfitPrice()));
|
||||
|
||||
double breakEven = worker.getTotalAmountOfQuote()/worker.getTotalAmountOfBase();
|
||||
if (worker.getPrice() > breakEven) {
|
||||
price.setTextColor(Color.parseColor("#00A000"));
|
||||
}
|
||||
|
||||
double percentageToProfit = abs(worker.getTakeProfitPrice()- worker.getPrice())/worker.getPrice()*100;
|
||||
String percentageToDisplay = String.format(Locale.ROOT, "%.2f",percentageToProfit)+"%";
|
||||
percentage.setText(percentageToDisplay);
|
||||
|
|
@ -94,9 +91,20 @@ public class WorkerCardAdapter{
|
|||
|
||||
double progressBarPercentage = (worker.getPrice()-worker.getNextSoPrice())/(worker.getTakeProfitPrice()-worker.getNextSoPrice());
|
||||
progressBar.setProgress((int) (progressBarPercentage * 100));
|
||||
|
||||
|
||||
|
||||
double breakEven = worker.getTotalAmountOfQuote()/worker.getTotalAmountOfBase();
|
||||
if (!worker.isShort()) {
|
||||
if (worker.getPrice() > breakEven) {
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#00A000")));
|
||||
} else {
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#B00000")));
|
||||
}
|
||||
} else {
|
||||
if (worker.getPrice() < breakEven) {
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#00A000")));
|
||||
} else {
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#B00000")));
|
||||
}
|
||||
}
|
||||
|
||||
if (worker.isBoosted()) {
|
||||
workerCardIcon.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
android:id="@+id/workerCardStatusString"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="LAST DEAL"
|
||||
android:text="@string/last_deal_notice"
|
||||
android:textSize="8sp"
|
||||
android:textStyle="bold"
|
||||
android:textAlignment="center"
|
||||
|
|
@ -65,6 +65,7 @@
|
|||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_flame"
|
||||
android:visibility="visible"
|
||||
android:contentDescription="@string/fire_icon_legend"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
|
@ -112,7 +113,7 @@
|
|||
android:max="100"
|
||||
android:progress="50"
|
||||
android:layout_weight="1"
|
||||
android:progressDrawable="@drawable/worker_progress_bar"/>
|
||||
android:progressDrawable="@drawable/worker_progress_bar" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="green">#FF008000</color>
|
||||
<color name="red">#FFFF0000</color>
|
||||
<color name="dark_red">#B00000</color>
|
||||
<color name="blue">#FF0000FF</color>
|
||||
<color name="yellow">#FFFFFF00</color>
|
||||
<color name="dark_yellow">#99991D</color>
|
||||
|
|
|
|||
|
|
@ -81,4 +81,5 @@
|
|||
<string name="loading_message">Querying data sources…</string>
|
||||
<string name="last_deal_notice">LAST DEAL</string>
|
||||
<string name="autoswitch_notice">AUTO</string>
|
||||
<string name="fire_icon_legend">Fire icon</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue