Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.security.KeyChain
import android.view.KeyEvent
import android.view.View
import android.view.View.INVISIBLE
import android.view.WindowManager.LayoutParams.FLAG_SECURE
import android.view.inputmethod.EditorInfo
import android.widget.PopupMenu
import androidx.appcompat.app.AppCompatActivity
import androidx.browser.customtabs.CustomTabsIntent
Expand Down Expand Up @@ -274,6 +276,8 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted

binding.embeddedCheckServerButton.setOnClickListener { checkOcServer() }

setupHostUrlEnterAction()

binding.connectionOptionsButton.setOnClickListener { showConnectionMenu(it) }

binding.loginButton.setOnClickListener {
Expand Down Expand Up @@ -534,6 +538,23 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted
binding.webfingerStatusText.isVisible = true
}

// ENTER (hardware key) and the soft-keyboard action (Go / Done checkmark) run the ">" check.
private fun setupHostUrlEnterAction() {
binding.hostUrlInput.setOnEditorActionListener { _, actionId, event ->
val imeActionTriggered = actionId == EditorInfo.IME_ACTION_GO ||
actionId == EditorInfo.IME_ACTION_DONE ||
actionId == EditorInfo.IME_ACTION_SEND
val hardwareEnterPressed =
event?.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN
if (imeActionTriggered || hardwareEnterPressed) {
checkOcServer()
true
} else {
false
}
}
}

private fun checkOcServer() {
val uri = binding.hostUrlInput.text.toString().trim()
if (uri.isNotEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions opencloudApp/src/main/res/layout/account_setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
android:layout_gravity="bottom"
android:drawablePadding="5dp"
android:hint="@string/auth_host_url"
android:imeOptions="actionGo"
android:inputType="textUri"
android:paddingEnd="55dp"
android:theme="@style/Theme.openCloud.Authenticator.EditText">
Expand Down
Loading