Commit 6f77c339 authored by rakam's avatar rakam

cleanup

parent 970edab1
......@@ -9,7 +9,7 @@ android {
minSdkVersion 15
targetSdkVersion 21
versionCode 2
versionName "1.3 Décembre 2014"
versionName "AceCream 1.0"
}
buildTypes {
release {
......
......@@ -26,11 +26,6 @@
android:screenOrientation="sensorLandscape"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
<activity
android:name=".activities.MainActivity"
android:screenOrientation="sensorLandscape"
android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
<activity
android:name=".activities.SingleMatchActivity"
android:screenOrientation="sensorLandscape"
......
package fr.istic.masteru.android.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.gson.JsonObject;
import com.koushikdutta.async.future.FutureCallback;
import com.koushikdutta.ion.Ion;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeoutException;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.utils.API_URLS;
public class MainActivity extends Activity {
EditText numberEditText;
Button sendButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
numberEditText = (EditText) findViewById(R.id.number);
sendButton = (Button) findViewById(R.id.sendButton);
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendNumber();
}
});
findViewById(R.id.simpleButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, SingleMatchActivity.class);
startActivity(intent);
}
});
findViewById(R.id.doubleButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, DoubleMatchActivity.class);
intent.putExtra(DoubleMatchActivity.REFEREEING_TYPE, DoubleMatchActivity.TYPE_DOUBLE);
startActivity(intent);
}
});
findViewById(R.id.doubleProButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, DoubleMatchActivity.class);
intent.putExtra(DoubleMatchActivity.REFEREEING_TYPE, DoubleMatchActivity.TYPE_DOUBLE_PRO);
startActivity(intent);
}
});
findViewById(R.id.testButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("SecureDelayButton", "click");
}
});
}
private void sendNumber() {
String number = numberEditText.getText().toString();
if (number.length() == 0)
return;
JsonObject param = new JsonObject();
param.addProperty("nombre", number);
Ion.with(this)
.load("POST", API_URLS.PING_ADD_NUMBER)
.setJsonObjectBody(param)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
if (e != null) {
if (e instanceof CancellationException || e instanceof TimeoutException)
Toast.makeText(MainActivity.this, "Cancelled", Toast.LENGTH_SHORT).show();
}
Toast.makeText(MainActivity.this, "" + result, Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
......@@ -16,11 +16,11 @@ import java.util.ArrayList;
import java.util.List;
import fr.istic.masteru.android.R;
import fr.istic.masteru.android.fragments.FirstServiceFragment;
import fr.istic.masteru.android.fragments.InitialSideFragment;
import fr.istic.masteru.android.fragments.RefereeingTypeFragment;
import fr.istic.masteru.android.fragments.ResultFragment;
import fr.istic.masteru.android.fragments.SelectCourtFragment;
import fr.istic.masteru.android.fragments.SelectFirstServiceFragment;
import fr.istic.masteru.android.fragments.SelectInitialSideFragment;
import fr.istic.masteru.android.fragments.SelectMatchFragment;
import fr.istic.masteru.android.fragments.SelectPlayersFragment;
import fr.istic.masteru.android.fragments.SetupFragment;
......@@ -60,8 +60,8 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
flow.add(SelectMatchFragment.class.getName());
flow.add(SelectCourtFragment.class.getName());
flow.add(SelectPlayersFragment.class.getName());
flow.add(FirstServiceFragment.class.getName());
flow.add(InitialSideFragment.class.getName());
flow.add(SelectFirstServiceFragment.class.getName());
flow.add(SelectInitialSideFragment.class.getName());
String fname = flow.get(currentPosition);
if (fname != null) {
currentSetupFragment = (SetupFragment) Fragment.instantiate(this, fname);
......@@ -89,11 +89,11 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
if (currentSetupFragment instanceof SelectPlayersFragment) {
((SelectPlayersFragment) currentSetupFragment).setMatch(match);
}
if (currentSetupFragment instanceof FirstServiceFragment) {
((FirstServiceFragment) currentSetupFragment).setMatch(match);
if (currentSetupFragment instanceof SelectFirstServiceFragment) {
((SelectFirstServiceFragment) currentSetupFragment).setMatch(match);
}
if (currentSetupFragment instanceof InitialSideFragment) {
((InitialSideFragment) currentSetupFragment).setMatch(match);
if (currentSetupFragment instanceof SelectInitialSideFragment) {
((SelectInitialSideFragment) currentSetupFragment).setMatch(match);
}
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.translation_in_left, R.animator.translation_out_left);
......@@ -110,11 +110,11 @@ public class MatchSetupActivity extends Activity implements OnMatchSelectedListe
if (currentSetupFragment instanceof SelectPlayersFragment) {
((SelectPlayersFragment) currentSetupFragment).setMatch(match);
}
if (currentSetupFragment instanceof FirstServiceFragment) {
((FirstServiceFragment) currentSetupFragment).setMatch(match);
if (currentSetupFragment instanceof SelectFirstServiceFragment) {
((SelectFirstServiceFragment) currentSetupFragment).setMatch(match);
}
if (currentSetupFragment instanceof InitialSideFragment) {
((InitialSideFragment) currentSetupFragment).setMatch(match);
if (currentSetupFragment instanceof SelectInitialSideFragment) {
((SelectInitialSideFragment) currentSetupFragment).setMatch(match);
}
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.translation_in_right, R.animator.translation_out_right);
......
......@@ -30,7 +30,7 @@ public class RefereeingTypeFragment extends SetupFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
lightGrey = matchSetupActivity.getResources().getColor(R.color.light_grey);
View root = inflater.inflate(R.layout.refereeing_type_fragment, container, false);
View root = inflater.inflate(R.layout.select_refereeing_type_fragment, container, false);
root.findViewById(R.id.previousButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -40,7 +40,7 @@ public class SelectCourtFragment extends SetupFragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.court_id_fragment, container, false);
View root = inflater.inflate(R.layout.select_court_fragment, container, false);
root.findViewById(R.id.previousButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -14,7 +14,7 @@ import fr.istic.masteru.android.activities.MatchSetupActivity;
import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.utils.Utils;
public class FirstServiceFragment extends SetupFragment {
public class SelectFirstServiceFragment extends SetupFragment {
MatchSetupActivity matchSetupActivity;
private Match match;
......@@ -33,7 +33,7 @@ public class FirstServiceFragment extends SetupFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
lightGrey = matchSetupActivity.getResources().getColor(R.color.light_grey);
View root = inflater.inflate(R.layout.first_service_fragment, container, false);
View root = inflater.inflate(R.layout.select_first_service_fragment, container, false);
root.findViewById(R.id.previousButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -15,7 +15,7 @@ import fr.istic.masteru.android.model.Match;
import fr.istic.masteru.android.utils.Constants;
import fr.istic.masteru.android.utils.Utils;
public class InitialSideFragment extends SetupFragment {
public class SelectInitialSideFragment extends SetupFragment {
MatchSetupActivity matchSetupActivity;
private Match match;
......@@ -34,7 +34,7 @@ public class InitialSideFragment extends SetupFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
lightGrey = matchSetupActivity.getResources().getColor(R.color.light_grey);
final View root = inflater.inflate(R.layout.initial_side_fragment, container, false);
final View root = inflater.inflate(R.layout.select_initial_side_fragment, container, false);
root.findViewById(R.id.previousButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey_button_disabled" android:state_enabled="false"/>
<item android:drawable="@android:color/holo_red_dark" android:state_selected="true"/>
<item android:drawable="@color/red_button" android:state_selected="true"/>
<item android:drawable="@color/grey_button" android:state_checked="true"/>
<item android:drawable="@color/grey_button" android:state_pressed="true"/>
<item android:drawable="@color/light_grey_button"/>
......
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<EditText
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:hint="number..."
android:inputType="number"/>
<Button
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="@string/send"/>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="14dp"
android:background="#333"/>
<Button
android:id="@+id/simpleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Test Simple"/>
<Button
android:id="@+id/doubleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Test Double"/>
<Button
android:id="@+id/doubleProButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Test Double Pro"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:id="@+id/testButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Test SecureDelayButton"/>
</LinearLayout>
</ScrollView>
......@@ -32,13 +32,15 @@
android:layout_weight="50"
android:text="@string/start_match"
android:textColor="#444"
android:textSize="22sp"/>
android:textSize="22sp"
android:background="@drawable/ac_button"/>
<Button
android:id="@+id/resumeMatchButton"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="50"
android:background="@drawable/ac_button"
android:text="@string/resume_match"
android:textColor="#444"
android:textSize="22sp"/>
......
......@@ -3,7 +3,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#dadada">
android:background="#eee">
<TextView
android:id="@+id/categorie"
......@@ -23,7 +23,6 @@
android:src="@drawable/person"
android:scaleType="centerCrop"/>
<ImageView
android:id="@+id/playerLeft2Photo"
android:layout_width="82dp"
......@@ -168,8 +167,9 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/_scoreMiddle"
android:background="@drawable/ac_button"
android:padding="22dp"
android:layout_marginBottom="4dp"
android:layout_margin="6dp"
android:text="Fault First Service"/>
<View
......@@ -181,6 +181,7 @@
android:layout_centerHorizontal="true"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="@dimen/stats_button_margin"
android:background="#999"/>
<LinearLayout
......@@ -205,8 +206,8 @@
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text="@string/Point"
android:textSize="22sp"/>
android:text="@string/POINT"
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:id="@+id/aceLeft"
......@@ -214,14 +215,15 @@
android:layout_height="match_parent"
android:layout_weight="30"
android:text="@string/ace"
android:textSize="22sp"/>
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text=""
android:textSize="22sp"/>
style="@style/StatsButton"/>
</LinearLayout>
<LinearLayout
......@@ -235,21 +237,22 @@
android:layout_height="match_parent"
android:layout_weight="30"
android:text=""
android:textSize="22sp"/>
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text=""
android:textSize="22sp"/>
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text=""
android:textSize="22sp"/>
style="@style/StatsButton"/>
</LinearLayout>
</LinearLayout>
......@@ -274,22 +277,25 @@
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"/>
android:layout_weight="30"
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:id="@+id/aceRight"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text="@string/ace"
android:layout_weight="30"/>
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:id="@+id/pointRight"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"
android:text="@string/Point"
android:textSize="22sp"/>
android:text="@string/POINT"
style="@style/StatsButton"/>
</LinearLayout>
<LinearLayout
......@@ -301,18 +307,23 @@
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"/>
android:layout_weight="30"
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"/>
android:layout_weight="30"
style="@style/StatsButton"/>
<fr.istic.masteru.android.views.SecureDelayButton
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="30"/>
android:layout_weight="30"
style="@style/StatsButton"/>
</LinearLayout>
</LinearLayout>
......@@ -360,20 +371,20 @@
android:textSize="18sp"
android:textStyle="bold"/>
<!--<Button-->
<!--android:id="@+id/gameTime"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentRight="true"-->
<!--android:layout_margin="4dp"-->
<!--android:background="@drawable/dark_button"-->
<!--android:paddingLeft="16dp"-->
<!--android:paddingRight="16dp"-->
<!--android:text="0:54"-->
<!--android:textColor="@color/white"-->
<!--android:textSize="18sp"-->
<!--android:textStyle="bold"-->
<!--android:visibility="invisible"/>-->
<Button
android:id="@+id/gameTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/optionsButton"
android:layout_margin="4dp"
android:background="@drawable/dark_button"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="0:54"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="invisible"/>
</RelativeLayout>
......
......@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:background="#eee"
android:background="@drawable/ac_button"
android:gravity="center_horizontal"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
......
......@@ -99,7 +99,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court Central"
android:enabled="false"
android:textColor="#444"
......@@ -111,7 +111,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 1"
android:enabled="false"
android:textColor="#444"
......@@ -123,7 +123,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 2"
android:enabled="false"
android:textColor="#444"
......@@ -135,7 +135,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 3"
android:enabled="false"
android:textColor="#444"
......@@ -159,7 +159,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 4"
android:enabled="false"
android:textColor="#444"
......@@ -171,7 +171,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 5"
android:enabled="false"
android:textColor="#444"
......@@ -183,7 +183,7 @@
android:layout_height="0px"
android:layout_marginBottom="10dp"
android:layout_weight="25"
android:background="@drawable/checkable_button"
android:background="@drawable/ac_button"
android:text="Court 6"
android:enabled="false"