diff --git a/app/src/main/java/app/fedilab/fedilabtube/PeertubeEditUploadActivity.java b/app/src/main/java/app/fedilab/fedilabtube/PeertubeEditUploadActivity.java index ce8b7bc..5420404 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/PeertubeEditUploadActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/PeertubeEditUploadActivity.java @@ -22,6 +22,8 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; @@ -58,6 +60,7 @@ import java.util.UUID; import app.fedilab.fedilabtube.client.APIResponse; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; import app.fedilab.fedilabtube.client.data.ChannelData.Channel; +import app.fedilab.fedilabtube.client.data.VideoData; import app.fedilab.fedilabtube.client.data.VideoData.Video; import app.fedilab.fedilabtube.client.entities.Item; import app.fedilab.fedilabtube.client.entities.ItemStr; @@ -225,6 +228,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity { TimelineVM feedsViewModel = new ViewModelProvider(PeertubeEditUploadActivity.this).get(TimelineVM.class); feedsViewModel.getMyVideo(null, videoId).observe(PeertubeEditUploadActivity.this, this::manageVIewVideo); + channels = new LinkedHashMap<>(); setTitle(R.string.edit_video); @@ -330,6 +334,23 @@ public class PeertubeEditUploadActivity extends AppCompatActivity { p_video_title.setText(title); p_video_description.setText(video.getDescription()); + new Thread(() -> { + try { + RetrofitPeertubeAPI api; + api = new RetrofitPeertubeAPI(PeertubeEditUploadActivity.this); + VideoData.Description description = api.getVideoDescription(video.getUuid()); + Handler mainHandler = new Handler(Looper.getMainLooper()); + Runnable myRunnable = () -> { + if (description == null) { + p_video_description.setText(description.getDescription()); + } + }; + mainHandler.post(myRunnable); + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + LinkedHashMap categories = new LinkedHashMap<>(peertubeInformation.getCategories()); LinkedHashMap licences = new LinkedHashMap<>(peertubeInformation.getLicences()); LinkedHashMap privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies());