Commit 02ec9b4a authored by rakam's avatar rakam

New design [WIP 2]

parent ba449351
......@@ -2,7 +2,6 @@ package fr.istic.masteru.android.adapters;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -26,10 +25,7 @@ public class MatchAdapter extends BaseAdapter {
private List<Match> matches;
private OnMatchSelectedListener onMatchSelectedListener;
private int selectedItem = -1;
private int lightGrey;
private Drawable normalBackground;
private Drawable selectedBackground;
private int normalTextColor;
private int selectedTextColor;
......@@ -38,11 +34,8 @@ public class MatchAdapter extends BaseAdapter {
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.matches = matches;
this.onMatchSelectedListener = listener;
lightGrey = context.getResources().getColor(R.color.light_grey);
normalBackground = context.getResources().getDrawable(R.drawable.ac_button_normal);
selectedBackground = context.getResources().getDrawable(R.drawable.ac_button_selected);
normalTextColor = Color.parseColor("#111111");
selectedTextColor = Color.parseColor("#eeeeee");
selectedTextColor = Color.parseColor("#ffffff");
}
@Override
......@@ -119,7 +112,7 @@ public class MatchAdapter extends BaseAdapter {
}
private void select(View itemView) {
itemView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.ac_button_selected));
itemView.setBackgroundResource(R.drawable.ac_button_selected);
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.paysA.setTextColor(selectedTextColor);
viewHolder.paysB.setTextColor(selectedTextColor);
......@@ -130,12 +123,13 @@ public class MatchAdapter extends BaseAdapter {
}
private void unselect(View itemView) {
itemView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.ac_button_normal));
itemView.setBackgroundResource(R.drawable.ac_button_normal);
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.paysA.setTextColor(normalTextColor);
viewHolder.paysB.setTextColor(normalTextColor);
viewHolder.categorie.setTextColor(normalTextColor);
viewHolder.tableau.setTextColor(normalTextColor);
viewHolder._vs.setTextColor(normalTextColor);
viewHolder._separator.setTextColor(normalTextColor);
}
......
......@@ -26,7 +26,9 @@ public class PlayerAdapter extends BaseAdapter {
private int selectedItem1 = -1;
private int selectedItem2 = -1;
private boolean isDouble;
private int lightGrey;
private int normalTextColor;
private int selectedTextColor;
public PlayerAdapter(Context context, List<PlayerInfo> players, boolean isDouble,
OnPlayerSelectedListener listener) {
......@@ -35,7 +37,8 @@ public class PlayerAdapter extends BaseAdapter {
this.players = players;
this.isDouble = isDouble;
this.onPlayerSelectedListener = listener;
lightGrey = context.getResources().getColor(R.color.light_grey);
normalTextColor = Color.parseColor("#111111");
selectedTextColor = Color.parseColor("#ffffff");
}
@Override
......@@ -67,40 +70,30 @@ public class PlayerAdapter extends BaseAdapter {
final PlayerInfo playerInfo = players.get(position);
final ViewHolder viewHolder = (ViewHolder) itemView.getTag();
Ion.with(viewHolder.photo).load(playerInfo.getPhotoUrl());
// Ion.with(context).load(playerInfo.getPhotoUrl())
// .asBitmap()
// .setCallback(new FutureCallback<Bitmap>() {
// @Override
// public void onCompleted(Exception e, Bitmap result) {
// if (result == null) {
// result = Util.getPersonBitmap(context);
// }
// viewHolder.photo.setImageBitmap(result);
// }
// });
viewHolder.name.setText(playerInfo.getName());
viewHolder.gender.setText(playerInfo.getGender() == PlayerInfo.MAN ? "(M)" : "(W)");
final View finalItemView = itemView;
if (position == selectedItem1 || position == selectedItem2)
finalItemView.setBackgroundColor(Color.RED);
else
itemView.setBackgroundColor(lightGrey);
if (position == selectedItem1 || position == selectedItem2) {
select(finalItemView);
} else {
unselect(finalItemView);
}
if (isDouble) {
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (position == selectedItem1) {
finalItemView.setBackgroundColor(lightGrey);
unselect(finalItemView);
selectedItem1 = -1;
onPlayerSelectedListener.onPlayer1Change(null);
} else if (position == selectedItem2) {
finalItemView.setBackgroundColor(lightGrey);
unselect(finalItemView);
selectedItem2 = -1;
onPlayerSelectedListener.onPlayer2Change(null);
} else {
finalItemView.setBackgroundColor(Color.RED);
select(finalItemView);
if (selectedItem1 == -1) {
selectedItem1 = position;
onPlayerSelectedListener.onPlayer1Change(playerInfo);
......@@ -122,11 +115,11 @@ public class PlayerAdapter extends BaseAdapter {
@Override
public void onClick(View view) {
if (position == selectedItem1) {
finalItemView.setBackgroundColor(lightGrey);
unselect(finalItemView);
selectedItem1 = -1;
onPlayerSelectedListener.onPlayer1Change(null);
} else {
finalItemView.setBackgroundColor(Color.RED);
select(finalItemView);
selectedItem1 = position;
notifyDataSetChanged();
onPlayerSelectedListener.onPlayer1Change(playerInfo);
......@@ -137,6 +130,20 @@ public class PlayerAdapter extends BaseAdapter {
return itemView;
}
private void select(View itemView) {
itemView.setBackgroundResource(R.drawable.ac_button_selected);
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.name.setTextColor(selectedTextColor);
viewHolder.gender.setTextColor(selectedTextColor);
}
private void unselect(View itemView) {
itemView.setBackgroundResource(R.drawable.ac_button_normal);
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.name.setTextColor(normalTextColor);
viewHolder.gender.setTextColor(normalTextColor);
}
static class ViewHolder {
ImageView photo;
TextView name;
......
package fr.istic.masteru.android.fragments;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
......@@ -54,8 +53,8 @@ public class SelectFirstServiceFragment extends SetupFragment {
countryAButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
countryAButton.setBackgroundColor(Color.RED);
countryBButton.setBackgroundColor(lightGrey);
countryAButton.setSelected(true);
countryBButton.setSelected(false);
matchSetupActivity.onFirstServiceChange(match.getTeamA());
nextButton.setVisibility(View.VISIBLE);
}
......@@ -63,8 +62,8 @@ public class SelectFirstServiceFragment extends SetupFragment {
countryBButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
countryAButton.setBackgroundColor(lightGrey);
countryBButton.setBackgroundColor(Color.RED);
countryAButton.setSelected(false);
countryBButton.setSelected(true);
matchSetupActivity.onFirstServiceChange(match.getTeamB());
nextButton.setVisibility(View.VISIBLE);
}
......
package fr.istic.masteru.android.fragments;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
......@@ -59,8 +58,8 @@ public class SelectInitialSideFragment extends SetupFragment {
countryAButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
countryAButton.setBackgroundColor(Color.RED);
countryBButton.setBackgroundColor(lightGrey);
countryAButton.setSelected(true);
countryBButton.setSelected(false);
matchSetupActivity.onInitialSideChange(Constants.A_IS_LEFT);
nextButton.setVisibility(View.VISIBLE);
}
......@@ -68,8 +67,8 @@ public class SelectInitialSideFragment extends SetupFragment {
countryBButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
countryAButton.setBackgroundColor(lightGrey);
countryBButton.setBackgroundColor(Color.RED);
countryAButton.setSelected(false);
countryBButton.setSelected(true);
matchSetupActivity.onInitialSideChange(Constants.A_IS_RIGHT);
nextButton.setVisibility(View.VISIBLE);
}
......
......@@ -5,9 +5,12 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:background="#eee"
android:background="@drawable/ac_button_background"
android:gravity="center_horizontal"
android:paddingRight="10dp">
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="1dp"
android:paddingBottom="1dp">
<ImageView
android:id="@+id/photo"
......@@ -17,7 +20,7 @@
android:background="#ddd"
android:scaleType="centerCrop"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -25,9 +28,10 @@
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/photo"
android:text="Joueur A"
android:textStyle="italic"
android:textSize="20sp"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -35,6 +39,6 @@
android:layout_alignParentTop="true"
android:layout_marginTop="3dp"
android:textSize="18sp"
android:textStyle="bold"/>
android:textStyle="italic"/>
</RelativeLayout>
\ No newline at end of file
......@@ -40,34 +40,36 @@
android:background="@android:color/transparent"
android:visibility="invisible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/previousButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_previous"
android:drawableTop="@drawable/left_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/previous"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="visible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>
<LinearLayout
......
......@@ -11,41 +11,43 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#226"
android:background="@color/setup_header"
android:padding="10dp"
android:text="@string/first_service"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/previousButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_previous"
android:drawableTop="@drawable/left_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/previous"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="visible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>
<LinearLayout
......@@ -60,23 +62,25 @@
android:orientation="horizontal"
android:weightSum="100">
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/countryA"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_marginRight="40dp"
android:layout_weight="50"
android:background="@drawable/ac_button_background"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textStyle="italic"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/countryB"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_weight="50"
android:background="@drawable/ac_button_background"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textStyle="italic"
android:textSize="22sp"/>
</LinearLayout>
......
......@@ -11,41 +11,43 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#226"
android:background="@color/setup_header"
android:padding="10dp"
android:text="@string/select_left_team"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/previousButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_previous"
android:drawableTop="@drawable/left_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/previous"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="visible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>
<LinearLayout
......@@ -60,23 +62,25 @@
android:orientation="horizontal"
android:weightSum="100">
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/countryA"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_marginRight="40dp"
android:layout_weight="50"
android:background="@drawable/ac_button_background"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textStyle="italic"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/countryB"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_weight="50"
android:background="@drawable/ac_button_background"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textStyle="italic"
android:textSize="22sp"/>
</LinearLayout>
......
......@@ -16,19 +16,20 @@
android:textSize="20sp"
android:textStyle="bold"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>
<ProgressBar
......
......@@ -9,41 +9,43 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:background="#226"
android:background="@color/setup_header"
android:padding="10dp"
android:text="Selectionnez les joueurs"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/previousButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_previous"
android:drawableTop="@drawable/left_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/previous"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="visible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>
<ProgressBar
......
......@@ -11,41 +11,43 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#226"
android:background="@color/setup_header"
android:padding="10dp"
android:text="@string/refereeing_type"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/previousButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_previous"
android:drawableTop="@drawable/left_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/previous"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="visible"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/nextButton"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableTop="@android:drawable/ic_media_next"
android:drawableTop="@drawable/right_arrow"
android:paddingBottom="40dp"
android:paddingTop="40dp"
android:text="@string/next"
android:textColor="#777"
android:textSize="22sp"
android:textStyle="italic"
android:visibility="invisible"/>