Merge pull request #82 from lishoujun/develop
add languages MultiSelectListPreference. but not all languages.
This commit is contained in:
commit
068dca5d09
|
@ -60,6 +60,7 @@ import net.schueller.peertube.service.VideoPlayerService;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
@ -253,16 +254,16 @@ public class VideoListActivity extends AppCompatActivity {
|
||||||
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false";
|
String nsfw = sharedPref.getBoolean("pref_show_nsfw", false) ? "both" : "false";
|
||||||
|
Set<String> languages = sharedPref.getStringSet("pref_language", null);
|
||||||
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
|
String apiBaseURL = APIUrlHelper.getUrlWithVersion(this);
|
||||||
|
|
||||||
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL).create(GetVideoDataService.class);
|
||||||
|
|
||||||
Call<VideoList> call;
|
Call<VideoList> call;
|
||||||
if (!searchQuery.equals("")) {
|
if (!searchQuery.equals("")) {
|
||||||
call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter);
|
call = service.searchVideosData(start, count, sort, nsfw, searchQuery, filter, languages);
|
||||||
} else {
|
} else {
|
||||||
call = service.getVideosData(start, count, sort, nsfw, filter);
|
call = service.getVideosData(start, count, sort, nsfw, filter, languages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Log the URL called*/
|
/*Log the URL called*/
|
||||||
|
|
|
@ -20,6 +20,8 @@ package net.schueller.peertube.network;
|
||||||
import net.schueller.peertube.model.Video;
|
import net.schueller.peertube.model.Video;
|
||||||
import net.schueller.peertube.model.VideoList;
|
import net.schueller.peertube.model.VideoList;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Path;
|
import retrofit2.http.Path;
|
||||||
|
@ -32,7 +34,8 @@ public interface GetVideoDataService {
|
||||||
@Query("count") int count,
|
@Query("count") int count,
|
||||||
@Query("sort") String sort,
|
@Query("sort") String sort,
|
||||||
@Query("nsfw") String nsfw,
|
@Query("nsfw") String nsfw,
|
||||||
@Query("filter") String filter
|
@Query("filter") String filter,
|
||||||
|
@Query("languageOneOf") Set<String> languages
|
||||||
);
|
);
|
||||||
|
|
||||||
@GET("videos/{id}")
|
@GET("videos/{id}")
|
||||||
|
@ -47,6 +50,7 @@ public interface GetVideoDataService {
|
||||||
@Query("sort") String sort,
|
@Query("sort") String sort,
|
||||||
@Query("nsfw") String nsfw,
|
@Query("nsfw") String nsfw,
|
||||||
@Query("search") String search,
|
@Query("search") String search,
|
||||||
@Query("filter") String filter
|
@Query("filter") String filter,
|
||||||
|
@Query("languageOneOf") Set<String> languages
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -44,5 +44,15 @@
|
||||||
<item>AppTheme.GRAY</item>
|
<item>AppTheme.GRAY</item>
|
||||||
<item>AppTheme.BLUEGRAY</item>
|
<item>AppTheme.BLUEGRAY</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="languageArray">
|
||||||
|
<item>@string/en</item>
|
||||||
|
<item>@string/fr</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="languageValues">
|
||||||
|
<item>en</item>
|
||||||
|
<item>fr</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="empty_array"/>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
<string name="pref_title_show_nsfw">Show NSFW</string>
|
<string name="pref_title_show_nsfw">Show NSFW</string>
|
||||||
<string name="pref_description_show_nsfw">NSFW content will be shown if enabled.</string>
|
<string name="pref_description_show_nsfw">NSFW content will be shown if enabled.</string>
|
||||||
|
<string name="pref_language">Show Languages</string>
|
||||||
|
<string name="pref_description_language">Select languages be shown.</string>
|
||||||
<string name="title_activity_url_video_play">UrlVideoPlayActivity</string>
|
<string name="title_activity_url_video_play">UrlVideoPlayActivity</string>
|
||||||
<string name="pref_title_torrent_player">Torrent Video Player</string>
|
<string name="pref_title_torrent_player">Torrent Video Player</string>
|
||||||
<string name="pref_description_torrent_player">Video playback via a torrent stream. This requires Storage Permissions. (Alpha, not stable!)</string>
|
<string name="pref_description_torrent_player">Video playback via a torrent stream. This requires Storage Permissions. (Alpha, not stable!)</string>
|
||||||
|
@ -65,6 +67,9 @@
|
||||||
<string name="pref_title_app_theme">App Theme</string>
|
<string name="pref_title_app_theme">App Theme</string>
|
||||||
<string name="pref_description_app_theme">Restart App for theme to take effect.</string>
|
<string name="pref_description_app_theme">Restart App for theme to take effect.</string>
|
||||||
|
|
||||||
|
<string name="en">English</string>
|
||||||
|
<string name="fr">French</string>
|
||||||
|
|
||||||
<string name="red">Red</string>
|
<string name="red">Red</string>
|
||||||
<string name="pink">Pink</string>
|
<string name="pink">Pink</string>
|
||||||
<string name="purple">Purple</string>
|
<string name="purple">Purple</string>
|
||||||
|
|
|
@ -22,6 +22,14 @@
|
||||||
android:summary="@string/pref_description_show_nsfw"
|
android:summary="@string/pref_description_show_nsfw"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<MultiSelectListPreference
|
||||||
|
android:defaultValue="@array/empty_array"
|
||||||
|
android:entries="@array/languageArray"
|
||||||
|
android:entryValues="@array/languageValues"
|
||||||
|
android:key="pref_language"
|
||||||
|
android:summary="@string/pref_description_language"
|
||||||
|
android:title="@string/pref_language" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:title="@string/pref_title_app_theme"
|
android:title="@string/pref_title_app_theme"
|
||||||
android:summary="@string/pref_description_app_theme"
|
android:summary="@string/pref_description_app_theme"
|
||||||
|
|
Loading…
Reference in New Issue