1 package net.osdn.gokigen.cameratest.fuji.preference;
3 import android.content.Context;
4 import android.os.Bundle;
6 import androidx.annotation.NonNull;
7 import androidx.preference.ListPreference;
8 import androidx.preference.Preference;
9 import androidx.preference.PreferenceFragmentCompat;
11 import net.osdn.gokigen.cameratest.IApplicationControl;
12 import net.osdn.gokigen.cameratest.R;
14 public class FujiPreferenceFragment extends PreferenceFragmentCompat
16 private PowerOffController powerOffController = null;
22 public static FujiPreferenceFragment newInstance(@NonNull Context context, @NonNull IApplicationControl control)
24 FujiPreferenceFragment instance = new FujiPreferenceFragment();
25 instance.prepare(context, control);
27 // パラメータはBundleにまとめておく
28 Bundle arguments = new Bundle();
29 //arguments.putString("title", title);
30 //arguments.putString("message", message);
31 instance.setArguments(arguments);
36 private void prepare(@NonNull Context context, @NonNull IApplicationControl control)
38 powerOffController = new PowerOffController(context, control);
42 public void onCreatePreferences(Bundle savedInstanceState, String rootKey)
44 setPreferencesFromResource(R.xml.preferences_fuji_x, rootKey);
46 ListPreference connectionMethod = (ListPreference) findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
47 connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
49 public boolean onPreferenceChange(Preference preference, Object newValue) {
50 preference.setSummary(newValue + " ");
54 connectionMethod.setSummary(connectionMethod.getValue() + " ");
56 findPreference("exit_application").setOnPreferenceClickListener(powerOffController);