From e5bfd5142bd1cf48a0a98817c5ff8f991009e068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Tue, 12 Dec 2023 11:47:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DebugRepositoryDebuggerFragment.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugRepositoryDebuggerFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugRepositoryDebuggerFragment.java index e5e6f478..98842ff7 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugRepositoryDebuggerFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugRepositoryDebuggerFragment.java @@ -7,14 +7,31 @@ import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.Toast; + +import org.intellij.lang.annotations.JdkConstants; + +import java.util.UUID; + +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; + +import one.nem.lacerta.data.repository.DebugFunc; /** * A simple {@link Fragment} subclass. * Use the {@link DebugRepositoryDebuggerFragment#newInstance} factory method to * create an instance of this fragment. */ + +@AndroidEntryPoint public class DebugRepositoryDebuggerFragment extends Fragment { + @Inject + DebugFunc debugFunc; + public DebugRepositoryDebuggerFragment() { // Required empty public constructor } @@ -42,6 +59,17 @@ public class DebugRepositoryDebuggerFragment extends Fragment { public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + EditText editTextRepoId = view.findViewById(R.id.editTextRepoId); + view.findViewById(R.id.buttonGenerateRepoId).setOnClickListener(v -> { + editTextRepoId.setText(UUID.randomUUID().toString()); //Generate random UUID + Toast.makeText(getContext(), "Generated random UUID", Toast.LENGTH_SHORT).show(); + }); + + view.findViewById(R.id.buttonGetCreateRepository).setOnClickListener(v -> { + String repoId = editTextRepoId.getText().toString(); + Repository repo = debugFunc.getOrCreateRepositoryById(repoId); + Toast.makeText(getContext(), "Get or create repository: " + repoId, Toast.LENGTH_SHORT).show(); + } } } \ No newline at end of file