Some fixes
This commit is contained in:
parent
3e694b8ac2
commit
a87ec4ffa5
|
@ -83,7 +83,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
|
|
||||||
SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
|
SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
|
||||||
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
content_create.setSpan(new UnderlineSpan(), 0, content_create.length(), 0);
|
||||||
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, Helper.getColorAccent())), 0, content_create.length(),
|
content_create.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, Helper.getColorAccent())), 0, content_create.length(),
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
create_an_account_peertube.setText(content_create);
|
create_an_account_peertube.setText(content_create);
|
||||||
|
|
||||||
|
@ -155,11 +155,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
Toasty.error(LoginActivity.this, getString(R.string.not_valide_instance)).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
instance = host = login_instance.getText().toString();
|
instance = host = login_instance.getText().toString().trim().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Arrays.asList(Helper.openid).contains(host) || !BuildConfig.full_instances) {
|
if (Arrays.asList(Helper.openid).contains(host) && !BuildConfig.full_instances) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
actionToken = "/api/v1/oauth-clients/local";
|
actionToken = "/api/v1/oauth-clients/local";
|
||||||
|
|
|
@ -319,9 +319,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
Map.Entry<Integer, String> entryInt = privacyToSend.entrySet().iterator().next();
|
Map.Entry<Integer, String> entryInt = privacyToSend.entrySet().iterator().next();
|
||||||
privacy = entryInt.getValue();
|
privacy = entryInt.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
String category = null;
|
String category = null;
|
||||||
if (categoryToSend != null) {
|
if (categoryToSend != null && categoryToSend.entrySet().iterator().hasNext()) {
|
||||||
Map.Entry<Integer, String> entryInt = categoryToSend.entrySet().iterator().next();
|
Map.Entry<Integer, String> entryInt = categoryToSend.entrySet().iterator().next();
|
||||||
category = entryInt.getValue();
|
category = entryInt.getValue();
|
||||||
}
|
}
|
||||||
|
@ -358,7 +357,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
|
Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Integer, String> pair = it.next();
|
Map.Entry<Integer, String> pair = it.next();
|
||||||
if (pair.getValue().equals(privacy))
|
if (pair.getValue().compareTo(privacy) == 0)
|
||||||
break;
|
break;
|
||||||
it.remove();
|
it.remove();
|
||||||
privacyPosition++;
|
privacyPosition++;
|
||||||
|
@ -369,7 +368,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
Iterator<Map.Entry<Integer, String>> it = licences.entrySet().iterator();
|
Iterator<Map.Entry<Integer, String>> it = licences.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Integer, String> pair = it.next();
|
Map.Entry<Integer, String> pair = it.next();
|
||||||
if (pair.getValue().equals(license))
|
if (pair.getValue().compareTo(license) == 0)
|
||||||
break;
|
break;
|
||||||
it.remove();
|
it.remove();
|
||||||
licensePosition++;
|
licensePosition++;
|
||||||
|
@ -380,7 +379,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
|
||||||
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Integer, String> pair = it.next();
|
Map.Entry<Integer, String> pair = it.next();
|
||||||
if (pair.getValue().equals(category))
|
if (pair.getValue().compareTo(category) == 0)
|
||||||
break;
|
break;
|
||||||
it.remove();
|
it.remove();
|
||||||
categoryPosition++;
|
categoryPosition++;
|
||||||
|
|
|
@ -377,8 +377,16 @@ public class PeertubeAPI {
|
||||||
LinkedHashMap<Integer, String> category = new LinkedHashMap<>();
|
LinkedHashMap<Integer, String> category = new LinkedHashMap<>();
|
||||||
LinkedHashMap<Integer, String> license = new LinkedHashMap<>();
|
LinkedHashMap<Integer, String> license = new LinkedHashMap<>();
|
||||||
LinkedHashMap<Integer, String> privacy = new LinkedHashMap<>();
|
LinkedHashMap<Integer, String> privacy = new LinkedHashMap<>();
|
||||||
category.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").getString("label"));
|
if (!resobj.getJSONObject("category").isNull("id")) {
|
||||||
license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").getString("label"));
|
license.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").getString("label"));
|
||||||
|
} else {
|
||||||
|
license.put(1, resobj.getJSONObject("category").getString("label"));
|
||||||
|
}
|
||||||
|
if (!resobj.getJSONObject("licence").isNull("id")) {
|
||||||
|
license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").getString("label"));
|
||||||
|
} else {
|
||||||
|
license.put(1, resobj.getJSONObject("licence").getString("label"));
|
||||||
|
}
|
||||||
privacy.put(resobj.getJSONObject("privacy").getInt("id"), resobj.getJSONObject("privacy").getString("label"));
|
privacy.put(resobj.getJSONObject("privacy").getInt("id"), resobj.getJSONObject("privacy").getString("label"));
|
||||||
langue.put(resobj.getJSONObject("language").getString("id"), resobj.getJSONObject("language").get("label").toString());
|
langue.put(resobj.getJSONObject("language").getString("id"), resobj.getJSONObject("language").get("label").toString());
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ import java.util.Objects;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import app.fedilab.fedilabtube.R;
|
|
||||||
import app.fedilab.fedilabtube.helper.CustomQuoteSpan;
|
import app.fedilab.fedilabtube.helper.CustomQuoteSpan;
|
||||||
import app.fedilab.fedilabtube.helper.Helper;
|
import app.fedilab.fedilabtube.helper.Helper;
|
||||||
import app.fedilab.fedilabtube.viewmodel.FeedsVM;
|
import app.fedilab.fedilabtube.viewmodel.FeedsVM;
|
||||||
|
|
|
@ -692,10 +692,10 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getColorAccent() {
|
public static int getColorAccent() {
|
||||||
return BuildConfig.full_instances?R.color.colorAccent_full:R.color.colorAccent;
|
return BuildConfig.full_instances ? R.color.colorAccent_full : R.color.colorAccent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getColorPrimary() {
|
public static int getColorPrimary() {
|
||||||
return BuildConfig.full_instances?R.color.colorPrimary_full:R.color.colorPrimary;
|
return BuildConfig.full_instances ? R.color.colorPrimary_full : R.color.colorPrimary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue