Skip to content

Commit 7f9f670

Browse files
dependabot[bot]Okuro3499
authored andcommitted
actions: bump kotlin_version to 1.9.22 (fixes #1877) (#1870)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gideon Okuro <[email protected]>
1 parent 732a32f commit 7f9f670

File tree

6 files changed

+76
-66
lines changed

6 files changed

+76
-66
lines changed

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43
def appVersionCode = (System.env.GITHUB_RUN_NUMBER ? Integer.valueOf(System.env.GITHUB_RUN_NUMBER) : 2) + 6050
54
def appVersionName = (System.env.GITHUB_RUN_NUMBER ? Integer.valueOf(System.env.GITHUB_RUN_NUMBER) + 6050: "1.0.0") + ""
65

app/src/main/kotlin/io/treehouses/remote/fragments/DiscoverFragment.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ import android.widget.ImageView
1515
import android.widget.LinearLayout
1616
import com.parse.Parse.getApplicationContext
1717
import io.treehouses.remote.Constants
18-
import io.treehouses.remote.fragments.dialogfragments.RPIDialogFragment
19-
import io.treehouses.remote.interfaces.FragmentDialogInterface
2018
import io.treehouses.remote.R
2119
import io.treehouses.remote.bases.BaseFragment
2220
import io.treehouses.remote.databinding.ActivityDiscoverFragmentBinding
21+
import io.treehouses.remote.fragments.dialogfragments.RPIDialogFragment
22+
import io.treehouses.remote.interfaces.FragmentDialogInterface
2323
import io.treehouses.remote.utils.logD
2424
import io.treehouses.remote.utils.logE
25-
import kotlinx.android.synthetic.main.activity_discover_fragment.view.*
2625
import kotlin.math.PI
2726
import kotlin.math.cos
2827
import kotlin.math.sin
@@ -124,7 +123,7 @@ class DiscoverFragment : BaseFragment(), FragmentDialogInterface {
124123
}
125124

126125
private fun updateGatewayIcon() {
127-
val gatewayIcon = bind.gatewayContainer.gateway_icon
126+
val gatewayIcon = bind.gatewayIcon
128127
bind.gatewayContainer.removeView(gatewayIcon)
129128

130129

app/src/main/kotlin/io/treehouses/remote/ui/network/NetworkFragment.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import io.treehouses.remote.R
2020
import io.treehouses.remote.Tutorials
2121
import io.treehouses.remote.bases.BaseFragment
2222
import io.treehouses.remote.databinding.ActivityNetworkFragmentBinding
23+
import io.treehouses.remote.databinding.DialogSpeedtestBinding
2324
import io.treehouses.remote.fragments.DiscoverFragment
2425
import io.treehouses.remote.fragments.dialogfragments.WifiDialogFragment
2526
import io.treehouses.remote.interfaces.FragmentDialogInterface
@@ -29,14 +30,14 @@ import io.treehouses.remote.ui.network.bottomsheetdialogs.EthernetBottomSheet
2930
import io.treehouses.remote.ui.network.bottomsheetdialogs.HotspotBottomSheet
3031
import io.treehouses.remote.ui.network.bottomsheetdialogs.WifiBottomSheet
3132
import io.treehouses.remote.utils.Utils
32-
import kotlinx.android.synthetic.main.dialog_speedtest.*
3333
open class NetworkFragment : BaseFragment(), View.OnClickListener, FragmentDialogInterface {
3434
private lateinit var binding: ActivityNetworkFragmentBinding
3535
private lateinit var speedDialog: Dialog
3636
private lateinit var speedDialogDismiss: Button
3737
private lateinit var speedDialogTest: Button
3838
private var speedDialogCheck: Boolean = false
3939
protected val viewModel: NetworkViewModel by viewModels(ownerProducer = { this })
40+
lateinit var dialogSpeedtestBinding: DialogSpeedtestBinding
4041
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
4142
binding = ActivityNetworkFragmentBinding.inflate(inflater, container, false)
4243
loadObservers()
@@ -94,8 +95,8 @@ open class NetworkFragment : BaseFragment(), View.OnClickListener, FragmentDialo
9495
binding.speedTest == v -> speedTest()
9596
binding.reverseLookup == v -> reverseLookup()
9697
binding.discoverBtn == v -> listener.openCallFragment(DiscoverFragment())
97-
speedDialog.speedBtnTest == v -> viewModel.treehousesInternet()
98-
speedDialog.speedBtnDismiss == v -> speedDialog.dismiss()
98+
dialogSpeedtestBinding.speedBtnTest == v -> viewModel.treehousesInternet()
99+
dialogSpeedtestBinding.speedBtnDismiss == v -> speedDialog.dismiss()
99100
}
100101
}
101102

@@ -130,11 +131,12 @@ open class NetworkFragment : BaseFragment(), View.OnClickListener, FragmentDialo
130131

131132
private fun initializeSpeedDialog() {
132133
speedDialog = Dialog(requireContext())
133-
speedDialog.setContentView(R.layout.dialog_speedtest)
134+
dialogSpeedtestBinding = DialogSpeedtestBinding.inflate(layoutInflater)
135+
speedDialog.setContentView(dialogSpeedtestBinding.root)
134136
speedDialogDismiss = speedDialog.findViewById(R.id.speedBtnDismiss); speedDialogTest = speedDialog.findViewById(R.id.speedBtnTest)
135137
speedDialogDismiss.setOnClickListener(this); speedDialogTest.setOnClickListener(this)
136138
viewModel.downloadUpload.observe(viewLifecycleOwner, Observer {
137-
speedDialog.speed_text.text = it
139+
dialogSpeedtestBinding.speedText.text = it
138140
})
139141
viewModel.dialogCheck.observe(viewLifecycleOwner, Observer {
140142
speedDialogCheck = it

app/src/main/kotlin/io/treehouses/remote/ui/sshtunnel/SSHTunnelFragment.kt

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import io.treehouses.remote.Constants
1515
import io.treehouses.remote.R
1616
import io.treehouses.remote.Tutorials
1717
import io.treehouses.remote.databinding.ActivityTunnelSshFragmentBinding
18+
import io.treehouses.remote.databinding.DialogSshtunnelHostsBinding
19+
import io.treehouses.remote.databinding.DialogSshtunnelKeyBinding
20+
import io.treehouses.remote.databinding.DialogSshtunnelPortsBinding
1821
import io.treehouses.remote.pojo.enum.Status
1922
import io.treehouses.remote.utils.*
20-
import kotlinx.android.synthetic.main.dialog_sshtunnel_hosts.*
21-
import kotlinx.android.synthetic.main.dialog_sshtunnel_key.*
22-
import kotlinx.android.synthetic.main.dialog_sshtunnel_ports.*
2323

2424
class SSHTunnelFragment : BaseSSHTunnelFragment() {
25-
25+
lateinit var dialogSshTunnelPortsBinding: DialogSshtunnelPortsBinding
26+
lateinit var dialogSshTunnelKeyBinding: DialogSshtunnelKeyBinding
27+
lateinit var dialogSshTunnelHostsBinding: DialogSshtunnelHostsBinding
2628

2729
@RequiresApi(Build.VERSION_CODES.N)
2830
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@@ -45,7 +47,7 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
4547
handlePhoneKeySave(it.data)
4648
if (it.data!!.showHandlePiKeySaveDialog)
4749
handlePiKeySave(it.data.profile, it.data.storedPublicKey, it.data.storedPrivateKey)
48-
}
50+
} else -> {}
4951
}
5052
})
5153
}
@@ -76,32 +78,32 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
7678
val dialog = builder.create();
7779
dialog.window!!.setBackgroundDrawableResource(android.R.color.transparent); dialog.show();
7880
}
79-
dialogPort.btn_adding_port.setOnClickListener { handleAddPort() }
80-
dialogHosts.btn_adding_host.setOnClickListener {
81-
val m1 = dialogHosts.PortNumberInput.text.toString()
82-
val m2 = dialogHosts.UserNameInput.text.toString() + "@" + dialogHosts.DomainIPInput.text.toString()
81+
dialogSshTunnelPortsBinding.btnAddingPort.setOnClickListener { handleAddPort() }
82+
dialogSshTunnelHostsBinding.btnAddingHost.setOnClickListener {
83+
val m1 = dialogSshTunnelHostsBinding.PortNumberInput.text.toString()
84+
val m2 = dialogSshTunnelHostsBinding.UserNameInput.text.toString() + "@" + dialogSshTunnelHostsBinding.DomainIPInput.text.toString()
8385
viewModel.addingHostButton(m1, m2)
8486
dialogHosts.dismiss()
8587
}
8688
}
8789

8890
private fun handleAddPort() {
89-
if (dialogPort.ExternalTextInput.text!!.isNotEmpty() && dialogPort.InternalTextInput.text!!.isNotEmpty()) {
90-
val parts = dialogPort.hosts?.selectedItem.toString().split(":")[0]
91-
viewModel.addingPortButton(dialogPort.InternalTextInput.text.toString(), dialogPort.ExternalTextInput.text.toString(), parts)
91+
if (dialogSshTunnelPortsBinding.ExternalTextInput.text!!.isNotEmpty() && dialogSshTunnelPortsBinding.InternalTextInput.text!!.isNotEmpty()) {
92+
val parts = dialogSshTunnelPortsBinding.hosts?.selectedItem.toString().split(":")[0]
93+
viewModel.addingPortButton(dialogSshTunnelPortsBinding.InternalTextInput.text.toString(), dialogSshTunnelPortsBinding.ExternalTextInput.text.toString(), parts)
9294
dialogPort.dismiss()
9395
}
9496
}
9597

9698
private fun addListeners2() {
97-
var profile = dialogKeys.findViewById<EditText>(R.id.sshtunnel_profile).text.toString()
98-
dialogKeys.btn_save_keys.setOnClickListener { viewModel.keyClickListener(profile); }
99-
dialogKeys.btn_show_keys.setOnClickListener {
99+
val profile = dialogKeys.findViewById<EditText>(R.id.sshtunnel_profile).text.toString()
100+
dialogSshTunnelKeyBinding.btnSaveKeys.setOnClickListener { viewModel.keyClickListener(profile); }
101+
dialogSshTunnelKeyBinding.btnShowKeys.setOnClickListener {
100102
viewModel.keyClickListener(profile); viewModel.handleShowKeys(profile)
101103
}
102-
dialogPort.addPortCloseButton.setOnClickListener { dialogPort.dismiss() }
103-
dialogHosts.addHostCloseButton.setOnClickListener { dialogHosts.dismiss() }
104-
dialogKeys.addKeyCloseButton.setOnClickListener { dialogKeys.dismiss() }
104+
dialogSshTunnelPortsBinding.addPortCloseButton.setOnClickListener { dialogPort.dismiss() }
105+
dialogSshTunnelHostsBinding.addHostCloseButton.setOnClickListener { dialogHosts.dismiss() }
106+
dialogSshTunnelKeyBinding.addKeyCloseButton.setOnClickListener { dialogKeys.dismiss() }
105107
bind.sshPorts.onItemClickListener = AdapterView.OnItemClickListener { _: AdapterView<*>?, _: View?, position: Int, _: Long ->
106108
handleDeletePort(position)
107109
}
@@ -133,32 +135,41 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
133135
bind.switchNotification.isEnabled = it.data.enableSwitchNotification; bind.btnAddHosts.text = it.data.addHostText
134136
bind.btnAddPort.text = it.data.addPortText; bind.btnAddPort.isEnabled = it.data.enableAddPort
135137
bind.btnAddHosts.isEnabled = it.data.enableAddHost; bind.sshPorts.isEnabled = it.data.enableSSHPort
136-
dialogKeys.public_key.text = it.data.publicKey; dialogKeys.private_key.text = it.data.privateKey
137-
dialogKeys.progress_bar.visibility = View.GONE
138+
dialogSshTunnelKeyBinding.publicKey.text = it.data.publicKey; dialogSshTunnelKeyBinding.privateKey.text = it.data.privateKey
139+
dialogSshTunnelKeyBinding.progressBar.visibility = View.GONE
138140
portsName = it.data.portNames; hostsName = it.data.hostNames
139141
adapter = TunnelUtils.getPortAdapter(requireContext(), portsName)
140142
bind.sshPorts.adapter = adapter
141143
adapter2 = ArrayAdapter(requireContext(), R.layout.support_simple_spinner_dropdown_item, hostsName!!)
142-
dialogPort.hosts.adapter = adapter2
144+
dialogSshTunnelPortsBinding.hosts.adapter = adapter2
143145
}
144146
Status.LOADING -> {
145147
if (it == null) return@Observer
146-
dialogKeys.progress_bar.visibility = View.VISIBLE
147-
}
148+
dialogSshTunnelKeyBinding.progressBar.visibility = View.VISIBLE
149+
} else -> {}
148150
}
149151
})
150152
}
151153

152154
@RequiresApi(Build.VERSION_CODES.N)
153155
private fun initializeDialog() {
154-
dialogPort = Dialog(requireContext()); dialogHosts = Dialog(requireContext()); dialogKeys = Dialog(requireContext())
155-
dialogPort.setContentView(R.layout.dialog_sshtunnel_ports); dialogHosts.setContentView(R.layout.dialog_sshtunnel_hosts)
156-
dialogKeys.setContentView(R.layout.dialog_sshtunnel_key)
157-
addHostSyntaxCheck(dialogHosts.UserNameInput, dialogHosts.TLusername, Constants.userRegex, Constants.hostError)
158-
addHostSyntaxCheck(dialogHosts.DomainIPInput, dialogHosts.TLdomain, Constants.domainRegex + "|" + Constants.ipRegex, Constants.domainIPError)
159-
addHostSyntaxCheck(dialogHosts.PortNumberInput, dialogHosts.TLportname, Constants.portRegex, Constants.portError)
160-
addPortSyntaxCheck(dialogPort.ExternalTextInput, dialogPort.TLexternal)
161-
addPortSyntaxCheck(dialogPort.InternalTextInput, dialogPort.TLinternal)
156+
dialogPort = Dialog(requireContext())
157+
dialogSshTunnelPortsBinding = DialogSshtunnelPortsBinding.inflate(layoutInflater)
158+
dialogPort.setContentView(dialogSshTunnelPortsBinding.root)
159+
160+
dialogHosts = Dialog(requireContext())
161+
dialogSshTunnelHostsBinding = DialogSshtunnelHostsBinding.inflate(layoutInflater)
162+
dialogHosts.setContentView(dialogSshTunnelHostsBinding.root)
163+
164+
dialogKeys = Dialog(requireContext())
165+
dialogSshTunnelKeyBinding = DialogSshtunnelKeyBinding.inflate(layoutInflater)
166+
dialogKeys.setContentView(dialogSshTunnelKeyBinding.root)
167+
168+
addHostSyntaxCheck(dialogSshTunnelHostsBinding.UserNameInput, dialogSshTunnelHostsBinding.TLusername, Constants.userRegex, Constants.hostError)
169+
addHostSyntaxCheck(dialogSshTunnelHostsBinding.DomainIPInput, dialogSshTunnelHostsBinding.TLdomain, Constants.domainRegex + "|" + Constants.ipRegex, Constants.domainIPError)
170+
addHostSyntaxCheck(dialogSshTunnelHostsBinding.PortNumberInput, dialogSshTunnelHostsBinding.TLportname, Constants.portRegex, Constants.portError)
171+
addPortSyntaxCheck(dialogSshTunnelPortsBinding.ExternalTextInput, dialogSshTunnelPortsBinding.TLexternal)
172+
addPortSyntaxCheck(dialogSshTunnelPortsBinding.InternalTextInput, dialogSshTunnelPortsBinding.TLinternal)
162173
viewModel.initializeArrays()
163174
val window = dialogPort.window;
164175
val windowHost = dialogHosts.window
@@ -176,17 +187,17 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
176187
// }
177188

178189
fun checkAddingHostButtonEnable() {
179-
if (dialogHosts.UserNameInput.editableText.isNotEmpty() && dialogHosts.DomainIPInput.editableText.isNotEmpty()
180-
&& dialogHosts.PortNumberInput.editableText.isNotEmpty())
181-
if (!dialogHosts.TLusername.isErrorEnabled && !dialogHosts.TLdomain.isErrorEnabled && !dialogHosts.TLportname.isErrorEnabled)
182-
dialogHosts.btn_adding_host.isEnabled = true
190+
if (dialogSshTunnelHostsBinding.UserNameInput.editableText.isNotEmpty() && dialogSshTunnelHostsBinding.DomainIPInput.editableText.isNotEmpty()
191+
&& dialogSshTunnelHostsBinding.PortNumberInput.editableText.isNotEmpty())
192+
if (!dialogSshTunnelHostsBinding.TLusername.isErrorEnabled && !dialogSshTunnelHostsBinding.TLdomain.isErrorEnabled && !dialogSshTunnelHostsBinding.TLportname.isErrorEnabled)
193+
dialogSshTunnelHostsBinding.btnAddingHost.isEnabled = true
183194

184195
}
185196

186197
fun checkAddingPortButtonEnable() {
187-
if (dialogPort.ExternalTextInput.editableText.isNotEmpty() && dialogPort.InternalTextInput.editableText.isNotEmpty())
188-
if (!dialogPort.TLexternal.isErrorEnabled && !dialogPort.TLinternal.isErrorEnabled)
189-
dialogPort.btn_adding_port.isEnabled = true
198+
if (dialogSshTunnelPortsBinding.ExternalTextInput.editableText.isNotEmpty() && dialogSshTunnelPortsBinding.InternalTextInput.editableText.isNotEmpty())
199+
if (!dialogSshTunnelPortsBinding.TLexternal.isErrorEnabled && !dialogSshTunnelPortsBinding.TLinternal.isErrorEnabled)
200+
dialogSshTunnelPortsBinding.btnAddingPort.isEnabled = true
190201
}
191202

192203
/*
@@ -198,10 +209,10 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
198209
override fun afterTextChanged(s: Editable?) {
199210
textInputLayout.isErrorEnabled = true
200211
if (s!!.isEmpty()) {
201-
dialogHosts.btn_adding_host.isEnabled = false
212+
dialogSshTunnelHostsBinding.btnAddingHost.isEnabled = false
202213
} else {
203214
if (!s!!.toString().matches(regex.toRegex())) {
204-
dialogHosts.btn_adding_host.isEnabled = false
215+
dialogSshTunnelHostsBinding.btnAddingHost.isEnabled = false
205216
textInputLayout.error = error
206217
} else {
207218
textInputLayout.isErrorEnabled = false
@@ -220,14 +231,14 @@ class SSHTunnelFragment : BaseSSHTunnelFragment() {
220231
override fun afterTextChanged(s: Editable?) {
221232
textInputLayout.isErrorEnabled = true
222233
if (s!!.isEmpty()) {
223-
dialogPort.btn_adding_port.isEnabled = false
234+
dialogSshTunnelPortsBinding.btnAddingPort.isEnabled = false
224235
} else {
225236
if (!s!!.toString().matches(Constants.portRegex.toRegex())) {
226-
dialogPort.btn_adding_port.isEnabled = false
237+
dialogSshTunnelPortsBinding.btnAddingPort.isEnabled = false
227238
textInputLayout.error = Constants.portError
228-
} else if (textInputEditText == dialogPort.ExternalTextInput && viewModel.searchArray(portsName, s!!.toString())) {
229-
dialogPort.btn_adding_port.isEnabled = false
230-
dialogPort.TLexternal.error = "Port number already exists"
239+
} else if (textInputEditText == dialogSshTunnelPortsBinding.ExternalTextInput && viewModel.searchArray(portsName, s!!.toString())) {
240+
dialogSshTunnelPortsBinding.btnAddingPort.isEnabled = false
241+
dialogSshTunnelPortsBinding.TLexternal.error = "Port number already exists"
231242
} else {
232243
textInputLayout.isErrorEnabled = false
233244
checkAddingPortButtonEnable()

app/src/main/kotlin/io/treehouses/remote/ui/status/StatusFragment.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package io.treehouses.remote.ui.status
33
import android.animation.ObjectAnimator
44
import android.app.Dialog
55
import android.content.Context
6-
import android.content.DialogInterface
76
import android.os.Bundle
87
import android.text.TextUtils
98
import android.view.LayoutInflater
@@ -20,10 +19,10 @@ import io.treehouses.remote.bases.BaseFragment
2019
import io.treehouses.remote.callback.NotificationCallback
2120
import io.treehouses.remote.databinding.ActivityStatusFragmentBinding
2221
import io.treehouses.remote.databinding.DialogRenameStatusBinding
22+
import io.treehouses.remote.databinding.DialogWificountryBinding
23+
import io.treehouses.remote.interfaces.FragmentDialogInterface
2324
import io.treehouses.remote.utils.DialogUtils
2425
import io.treehouses.remote.utils.Utils
25-
import io.treehouses.remote.interfaces.FragmentDialogInterface
26-
import kotlinx.android.synthetic.main.dialog_wificountry.*
2726

2827
class StatusFragment : BaseFragment(), FragmentDialogInterface {
2928

@@ -46,9 +45,10 @@ class StatusFragment : BaseFragment(), FragmentDialogInterface {
4645

4746
private fun wifiCountry(adapter: ArrayAdapter<String?>) {
4847
val dialog = Dialog(requireContext())
49-
dialog.setContentView(R.layout.dialog_wificountry)
50-
dialog.countries
51-
countryList = dialog.countries
48+
val dialogWifiCountryBinding = DialogWificountryBinding.inflate(layoutInflater)
49+
dialog.setContentView(dialogWifiCountryBinding.root)
50+
dialogWifiCountryBinding.countries
51+
countryList = dialogWifiCountryBinding.countries
5252
adapter.filter.filter("")
5353
countryList?.adapter = adapter
5454
countryList?.isTextFilterEnabled = true
@@ -57,10 +57,9 @@ class StatusFragment : BaseFragment(), FragmentDialogInterface {
5757
dialog.dismiss()
5858
}
5959

60-
searchView(dialog)
60+
searchView(dialogWifiCountryBinding)
6161
dialog.show()
6262
}
63-
6463
private fun showBar(mutableData: MutableLiveData<Int>, barView: ProgressBar) {
6564
mutableData.observe(viewLifecycleOwner, Observer {
6665
ObjectAnimator.ofInt(barView, "progress", it).setDuration(600).start()
@@ -157,8 +156,8 @@ class StatusFragment : BaseFragment(), FragmentDialogInterface {
157156
}
158157

159158

160-
private fun searchView(dialog: Dialog) {
161-
val searchView = dialog.search_bar
159+
private fun searchView(dialogWifiCountryBinding: DialogWificountryBinding) {
160+
val searchView = dialogWifiCountryBinding.searchBar
162161
searchView.isIconifiedByDefault = false
163162
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
164163
override fun onQueryTextSubmit(query: String): Boolean {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.6.21'
4+
ext.kotlin_version = '1.9.22'
55
repositories {
66
jcenter()
77
google()

0 commit comments

Comments
 (0)