melhorar o streak

This commit is contained in:
MeuNome
2026-05-05 17:14:37 +01:00
parent 84dbdac0f2
commit 2c7d1a854f
8 changed files with 792 additions and 523 deletions

View File

@@ -1,305 +1,274 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_light">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/card_background"
app:elevation="0dp">
<RelativeLayout
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="64dp"
android:paddingHorizontal="16dp">
app:contentInsetStart="0dp">
<ImageButton
android:id="@+id/btnBack"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_back"
app:tint="@color/text_primary" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="16dp">
<TextView
android:id="@+id/tvToolbarTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Ligas"
android:textColor="@color/text_primary"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<ImageButton
android:id="@+id/btnBack"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_back"
app:tint="@color/text_primary" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Ligas"
android:textColor="@color/text_primary"
android:textSize="20sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/btnHelp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@android:drawable/ic_menu_help"
app:tint="@color/text_primary" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<!-- Gamified Header Section -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
android:padding="20dp"
android:gravity="center">
<!-- 1. 🥇 HEADER DA LIGA -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:cardCornerRadius="20dp"
app:cardBackgroundColor="@color/primary_purple"
app:cardElevation="4dp">
<ImageView
android:id="@+id/ivHeaderLeagueIcon"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/ic_trophy_bronze"
android:layout_marginBottom="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp"
android:gravity="center">
<ImageView
android:id="@+id/ivLeagueBadge"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/ic_trophy_bronze"
android:layout_marginBottom="12dp"
app:tint="@color/white" />
<TextView
android:id="@+id/tvLeagueName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Divisão Bronze"
android:textColor="@color/white"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tvLeagueTimeRemaining"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="2 dias 14h restantes"
android:textColor="#E0E0E0"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/pbWeeklyProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginTop="20dp"
android:max="100"
android:progress="60"
android:progressTint="@color/reward_yellow"
android:progressBackgroundTint="#4DFFFFFF" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- 2. 🎯 OBJETIVO DA LIGA -->
<TextView
android:id="@+id/tvLeagueObjective"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="🚀 Fica no TOP 3 para subir para Prata"
android:textAlignment="center"
android:textColor="@color/primary_purple"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="24dp"/>
<!-- 5. ⚡ PROGRESSO DO UTILIZADOR -->
<androidx.cardview.widget.CardView
android:id="@+id/cardUserProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
app:cardCornerRadius="16dp"
app:cardElevation="2dp"
app:cardBackgroundColor="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center">
<TextView
android:id="@+id/tvUserRankingStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Faltam 120 XP para entrares no TOP 3"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:textAlignment="center"
android:textSize="16sp"/>
<TextView
android:id="@+id/tvXPToNextPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Diferença para o próximo: 45 XP"
android:textColor="@color/text_secondary"
android:textAlignment="center"
android:textSize="14sp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- 8. 👥 FILTRO DE RANKING -->
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggleRankingFilter"
android:id="@+id/tvHeaderTimeLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="24dp"
app:singleSelection="true"
app:selectionRequired="true"
app:checkedButton="@+id/btnRankingGlobal">
<Button
android:id="@+id/btnRankingGlobal"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="120dp"
android:layout_height="50dp"
android:text="Global"
android:textStyle="bold"
android:textSize="14sp"/>
<Button
android:id="@+id/btnRankingAmigos"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="120dp"
android:layout_height="50dp"
android:text="Amigos"
android:textStyle="bold"
android:textSize="14sp"/>
</com.google.android.material.button.MaterialButtonToggleGroup>
android:text="Termina em 3 dias"
android:textColor="@color/text_secondary"
android:textSize="14sp"
android:layout_marginBottom="8dp"/>
<ProgressBar
android:id="@+id/pbHeaderProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="12dp"
android:max="100"
android:progress="0"
android:progressTint="@color/primary_purple"
android:progressBackgroundTint="#E0E0E0" />
<TextView
android:id="@+id/tvHeaderXP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6415 / 10000 XP"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:layout_marginTop="8dp"/>
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
app:tabIndicatorColor="@color/primary_purple"
app:tabSelectedTextColor="@color/primary_purple"
app:tabTextColor="@color/text_secondary">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Divisões" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Amigos" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ranking" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appBar"
android:layout_above="@id/bottomWrapper">
<!-- DIVISÕES TAB -->
<androidx.core.widget.NestedScrollView
android:id="@+id/tabDivisoes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="16dp">
<LinearLayout
android:id="@+id/divisionsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</androidx.core.widget.NestedScrollView>
<!-- RANKING / AMIGOS TAB -->
<androidx.core.widget.NestedScrollView
android:id="@+id/tabRanking"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:clipToPadding="false"
android:padding="16dp">
<!-- 3. 📊 RANKING DA SEMANA -->
<LinearLayout
android:id="@+id/rankingContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="32dp"/>
android:orientation="vertical" />
<!-- 6. 🎁 RECOMPENSAS DA SEMANA -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recompensas da semana"
android:textStyle="bold"
android:textSize="18sp"
android:textColor="@color/text_primary"
android:layout_marginBottom="16dp"/>
</androidx.core.widget.NestedScrollView>
<LinearLayout
</FrameLayout>
<LinearLayout
android:id="@+id/bottomWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:background="@color/card_background"
android:elevation="12dp">
<!-- Fixed User Card -->
<androidx.cardview.widget.CardView
android:id="@+id/cardUserProgress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardBackgroundColor="@color/card_background">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginBottom="32dp">
android:padding="16dp">
<!-- 1º Lugar -->
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginEnd="4dp"
app:cardCornerRadius="16dp"
app:cardBackgroundColor="#FFF8E1"
app:cardElevation="1dp">
<LinearLayout
android:id="@+id/cvAvatar"
android:layout_width="48dp"
android:layout_height="48dp"
app:cardCornerRadius="24dp"
app:cardElevation="0dp">
<ImageView
android:id="@+id/ivUserAvatar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:gravity="center">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🥇" android:textSize="32sp" android:layout_marginBottom="8dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1º Lugar" android:textStyle="bold" android:textSize="14sp" android:textColor="#FF8F00"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+300 XP\nBadge" android:textAlignment="center" android:textSize="12sp" android:textColor="#FF8F00"/>
</LinearLayout>
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/ic_nav_profile" />
</androidx.cardview.widget.CardView>
<!-- 2º Lugar -->
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginHorizontal="4dp"
app:cardCornerRadius="16dp"
app:cardBackgroundColor="#F5F5F5"
app:cardElevation="1dp">
<LinearLayout
android:layout_width="match_parent"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/cvAvatar"
android:layout_toStartOf="@id/ivUserExpand"
android:layout_marginStart="16dp"
android:orientation="vertical">
<TextView
android:id="@+id/tvUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:gravity="center">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🥈" android:textSize="28sp" android:layout_marginBottom="8dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2º Lugar" android:textStyle="bold" android:textSize="14sp" android:textColor="#757575"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+200 XP" android:textAlignment="center" android:textSize="12sp" android:textColor="#757575"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
android:text="Utilizador"
android:textColor="@color/text_primary"
android:textStyle="bold"
android:textSize="16sp"/>
<!-- 3º Lugar -->
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="4dp"
app:cardCornerRadius="16dp"
app:cardBackgroundColor="#EFEBE9"
app:cardElevation="1dp">
<LinearLayout
android:layout_width="match_parent"
<TextView
android:id="@+id/tvUserDivision"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:gravity="center">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="🥉" android:textSize="28sp" android:layout_marginBottom="8dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3º Lugar" android:textStyle="bold" android:textSize="14sp" android:textColor="#8D6E63"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+100 XP" android:textAlignment="center" android:textSize="12sp" android:textColor="#8D6E63"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
android:text="Bronze • 0 XP"
android:textColor="@color/text_secondary"
android:textSize="14sp"/>
<!-- 7. 📈 HISTÓRICO DE PERFORMANCE -->
<TextView
android:id="@+id/tvPastPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Semana passada: 2º lugar (subiste)"
android:textAlignment="center"
android:textColor="@color/text_secondary"
android:textSize="14sp"
android:layout_marginBottom="32dp"
android:visibility="gone" />
<ProgressBar
android:id="@+id/pbUserBottom"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_marginTop="4dp"
android:max="100"
android:progress="0"
android:progressTint="@color/primary_purple"
android:progressBackgroundTint="#E0E0E0" />
<!-- 9. 🔘 BOTÃO DE ACÇÃO -->
<Button
android:id="@+id/btnEarnXpNow"
android:layout_width="match_parent"
android:layout_height="64dp"
android:text="⚡ Ganhar XP Agora"
android:backgroundTint="@color/primary_purple"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:textAllCaps="false"
app:cornerRadius="16dp"
android:layout_marginBottom="40dp"/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<ImageView
android:id="@+id/ivUserExpand"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_arrow_right"
app:tint="@color/text_secondary" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/btnEarnXpNow"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="16dp"
android:text="Ganhar XP agora"
android:backgroundTint="@color/primary_purple"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
android:textAllCaps="false"
app:cornerRadius="12dp" />
</LinearLayout>
</RelativeLayout>