Skip to content

Commit

Permalink
global: small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarning committed Jun 14, 2023
1 parent afa664d commit 7520770
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/src/main/kotlin/d/d/meshenger/EventListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class EventListFragment : Fragment() {
}
}

private val onEventLongClickListener = AdapterView.OnItemLongClickListener { adapterView, view, i, _ ->
private val onEventLongClickListener = AdapterView.OnItemLongClickListener { _, view, i, _ ->
Log.d(this, "onItemLongClick")
val activity = requireActivity()
val binder = (activity as MainActivity).binder ?: return@OnItemLongClickListener false
Expand Down Expand Up @@ -153,7 +153,7 @@ class EventListFragment : Fragment() {
val contacts = binder.getContacts().contactList

activity.runOnUiThread {
activity.updateMissedCalls()
activity.updateEventTabTitle()

eventListAdapter.update(events, contacts)
eventListAdapter.notifyDataSetChanged()
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/kotlin/d/d/meshenger/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class MainActivity : BaseActivity(), ServiceConnection {

val settings = binder!!.getSettings()

// data source for the views was not ready before
(viewPager.adapter as ViewPagerFragmentAdapter).let {
it.ready = true
it.notifyDataSetChanged()
Expand Down Expand Up @@ -186,7 +187,7 @@ class MainActivity : BaseActivity(), ServiceConnection {
}.attach()

if (!addressWarningShown) {
// onyl show once since app start
// only show once since app start
showInvalidAddressSettingsWarning()
addressWarningShown = true
}
Expand Down Expand Up @@ -264,8 +265,8 @@ class MainActivity : BaseActivity(), ServiceConnection {
return super.onOptionsItemSelected(item)
}

fun updateMissedCalls() {
Log.d(this, "updateMissedCalls()")
fun updateEventTabTitle() {
Log.d(this, "updateEventTabTitle()")
// update event tab title
(viewPager.adapter as ViewPagerFragmentAdapter).let {
it.notifyDataSetChanged()
Expand All @@ -276,7 +277,7 @@ class MainActivity : BaseActivity(), ServiceConnection {
Log.d(this, "onResume()")
super.onResume()

updateMissedCalls()
updateEventTabTitle()
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/kotlin/d/d/meshenger/MainService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class MainService : Service(), Runnable {
// ignore
}

// save database on exit
saveDatabase()
database?.destroy()

Expand Down Expand Up @@ -253,11 +254,8 @@ class MainService : Service(), Runnable {
private fun updateNotification() {
Log.d(this, "updateNotification()")

//val missedCalls = binder.getEvents().getMissedCalls()
val eventList = binder.getEvents().eventList

val eventsMissed = binder.getEvents().eventsMissed
Log.d(this, "updateNotification() eventsMissed=$eventsMissed")
val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val message = if (eventList.isEmpty() || eventsMissed == 0) {
// default message
Expand Down
1 change: 0 additions & 1 deletion app/src/main/kotlin/d/d/meshenger/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ class SettingsActivity : BaseActivity(), ServiceConnection {
.show()
}


private fun showChangeConnectRetriesDialog() {
val settings = binder!!.getSettings()
val dialog = Dialog(this)
Expand Down
1 change: 0 additions & 1 deletion app/src/main/kotlin/d/d/meshenger/call/RTCCall.kt
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ class RTCCall : RTCPeerConnection {

if (iceGatheringState == IceGatheringState.COMPLETE) {
try {
val settings = binder.getSettings()
val ownPublicKey = settings.publicKey
val ownSecretKey = settings.secretKey
val pw = PacketWriter(commSocket!!)
Expand Down

0 comments on commit 7520770

Please sign in to comment.