mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
挙動実装
This commit is contained in:
parent
386877e91e
commit
f6b57a4b09
|
@ -11,8 +11,11 @@ import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
|
||||||
import one.nem.lacerta.source.pref.repository.Common; //TODO-rca: 名前変えるべきかも
|
import one.nem.lacerta.source.pref.repository.Common; //TODO-rca: 名前変えるべきかも
|
||||||
|
|
||||||
|
import one.nem.lacerta.data.repository.SharedPref;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
@ -28,6 +31,11 @@ public class DebugSharedPrefEditorFragment extends Fragment {
|
||||||
@Inject
|
@Inject
|
||||||
Common prefCommon;
|
Common prefCommon;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPref sharedPref;
|
||||||
|
|
||||||
|
SharedPrefType sharedPrefType = SharedPrefType.COMMON;
|
||||||
|
|
||||||
public DebugSharedPrefEditorFragment() {
|
public DebugSharedPrefEditorFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
@ -60,18 +68,21 @@ public class DebugSharedPrefEditorFragment extends Fragment {
|
||||||
EditText saveKeyEditText = view.findViewById(R.id.saveKeyEditText);
|
EditText saveKeyEditText = view.findViewById(R.id.saveKeyEditText);
|
||||||
|
|
||||||
view.findViewById(R.id.loadButton).setOnClickListener(v -> {
|
view.findViewById(R.id.loadButton).setOnClickListener(v -> {
|
||||||
String key = loadKeyEditText.getText().toString();
|
String value = sharedPref.getSharedPreferencesByTag(sharedPrefType).getString(loadKeyEditText.getText().toString(), "null");
|
||||||
String value = prefCommon.getStringValue(key);
|
((TextView) view.findViewById(R.id.loadValueTextView)).setText(value);
|
||||||
Log.d("loadButton", "key:" + key + " value:" + value);
|
|
||||||
TextView loadValueTextView = view.findViewById(R.id.loadValueTextView);
|
|
||||||
loadValueTextView.setText(value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
view.findViewById(R.id.saveButton).setOnClickListener(v -> {
|
view.findViewById(R.id.saveButton).setOnClickListener(v -> {
|
||||||
String KeyValue = saveKeyEditText.getText().toString();
|
String[] split = saveKeyEditText.getText().toString().split(":");
|
||||||
String[] split = KeyValue.split(":", 2);
|
sharedPref.getSharedPreferencesByTag(sharedPrefType).edit().putString(split[0], split[1]).apply();
|
||||||
Log.d("saveButton", "split[0]:" + split[0] + " split[1]:" + split[1]);
|
});
|
||||||
prefCommon.setStringValue(split[0], split[1]);
|
|
||||||
|
// ラジオボタンの変更を監視
|
||||||
|
view.findViewById(R.id.radioButtonCommon).setOnClickListener(v -> {
|
||||||
|
sharedPrefType = SharedPrefType.COMMON;
|
||||||
|
});
|
||||||
|
view.findViewById(R.id.radioButtonUserData).setOnClickListener(v -> {
|
||||||
|
sharedPrefType = SharedPrefType.USERDATA;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user