private TextView preferredAccountsFilter;
private TextInputLayout preferredAccountsFilterLayout;
private View huePickerView;
+ private View insecureWarningText;
/**
* Mandatory empty constructor for the fragment manager to instantiate the
preferredAccountsFilter = rootView.findViewById(R.id.preferred_accounts_filter_filter);
preferredAccountsFilterLayout =
rootView.findViewById(R.id.preferred_accounts_accounts_filter_layout);
+ insecureWarningText = rootView.findViewById(R.id.insecure_scheme_text);
+
+ url.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+ }
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+ }
+ @Override
+ public void afterTextChanged(Editable s) {
+ checkInsecureSchemeWithAuth();
+ }
+ });
useAuthentication.setOnCheckedChangeListener((buttonView, isChecked) -> {
debug("profiles", isChecked ? "auth enabled " : "auth disabled");
authParams.setVisibility(isChecked ? View.VISIBLE : View.GONE);
if (isChecked) userName.requestFocus();
+ checkInsecureSchemeWithAuth();
});
postingPermitted.setOnCheckedChangeListener(
});
return rootView;
}
+ private void checkInsecureSchemeWithAuth() {
+ boolean showWarning = false;
+
+ if (useAuthentication.isChecked()) {
+ String urlText = url.getText().toString();
+ if (urlText.startsWith("http") && !urlText.startsWith("https")) showWarning = true;
+ }
+
+ if (showWarning) insecureWarningText.setVisibility(View.VISIBLE);
+ else insecureWarningText.setVisibility(View.GONE);
+ }
private void hookClearErrorOnFocusListener(TextView view, TextInputLayout layout) {
view.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) layout.setError(null);
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="8dp"
+ android:animateLayoutChanges="true"
tools:ignore="RtlSymmetry">
+ <LinearLayout
+ android:id="@+id/insecure_scheme_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/activity_vertical_margin"
+ android:background="@color/error_background"
+ android:padding="@dimen/activity_vertical_margin"
+ android:visibility="gone">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/insecure_scheme_with_auth" />
+ </LinearLayout>
+
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/auth_user_name_layout"
android:layout_width="match_parent"