mirror of
https://github.com/kmitresse/Master-TI-2.git
synced 2026-05-13 17:11:53 +00:00
[Feat] Part 1 - Activation intentionnelle explicite
This commit is contained in:
@@ -7,16 +7,45 @@ import android.os.Bundle;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import fr.univpau.intention.listeners.NextButtonListener;
|
||||||
|
|
||||||
public class A1 extends AppCompatActivity {
|
public class A1 extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_all);
|
setContentView(R.layout.activity_all);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
Button button = findViewById(R.id.button);
|
Button button = findViewById(R.id.button);
|
||||||
button.setOnClickListener(v -> {
|
button.setOnClickListener( new NextButtonListener(this, A2.class));
|
||||||
// Start the activity A2
|
}
|
||||||
startActivity(new Intent(this, A2.class));
|
|
||||||
});
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,45 @@ import android.os.Bundle;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import fr.univpau.intention.listeners.NextButtonListener;
|
||||||
|
|
||||||
public class A2 extends AppCompatActivity {
|
public class A2 extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_all);
|
setContentView(R.layout.activity_all);
|
||||||
Button button = findViewById(R.id.button);
|
|
||||||
button.setOnClickListener(v -> {
|
|
||||||
// Start the activity A2
|
|
||||||
startActivity(new Intent(this, A3.class));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener( new NextButtonListener(this, A3.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,44 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import fr.univpau.intention.listeners.NextButtonListener;
|
||||||
|
|
||||||
public class A3 extends AppCompatActivity {
|
public class A3 extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_all);
|
setContentView(R.layout.activity_all);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
Button button = findViewById(R.id.button);
|
Button button = findViewById(R.id.button);
|
||||||
button.setOnClickListener(v -> {
|
button.setOnClickListener( new NextButtonListener(this, A4.class));
|
||||||
// Start the activity A2
|
}
|
||||||
startActivity(new Intent(this, A4.class));
|
|
||||||
});
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,45 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import fr.univpau.intention.listeners.NextButtonListener;
|
||||||
|
|
||||||
public class A4 extends AppCompatActivity {
|
public class A4 extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_all);
|
setContentView(R.layout.activity_all);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
Button button = findViewById(R.id.button);
|
Button button = findViewById(R.id.button);
|
||||||
button.setOnClickListener(v -> {
|
button.setOnClickListener( new NextButtonListener(this, A5.class));
|
||||||
// Start the activity A2
|
}
|
||||||
startActivity(new Intent(this, A5.class));
|
|
||||||
});
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
Button button = findViewById(R.id.button);
|
||||||
|
button.setOnClickListener(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package fr.univpau.intention.listeners;
|
||||||
|
|
||||||
|
import static androidx.core.content.ContextCompat.startActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class NextButtonListener implements View.OnClickListener {
|
||||||
|
|
||||||
|
Context context;
|
||||||
|
Class<?> nextActivity;
|
||||||
|
|
||||||
|
public NextButtonListener(Context context, Class<?> nextActivity) {
|
||||||
|
this.context = context;
|
||||||
|
this.nextActivity = nextActivity;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent i = new Intent();
|
||||||
|
i.setClass(context, nextActivity);
|
||||||
|
context.startActivity(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".A1">
|
tools:context=".A2">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -18,6 +18,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/button"
|
android:id="@+id/button"
|
||||||
android:text="@string/next"/>
|
android:text="@string/next"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/editTextcontent"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user