added band rates ui

This commit is contained in:
2025-07-25 20:38:07 +05:00
parent b69d351578
commit a35583b024
12 changed files with 945 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -11,18 +12,284 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center">
android:padding="16dp">
<TextView
android:id="@+id/text_band_rates"
<!-- Tab Layout -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="?android:attr/textColorPrimary"
android:gravity="center"
android:layout_marginTop="100dp"
tools:text="Band Rates\n\nComing soon..." />
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="4dp">
<TextView
android:id="@+id/tab_electricity"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:text="Electricity"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center"
android:layout_margin="4dp"
android:background="@drawable/card_background"
android:clickable="true"
android:focusable="true"
tools:textColor="@color/white"
tools:backgroundTint="@color/electricity_color" />
<TextView
android:id="@+id/tab_water"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:text="Water"
android:textSize="16sp"
android:textStyle="bold"
android:gravity="center"
android:layout_margin="4dp"
android:background="@drawable/card_background"
android:clickable="true"
android:focusable="true"
tools:textColor="?android:attr/textColorPrimary"
tools:backgroundTint="@color/tab_inactive_color" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Content Area -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Loading State -->
<LinearLayout
android:id="@+id/layout_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:padding="48dp"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginBottom="16dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Loading band rates..."
android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
<!-- Error State -->
<LinearLayout
android:id="@+id/layout_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:padding="48dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="⚠️"
android:textSize="48sp"
android:layout_marginBottom="16dp" />
<TextView
android:id="@+id/text_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unable to load band rates"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="center" />
</LinearLayout>
<!-- Main Content -->
<LinearLayout
android:id="@+id/layout_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<!-- Category Selection -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Categories"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginBottom="12dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_subscription" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Zone Selection (Electricity Only) -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/card_zones"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Zones"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginBottom="12dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_zones"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_subscription" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<!-- Rates Table -->
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="12dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/text_rates_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rate Structure"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginBottom="16dp" />
<!-- Table Header -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/category_tag_background"
android:padding="12dp"
android:layout_marginBottom="1dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Allocated Units"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Rate"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:gravity="end" />
</LinearLayout>
<!-- Rates List -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_rates"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- Empty State -->
<LinearLayout
android:id="@+id/layout_rates_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:padding="32dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="📊"
android:textSize="48sp"
android:layout_marginBottom="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No rates available for selected criteria"
android:textColor="?android:attr/textColorSecondary"
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="12dp"
android:layout_marginBottom="1dp"
android:background="@color/card_background_color">
<TextView
android:id="@+id/text_band"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
tools:text="0-100" />
<TextView
android:id="@+id/text_rate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
android:gravity="end"
tools:text="MVR 22.00" />
</LinearLayout>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/text_chip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:padding="12dp"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"
android:background="@drawable/category_tag_background"
android:clickable="true"
android:focusable="true"
android:minWidth="80dp"
android:gravity="center"
tools:text="Domestic" />

View File

@@ -17,4 +17,16 @@
<color name="category_tag_background">#E0E0E0</color>
<color name="card_stroke_color">#E0E0E0</color>
<color name="card_background_color">#FFFFFF</color>
<!-- Band rates colors (matching chart colors) -->
<color name="electricity_color">#FF9800</color>
<color name="water_color">#2196F3</color>
<color name="tab_inactive_color">#E0E0E0</color>
<color name="tab_inactive_text_color">#666666</color>
<!-- Selection chip colors -->
<color name="electricity_selection_background">#FFF3E0</color>
<color name="electricity_selection_border">#FF9800</color>
<color name="water_selection_background">#E3F2FD</color>
<color name="water_selection_border">#2196F3</color>
</resources>