Commit 0e3ce2934631049a8f0cef42dab55407f51967d3

Authored by JLo'w
1 parent 9142a050

Corrections mineures + comparaison chaine avec ""

PremiereActivite/app/src/main/java/com/example/app_10p5/ConnectionFragment.java
... ... @@ -20,8 +20,7 @@ public class ConnectionFragment extends NFC {
20 20  
21 21 @Override
22 22 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
23   - View ret = inflater.inflate(R.layout.layout_connection, container, false);
24   - return ret;
  23 + return inflater.inflate(R.layout.layout_connection, container, false);
25 24 }
26 25  
27 26 @Override
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/DecimalDigitsInputFilter.java
... ... @@ -9,13 +9,12 @@ import java.util.regex.Pattern;
9 9 /**
10 10 * Created by Jean-loup Beaussart on 02/05/2016.
11 11 */
12   -public class DecimalDigitsInputFilter implements InputFilter {
  12 +class DecimalDigitsInputFilter implements InputFilter {
13 13  
14   - Pattern mPattern;
  14 + private final Pattern mPattern;
15 15  
16 16 public DecimalDigitsInputFilter(int digitsBeforeZero,int digitsAfterZero) {
17 17 mPattern = Pattern.compile("(0|[1-9][0-9]{0,2})?([,.][0-9]{0,2})?");
18   -
19 18 }
20 19  
21 20 @Override
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
... ... @@ -17,7 +17,7 @@ import android.view.Menu;
17 17 import android.view.MenuInflater;
18 18 import android.view.MenuItem;
19 19 import android.view.View;
20   -import android.widget.EditText;;
  20 +import android.widget.EditText;
21 21 import android.widget.Toast;
22 22 import android.os.Handler;
23 23  
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/NFC.java
... ... @@ -9,7 +9,7 @@ import android.content.Intent;
9 9 public abstract class NFC extends Fragment {
10 10  
11 11 // Convertit l'array de byte en chaîne hexadécimale (si le byte = 0x63, str = "63").
12   - public String ByteArrayToHexString(byte [] inarray) {
  12 + String ByteArrayToHexString(byte[] inarray) {
13 13 int i, j, in;
14 14 String [] hex = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};
15 15 String out= "";
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java
... ... @@ -79,7 +79,7 @@ public class NFCFragment extends NFC {
79 79 }
80 80  
81 81  
82   - public void clientAPI() {
  82 + private void clientAPI() {
83 83 try {
84 84 SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
85 85 URL url = new URL(settings.getString("server_address", null) + mAPI);
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/NetworkThread.java
... ... @@ -17,10 +17,10 @@ import javax.net.ssl.HttpsURLConnection;
17 17 /**
18 18 * Created by Jean-loup Beaussart on 30/04/2016.
19 19 */
20   -public class NetworkThread extends AsyncTask<Void, Void, JSONObject> {
  20 +class NetworkThread extends AsyncTask<Void, Void, JSONObject> {
21 21 public ASyncResponse delegate = null;
22   - private URL mUrl;
23   - private HashMap<String, String> mParam;
  22 + private final URL mUrl;
  23 + private final HashMap<String, String> mParam;
24 24  
25 25 NetworkThread(URL url, HashMap<String, String> param){
26 26  
... ... @@ -29,14 +29,6 @@ public class NetworkThread extends AsyncTask&lt;Void, Void, JSONObject&gt; {
29 29 }
30 30  
31 31 @Override
32   - protected void onPreExecute() {
33   - /**
34   - * show dialog
35   - */
36   - super.onPreExecute();
37   - }
38   -
39   - @Override
40 32 protected JSONObject doInBackground(Void ... params) {
41 33  
42 34 /**
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java
... ... @@ -5,10 +5,10 @@ package com.example.app_10p5;
5 5 */
6 6 import android.app.Fragment;
7 7 import android.app.FragmentManager;
8   -import android.support.v13.app.FragmentStatePagerAdapter;;
  8 +import android.support.v13.app.FragmentStatePagerAdapter;
9 9  
10   -public class PagerAdapter extends FragmentStatePagerAdapter {
11   - int mNumOfTabs;
  10 +class PagerAdapter extends FragmentStatePagerAdapter {
  11 + private final int mNumOfTabs;
12 12  
13 13 public PagerAdapter(FragmentManager fm, int NumOfTabs) {
14 14 super(fm);
... ... @@ -20,17 +20,13 @@ public class PagerAdapter extends FragmentStatePagerAdapter {
20 20  
21 21 switch (position) {
22 22 case 0:
23   - TabFragment1 tab1 = new TabFragment1();
24   - return tab1;
  23 + return new TabFragment1();
25 24 case 1:
26   - TabFragment2 tab2 = new TabFragment2();
27   - return tab2;
  25 + return new TabFragment2();
28 26 case 2:
29   - TabFragment3 tab3 = new TabFragment3();
30   - return tab3;
  27 + return new TabFragment3();
31 28 case 3:
32   - TabFragment4 tab4 = new TabFragment4();
33   - return tab4;
  29 + return new TabFragment4();
34 30 default:
35 31 return null;
36 32 }
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/main_tab_frag.java
1 1 package com.example.app_10p5;
2 2  
3   -import android.content.Context;
4 3 import android.os.Bundle;
5 4 import android.app.Fragment;
6 5 import android.support.design.widget.TabLayout;
7 6 import android.support.v4.view.ViewPager;
  7 +import android.text.TextUtils;
8 8 import android.view.LayoutInflater;
9 9 import android.view.View;
10 10 import android.view.ViewGroup;
... ... @@ -20,11 +20,6 @@ public class main_tab_frag extends Fragment {
20 20 }
21 21  
22 22 @Override
23   - public void onCreate(Bundle savedInstanceState) {
24   - super.onCreate(savedInstanceState);
25   - }
26   -
27   - @Override
28 23 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
29 24 // Inflate the layout for this fragment
30 25 View ret = inflater.inflate(R.layout.fragment_main_tab_frag, container, false);
... ... @@ -48,7 +43,7 @@ public class main_tab_frag extends Fragment {
48 43 @Override
49 44 public void onTabSelected(TabLayout.Tab tab) {
50 45  
51   - if(parent.getToken() != "" && System.currentTimeMillis() - parent.getTimeToken() < MainActivite.EXPIRATION){
  46 + if((TextUtils.getTrimmedLength(parent.getToken()) == 30) && ((System.currentTimeMillis() - parent.getTimeToken()) < MainActivite.EXPIRATION)){
52 47 viewPager.setCurrentItem(tab.getPosition());
53 48 }
54 49 else{
... ... @@ -69,16 +64,6 @@ public class main_tab_frag extends Fragment {
69 64 return ret;
70 65 }
71 66  
72   - @Override
73   - public void onAttach(Context context) {
74   - super.onAttach(context);
75   - }
76   -
77   - @Override
78   - public void onDetach() {
79   - super.onDetach();
80   - }
81   -
82 67 public interface OnFragmentInteractionListener {
83 68 void onFragmentInteraction(String s);
84 69 }
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/viewListenerAnnulerRefaire.java
... ... @@ -5,10 +5,10 @@ import android.view.View;
5 5 /**
6 6 * Created by Jean-loup Beaussart on 06/05/2016.
7 7 */
8   -public class viewListenerAnnulerRefaire implements View.OnClickListener {
9   - private int mIdTransaction;
10   - private MainActivite mMain;
11   - private boolean mAnnuler;
  8 +class viewListenerAnnulerRefaire implements View.OnClickListener {
  9 + private final int mIdTransaction;
  10 + private final MainActivite mMain;
  11 + private final boolean mAnnuler;
12 12  
13 13 viewListenerAnnulerRefaire(int idTransaction, MainActivite main, boolean annuler){
14 14 mIdTransaction = idTransaction;
... ...
PremiereActivite/app/src/main/res/layout/layout_vidange.xml
... ... @@ -18,7 +18,7 @@
18 18 android:layout_marginTop="40dp"
19 19 android:textAlignment="center"
20 20 android:textSize="80sp"
21   - android:textColor="@color/abc_input_method_navigation_guard" />
  21 + android:textColor="@color/black" />
22 22  
23 23 <Button
24 24 android:layout_width="wrap_content"
... ...
PremiereActivite/app/src/main/res/layout/tab_fragment_1.xml
... ... @@ -4,6 +4,6 @@
4 4 android:layout_height="match_parent"
5 5 android:orientation="vertical">
6 6  
7   - <include layout="@layout/layout_commande"></include>
  7 + <include layout="@layout/layout_commande"/>
8 8  
9 9 </RelativeLayout>
10 10 \ No newline at end of file
... ...
PremiereActivite/app/src/main/res/layout/tab_fragment_2.xml
... ... @@ -4,6 +4,6 @@
4 4 android:layout_height="match_parent"
5 5 android:orientation="vertical">
6 6  
7   - <include layout="@layout/layout_rechargement"></include>
  7 + <include layout="@layout/layout_rechargement"/>
8 8  
9 9 </RelativeLayout>
10 10 \ No newline at end of file
... ...
PremiereActivite/app/src/main/res/layout/tab_fragment_3.xml
... ... @@ -4,6 +4,6 @@
4 4 android:layout_height="match_parent"
5 5 android:orientation="vertical">
6 6  
7   - <include layout="@layout/layout_creation"></include>
  7 + <include layout="@layout/layout_creation"/>
8 8  
9 9 </RelativeLayout>
10 10 \ No newline at end of file
... ...
PremiereActivite/app/src/main/res/layout/tab_fragment_4.xml
... ... @@ -4,6 +4,6 @@
4 4 android:layout_height="match_parent"
5 5 android:orientation="vertical">
6 6  
7   - <include layout="@layout/layout_vidange"></include>
  7 + <include layout="@layout/layout_vidange"/>
8 8  
9 9 </RelativeLayout>
10 10 \ No newline at end of file
... ...
PremiereActivite/app/src/main/res/values/colors.xml
... ... @@ -3,4 +3,5 @@
3 3 <color name="colorPrimary">#EE4242</color>
4 4 <color name="colorPrimaryDark">#303F9F</color>
5 5 <color name="colorAccent">#ff4081</color>
  6 + <color name="black">#000000</color>
6 7 </resources>
... ...