mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 13:57:47 +00:00
fix(app): address UI inconsistencies in proxy configuration screen
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.proxy.ProxySelectorActivity"
|
android:name=".ui.proxy.ProxySelectorActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
android:label="@string/activity_proxy_label"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
@@ -12,6 +12,7 @@ import android.os.Bundle
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.util.Patterns
|
import android.util.Patterns
|
||||||
|
import android.view.MenuItem
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.core.os.postDelayed
|
import androidx.core.os.postDelayed
|
||||||
@@ -27,8 +28,6 @@ import app.passwordstore.util.settings.PreferenceKeys
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private val WEB_ADDRESS_REGEX = Patterns.WEB_URL.toRegex()
|
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class ProxySelectorActivity : AppCompatActivity() {
|
class ProxySelectorActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@@ -36,9 +35,11 @@ class ProxySelectorActivity : AppCompatActivity() {
|
|||||||
@ProxyPreferences @Inject lateinit var proxyPrefs: SharedPreferences
|
@ProxyPreferences @Inject lateinit var proxyPrefs: SharedPreferences
|
||||||
@Inject lateinit var proxyUtils: ProxyUtils
|
@Inject lateinit var proxyUtils: ProxyUtils
|
||||||
private val binding by viewBinding(ActivityProxySelectorBinding::inflate)
|
private val binding by viewBinding(ActivityProxySelectorBinding::inflate)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
with(binding) {
|
with(binding) {
|
||||||
proxyHost.setText(proxyPrefs.getString(PreferenceKeys.PROXY_HOST))
|
proxyHost.setText(proxyPrefs.getString(PreferenceKeys.PROXY_HOST))
|
||||||
proxyUser.setText(proxyPrefs.getString(PreferenceKeys.PROXY_USERNAME))
|
proxyUser.setText(proxyPrefs.getString(PreferenceKeys.PROXY_USERNAME))
|
||||||
@@ -61,6 +62,16 @@ class ProxySelectorActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
when (item.itemId) {
|
||||||
|
android.R.id.home -> {
|
||||||
|
onBackPressedDispatcher.onBackPressed()
|
||||||
|
}
|
||||||
|
else -> return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
private fun isNumericAddress(text: CharSequence): Boolean {
|
private fun isNumericAddress(text: CharSequence): Boolean {
|
||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
InetAddresses.isNumericAddress(text as String)
|
InetAddresses.isNumericAddress(text as String)
|
||||||
@@ -91,4 +102,8 @@ class ProxySelectorActivity : AppCompatActivity() {
|
|||||||
proxyUtils.setDefaultProxy()
|
proxyUtils.setDefaultProxy()
|
||||||
Handler(Looper.getMainLooper()).postDelayed(500) { finish() }
|
Handler(Looper.getMainLooper()).postDelayed(500) { finish() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
private val WEB_ADDRESS_REGEX = Patterns.WEB_URL.toRegex()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -344,6 +344,7 @@
|
|||||||
<string name="git_scheme_disallowed_message">The git protocol provided by git-daemon performs no transport encryption and is unsuitable for secure operations.</string>
|
<string name="git_scheme_disallowed_message">The git protocol provided by git-daemon performs no transport encryption and is unsuitable for secure operations.</string>
|
||||||
|
|
||||||
<!-- Proxy configuration activity -->
|
<!-- Proxy configuration activity -->
|
||||||
|
<string name="activity_proxy_label">Proxy settings</string>
|
||||||
<string name="proxy_hostname">Proxy hostname</string>
|
<string name="proxy_hostname">Proxy hostname</string>
|
||||||
<string name="port">Port</string>
|
<string name="port">Port</string>
|
||||||
<string name="pref_edit_proxy_settings">HTTP(S) proxy settings</string>
|
<string name="pref_edit_proxy_settings">HTTP(S) proxy settings</string>
|
||||||
|
Reference in New Issue
Block a user