more grammar fix
This commit is contained in:
parent
fd5f4d9840
commit
a0151f2a68
|
@ -36,7 +36,6 @@ import com.grack.nanojson.JsonStringWriter;
|
||||||
import com.grack.nanojson.JsonWriter;
|
import com.grack.nanojson.JsonWriter;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.extractor.ServiceList;
|
|
||||||
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
|
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
|
||||||
import org.schabi.newpipe.util.Constants;
|
import org.schabi.newpipe.util.Constants;
|
||||||
import org.schabi.newpipe.util.PeertubeHelper;
|
import org.schabi.newpipe.util.PeertubeHelper;
|
||||||
|
@ -219,7 +218,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInstance(String url) {
|
private void addInstance(String url) {
|
||||||
String cleanUrl = verifyUrl(url);
|
String cleanUrl = cleanUrl(url);
|
||||||
if(null == cleanUrl) return;
|
if(null == cleanUrl) return;
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
Disposable disposable = Single.fromCallable(() -> {
|
Disposable disposable = Single.fromCallable(() -> {
|
||||||
|
@ -237,7 +236,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String verifyUrl(String url){
|
private String cleanUrl(String url){
|
||||||
// if protocol not present, add https
|
// if protocol not present, add https
|
||||||
if(!url.startsWith("http")){
|
if(!url.startsWith("http")){
|
||||||
url = "https://" + url;
|
url = "https://" + url;
|
||||||
|
@ -246,13 +245,13 @@ public class PeertubeInstanceListFragment extends Fragment {
|
||||||
url = url.replaceAll("/$", "");
|
url = url.replaceAll("/$", "");
|
||||||
// only allow https
|
// only allow https
|
||||||
if (!url.startsWith("https://")) {
|
if (!url.startsWith("https://")) {
|
||||||
Toast.makeText(getActivity(), "instance url should start with https://", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.peertube_instance_add_https_only, Toast.LENGTH_SHORT).show();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// only allow if not already exists
|
// only allow if not already exists
|
||||||
for (PeertubeInstance instance : instanceList) {
|
for (PeertubeInstance instance : instanceList) {
|
||||||
if (instance.getUrl().equals(url)) {
|
if (instance.getUrl().equals(url)) {
|
||||||
Toast.makeText(getActivity(), "instance already exists", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), R.string.peertube_instance_add_exists, Toast.LENGTH_SHORT).show();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,10 +111,12 @@
|
||||||
<string name="content_language_title">Default content language</string>
|
<string name="content_language_title">Default content language</string>
|
||||||
<string name="peertube_instance_url_title">PeerTube instances</string>
|
<string name="peertube_instance_url_title">PeerTube instances</string>
|
||||||
<string name="peertube_instance_url_summary">Set your favorite peertube instances</string>
|
<string name="peertube_instance_url_summary">Set your favorite peertube instances</string>
|
||||||
<string name="peertube_instance_url_help">Find the instances that best suit you on https://instances.joinpeertube.org</string>
|
<string name="peertube_instance_url_help">Find the instances that best suit you on https://joinpeertube.org/instances#instances-list</string>
|
||||||
<string name="peertube_instance_add_title">Add instance</string>
|
<string name="peertube_instance_add_title">Add instance</string>
|
||||||
<string name="peertube_instance_add_help">enter instance url</string>
|
<string name="peertube_instance_add_help">Enter instance url</string>
|
||||||
<string name="peertube_instance_add_fail">Failed to validate instance</string>
|
<string name="peertube_instance_add_fail">Failed to validate instance</string>
|
||||||
|
<string name="peertube_instance_add_https_only">Only https urls are supported</string>
|
||||||
|
<string name="peertube_instance_add_exists">Instance already exists</string>
|
||||||
<string name="settings_category_player_title">Player</string>
|
<string name="settings_category_player_title">Player</string>
|
||||||
<string name="settings_category_player_behavior_title">Behavior</string>
|
<string name="settings_category_player_behavior_title">Behavior</string>
|
||||||
<string name="settings_category_video_audio_title">Video & audio</string>
|
<string name="settings_category_video_audio_title">Video & audio</string>
|
||||||
|
|
Loading…
Reference in New Issue