diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-01-26 12:14:11 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-01-26 12:17:08 +0530 |
commit | e17a17a8e840230651cb6f7d9f9d46e252637e77 (patch) | |
tree | 87f8d2a96f9e09f2db75ba7eeeafad2b1c5701ea /app/src/main/java | |
parent | 448ed3e57549ad44a8e444d283398aaa78c92ac0 (diff) |
fix(app): address UI inconsistencies in proxy configuration screen
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/app/passwordstore/ui/proxy/ProxySelectorActivity.kt | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/proxy/ProxySelectorActivity.kt b/app/src/main/java/app/passwordstore/ui/proxy/ProxySelectorActivity.kt index f7833a1c..833f14c7 100644 --- a/app/src/main/java/app/passwordstore/ui/proxy/ProxySelectorActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/proxy/ProxySelectorActivity.kt @@ -12,6 +12,7 @@ import android.os.Bundle import android.os.Handler import android.os.Looper import android.util.Patterns +import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity import androidx.core.content.edit import androidx.core.os.postDelayed @@ -27,8 +28,6 @@ import app.passwordstore.util.settings.PreferenceKeys import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject -private val WEB_ADDRESS_REGEX = Patterns.WEB_URL.toRegex() - @AndroidEntryPoint class ProxySelectorActivity : AppCompatActivity() { @@ -36,9 +35,11 @@ class ProxySelectorActivity : AppCompatActivity() { @ProxyPreferences @Inject lateinit var proxyPrefs: SharedPreferences @Inject lateinit var proxyUtils: ProxyUtils private val binding by viewBinding(ActivityProxySelectorBinding::inflate) + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(binding.root) + supportActionBar?.setDisplayHomeAsUpEnabled(true) with(binding) { proxyHost.setText(proxyPrefs.getString(PreferenceKeys.PROXY_HOST)) 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 { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { InetAddresses.isNumericAddress(text as String) @@ -91,4 +102,8 @@ class ProxySelectorActivity : AppCompatActivity() { proxyUtils.setDefaultProxy() Handler(Looper.getMainLooper()).postDelayed(500) { finish() } } + + private companion object { + private val WEB_ADDRESS_REGEX = Patterns.WEB_URL.toRegex() + } } |