Skip to content

Commit

Permalink
beta4
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Feb 12, 2019
1 parent 8b7a73d commit fa002fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ object ConnectionManager {
}
}

fun closeConnection() {
DataModel.ws?.close(1000, "Close requested")
}

fun sendRefreshSignal(finished: Boolean) {
val i = Intent(DATA_SIGNAL)
i.putExtra("action", "refresh")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ class SettingsActivity : AppCompatActivity() {
btnDisconnect.setOnClickListener {
DataModel.setConnString(null, applicationContext)
DataModel.clear()
ConnectionManager.closeConnection()

updateUI()
}

chkDisallowInternet.setOnClickListener {
DataModel.setGlobalAllowInternet(chkDisallowInternet.isChecked)
DataModel.setGlobalAllowInternet(!chkDisallowInternet.isChecked)

if (chkDisallowInternet.isChecked) {
ConnectionManager.closeConnection()
}

updateUI()
}
}

fun updateUI() {
txtSettingsConnString.text = DataModel.getConnString(ZQWApp.appContext!!) ?: "Not Connected"

chkDisallowInternet.isChecked = !DataModel.getGlobalAllowInternet()

lblVersionName.text = BuildConfig.VERSION_NAME
lblServerVersion.text = DataModel.mainResponseData?.serverversion ?: "Not Connected"
}
Expand Down

0 comments on commit fa002fb

Please sign in to comment.