Fix card dashboard styling.
- Center card text and make it darker. - Make card ripple when clicked.
This commit is contained in:
parent
7f5aea94ec
commit
cca4b70b90
@ -17,6 +17,8 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class CardPreviewArrayAdapter extends ArrayAdapter<PreviewCard> {
|
class CardPreviewArrayAdapter extends ArrayAdapter<PreviewCard> {
|
||||||
@ -41,7 +43,11 @@ class CardPreviewArrayAdapter extends ArrayAdapter<PreviewCard> {
|
|||||||
final View row = inflater.inflate(R.layout.card_preview, parent, false);
|
final View row = inflater.inflate(R.layout.card_preview, parent, false);
|
||||||
final PreviewCard card = this.cards[position];
|
final PreviewCard card = this.cards[position];
|
||||||
|
|
||||||
row.setOnClickListener(new View.OnClickListener() {
|
TextView nameView = row.findViewById(R.id.card_preview_name);
|
||||||
|
final CardView cardView = row.findViewById(R.id.card_preview_card);
|
||||||
|
final FloatingActionButton settingsButton = row.findViewById(R.id.card_preview_settings_button);
|
||||||
|
|
||||||
|
cardView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent i = new Intent(CardActivity.INTENT);
|
Intent i = new Intent(CardActivity.INTENT);
|
||||||
@ -50,7 +56,7 @@ class CardPreviewArrayAdapter extends ArrayAdapter<PreviewCard> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final ImageView settingsButton = row.findViewById(R.id.card_preview_settings_button);
|
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -58,8 +64,6 @@ class CardPreviewArrayAdapter extends ArrayAdapter<PreviewCard> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CardView cardView = row.findViewById(R.id.card_preview_card);
|
|
||||||
TextView nameView = row.findViewById(R.id.card_preview_name);
|
|
||||||
|
|
||||||
nameView.setText(card.getName());
|
nameView.setText(card.getName());
|
||||||
return row;
|
return row;
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="auto"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:paddingLeft="15dp"
|
android:paddingLeft="15dp"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp"
|
||||||
android:paddingRight="15dp"
|
android:paddingRight="15dp"
|
||||||
@ -28,23 +31,31 @@
|
|||||||
card_view:layout_constraintStart_toStartOf="parent"
|
card_view:layout_constraintStart_toStartOf="parent"
|
||||||
card_view:layout_constraintTop_toTopOf="parent">
|
card_view:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<RelativeLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="100dp"
|
||||||
android:minHeight="100dp">
|
android:height="100dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/card_preview_name"
|
android:id="@+id/card_preview_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="TextView"
|
android:layout_marginEnd="20dp"
|
||||||
android:textSize="25dp"
|
android:layout_marginRight="20dp"
|
||||||
tools:layout_editor_absoluteX="8dp"
|
android:layout_marginBottom="30dp"
|
||||||
tools:layout_editor_absoluteY="3dp" />
|
android:text="@string/placeholder_text"
|
||||||
|
android:textColor="?android:attr/colorForeground"
|
||||||
|
android:textSize="25sp"
|
||||||
|
card_view:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
card_view:layout_constraintEnd_toEndOf="parent"
|
||||||
|
card_view:layout_constraintStart_toStartOf="parent"
|
||||||
|
card_view:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
@ -15,4 +15,5 @@
|
|||||||
<string name="action_login_short">Login</string>
|
<string name="action_login_short">Login</string>
|
||||||
<string name="loading">Loading...</string>
|
<string name="loading">Loading...</string>
|
||||||
<string name="invalid_user_pass">Invalid username/password</string>
|
<string name="invalid_user_pass">Invalid username/password</string>
|
||||||
|
<string name="placeholder_text">Placeholder text</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user