Allow to add/remove videos in playlist
This commit is contained in:
parent
0847a67063
commit
6793bce724
|
@ -1658,12 +1658,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, displayFavoritesPeertubeFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, displayFavoritesPeertubeFragment, fragmentTag).commit();
|
||||||
toot.hide();
|
toot.hide();
|
||||||
}else if (id == R.id.nav_peertube_fav) {
|
|
||||||
DisplayFavoritesPeertubeFragment displayFavoritesPeertubeFragment = new DisplayFavoritesPeertubeFragment();
|
|
||||||
fragmentTag = "BOOKMARKS_PEERTUBE";
|
|
||||||
fragmentManager.beginTransaction()
|
|
||||||
.replace(R.id.main_app_container, displayFavoritesPeertubeFragment, fragmentTag).commit();
|
|
||||||
toot.hide();
|
|
||||||
}else if( id == R.id.nav_follow_request){
|
}else if( id == R.id.nav_follow_request){
|
||||||
toot.hide();
|
toot.hide();
|
||||||
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();
|
DisplayFollowRequestSentFragment followRequestSentFragment = new DisplayFollowRequestSentFragment();
|
||||||
|
|
|
@ -32,10 +32,12 @@ import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
@ -72,25 +74,32 @@ import com.google.android.exoplayer2.util.Util;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
import app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask;
|
||||||
import app.fedilab.android.client.API;
|
import app.fedilab.android.client.API;
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
import app.fedilab.android.client.Entities.Error;
|
import app.fedilab.android.client.Entities.Error;
|
||||||
import app.fedilab.android.client.Entities.Peertube;
|
import app.fedilab.android.client.Entities.Peertube;
|
||||||
|
import app.fedilab.android.client.Entities.Playlist;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.TLSSocketFactory;
|
import app.fedilab.android.client.TLSSocketFactory;
|
||||||
import app.fedilab.android.drawers.StatusListAdapter;
|
import app.fedilab.android.drawers.StatusListAdapter;
|
||||||
|
import app.fedilab.android.fragments.DisplayStatusFragment;
|
||||||
import app.fedilab.android.helper.CrossActions;
|
import app.fedilab.android.helper.CrossActions;
|
||||||
import app.fedilab.android.helper.FullScreenMediaController;
|
import app.fedilab.android.helper.FullScreenMediaController;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
|
import app.fedilab.android.interfaces.OnPlaylistActionInterface;
|
||||||
import app.fedilab.android.sqlite.AccountDAO;
|
import app.fedilab.android.sqlite.AccountDAO;
|
||||||
|
import app.fedilab.android.sqlite.InstancesDAO;
|
||||||
import app.fedilab.android.sqlite.PeertubeFavoritesDAO;
|
import app.fedilab.android.sqlite.PeertubeFavoritesDAO;
|
||||||
import app.fedilab.android.sqlite.Sqlite;
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
import app.fedilab.android.sqlite.TimelinesDAO;
|
||||||
import app.fedilab.android.webview.MastalabWebChromeClient;
|
import app.fedilab.android.webview.MastalabWebChromeClient;
|
||||||
import app.fedilab.android.webview.MastalabWebViewClient;
|
import app.fedilab.android.webview.MastalabWebViewClient;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
@ -103,6 +112,10 @@ import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||||
import app.fedilab.android.interfaces.OnPostActionInterface;
|
import app.fedilab.android.interfaces.OnPostActionInterface;
|
||||||
import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
|
import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
|
||||||
|
|
||||||
|
import static app.fedilab.android.activities.BaseMainActivity.mPageReferenceMap;
|
||||||
|
import static app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask.action.GET_LIST_VIDEOS;
|
||||||
|
import static app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask.action.GET_PLAYLIST;
|
||||||
|
import static app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask.action.GET_PLAYLIST_FOR_VIDEO;
|
||||||
import static app.fedilab.android.helper.Helper.changeDrawableColor;
|
import static app.fedilab.android.helper.Helper.changeDrawableColor;
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,12 +124,12 @@ import static app.fedilab.android.helper.Helper.changeDrawableColor;
|
||||||
* Peertube activity
|
* Peertube activity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PeertubeActivity extends BaseActivity implements OnRetrievePeertubeInterface, OnPostActionInterface {
|
public class PeertubeActivity extends BaseActivity implements OnRetrievePeertubeInterface, OnPostActionInterface, OnPlaylistActionInterface {
|
||||||
|
|
||||||
private String peertubeInstance, videoId;
|
private String peertubeInstance, videoId;
|
||||||
private FullScreenMediaController.fullscreen fullscreen;
|
private FullScreenMediaController.fullscreen fullscreen;
|
||||||
private RelativeLayout loader;
|
private RelativeLayout loader;
|
||||||
private TextView peertube_view_count, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
|
private TextView peertube_view_count, peertube_playlist, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_share, peertube_download, peertube_description, peertube_title;
|
||||||
private ScrollView peertube_information_container;
|
private ScrollView peertube_information_container;
|
||||||
private int stopPosition;
|
private int stopPosition;
|
||||||
private Peertube peertube;
|
private Peertube peertube;
|
||||||
|
@ -135,7 +148,8 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
private TextView add_comment_read;
|
private TextView add_comment_read;
|
||||||
private EditText add_comment_write;
|
private EditText add_comment_write;
|
||||||
private String instance;
|
private String instance;
|
||||||
|
private List<String> playlistForVideo;
|
||||||
|
private List<Playlist> playlists;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -156,6 +170,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
setTheme(R.style.AppThemeDark);
|
setTheme(R.style.AppThemeDark);
|
||||||
}
|
}
|
||||||
fullScreenMode = false;
|
fullScreenMode = false;
|
||||||
|
playlistForVideo = new ArrayList<>();
|
||||||
setContentView(R.layout.activity_peertube);
|
setContentView(R.layout.activity_peertube);
|
||||||
loader = findViewById(R.id.loader);
|
loader = findViewById(R.id.loader);
|
||||||
peertube_view_count = findViewById(R.id.peertube_view_count);
|
peertube_view_count = findViewById(R.id.peertube_view_count);
|
||||||
|
@ -173,6 +188,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
my_pp = findViewById(R.id.my_pp);
|
my_pp = findViewById(R.id.my_pp);
|
||||||
add_comment_read = findViewById(R.id.add_comment_read);
|
add_comment_read = findViewById(R.id.add_comment_read);
|
||||||
add_comment_write = findViewById(R.id.add_comment_write);
|
add_comment_write = findViewById(R.id.add_comment_write);
|
||||||
|
peertube_playlist = findViewById(R.id.peertube_playlist);
|
||||||
send = findViewById(R.id.send);
|
send = findViewById(R.id.send);
|
||||||
add_comment_read.setOnClickListener(new View.OnClickListener() {
|
add_comment_read.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,6 +205,10 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
if( MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||||
write_comment_container.setVisibility(View.GONE);
|
write_comment_container.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||||
|
peertube_playlist.setVisibility(View.VISIBLE);
|
||||||
|
peertube_bookmark.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
send.setOnClickListener(new View.OnClickListener() {
|
send.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -204,6 +224,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
|
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
|
||||||
|
@ -296,7 +317,9 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
initFullscreenButton();
|
initFullscreenButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this,GET_PLAYLIST, null, null, null , PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
|
||||||
new RetrievePeertubeSingleAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrievePeertubeSingleAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
@ -475,6 +498,66 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
}
|
}
|
||||||
|
|
||||||
peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
|
|
||||||
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this,GET_PLAYLIST_FOR_VIDEO, null, peertube.getId(), null , PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
peertube_playlist.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if( playlists != null && peertube.getId() != null) {
|
||||||
|
PopupMenu popup = new PopupMenu(PeertubeActivity.this, peertube_playlist);
|
||||||
|
|
||||||
|
for(Playlist playlist: playlists){
|
||||||
|
String title = null;
|
||||||
|
for (String id : playlistForVideo) {
|
||||||
|
if (playlist.getId().equals(id)) {
|
||||||
|
title = "✔ " + playlist.getDisplayName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( title == null){
|
||||||
|
title = playlist.getDisplayName();
|
||||||
|
}
|
||||||
|
MenuItem item = popup.getMenu().add(0, 0, Menu.NONE, title);
|
||||||
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||||
|
item.setActionView(new View(getApplicationContext()));
|
||||||
|
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(playlistForVideo.contains(playlist.getId())){
|
||||||
|
item.setTitle(playlist.getDisplayName());
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this,ManagePlaylistsAsyncTask.action.DELETE_VIDEOS, playlist, peertube.getId(), null , PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
playlistForVideo.remove(playlist.getId());
|
||||||
|
}else{
|
||||||
|
item.setTitle( "✔ " + playlist.getDisplayName());
|
||||||
|
new ManagePlaylistsAsyncTask(PeertubeActivity.this,ManagePlaylistsAsyncTask.action.ADD_VIDEOS, playlist, peertube.getId(), null , PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
playlistForVideo.add(playlist.getId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( peertube.isCommentsEnabled()) {
|
if( peertube.isCommentsEnabled()) {
|
||||||
new RetrievePeertubeSingleCommentsAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrievePeertubeSingleCommentsAsyncTask(PeertubeActivity.this, peertubeInstance, videoId, PeertubeActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
|
||||||
|
@ -870,4 +953,14 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
||||||
peertube_like_count.setCompoundDrawablesWithIntrinsicBounds( null, thumbUp, null, null);
|
peertube_like_count.setCompoundDrawablesWithIntrinsicBounds( null, thumbUp, null, null);
|
||||||
peertube_dislike_count.setCompoundDrawablesWithIntrinsicBounds( null, thumbDown, null, null);
|
peertube_dislike_count.setCompoundDrawablesWithIntrinsicBounds( null, thumbDown, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActionDone(ManagePlaylistsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
|
||||||
|
|
||||||
|
if( actionType == GET_PLAYLIST_FOR_VIDEO && apiResponse != null) {
|
||||||
|
playlistForVideo = apiResponse.getPlaylistForVideos();
|
||||||
|
}else if( actionType == GET_PLAYLIST && apiResponse != null){
|
||||||
|
playlists = apiResponse.getPlaylists();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
|
@ -45,7 +46,8 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
DELETE_PLAYLIST,
|
DELETE_PLAYLIST,
|
||||||
UPDATE_PLAYLIST,
|
UPDATE_PLAYLIST,
|
||||||
ADD_VIDEOS,
|
ADD_VIDEOS,
|
||||||
DELETE_VIDEOS
|
DELETE_VIDEOS,
|
||||||
|
GET_PLAYLIST_FOR_VIDEO,
|
||||||
}
|
}
|
||||||
|
|
||||||
private OnPlaylistActionInterface listener;
|
private OnPlaylistActionInterface listener;
|
||||||
|
@ -84,6 +86,8 @@ public class ManagePlaylistsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
statusCode = new PeertubeAPI(contextReference.get()).addVideoPlaylist(playlist.getId(),videoId);
|
statusCode = new PeertubeAPI(contextReference.get()).addVideoPlaylist(playlist.getId(),videoId);
|
||||||
}else if(apiAction == action.DELETE_VIDEOS){
|
}else if(apiAction == action.DELETE_VIDEOS){
|
||||||
statusCode = new PeertubeAPI(contextReference.get()).deleteVideoPlaylist(playlist.getId(),videoId);
|
statusCode = new PeertubeAPI(contextReference.get()).deleteVideoPlaylist(playlist.getId(),videoId);
|
||||||
|
}else if(apiAction == action.GET_PLAYLIST_FOR_VIDEO){
|
||||||
|
apiResponse = new PeertubeAPI(contextReference.get()).getPlaylistForVideo(videoId);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class APIResponse {
|
||||||
private Instance instance;
|
private Instance instance;
|
||||||
private List<StoredStatus> storedStatuses;
|
private List<StoredStatus> storedStatuses;
|
||||||
private boolean fetchmore = false;
|
private boolean fetchmore = false;
|
||||||
|
private List<String> playlistForVideos;
|
||||||
|
|
||||||
public List<Account> getAccounts() {
|
public List<Account> getAccounts() {
|
||||||
return accounts;
|
return accounts;
|
||||||
|
@ -229,4 +230,12 @@ public class APIResponse {
|
||||||
public void setPlaylists(List<Playlist> playlists) {
|
public void setPlaylists(List<Playlist> playlists) {
|
||||||
this.playlists = playlists;
|
this.playlists = playlists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getPlaylistForVideos() {
|
||||||
|
return playlistForVideos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaylistForVideos(List<String> playlistForVideos) {
|
||||||
|
this.playlistForVideos = playlistForVideos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ package app.fedilab.android.client;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -1340,6 +1339,46 @@ public class PeertubeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Video is in play lists
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public APIResponse getPlaylistForVideo(String videoId){
|
||||||
|
|
||||||
|
HashMap<String, String> params = new HashMap<>();
|
||||||
|
params.put("videoIds",videoId);
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
String response = new HttpsConnection(context, this.instance).get(getAbsoluteUrl("/users/me/video-playlists/videos-exist"), 60, params, prefKeyOauthTokenT);
|
||||||
|
|
||||||
|
JSONArray jsonArray = new JSONObject(response).getJSONArray(videoId);
|
||||||
|
try {
|
||||||
|
int i = 0;
|
||||||
|
while (i < jsonArray.length() ) {
|
||||||
|
JSONObject resobj = jsonArray.getJSONObject(i);
|
||||||
|
String playlistId = resobj.getString("playlistId");
|
||||||
|
ids.add(playlistId);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
setDefaultError(e);
|
||||||
|
}
|
||||||
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
setError(e.getStatusCode(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (KeyManagementException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
apiResponse = new APIResponse();
|
||||||
|
apiResponse.setPlaylistForVideos(ids);
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1431,6 +1470,7 @@ public class PeertubeAPI {
|
||||||
actionCode = httpsConnection.getActionCode();
|
actionCode = httpsConnection.getActionCode();
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
setError(e.getStatusCode(), e);
|
setError(e.getStatusCode(), e);
|
||||||
|
e.printStackTrace();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.fragments;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -29,7 +28,6 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
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;
|
||||||
|
@ -46,14 +44,8 @@ import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||||
import net.gotev.uploadservice.MultipartUploadRequest;
|
import net.gotev.uploadservice.MultipartUploadRequest;
|
||||||
import net.gotev.uploadservice.ServerResponse;
|
import net.gotev.uploadservice.ServerResponse;
|
||||||
import net.gotev.uploadservice.UploadInfo;
|
import net.gotev.uploadservice.UploadInfo;
|
||||||
import net.gotev.uploadservice.UploadNotificationAction;
|
|
||||||
import net.gotev.uploadservice.UploadNotificationConfig;
|
import net.gotev.uploadservice.UploadNotificationConfig;
|
||||||
import net.gotev.uploadservice.UploadStatusDelegate;
|
import net.gotev.uploadservice.UploadStatusDelegate;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -63,11 +55,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.BaseMainActivity;
|
|
||||||
import app.fedilab.android.activities.ListActivity;
|
|
||||||
import app.fedilab.android.activities.MainActivity;
|
import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.activities.PeertubeEditUploadActivity;
|
|
||||||
import app.fedilab.android.activities.PeertubeUploadActivity;
|
|
||||||
import app.fedilab.android.activities.PlaylistsActivity;
|
import app.fedilab.android.activities.PlaylistsActivity;
|
||||||
import app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask;
|
import app.fedilab.android.asynctasks.ManagePlaylistsAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.RetrievePeertubeChannelsAsyncTask;
|
import app.fedilab.android.asynctasks.RetrievePeertubeChannelsAsyncTask;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#606984"
|
||||||
|
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z"/>
|
||||||
|
</vector>
|
|
@ -58,7 +58,7 @@
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout
|
||||||
android:id="@+id/loader"
|
android:id="@+id/loader"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -148,6 +148,21 @@
|
||||||
android:text=""
|
android:text=""
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
/>
|
||||||
|
<TextView
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/peertube_playlist"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:drawableTop="@drawable/ic_list_peertube_activity"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:text=""
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical" android:layout_width="match_parent"
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp">
|
android:padding="15dp">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:labelFor="@+id/display_name"
|
android:labelFor="@+id/display_name"
|
||||||
|
|
|
@ -63,9 +63,9 @@
|
||||||
<menu>
|
<menu>
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_peertube_fav"
|
android:id="@+id/nav_peertube_playlists"
|
||||||
android:icon="@drawable/ic_favorite_peertube_full"
|
android:icon="@drawable/ic_list_peertube"
|
||||||
android:title="@string/peertube_favorites" />
|
android:title="@string/playlists" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_my_video"
|
android:id="@+id/nav_my_video"
|
||||||
android:icon="@drawable/ic_video_library"
|
android:icon="@drawable/ic_video_library"
|
||||||
|
@ -74,10 +74,7 @@
|
||||||
android:id="@+id/nav_peertube_history"
|
android:id="@+id/nav_peertube_history"
|
||||||
android:icon="@drawable/ic_history_black"
|
android:icon="@drawable/ic_history_black"
|
||||||
android:title="@string/history" />
|
android:title="@string/history" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_peertube_playlists"
|
|
||||||
android:icon="@drawable/ic_list_peertube"
|
|
||||||
android:title="@string/playlists" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_upload"
|
android:id="@+id/nav_upload"
|
||||||
android:icon="@drawable/ic_cloud_upload"
|
android:icon="@drawable/ic_cloud_upload"
|
||||||
|
|
Loading…
Reference in New Issue