diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-08-12 20:43:51 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-08-12 20:43:51 -0600 |
commit | d9dfccfc6a8ba167ba38efdf83368e790f35a636 (patch) | |
tree | 991b63d78c81632d3844334b0db0b53ebbf3e232 /app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings | |
parent | fb51cefd42871cc470253edbe9616706bfbd2361 (diff) | |
download | wiimmfi-watcher-dev.tar wiimmfi-watcher-dev.tar.gz wiimmfi-watcher-dev.tar.bz2 |
i have no idea what im doing actuallydev
Diffstat (limited to 'app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings')
-rw-r--r-- | app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java | 14 | ||||
-rw-r--r-- | app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java | 33 |
2 files changed, 43 insertions, 4 deletions
diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java index 076d6c0..2ecec14 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsActivity.java @@ -2,17 +2,25 @@ package me.brysonsteck.wiimmfiwatcher.settings; import android.os.Bundle; import android.preference.PreferenceFragment; +import android.view.View; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.PreferenceFragmentCompat; import me.brysonsteck.wiimmfiwatcher.R; +import me.brysonsteck.wiimmfiwatcher.fragments.WatchCodeFragment; -public class SettingsActivity extends PreferenceFragmentCompat { +public class SettingsActivity extends AppCompatActivity { @Override - public void onCreatePreferences(Bundle savedInstanceState, String rootkey) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setPreferencesFromResource(R.xml.preferences, rootkey); + setContentView(R.layout.activity_settings); + if (savedInstanceState != null) { + getSupportFragmentManager().beginTransaction() + .replace(R.id.settings_fragment_view, new SettingsMainFragment(), null) + .setReorderingAllowed(true) + .commit(); + } } } diff --git a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java index 6f9414f..883316d 100644 --- a/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java +++ b/app/src/main/java/me/brysonsteck/wiimmfiwatcher/settings/SettingsMainFragment.java @@ -1,6 +1,37 @@ package me.brysonsteck.wiimmfiwatcher.settings; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; + +import me.brysonsteck.wiimmfiwatcher.R; + +public class SettingsMainFragment extends PreferenceFragmentCompat { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootkey) { + super.onCreate(savedInstanceState); + setPreferencesFromResource(R.xml.preferences, rootkey); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + ListPreference mListPreference = (ListPreference) getPreferenceManager().findPreference("preference_key"); + mListPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + // your code here + return true; + } + }); -public class SettingsMainFragment extends Fragment { + return inflater.inflate(R.layout.main_settings_fragment, container, false); + } } |