Commit c6c72828 authored by rakam's avatar rakam
Browse files

Player's photos

parent a475d6d3
package fr.istic.masteru.android.adapters;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
......@@ -10,7 +9,6 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.koushikdutta.async.future.FutureCallback;
import com.koushikdutta.ion.Ion;
import java.util.List;
......@@ -18,7 +16,6 @@ import java.util.List;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.listeners.OnPlayerSelectedListener;
import fr.istic.masteru.android.model.PlayerInfo;
import fr.istic.masteru.android.utils.Util;
public class PlayerAdapter extends BaseAdapter {
......@@ -69,17 +66,18 @@ public class PlayerAdapter extends BaseAdapter {
}
final PlayerInfo playerInfo = players.get(position);
final ViewHolder viewHolder = (ViewHolder) itemView.getTag();
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);
}
});
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)");
......
......@@ -82,7 +82,8 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
tableau = "1/4";
final JsonObject param = new JsonObject();
param.addProperty("tableau", tableau);
// param.addProperty("tableau", tableau);
param.addProperty("tableau", "1/4");
Ion.with(matchSetupActivity)
.load(API_URLS.MATCHS)
.setTimeout(1000 * 10)
......
......@@ -7,7 +7,7 @@ public class PlayerInfo implements Serializable {
public static final int MAN = 1;
public static final int WOMAN = 2;
private static final String rootPhotoUrl = ""; //todo
private static final String rootPhotoUrl = "https://dl.dropboxusercontent.com/u/20851137/photos/";
private int id;
private int gender;
......@@ -46,6 +46,6 @@ public class PlayerInfo implements Serializable {
}
public String getPhotoUrl() {
return rootPhotoUrl + id;
return rootPhotoUrl + id + ".jpg";
}
}
......@@ -14,7 +14,8 @@
android:layout_width="80dp"
android:layout_height="100dp"
android:layout_centerVertical="true"
android:background="#ddd" />
android:background="#ddd"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/name"
......
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