Archived
Restored priority variable because an update would mess up the order of the items temporarily
This commit is contained in:
@@ -44,6 +44,7 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
|
|||||||
private var mContext = WeakReference(context)
|
private var mContext = WeakReference(context)
|
||||||
private var mApplication = application
|
private var mApplication = application
|
||||||
private var mView = WeakReference(parentView)
|
private var mView = WeakReference(parentView)
|
||||||
|
private var priority = 200
|
||||||
private var notificationText = ""
|
private var notificationText = ""
|
||||||
private var informational = ""
|
private var informational = ""
|
||||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(mContext.get())
|
private val prefs = PreferenceManager.getDefaultSharedPreferences(mContext.get())
|
||||||
@@ -170,10 +171,11 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
|
|||||||
additional = cols[5].text(),
|
additional = cols[5].text(),
|
||||||
teacher = cols[6].text(),
|
teacher = cols[6].text(),
|
||||||
type = cols[7].text(),
|
type = cols[7].text(),
|
||||||
priority = i
|
priority = priority
|
||||||
)
|
)
|
||||||
substArray.add(subst)
|
substArray.add(subst)
|
||||||
substRepo.insert(subst)
|
substRepo.insert(subst)
|
||||||
|
priority--
|
||||||
}
|
}
|
||||||
var countOfNotificationItems = 0
|
var countOfNotificationItems = 0
|
||||||
var countOfMoreNotificationItems = 0
|
var countOfMoreNotificationItems = 0
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.denizd.substitutionplan.models.Subst
|
|||||||
@Dao
|
@Dao
|
||||||
internal interface SubstDao {
|
internal interface SubstDao {
|
||||||
|
|
||||||
@get:Query("SELECT * FROM subst_table ORDER BY priority ASC")
|
@get:Query("SELECT * FROM subst_table ORDER BY priority DESC")
|
||||||
val allSubst: LiveData<List<Subst>>
|
val allSubst: LiveData<List<Subst>>
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ internal class PersonalPlanFragment : PlanFragment() {
|
|||||||
}
|
}
|
||||||
persPlanEmpty = (planCardList.size == 1 && planCardList[0].date.substring(0, 3) == "psa") || planCardList.isEmpty()
|
persPlanEmpty = (planCardList.size == 1 && planCardList[0].date.substring(0, 3) == "psa") || planCardList.isEmpty()
|
||||||
|
|
||||||
planCardList.sortWith(Comparator { rhs, lhs -> rhs.priority.compareTo(lhs.priority) })
|
planCardList.sortWith(Comparator { lhs, rhs -> rhs.priority.compareTo(lhs.priority) })
|
||||||
recyclerView.scheduleLayoutAnimation()
|
recyclerView.scheduleLayoutAnimation()
|
||||||
mAdapter.setSubst(planCardList)
|
mAdapter.setSubst(planCardList)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user