diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java index 6720486..06c2566 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java @@ -1,12 +1,12 @@ package org.ntlab.acanthus_client.views.main_menu_ui.edit; import org.ntlab.acanthus_client.entities.AidJson; +import org.ntlab.acanthus_client.entities.Animation; import org.ntlab.acanthus_client.entities.WorkJson; import org.ntlab.acanthus_client.resources.accounts.WorkRest; +import org.ntlab.acanthus_client.resources.gallery.GalleryRest; import org.ntlab.acanthus_client.resources.gallery.InvitesRest; -import java.util.concurrent.Callable; - import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; @@ -94,6 +94,37 @@ }); } + //aidから特定の作品を取得するAPIの呼び出し + public Animation getAnimationInfo(Integer aid) { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + final GalleryRest galleryRest = retrofit.create(GalleryRest.class); + + final Animation[] animation = {null}; + + //特定の作品の表示 + Call call = galleryRest.getAnimationInformation(aid); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()) { + if (response.body() != null) { + animation[0] = response.body(); + } + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + + return animation[0]; + } + //ユーザーの作品へ他ユーザーを招待するAPIの呼び出し public void invitesEditor(Integer aid, String ownerUid, String invitedUid, String ownerToken) { Retrofit retrofit = new Retrofit.Builder()