Fix login activity layout (#381)
This commit is contained in:
parent
b9e91f30ef
commit
cedb207eca
@ -14,7 +14,6 @@ import android.view.MenuItem
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi
|
||||||
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse
|
||||||
import apps.amine.bou.readerforselfoss.databinding.ActivityLoginBinding
|
import apps.amine.bou.readerforselfoss.databinding.ActivityLoginBinding
|
||||||
@ -22,7 +21,6 @@ import apps.amine.bou.readerforselfoss.themes.AppColors
|
|||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid
|
||||||
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible
|
||||||
import com.mikepenz.aboutlibraries.Libs
|
|
||||||
import com.mikepenz.aboutlibraries.LibsBuilder
|
import com.mikepenz.aboutlibraries.LibsBuilder
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
@ -91,16 +89,16 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
isWithLogin = !isWithLogin
|
isWithLogin = !isWithLogin
|
||||||
val visi: Int = if (b) View.VISIBLE else View.GONE
|
val visi: Int = if (b) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.loginLayout.visibility = visi
|
binding.loginView.visibility = visi
|
||||||
binding.passwordLayout.visibility = visi
|
binding.passwordView.visibility = visi
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.withHttpLogin.setOnCheckedChangeListener { _, b ->
|
binding.withHttpLogin.setOnCheckedChangeListener { _, b ->
|
||||||
isWithHTTPLogin = !isWithHTTPLogin
|
isWithHTTPLogin = !isWithHTTPLogin
|
||||||
val visi: Int = if (b) View.VISIBLE else View.GONE
|
val visi: Int = if (b) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
binding.httpLoginInput.visibility = visi
|
binding.httpLoginView.visibility = visi
|
||||||
binding.httpPasswordInput.visibility = visi
|
binding.httpPasswordView.visibility = visi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,9 +109,8 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
alertDialog.setMessage(getString(R.string.base_url_error))
|
alertDialog.setMessage(getString(R.string.base_url_error))
|
||||||
alertDialog.setButton(
|
alertDialog.setButton(
|
||||||
AlertDialog.BUTTON_NEUTRAL,
|
AlertDialog.BUTTON_NEUTRAL,
|
||||||
"OK",
|
"OK"
|
||||||
{ dialog, _ -> dialog.dismiss() }
|
) { dialog, _ -> dialog.dismiss() }
|
||||||
)
|
|
||||||
alertDialog.show()
|
alertDialog.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,9 +151,8 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
alertDialog.setMessage(getString(R.string.text_wrong_url))
|
alertDialog.setMessage(getString(R.string.text_wrong_url))
|
||||||
alertDialog.setButton(
|
alertDialog.setButton(
|
||||||
AlertDialog.BUTTON_NEUTRAL,
|
AlertDialog.BUTTON_NEUTRAL,
|
||||||
"OK",
|
"OK"
|
||||||
{ dialog, _ -> dialog.dismiss() }
|
) { dialog, _ -> dialog.dismiss() }
|
||||||
)
|
|
||||||
alertDialog.show()
|
alertDialog.show()
|
||||||
inValidCount = 0
|
inValidCount = 0
|
||||||
}
|
}
|
||||||
|
@ -45,98 +45,69 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<EditText
|
||||||
|
android:id="@+id/urlView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/urlLayout"
|
android:hint="@string/prompt_url"
|
||||||
>
|
android:imeOptions="actionUnspecified"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:maxLines="1" />
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/urlView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/prompt_url"
|
|
||||||
android:imeOptions="actionUnspecified"
|
|
||||||
android:inputType="textUri"
|
|
||||||
android:maxLines="1" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:text="@string/withLoginSwitch"
|
android:text="@string/withLoginSwitch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:id="@+id/withLogin"
|
android:id="@+id/withLogin"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<EditText
|
||||||
android:id="@+id/loginLayout"
|
android:id="@+id/loginView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:autofillHints="username"
|
||||||
|
android:hint="@string/prompt_login"
|
||||||
|
android:inputType="text"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<EditText
|
||||||
android:id="@+id/loginView"
|
android:id="@+id/passwordView"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/prompt_login"
|
|
||||||
android:inputType="text"
|
|
||||||
android:maxLines="1" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/passwordLayout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:autofillHints="password"
|
||||||
|
android:hint="@string/prompt_password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/passwordView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/prompt_password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:maxLines="1" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:id="@+id/withHttpLogin"
|
android:id="@+id/withHttpLogin"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/withHttpLoginSwitch" />
|
android:text="@string/withHttpLoginSwitch" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<EditText
|
||||||
android:id="@+id/httpLoginInput"
|
android:id="@+id/httpLoginView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:autofillHints="username"
|
||||||
|
android:hint="@string/prompt_http_login"
|
||||||
|
android:inputType="text"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:inputType="text"
|
android:id="@+id/httpPasswordView"
|
||||||
android:id="@+id/httpLoginView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/prompt_http_login" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/httpPasswordInput"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone">
|
android:autofillHints="password"
|
||||||
|
android:hint="@string/prompt_http_password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/httpPasswordView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/prompt_http_password"
|
|
||||||
android:inputType="textPassword" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:id="@+id/withSelfhostedCert"
|
android:id="@+id/withSelfhostedCert"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -155,8 +126,8 @@
|
|||||||
style="?android:textAppearanceSmall"
|
style="?android:textAppearanceSmall"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
android:text="@string/action_sign_in"
|
android:text="@string/action_sign_in"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user