Commit 86f29d41 authored by rakam's avatar rakam

Message si tournois en SETTING-UP

parent e30d84a0
......@@ -2,7 +2,6 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/MasterU.iml" filepath="$PROJECT_DIR$/MasterU.iml" />
<module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
......
......@@ -2,6 +2,7 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
......@@ -85,10 +85,10 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="androidasync-2.1.2" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.2" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
</component>
</module>
......@@ -2,13 +2,13 @@ package fr.istic.masteru.android.fragments;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
......@@ -36,6 +36,7 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
private MatchAdapter matchAdapter;
private Button nextButton;
private ProgressBar progressBar;
private TextView noMatches;
@Override
public void onAttach(Activity activity) {
......@@ -46,7 +47,6 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
throw new IllegalArgumentException("Activity must be an MatchSetupActivity");
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.select_match_fragment, container, false);
......@@ -58,6 +58,7 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
}
});
progressBar = (ProgressBar) root.findViewById(R.id.progressBar);
noMatches = (TextView) root.findViewById(R.id.noMatches);
ListView matchListView = (ListView) root.findViewById(R.id.matchListView);
matchListView.setDividerHeight(getResources().getDimensionPixelSize(R.dimen.divider_height));
matchAdapter = new MatchAdapter(matchSetupActivity, matches, this);
......@@ -73,26 +74,18 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
Date d = new Date();
String dayOfTheWeek = sdf.format(d);
String tableau = null;
if (dayOfTheWeek.equals("Sunday"))
tableau = "finale";
else if (dayOfTheWeek.equals("Saturday"))
tableau = "1/2";
else if (dayOfTheWeek.equals("Friday"))
tableau = "1/4";
if (tableau == null)
tableau = "1/4";
Ion.with(matchSetupActivity)
.load("GET", API_URLS.MATCHS + "?round=1/4")
.load("GET", API_URLS.MATCHS + "?round=CURRENT")
.setTimeout(1000 * 10)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
if (e != null || result != null && result.get("code").getAsInt() != 0) {
loadMatches();
if (result.get("code").getAsInt() == -3)
noMatches();
else
loadMatches();
return;
}
progressBar.setVisibility(View.GONE);
......@@ -121,6 +114,11 @@ public class SelectMatchFragment extends SetupFragment implements OnMatchSelecte
});
}
private void noMatches() {
progressBar.setVisibility(View.GONE);
noMatches.setText(matchSetupActivity.getString(R.string.no_match_setting_up));
}
@Override
public void onMatchSelected(Match match) {
if (match == null) {
......
......@@ -2,7 +2,7 @@ package fr.istic.masteru.android.utils;
public class API_URLS {
public static final String BASE_URL = "http://5.196.21.161:9222";
public static final String BASE_URL = "http://5.196.21.161:2222";
public static final String PING_ADD_NUMBER = BASE_URL + "/test/nombres/ajouterNombre";
public static final String SCORE_UPDATE = BASE_URL + "/score/update";
public static final String MATCH_WINNER = BASE_URL + "/match/finMatch";
......
......@@ -37,6 +37,13 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/noMatches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="20sp"/>
<ListView
android:id="@+id/matchListView"
android:layout_width="match_parent"
......
......@@ -38,5 +38,6 @@
<string name="FAUTE_DIRECT_ADV">POINT SUR FAUTE\nDIRECTE DE L\'ADVERSAIRE</string>
<string name="COUP_GAGNANT">COUP GAGNANT</string>
<string name="SERVICE_GAGNANT">SERVICE GAGNANT</string>
<string name="no_match_setting_up">Aucun match disponible.\nLa compétition n\'a pas commencé.</string>
</resources>
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