Price widget placeholder

This commit is contained in:
Nicolás Sánchez 2024-12-10 16:02:03 -03:00
parent 58a47369d8
commit d38ea199ca
6 changed files with 167 additions and 15 deletions

View File

@ -4,7 +4,7 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-12-10T14:15:46.909768986Z"> <DropdownSelection timestamp="2024-12-10T18:54:23.469267166Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/nicolas/.android/avd/Pixel_6_Pro_API_34.avd" /> <DeviceId pluginId="LocalEmulator" identifier="path=/home/nicolas/.android/avd/Pixel_6_Pro_API_34.avd" />

View File

@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.example.dcav2gui.R;
import com.example.dcav2gui.databinding.FragmentHomeBinding; import com.example.dcav2gui.databinding.FragmentHomeBinding;
public class HomeFragment extends Fragment { public class HomeFragment extends Fragment {
@ -24,8 +25,25 @@ public class HomeFragment extends Fragment {
binding = FragmentHomeBinding.inflate(inflater, container, false); binding = FragmentHomeBinding.inflate(inflater, container, false);
View root = binding.getRoot(); View root = binding.getRoot();
final TextView textView = binding.textHome; //final TextView textView = binding.textHome;
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText); //homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
// Bind text views
TextView pricePair1 = root.findViewById(R.id.pricesCardPrice1);
TextView pricePair1Percentages = root.findViewById(R.id.pricesCardPercentages1);
TextView pricePair2 = root.findViewById(R.id.pricesCardPrice2);
TextView pricePair2Percentages = root.findViewById(R.id.pricesCardPercentages2);
TextView pricePair3 = root.findViewById(R.id.pricesCardPrice3);
TextView pricePair3Percentages = root.findViewById(R.id.pricesCardPercentages3);
// Set text values
pricePair1.setText("696969.35");
pricePair1Percentages.setText("24h +100% 7d +100% 30d +100%");
pricePair2.setText("69696.93");
pricePair2Percentages.setText("24h +100% 7d +100% 30d +100%");
pricePair3.setText("1000.35");
pricePair3Percentages.setText("24h +100% 7d +100% 30d +100%");
return root; return root;
} }

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/card_background_color"/>
<corners android:radius="8dp"/>
<stroke android:color="@color/stroke_color" android:width="1dp"/>
</shape>

View File

@ -6,17 +6,133 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment"> tools:context=".ui.home.HomeFragment">
<TextView <LinearLayout
android:id="@+id/text_home"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="84dp"
android:layout_marginStart="8dp" android:orientation="vertical"
android:layout_marginTop="8dp" android:background="@drawable/price_card_background"
android:layout_marginEnd="8dp" android:padding="2dp"
android:textAlignment="center" tools:ignore="MissingConstraints">
android:textSize="20sp" <LinearLayout
app:layout_constraintBottom_toBottomOf="parent" android:layout_width="match_parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_height="24dp"
app:layout_constraintStart_toStartOf="parent" android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent" /> android:padding="2dp"
android:layout_marginBottom="2dp">
<TextView
android:id="@+id/pricesCardBase1"
android:layout_width="48dp"
android:layout_height="24dp"
android:text="@string/base_price_ticker_1"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPrice1"
android:layout_width="96dp"
android:layout_height="24dp"
android:text="696969.69"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardQuote1"
android:layout_width="32dp"
android:layout_height="16dp"
android:textAlignment="center"
android:text="@string/quote_price_ticker_1"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPercentages1"
android:layout_width="220dp"
android:layout_height="16dp"
android:textAlignment="textEnd"
android:text="24h +100% 7d +100% 30d +100%"
android:textColor="@color/secondary_text_color"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:padding="2dp"
android:layout_marginBottom="2dp">
<TextView
android:id="@+id/pricesCardBase2"
android:layout_width="48dp"
android:layout_height="24dp"
android:text="@string/base_price_ticker_2"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPrice2"
android:layout_width="96dp"
android:layout_height="24dp"
android:text="696969.69"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardQuote2"
android:layout_width="32dp"
android:layout_height="16dp"
android:textAlignment="center"
android:text="@string/quote_price_ticker_2"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPercentages2"
android:layout_width="220dp"
android:layout_height="16dp"
android:textAlignment="textEnd"
android:text="24h +100% 7d +100% 30d +100%"
android:textColor="@color/secondary_text_color"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:padding="2dp"
android:layout_marginBottom="2dp">
<TextView
android:id="@+id/pricesCardBase3"
android:layout_width="48dp"
android:layout_height="24dp"
android:text="@string/base_price_ticker_3"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPrice3"
android:layout_width="96dp"
android:layout_height="24dp"
android:text="696969.69"
android:textAlignment="center"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardQuote3"
android:layout_width="32dp"
android:layout_height="16dp"
android:textAlignment="center"
android:text="@string/quote_price_ticker_2"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/pricesCardPercentages3"
android:layout_width="220dp"
android:layout_height="16dp"
android:textAlignment="textEnd"
android:text="24h +100% 7d +100% 30d +100%"
android:textColor="@color/secondary_text_color"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -7,4 +7,8 @@
<color name="teal_700">#FF018786</color> <color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="secondary_text_color">#FF424242</color>
<color name="card_background_color">#FFF6F6F6</color>
<color name="stroke_color">#FF000000</color>
</resources> </resources>

View File

@ -33,4 +33,11 @@
<string name="chat_id_title">Chat ID</string> <string name="chat_id_title">Chat ID</string>
<string name="profile_name_title">Profile name</string> <string name="profile_name_title">Profile name</string>
<string name="general_settings_title">General settings</string> <string name="general_settings_title">General settings</string>
<string name="base_price_ticker_1">BTC</string>
<string name="base_price_ticker_2">ETH</string>
<string name="base_price_ticker_3">USDT</string>
<string name="quote_price_ticker_1">USDT</string>
<string name="quote_price_ticker_2">USDT</string>
<string name="quote_price_ticker_3">ARS</string>
</resources> </resources>