Commit 0aec73b6dbe086d26bb519032cca47feea153ca5

Authored by JLo'w
1 parent ae04d14f

Petit changement dans les ressources et le style

PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
@@ -2,9 +2,13 @@ package com.example.app_10p5; @@ -2,9 +2,13 @@ package com.example.app_10p5;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.content.Intent; 4 import android.content.Intent;
  5 +import android.graphics.drawable.ColorDrawable;
5 import android.os.Bundle; 6 import android.os.Bundle;
6 import android.support.design.widget.TabLayout; 7 import android.support.design.widget.TabLayout;
7 import android.support.v4.view.ViewPager; 8 import android.support.v4.view.ViewPager;
  9 +import android.view.Menu;
  10 +import android.view.MenuInflater;
  11 +import android.view.MenuItem;
8 import android.view.View; 12 import android.view.View;
9 import android.widget.EditText; 13 import android.widget.EditText;
10 import android.widget.Toast; 14 import android.widget.Toast;
@@ -43,6 +47,8 @@ public class MainActivite extends Activity implements ASyncResponse { @@ -43,6 +47,8 @@ public class MainActivite extends Activity implements ASyncResponse {
43 mTimeToken = -1; 47 mTimeToken = -1;
44 mToken = ""; 48 mToken = "";
45 49
  50 + getActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
  51 +
46 TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); 52 TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
47 tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); 53 tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
48 tabLayout.addTab(tabLayout.newTab().setText("Connexion")); 54 tabLayout.addTab(tabLayout.newTab().setText("Connexion"));
@@ -82,6 +88,19 @@ public class MainActivite extends Activity implements ASyncResponse { @@ -82,6 +88,19 @@ public class MainActivite extends Activity implements ASyncResponse {
82 } 88 }
83 89
84 @Override 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 public void onSaveInstanceState(Bundle savedInstanceState){ 104 public void onSaveInstanceState(Bundle savedInstanceState){
86 savedInstanceState.putString("token", mToken); 105 savedInstanceState.putString("token", mToken);
87 savedInstanceState.putInt("state", mState); 106 savedInstanceState.putInt("state", mState);
PremiereActivite/app/src/main/res/layout/layout_main.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
4 - xmlns:app="http://schemas.android.com/apk/res-auto"  
5 android:layout_width="match_parent" 4 android:layout_width="match_parent"
6 android:layout_height="match_parent" 5 android:layout_height="match_parent"
7 tools:context=".MainActivite" 6 tools:context=".MainActivite"
8 android:orientation="vertical"> 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 <android.support.design.widget.TabLayout 9 <android.support.design.widget.TabLayout
22 android:id="@+id/tab_layout" 10 android:id="@+id/tab_layout"
23 android:layout_width="match_parent" 11 android:layout_width="match_parent"
24 android:layout_height="wrap_content" 12 android:layout_height="wrap_content"
25 - android:layout_below="@+id/toolbar"  
26 android:background="?attr/colorPrimary" 13 android:background="?attr/colorPrimary"
27 android:elevation="6dp" 14 android:elevation="6dp"
28 - android:minHeight="?attr/actionBarSize"  
29 - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 15 + android:minHeight="75dp"/>
30 16
31 <android.support.v4.view.ViewPager 17 <android.support.v4.view.ViewPager
32 android:id="@+id/pager" 18 android:id="@+id/pager"
33 android:layout_width="match_parent" 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 </LinearLayout> 22 </LinearLayout>
38 \ No newline at end of file 23 \ No newline at end of file
PremiereActivite/app/src/main/res/menu/menu.xml 0 → 100644
@@ -0,0 +1,24 @@ @@ -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 \ No newline at end of file 25 \ No newline at end of file
PremiereActivite/app/src/main/res/values-v21/styles.xml deleted
@@ -1,9 +0,0 @@ @@ -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 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 - <color name="colorPrimary">#3F51B5</color> 3 + <color name="colorPrimary">#EE4242</color>
4 <color name="colorPrimaryDark">#303F9F</color> 4 <color name="colorPrimaryDark">#303F9F</color>
5 <color name="colorAccent">#ff4081</color> 5 <color name="colorAccent">#ff4081</color>
6 </resources> 6 </resources>
PremiereActivite/app/src/main/res/values/strings.xml
@@ -9,5 +9,7 @@ @@ -9,5 +9,7 @@
9 <string name="prix">Prix</string> 9 <string name="prix">Prix</string>
10 <string name="vidange">Vidange</string> 10 <string name="vidange">Vidange</string>
11 <string name="passCarte">Passez la carte du client</string> 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 </resources> 15 </resources>
PremiereActivite/app/src/main/res/values/styles.xml
1 <resources> 1 <resources>
2 2
3 <!-- Base application theme. --> 3 <!-- Base application theme. -->
4 - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 4 + <style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
5 <!-- Customize your theme here. --> 5 <!-- Customize your theme here. -->
6 <item name="colorPrimary">@color/colorPrimary</item> 6 <item name="colorPrimary">@color/colorPrimary</item>
7 <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 7 <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8 <item name="colorAccent">@color/colorAccent</item> 8 <item name="colorAccent">@color/colorAccent</item>
9 </style> 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 </resources> 11 </resources>