Fix channel issue for playlist

This commit is contained in:
tom79 2019-05-28 07:46:07 +02:00
parent ed05ef141e
commit 0b373c53f5
2 changed files with 9 additions and 9 deletions

View File

@ -118,7 +118,7 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
LinkedHashMap<String, String> translations = null;
if( peertubeInformation.getTranslations() != null)
if( peertubeInformation != null && peertubeInformation.getTranslations() != null)
translations = new LinkedHashMap<>(peertubeInformation.getTranslations());
LinkedHashMap<Integer, String> privaciesInit = new LinkedHashMap<>(peertubeInformation.getPrivacies());
@ -170,7 +170,6 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
Helper.changeMaterialSpinnerColor(context, set_upload_channel);
new RetrievePeertubeChannelsAsyncTask(context, DisplayPlaylistsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
channels = new HashMap<>();
display_name.setFilters(new InputFilter[]{new InputFilter.LengthFilter(120)});
description.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1000)});
@ -374,9 +373,12 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
//Populate channels
List<Account> accounts = apiResponse.getAccounts();
String[] channelName = new String[accounts.size()];
String[] channelId= new String[accounts.size()];
int i = 0;
String[] channelName = new String[accounts.size()+1];
String[] channelId= new String[accounts.size()+1];
int i = 1;
channelName[0] = "";
channelId[0] = "";
channels = new HashMap<>();
for(Account account: accounts){
channels.put(account.getUsername(),account.getId());
channelName[i] = account.getUsername();

View File

@ -42,7 +42,6 @@
android:layout_weight="3"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:gravity="center"
@ -51,7 +50,7 @@
android:layout_height="wrap_content"
android:text="@string/channel"/>
<com.jaredrummler.materialspinner.MaterialSpinner
android:textSize="16sp"
android:textSize="14sp"
android:id="@+id/set_upload_channel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
@ -63,7 +62,6 @@
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:gravity="center"
@ -72,7 +70,7 @@
android:layout_height="wrap_content"
android:text="@string/action_privacy"/>
<com.jaredrummler.materialspinner.MaterialSpinner
android:textSize="16sp"
android:textSize="14sp"
android:id="@+id/set_upload_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />