Commit dd839264ec899599e22785fea1567bf6dad20cf8

Authored by badetitou
1 parent efe94d64

All done

Showing 47 changed files with 1579 additions and 0 deletions   Show diff stats
.gitignore 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +*.iml
  2 +.gradle
  3 +/local.properties
  4 +/.idea/workspace.xml
  5 +/.idea/libraries
  6 +.DS_Store
  7 +/build
  8 +/captures
  9 +.externalNativeBuild
... ...
.idea/compiler.xml 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="CompilerConfiguration">
  4 + <resourceExtensions />
  5 + <wildcardResourcePatterns>
  6 + <entry name="!?*.java" />
  7 + <entry name="!?*.form" />
  8 + <entry name="!?*.class" />
  9 + <entry name="!?*.groovy" />
  10 + <entry name="!?*.scala" />
  11 + <entry name="!?*.flex" />
  12 + <entry name="!?*.kt" />
  13 + <entry name="!?*.clj" />
  14 + <entry name="!?*.aj" />
  15 + </wildcardResourcePatterns>
  16 + <annotationProcessing>
  17 + <profile default="true" name="Default" enabled="false">
  18 + <processorPath useClasspath="true" />
  19 + </profile>
  20 + </annotationProcessing>
  21 + </component>
  22 +</project>
0 23 \ No newline at end of file
... ...
.idea/copyright/profiles_settings.xml 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<component name="CopyrightManager">
  2 + <settings default="" />
  3 +</component>
0 4 \ No newline at end of file
... ...
.idea/encodings.xml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="Encoding">
  4 + <file url="PROJECT" charset="UTF-8" />
  5 + </component>
  6 +</project>
0 7 \ No newline at end of file
... ...
.idea/gradle.xml 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="GradleSettings">
  4 + <option name="linkedExternalProjectsSettings">
  5 + <GradleProjectSettings>
  6 + <option name="distributionType" value="LOCAL" />
  7 + <option name="externalProjectPath" value="$PROJECT_DIR$" />
  8 + <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" />
  9 + <option name="modules">
  10 + <set>
  11 + <option value="$PROJECT_DIR$" />
  12 + <option value="$PROJECT_DIR$/app" />
  13 + </set>
  14 + </option>
  15 + <option name="resolveModulePerSourceSet" value="false" />
  16 + </GradleProjectSettings>
  17 + </option>
  18 + </component>
  19 +</project>
0 20 \ No newline at end of file
... ...
.idea/misc.xml 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="EntryPointsManager">
  4 + <entry_points version="2.0" />
  5 + </component>
  6 + <component name="NullableNotNullManager">
  7 + <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
  8 + <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
  9 + <option name="myNullables">
  10 + <value>
  11 + <list size="4">
  12 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
  13 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
  14 + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
  15 + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
  16 + </list>
  17 + </value>
  18 + </option>
  19 + <option name="myNotNulls">
  20 + <value>
  21 + <list size="4">
  22 + <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
  23 + <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
  24 + <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
  25 + <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
  26 + </list>
  27 + </value>
  28 + </option>
  29 + </component>
  30 + <component name="ProjectLevelVcsManager" settingsEditedManually="false">
  31 + <OptionsSetting value="true" id="Add" />
  32 + <OptionsSetting value="true" id="Remove" />
  33 + <OptionsSetting value="true" id="Checkout" />
  34 + <OptionsSetting value="true" id="Update" />
  35 + <OptionsSetting value="true" id="Status" />
  36 + <OptionsSetting value="true" id="Edit" />
  37 + <ConfirmationsSetting value="0" id="Add" />
  38 + <ConfirmationsSetting value="0" id="Remove" />
  39 + </component>
  40 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
  41 + <output url="file://$PROJECT_DIR$/build/classes" />
  42 + </component>
  43 + <component name="ProjectType">
  44 + <option name="id" value="Android" />
  45 + </component>
  46 +</project>
0 47 \ No newline at end of file
... ...
.idea/modules.xml 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="ProjectModuleManager">
  4 + <modules>
  5 + <module fileurl="file://$PROJECT_DIR$/Etunicorn.iml" filepath="$PROJECT_DIR$/Etunicorn.iml" />
  6 + <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
  7 + </modules>
  8 + </component>
  9 +</project>
0 10 \ No newline at end of file
... ...
.idea/runConfigurations.xml 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="RunConfigurationProducerService">
  4 + <option name="ignoredProducers">
  5 + <set>
  6 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
  7 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
  8 + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
  9 + </set>
  10 + </option>
  11 + </component>
  12 +</project>
0 13 \ No newline at end of file
... ...
.idea/vcs.xml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="VcsDirectoryMappings">
  4 + <mapping directory="$PROJECT_DIR$" vcs="Git" />
  5 + </component>
  6 +</project>
0 7 \ No newline at end of file
... ...
app/.gitignore 0 → 100644
... ... @@ -0,0 +1 @@
  1 +/build
... ...
app/build.gradle 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +apply plugin: 'com.android.application'
  2 +
  3 +android {
  4 + compileSdkVersion 24
  5 + buildToolsVersion "24.0.2"
  6 + defaultConfig {
  7 + applicationId "net.plil.clubinfo.etunicorn"
  8 + minSdkVersion 21
  9 + targetSdkVersion 24
  10 + versionCode 1
  11 + versionName "1.0"
  12 + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  13 + }
  14 + buildTypes {
  15 + release {
  16 + minifyEnabled false
  17 + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  18 + }
  19 + }
  20 +}
  21 +
  22 +dependencies {
  23 + compile fileTree(dir: 'libs', include: ['*.jar'])
  24 + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
  25 + exclude group: 'com.android.support', module: 'support-annotations'
  26 + })
  27 + compile 'com.android.support:appcompat-v7:24.2.1'
  28 + compile 'com.android.support:design:24.2.1'
  29 + compile 'com.android.volley:volley:1.0.0'
  30 + compile 'com.google.code.gson:gson:2.4'
  31 + compile 'com.android.support:support-v4:24.2.1'
  32 + testCompile 'junit:junit:4.12'
  33 +}
... ...
app/proguard-rules.pro 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +# Add project specific ProGuard rules here.
  2 +# By default, the flags in this file are appended to flags specified
  3 +# in C:\Users\badet\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
  4 +# You can edit the include path and order by changing the proguardFiles
  5 +# directive in build.gradle.
  6 +#
  7 +# For more details, see
  8 +# http://developer.android.com/guide/developing/tools/proguard.html
  9 +
  10 +# Add any project specific keep options here:
  11 +
  12 +# If your project uses WebView with JS, uncomment the following
  13 +# and specify the fully qualified class name to the JavaScript interface
  14 +# class:
  15 +#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  16 +# public *;
  17 +#}
... ...
app/src/androidTest/java/net/plil/clubinfo/etunicorn/ExampleInstrumentedTest.java 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +package net.plil.clubinfo.etunicorn;
  2 +
  3 +import android.content.Context;
  4 +import android.support.test.InstrumentationRegistry;
  5 +import android.support.test.runner.AndroidJUnit4;
  6 +
  7 +import org.junit.Test;
  8 +import org.junit.runner.RunWith;
  9 +
  10 +import static org.junit.Assert.*;
  11 +
  12 +/**
  13 + * Instrumentation test, which will execute on an Android device.
  14 + *
  15 + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
  16 + */
  17 +@RunWith(AndroidJUnit4.class)
  18 +public class ExampleInstrumentedTest {
  19 + @Test
  20 + public void useAppContext() throws Exception {
  21 + // Context of the app under test.
  22 + Context appContext = InstrumentationRegistry.getTargetContext();
  23 +
  24 + assertEquals("net.plil.clubinfo.etunicorn", appContext.getPackageName());
  25 + }
  26 +}
... ...
app/src/main/AndroidManifest.xml 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3 + package="net.plil.clubinfo.etunicorn">
  4 +
  5 + <uses-permission android:name="android.permission.INTERNET" />
  6 + <uses-permission android:name="android.permission.NFC" />
  7 + <uses-feature android:name="android.hardware.nfc" android:required="true" />
  8 +
  9 +
  10 + <application
  11 + android:allowBackup="true"
  12 + android:icon="@mipmap/ic_launcher"
  13 + android:label="@string/app_name"
  14 + android:supportsRtl="true"
  15 + android:theme="@style/AppTheme">
  16 + <activity
  17 + android:name=".app.LoginActivity"
  18 + android:label="@string/app_name">
  19 + <intent-filter>
  20 + <action android:name="android.intent.action.MAIN" />
  21 +
  22 + <category android:name="android.intent.category.LAUNCHER" />
  23 + </intent-filter>
  24 + </activity>
  25 +
  26 + <activity
  27 + android:name=".app.MainActivity"
  28 + android:label="@string/title_activity_main"
  29 + android:theme="@style/AppTheme.NoActionBar" >
  30 + <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
  31 + android:resource="@xml/tech" />
  32 + <intent-filter>
  33 + <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
  34 + <category android:name="android.intent.category.DEFAULT"/>
  35 + </intent-filter>
  36 + <intent-filter>
  37 + <action android:name="android.nfc.action.TECH_DISCOVERED"/>
  38 + <category android:name="android.intent.category.DEFAULT"/>
  39 + </intent-filter>
  40 + </activity>
  41 + </application>
  42 +
  43 +</manifest>
0 44 \ No newline at end of file
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Crediter.java 0 → 100644
... ... @@ -0,0 +1,108 @@
  1 +package net.plil.clubinfo.etunicorn.app;
  2 +
  3 +import android.content.Context;
  4 +import android.content.Intent;
  5 +import android.net.Uri;
  6 +import android.nfc.NdefMessage;
  7 +import android.nfc.NfcAdapter;
  8 +import android.nfc.NfcEvent;
  9 +import android.os.Bundle;
  10 +import android.os.Parcelable;
  11 +import android.support.design.widget.Snackbar;
  12 +import android.support.v4.app.Fragment;
  13 +import android.view.LayoutInflater;
  14 +import android.view.View;
  15 +import android.view.ViewGroup;
  16 +import android.widget.Toast;
  17 +
  18 +import net.plil.clubinfo.etunicorn.R;
  19 +
  20 +/**
  21 + * A simple {@link Fragment} subclass.
  22 + * Activities that contain this fragment must implement the
  23 + * {@link Crediter.OnFragmentInteractionListener} interface
  24 + * to handle interaction events.
  25 + * Use the {@link Crediter#newInstance} factory method to
  26 + * create an instance of this fragment.
  27 + */
  28 +public class Crediter extends Fragment {
  29 + NfcAdapter mNfcAdapter;
  30 +
  31 +
  32 +
  33 + private OnFragmentInteractionListener mListener;
  34 +
  35 + public Crediter() {
  36 + // Required empty public constructor
  37 + }
  38 +
  39 + /**
  40 + * Use this factory method to create a new instance of
  41 + * this fragment using the provided parameters.
  42 + *
  43 + * @return A new instance of fragment Crediter.
  44 + */
  45 + public static Crediter newInstance(String param1, String param2) {
  46 + Crediter fragment = new Crediter();
  47 + return fragment;
  48 + }
  49 +
  50 + @Override
  51 + public void onCreate(Bundle savedInstanceState) {
  52 + super.onCreate(savedInstanceState);
  53 + mNfcAdapter = NfcAdapter.getDefaultAdapter(getContext());
  54 + if (mNfcAdapter == null) {
  55 + Toast.makeText(getActivity(), "NFC is not available", Toast.LENGTH_LONG).show();
  56 + return;
  57 + }
  58 + if (!mNfcAdapter.isEnabled()){
  59 + Toast.makeText(getActivity(), "NFC is not enabled, please turn it on", Toast.LENGTH_LONG).show();
  60 + }
  61 +
  62 + }
  63 +
  64 + @Override
  65 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
  66 + Bundle savedInstanceState) {
  67 + // Inflate the layout for this fragment
  68 + return inflater.inflate(R.layout.fragment_crediter, container, false);
  69 + }
  70 +
  71 +
  72 + @Override
  73 + public void onAttach(Context context) {
  74 + super.onAttach(context);
  75 + if (context instanceof OnFragmentInteractionListener) {
  76 + mListener = (OnFragmentInteractionListener) context;
  77 + } else {
  78 + throw new RuntimeException(context.toString()
  79 + + " must implement OnFragmentInteractionListener");
  80 + }
  81 + }
  82 +
  83 + @Override
  84 + public void onDetach() {
  85 + super.onDetach();
  86 + mListener = null;
  87 + }
  88 +
  89 + public void processNFC(){
  90 + Toast.makeText(getContext(), "HELLO NFC", Toast.LENGTH_LONG).show();
  91 + }
  92 +
  93 +
  94 + /**
  95 + * This interface must be implemented by activities that contain this
  96 + * fragment to allow an interaction in this fragment to be communicated
  97 + * to the activity and potentially other fragments contained in that
  98 + * activity.
  99 + * <p>
  100 + * See the Android Training lesson <a href=
  101 + * "http://developer.android.com/training/basics/fragments/communicating.html"
  102 + * >Communicating with Other Fragments</a> for more information.
  103 + */
  104 + public interface OnFragmentInteractionListener {
  105 + // TODO: Update argument type and name
  106 + void onFragmentInteraction(Uri uri);
  107 + }
  108 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Debiter.java 0 → 100644
... ... @@ -0,0 +1,109 @@
  1 +package net.plil.clubinfo.etunicorn.app;
  2 +
  3 +import android.content.Context;
  4 +import android.net.Uri;
  5 +import android.os.Bundle;
  6 +import android.support.v4.app.Fragment;
  7 +import android.view.LayoutInflater;
  8 +import android.view.View;
  9 +import android.view.ViewGroup;
  10 +
  11 +import net.plil.clubinfo.etunicorn.R;
  12 +
  13 +/**
  14 + * A simple {@link Fragment} subclass.
  15 + * Activities that contain this fragment must implement the
  16 + * {@link Debiter.OnFragmentInteractionListener} interface
  17 + * to handle interaction events.
  18 + * Use the {@link Debiter#newInstance} factory method to
  19 + * create an instance of this fragment.
  20 + */
  21 +public class Debiter extends Fragment {
  22 + // TODO: Rename parameter arguments, choose names that match
  23 + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
  24 + private static final String ARG_PARAM1 = "param1";
  25 + private static final String ARG_PARAM2 = "param2";
  26 +
  27 + // TODO: Rename and change types of parameters
  28 + private String mParam1;
  29 + private String mParam2;
  30 +
  31 + private OnFragmentInteractionListener mListener;
  32 +
  33 + public Debiter() {
  34 + // Required empty public constructor
  35 + }
  36 +
  37 + /**
  38 + * Use this factory method to create a new instance of
  39 + * this fragment using the provided parameters.
  40 + *
  41 + * @param param1 Parameter 1.
  42 + * @param param2 Parameter 2.
  43 + * @return A new instance of fragment Debiter.
  44 + */
  45 + // TODO: Rename and change types and number of parameters
  46 + public static Debiter newInstance(String param1, String param2) {
  47 + Debiter fragment = new Debiter();
  48 + Bundle args = new Bundle();
  49 + args.putString(ARG_PARAM1, param1);
  50 + args.putString(ARG_PARAM2, param2);
  51 + fragment.setArguments(args);
  52 + return fragment;
  53 + }
  54 +
  55 + @Override
  56 + public void onCreate(Bundle savedInstanceState) {
  57 + super.onCreate(savedInstanceState);
  58 + if (getArguments() != null) {
  59 + mParam1 = getArguments().getString(ARG_PARAM1);
  60 + mParam2 = getArguments().getString(ARG_PARAM2);
  61 + }
  62 + }
  63 +
  64 + @Override
  65 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
  66 + Bundle savedInstanceState) {
  67 + // Inflate the layout for this fragment
  68 + return inflater.inflate(R.layout.fragment_debiter, container, false);
  69 + }
  70 +
  71 + // TODO: Rename method, update argument and hook method into UI event
  72 + public void onButtonPressed(Uri uri) {
  73 + if (mListener != null) {
  74 + mListener.onFragmentInteraction(uri);
  75 + }
  76 + }
  77 +
  78 + @Override
  79 + public void onAttach(Context context) {
  80 + super.onAttach(context);
  81 + if (context instanceof OnFragmentInteractionListener) {
  82 + mListener = (OnFragmentInteractionListener) context;
  83 + } else {
  84 + throw new RuntimeException(context.toString()
  85 + + " must implement OnFragmentInteractionListener");
  86 + }
  87 + }
  88 +
  89 + @Override
  90 + public void onDetach() {
  91 + super.onDetach();
  92 + mListener = null;
  93 + }
  94 +
  95 + /**
  96 + * This interface must be implemented by activities that contain this
  97 + * fragment to allow an interaction in this fragment to be communicated
  98 + * to the activity and potentially other fragments contained in that
  99 + * activity.
  100 + * <p>
  101 + * See the Android Training lesson <a href=
  102 + * "http://developer.android.com/training/basics/fragments/communicating.html"
  103 + * >Communicating with Other Fragments</a> for more information.
  104 + */
  105 + public interface OnFragmentInteractionListener {
  106 + // TODO: Update argument type and name
  107 + void onFragmentInteraction(Uri uri);
  108 + }
  109 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/LoginActivity.java 0 → 100644
... ... @@ -0,0 +1,197 @@
  1 +package net.plil.clubinfo.etunicorn.app;
  2 +
  3 +import android.animation.Animator;
  4 +import android.animation.AnimatorListenerAdapter;
  5 +import android.annotation.TargetApi;
  6 +import android.app.DownloadManager;
  7 +import android.content.Intent;
  8 +import android.content.pm.PackageManager;
  9 +import android.support.annotation.NonNull;
  10 +import android.support.design.widget.Snackbar;
  11 +import android.support.v7.app.AppCompatActivity;
  12 +import android.app.LoaderManager.LoaderCallbacks;
  13 +
  14 +import android.content.CursorLoader;
  15 +import android.content.Loader;
  16 +import android.database.Cursor;
  17 +import android.net.Uri;
  18 +import android.os.AsyncTask;
  19 +
  20 +import android.os.Build;
  21 +import android.os.Bundle;
  22 +import android.provider.ContactsContract;
  23 +import android.text.TextUtils;
  24 +import android.view.KeyEvent;
  25 +import android.view.View;
  26 +import android.view.View.OnClickListener;
  27 +import android.view.inputmethod.EditorInfo;
  28 +import android.widget.ArrayAdapter;
  29 +import android.widget.Button;
  30 +import android.widget.EditText;
  31 +import android.widget.TextView;
  32 +import android.widget.Toast;
  33 +
  34 +import com.android.volley.Request;
  35 +import com.android.volley.RequestQueue;
  36 +import com.android.volley.Response;
  37 +import com.android.volley.VolleyError;
  38 +import com.android.volley.toolbox.JsonObjectRequest;
  39 +import com.google.gson.Gson;
  40 +
  41 +import net.plil.clubinfo.etunicorn.R;
  42 +import net.plil.clubinfo.etunicorn.data.Personne;
  43 +import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
  44 +
  45 +import org.json.JSONException;
  46 +import org.json.JSONObject;
  47 +
  48 +import java.util.ArrayList;
  49 +import java.util.List;
  50 +
  51 +import static android.Manifest.permission.READ_CONTACTS;
  52 +
  53 +/**
  54 + * A login screen that offers login via email/password.
  55 + */
  56 +public class LoginActivity extends AppCompatActivity {
  57 +
  58 + /**
  59 + * Id to identity READ_CONTACTS permission request.
  60 + */
  61 + private static final int REQUEST_READ_CONTACTS = 0;
  62 +
  63 + /**
  64 + * Keep track of the login task to ensure we can cancel it if requested.
  65 + */
  66 +
  67 + // UI references.
  68 + private EditText mUsernameView;
  69 + private EditText mPasswordView;
  70 + private View mProgressView;
  71 + private View mLoginFormView;
  72 +
  73 + @Override
  74 + protected void onCreate(Bundle savedInstanceState) {
  75 + super.onCreate(savedInstanceState);
  76 + setContentView(R.layout.activity_login);
  77 + // Set up the login form.
  78 + mUsernameView = (EditText) findViewById(R.id.username);
  79 +
  80 + mPasswordView = (EditText) findViewById(R.id.password);
  81 + mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
  82 + @Override
  83 + public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
  84 + if (id == R.id.login || id == EditorInfo.IME_NULL) {
  85 + attemptLogin();
  86 + return true;
  87 + }
  88 + return false;
  89 + }
  90 + });
  91 +
  92 + Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
  93 + mEmailSignInButton.setOnClickListener(new OnClickListener() {
  94 + @Override
  95 + public void onClick(View view) {
  96 + attemptLogin();
  97 + }
  98 + });
  99 +
  100 + mLoginFormView = findViewById(R.id.login_form);
  101 + mProgressView = findViewById(R.id.login_progress);
  102 + }
  103 +
  104 +
  105 + /**
  106 + * Attempts to sign in or register the account specified by the login form.
  107 + * If there are form errors (invalid email, missing fields, etc.), the
  108 + * errors are presented and no actual login attempt is made.
  109 + */
  110 + private void attemptLogin() {
  111 +
  112 + // Reset errors.
  113 + mUsernameView.setError(null);
  114 + mPasswordView.setError(null);
  115 +
  116 + // Store values at the time of the login attempt.
  117 + String email = mUsernameView.getText().toString();
  118 + String username = mPasswordView.getText().toString();
  119 +
  120 +
  121 + showProgress(true);
  122 + tryLogin(email, username);
  123 + }
  124 +
  125 + /**
  126 + * Shows the progress UI and hides the login form.
  127 + */
  128 + @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
  129 + private void showProgress(final boolean show) {
  130 + // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
  131 + // for very easy animations. If available, use these APIs to fade-in
  132 + // the progress spinner.
  133 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
  134 + int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
  135 +
  136 + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
  137 + mLoginFormView.animate().setDuration(shortAnimTime).alpha(
  138 + show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
  139 + @Override
  140 + public void onAnimationEnd(Animator animation) {
  141 + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
  142 + }
  143 + });
  144 +
  145 + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
  146 + mProgressView.animate().setDuration(shortAnimTime).alpha(
  147 + show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
  148 + @Override
  149 + public void onAnimationEnd(Animator animation) {
  150 + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
  151 + }
  152 + });
  153 + } else {
  154 + // The ViewPropertyAnimator APIs are not available, so simply show
  155 + // and hide the relevant UI components.
  156 + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
  157 + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
  158 + }
  159 + }
  160 +
  161 + /**
  162 + * You need a polytech Lille Account
  163 + *
  164 + * @param username The username of the person
  165 + * @param password The password of the person
  166 + */
  167 + private void tryLogin (String username, String password){
  168 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/login?login=" + username + "&password=" + password , null, new Response.Listener<JSONObject>() {
  169 + @Override
  170 + public void onResponse(JSONObject response) {
  171 + showProgress(false);
  172 + try {
  173 + Personne p = new Gson().fromJson(response.getJSONObject("").toString(), Personne.class);
  174 + Intent intent = new Intent(getApplicationContext(), MainActivity.class);
  175 + startActivity(intent);
  176 + } catch (JSONException e) {
  177 + e.printStackTrace();
  178 + }
  179 + }
  180 + }, new Response.ErrorListener() {
  181 + @Override
  182 + public void onErrorResponse(VolleyError error) {
  183 + showProgress(false);
  184 + Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
  185 +
  186 + //TODO remove this line
  187 + Intent intent = new Intent(getApplicationContext(), MainActivity.class);
  188 + startActivity(intent);
  189 + // END
  190 + }
  191 + }
  192 + );
  193 +
  194 + VolleyUtils.getInstance(getApplicationContext()).addToRequestQueue(jsonObjectRequest);
  195 + }
  196 +}
  197 +
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/MainActivity.java 0 → 100644
... ... @@ -0,0 +1,212 @@
  1 +package net.plil.clubinfo.etunicorn.app;
  2 +
  3 +import android.app.PendingIntent;
  4 +import android.content.Intent;
  5 +import android.nfc.NdefMessage;
  6 +import android.nfc.NfcAdapter;
  7 +import android.nfc.Tag;
  8 +import android.os.Parcelable;
  9 +import android.support.design.widget.TabLayout;
  10 +import android.support.design.widget.FloatingActionButton;
  11 +import android.support.design.widget.Snackbar;
  12 +import android.support.v7.app.AppCompatActivity;
  13 +import android.support.v7.widget.Toolbar;
  14 +
  15 +import android.support.v4.app.Fragment;
  16 +import android.support.v4.app.FragmentManager;
  17 +import android.support.v4.app.FragmentPagerAdapter;
  18 +import android.support.v4.view.ViewPager;
  19 +import android.os.Bundle;
  20 +import android.view.LayoutInflater;
  21 +import android.view.Menu;
  22 +import android.view.MenuItem;
  23 +import android.view.View;
  24 +import android.view.ViewGroup;
  25 +
  26 +import android.widget.TextView;
  27 +import android.widget.Toast;
  28 +
  29 +import net.plil.clubinfo.etunicorn.R;
  30 +
  31 +import java.util.List;
  32 +
  33 +public class MainActivity extends AppCompatActivity {
  34 +
  35 + /**
  36 + * The {@link android.support.v4.view.PagerAdapter} that will provide
  37 + * fragments for each of the sections. We use a
  38 + * {@link FragmentPagerAdapter} derivative, which will keep every
  39 + * loaded fragment in memory. If this becomes too memory intensive, it
  40 + * may be best to switch to a
  41 + * {@link android.support.v4.app.FragmentStatePagerAdapter}.
  42 + */
  43 + private SectionsPagerAdapter mSectionsPagerAdapter;
  44 +
  45 + /**
  46 + * The {@link ViewPager} that will host the section contents.
  47 + */
  48 + private ViewPager mViewPager;
  49 +
  50 +
  51 + NfcAdapter mAdapter;
  52 + PendingIntent mPendingIntent;
  53 +
  54 + @Override
  55 + protected void onCreate(Bundle savedInstanceState) {
  56 + super.onCreate(savedInstanceState);
  57 + setContentView(R.layout.activity_main);
  58 +
  59 + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  60 + setSupportActionBar(toolbar);
  61 + // Create the adapter that will return a fragment for each of the three
  62 + // primary sections of the activity.
  63 + mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
  64 +
  65 + // Set up the ViewPager with the sections adapter.
  66 + mViewPager = (ViewPager) findViewById(R.id.container);
  67 + mViewPager.setAdapter(mSectionsPagerAdapter);
  68 +
  69 + TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
  70 + tabLayout.setupWithViewPager(mViewPager);
  71 +
  72 +
  73 + mAdapter = NfcAdapter.getDefaultAdapter(this);
  74 + if (mAdapter == null) {
  75 + //nfc not support your device.
  76 + return;
  77 + }
  78 + mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
  79 + getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
  80 +
  81 + }
  82 +
  83 +
  84 + @Override
  85 + public boolean onCreateOptionsMenu(Menu menu) {
  86 + // Inflate the menu; this adds items to the action bar if it is present.
  87 + getMenuInflater().inflate(R.menu.menu_main, menu);
  88 + return true;
  89 + }
  90 +
  91 + @Override
  92 + public boolean onOptionsItemSelected(MenuItem item) {
  93 + // Handle action bar item clicks here. The action bar will
  94 + // automatically handle clicks on the Home/Up button, so long
  95 + // as you specify a parent activity in AndroidManifest.xml.
  96 + int id = item.getItemId();
  97 +
  98 + //noinspection SimplifiableIfStatement
  99 + if (id == R.id.action_settings) {
  100 + return true;
  101 + }
  102 +
  103 + return super.onOptionsItemSelected(item);
  104 + }
  105 +
  106 + @Override
  107 + protected void onNewIntent(Intent intent) {
  108 + super.onNewIntent(intent);
  109 + Toast.makeText(getBaseContext(), mViewPager.getCurrentItem()+" NFC WORKING", Toast.LENGTH_LONG).show();
  110 + Toast.makeText(getBaseContext(), intent.getParcelableExtra(NfcAdapter.EXTRA_TAG) + "", Toast.LENGTH_LONG).show();
  111 +
  112 + }
  113 +
  114 + @Override
  115 + public void onResume(){
  116 + super.onResume();
  117 + mAdapter.enableForegroundDispatch(this, mPendingIntent, null, null);
  118 + }
  119 +
  120 + @Override
  121 + public void onPause(){
  122 + super.onPause();
  123 + if (mAdapter != null) {
  124 + mAdapter.disableForegroundDispatch(this);
  125 + }
  126 + }
  127 +
  128 + /**
  129 + * A placeholder fragment containing a simple view.
  130 + */
  131 + public static class PlaceholderFragment extends Fragment {
  132 + /**
  133 + * The fragment argument representing the section number for this
  134 + * fragment.
  135 + */
  136 + private static final String ARG_SECTION_NUMBER = "section_number";
  137 +
  138 + public PlaceholderFragment() {
  139 + }
  140 +
  141 + /**
  142 + * Returns a new instance of this fragment for the given section
  143 + * number.
  144 + */
  145 + public static PlaceholderFragment newInstance(int sectionNumber) {
  146 + PlaceholderFragment fragment = new PlaceholderFragment();
  147 + Bundle args = new Bundle();
  148 + args.putInt(ARG_SECTION_NUMBER, sectionNumber);
  149 + fragment.setArguments(args);
  150 + return fragment;
  151 + }
  152 +
  153 + @Override
  154 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
  155 + Bundle savedInstanceState) {
  156 + View rootView;
  157 + if (getArguments().getInt(ARG_SECTION_NUMBER) == Action.DEBITER.getValue())
  158 + rootView = inflater.inflate(R.layout.fragment_debiter, container, false);
  159 + else if (getArguments().getInt(ARG_SECTION_NUMBER) == Action.CREDITER.getValue())
  160 + rootView = inflater.inflate(R.layout.fragment_crediter, container, false);
  161 + else
  162 + rootView = inflater.inflate(R.layout.fragment_main, container, false);
  163 + return rootView;
  164 + }
  165 + }
  166 +
  167 + /**
  168 + * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
  169 + * one of the sections/tabs/pages.
  170 + */
  171 + public class SectionsPagerAdapter extends FragmentPagerAdapter {
  172 +
  173 + public SectionsPagerAdapter(FragmentManager fm) {
  174 + super(fm);
  175 + }
  176 +
  177 + @Override
  178 + public Fragment getItem(int position) {
  179 + // getItem is called to instantiate the fragment for the given page.
  180 + // Return a PlaceholderFragment (defined as a static inner class below).
  181 + return PlaceholderFragment.newInstance(position + 1);
  182 + }
  183 +
  184 + @Override
  185 + public int getCount() {
  186 + // Show 3 total pages.
  187 + return 3;
  188 + }
  189 +
  190 + @Override
  191 + public CharSequence getPageTitle(int position) {
  192 + if(position == Action.DEBITER.getValue())
  193 + return "Debiter";
  194 + else if (position == Action.CREDITER.getValue())
  195 + return "Crediter";
  196 + return null;
  197 + }
  198 + }
  199 +
  200 + private enum Action {
  201 + DEBITER(0), CREDITER(1);
  202 +
  203 + private final int value;
  204 + Action(int value) {
  205 + this.value = value;
  206 + }
  207 +
  208 + public int getValue() {
  209 + return value;
  210 + }
  211 + }
  212 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/data/Personne.java 0 → 100644
... ... @@ -0,0 +1,55 @@
  1 +package net.plil.clubinfo.etunicorn.data;
  2 +
  3 +
  4 +import java.sql.Date;
  5 +
  6 +public class Personne {
  7 + private int idPersonne;
  8 + private int idCarte;
  9 + private Date naissance;
  10 + private int solde = 0;
  11 + private String loginPoly;
  12 +
  13 + public Personne() {
  14 + }
  15 +
  16 + public int getIdPersonne() {
  17 + return idPersonne;
  18 + }
  19 +
  20 + public void setIdPersonne(int idPersonne) {
  21 + this.idPersonne = idPersonne;
  22 + }
  23 +
  24 + public int getIdCarte() {
  25 + return idCarte;
  26 + }
  27 +
  28 + public void setIdCarte(int idCarte) {
  29 + this.idCarte = idCarte;
  30 + }
  31 +
  32 + public Date getNaissance() {
  33 + return naissance;
  34 + }
  35 +
  36 + public void setNaissance(Date naissance) {
  37 + this.naissance = naissance;
  38 + }
  39 +
  40 + public int getSolde() {
  41 + return solde;
  42 + }
  43 +
  44 + public void setSolde(int solde) {
  45 + this.solde = solde;
  46 + }
  47 +
  48 + public String getLoginPoly() {
  49 + return loginPoly;
  50 + }
  51 +
  52 + public void setLoginPoly(String loginPoly) {
  53 + this.loginPoly = loginPoly;
  54 + }
  55 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/utils/VolleyUtils.java 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +package net.plil.clubinfo.etunicorn.utils;
  2 +
  3 +import android.content.Context;
  4 +import android.graphics.Bitmap;
  5 +import android.util.LruCache;
  6 +
  7 +import com.android.volley.Request;
  8 +import com.android.volley.RequestQueue;
  9 +import com.android.volley.toolbox.ImageLoader;
  10 +import com.android.volley.toolbox.Volley;
  11 +
  12 +/**
  13 + * Created by badetitou on 28/01/2017.
  14 + */
  15 +
  16 +public class VolleyUtils {
  17 +
  18 + private static final String uri = "https://etunicorn.plil.net/";
  19 + private static final String version = "v1";
  20 +
  21 + public static final String baseUri = VolleyUtils.uri + VolleyUtils.version + "/";
  22 +
  23 + private static VolleyUtils mInstance;
  24 + private RequestQueue mRequestQueue;
  25 + private ImageLoader mImageLoader;
  26 + private static Context mCtx;
  27 +
  28 + private VolleyUtils(Context context) {
  29 + mCtx = context;
  30 + mRequestQueue = getRequestQueue();
  31 +
  32 + mImageLoader = new ImageLoader(mRequestQueue,
  33 + new ImageLoader.ImageCache() {
  34 + private final LruCache<String, Bitmap>
  35 + cache = new LruCache<String, Bitmap>(20);
  36 +
  37 + @Override
  38 + public Bitmap getBitmap(String url) {
  39 + return cache.get(url);
  40 + }
  41 +
  42 + @Override
  43 + public void putBitmap(String url, Bitmap bitmap) {
  44 + cache.put(url, bitmap);
  45 + }
  46 + });
  47 + }
  48 +
  49 + public static synchronized VolleyUtils getInstance(Context context) {
  50 + if (mInstance == null) {
  51 + mInstance = new VolleyUtils(context);
  52 + }
  53 + return mInstance;
  54 + }
  55 +
  56 + public RequestQueue getRequestQueue() {
  57 + if (mRequestQueue == null) {
  58 + // getApplicationContext() is key, it keeps you from leaking the
  59 + // Activity or BroadcastReceiver if someone passes one in.
  60 + mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
  61 + }
  62 + return mRequestQueue;
  63 + }
  64 +
  65 + public <T> void addToRequestQueue(Request<T> req) {
  66 + getRequestQueue().add(req);
  67 + }
  68 +
  69 + public ImageLoader getImageLoader() {
  70 + return mImageLoader;
  71 + }
  72 +}
  73 +
... ...
app/src/main/res/layout/activity_login.xml 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:gravity="center_horizontal"
  6 + android:orientation="vertical"
  7 + android:paddingBottom="@dimen/activity_vertical_margin"
  8 + android:paddingLeft="@dimen/activity_horizontal_margin"
  9 + android:paddingRight="@dimen/activity_horizontal_margin"
  10 + android:paddingTop="@dimen/activity_vertical_margin"
  11 + tools:context="net.plil.clubinfo.etunicorn.app.LoginActivity">
  12 +
  13 + <!-- Login progress -->
  14 + <ProgressBar
  15 + android:id="@+id/login_progress"
  16 + style="?android:attr/progressBarStyleLarge"
  17 + android:layout_width="wrap_content"
  18 + android:layout_height="wrap_content"
  19 + android:layout_marginBottom="8dp"
  20 + android:visibility="gone" />
  21 +
  22 + <ScrollView
  23 + android:id="@+id/login_form"
  24 + android:layout_width="match_parent"
  25 + android:layout_height="match_parent">
  26 +
  27 + <LinearLayout
  28 + android:id="@+id/email_login_form"
  29 + android:layout_width="match_parent"
  30 + android:layout_height="wrap_content"
  31 + android:orientation="vertical">
  32 +
  33 + <android.support.design.widget.TextInputLayout
  34 + android:layout_width="match_parent"
  35 + android:layout_height="wrap_content">
  36 +
  37 + <EditText
  38 + android:id="@+id/username"
  39 + android:layout_width="match_parent"
  40 + android:layout_height="wrap_content"
  41 + android:hint="@string/prompt_username"
  42 + android:inputType="none"
  43 + android:maxLines="1"
  44 + android:singleLine="true" />
  45 +
  46 + </android.support.design.widget.TextInputLayout>
  47 +
  48 + <android.support.design.widget.TextInputLayout
  49 + android:layout_width="match_parent"
  50 + android:layout_height="wrap_content">
  51 +
  52 + <EditText
  53 + android:id="@+id/password"
  54 + android:layout_width="match_parent"
  55 + android:layout_height="wrap_content"
  56 + android:hint="@string/prompt_password"
  57 + android:imeActionId="@+id/login"
  58 + android:imeActionLabel="@string/action_sign_in_short"
  59 + android:imeOptions="actionUnspecified"
  60 + android:inputType="textPassword"
  61 + android:maxLines="1"
  62 + android:singleLine="true" />
  63 + </android.support.design.widget.TextInputLayout>
  64 +
  65 + <Button
  66 + android:id="@+id/email_sign_in_button"
  67 + style="?android:textAppearanceSmall"
  68 + android:layout_width="match_parent"
  69 + android:layout_height="wrap_content"
  70 + android:layout_marginTop="16dp"
  71 + android:text="@string/action_sign_in_short"
  72 + android:textStyle="bold" />
  73 +
  74 + </LinearLayout>
  75 + </ScrollView>
  76 +</LinearLayout>
... ...
app/src/main/res/layout/activity_main.xml 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools"
  5 + android:id="@+id/main_content"
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:fitsSystemWindows="true"
  9 + tools:context="net.plil.clubinfo.etunicorn.app.MainActivity">
  10 +
  11 + <android.support.design.widget.AppBarLayout
  12 + android:id="@+id/appbar"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="wrap_content"
  15 + android:paddingTop="@dimen/appbar_padding_top"
  16 + android:theme="@style/AppTheme.AppBarOverlay">
  17 +
  18 + <android.support.v7.widget.Toolbar
  19 + android:id="@+id/toolbar"
  20 + android:layout_width="match_parent"
  21 + android:layout_height="?attr/actionBarSize"
  22 + android:background="?attr/colorPrimary"
  23 + app:layout_scrollFlags="scroll|enterAlways"
  24 + app:popupTheme="@style/AppTheme.PopupOverlay">
  25 +
  26 + </android.support.v7.widget.Toolbar>
  27 +
  28 + <android.support.design.widget.TabLayout
  29 + android:id="@+id/tabs"
  30 + android:layout_width="match_parent"
  31 + android:layout_height="wrap_content" />
  32 +
  33 + </android.support.design.widget.AppBarLayout>
  34 +
  35 + <android.support.v4.view.ViewPager
  36 + android:id="@+id/container"
  37 + android:layout_width="match_parent"
  38 + android:layout_height="match_parent"
  39 + app:layout_behavior="@string/appbar_scrolling_view_behavior" />
  40 +
  41 +
  42 +</android.support.design.widget.CoordinatorLayout>
... ...
app/src/main/res/layout/fragment_crediter.xml 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + tools:context="net.plil.clubinfo.etunicorn.app.Crediter">
  6 +
  7 + <!-- TODO: Update blank fragment layout -->
  8 + <TextView
  9 + android:layout_width="match_parent"
  10 + android:layout_height="match_parent"
  11 + android:text="@string/hello_blank_fragment" />
  12 +
  13 +</FrameLayout>
... ...
app/src/main/res/layout/fragment_debiter.xml 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + tools:context="net.plil.clubinfo.etunicorn.app.Debiter">
  6 +
  7 + <!-- TODO: Update blank fragment layout -->
  8 + <TextView
  9 + android:layout_width="match_parent"
  10 + android:layout_height="match_parent"
  11 + android:text="@string/hello_blank_fragment" />
  12 +
  13 +</FrameLayout>
... ...
app/src/main/res/layout/fragment_main.xml 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:paddingBottom="@dimen/activity_vertical_margin"
  6 + android:paddingLeft="@dimen/activity_horizontal_margin"
  7 + android:paddingRight="@dimen/activity_horizontal_margin"
  8 + android:paddingTop="@dimen/activity_vertical_margin"
  9 + tools:context="net.plil.clubinfo.etunicorn.app.MainActivity$PlaceholderFragment">
  10 +
  11 + <TextView
  12 + android:id="@+id/section_label"
  13 + android:layout_width="wrap_content"
  14 + android:layout_height="wrap_content" />
  15 +
  16 +</RelativeLayout>
... ...
app/src/main/res/menu/menu_main.xml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:app="http://schemas.android.com/apk/res-auto"
  3 + xmlns:tools="http://schemas.android.com/tools"
  4 + tools:context="net.plil.clubinfo.etunicorn.app.MainActivity">
  5 + <item
  6 + android:id="@+id/action_settings"
  7 + android:orderInCategory="100"
  8 + android:title="@string/action_settings"
  9 + app:showAsAction="never" />
  10 +</menu>
... ...
app/src/main/res/mipmap-hdpi/ic_launcher.png 0 → 100644

3.34 KB

app/src/main/res/mipmap-mdpi/ic_launcher.png 0 → 100644

2.15 KB

app/src/main/res/mipmap-xhdpi/ic_launcher.png 0 → 100644

4.73 KB

app/src/main/res/mipmap-xxhdpi/ic_launcher.png 0 → 100644

7.54 KB

app/src/main/res/mipmap-xxxhdpi/ic_launcher.png 0 → 100644

10.2 KB

app/src/main/res/values-fr/strings.xml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <string name="app_name">Etunicorn</string>
  4 + <string name="action_sign_in_short">Se connecter</string>
  5 + <string name="error_field_required">Ce champ est requis</string>
  6 + <string name="error_incorrect_password">Mot de passe incorrect</string>
  7 + <string name="error_invalid_password">Mot de passe invalide</string>
  8 + <string name="prompt_password">Mot de passe</string>
  9 + <string name="prompt_username">Nom d\'utilisateur</string>
  10 +</resources>
0 11 \ No newline at end of file
... ...
app/src/main/res/values-v21/styles.xml 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<resources>
  2 +
  3 + <style name="AppTheme.NoActionBar">
  4 + <item name="windowActionBar">false</item>
  5 + <item name="windowNoTitle">true</item>
  6 + <item name="android:windowDrawsSystemBarBackgrounds">true</item>
  7 + <item name="android:statusBarColor">@android:color/transparent</item>
  8 + </style>
  9 +</resources>
... ...
app/src/main/res/values-w820dp/dimens.xml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<resources>
  2 + <!-- Example customization of dimensions originally defined in res/values/dimens.xml
  3 + (such as screen margins) for screens with more than 820dp of available width. This
  4 + would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
  5 + <dimen name="activity_horizontal_margin">64dp</dimen>
  6 +</resources>
... ...
app/src/main/res/values/colors.xml 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <color name="colorPrimary">#F44336</color>
  4 + <color name="colorPrimaryDark">#C62828</color>
  5 + <color name="colorAccent">#2196F3</color>
  6 +</resources>
... ...
app/src/main/res/values/dimens.xml 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<resources>
  2 + <!-- Default screen margins, per the Android Design guidelines. -->
  3 + <dimen name="activity_horizontal_margin">16dp</dimen>
  4 + <dimen name="activity_vertical_margin">16dp</dimen>
  5 + <dimen name="fab_margin">16dp</dimen>
  6 + <dimen name="appbar_padding_top">8dp</dimen>
  7 +</resources>
... ...
app/src/main/res/values/strings.xml 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<resources>
  2 + <string name="app_name">Etunicorn</string>
  3 +
  4 + <!-- Strings related to login -->
  5 + <string name="prompt_password">Password</string>
  6 + <string name="action_sign_in_short">Sign in</string>
  7 + <string name="error_invalid_password">This password is too short</string>
  8 + <string name="error_incorrect_password">This password is incorrect</string>
  9 + <string name="error_field_required">This field is required</string>
  10 + <string name="prompt_username">Username</string>
  11 + <string name="title_activity_main">MainActivity</string>
  12 + <string name="action_settings">Settings</string>
  13 + <string name="section_format">Hello World from section: %1$d</string>
  14 +
  15 + <!-- TODO: Remove or change this placeholder text -->
  16 + <string name="hello_blank_fragment">Hello blank fragment</string>
  17 +</resources>
... ...
app/src/main/res/values/styles.xml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<resources>
  2 +
  3 + <!-- Base application theme. -->
  4 + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  5 + <!-- Customize your theme here. -->
  6 + <item name="colorPrimary">@color/colorPrimary</item>
  7 + <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  8 + <item name="colorAccent">@color/colorAccent</item>
  9 + </style>
  10 +
  11 + <style name="AppTheme.NoActionBar">
  12 + <item name="windowActionBar">false</item>
  13 + <item name="windowNoTitle">true</item>
  14 + </style>
  15 +
  16 + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
  17 +
  18 + <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
  19 +
  20 +</resources>
... ...
app/src/main/res/xml/tech.xml 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  3 + <tech-list>
  4 + <tech>android.nfc.tech.IsoDep</tech>
  5 + <tech>android.nfc.tech.NfcA</tech>
  6 + <tech>android.nfc.tech.NfcB</tech>
  7 + <tech>android.nfc.tech.NfcF</tech>
  8 + <tech>android.nfc.tech.NfcV</tech>
  9 + <tech>android.nfc.tech.Ndef</tech>
  10 + <tech>android.nfc.tech.NdefFormatable</tech>
  11 + <tech>android.nfc.tech.MifareClassic</tech>
  12 + <tech>android.nfc.tech.MifareUltralight</tech>
  13 + </tech-list>
  14 +</resources>
0 15 \ No newline at end of file
... ...
app/src/test/java/net/plil/clubinfo/etunicorn/ExampleUnitTest.java 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +package net.plil.clubinfo.etunicorn;
  2 +
  3 +import org.junit.Test;
  4 +
  5 +import static org.junit.Assert.*;
  6 +
  7 +/**
  8 + * Example local unit test, which will execute on the development machine (host).
  9 + *
  10 + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
  11 + */
  12 +public class ExampleUnitTest {
  13 + @Test
  14 + public void addition_isCorrect() throws Exception {
  15 + assertEquals(4, 2 + 2);
  16 + }
  17 +}
0 18 \ No newline at end of file
... ...
build.gradle 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +// Top-level build file where you can add configuration options common to all sub-projects/modules.
  2 +
  3 +buildscript {
  4 + repositories {
  5 + jcenter()
  6 + }
  7 + dependencies {
  8 + classpath 'com.android.tools.build:gradle:2.2.3'
  9 +
  10 + // NOTE: Do not place your application dependencies here; they belong
  11 + // in the individual module build.gradle files
  12 + }
  13 +}
  14 +
  15 +allprojects {
  16 + repositories {
  17 + jcenter()
  18 + }
  19 +}
  20 +
  21 +task clean(type: Delete) {
  22 + delete rootProject.buildDir
  23 +}
... ...
gradle.properties 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +# Project-wide Gradle settings.
  2 +
  3 +# IDE (e.g. Android Studio) users:
  4 +# Gradle settings configured through the IDE *will override*
  5 +# any settings specified in this file.
  6 +
  7 +# For more details on how to configure your build environment visit
  8 +# http://www.gradle.org/docs/current/userguide/build_environment.html
  9 +
  10 +# Specifies the JVM arguments used for the daemon process.
  11 +# The setting is particularly useful for tweaking memory settings.
  12 +org.gradle.jvmargs=-Xmx1536m
  13 +
  14 +# When configured, Gradle will run in incubating parallel mode.
  15 +# This option should only be used with decoupled projects. More details, visit
  16 +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
  17 +# org.gradle.parallel=true
... ...
gradle/wrapper/gradle-wrapper.jar 0 → 100644
No preview for this file type
gradle/wrapper/gradle-wrapper.properties 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +#Mon Dec 28 10:00:20 PST 2015
  2 +distributionBase=GRADLE_USER_HOME
  3 +distributionPath=wrapper/dists
  4 +zipStoreBase=GRADLE_USER_HOME
  5 +zipStorePath=wrapper/dists
  6 +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
... ...
gradlew 0 → 100644
... ... @@ -0,0 +1,160 @@
  1 +#!/usr/bin/env bash
  2 +
  3 +##############################################################################
  4 +##
  5 +## Gradle start up script for UN*X
  6 +##
  7 +##############################################################################
  8 +
  9 +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  10 +DEFAULT_JVM_OPTS=""
  11 +
  12 +APP_NAME="Gradle"
  13 +APP_BASE_NAME=`basename "$0"`
  14 +
  15 +# Use the maximum available, or set MAX_FD != -1 to use that value.
  16 +MAX_FD="maximum"
  17 +
  18 +warn ( ) {
  19 + echo "$*"
  20 +}
  21 +
  22 +die ( ) {
  23 + echo
  24 + echo "$*"
  25 + echo
  26 + exit 1
  27 +}
  28 +
  29 +# OS specific support (must be 'true' or 'false').
  30 +cygwin=false
  31 +msys=false
  32 +darwin=false
  33 +case "`uname`" in
  34 + CYGWIN* )
  35 + cygwin=true
  36 + ;;
  37 + Darwin* )
  38 + darwin=true
  39 + ;;
  40 + MINGW* )
  41 + msys=true
  42 + ;;
  43 +esac
  44 +
  45 +# Attempt to set APP_HOME
  46 +# Resolve links: $0 may be a link
  47 +PRG="$0"
  48 +# Need this for relative symlinks.
  49 +while [ -h "$PRG" ] ; do
  50 + ls=`ls -ld "$PRG"`
  51 + link=`expr "$ls" : '.*-> \(.*\)$'`
  52 + if expr "$link" : '/.*' > /dev/null; then
  53 + PRG="$link"
  54 + else
  55 + PRG=`dirname "$PRG"`"/$link"
  56 + fi
  57 +done
  58 +SAVED="`pwd`"
  59 +cd "`dirname \"$PRG\"`/" >/dev/null
  60 +APP_HOME="`pwd -P`"
  61 +cd "$SAVED" >/dev/null
  62 +
  63 +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
  64 +
  65 +# Determine the Java command to use to start the JVM.
  66 +if [ -n "$JAVA_HOME" ] ; then
  67 + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  68 + # IBM's JDK on AIX uses strange locations for the executables
  69 + JAVACMD="$JAVA_HOME/jre/sh/java"
  70 + else
  71 + JAVACMD="$JAVA_HOME/bin/java"
  72 + fi
  73 + if [ ! -x "$JAVACMD" ] ; then
  74 + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
  75 +
  76 +Please set the JAVA_HOME variable in your environment to match the
  77 +location of your Java installation."
  78 + fi
  79 +else
  80 + JAVACMD="java"
  81 + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  82 +
  83 +Please set the JAVA_HOME variable in your environment to match the
  84 +location of your Java installation."
  85 +fi
  86 +
  87 +# Increase the maximum file descriptors if we can.
  88 +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
  89 + MAX_FD_LIMIT=`ulimit -H -n`
  90 + if [ $? -eq 0 ] ; then
  91 + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
  92 + MAX_FD="$MAX_FD_LIMIT"
  93 + fi
  94 + ulimit -n $MAX_FD
  95 + if [ $? -ne 0 ] ; then
  96 + warn "Could not set maximum file descriptor limit: $MAX_FD"
  97 + fi
  98 + else
  99 + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
  100 + fi
  101 +fi
  102 +
  103 +# For Darwin, add options to specify how the application appears in the dock
  104 +if $darwin; then
  105 + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
  106 +fi
  107 +
  108 +# For Cygwin, switch paths to Windows format before running java
  109 +if $cygwin ; then
  110 + APP_HOME=`cygpath --path --mixed "$APP_HOME"`
  111 + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
  112 + JAVACMD=`cygpath --unix "$JAVACMD"`
  113 +
  114 + # We build the pattern for arguments to be converted via cygpath
  115 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
  116 + SEP=""
  117 + for dir in $ROOTDIRSRAW ; do
  118 + ROOTDIRS="$ROOTDIRS$SEP$dir"
  119 + SEP="|"
  120 + done
  121 + OURCYGPATTERN="(^($ROOTDIRS))"
  122 + # Add a user-defined pattern to the cygpath arguments
  123 + if [ "$GRADLE_CYGPATTERN" != "" ] ; then
  124 + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
  125 + fi
  126 + # Now convert the arguments - kludge to limit ourselves to /bin/sh
  127 + i=0
  128 + for arg in "$@" ; do
  129 + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
  130 + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
  131 +
  132 + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
  133 + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
  134 + else
  135 + eval `echo args$i`="\"$arg\""
  136 + fi
  137 + i=$((i+1))
  138 + done
  139 + case $i in
  140 + (0) set -- ;;
  141 + (1) set -- "$args0" ;;
  142 + (2) set -- "$args0" "$args1" ;;
  143 + (3) set -- "$args0" "$args1" "$args2" ;;
  144 + (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
  145 + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
  146 + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
  147 + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
  148 + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
  149 + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
  150 + esac
  151 +fi
  152 +
  153 +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
  154 +function splitJvmOpts() {
  155 + JVM_OPTS=("$@")
  156 +}
  157 +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
  158 +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
  159 +
  160 +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
... ...
gradlew.bat 0 → 100644
... ... @@ -0,0 +1,90 @@
  1 +@if "%DEBUG%" == "" @echo off
  2 +@rem ##########################################################################
  3 +@rem
  4 +@rem Gradle startup script for Windows
  5 +@rem
  6 +@rem ##########################################################################
  7 +
  8 +@rem Set local scope for the variables with windows NT shell
  9 +if "%OS%"=="Windows_NT" setlocal
  10 +
  11 +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  12 +set DEFAULT_JVM_OPTS=
  13 +
  14 +set DIRNAME=%~dp0
  15 +if "%DIRNAME%" == "" set DIRNAME=.
  16 +set APP_BASE_NAME=%~n0
  17 +set APP_HOME=%DIRNAME%
  18 +
  19 +@rem Find java.exe
  20 +if defined JAVA_HOME goto findJavaFromJavaHome
  21 +
  22 +set JAVA_EXE=java.exe
  23 +%JAVA_EXE% -version >NUL 2>&1
  24 +if "%ERRORLEVEL%" == "0" goto init
  25 +
  26 +echo.
  27 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  28 +echo.
  29 +echo Please set the JAVA_HOME variable in your environment to match the
  30 +echo location of your Java installation.
  31 +
  32 +goto fail
  33 +
  34 +:findJavaFromJavaHome
  35 +set JAVA_HOME=%JAVA_HOME:"=%
  36 +set JAVA_EXE=%JAVA_HOME%/bin/java.exe
  37 +
  38 +if exist "%JAVA_EXE%" goto init
  39 +
  40 +echo.
  41 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
  42 +echo.
  43 +echo Please set the JAVA_HOME variable in your environment to match the
  44 +echo location of your Java installation.
  45 +
  46 +goto fail
  47 +
  48 +:init
  49 +@rem Get command-line arguments, handling Windowz variants
  50 +
  51 +if not "%OS%" == "Windows_NT" goto win9xME_args
  52 +if "%@eval[2+2]" == "4" goto 4NT_args
  53 +
  54 +:win9xME_args
  55 +@rem Slurp the command line arguments.
  56 +set CMD_LINE_ARGS=
  57 +set _SKIP=2
  58 +
  59 +:win9xME_args_slurp
  60 +if "x%~1" == "x" goto execute
  61 +
  62 +set CMD_LINE_ARGS=%*
  63 +goto execute
  64 +
  65 +:4NT_args
  66 +@rem Get arguments from the 4NT Shell from JP Software
  67 +set CMD_LINE_ARGS=%$
  68 +
  69 +:execute
  70 +@rem Setup the command line
  71 +
  72 +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
  73 +
  74 +@rem Execute Gradle
  75 +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
  76 +
  77 +:end
  78 +@rem End local scope for the variables with windows NT shell
  79 +if "%ERRORLEVEL%"=="0" goto mainEnd
  80 +
  81 +:fail
  82 +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
  83 +rem the _cmd.exe /c_ return code!
  84 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
  85 +exit /b 1
  86 +
  87 +:mainEnd
  88 +if "%OS%"=="Windows_NT" endlocal
  89 +
  90 +:omega
... ...
settings.gradle 0 → 100644
... ... @@ -0,0 +1 @@
  1 +include ':app'
... ...