Commit 0aec73b6dbe086d26bb519032cca47feea153ca5
1 parent
ae04d14f
Petit changement dans les ressources et le style
Showing
7 changed files
with
49 additions
and
37 deletions
Show diff stats
PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
... | ... | @@ -2,9 +2,13 @@ package com.example.app_10p5; |
2 | 2 | |
3 | 3 | import android.app.Activity; |
4 | 4 | import android.content.Intent; |
5 | +import android.graphics.drawable.ColorDrawable; | |
5 | 6 | import android.os.Bundle; |
6 | 7 | import android.support.design.widget.TabLayout; |
7 | 8 | import android.support.v4.view.ViewPager; |
9 | +import android.view.Menu; | |
10 | +import android.view.MenuInflater; | |
11 | +import android.view.MenuItem; | |
8 | 12 | import android.view.View; |
9 | 13 | import android.widget.EditText; |
10 | 14 | import android.widget.Toast; |
... | ... | @@ -43,6 +47,8 @@ public class MainActivite extends Activity implements ASyncResponse { |
43 | 47 | mTimeToken = -1; |
44 | 48 | mToken = ""; |
45 | 49 | |
50 | + getActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary))); | |
51 | + | |
46 | 52 | TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); |
47 | 53 | tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); |
48 | 54 | tabLayout.addTab(tabLayout.newTab().setText("Connexion")); |
... | ... | @@ -82,6 +88,19 @@ public class MainActivite extends Activity implements ASyncResponse { |
82 | 88 | } |
83 | 89 | |
84 | 90 | @Override |
91 | + public boolean onCreateOptionsMenu(Menu menu) { | |
92 | + MenuInflater inflater = getMenuInflater(); | |
93 | + inflater.inflate(R.menu.menu, menu); | |
94 | + return true; | |
95 | + } | |
96 | + | |
97 | + @Override | |
98 | + public boolean onOptionsItemSelected(MenuItem item) { | |
99 | + // Handle item selection | |
100 | + return super.onOptionsItemSelected(item); | |
101 | + } | |
102 | + | |
103 | + @Override | |
85 | 104 | public void onSaveInstanceState(Bundle savedInstanceState){ |
86 | 105 | savedInstanceState.putString("token", mToken); |
87 | 106 | savedInstanceState.putInt("state", mState); | ... | ... |
PremiereActivite/app/src/main/res/layout/layout_main.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | - xmlns:app="http://schemas.android.com/apk/res-auto" | |
5 | 4 | android:layout_width="match_parent" |
6 | 5 | android:layout_height="match_parent" |
7 | 6 | tools:context=".MainActivite" |
8 | 7 | android:orientation="vertical"> |
9 | 8 | |
10 | - <android.support.v7.widget.Toolbar | |
11 | - android:id="@+id/toolbar" | |
12 | - android:layout_width="match_parent" | |
13 | - android:layout_height="wrap_content" | |
14 | - android:layout_alignParentTop="true" | |
15 | - android:background="?attr/colorPrimary" | |
16 | - android:elevation="6dp" | |
17 | - android:minHeight="?attr/actionBarSize" | |
18 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
19 | - app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> | |
20 | - | |
21 | 9 | <android.support.design.widget.TabLayout |
22 | 10 | android:id="@+id/tab_layout" |
23 | 11 | android:layout_width="match_parent" |
24 | 12 | android:layout_height="wrap_content" |
25 | - android:layout_below="@+id/toolbar" | |
26 | 13 | android:background="?attr/colorPrimary" |
27 | 14 | android:elevation="6dp" |
28 | - android:minHeight="?attr/actionBarSize" | |
29 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> | |
15 | + android:minHeight="75dp"/> | |
30 | 16 | |
31 | 17 | <android.support.v4.view.ViewPager |
32 | 18 | android:id="@+id/pager" |
33 | 19 | android:layout_width="match_parent" |
34 | - android:layout_height="fill_parent" | |
35 | - android:layout_below="@id/tab_layout"/> | |
20 | + android:layout_height="fill_parent" /> | |
36 | 21 | |
37 | 22 | </LinearLayout> |
38 | 23 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +<menu xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | |
3 | + | |
4 | + <item | |
5 | + android:id="@+id/action_save" | |
6 | + android:icon="@android:drawable/ic_menu_upload" | |
7 | + android:title="@string/connect" | |
8 | + android:showAsAction="ifRoom|withText" | |
9 | + app:showAsAction="ifRoom|withText" /> | |
10 | + | |
11 | + <item | |
12 | + android:id="@+id/action_delete" | |
13 | + android:icon="@android:drawable/ic_menu_delete" | |
14 | + android:title="@string/disconnect" | |
15 | + android:showAsAction="ifRoom|withText" | |
16 | + app:showAsAction="ifRoom|withText" /> | |
17 | + | |
18 | + <item | |
19 | + android:id="@+id/action_settings" | |
20 | + android:title="@string/action_settings" | |
21 | + android:showAsAction="never" | |
22 | + app:showAsAction="never" /> | |
23 | + | |
24 | +</menu> | |
0 | 25 | \ 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
PremiereActivite/app/src/main/res/values/strings.xml
... | ... | @@ -9,5 +9,7 @@ |
9 | 9 | <string name="prix">Prix</string> |
10 | 10 | <string name="vidange">Vidange</string> |
11 | 11 | <string name="passCarte">Passez la carte du client</string> |
12 | + <string name="disconnect">Déconnexion</string> | |
13 | + <string name="connect">Connexion</string> | |
12 | 14 | |
13 | 15 | </resources> | ... | ... |
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:Theme.Material.Light.DarkActionBar"> | |
5 | 5 | <!-- Customize your theme here. --> |
6 | 6 | <item name="colorPrimary">@color/colorPrimary</item> |
7 | 7 | <item name="colorPrimaryDark">@color/colorPrimaryDark</item> |
8 | 8 | <item name="colorAccent">@color/colorAccent</item> |
9 | 9 | </style> |
10 | 10 | |
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 | 11 | </resources> | ... | ... |