Small fix
This commit is contained in:
parent
a1790bf32d
commit
e78e7a6f97
|
@ -16,9 +16,7 @@ package app.fedilab.fedilabtube;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
@ -45,7 +43,6 @@ import java.util.regex.Pattern;
|
|||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.entities.AccountCreation;
|
||||
import app.fedilab.fedilabtube.client.entities.Peertube;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
@ -130,7 +127,7 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTextAgreement();
|
||||
signup.setOnClickListener(view -> {
|
||||
error_message.setVisibility(View.GONE);
|
||||
if (username.getText() == null || email.getText() == null || password.getText() == null || password_confirm.getText() == null || username.getText().toString().trim().length() == 0 || email.getText().toString().trim().length() == 0 ||
|
||||
|
@ -169,6 +166,11 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||
} else {
|
||||
instance = "";
|
||||
}
|
||||
login_instance.setOnFocusChangeListener((view1, focus) -> {
|
||||
if (!focus) {
|
||||
setTextAgreement();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String host = emailArray[1];
|
||||
instance = Helper.getPeertubeUrl(host);
|
||||
|
@ -228,22 +230,6 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||
|
||||
});
|
||||
|
||||
TextView agreement_text = findViewById(R.id.agreement_text);
|
||||
String tos = getString(R.string.tos);
|
||||
String serverrules = getString(R.string.server_rules);
|
||||
String content_agreement;
|
||||
if (BuildConfig.full_instances) {
|
||||
content_agreement = getString(R.string.agreement_check_peertube,
|
||||
"<a href='https://" + instance + "/about/instance#terms-section' >" + tos + "</a>"
|
||||
);
|
||||
} else {
|
||||
content_agreement = getString(R.string.agreement_check,
|
||||
"<a href='https://apps.education.fr/cgu#peertube' >" + serverrules + "</a>",
|
||||
"<a href='https://apps.education.fr/bonnes-pratiques/' >" + tos + "</a>"
|
||||
);
|
||||
}
|
||||
agreement_text.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
agreement_text.setText(Html.fromHtml(content_agreement));
|
||||
setTitle(R.string.create_an_account);
|
||||
}
|
||||
|
||||
|
@ -271,8 +257,34 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
|||
String instance = String.valueOf(data.getData());
|
||||
login_instance.setText(instance);
|
||||
login_instance.setSelection(instance.length());
|
||||
setTextAgreement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextAgreement() {
|
||||
TextView agreement_text = findViewById(R.id.agreement_text);
|
||||
String tos = getString(R.string.tos);
|
||||
String serverrules = getString(R.string.server_rules);
|
||||
String content_agreement = null;
|
||||
agreement_text.setMovementMethod(null);
|
||||
agreement_text.setText(null);
|
||||
if (BuildConfig.full_instances) {
|
||||
if (login_instance.getText() != null) {
|
||||
content_agreement = getString(R.string.agreement_check_peertube,
|
||||
"<a href='https://" + login_instance.getText().toString() + "/about/instance#terms-section' >" + tos + "</a>"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
content_agreement = getString(R.string.agreement_check,
|
||||
"<a href='https://apps.education.fr/cgu#peertube' >" + serverrules + "</a>",
|
||||
"<a href='https://apps.education.fr/bonnes-pratiques/' >" + tos + "</a>"
|
||||
);
|
||||
}
|
||||
agreement_text.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (content_agreement != null) {
|
||||
agreement_text.setText(Html.fromHtml(content_agreement));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue