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 mApplication = application
|
||||
private var mView = WeakReference(parentView)
|
||||
private var priority = 200
|
||||
private var notificationText = ""
|
||||
private var informational = ""
|
||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(mContext.get())
|
||||
@@ -170,10 +171,11 @@ internal class DataFetcher(isPlan: Boolean, isMenu: Boolean, isJobService: Boole
|
||||
additional = cols[5].text(),
|
||||
teacher = cols[6].text(),
|
||||
type = cols[7].text(),
|
||||
priority = i
|
||||
priority = priority
|
||||
)
|
||||
substArray.add(subst)
|
||||
substRepo.insert(subst)
|
||||
priority--
|
||||
}
|
||||
var countOfNotificationItems = 0
|
||||
var countOfMoreNotificationItems = 0
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.denizd.substitutionplan.models.Subst
|
||||
@Dao
|
||||
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>>
|
||||
|
||||
@Insert
|
||||
|
||||
@@ -39,7 +39,7 @@ internal class PersonalPlanFragment : PlanFragment() {
|
||||
}
|
||||
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()
|
||||
mAdapter.setSubst(planCardList)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user