gravar
This commit is contained in:
31
app/src/main/java/com/fluxup/app/DailyProgress.java
Normal file
31
app/src/main/java/com/fluxup/app/DailyProgress.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.fluxup.app;
|
||||
|
||||
public class DailyProgress {
|
||||
public String date;
|
||||
public int completedTasks;
|
||||
public int dailyGoal;
|
||||
public int focusSessions;
|
||||
public int xp;
|
||||
public String status; // "complete", "partial", "empty"
|
||||
|
||||
public DailyProgress() {}
|
||||
|
||||
public DailyProgress(String date, int dailyGoal) {
|
||||
this.date = date;
|
||||
this.dailyGoal = dailyGoal;
|
||||
this.completedTasks = 0;
|
||||
this.focusSessions = 0;
|
||||
this.xp = 0;
|
||||
this.status = "empty";
|
||||
}
|
||||
|
||||
public void updateStatus() {
|
||||
if (completedTasks >= dailyGoal && dailyGoal > 0) {
|
||||
status = "complete";
|
||||
} else if (completedTasks > 0) {
|
||||
status = "partial";
|
||||
} else {
|
||||
status = "empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -628,20 +628,21 @@ public class InicioFragment extends Fragment {
|
||||
int dailyTaskGoal = (dp != null && dp.dailyGoal > 0) ? dp.dailyGoal : 3;
|
||||
if (dailyTaskGoal <= 0) dailyTaskGoal = 3;
|
||||
|
||||
// LÓGICA DE STATUS SOLICITADA
|
||||
String status = "empty";
|
||||
if (completedTasksForDay >= dailyTaskGoal) {
|
||||
status = "completed";
|
||||
} else if (isToday) {
|
||||
status = "today";
|
||||
} else if (completedTasksForDay > 0) {
|
||||
status = "partial";
|
||||
}
|
||||
|
||||
android.util.Log.d("FLUXUP_DEBUG", "WEEK_DAY_DATE: " + dateStr);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "COMPLETED_TASKS_FOR_DAY: " + completedTasksForDay);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "DAILY_TASK_GOAL: " + dailyTaskGoal);
|
||||
// DEBUG LOGS
|
||||
android.util.Log.d("FLUXUP_DEBUG", "WEEK_DAY: " + i);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "DATE: " + dateStr);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "COMPLETED_TASKS: " + completedTasksForDay);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "DAILY_GOAL: " + dailyTaskGoal);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "IS_TODAY: " + isToday);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "DAY_STATUS: " + status);
|
||||
android.util.Log.d("FLUXUP_DEBUG", "FINAL_STATUS: " + status);
|
||||
|
||||
// RENDERIZAÇÃO
|
||||
if ("completed".equals(status)) {
|
||||
@@ -651,7 +652,10 @@ public class InicioFragment extends Fragment {
|
||||
// Verificação para conector verde (dia seguinte também completo)
|
||||
Calendar nextDayCal = (Calendar) dayCal.clone();
|
||||
nextDayCal.add(Calendar.DAY_OF_YEAR, 1);
|
||||
DailyProgress nextDp = progressMap.get(sdf.format(nextDayCal.getTime()));
|
||||
String nextDateStr = sdf.format(nextDayCal.getTime());
|
||||
DailyProgress nextDp = progressMap.get(nextDateStr);
|
||||
|
||||
// Se o próximo dia também estiver completo, conector verde
|
||||
if (nextDp != null && nextDp.completedTasks >= nextDp.dailyGoal && nextDp.dailyGoal > 0) {
|
||||
rightConnector.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.success_green));
|
||||
} else {
|
||||
@@ -662,11 +666,8 @@ public class InicioFragment extends Fragment {
|
||||
nodeCircle.getBackground().setTint(ContextCompat.getColor(getContext(), R.color.primary_purple));
|
||||
nodeDayInitial.setTextColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
if (rightConnector != null) rightConnector.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.border_color));
|
||||
} else if ("partial".equals(status)) {
|
||||
nodeCircle.getBackground().setTint(android.graphics.Color.parseColor("#4FC3F7"));
|
||||
nodeDayInitial.setTextColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
if (rightConnector != null) rightConnector.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.border_color));
|
||||
} else {
|
||||
// Estado Empty ou Incompleto (cinzento)
|
||||
nodeCircle.getBackground().setTint(android.graphics.Color.parseColor("#E0E0E0"));
|
||||
nodeDayInitial.setTextColor(ContextCompat.getColor(getContext(), R.color.text_primary));
|
||||
if (rightConnector != null) rightConnector.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.border_color));
|
||||
@@ -677,7 +678,11 @@ public class InicioFragment extends Fragment {
|
||||
nodeDayLabel.setVisibility(View.VISIBLE);
|
||||
nodeDayLabel.setTextColor(ContextCompat.getColor(getContext(), R.color.primary_purple));
|
||||
nodeProgress.setVisibility(View.VISIBLE);
|
||||
if (dailyTaskGoal > 0) {
|
||||
nodeProgress.setProgress(completedTasksForDay * 100 / dailyTaskGoal);
|
||||
} else {
|
||||
nodeProgress.setProgress(0);
|
||||
}
|
||||
} else {
|
||||
nodeDayLabel.setVisibility(View.GONE);
|
||||
nodeProgress.setVisibility(View.GONE);
|
||||
|
||||
52
app/src/main/java/com/fluxup/app/LeagueHelper.java
Normal file
52
app/src/main/java/com/fluxup/app/LeagueHelper.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.fluxup.app;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
public class LeagueHelper {
|
||||
|
||||
public static class LeagueInfo {
|
||||
public String name;
|
||||
public int minXp;
|
||||
public int maxXp;
|
||||
public int iconRes;
|
||||
public String colorHex;
|
||||
public String rewards;
|
||||
|
||||
public LeagueInfo(String name, int minXp, int maxXp, int iconRes, String colorHex, String rewards) {
|
||||
this.name = name;
|
||||
this.minXp = minXp;
|
||||
this.maxXp = maxXp;
|
||||
this.iconRes = iconRes;
|
||||
this.colorHex = colorHex;
|
||||
this.rewards = rewards;
|
||||
}
|
||||
}
|
||||
|
||||
public static final LeagueInfo[] LEAGUES = {
|
||||
new LeagueInfo("Bronze", 0, 499, R.drawable.ic_trophy_bronze, "#8D6E63", "• Badge Bronze"),
|
||||
new LeagueInfo("Prata", 500, 1499, R.drawable.ic_trophy_silver, "#B0BEC5", "• Badge Prata\n• Moldura Simples"),
|
||||
new LeagueInfo("Ouro", 1500, 2999, R.drawable.ic_trophy_gold, "#FFD54F", "• Badge Ouro\n• Moldura Dourada"),
|
||||
new LeagueInfo("Platina", 3000, 5999, R.drawable.ic_trophy_platinum, "#4FC3F7", "• Badge Platina\n• Tema Azul"),
|
||||
new LeagueInfo("Diamante", 6000, 9999, R.drawable.ic_trophy_diamond, "#1E88E5", "• Badge Diamante\n• Moldura Diamante"),
|
||||
new LeagueInfo("Mestre", 10000, 14999, R.drawable.ic_trophy_master, "#7C3AED", "• Badge Mestre\n• Tema Roxo Premium"),
|
||||
new LeagueInfo("Lenda", 15000, Integer.MAX_VALUE, R.drawable.ic_trophy_legend, "#D81B60", "• Badge Lenda\n• Moldura Lendária")
|
||||
};
|
||||
|
||||
public static LeagueInfo getCurrentLeague(int totalXp) {
|
||||
for (int i = LEAGUES.length - 1; i >= 0; i--) {
|
||||
if (totalXp >= LEAGUES[i].minXp) {
|
||||
return LEAGUES[i];
|
||||
}
|
||||
}
|
||||
return LEAGUES[0];
|
||||
}
|
||||
|
||||
public static LeagueInfo getNextLeague(int totalXp) {
|
||||
for (int i = 0; i < LEAGUES.length - 1; i++) {
|
||||
if (totalXp < LEAGUES[i + 1].minXp) {
|
||||
return LEAGUES[i + 1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
11
app/src/main/res/drawable/button_secondary.xml
Normal file
11
app/src/main/res/drawable/button_secondary.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#20000000">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F5F5F5" />
|
||||
<stroke android:width="1dp" android:color="@color/border_color" />
|
||||
<corners android:radius="@dimen/radius_duo" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
||||
9
app/src/main/res/drawable/ic_arrow_right.xml
Normal file
9
app/src/main/res/drawable/ic_arrow_right.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M8.59,16.59L13.17,12L8.59,7.41L10,6l6,6l-6,6L8.59,16.59z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_trophy_diamond.xml
Normal file
9
app/src/main/res/drawable/ic_trophy_diamond.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#1E88E5"
|
||||
android:pathData="M18,2H6A2,2 0,0 0,4 4V7C4,8.11 4.9,9 6,9H7V11C7,12.71 8.06,14.2 9.5,14.8V17H8V19H16V17H14.5V14.8C15.94,14.2 17,12.71 17,11V9H18A2,2 0,0 0,20 7V4A2,2 0,0 0,18 2M6,7V4H7V7H6M18,7H17V4H18V7Z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_trophy_legend.xml
Normal file
9
app/src/main/res/drawable/ic_trophy_legend.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#D81B60"
|
||||
android:pathData="M18,2H6A2,2 0,0 0,4 4V7C4,8.11 4.9,9 6,9H7V11C7,12.71 8.06,14.2 9.5,14.8V17H8V19H16V17H14.5V14.8C15.94,14.2 17,12.71 17,11V9H18A2,2 0,0 0,20 7V4A2,2 0,0 0,18 2M6,7V4H7V7H6M18,7H17V4H18V7Z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_trophy_master.xml
Normal file
9
app/src/main/res/drawable/ic_trophy_master.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#7C3AED"
|
||||
android:pathData="M18,2H6A2,2 0,0 0,4 4V7C4,8.11 4.9,9 6,9H7V11C7,12.71 8.06,14.2 9.5,14.8V17H8V19H16V17H14.5V14.8C15.94,14.2 17,12.71 17,11V9H18A2,2 0,0 0,20 7V4A2,2 0,0 0,18 2M6,7V4H7V7H6M18,7H17V4H18V7Z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_trophy_platinum.xml
Normal file
9
app/src/main/res/drawable/ic_trophy_platinum.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#4FC3F7"
|
||||
android:pathData="M18,2H6A2,2 0,0 0,4 4V7C4,8.11 4.9,9 6,9H7V11C7,12.71 8.06,14.2 9.5,14.8V17H8V19H16V17H14.5V14.8C15.94,14.2 17,12.71 17,11V9H18A2,2 0,0 0,20 7V4A2,2 0,0 0,18 2M6,7V4H7V7H6M18,7H17V4H18V7Z" />
|
||||
</vector>
|
||||
104
app/src/main/res/layout/item_division_card.xml
Normal file
104
app/src/main/res/layout/item_division_card.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/cardDivision"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardBackgroundColor="@color/card_background"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llDivisionBg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDivisionStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Liga Atual"
|
||||
android:textColor="@color/primary_purple"
|
||||
android:textStyle="bold"
|
||||
android:textSize="12sp"
|
||||
android:textAllCaps="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivDivisionIcon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@drawable/ic_trophy_bronze"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDivisionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Bronze"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDivisionXP"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="0 - 499 XP"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDivisionProgressText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Faltam 3585 XP para Mestre"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDivisionPercentage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="64% até à próxima divisão"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerRewards"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#E0E0E0"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Recompensas"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRewardsList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="• Badge Bronze\n• Moldura Simples"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
Reference in New Issue
Block a user