mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-649 App | Fix | Disable login button on an empty field (#2777)
This commit is contained in:
parent
b6479e9bb2
commit
184305bc2c
8 changed files with 54 additions and 22 deletions
|
@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.BuildConfig
|
||||
import com.anytypeio.anytype.R
|
||||
|
@ -87,6 +88,9 @@ class KeychainLoginFragment :
|
|||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
binding.keychainInputField.addTextChangedListener { text ->
|
||||
binding.loginButton.isEnabled = text?.trim()?.isNotEmpty() == true
|
||||
}
|
||||
binding.loginButton.setOnClickListener {
|
||||
vm.onLoginClicked(
|
||||
chain = binding.keychainInputField.text.trim().toString()
|
||||
|
@ -113,6 +117,7 @@ class KeychainLoginFragment :
|
|||
.initiateScan()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
|
||||
if (result != null && result.contents != null) {
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
android:layout_height="@dimen/auth_default_button_height"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="@dimen/auth_default_margin_end"
|
||||
android:enabled="false"
|
||||
android:text="@string/login"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/backButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
14
build.gradle
14
build.gradle
|
@ -15,10 +15,24 @@ buildscript {
|
|||
ext.version_code = 1
|
||||
ext.test_runner = 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
def githubProperties = new Properties()
|
||||
def githubPropertiesFile = file("$rootDir${File.separator}github.properties")
|
||||
githubProperties.load(new FileInputStream(githubPropertiesFile))
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://maven.pkg.github.com/anytypeio/go-anytype-middleware")
|
||||
credentials {
|
||||
username = githubProperties['gpr.usr']
|
||||
password = githubProperties['gpr.key']
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
def libs = project.extensions.getByName("libs") as org.gradle.accessors.dm.LibrariesForLibs
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/glyph_accent" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/glyph_accent" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</ripple>
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#F55522" />
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F55522" />
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</ripple>
|
|
@ -1,8 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/shape_primary" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/shape_transparent" />
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/background_primary" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</ripple>
|
|
@ -765,7 +765,7 @@
|
|||
<item name="android:textSize">17sp</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:stateListAnimator">@animator/scale_shrink</item>
|
||||
<item name="android:background">@drawable/rectangle_default_button</item>
|
||||
<item name="android:background">@drawable/rectangle_default_button_selector</item>
|
||||
</style>
|
||||
|
||||
<style name="DefaultRedButtonStyle">
|
||||
|
|
|
@ -61,9 +61,6 @@ class KeychainLoginViewModel(
|
|||
}
|
||||
|
||||
private fun proceedWithRecoveringWallet(chain: String) {
|
||||
|
||||
val startTime = System.currentTimeMillis()
|
||||
|
||||
state.postValue(ViewState.Loading)
|
||||
|
||||
recoverWallet.invoke(
|
||||
|
@ -73,7 +70,6 @@ class KeychainLoginViewModel(
|
|||
mnemonic = chain
|
||||
)
|
||||
) { result ->
|
||||
val middleTime = System.currentTimeMillis()
|
||||
result.either(
|
||||
fnR = {
|
||||
state.postValue(ViewState.Success(true))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue