Skip to content

Commit 4664378

Browse files
author
Vincent Timofti
committed
maj composition
1 parent c054405 commit 4664378

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed

project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=Google Inc.:Google APIs:22
14+
target=android-17

res/layout/composition_layout2.xml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
android:layout_width="fill_parent"
44
android:layout_height="match_parent"
55
android:orientation="vertical"
6-
android:gravity="center_horizontal" >
6+
android:gravity="center" >
77

88
<TextView
99
android:id="@+id/choix_garniture"
@@ -15,7 +15,8 @@
1515

1616
<LinearLayout
1717
android:layout_width="match_parent"
18-
android:layout_height="fill_parent" >
18+
android:layout_height="wrap_content"
19+
android:gravity="center">
1920

2021
<GridLayout
2122
android:layout_width="wrap_content"
@@ -26,7 +27,7 @@
2627
<ToggleButton
2728
android:id="@+id/buttonJambon"
2829
android:layout_column="1"
29-
android:layout_gravity="right"
30+
android:width = "100dp"
3031
android:layout_row="1"
3132
android:textOn="@string/jambon"
3233
android:textOff="@string/jambon" />
@@ -41,6 +42,7 @@
4142

4243
<ToggleButton
4344
android:id="@+id/viande1"
45+
android:width = "100dp"
4446
android:layout_width="match_parent"
4547
android:layout_column="0"
4648
android:layout_gravity="center"
@@ -50,13 +52,15 @@
5052

5153
<ToggleButton
5254
android:id="@+id/toggleButton4"
55+
android:width = "100dp"
5356
android:layout_column="2"
5457
android:layout_gravity="right"
5558
android:layout_row="1"
5659
android:text="ToggleButton" />
5760

5861
<ToggleButton
5962
android:id="@+id/toggleButton3"
63+
android:width = "100dp"
6064
android:layout_column="0"
6165
android:layout_gravity="left"
6266
android:layout_row="2"
@@ -65,6 +69,7 @@
6569

6670
<ToggleButton
6771
android:id="@+id/toggleButton2"
72+
android:width = "100dp"
6873
android:layout_column="1"
6974
android:layout_gravity="left"
7075
android:layout_row="2"
@@ -82,6 +87,7 @@
8287

8388
<ToggleButton
8489
android:id="@+id/toggleButton9"
90+
android:width = "100dp"
8591
android:layout_column="3"
8692
android:layout_gravity="left"
8793
android:layout_row="1"
@@ -98,6 +104,7 @@
98104

99105
<ToggleButton
100106
android:id="@+id/buttonChevre"
107+
android:width = "100dp"
101108
android:layout_column="1"
102109
android:layout_gravity="left"
103110
android:layout_row="4"
@@ -106,6 +113,7 @@
106113

107114
<ToggleButton
108115
android:id="@+id/buttonEmmental"
116+
android:width = "100dp"
109117
android:layout_column="0"
110118
android:layout_gravity="left"
111119
android:layout_row="5"
@@ -130,4 +138,23 @@
130138
android:text="TextView" />
131139
</LinearLayout>
132140

141+
<LinearLayout
142+
android:layout_width="match_parent"
143+
android:layout_height="wrap_content"
144+
android:gravity="center" >
145+
146+
<Button
147+
android:id="@+id/buttonRevenirBase"
148+
android:layout_width="wrap_content"
149+
android:layout_height="wrap_content"
150+
android:text="@string/bouton_revenir_base" />
151+
152+
<Button
153+
android:id="@+id/button2"
154+
android:layout_width="wrap_content"
155+
android:layout_height="wrap_content"
156+
android:text="@string/bouton_confirmer" />
157+
158+
</LinearLayout>
159+
133160
</LinearLayout>

res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
<string name="mozzarella">Mozzarella</string>
2424
<string name="emmental">Emmental</string>
2525
<string name="chevre">Chèvre</string>
26+
<string name="bouton_confirmer">Commander la pizza &gt;</string>
27+
<string name="bouton_revenir_base">&lt; Changer la base</string>
2628

2729
</resources>

src/infsi351/Restauration/FragmentComposition2.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.view.LayoutInflater;
66
import android.view.View;
77
import android.view.ViewGroup;
8+
import android.widget.Button;
89
import android.widget.TextView;
910

1011
public class FragmentComposition2 extends Fragment {
@@ -24,8 +25,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
2425
Bundle savedInstanceState) {
2526

2627
View view = inflater.inflate(R.layout.composition_layout2, container, false);
27-
// TextView textView = (TextView) view.findViewById(R.id.textView1);
28-
// textView.setText(base);
28+
29+
final Button button_retour = (Button) view.findViewById(R.id.buttonRevenirBase);
30+
button_retour.setOnClickListener(new View.OnClickListener() {
31+
public void onClick(View v) {
32+
((MainActivity) getActivity()).backToComposition1();
33+
}
34+
});
2935

3036
return view;
3137
}

src/infsi351/Restauration/MainActivity.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ public void switchToComposition2(String base) {
107107
fragmentTransaction.commit();
108108

109109
}
110+
111+
public void backToComposition1()
112+
{
113+
Fragment fragment = new FragmentComposition1();
114+
115+
android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
116+
fragmentTransaction.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right);
117+
fragmentTransaction.replace(R.id.container, fragment);
118+
fragmentTransaction.commit();
119+
120+
}
110121

111122

112123
}

0 commit comments

Comments
 (0)