corrections
This commit is contained in:
parent
5a0811967f
commit
b2c19db626
3 changed files with 8 additions and 12 deletions
|
@ -998,12 +998,12 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun calcLivePeriod(periods: LinkedList<Long>): Long {
|
fun calcLivePeriod(periods: LinkedList<Long>): Long {
|
||||||
val copy = periods.toLongArray()
|
val sortedPeriods = periods.toLongArray()
|
||||||
copy.sort()
|
sortedPeriods.sort()
|
||||||
return if (copy.size % 2 == 0) {
|
return if (sortedPeriods.size % 2 == 0) {
|
||||||
(copy[copy.size / 2] + copy[copy.size / 2 - 1]) / 2
|
(sortedPeriods[sortedPeriods.size / 2] + sortedPeriods[sortedPeriods.size / 2 - 1]) / 2
|
||||||
} else {
|
} else {
|
||||||
copy[copy.size / 2]
|
sortedPeriods[sortedPeriods.size / 2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ private const val MY_LOCATION_TAB_POS = 0
|
||||||
private const val LIVE_NOW_TAB_POS = 1
|
private const val LIVE_NOW_TAB_POS = 1
|
||||||
private const val TIMELINE_TAB_POS = 2
|
private const val TIMELINE_TAB_POS = 2
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListener, TelegramIncomingMessagesListener, DataSetListener {
|
class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListener, TelegramIncomingMessagesListener {
|
||||||
|
|
||||||
private val log = PlatformUtil.getLog(MainActivity::class.java)
|
private val log = PlatformUtil.getLog(MainActivity::class.java)
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDataSetChanged() {
|
fun onDataSetChanged() {
|
||||||
viewPager.adapter?.notifyDataSetChanged()
|
viewPager.adapter?.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,3 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataSetListener {
|
|
||||||
fun onDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
|
@ -856,7 +856,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
||||||
} else {
|
} else {
|
||||||
settings.shareLocationToChat(lastChat.chat.id, true, lastChat.time)
|
settings.shareLocationToChat(lastChat.chat.id, true, lastChat.time)
|
||||||
app.shareLocationHelper.startSharingLocation()
|
app.shareLocationHelper.startSharingLocation()
|
||||||
(activity as DataSetListener).onDataSetChanged()
|
(activity as MainActivity).onDataSetChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue