2020-06-30 17:26:20 +02:00
|
|
|
package app.fedilab.fedilabtube;
|
2020-07-01 16:36:08 +02:00
|
|
|
/* Copyright 2020 Thomas Schneider
|
|
|
|
*
|
|
|
|
* This file is a part of TubeLab
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Bundle;
|
2020-09-04 15:56:18 +02:00
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Looper;
|
2020-06-30 17:26:20 +02:00
|
|
|
import android.text.InputFilter;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.WindowManager;
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.EditText;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.ListView;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
2020-09-07 16:57:00 +02:00
|
|
|
import androidx.lifecycle.ViewModelProvider;
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import app.fedilab.fedilabtube.client.APIResponse;
|
2020-09-04 15:56:18 +02:00
|
|
|
import app.fedilab.fedilabtube.client.HttpsConnection;
|
|
|
|
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
2020-06-30 17:26:20 +02:00
|
|
|
import app.fedilab.fedilabtube.client.entities.Account;
|
|
|
|
import app.fedilab.fedilabtube.client.entities.Playlist;
|
2020-09-04 15:56:18 +02:00
|
|
|
import app.fedilab.fedilabtube.client.entities.PlaylistElement;
|
2020-06-30 17:26:20 +02:00
|
|
|
import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
|
2020-09-11 15:56:18 +02:00
|
|
|
import app.fedilab.fedilabtube.helper.Helper;
|
2020-09-07 16:57:00 +02:00
|
|
|
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
|
2020-09-08 10:11:11 +02:00
|
|
|
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
2020-06-30 17:26:20 +02:00
|
|
|
import es.dmoral.toasty.Toasty;
|
|
|
|
|
2020-09-08 10:11:11 +02:00
|
|
|
import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
|
2020-09-08 10:11:11 +02:00
|
|
|
public class AllPlaylistsActivity extends AppCompatActivity {
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
|
2020-09-04 15:58:49 +02:00
|
|
|
PlaylistAdapter playlistAdapter;
|
2020-06-30 17:26:20 +02:00
|
|
|
private RelativeLayout mainLoader;
|
|
|
|
private RelativeLayout textviewNoAction;
|
|
|
|
private HashMap<Integer, String> privacyToSend;
|
|
|
|
private Spinner set_upload_channel;
|
|
|
|
private Spinner set_upload_privacy;
|
2020-09-04 15:56:18 +02:00
|
|
|
private String idChannel;
|
|
|
|
private List<Playlist> playlists;
|
2020-09-11 15:56:18 +02:00
|
|
|
private Playlist playlistToEdit;
|
2020-09-11 11:50:26 +02:00
|
|
|
|
2020-06-30 17:26:20 +02:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
setContentView(R.layout.activity_all_playlist);
|
|
|
|
|
|
|
|
if (getSupportActionBar() != null)
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
setTitle(R.string.playlists);
|
|
|
|
|
|
|
|
|
|
|
|
textviewNoAction = findViewById(R.id.no_action);
|
|
|
|
mainLoader = findViewById(R.id.loader);
|
|
|
|
RelativeLayout nextElementLoader = findViewById(R.id.loading_next_items);
|
|
|
|
mainLoader.setVisibility(View.VISIBLE);
|
|
|
|
nextElementLoader.setVisibility(View.GONE);
|
2020-09-04 15:56:18 +02:00
|
|
|
idChannel = null;
|
2020-06-30 19:06:54 +02:00
|
|
|
|
2020-09-08 10:11:11 +02:00
|
|
|
PlaylistsVM viewModel = new ViewModelProvider(AllPlaylistsActivity.this).get(PlaylistsVM.class);
|
|
|
|
viewModel.manage(PlaylistsVM.action.GET_PLAYLIST, null, null, null).observe(AllPlaylistsActivity.this, apiResponse -> manageVIewPlaylists(PlaylistsVM.action.GET_PLAYLIST, apiResponse));
|
|
|
|
|
2020-09-04 15:56:18 +02:00
|
|
|
FloatingActionButton add_new = findViewById(R.id.add_new);
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
LinkedHashMap<Integer, String> privaciesInit = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
2020-09-03 19:08:53 +02:00
|
|
|
if (privaciesInit.size() > 0) {
|
|
|
|
Map.Entry<Integer, String> entryInt = privaciesInit.entrySet().iterator().next();
|
|
|
|
privacyToSend = new HashMap<>();
|
|
|
|
privacyToSend.put(entryInt.getKey(), entryInt.getValue());
|
|
|
|
}
|
2020-06-30 17:26:20 +02:00
|
|
|
|
|
|
|
|
2020-09-04 15:56:18 +02:00
|
|
|
playlists = new ArrayList<>();
|
|
|
|
ListView lv_playlist = findViewById(R.id.lv_playlist);
|
|
|
|
playlistAdapter = new PlaylistAdapter(AllPlaylistsActivity.this, playlists, textviewNoAction);
|
|
|
|
lv_playlist.setAdapter(playlistAdapter);
|
|
|
|
|
2020-09-11 11:50:26 +02:00
|
|
|
add_new.setOnClickListener(view -> manageAlert(null));
|
2020-06-30 17:26:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDestroy() {
|
|
|
|
super.onDestroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
if (item.getItemId() == android.R.id.home) {
|
|
|
|
finish();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-08 10:11:11 +02:00
|
|
|
public void manageVIewPlaylists(PlaylistsVM.action actionType, APIResponse apiResponse) {
|
2020-06-30 17:26:20 +02:00
|
|
|
mainLoader.setVisibility(View.GONE);
|
|
|
|
if (apiResponse.getError() != null) {
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
|
|
|
return;
|
|
|
|
}
|
2020-09-08 10:11:11 +02:00
|
|
|
if (actionType == PlaylistsVM.action.GET_PLAYLIST) {
|
2020-06-30 17:26:20 +02:00
|
|
|
if (apiResponse.getPlaylists() != null && apiResponse.getPlaylists().size() > 0) {
|
2020-06-30 19:06:54 +02:00
|
|
|
playlists.addAll(apiResponse.getPlaylists());
|
2020-09-04 15:56:18 +02:00
|
|
|
playlistAdapter.notifyDataSetChanged();
|
2020-06-30 17:26:20 +02:00
|
|
|
textviewNoAction.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
textviewNoAction.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
public void manageAlert(Playlist playlistParam) {
|
2020-09-11 11:50:26 +02:00
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
playlistToEdit = playlistParam;
|
2020-09-11 11:50:26 +02:00
|
|
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(AllPlaylistsActivity.this);
|
|
|
|
LayoutInflater inflater1 = getLayoutInflater();
|
|
|
|
View dialogView = inflater1.inflate(R.layout.add_playlist, new LinearLayout(AllPlaylistsActivity.this), false);
|
|
|
|
dialogBuilder.setView(dialogView);
|
|
|
|
EditText display_name = dialogView.findViewById(R.id.display_name);
|
|
|
|
EditText description = dialogView.findViewById(R.id.description);
|
|
|
|
set_upload_channel = dialogView.findViewById(R.id.set_upload_channel);
|
|
|
|
set_upload_privacy = dialogView.findViewById(R.id.set_upload_privacy);
|
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
|
2020-09-11 11:50:26 +02:00
|
|
|
ChannelsVM viewModelC = new ViewModelProvider(AllPlaylistsActivity.this).get(ChannelsVM.class);
|
|
|
|
viewModelC.get().observe(AllPlaylistsActivity.this, this::manageVIewChannels);
|
|
|
|
|
|
|
|
display_name.setFilters(new InputFilter[]{new InputFilter.LengthFilter(120)});
|
|
|
|
description.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1000)});
|
|
|
|
|
|
|
|
if (playlistToEdit != null) {
|
|
|
|
display_name.setText(playlistToEdit.getDisplayName());
|
|
|
|
description.setText(playlistToEdit.getDescription());
|
|
|
|
}
|
|
|
|
|
|
|
|
dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> {
|
|
|
|
if (display_name.getText() != null && display_name.getText().toString().trim().length() > 0) {
|
|
|
|
PlaylistElement playlistElement = new PlaylistElement();
|
|
|
|
playlistElement.setDisplayName(display_name.getText().toString().trim());
|
|
|
|
if (description.getText() != null && description.getText().toString().trim().length() > 0) {
|
|
|
|
playlistElement.setDescription(description.getText().toString().trim());
|
|
|
|
}
|
|
|
|
playlistElement.setVideoChannelId(idChannel);
|
|
|
|
String idPrivacy;
|
|
|
|
String label;
|
|
|
|
Map.Entry<Integer, String> privacyM = privacyToSend.entrySet().iterator().next();
|
|
|
|
idPrivacy = String.valueOf(privacyM.getKey());
|
|
|
|
label = privacyM.getValue();
|
|
|
|
if ((label.equals("Public") && (playlistElement.getVideoChannelId() == null || playlistElement.getVideoChannelId().equals("")))) {
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, getString(R.string.error_channel_mandatory), Toast.LENGTH_LONG).show();
|
|
|
|
} else {
|
|
|
|
if (privacyToSend != null) {
|
|
|
|
playlistElement.setPrivacy(idPrivacy);
|
|
|
|
}
|
|
|
|
new Thread(() -> {
|
|
|
|
try {
|
2020-09-11 15:56:18 +02:00
|
|
|
String playlistId;
|
|
|
|
if (playlistToEdit == null) {
|
|
|
|
playlistId = new PeertubeAPI(AllPlaylistsActivity.this).createPlaylist(playlistElement);
|
|
|
|
} else {
|
|
|
|
playlistId = playlistToEdit.getId();
|
|
|
|
playlistElement.setPlaylistId(playlistId);
|
|
|
|
new PeertubeAPI(AllPlaylistsActivity.this).updatePlaylist(playlistElement);
|
|
|
|
}
|
2020-09-11 11:50:26 +02:00
|
|
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
|
|
Runnable myRunnable = () -> {
|
2020-09-11 15:56:18 +02:00
|
|
|
Playlist playlist;
|
|
|
|
if (playlistToEdit == null) {
|
|
|
|
playlist = new Playlist();
|
|
|
|
} else {
|
|
|
|
playlist = playlistToEdit;
|
|
|
|
}
|
2020-09-11 11:50:26 +02:00
|
|
|
playlist.setId(playlistId);
|
|
|
|
playlist.setDescription(playlistElement.getDescription());
|
|
|
|
playlist.setDisplayName(playlistElement.getDisplayName());
|
2020-09-11 15:56:18 +02:00
|
|
|
playlist.setVideoChannelId(playlistElement.getVideoChannelId());
|
2020-09-11 11:50:26 +02:00
|
|
|
playlist.setPrivacy(privacyToSend);
|
2020-09-11 15:56:18 +02:00
|
|
|
if (playlistToEdit == null) {
|
|
|
|
playlists.add(playlist);
|
|
|
|
}
|
2020-09-11 11:50:26 +02:00
|
|
|
playlistAdapter.notifyDataSetChanged();
|
|
|
|
};
|
|
|
|
mainHandler.post(myRunnable);
|
|
|
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
|
|
Runnable myRunnable = () -> {
|
|
|
|
if (e.getMessage() != null) {
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
|
|
|
|
} else {
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
mainHandler.post(myRunnable);
|
|
|
|
}
|
|
|
|
}).start();
|
|
|
|
dialog.dismiss();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, getString(R.string.error_display_name), Toast.LENGTH_LONG).show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
|
|
|
AlertDialog alertDialog = dialogBuilder.create();
|
2020-09-12 12:33:23 +02:00
|
|
|
if (playlistToEdit == null) {
|
|
|
|
alertDialog.setTitle(getString(R.string.action_playlist_create));
|
|
|
|
} else {
|
|
|
|
alertDialog.setTitle(getString(R.string.action_playlist_edit));
|
|
|
|
}
|
2020-09-11 11:50:26 +02:00
|
|
|
alertDialog.setOnDismissListener(dialogInterface -> {
|
|
|
|
//Hide keyboard
|
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
assert imm != null;
|
|
|
|
imm.hideSoftInputFromWindow(display_name.getWindowToken(), 0);
|
|
|
|
});
|
|
|
|
if (alertDialog.getWindow() != null)
|
|
|
|
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
|
|
|
alertDialog.show();
|
|
|
|
}
|
|
|
|
|
2020-06-30 17:26:20 +02:00
|
|
|
|
2020-09-07 16:57:00 +02:00
|
|
|
public void manageVIewChannels(APIResponse apiResponse) {
|
2020-06-30 17:26:20 +02:00
|
|
|
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
|
|
|
|
if (apiResponse.getError() != null && apiResponse.getError().getError() != null)
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
|
|
|
else
|
|
|
|
Toasty.error(AllPlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Populate channels
|
2020-09-11 15:56:18 +02:00
|
|
|
List<Account> channels = apiResponse.getAccounts();
|
|
|
|
String[] channelName = new String[channels.size() + 1];
|
|
|
|
String[] channelId = new String[channels.size() + 1];
|
2020-06-30 17:26:20 +02:00
|
|
|
int i = 1;
|
|
|
|
channelName[0] = "";
|
2020-09-04 15:56:18 +02:00
|
|
|
channelId[0] = "null";
|
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
for (Account account : channels) {
|
2020-06-30 17:26:20 +02:00
|
|
|
channelName[i] = account.getUsername();
|
|
|
|
channelId[i] = account.getId();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayAdapter<String> adapterChannel = new ArrayAdapter<>(AllPlaylistsActivity.this,
|
|
|
|
android.R.layout.simple_spinner_dropdown_item, channelName);
|
|
|
|
set_upload_channel.setAdapter(adapterChannel);
|
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
|
2020-06-30 17:26:20 +02:00
|
|
|
LinkedHashMap<String, String> translations = null;
|
|
|
|
if (peertubeInformation.getTranslations() != null)
|
|
|
|
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
|
|
|
|
|
|
|
|
LinkedHashMap<Integer, String> privaciesInit = new LinkedHashMap<>(peertubeInformation.getPlaylistPrivacies());
|
|
|
|
Map.Entry<Integer, String> entryInt = privaciesInit.entrySet().iterator().next();
|
|
|
|
privacyToSend = new HashMap<>();
|
|
|
|
privacyToSend.put(entryInt.getKey(), entryInt.getValue());
|
|
|
|
LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPlaylistPrivacies());
|
|
|
|
//Populate privacies
|
|
|
|
String[] privaciesA = new String[privacies.size()];
|
|
|
|
Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
|
|
|
|
i = 0;
|
|
|
|
while (it.hasNext()) {
|
|
|
|
Map.Entry<Integer, String> pair = it.next();
|
|
|
|
if (translations == null || translations.size() == 0 || !translations.containsKey(pair.getValue()))
|
|
|
|
privaciesA[i] = pair.getValue();
|
|
|
|
else
|
|
|
|
privaciesA[i] = translations.get(pair.getValue());
|
|
|
|
it.remove();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayAdapter<String> adapterPrivacies = new ArrayAdapter<>(AllPlaylistsActivity.this,
|
|
|
|
android.R.layout.simple_spinner_dropdown_item, privaciesA);
|
|
|
|
set_upload_privacy.setAdapter(adapterPrivacies);
|
|
|
|
|
2020-09-11 15:56:18 +02:00
|
|
|
if (playlistToEdit != null) {
|
|
|
|
it = playlistToEdit.getPrivacy().entrySet().iterator();
|
|
|
|
Map.Entry<Integer, String> pair = null;
|
|
|
|
while (it.hasNext()) {
|
|
|
|
pair = it.next();
|
|
|
|
}
|
|
|
|
if (pair != null) {
|
|
|
|
set_upload_privacy.setSelection(pair.getKey() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-30 17:26:20 +02:00
|
|
|
//Manage privacies
|
|
|
|
set_upload_privacy.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
LinkedHashMap<Integer, String> privaciesCheck = new LinkedHashMap<>(peertubeInformation.getPrivacies());
|
|
|
|
Iterator<Map.Entry<Integer, String>> it = privaciesCheck.entrySet().iterator();
|
|
|
|
int i = 0;
|
|
|
|
while (it.hasNext()) {
|
|
|
|
Map.Entry<Integer, String> pair = it.next();
|
|
|
|
if (i == position) {
|
|
|
|
privacyToSend = new HashMap<>();
|
|
|
|
privacyToSend.put(pair.getKey(), pair.getValue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
it.remove();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2020-09-11 15:56:18 +02:00
|
|
|
|
|
|
|
if (playlistToEdit != null) {
|
|
|
|
it = playlistToEdit.getPrivacy().entrySet().iterator();
|
|
|
|
Map.Entry<Integer, String> pair = null;
|
|
|
|
while (it.hasNext()) {
|
|
|
|
pair = it.next();
|
|
|
|
}
|
|
|
|
if (pair != null) {
|
|
|
|
set_upload_privacy.setSelection(pair.getKey() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-30 17:26:20 +02:00
|
|
|
//Manage languages
|
|
|
|
set_upload_channel.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
2020-09-04 15:56:18 +02:00
|
|
|
idChannel = channelId[position];
|
2020-06-30 17:26:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
2020-09-11 15:56:18 +02:00
|
|
|
|
|
|
|
if (playlistToEdit != null) {
|
|
|
|
int position = 0;
|
|
|
|
int k = 1;
|
|
|
|
for (Account ac : channels) {
|
|
|
|
if (playlistToEdit.getVideoChannelId() != null && ac.getId().compareTo(playlistToEdit.getVideoChannelId()) == 0) {
|
|
|
|
position = k;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
set_upload_channel.setSelection(position);
|
|
|
|
}
|
2020-06-30 17:26:20 +02:00
|
|
|
}
|
|
|
|
}
|