diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditFragment.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditFragment.java index ae72fc6..1641c7f 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditFragment.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditFragment.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.EditText; import android.widget.TextView; @@ -20,6 +21,8 @@ import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; +import java.util.ArrayList; + public class EditFragment extends Fragment { private EditViewModel editViewModel; @@ -43,6 +46,11 @@ return root; } + //----------------------------------------------------------------- + + //----------------------------------------------------------------- + + @Override public void onDestroyView() { super.onDestroyView(); @@ -52,12 +60,22 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Button appButton = view.findViewById(R.id.Paint_button); - appButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(getActivity(), PaintActivity.class); - startActivity(intent); - } + appButton.setOnClickListener(v -> { + Acanthus acanthus = (Acanthus) getActivity().getApplication(); + Integer uid = acanthus.getPreferenceUid(); + String name = ((EditText)view.findViewById(R.id.AnimationName)).getText().toString(); + String token = acanthus.getPreferenceToken(); + Integer aid = editViewModel.startWorkEdit(uid, name, token); + acanthus.setAid(aid); + transitionPaintActivity(); }); } + + //----------------------------------------------------------------- + // 画面遷移 + private void transitionPaintActivity() { + Acanthus acanthus = (Acanthus) getActivity().getApplication(); + Intent intent = new Intent(acanthus, PaintActivity.class); + startActivity(intent); + } } \ No newline at end of file