diff --git a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/ObservateurPrefs.java b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/ObservateurPrefs.java new file mode 100644 index 0000000..9fc9a93 --- /dev/null +++ b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/ObservateurPrefs.java @@ -0,0 +1,2 @@ +package com.example.desoxyribonucleique;public class ObservateurPrefs { +} diff --git a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/SettingsActivity.java b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/SettingsActivity.java index d6b8e2c..989acc8 100644 --- a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/SettingsActivity.java +++ b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/java/com/example/desoxyribonucleique/SettingsActivity.java @@ -1,16 +1,33 @@ package com.example.desoxyribonucleique; import android.os.Bundle; -import android.preference.PreferenceActivity; -import android.view.Menu; -public class SettingsActivity extends PreferenceActivity { +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.preference.PreferenceFragmentCompat; + +public class SettingsActivity extends AppCompatActivity { @Override - public void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - this.addPreferencesFromResource(R.xml.preferences); + setContentView(R.layout.settings_activity); + if (savedInstanceState == null) { + getSupportFragmentManager() + .beginTransaction() + .replace(R.id.settings, new SettingsFragment()) + .commit(); + } + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } } - -} + public static class SettingsFragment extends PreferenceFragmentCompat { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.root_preferences, rootKey); + } + } +} \ No newline at end of file diff --git a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/layout/settings_activity.xml b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/layout/settings_activity.xml new file mode 100644 index 0000000..de6591a --- /dev/null +++ b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/layout/settings_activity.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/values/arrays.xml b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/values/arrays.xml new file mode 100644 index 0000000..6cf9ed4 --- /dev/null +++ b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/values/arrays.xml @@ -0,0 +1,12 @@ + + + + Reply + Reply to all + + + + reply + reply_all + + \ No newline at end of file diff --git a/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/xml/root_preferences.xml b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/xml/root_preferences.xml new file mode 100644 index 0000000..67158db --- /dev/null +++ b/DEV-4.5/TP06/Desoxyribonucleique/app/src/main/res/xml/root_preferences.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file