mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
ビルドできないので一旦コメントアウト
This commit is contained in:
parent
49cc132f14
commit
2188e55c5f
|
@ -1,111 +1,111 @@
|
||||||
package one.nem.lacerta.feature.debug;
|
//package one.nem.lacerta.feature.debug;
|
||||||
|
//
|
||||||
import android.os.Bundle;
|
//import android.os.Bundle;
|
||||||
|
//
|
||||||
import androidx.fragment.app.Fragment;
|
//import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
//import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
//
|
||||||
import android.util.Log;
|
//import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
//import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
//import android.view.View;
|
||||||
import android.view.ViewGroup;
|
//import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
//import android.widget.EditText;
|
||||||
import android.widget.RadioGroup;
|
//import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
//import android.widget.TextView;
|
||||||
|
//
|
||||||
import org.w3c.dom.Text;
|
//import org.w3c.dom.Text;
|
||||||
|
//
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
|
//import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
|
||||||
|
//
|
||||||
import one.nem.lacerta.data.repository.SharedPref;
|
//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;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* A simple {@link Fragment} subclass.
|
// * A simple {@link Fragment} subclass.
|
||||||
* Use the {@link DebugSharedPrefEditorFragment#newInstance} factory method to
|
// * Use the {@link DebugSharedPrefEditorFragment#newInstance} factory method to
|
||||||
* create an instance of this fragment.
|
// * create an instance of this fragment.
|
||||||
*/
|
// */
|
||||||
@AndroidEntryPoint
|
//@AndroidEntryPoint
|
||||||
public class DebugSharedPrefEditorFragment extends Fragment {
|
//public class DebugSharedPrefEditorFragment extends Fragment {
|
||||||
|
//
|
||||||
@Inject
|
// @Inject
|
||||||
SharedPref sharedPref;
|
// SharedPref sharedPref;
|
||||||
|
//
|
||||||
SharedPrefType sharedPrefType = null;
|
// SharedPrefType sharedPrefType = null;
|
||||||
|
//
|
||||||
public DebugSharedPrefEditorFragment() {
|
// public DebugSharedPrefEditorFragment() {
|
||||||
// Required empty public constructor
|
// // Required empty public constructor
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static DebugSharedPrefEditorFragment newInstance() {
|
// public static DebugSharedPrefEditorFragment newInstance() {
|
||||||
DebugSharedPrefEditorFragment fragment = new DebugSharedPrefEditorFragment();
|
// DebugSharedPrefEditorFragment fragment = new DebugSharedPrefEditorFragment();
|
||||||
Bundle args = new Bundle();
|
// Bundle args = new Bundle();
|
||||||
fragment.setArguments(args);
|
// fragment.setArguments(args);
|
||||||
return fragment;
|
// return fragment;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
// public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
// super.onCreate(savedInstanceState);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
// Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// // Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_debug_shared_pref_editor, container, false);
|
// return inflater.inflate(R.layout.fragment_debug_shared_pref_editor, container, false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
// public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
// super.onViewCreated(view, savedInstanceState);
|
||||||
|
//
|
||||||
EditText loadKeyEditText = view.findViewById(R.id.loadKeyEditText);
|
// EditText loadKeyEditText = view.findViewById(R.id.loadKeyEditText);
|
||||||
EditText saveKeyEditText = view.findViewById(R.id.saveKeyEditText);
|
// EditText saveKeyEditText = view.findViewById(R.id.saveKeyEditText);
|
||||||
|
//
|
||||||
TextView prefItemTextView = view.findViewById(R.id.prefItemTextView);
|
// TextView prefItemTextView = view.findViewById(R.id.prefItemTextView);
|
||||||
|
//
|
||||||
view.findViewById(R.id.loadButton).setOnClickListener(v -> {
|
// view.findViewById(R.id.loadButton).setOnClickListener(v -> {
|
||||||
String value = sharedPref.getSharedPreferencesByTag(sharedPrefType).getString(loadKeyEditText.getText().toString(), "null");
|
// String value = sharedPref.getSharedPreferencesByTag(sharedPrefType).getString(loadKeyEditText.getText().toString(), "null");
|
||||||
((TextView) view.findViewById(R.id.loadValueTextView)).setText(value);
|
// ((TextView) view.findViewById(R.id.loadValueTextView)).setText(value);
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
view.findViewById(R.id.saveButton).setOnClickListener(v -> {
|
// view.findViewById(R.id.saveButton).setOnClickListener(v -> {
|
||||||
String[] split = saveKeyEditText.getText().toString().split(":");
|
// String[] split = saveKeyEditText.getText().toString().split(":");
|
||||||
sharedPref.getSharedPreferencesByTag(sharedPrefType).edit().putString(split[0], split[1]).apply();
|
// sharedPref.getSharedPreferencesByTag(sharedPrefType).edit().putString(split[0], split[1]).apply();
|
||||||
updateList(prefItemTextView);
|
// updateList(prefItemTextView);
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
// ラジオボタンの変更を監視
|
// // ラジオボタンの変更を監視
|
||||||
((RadioGroup) view.findViewById(R.id.radioGroupPrefType)).setOnCheckedChangeListener((group, checkedId) -> {
|
// ((RadioGroup) view.findViewById(R.id.radioGroupPrefType)).setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
if (checkedId == R.id.radioButtonCommon) {
|
// if (checkedId == R.id.radioButtonCommon) {
|
||||||
sharedPrefType = SharedPrefType.COMMON;
|
// sharedPrefType = SharedPrefType.COMMON;
|
||||||
updateList(prefItemTextView);
|
// updateList(prefItemTextView);
|
||||||
} else if (checkedId == R.id.radioButtonUserData) {
|
// } else if (checkedId == R.id.radioButtonUserData) {
|
||||||
sharedPrefType = SharedPrefType.USERDATA;
|
// sharedPrefType = SharedPrefType.USERDATA;
|
||||||
updateList(prefItemTextView);
|
// updateList(prefItemTextView);
|
||||||
} else {
|
// } else {
|
||||||
Log.e("DebugSharedPrefEditorFragment", "radioButtonのIDが不正です");
|
// Log.e("DebugSharedPrefEditorFragment", "radioButtonのIDが不正です");
|
||||||
}
|
// }
|
||||||
updateList(prefItemTextView);
|
// updateList(prefItemTextView);
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void updateList(TextView textView) {
|
// public void updateList(TextView textView) {
|
||||||
// リストの更新
|
// // リストの更新
|
||||||
Map<String, ?> resultMap = sharedPref.getSharedPreferencesByTag(sharedPrefType).getAll();
|
// Map<String, ?> resultMap = sharedPref.getSharedPreferencesByTag(sharedPrefType).getAll();
|
||||||
StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
for (Map.Entry<String, ?> entry : resultMap.entrySet()) {
|
// for (Map.Entry<String, ?> entry : resultMap.entrySet()) {
|
||||||
sb.append(entry.getKey()).append(":").append(entry.getValue().toString()).append("\n");
|
// sb.append(entry.getKey()).append(":").append(entry.getValue().toString()).append("\n");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
textView.setText(sb.toString());
|
// textView.setText(sb.toString());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
Loading…
Reference in New Issue
Block a user