@ -116,7 +116,12 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
is Transaction -> {
selectedTransaction = row
selectedTransactionPosition = position
EditableDataActivity . newInstanceForResult ( this , LiveData . TRANSACTION , row . id , REQUEST _CODE _TRANSACTION _DETAILS )
EditableDataActivity . newInstanceForResult (
this ,
LiveData . TRANSACTION ,
row . id ,
REQUEST _CODE _TRANSACTION _DETAILS
)
}
}
}
@ -195,17 +200,24 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
}
// Sessions
this . realmSessions = sessionFilter ?. results ( ) ?: run { getRealm ( ) . where < Session > ( ) . findAll ( ) }
this . realmSessions = sessionFilter ?. results ( ) ?: run { getRealm ( ) . where < Session > ( ) . isNotNull ( " startDate " ) . findAll ( ) }
this . realmSessions = this . realmSessions . sort ( " startDate " , Sort . DESCENDING )
this . realmSessions . addChangeListener { _ , _ ->
this . feedSessionAdapter . refreshData ( )
this . feedSessionAdapter . notifyDataSetChanged ( )
}
val pendingSessions = sessionFilter ?. let { getRealm ( ) . where < Session > ( ) . alwaysFalse ( ) . findAll ( ) } ?: run { getRealm ( ) . where < Session > ( ) . isNull ( " year " ) . isNull ( " month " ) . findAll ( ) . sort ( " startDate " , Sort . DESCENDING ) }
var distinctDateSessions = sessionFilter ?. results ( " year " , " month " ) ?: run { getRealm ( ) . where < Session > ( ) . distinct ( " year " , " month " ) . findAll ( ) }
val pendingSessions = sessionFilter ?. let {
getRealm ( ) . where < Session > ( ) . alwaysFalse ( ) . findAll ( )
} ?: run {
getRealm ( ) . where < Session > ( ) . isNull ( " year " ) . isNull ( " month " ) . findAll ( ) . sort ( " startDate " , Sort . DESCENDING )
}
var distinctDateSessions = sessionFilter ?. results ( " year " , " month " ) ?: run {
getRealm ( ) . where < Session > ( ) . distinct ( " year " , " month " ) . findAll ( )
}
distinctDateSessions = distinctDateSessions . sort ( " startDate " , Sort . DESCENDING )
this . feedSessionAdapter = FeedSessionRowRepresentableAdapter ( this , realmSessions , pendingSessions , distinctDateSessions )
this . feedSessionAdapter =
FeedSessionRowRepresentableAdapter ( this , realmSessions , pendingSessions , distinctDateSessions )
}
private fun loadTransactions ( filter : Filter ? = null ) {
@ -225,9 +237,12 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
this . feedTransactionAdapter . notifyDataSetChanged ( )
}
var distinctDateTransactions = transactionFilter ?. results ( " year " , " month " ) ?: run { getRealm ( ) . where < Transaction > ( ) . distinct ( " year " , " month " ) . findAll ( ) }
var distinctDateTransactions = transactionFilter ?. results ( " year " , " month " ) ?: run {
getRealm ( ) . where < Transaction > ( ) . distinct ( " year " , " month " ) . findAll ( )
}
distinctDateTransactions = distinctDateTransactions . sort ( " date " , Sort . DESCENDING )
this . feedTransactionAdapter = FeedTransactionRowRepresentableAdapter ( this , realmTransactions , distinctDateTransactions )
this . feedTransactionAdapter =
FeedTransactionRowRepresentableAdapter ( this , realmTransactions , distinctDateTransactions )
}
@ -280,7 +295,11 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
* Show end of beta message
* /
private fun showEndOfBetaMessage ( ) {
Toast . makeText ( context , " Beta has ended. Thanks a lot for your participation! Please update with the Google Play version to continue using the app " , Toast . LENGTH _LONG ) . show ( )
Toast . makeText (
context ,
" Beta has ended. Thanks a lot for your participation! Please update with the Google Play version to continue using the app " ,
Toast . LENGTH _LONG
) . show ( )
}