mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Merge branch 'feature/kotlin' into dev
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker 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 General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides classes that deal with importing from and exporting to files.
|
||||
*/
|
||||
package org.isoron.uhabits.core.io;
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker 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 General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides classes that represent rows in the SQLite database.
|
||||
*/
|
||||
package org.isoron.uhabits.core.models.sqlite.records;
|
||||
@@ -212,6 +212,11 @@ public class Preferences
|
||||
return storage.getBoolean("pref_short_toggle", false);
|
||||
}
|
||||
|
||||
public void setShortToggleEnabled(boolean enabled)
|
||||
{
|
||||
storage.putBoolean("pref_short_toggle", enabled);
|
||||
}
|
||||
|
||||
public boolean isSyncEnabled()
|
||||
{
|
||||
return storage.getBoolean("pref_feature_sync", false);
|
||||
@@ -243,11 +248,11 @@ public class Preferences
|
||||
for (Listener l : listeners) l.onNotificationsChanged();
|
||||
}
|
||||
|
||||
public void setShouldReverseCheckmarks(boolean reverse)
|
||||
public void setCheckmarkSequenceReversed(boolean reverse)
|
||||
{
|
||||
shouldReverseCheckmarks = reverse;
|
||||
storage.putBoolean("pref_checkmark_reverse_order", reverse);
|
||||
for (Listener l : listeners) l.onCheckmarkOrderChanged();
|
||||
for (Listener l : listeners) l.onCheckmarkSequenceChanged();
|
||||
}
|
||||
|
||||
public void setSyncEnabled(boolean isEnabled)
|
||||
@@ -261,7 +266,7 @@ public class Preferences
|
||||
return storage.getBoolean("pref_sticky_notifications", false);
|
||||
}
|
||||
|
||||
public boolean shouldReverseCheckmarks()
|
||||
public boolean isCheckmarkSequenceReversed()
|
||||
{
|
||||
if (shouldReverseCheckmarks == null) shouldReverseCheckmarks =
|
||||
storage.getBoolean("pref_checkmark_reverse_order", false);
|
||||
@@ -277,7 +282,7 @@ public class Preferences
|
||||
|
||||
public interface Listener
|
||||
{
|
||||
default void onCheckmarkOrderChanged() {}
|
||||
default void onCheckmarkSequenceChanged() {}
|
||||
|
||||
default void onNotificationsChanged() {}
|
||||
|
||||
|
||||
@@ -19,21 +19,27 @@
|
||||
|
||||
package org.isoron.uhabits.core.tasks;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SingleThreadTaskRunner implements TaskRunner
|
||||
{
|
||||
private List<Listener> listeners = new LinkedList<>();
|
||||
|
||||
@Override
|
||||
public void addListener(Listener listener)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Task task)
|
||||
{
|
||||
for(Listener l : listeners) l.onTaskStarted(task);
|
||||
task.onAttached(this);
|
||||
task.onPreExecute();
|
||||
task.doInBackground();
|
||||
task.onPostExecute();
|
||||
for(Listener l : listeners) l.onTaskFinished(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,6 +57,6 @@ public class SingleThreadTaskRunner implements TaskRunner
|
||||
@Override
|
||||
public void removeListener(Listener listener)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*
|
||||
* 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.models.sqlite;
|
||||
|
||||
Reference in New Issue
Block a user