Commit e9b6c14d7e97097f87d459c3bbfb58ae28047247

Authored by JLo'w
1 parent 4ef24041

Passage au supportv13 avec les fragments natifs

PremiereActivite/app/build.gradle
... ... @@ -23,4 +23,5 @@ dependencies {
23 23 compile fileTree(dir: 'libs', include: ['*.jar'])
24 24 testCompile 'junit:junit:4.12'
25 25 compile 'com.android.support:design:23.2.1'
  26 + compile 'com.android.support:support-v13:23.2.1'
26 27 }
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
1 1 package com.example.app_10p5;
2 2  
  3 +import android.app.Activity;
3 4 import android.content.Intent;
4   -import android.opengl.ETC1;
5 5 import android.os.Bundle;
6 6 import android.support.design.widget.TabLayout;
7   -import android.support.v4.app.FragmentActivity;
8 7 import android.support.v4.view.ViewPager;
9   -import android.text.InputFilter;
10 8 import android.view.View;
11 9 import android.widget.EditText;
12 10 import android.widget.Toast;
... ... @@ -20,7 +18,7 @@ import java.util.HashMap;
20 18 /**
21 19 * Created by beaus on 24/04/2016.
22 20 */
23   -public class MainActivite extends FragmentActivity implements ASyncResponse {
  21 +public class MainActivite extends Activity implements ASyncResponse {
24 22  
25 23 public static final int STATE_RIEN = 0;
26 24 public static final int STATE_COMMANDE = 3;
... ... @@ -55,7 +53,7 @@ public class MainActivite extends FragmentActivity implements ASyncResponse {
55 53 tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
56 54  
57 55 final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
58   - final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
  56 + final PagerAdapter adapter = new PagerAdapter(getFragmentManager(), tabLayout.getTabCount());
59 57 viewPager.setAdapter(adapter);
60 58 viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
61 59 tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java
... ... @@ -3,9 +3,9 @@ package com.example.app_10p5;
3 3 /**
4 4 * Created by beaus on 24/04/2016.
5 5 */
6   -import android.support.v4.app.Fragment;
7   -import android.support.v4.app.FragmentManager;
8   -import android.support.v4.app.FragmentStatePagerAdapter;
  6 +import android.app.Fragment;
  7 +import android.app.FragmentManager;
  8 +import android.support.v13.app.FragmentStatePagerAdapter;;
9 9  
10 10 public class PagerAdapter extends FragmentStatePagerAdapter {
11 11 int mNumOfTabs;
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment1.java
1 1 package com.example.app_10p5;
2 2  
3 3 import android.os.Bundle;
4   -import android.support.v4.app.Fragment;
  4 +import android.app.Fragment;
5 5 import android.view.LayoutInflater;
6 6 import android.view.View;
7 7 import android.view.ViewGroup;
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment2.java
1 1 package com.example.app_10p5;
2 2  
3 3 import android.os.Bundle;
4   -import android.support.v4.app.Fragment;
  4 +import android.app.Fragment;
5 5 import android.text.InputFilter;
6 6 import android.view.LayoutInflater;
7 7 import android.view.View;
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment3.java
... ... @@ -2,7 +2,7 @@ package com.example.app_10p5;
2 2  
3 3  
4 4 import android.os.Bundle;
5   -import android.support.v4.app.Fragment;
  5 +import android.app.Fragment;
6 6 import android.view.LayoutInflater;
7 7 import android.view.View;
8 8 import android.view.ViewGroup;
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment4.java
1 1 package com.example.app_10p5;
2 2  
3 3 import android.os.Bundle;
4   -import android.support.v4.app.Fragment;
  4 +import android.app.Fragment;
5 5 import android.view.LayoutInflater;
6 6 import android.view.View;
7 7 import android.view.ViewGroup;
... ...
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment5.java
1 1 package com.example.app_10p5;
2 2  
3 3 import android.os.Bundle;
4   -import android.support.v4.app.Fragment;
  4 +import android.app.Fragment;
5 5 import android.view.LayoutInflater;
6 6 import android.view.View;
7 7 import android.view.ViewGroup;
... ...