Commit 9d65a3063b723bbbba9a1b8d6aca7e898bc34eae
1 parent
4ef24041
Get rid of support libraries
Showing
15 changed files
with
100 additions
and
74 deletions
Show diff stats
PremiereActivite/app/build.gradle
... | ... | @@ -7,7 +7,7 @@ android { |
7 | 7 | defaultConfig { |
8 | 8 | applicationId "com.example.app_10p5" |
9 | 9 | minSdkVersion 21 |
10 | - targetSdkVersion 23 | |
10 | + targetSdkVersion 21 | |
11 | 11 | versionCode 1 |
12 | 12 | versionName "1.0" |
13 | 13 | } |
... | ... | @@ -22,5 +22,4 @@ android { |
22 | 22 | dependencies { |
23 | 23 | compile fileTree(dir: 'libs', include: ['*.jar']) |
24 | 24 | testCompile 'junit:junit:4.12' |
25 | - compile 'com.android.support:design:23.2.1' | |
26 | 25 | } | ... | ... |
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; |
5 | +import android.graphics.drawable.ColorDrawable; | |
6 | +import android.graphics.drawable.Drawable; | |
4 | 7 | import android.opengl.ETC1; |
5 | 8 | import android.os.Bundle; |
6 | -import android.support.design.widget.TabLayout; | |
7 | -import android.support.v4.app.FragmentActivity; | |
8 | -import android.support.v4.view.ViewPager; | |
9 | 9 | import android.text.InputFilter; |
10 | +import android.view.Menu; | |
11 | +import android.view.MenuInflater; | |
12 | +import android.view.MenuItem; | |
10 | 13 | import android.view.View; |
14 | +import android.view.Window; | |
15 | +import android.view.WindowManager; | |
11 | 16 | import android.widget.EditText; |
12 | 17 | import android.widget.Toast; |
13 | 18 | |
... | ... | @@ -20,7 +25,7 @@ import java.util.HashMap; |
20 | 25 | /** |
21 | 26 | * Created by beaus on 24/04/2016. |
22 | 27 | */ |
23 | -public class MainActivite extends FragmentActivity implements ASyncResponse { | |
28 | +public class MainActivite extends Activity implements ASyncResponse { | |
24 | 29 | |
25 | 30 | public static final int STATE_RIEN = 0; |
26 | 31 | public static final int STATE_COMMANDE = 3; |
... | ... | @@ -41,11 +46,18 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
41 | 46 | super.onCreate(savedInstanceState); |
42 | 47 | setContentView(R.layout.layout_main); |
43 | 48 | |
49 | + Window window = this.getWindow(); | |
50 | + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
51 | + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); | |
52 | + window.setStatusBarColor(getResources().getColor(R.color.colorPrimary)); | |
53 | + | |
54 | + getActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary))); | |
55 | + | |
44 | 56 | mState = STATE_RIEN; |
45 | 57 | mTimeToken = -1; |
46 | 58 | mToken = ""; |
47 | 59 | |
48 | - TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); | |
60 | + /*TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); | |
49 | 61 | tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); |
50 | 62 | tabLayout.addTab(tabLayout.newTab().setText("Connexion")); |
51 | 63 | tabLayout.addTab(tabLayout.newTab().setText("Commande")); |
... | ... | @@ -55,7 +67,7 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
55 | 67 | tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); |
56 | 68 | |
57 | 69 | final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); |
58 | - final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); | |
70 | + final PagerAdapter adapter = new PagerAdapter(getFragmentManager(), tabLayout.getTabCount()); | |
59 | 71 | viewPager.setAdapter(adapter); |
60 | 72 | viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); |
61 | 73 | tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { |
... | ... | @@ -80,7 +92,20 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
80 | 92 | public void onTabReselected(TabLayout.Tab tab) { |
81 | 93 | |
82 | 94 | } |
83 | - }); | |
95 | + });*/ | |
96 | + } | |
97 | + | |
98 | + @Override | |
99 | + public boolean onOptionsItemSelected(MenuItem item) { | |
100 | + | |
101 | + return super.onOptionsItemSelected(item); | |
102 | + } | |
103 | + | |
104 | + @Override | |
105 | + public boolean onCreateOptionsMenu(Menu menu) { | |
106 | + menu.clear(); | |
107 | + getMenuInflater().inflate(R.menu.menu, menu); | |
108 | + return super.onCreateOptionsMenu(menu); | |
84 | 109 | } |
85 | 110 | |
86 | 111 | @Override |
... | ... | @@ -131,8 +156,8 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
131 | 156 | } |
132 | 157 | else{ |
133 | 158 | Toast.makeText(this, "Veuillez vous reconnecter.", Toast.LENGTH_LONG).show(); |
134 | - final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
135 | - viewPager.setCurrentItem(0); | |
159 | + /*final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
160 | + viewPager.setCurrentItem(0);*/ | |
136 | 161 | } |
137 | 162 | } |
138 | 163 | |
... | ... | @@ -168,8 +193,8 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
168 | 193 | } |
169 | 194 | else{ |
170 | 195 | Toast.makeText(this, "Veuillez vous reconnecter.", Toast.LENGTH_LONG).show(); |
171 | - final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
172 | - viewPager.setCurrentItem(0); | |
196 | + /*final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
197 | + viewPager.setCurrentItem(0);*/ | |
173 | 198 | } |
174 | 199 | } |
175 | 200 | |
... | ... | @@ -200,8 +225,8 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
200 | 225 | } |
201 | 226 | else{ |
202 | 227 | Toast.makeText(this, "Veuillez vous reconnecter.", Toast.LENGTH_LONG).show(); |
203 | - final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
204 | - viewPager.setCurrentItem(0); | |
228 | + /*final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
229 | + viewPager.setCurrentItem(0);*/ | |
205 | 230 | } |
206 | 231 | } |
207 | 232 | |
... | ... | @@ -250,8 +275,8 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
250 | 275 | } |
251 | 276 | else{ |
252 | 277 | Toast.makeText(this, "Veuillez vous reconnecter.", Toast.LENGTH_LONG).show(); |
253 | - final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
254 | - viewPager.setCurrentItem(0); | |
278 | + /*final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
279 | + viewPager.setCurrentItem(0);*/ | |
255 | 280 | } |
256 | 281 | } |
257 | 282 | |
... | ... | @@ -265,7 +290,7 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
265 | 290 | |
266 | 291 | } |
267 | 292 | catch (Throwable t){ |
268 | - Toast.makeText(this, "WTF, le cancer est dans l'application!!", Toast.LENGTH_LONG).show(); | |
293 | + Toast.makeText(this, "Retour", Toast.LENGTH_SHORT).show(); | |
269 | 294 | } |
270 | 295 | |
271 | 296 | |
... | ... | @@ -297,11 +322,11 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
297 | 322 | mTimeToken = System.currentTimeMillis(); |
298 | 323 | mDroit = output.getInt("droit"); |
299 | 324 | mUser = output.get("login").toString(); |
300 | - Toast.makeText(this, "Bonjour " + mUser + " vous êtes bien connecté pour " + EXPIRATION / (1000 * 60) + " minutes.", Toast.LENGTH_LONG).show(); | |
325 | + Toast.makeText(this, "Bonjour " + mUser + " vous êtes bien connecté pour " + EXPIRATION / (1000 * 60) + " minutes.", Toast.LENGTH_SHORT).show(); | |
301 | 326 | EditText coUser = (EditText) findViewById(R.id.connection_password); |
302 | 327 | coUser.setText(""); |
303 | - final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
304 | - viewPager.setCurrentItem(1); | |
328 | + /*final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
329 | + viewPager.setCurrentItem(1);*/ | |
305 | 330 | } |
306 | 331 | else{ |
307 | 332 | Toast.makeText(this, "Erreur dans la requête: " + output.get("status"), Toast.LENGTH_LONG).show(); |
... | ... | @@ -312,7 +337,7 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
312 | 337 | } |
313 | 338 | } |
314 | 339 | else{ |
315 | - Toast.makeText(this, "Impossible de se connecter au serveur", Toast.LENGTH_LONG).show(); | |
340 | + Toast.makeText(this, "Impossible de se connecter au serveur", Toast.LENGTH_SHORT).show(); | |
316 | 341 | } |
317 | 342 | } |
318 | 343 | } | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/PagerAdapter.java
... | ... | @@ -3,19 +3,20 @@ 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; | |
9 | 6 | |
10 | -public class PagerAdapter extends FragmentStatePagerAdapter { | |
7 | +import android.app.Fragment; | |
8 | +import android.app.FragmentManager; | |
9 | + | |
10 | + | |
11 | +public class PagerAdapter /*extends ViewPager*/ { | |
11 | 12 | int mNumOfTabs; |
12 | 13 | |
13 | 14 | public PagerAdapter(FragmentManager fm, int NumOfTabs) { |
14 | - super(fm); | |
15 | + //super(fm); | |
15 | 16 | this.mNumOfTabs = NumOfTabs; |
16 | 17 | } |
17 | 18 | |
18 | - @Override | |
19 | + //@Override | |
19 | 20 | public Fragment getItem(int position) { |
20 | 21 | |
21 | 22 | switch (position) { |
... | ... | @@ -39,7 +40,7 @@ public class PagerAdapter extends FragmentStatePagerAdapter { |
39 | 40 | } |
40 | 41 | } |
41 | 42 | |
42 | - @Override | |
43 | + //@Override | |
43 | 44 | public int getCount() { |
44 | 45 | return mNumOfTabs; |
45 | 46 | } | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment1.java
1 | 1 | package com.example.app_10p5; |
2 | 2 | |
3 | +import android.app.Fragment; | |
3 | 4 | import android.os.Bundle; |
4 | -import android.support.v4.app.Fragment; | |
5 | 5 | import android.view.LayoutInflater; |
6 | +import android.view.Menu; | |
7 | +import android.view.MenuInflater; | |
8 | +import android.view.MenuItem; | |
6 | 9 | import android.view.View; |
7 | 10 | import android.view.ViewGroup; |
8 | 11 | |
... | ... | @@ -13,6 +16,20 @@ import android.view.ViewGroup; |
13 | 16 | public class TabFragment1 extends Fragment { |
14 | 17 | @Override |
15 | 18 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
19 | + setHasOptionsMenu(true); | |
16 | 20 | return inflater.inflate(R.layout.tab_fragment_1, container, false); |
17 | 21 | } |
22 | + | |
23 | + @Override | |
24 | + public boolean onOptionsItemSelected(MenuItem item) { | |
25 | + | |
26 | + return super.onOptionsItemSelected(item); | |
27 | + } | |
28 | + | |
29 | + @Override | |
30 | + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { | |
31 | + menu.clear(); | |
32 | + super.onCreateOptionsMenu(menu, inflater); | |
33 | + } | |
34 | + | |
18 | 35 | } |
19 | 36 | \ No newline at end of file | ... | ... |
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; | |
5 | 4 | import android.text.InputFilter; |
6 | 5 | import android.view.LayoutInflater; |
7 | 6 | import android.view.View; |
8 | 7 | import android.view.ViewGroup; |
9 | 8 | import android.widget.EditText; |
9 | +import android.app.Fragment; | |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Created by beaus on 24/04/2016. |
... | ... | @@ -16,6 +16,8 @@ public class TabFragment2 extends Fragment { |
16 | 16 | |
17 | 17 | @Override |
18 | 18 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
19 | + setHasOptionsMenu(true); | |
20 | + | |
19 | 21 | View v = inflater.inflate(R.layout.tab_fragment_2, container, false);; |
20 | 22 | |
21 | 23 | EditText et = (EditText) v.findViewById(R.id.commande_prix); | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment3.java
1 | 1 | package com.example.app_10p5; |
2 | 2 | |
3 | 3 | |
4 | +import android.app.Fragment; | |
4 | 5 | import android.os.Bundle; |
5 | -import android.support.v4.app.Fragment; | |
6 | 6 | import android.view.LayoutInflater; |
7 | 7 | import android.view.View; |
8 | 8 | import android.view.ViewGroup; |
... | ... | @@ -15,6 +15,7 @@ public class TabFragment3 extends Fragment { |
15 | 15 | |
16 | 16 | @Override |
17 | 17 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
18 | + setHasOptionsMenu(true); | |
18 | 19 | return inflater.inflate(R.layout.tab_fragment_3, container, false); |
19 | 20 | } |
20 | 21 | } | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment4.java
1 | 1 | package com.example.app_10p5; |
2 | 2 | |
3 | +import android.app.Fragment; | |
3 | 4 | import android.os.Bundle; |
4 | -import android.support.v4.app.Fragment; | |
5 | 5 | import android.view.LayoutInflater; |
6 | 6 | import android.view.View; |
7 | 7 | import android.view.ViewGroup; |
... | ... | @@ -13,6 +13,7 @@ import android.view.ViewGroup; |
13 | 13 | public class TabFragment4 extends Fragment { |
14 | 14 | @Override |
15 | 15 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
16 | + setHasOptionsMenu(true); | |
16 | 17 | return inflater.inflate(R.layout.tab_fragment_4, container, false); |
17 | 18 | } |
18 | 19 | } |
19 | 20 | \ No newline at end of file | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/TabFragment5.java
1 | 1 | package com.example.app_10p5; |
2 | 2 | |
3 | +import android.app.Fragment; | |
3 | 4 | import android.os.Bundle; |
4 | -import android.support.v4.app.Fragment; | |
5 | 5 | import android.view.LayoutInflater; |
6 | 6 | import android.view.View; |
7 | 7 | import android.view.ViewGroup; |
... | ... | @@ -13,6 +13,7 @@ import android.view.ViewGroup; |
13 | 13 | public class TabFragment5 extends Fragment { |
14 | 14 | @Override |
15 | 15 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
16 | + setHasOptionsMenu(true); | |
16 | 17 | return inflater.inflate(R.layout.tab_fragment_5, container, false); |
17 | 18 | } |
18 | 19 | } |
19 | 20 | \ No newline at end of file | ... | ... |
PremiereActivite/app/src/main/res/layout/layout_main.xml
... | ... | @@ -7,31 +7,25 @@ |
7 | 7 | tools:context=".MainActivite" |
8 | 8 | android:orientation="vertical"> |
9 | 9 | |
10 | - <android.support.v7.widget.Toolbar | |
10 | + <Toolbar | |
11 | 11 | android:id="@+id/toolbar" |
12 | 12 | android:layout_width="match_parent" |
13 | 13 | android:layout_height="wrap_content" |
14 | 14 | android:layout_alignParentTop="true" |
15 | - android:background="?attr/colorPrimary" | |
16 | 15 | android:elevation="6dp" |
17 | - android:minHeight="?attr/actionBarSize" | |
18 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
19 | - app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> | |
16 | + android:titleTextColor="@color/colorPrimary"/> | |
20 | 17 | |
21 | - <android.support.design.widget.TabLayout | |
18 | + <!--<android.TabLayout | |
22 | 19 | android:id="@+id/tab_layout" |
23 | 20 | android:layout_width="match_parent" |
24 | 21 | android:layout_height="wrap_content" |
25 | 22 | android:layout_below="@+id/toolbar" |
26 | - android:background="?attr/colorPrimary" | |
27 | - android:elevation="6dp" | |
28 | - android:minHeight="?attr/actionBarSize" | |
29 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> | |
23 | + android:elevation="6dp"/> | |
30 | 24 | |
31 | - <android.support.v4.view.ViewPager | |
25 | + <android.ViewPager | |
32 | 26 | android:id="@+id/pager" |
33 | 27 | android:layout_width="match_parent" |
34 | 28 | android:layout_height="fill_parent" |
35 | - android:layout_below="@id/tab_layout"/> | |
29 | + android:layout_below="@id/tab_layout"/>--> | |
36 | 30 | |
37 | 31 | </LinearLayout> |
38 | 32 | \ No newline at end of file | ... | ... |
PremiereActivite/app/src/main/res/layout/layout_vidange.xml
... | ... | @@ -17,8 +17,7 @@ |
17 | 17 | android:layout_gravity="center_horizontal" |
18 | 18 | android:layout_marginTop="40dp" |
19 | 19 | android:textAlignment="center" |
20 | - android:textSize="80sp" | |
21 | - android:textColor="@color/abc_input_method_navigation_guard" /> | |
20 | + android:textSize="80sp" /> | |
22 | 21 | |
23 | 22 | <Button |
24 | 23 | android:layout_width="wrap_content" | ... | ... |
... | ... | @@ -0,0 +1,7 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<menu xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + <item android:id="@+id/start_action" | |
4 | + android:title="dsklgjkdlg" /> | |
5 | + <item android:id="@+id/cancel_action" | |
6 | + android:title="lm" /> | |
7 | +</menu> | |
0 | 8 | \ No newline at end of file | ... | ... |
PremiereActivite/app/src/main/res/values-v21/styles.xml deleted
... | ... | @@ -1,9 +0,0 @@ |
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> |
PremiereActivite/app/src/main/res/values/colors.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <color name="colorPrimary">#3F51B5</color> | |
4 | - <color name="colorPrimaryDark">#303F9F</color> | |
5 | - <color name="colorAccent">#ff4081</color> | |
3 | + <color name="colorPrimary">#EE4230</color> | |
4 | + <color name="colorPrimaryDark">#AA2812</color> | |
5 | + <color name="colorAccent">#ff0000</color> | |
6 | 6 | </resources> | ... | ... |
PremiereActivite/app/src/main/res/values/strings.xml
PremiereActivite/app/src/main/res/values/styles.xml
1 | 1 | <resources> |
2 | 2 | |
3 | 3 | <!-- Base application theme. --> |
4 | - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
4 | + <style name="AppTheme" parent="@android:style/Theme.Holo.Light"> | |
5 | 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 | 6 | </style> |
10 | 7 | |
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 | 8 | </resources> | ... | ... |