Commit ba449351 authored by rakam's avatar rakam

New design [WIP]

parent 8e5c1a24
......@@ -2,6 +2,7 @@ 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;
......@@ -27,12 +28,21 @@ public class MatchAdapter extends BaseAdapter {
private int selectedItem = -1;
private int lightGrey;
private Drawable normalBackground;
private Drawable selectedBackground;
private int normalTextColor;
private int selectedTextColor;
public MatchAdapter(Context context, List<Match> matches, OnMatchSelectedListener listener) {
this.context = context;
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");
}
@Override
......@@ -62,6 +72,8 @@ public class MatchAdapter extends BaseAdapter {
viewHolder.paysB = (TextView) itemView.findViewById(R.id.paysB);
viewHolder.categorie = (TextView) itemView.findViewById(R.id.categorie);
viewHolder.tableau = (TextView) itemView.findViewById(R.id.tableau);
viewHolder._vs = (TextView) itemView.findViewById(R.id._vs);
viewHolder._separator = (TextView) itemView.findViewById(R.id._separator);
itemView.setTag(viewHolder);
}
final Match match = matches.get(position);
......@@ -83,20 +95,21 @@ public class MatchAdapter extends BaseAdapter {
}
viewHolder.tableau.setText(Utils.getTableauName(match.getTableau()));
final View finalItemView = itemView;
if (position == selectedItem)
finalItemView.setBackgroundColor(Color.RED);
else
itemView.setBackgroundColor(lightGrey);
if (position == selectedItem) {
select(finalItemView);
} else {
unselect(finalItemView);
}
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (position != selectedItem) {
notifyDataSetChanged();
finalItemView.setBackgroundColor(Color.RED);
select(finalItemView);
selectedItem = position;
onMatchSelectedListener.onMatchSelected(match);
} else {
finalItemView.setBackgroundColor(lightGrey);
unselect(finalItemView);
selectedItem = -1;
onMatchSelectedListener.onMatchSelected(null);
}
......@@ -105,11 +118,34 @@ public class MatchAdapter extends BaseAdapter {
return itemView;
}
private void select(View itemView) {
itemView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.ac_button_selected));
ViewHolder viewHolder = (ViewHolder) itemView.getTag();
viewHolder.paysA.setTextColor(selectedTextColor);
viewHolder.paysB.setTextColor(selectedTextColor);
viewHolder.categorie.setTextColor(selectedTextColor);
viewHolder.tableau.setTextColor(selectedTextColor);
viewHolder._vs.setTextColor(selectedTextColor);
viewHolder._separator.setTextColor(selectedTextColor);
}
private void unselect(View itemView) {
itemView.setBackgroundDrawable(context.getResources().getDrawable(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._separator.setTextColor(normalTextColor);
}
static class ViewHolder {
ImageView drapeauA, drapeauB;
TextView paysA, paysB;
TextView categorie;
TextView tableau;
TextView _vs;
TextView _separator;
}
}
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;
......@@ -50,8 +49,8 @@ public class SelectRefereeingTypeFragment extends SetupFragment {
classicDouble.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
classicDouble.setBackgroundColor(Color.RED);
proDouble.setBackgroundColor(lightGrey);
classicDouble.setSelected(true);
proDouble.setSelected(false);
matchSetupActivity.onRefereeingTypeChange(Constants.DOUBLE_CLASSIC);
nextButton.setVisibility(View.VISIBLE);
}
......@@ -59,8 +58,8 @@ public class SelectRefereeingTypeFragment extends SetupFragment {
proDouble.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
classicDouble.setBackgroundColor(lightGrey);
proDouble.setBackgroundColor(Color.RED);
classicDouble.setSelected(false);
proDouble.setSelected(true);
matchSetupActivity.onRefereeingTypeChange(Constants.DOUBLE_PRO);
nextButton.setVisibility(View.VISIBLE);
}
......
......@@ -6,8 +6,12 @@ import android.graphics.Typeface;
public class FontUtils {
public static Typeface robotoThinFont;
public static Typeface robotoRegularFont;
public static Typeface robotoBoldFont;
public static void loadFont(Context context) {
robotoThinFont = Typeface.createFromAsset(context.getAssets(), "Roboto-Thin.ttf");
robotoRegularFont = Typeface.createFromAsset(context.getAssets(), "Roboto-Regular.ttf");
robotoBoldFont = Typeface.createFromAsset(context.getAssets(), "Roboto-Bold.ttf");
}
}
package fr.istic.masteru.android.views;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
......@@ -10,16 +11,24 @@ public class RobotoTextView extends TextView {
public RobotoTextView(Context context) {
super(context);
setTypeface(FontUtils.robotoThinFont);
}
public RobotoTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setTypeface(FontUtils.robotoThinFont);
}
public RobotoTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setTypeface(FontUtils.robotoThinFont);
}
@Override
public void setTypeface(Typeface tf, int style) {
if (style == Typeface.BOLD) {
super.setTypeface(FontUtils.robotoBoldFont);
} else if (style == Typeface.ITALIC) { // Dirty hack here. ITALIC == THIN
super.setTypeface(FontUtils.robotoThinFont);
} else {
super.setTypeface(FontUtils.robotoRegularFont);
}
}
}
......@@ -26,28 +26,31 @@
android:layout_height="40dp"
android:src="@drawable/france"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/paysA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="France"
android:textStyle="italic"
android:textColor="#444"
android:textSize="22sp"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/_vs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="vs"
android:textStyle="italic"
android:textColor="#444"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/paysB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="USA"
android:textStyle="italic"
android:textColor="#444"
android:textSize="22sp"/>
......@@ -66,28 +69,32 @@
android:layout_marginTop="10dp"
android:gravity="center">
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/categorie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Simple Homme"
android:textStyle="italic"
android:textColor="#444"
android:textSize="18sp"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="-"
android:textStyle="italic"
android:textColor="#444"
android:textSize="18sp"/>
<TextView
<fr.istic.masteru.android.views.RobotoTextView
android:id="@+id/tableau"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quarts de finale"
android:textStyle="italic"
android:textColor="#444"
android:textSize="18sp"/>
......
......@@ -11,7 +11,7 @@
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_court"
android:textColor="#ffffff"
......@@ -93,7 +93,7 @@
android:paddingRight="10dp"
android:weightSum="100">
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court1"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -102,10 +102,11 @@
android:background="@drawable/ac_button_background"
android:text="Court Central"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court2"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -114,10 +115,11 @@
android:background="@drawable/ac_button_background"
android:text="Court 1"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court3"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -126,10 +128,11 @@
android:background="@drawable/ac_button_background"
android:text="Court 2"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court4"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -138,7 +141,8 @@
android:background="@drawable/ac_button_background"
android:text="Court 3"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
......@@ -153,7 +157,7 @@
android:paddingRight="10dp"
android:weightSum="100">
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court5"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -162,10 +166,11 @@
android:background="@drawable/ac_button_background"
android:text="Court 4"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court6"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -174,10 +179,11 @@
android:background="@drawable/ac_button_background"
android:text="Court 5"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/court7"
android:layout_width="match_parent"
android:layout_height="0px"
......@@ -186,7 +192,8 @@
android:background="@drawable/ac_button_background"
android:text="Court 6"
android:enabled="false"
android:textColor="#444"
android:textStyle="italic"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
</LinearLayout>
......
......@@ -9,7 +9,7 @@
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="Selectionnez un match"
android:textColor="#ffffff"
......
......@@ -60,25 +60,25 @@
android:orientation="horizontal"
android:weightSum="100">
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/classicDouble"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_marginRight="40dp"
android:layout_weight="50"
android:background="@color/light_grey"
android:background="@drawable/ac_button_background"
android:text="@string/classic_double"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
<Button
<fr.istic.masteru.android.views.RobotoButton
android:id="@+id/proDouble"
android:layout_width="0px"
android:layout_height="150dp"
android:layout_weight="50"
android:background="@color/light_grey"
android:background="@drawable/ac_button_background"
android:text="@string/pro_double"
android:textColor="#444"
android:textColor="@color/ac_button_color"
android:textSize="22sp"/>
</LinearLayout>
......
......@@ -13,4 +13,5 @@
<color name="matchscore_loser">#ffff7c74</color>
<color name="matchscore_gamescore_background">#333</color>
<color name="blue_accent">#226</color>
<color name="setup_header">#cccc19</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment