tabela de classificacoes
This commit is contained in:
@@ -38,9 +38,29 @@ public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.View
|
|||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
Team team = mTeams.get(position);
|
Team team = mTeams.get(position);
|
||||||
|
|
||||||
holder.textPosition.setText(String.valueOf(position + 1));
|
int rank = position + 1;
|
||||||
|
holder.textPosition.setText(String.valueOf(rank));
|
||||||
|
|
||||||
|
if (rank >= 1 && rank <= 3) {
|
||||||
|
holder.textPosition.setBackgroundResource(R.drawable.bg_circle_green);
|
||||||
|
holder.textPosition.setTextColor(android.graphics.Color.WHITE);
|
||||||
|
} else if (rank == 4) {
|
||||||
|
holder.textPosition.setBackgroundResource(R.drawable.bg_circle_yellow);
|
||||||
|
holder.textPosition.setTextColor(android.graphics.Color.WHITE);
|
||||||
|
} else if (rank >= 5 && rank <= 6) {
|
||||||
|
holder.textPosition.setBackgroundResource(R.drawable.bg_circle_orange);
|
||||||
|
holder.textPosition.setTextColor(android.graphics.Color.WHITE);
|
||||||
|
} else {
|
||||||
|
holder.textPosition.setBackgroundResource(R.drawable.bg_circle_transparent);
|
||||||
|
holder.textPosition.setTextColor(android.graphics.Color.BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
holder.textTeamName.setText(team.getName());
|
holder.textTeamName.setText(team.getName());
|
||||||
holder.textPlayed.setText(String.valueOf(team.getPlayed()));
|
holder.textPlayed.setText(String.valueOf(team.getPlayed()));
|
||||||
|
holder.textWon.setText(String.valueOf(team.getWon()));
|
||||||
|
holder.textDrawn.setText(String.valueOf(team.getDrawn()));
|
||||||
|
holder.textLost.setText(String.valueOf(team.getLost()));
|
||||||
|
holder.textGoalDiff.setText(String.valueOf(team.getGoalDifference()));
|
||||||
holder.textPoints.setText(String.valueOf(team.getPoints()));
|
holder.textPoints.setText(String.valueOf(team.getPoints()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,15 +71,25 @@ public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.View
|
|||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
public final TextView textPosition;
|
public final TextView textPosition;
|
||||||
|
public final android.widget.ImageView imageLogo;
|
||||||
public final TextView textTeamName;
|
public final TextView textTeamName;
|
||||||
public final TextView textPlayed;
|
public final TextView textPlayed;
|
||||||
|
public final TextView textWon;
|
||||||
|
public final TextView textDrawn;
|
||||||
|
public final TextView textLost;
|
||||||
|
public final TextView textGoalDiff;
|
||||||
public final TextView textPoints;
|
public final TextView textPoints;
|
||||||
|
|
||||||
public ViewHolder(View view) {
|
public ViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
textPosition = view.findViewById(R.id.text_position);
|
textPosition = view.findViewById(R.id.text_position);
|
||||||
|
imageLogo = view.findViewById(R.id.image_logo);
|
||||||
textTeamName = view.findViewById(R.id.text_team_name);
|
textTeamName = view.findViewById(R.id.text_team_name);
|
||||||
textPlayed = view.findViewById(R.id.text_played);
|
textPlayed = view.findViewById(R.id.text_played);
|
||||||
|
textWon = view.findViewById(R.id.text_won);
|
||||||
|
textDrawn = view.findViewById(R.id.text_drawn);
|
||||||
|
textLost = view.findViewById(R.id.text_lost);
|
||||||
|
textGoalDiff = view.findViewById(R.id.text_goal_diff);
|
||||||
textPoints = view.findViewById(R.id.text_points);
|
textPoints = view.findViewById(R.id.text_points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
app/src/main/res/drawable/bg_circle_green.xml
Normal file
5
app/src/main/res/drawable/bg_circle_green.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#28a745"/>
|
||||||
|
</shape>
|
||||||
5
app/src/main/res/drawable/bg_circle_orange.xml
Normal file
5
app/src/main/res/drawable/bg_circle_orange.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#fd7e14"/>
|
||||||
|
</shape>
|
||||||
5
app/src/main/res/drawable/bg_circle_transparent.xml
Normal file
5
app/src/main/res/drawable/bg_circle_transparent.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@android:color/transparent"/>
|
||||||
|
</shape>
|
||||||
5
app/src/main/res/drawable/bg_circle_yellow.xml
Normal file
5
app/src/main/res/drawable/bg_circle_yellow.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#ffc107"/>
|
||||||
|
</shape>
|
||||||
8
app/src/main/res/drawable/bg_table_header.xml
Normal file
8
app/src/main/res/drawable/bg_table_header.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#0a1835"/>
|
||||||
|
<corners
|
||||||
|
android:topLeftRadius="12dp"
|
||||||
|
android:topRightRadius="12dp"/>
|
||||||
|
</shape>
|
||||||
@@ -18,57 +18,91 @@
|
|||||||
android:textColor="@color/primary_color"
|
android:textColor="@color/primary_color"
|
||||||
android:layout_marginBottom="24dp" />
|
android:layout_marginBottom="24dp" />
|
||||||
|
|
||||||
<!-- Table Header (Clean) -->
|
<!-- Table Header -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingVertical="12dp"
|
android:paddingVertical="8dp"
|
||||||
android:paddingHorizontal="4dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:background="#00000000">
|
android:background="@drawable/bg_table_header">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="40dp"
|
android:layout_width="28dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="#"
|
android:gravity="center"
|
||||||
android:textStyle="bold"
|
android:text="POS"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"/>
|
android:textSize="10sp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Clube"
|
android:text="EQUIPA"
|
||||||
android:textStyle="bold"
|
android:textColor="@color/white"
|
||||||
android:textColor="@color/black"
|
android:textSize="10sp"
|
||||||
android:textSize="14sp"/>
|
android:textStyle="normal" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="40dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="J"
|
android:text="J"
|
||||||
android:textStyle="bold"
|
android:textColor="@color/white"
|
||||||
android:textColor="@color/black"
|
android:textSize="10sp"
|
||||||
android:textSize="14sp"
|
android:textStyle="normal" />
|
||||||
android:tooltipText="Jogos" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="40dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Pts"
|
android:text="V"
|
||||||
android:textStyle="bold"
|
android:textColor="@color/white"
|
||||||
android:textColor="@color/black"
|
android:textSize="10sp"
|
||||||
android:textSize="14sp"/>
|
android:textStyle="normal" />
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="24dp"
|
||||||
android:layout_height="1dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/divider"
|
android:gravity="center"
|
||||||
android:layout_marginBottom="8dp"/>
|
android:text="E"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="D"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="26dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="DG"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="PTS"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="normal" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_standings"
|
android:id="@+id/recycler_standings"
|
||||||
|
|||||||
@@ -7,19 +7,29 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingVertical="16dp"
|
android:paddingVertical="12dp"
|
||||||
android:paddingHorizontal="4dp"
|
android:paddingHorizontal="8dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_position"
|
android:id="@+id/text_position"
|
||||||
android:layout_width="40dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginHorizontal="2dp"
|
||||||
|
android:gravity="center"
|
||||||
android:text="1"
|
android:text="1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/black"
|
android:background="@drawable/bg_circle_green" />
|
||||||
android:textSize="16sp" />
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_logo"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginHorizontal="2dp"
|
||||||
|
android:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_team_name"
|
android:id="@+id/text_team_name"
|
||||||
@@ -28,27 +38,65 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Team Name"
|
android:text="Team Name"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="13sp"
|
||||||
android:textStyle="normal" />
|
android:textStyle="bold"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_played"
|
android:id="@+id/text_played"
|
||||||
android:layout_width="40dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="P"
|
android:text="0"
|
||||||
android:textColor="@color/text_secondary"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="14sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_won"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_drawn"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_lost"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_goal_diff"
|
||||||
|
android:layout_width="26dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_points"
|
android:id="@+id/text_points"
|
||||||
android:layout_width="40dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="Pts"
|
android:text="0"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="14sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user