mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 12:26:48 +01:00
Add title and description to Alarm table (currently unsued)
Includes migration script Also bump version to 0.44.0 because of the previous Watch X merge
This commit is contained in:
parent
da23026e8f
commit
a089e01433
@ -43,7 +43,7 @@ public class GBDaoGenerator {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Schema schema = new Schema(25, MAIN_PACKAGE + ".entities");
|
Schema schema = new Schema(26, MAIN_PACKAGE + ".entities");
|
||||||
|
|
||||||
Entity userAttributes = addUserAttributes(schema);
|
Entity userAttributes = addUserAttributes(schema);
|
||||||
Entity user = addUserInfo(schema, userAttributes);
|
Entity user = addUserInfo(schema, userAttributes);
|
||||||
@ -442,6 +442,8 @@ public class GBDaoGenerator {
|
|||||||
alarm.addIntProperty("hour").notNull();
|
alarm.addIntProperty("hour").notNull();
|
||||||
alarm.addIntProperty("minute").notNull();
|
alarm.addIntProperty("minute").notNull();
|
||||||
alarm.addBooleanProperty("unused").notNull();
|
alarm.addBooleanProperty("unused").notNull();
|
||||||
|
alarm.addStringProperty("title");
|
||||||
|
alarm.addStringProperty("description");
|
||||||
alarm.addToOne(user, userId);
|
alarm.addToOne(user, userId);
|
||||||
alarm.addToOne(device, deviceId);
|
alarm.addToOne(device, deviceId);
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ android {
|
|||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
|
|
||||||
// Note: always bump BOTH versionCode and versionName!
|
// Note: always bump BOTH versionCode and versionName!
|
||||||
versionName "0.43.3"
|
versionName "0.44.0"
|
||||||
versionCode 172
|
versionCode 173
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -146,7 +146,7 @@ public class ConfigureAlarms extends AbstractGBActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Alarm createDefaultAlarm(@NonNull Device device, @NonNull User user, int position) {
|
private Alarm createDefaultAlarm(@NonNull Device device, @NonNull User user, int position) {
|
||||||
return new Alarm(device.getId(), user.getId(), position, false, false, false, 0, 6, 30, false);
|
return new Alarm(device.getId(), user.getId(), position, false, false, false, 0, 6, 30, false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
/* Copyright (C) 2017-2020 Andreas Shimokawa, protomors
|
||||||
|
|
||||||
|
This file is part of Gadgetbridge.
|
||||||
|
|
||||||
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Gadgetbridge is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.database.schema;
|
||||||
|
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao;
|
||||||
|
|
||||||
|
public class GadgetbridgeUpdate_26 implements DBUpdateScript {
|
||||||
|
@Override
|
||||||
|
public void upgradeSchema(SQLiteDatabase db) {
|
||||||
|
if (!DBHelper.existsColumn(AlarmDao.TABLENAME, AlarmDao.Properties.Title.columnName, db)) {
|
||||||
|
String ADD_COLUMN_TITLE = "ALTER TABLE " + AlarmDao.TABLENAME + " ADD COLUMN "
|
||||||
|
+ AlarmDao.Properties.Title.columnName + " TEXT";
|
||||||
|
db.execSQL(ADD_COLUMN_TITLE);
|
||||||
|
}
|
||||||
|
if (!DBHelper.existsColumn(AlarmDao.TABLENAME, AlarmDao.Properties.Description.columnName, db)) {
|
||||||
|
String ADD_COLUMN_TITLE = "ALTER TABLE " + AlarmDao.TABLENAME + " ADD COLUMN "
|
||||||
|
+ AlarmDao.Properties.Description.columnName + " TEXT";
|
||||||
|
db.execSQL(ADD_COLUMN_TITLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downgradeSchema(SQLiteDatabase db) {
|
||||||
|
}
|
||||||
|
}
|
@ -49,7 +49,7 @@ public class AlarmUtils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static nodomain.freeyourgadget.gadgetbridge.model.Alarm createSingleShot(int index, boolean smartWakeup, boolean snooze, Calendar calendar) {
|
public static nodomain.freeyourgadget.gadgetbridge.model.Alarm createSingleShot(int index, boolean smartWakeup, boolean snooze, Calendar calendar) {
|
||||||
return new Alarm(-1, -1, index, true, smartWakeup, snooze, Alarm.ALARM_ONCE, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false);
|
return new Alarm(-1, -1, index, true, smartWakeup, snooze, Alarm.ALARM_ONCE, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,7 +128,7 @@ public class AlarmUtils {
|
|||||||
int hour = Integer.parseInt(tokens[4]);
|
int hour = Integer.parseInt(tokens[4]);
|
||||||
int minute = Integer.parseInt(tokens[5]);
|
int minute = Integer.parseInt(tokens[5]);
|
||||||
|
|
||||||
return new Alarm(device.getId(), user.getId(), index, enabled, smartWakeup, false, repetition, hour, minute, false);
|
return new Alarm(device.getId(), user.getId(), index, enabled, smartWakeup, false, repetition, hour, minute, false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Comparator<Alarm> createComparator() {
|
private static Comparator<Alarm> createComparator() {
|
||||||
|
Loading…
Reference in New Issue
Block a user