Add order columns to nav drawer items

pull/1020/head
Alex Baker 4 years ago
parent 7f964ecc97
commit 8ff6057531

File diff suppressed because it is too large Load Diff

@ -23,7 +23,7 @@ object GtaskListMaker {
list.account = lookup.valueOf(ACCOUNT, "account")
list.remoteId = lookup.valueOf(REMOTE_ID, "1")
list.title = lookup.valueOf(NAME, "Default")
list.remoteOrder = lookup.valueOf(ORDER, 0)
list.order = lookup.valueOf(ORDER, 0)
list.lastSync = lookup.valueOf(LAST_SYNC, 0L)
list.setColor(lookup.valueOf(COLOR, 0))
list

@ -47,6 +47,7 @@ public class CaldavFilter extends Filter {
this.calendar = calendar;
tint = calendar.getColor();
icon = calendar.getIcon();
order = calendar.getOrder();
}
private static QueryTemplate queryTemplate(CaldavCalendar caldavCalendar) {

@ -34,6 +34,7 @@ public class CustomFilter extends Filter {
criterion = filter.getCriterion();
tint = filter.getColor();
icon = filter.getIcon();
order = filter.getOrder();
}
private CustomFilter(Parcel parcel) {

@ -26,6 +26,7 @@ public abstract class FilterListItem implements Parcelable {
public int icon = -1;
public int tint = 0;
public int count = -1;
public int order = 0;
public abstract Type getItemType();
@ -41,6 +42,7 @@ public abstract class FilterListItem implements Parcelable {
dest.writeInt(icon);
dest.writeInt(tint);
dest.writeInt(count);
dest.writeInt(order);
}
// --- parcelable helpers
@ -51,6 +53,7 @@ public abstract class FilterListItem implements Parcelable {
icon = source.readInt();
tint = source.readInt();
count = source.readInt();
order = source.readInt();
}
public abstract boolean areItemsTheSame(@NonNull FilterListItem other);
@ -59,7 +62,8 @@ public abstract class FilterListItem implements Parcelable {
return Objects.equals(listingTitle, other.listingTitle)
&& icon == other.icon
&& tint == other.tint
&& count == other.count;
&& count == other.count
&& order == other.order;
}
@Override
@ -74,6 +78,8 @@ public abstract class FilterListItem implements Parcelable {
+ tint
+ ", count="
+ count
+ ", order="
+ order
+ '}';
}

@ -47,6 +47,7 @@ public class GtasksFilter extends Filter {
this.list = list;
tint = list.getColor();
icon = list.getIcon();
order = list.getOrder();
}
private static QueryTemplate getQueryTemplate(GoogleTaskList list) {

@ -46,6 +46,7 @@ public class TagFilter extends Filter {
this.tagData = tagData;
tint = tagData.getColor();
icon = tagData.getIcon();
order = tagData.getOrder();
}
private static QueryTemplate queryTemplate(String uuid) {

@ -26,7 +26,7 @@ import org.tasks.notifications.NotificationDao
CaldavTask::class,
CaldavAccount::class,
GoogleTaskAccount::class],
version = 75)
version = 76)
abstract class Database : RoomDatabase() {
abstract fun notificationDao(): NotificationDao
abstract val tagDataDao: TagDataDao

@ -78,7 +78,6 @@ public class GtasksListService {
}
local.setTitle(title);
local.setRemoteOrder(i);
googleTaskListDao.insertOrReplace(local);
previousLists.remove(local.getId());
}

@ -37,6 +37,9 @@ class CaldavCalendar : Parcelable {
@ColumnInfo(name = "cdl_icon")
private var icon: Int? = -1
@ColumnInfo(name = "cdl_order")
var order = 0
constructor()
@Ignore
@ -55,6 +58,7 @@ class CaldavCalendar : Parcelable {
ctag = source.readString()
url = source.readString()
icon = source.readInt()
order = source.readInt()
}
fun getIcon(): Int? {
@ -76,6 +80,7 @@ class CaldavCalendar : Parcelable {
dest.writeString(ctag)
dest.writeString(url)
dest.writeInt(getIcon()!!)
dest.writeInt(order)
}
override fun equals(other: Any?): Boolean {
@ -90,6 +95,7 @@ class CaldavCalendar : Parcelable {
if (ctag != other.ctag) return false
if (url != other.url) return false
if (icon != other.icon) return false
if (order != other.order) return false
return true
}
@ -103,11 +109,12 @@ class CaldavCalendar : Parcelable {
result = 31 * result + (ctag?.hashCode() ?: 0)
result = 31 * result + (url?.hashCode() ?: 0)
result = 31 * result + (icon ?: 0)
result = 31 * result + order
return result
}
override fun toString(): String {
return "CaldavCalendar(id=$id, account=$account, uuid=$uuid, name=$name, color=$color, ctag=$ctag, url=$url, icon=$icon)"
return "CaldavCalendar(id=$id, account=$account, uuid=$uuid, name=$name, color=$color, ctag=$ctag, url=$url, icon=$icon, order=$order)"
}
companion object {

@ -32,6 +32,9 @@ class Filter {
@ColumnInfo(name = "f_icon")
private var icon: Int? = -1
@ColumnInfo(name = "f_order")
var order = 0
fun getSql(): String {
// TODO: replace dirty hack for missing column
return sql!!.replace("tasks.userId=0", "1")
@ -71,6 +74,7 @@ class Filter {
if (criterion != other.criterion) return false
if (color != other.color) return false
if (icon != other.icon) return false
if (order != other.order) return false
return true
}
@ -83,10 +87,11 @@ class Filter {
result = 31 * result + (criterion?.hashCode() ?: 0)
result = 31 * result + (color ?: 0)
result = 31 * result + (icon ?: 0)
result = 31 * result + order
return result
}
override fun toString(): String {
return "Filter(id=$id, title=$title, sql=$sql, values=$values, criterion=$criterion, color=$color, icon=$icon)"
return "Filter(id=$id, title=$title, sql=$sql, values=$values, criterion=$criterion, color=$color, icon=$icon, order=$order)"
}
}

@ -26,7 +26,7 @@ class GoogleTaskList : Parcelable {
var title: String? = null
@ColumnInfo(name = "gtl_remote_order")
var remoteOrder = 0
var order = 0
@ColumnInfo(name = "gtl_last_sync")
var lastSync: Long = 0
@ -45,7 +45,7 @@ class GoogleTaskList : Parcelable {
account = parcel.readString()
remoteId = parcel.readString()
title = parcel.readString()
remoteOrder = parcel.readInt()
order = parcel.readInt()
lastSync = parcel.readLong()
color = parcel.readInt()
icon = parcel.readInt()
@ -74,7 +74,7 @@ class GoogleTaskList : Parcelable {
parcel.writeString(account)
parcel.writeString(remoteId)
parcel.writeString(title)
parcel.writeInt(remoteOrder)
parcel.writeInt(order)
parcel.writeLong(lastSync)
parcel.writeInt(getColor()!!)
parcel.writeInt(getIcon()!!)
@ -88,7 +88,7 @@ class GoogleTaskList : Parcelable {
if (account != other.account) return false
if (remoteId != other.remoteId) return false
if (title != other.title) return false
if (remoteOrder != other.remoteOrder) return false
if (order != other.order) return false
if (lastSync != other.lastSync) return false
if (color != other.color) return false
if (icon != other.icon) return false
@ -101,7 +101,7 @@ class GoogleTaskList : Parcelable {
result = 31 * result + (account?.hashCode() ?: 0)
result = 31 * result + (remoteId?.hashCode() ?: 0)
result = 31 * result + (title?.hashCode() ?: 0)
result = 31 * result + remoteOrder
result = 31 * result + order
result = 31 * result + lastSync.hashCode()
result = 31 * result + (color ?: 0)
result = 31 * result + (icon ?: 0)
@ -109,7 +109,7 @@ class GoogleTaskList : Parcelable {
}
override fun toString(): String {
return "GoogleTaskList(id=$id, account=$account, remoteId=$remoteId, title=$title, remoteOrder=$remoteOrder, lastSync=$lastSync, color=$color, icon=$icon)"
return "GoogleTaskList(id=$id, account=$account, remoteId=$remoteId, title=$title, remoteOrder=$order, lastSync=$lastSync, color=$color, icon=$icon)"
}
companion object {

@ -10,7 +10,6 @@ import android.widget.Toast
import androidx.room.*
import com.mapbox.api.geocoding.v5.GeocodingCriteria
import com.mapbox.api.geocoding.v5.models.CarmenFeature
import com.todoroo.andlib.data.Property
import com.todoroo.andlib.data.Table
import com.todoroo.astrid.helper.UUIDHelper
import net.fortuna.ical4j.model.property.Geo
@ -56,6 +55,9 @@ class Place : Serializable, Parcelable {
@ColumnInfo(name = "place_icon")
private var icon = -1
@ColumnInfo(name = "place_order")
var order = 0
constructor()
@Ignore
@ -70,6 +72,7 @@ class Place : Serializable, Parcelable {
longitude = o.longitude
color = o.color
icon = o.icon
order = o.order
}
@Ignore
@ -84,6 +87,7 @@ class Place : Serializable, Parcelable {
longitude = parcel.readDouble()
color = parcel.readInt()
icon = parcel.readInt()
order = parcel.readInt()
}
fun getIcon(): Int? {
@ -140,6 +144,7 @@ class Place : Serializable, Parcelable {
out.writeDouble(longitude)
out.writeInt(color)
out.writeInt(icon)
out.writeInt(order)
}
override fun equals(other: Any?): Boolean {
@ -156,6 +161,7 @@ class Place : Serializable, Parcelable {
if (longitude != other.longitude) return false
if (color != other.color) return false
if (icon != other.icon) return false
if (order != other.order) return false
return true
}
@ -171,11 +177,12 @@ class Place : Serializable, Parcelable {
result = 31 * result + longitude.hashCode()
result = 31 * result + color
result = 31 * result + icon
result = 31 * result + order
return result
}
override fun toString(): String {
return "Place(id=$id, uid=$uid, name=$name, address=$address, phone=$phone, url=$url, latitude=$latitude, longitude=$longitude, color=$color, icon=$icon)"
return "Place(id=$id, uid=$uid, name=$name, address=$address, phone=$phone, url=$url, latitude=$latitude, longitude=$longitude, color=$color, icon=$icon, order=$order)"
}
companion object {

@ -33,6 +33,9 @@ class TagData : Parcelable {
@ColumnInfo(name = "td_icon")
private var icon: Int? = -1
@ColumnInfo(name = "td_order")
var order = 0
@Ignore
constructor(name: String?) {
this.name = name
@ -57,6 +60,7 @@ class TagData : Parcelable {
color = parcel.readInt()
tagOrdering = parcel.readString()
icon = parcel.readInt()
order = parcel.readInt()
}
fun getColor(): Int? {
@ -84,6 +88,7 @@ class TagData : Parcelable {
dest.writeInt(color!!)
dest.writeString(tagOrdering)
dest.writeInt(getIcon()!!)
dest.writeInt(order)
}
override fun equals(other: Any?): Boolean {
@ -96,6 +101,7 @@ class TagData : Parcelable {
if (color != other.color) return false
if (tagOrdering != other.tagOrdering) return false
if (icon != other.icon) return false
if (order != other.order) return false
return true
}
@ -107,11 +113,12 @@ class TagData : Parcelable {
result = 31 * result + (color ?: 0)
result = 31 * result + (tagOrdering?.hashCode() ?: 0)
result = 31 * result + (icon ?: 0)
result = 31 * result + order
return result
}
override fun toString(): String {
return "TagData(id=$id, remoteId=$remoteId, name=$name, color=$color, tagOrdering=$tagOrdering, icon=$icon)"
return "TagData(id=$id, remoteId=$remoteId, name=$name, color=$color, tagOrdering=$tagOrdering, icon=$icon, order=$order)"
}
companion object {

@ -347,6 +347,15 @@ object Migrations {
}
}
private val MIGRATION_75_76: Migration = object : Migration(75, 76) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `tagdata` ADD COLUMN `td_order` INTEGER NOT NULL DEFAULT 0")
database.execSQL("ALTER TABLE `caldav_lists` ADD COLUMN `cdl_order` INTEGER NOT NULL DEFAULT 0")
database.execSQL("ALTER TABLE `filters` ADD COLUMN `f_order` INTEGER NOT NULL DEFAULT 0")
database.execSQL("ALTER TABLE `places` ADD COLUMN `place_order` INTEGER NOT NULL DEFAULT 0")
}
}
val MIGRATIONS = arrayOf(
MIGRATION_35_36,
MIGRATION_36_37,
@ -378,7 +387,8 @@ object Migrations {
MIGRATION_71_72,
MIGRATION_72_73,
MIGRATION_73_74,
MIGRATION_74_75
MIGRATION_74_75,
MIGRATION_75_76
)
private fun noop(from: Int, to: Int): Migration {

@ -61,6 +61,7 @@ public class PlaceFilter extends Filter {
this.place = place;
tint = place.getColor();
icon = place.getIcon();
order = place.getOrder();
}
public Place getPlace() {

Loading…
Cancel
Save