mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Replace Config.java by Constants.kt
This commit is contained in:
@@ -27,13 +27,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.core.Config;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
|
||||
import static org.isoron.uhabits.core.Config.DATABASE_VERSION;
|
||||
import static org.isoron.uhabits.core.ConstantsKt.*;
|
||||
|
||||
public abstract class DatabaseUtils
|
||||
{
|
||||
@@ -55,7 +54,7 @@ public abstract class DatabaseUtils
|
||||
@NonNull
|
||||
public static String getDatabaseFilename()
|
||||
{
|
||||
String databaseFilename = Config.DATABASE_FILENAME;
|
||||
String databaseFilename = DATABASE_FILENAME;
|
||||
if (HabitsApplication.Companion.isTestMode()) databaseFilename = "test.db";
|
||||
return databaseFilename;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.isoron.uhabits.core
|
||||
|
||||
package org.isoron.uhabits.core;
|
||||
const val DATABASE_FILENAME = "uhabits.db"
|
||||
|
||||
public class Config
|
||||
{
|
||||
public static final String DATABASE_FILENAME = "uhabits.db";
|
||||
public static int DATABASE_VERSION = 24;
|
||||
}
|
||||
const val DATABASE_VERSION = 24
|
||||
@@ -32,7 +32,7 @@ import java.util.*;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
import static org.isoron.uhabits.core.Config.*;
|
||||
import static org.isoron.uhabits.core.ConstantsKt.*;
|
||||
|
||||
/**
|
||||
* Class that imports data from database files exported by Loop Habit Tracker.
|
||||
@@ -132,7 +132,7 @@ public class LoopDBImporter extends AbstractImporter
|
||||
{
|
||||
Timestamp t = new Timestamp(r.timestamp);
|
||||
Repetition rep = habit.getRepetitions().getByTimestamp(t);
|
||||
if(rep == null || rep.getValue() != r.value)
|
||||
if (rep == null || rep.getValue() != r.value)
|
||||
new CreateRepetitionCommand(habitList, habit, t, r.value).execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.io.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.isoron.uhabits.core.ConstantsKt.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@@ -127,7 +128,7 @@ public class BaseUnitTest
|
||||
DriverManager.getConnection("jdbc:sqlite::memory:"));
|
||||
db.execute("pragma user_version=8;");
|
||||
MigrationHelper helper = new MigrationHelper(db);
|
||||
helper.migrateTo(Config.DATABASE_VERSION);
|
||||
helper.migrateTo(DATABASE_VERSION);
|
||||
return db;
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
||||
Reference in New Issue
Block a user