mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Some fixes
This commit is contained in:
		@@ -83,7 +83,7 @@ public class LoginActivity extends AppCompatActivity {
 | 
			
		||||
 | 
			
		||||
        SpannableString content_create = new SpannableString(getString(R.string.join_peertube));
 | 
			
		||||
        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);
 | 
			
		||||
        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();
 | 
			
		||||
                    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(() -> {
 | 
			
		||||
                    try {
 | 
			
		||||
                        actionToken = "/api/v1/oauth-clients/local";
 | 
			
		||||
 
 | 
			
		||||
@@ -319,9 +319,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
 | 
			
		||||
            Map.Entry<Integer, String> entryInt = privacyToSend.entrySet().iterator().next();
 | 
			
		||||
            privacy = entryInt.getValue();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        String category = null;
 | 
			
		||||
        if (categoryToSend != null) {
 | 
			
		||||
        if (categoryToSend != null && categoryToSend.entrySet().iterator().hasNext()) {
 | 
			
		||||
            Map.Entry<Integer, String> entryInt = categoryToSend.entrySet().iterator().next();
 | 
			
		||||
            category = entryInt.getValue();
 | 
			
		||||
        }
 | 
			
		||||
@@ -358,7 +357,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
 | 
			
		||||
            Iterator<Map.Entry<Integer, String>> it = privacies.entrySet().iterator();
 | 
			
		||||
            while (it.hasNext()) {
 | 
			
		||||
                Map.Entry<Integer, String> pair = it.next();
 | 
			
		||||
                if (pair.getValue().equals(privacy))
 | 
			
		||||
                if (pair.getValue().compareTo(privacy) == 0)
 | 
			
		||||
                    break;
 | 
			
		||||
                it.remove();
 | 
			
		||||
                privacyPosition++;
 | 
			
		||||
@@ -369,7 +368,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
 | 
			
		||||
            Iterator<Map.Entry<Integer, String>> it = licences.entrySet().iterator();
 | 
			
		||||
            while (it.hasNext()) {
 | 
			
		||||
                Map.Entry<Integer, String> pair = it.next();
 | 
			
		||||
                if (pair.getValue().equals(license))
 | 
			
		||||
                if (pair.getValue().compareTo(license) == 0)
 | 
			
		||||
                    break;
 | 
			
		||||
                it.remove();
 | 
			
		||||
                licensePosition++;
 | 
			
		||||
@@ -380,7 +379,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
 | 
			
		||||
            Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();
 | 
			
		||||
            while (it.hasNext()) {
 | 
			
		||||
                Map.Entry<Integer, String> pair = it.next();
 | 
			
		||||
                if (pair.getValue().equals(category))
 | 
			
		||||
                if (pair.getValue().compareTo(category) == 0)
 | 
			
		||||
                    break;
 | 
			
		||||
                it.remove();
 | 
			
		||||
                categoryPosition++;
 | 
			
		||||
 
 | 
			
		||||
@@ -377,8 +377,16 @@ public class PeertubeAPI {
 | 
			
		||||
                LinkedHashMap<Integer, String> category = new LinkedHashMap<>();
 | 
			
		||||
                LinkedHashMap<Integer, String> license = new LinkedHashMap<>();
 | 
			
		||||
                LinkedHashMap<Integer, String> privacy = new LinkedHashMap<>();
 | 
			
		||||
                category.put(resobj.getJSONObject("category").getInt("id"), resobj.getJSONObject("category").getString("label"));
 | 
			
		||||
                license.put(resobj.getJSONObject("licence").getInt("id"), resobj.getJSONObject("licence").getString("label"));
 | 
			
		||||
                if (!resobj.getJSONObject("category").isNull("id")) {
 | 
			
		||||
                    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"));
 | 
			
		||||
                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.Pattern;
 | 
			
		||||
 | 
			
		||||
import app.fedilab.fedilabtube.R;
 | 
			
		||||
import app.fedilab.fedilabtube.helper.CustomQuoteSpan;
 | 
			
		||||
import app.fedilab.fedilabtube.helper.Helper;
 | 
			
		||||
import app.fedilab.fedilabtube.viewmodel.FeedsVM;
 | 
			
		||||
 
 | 
			
		||||
@@ -692,10 +692,10 @@ public class Helper {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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() {
 | 
			
		||||
        return BuildConfig.full_instances?R.color.colorPrimary_full:R.color.colorPrimary;
 | 
			
		||||
        return BuildConfig.full_instances ? R.color.colorPrimary_full : R.color.colorPrimary;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user