@@ -28,7 +28,6 @@ import android.widget.Toast
28
28
import androidx.appcompat.app.AlertDialog
29
29
import androidx.appcompat.app.AppCompatActivity
30
30
import androidx.fragment.app.Fragment
31
- import com.google.chip.chiptool.NetworkCredentialsParcelable
32
31
import chip.setuppayload.SetupPayload
33
32
import chip.setuppayload.SetupPayloadParser
34
33
import chip.setuppayload.SetupPayloadParser.UnrecognizedQrCodeException
@@ -71,7 +70,7 @@ class CHIPToolActivity :
71
70
val fragment = SelectActionFragment .newInstance()
72
71
supportFragmentManager
73
72
.beginTransaction()
74
- .add(R .id.fragment_container , fragment, fragment.javaClass.simpleName)
73
+ .add(R .id.nav_host_fragment , fragment, fragment.javaClass.simpleName)
75
74
.commit()
76
75
} else {
77
76
networkType =
@@ -116,20 +115,6 @@ class CHIPToolActivity :
116
115
showFragment(SelectActionFragment .newInstance(), false )
117
116
}
118
117
119
- override fun handleScanQrCodeClicked () {
120
- showFragment(BarcodeFragment .newInstance())
121
- }
122
-
123
- override fun onProvisionWiFiCredentialsClicked () {
124
- networkType = ProvisionNetworkType .WIFI
125
- showFragment(BarcodeFragment .newInstance(), false )
126
- }
127
-
128
- override fun onProvisionThreadCredentialsClicked () {
129
- networkType = ProvisionNetworkType .THREAD
130
- showFragment(BarcodeFragment .newInstance(), false )
131
- }
132
-
133
118
override fun onShowDeviceAddressInput () {
134
119
showFragment(AddressCommissioningFragment .newInstance(), false )
135
120
}
@@ -138,6 +123,10 @@ class CHIPToolActivity :
138
123
showFragment(DeviceProvisioningFragment .newInstance(deviceInfo!! , networkCredentials))
139
124
}
140
125
126
+ override fun handleScanQrCodeClicked () {
127
+ showFragment(BarcodeFragment .newInstance(), false )
128
+ }
129
+
141
130
override fun handleClusterInteractionClicked () {
142
131
showFragment(ClusterInteractionFragment .newInstance())
143
132
}
@@ -179,17 +168,18 @@ class CHIPToolActivity :
179
168
startActivity(redirectIntent)
180
169
}
181
170
182
- override fun onActivityResult (requestCode : Int , resultCode : Int , data : Intent ? ) {
183
- super .onActivityResult(requestCode, resultCode, data)
171
+ override fun handleProvisionWiFiCredentialsClicked () {
172
+ networkType = ProvisionNetworkType .WIFI
173
+ showFragment(BarcodeFragment .newInstance(), false )
174
+ }
184
175
185
- if (requestCode == REQUEST_CODE_COMMISSIONING ) {
186
- // Simply ignore the commissioning result.
187
- // TODO: tracking commissioned devices.
188
- }
176
+ override fun handleProvisionThreadCredentialsClicked () {
177
+ networkType = ProvisionNetworkType .THREAD
178
+ showFragment(BarcodeFragment .newInstance(), false )
189
179
}
190
180
191
- override fun handleCustomFlowClicked () {
192
- showFragment(BarcodeFragment .newInstance())
181
+ override fun handleProvisionCustomFlowClicked () {
182
+ showFragment(BarcodeFragment .newInstance(), false )
193
183
}
194
184
195
185
override fun handleUnpairDeviceClicked () {
@@ -199,7 +189,7 @@ class CHIPToolActivity :
199
189
private fun showFragment (fragment : Fragment , showOnBack : Boolean = true) {
200
190
val fragmentTransaction = supportFragmentManager
201
191
.beginTransaction()
202
- .replace(R .id.fragment_container , fragment, fragment.javaClass.simpleName)
192
+ .replace(R .id.nav_host_fragment , fragment, fragment.javaClass.simpleName)
203
193
204
194
if (showOnBack) {
205
195
fragmentTransaction.addToBackStack(null )
0 commit comments