Skip to content

Commit

Permalink
Merge pull request #23 from SecUSo/fix/21
Browse files Browse the repository at this point in the history
Fixes #21.
  • Loading branch information
coderPaddyS authored Mar 12, 2024
2 parents 232a8bc + 54df1bd commit d0e1cbd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.preference.PreferenceManager;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -19,7 +20,6 @@
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -469,15 +469,15 @@ private class AddPlayerViewHolder extends ViewHolder {
private class PlayerViewHolder extends ViewHolder {

ImageButton playerColor;
Switch playertype;
SwitchCompat playertype;
ImageButton delete_player;
TextView playerName;
ImageView person;

PlayerViewHolder(final View itemView) {
super(itemView);
person = (ImageView) itemView.findViewById(R.id.image_player_type);
playertype = (Switch) itemView.findViewById(R.id.switch_player_type);
playertype = (SwitchCompat) itemView.findViewById(R.id.switch_player_type);
playerColor = (ImageButton) itemView.findViewById(R.id.button_player_color);
playerName = (TextView) itemView.findViewById(R.id.textView_player_name);
delete_player = (ImageButton) itemView.findViewById(R.id.button_delete_player);
Expand Down
38 changes: 14 additions & 24 deletions app/src/main/res/layout/player_item.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"
Expand All @@ -9,70 +9,60 @@
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">

<Switch
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_player_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:button="@drawable/toggle_switch"
android:maxWidth="70dp"
android:textColor="#000000"
android:textOff=""
android:textOn=""
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.538" />
android:layout_gravity="center"/>

<ImageView
android:id="@+id/image_player_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/ic_person_blue_24dp"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.538" />
android:layout_gravity="center" />


<ImageButton
android:id="@+id/button_player_color"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:onClick="onClick"
app:srcCompat="@drawable/button_highlighted"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
app:layout_constraintLeft_toLeftOf="@+id/button_delete_player"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="@+id/switch_player_type"
app:layout_constraintHorizontal_bias="0.765"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp" />
android:layout_marginBottom="8dp"
android:layout_gravity="center"/>

<TextView
android:id="@+id/textView_player_name"
android:layout_width="97dp"
android:layout_width="0dp"
android:layout_height="18dp"
android:maxLines="1"
android:text="@string/initial_name_field"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintRight_toLeftOf="@+id/button_delete_player"
android:layout_marginRight="8dp"
app:layout_constraintLeft_toRightOf="@+id/button_player_color"
android:layout_marginLeft="8dp"
app:layout_constraintHorizontal_bias="0.162" />
android:layout_weight="1"
android:layout_gravity="center" />

<ImageButton
android:id="@+id/button_delete_player"
Expand All @@ -85,7 +75,7 @@
android:layout_marginTop="4dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_gravity="center"
app:layout_constraintRight_toRightOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

0 comments on commit d0e1cbd

Please sign in to comment.