diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/ConnectionFragment.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/ConnectionFragment.java index f4ca320..d37f2dd 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/ConnectionFragment.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/ConnectionFragment.java @@ -20,8 +20,7 @@ public class ConnectionFragment extends NFC { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View ret = inflater.inflate(R.layout.layout_connection, container, false); - return ret; + return inflater.inflate(R.layout.layout_connection, container, false); } @Override diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/DecimalDigitsInputFilter.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/DecimalDigitsInputFilter.java index a4f6eb1..40a4772 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/DecimalDigitsInputFilter.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/DecimalDigitsInputFilter.java @@ -9,13 +9,12 @@ import java.util.regex.Pattern; /** * Created by Jean-loup Beaussart on 02/05/2016. */ -public class DecimalDigitsInputFilter implements InputFilter { +class DecimalDigitsInputFilter implements InputFilter { - Pattern mPattern; + private final Pattern mPattern; public DecimalDigitsInputFilter(int digitsBeforeZero,int digitsAfterZero) { mPattern = Pattern.compile("(0|[1-9][0-9]{0,2})?([,.][0-9]{0,2})?"); - } @Override diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java index 158f791..44c046e 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java @@ -17,7 +17,7 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.widget.EditText;; +import android.widget.EditText; import android.widget.Toast; import android.os.Handler; diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/NFC.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/NFC.java index b9bb437..e70ef0b 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/NFC.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/NFC.java @@ -9,7 +9,7 @@ import android.content.Intent; public abstract class NFC extends Fragment { // Convertit l'array de byte en chaîne hexadécimale (si le byte = 0x63, str = "63"). - public String ByteArrayToHexString(byte [] inarray) { + String ByteArrayToHexString(byte[] inarray) { int i, j, in; String [] hex = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; String out= ""; diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java index 5a7447a..333e542 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java @@ -79,7 +79,7 @@ public class NFCFragment extends NFC { } - public void clientAPI() { + private void clientAPI() { try { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext()); URL url = new URL(settings.getString("server_address", null) + mAPI); diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java index ae696ff..a093fbd 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java @@ -17,10 +17,10 @@ import javax.net.ssl.HttpsURLConnection; /** * Created by Jean-loup Beaussart on 30/04/2016. */ -public class NetworkThread extends AsyncTask { +class NetworkThread extends AsyncTask { public ASyncResponse delegate = null; - private URL mUrl; - private HashMap mParam; + private final URL mUrl; + private final HashMap mParam; NetworkThread(URL url, HashMap param){ @@ -29,14 +29,6 @@ public class NetworkThread extends AsyncTask { } @Override - protected void onPreExecute() { - /** - * show dialog - */ - super.onPreExecute(); - } - - @Override protected JSONObject doInBackground(Void ... params) { /** diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java index f05fbb3..92fd12f 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java @@ -5,10 +5,10 @@ package com.example.app_10p5; */ import android.app.Fragment; import android.app.FragmentManager; -import android.support.v13.app.FragmentStatePagerAdapter;; +import android.support.v13.app.FragmentStatePagerAdapter; -public class PagerAdapter extends FragmentStatePagerAdapter { - int mNumOfTabs; +class PagerAdapter extends FragmentStatePagerAdapter { + private final int mNumOfTabs; public PagerAdapter(FragmentManager fm, int NumOfTabs) { super(fm); @@ -20,17 +20,13 @@ public class PagerAdapter extends FragmentStatePagerAdapter { switch (position) { case 0: - TabFragment1 tab1 = new TabFragment1(); - return tab1; + return new TabFragment1(); case 1: - TabFragment2 tab2 = new TabFragment2(); - return tab2; + return new TabFragment2(); case 2: - TabFragment3 tab3 = new TabFragment3(); - return tab3; + return new TabFragment3(); case 3: - TabFragment4 tab4 = new TabFragment4(); - return tab4; + return new TabFragment4(); default: return null; } diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/main_tab_frag.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/main_tab_frag.java index 48a996e..d1a43b4 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/main_tab_frag.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/main_tab_frag.java @@ -1,10 +1,10 @@ package com.example.app_10p5; -import android.content.Context; import android.os.Bundle; import android.app.Fragment; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,11 +20,6 @@ public class main_tab_frag extends Fragment { } @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View ret = inflater.inflate(R.layout.fragment_main_tab_frag, container, false); @@ -48,7 +43,7 @@ public class main_tab_frag extends Fragment { @Override public void onTabSelected(TabLayout.Tab tab) { - if(parent.getToken() != "" && System.currentTimeMillis() - parent.getTimeToken() < MainActivite.EXPIRATION){ + if((TextUtils.getTrimmedLength(parent.getToken()) == 30) && ((System.currentTimeMillis() - parent.getTimeToken()) < MainActivite.EXPIRATION)){ viewPager.setCurrentItem(tab.getPosition()); } else{ @@ -69,16 +64,6 @@ public class main_tab_frag extends Fragment { return ret; } - @Override - public void onAttach(Context context) { - super.onAttach(context); - } - - @Override - public void onDetach() { - super.onDetach(); - } - public interface OnFragmentInteractionListener { void onFragmentInteraction(String s); } diff --git a/PremiereActivite/app/src/main/java/com/example/app_10p5/viewListenerAnnulerRefaire.java b/PremiereActivite/app/src/main/java/com/example/app_10p5/viewListenerAnnulerRefaire.java index 9dc3834..6f54af1 100644 --- a/PremiereActivite/app/src/main/java/com/example/app_10p5/viewListenerAnnulerRefaire.java +++ b/PremiereActivite/app/src/main/java/com/example/app_10p5/viewListenerAnnulerRefaire.java @@ -5,10 +5,10 @@ import android.view.View; /** * Created by Jean-loup Beaussart on 06/05/2016. */ -public class viewListenerAnnulerRefaire implements View.OnClickListener { - private int mIdTransaction; - private MainActivite mMain; - private boolean mAnnuler; +class viewListenerAnnulerRefaire implements View.OnClickListener { + private final int mIdTransaction; + private final MainActivite mMain; + private final boolean mAnnuler; viewListenerAnnulerRefaire(int idTransaction, MainActivite main, boolean annuler){ mIdTransaction = idTransaction; diff --git a/PremiereActivite/app/src/main/res/layout/layout_vidange.xml b/PremiereActivite/app/src/main/res/layout/layout_vidange.xml index 599d061..8a21037 100644 --- a/PremiereActivite/app/src/main/res/layout/layout_vidange.xml +++ b/PremiereActivite/app/src/main/res/layout/layout_vidange.xml @@ -18,7 +18,7 @@ android:layout_marginTop="40dp" android:textAlignment="center" android:textSize="80sp" - android:textColor="@color/abc_input_method_navigation_guard" /> + android:textColor="@color/black" />