Blame view

PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java 2.26 KB
c8059613   JLo'w   Re-fonte de l'app...
1
2
  package com.example.app_10p5;
  
93f90e35   JLo'w   NFC et foreground
3
  import android.app.PendingIntent;
c8059613   JLo'w   Re-fonte de l'app...
4
  import android.content.Intent;
93f90e35   JLo'w   NFC et foreground
5
6
7
8
9
  import android.content.IntentFilter;
  import android.nfc.NfcAdapter;
  import android.nfc.Tag;
  import android.nfc.tech.MifareClassic;
  import android.nfc.tech.NfcA;
c8059613   JLo'w   Re-fonte de l'app...
10
11
12
13
14
15
16
  import android.os.Bundle;
  import android.support.design.widget.TabLayout;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.Fragment;
  import android.support.v4.view.ViewPager;
  import android.view.View;
93f90e35   JLo'w   NFC et foreground
17
18
19
  import android.widget.Toast;
  
  import java.io.IOException;
c8059613   JLo'w   Re-fonte de l'app...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  
  /**
   * Created by beaus on 24/04/2016.
   */
  public class MainActivite extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.layout_main);
          TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
          tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
          tabLayout.addTab(tabLayout.newTab().setText("Commande"));
          tabLayout.addTab(tabLayout.newTab().setText("Rechargement"));
          tabLayout.addTab(tabLayout.newTab().setText("Création"));
          tabLayout.addTab(tabLayout.newTab().setText("Vidange"));
          tabLayout.addTab(tabLayout.newTab().setText("Admin"));
          tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
  
          final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
          final PagerAdapter adapter = new PagerAdapter
                  (getSupportFragmentManager(), tabLayout.getTabCount());
          viewPager.setAdapter(adapter);
          viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
          tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
                  viewPager.setCurrentItem(tab.getPosition());
              }
  
              @Override
              public void onTabUnselected(TabLayout.Tab tab) {
  
              }
  
              @Override
              public void onTabReselected(TabLayout.Tab tab) {
  
              }
          });
      }
  
      public void valideCommande(View v)
      {
          Intent intent = new Intent(this, CarteActivite.class);
          startActivity(intent);
      }
93f90e35   JLo'w   NFC et foreground
67
  
c8059613   JLo'w   Re-fonte de l'app...
68
  }