mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 17:18:52 -06:00
Merge tag 'v1.7.3' into dev
1.7.3
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
<manifest
|
||||
package="org.isoron.uhabits"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="29"
|
||||
android:versionName="1.7.2">
|
||||
android:versionCode="30"
|
||||
android:versionName="1.7.3">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
|
||||
@@ -20,24 +20,27 @@
|
||||
package org.isoron.uhabits.activities.common.views;
|
||||
|
||||
import android.os.*;
|
||||
import android.support.v4.os.*;
|
||||
|
||||
public class BundleSavedState extends android.support.v4.view.AbsSavedState
|
||||
{
|
||||
public static final Parcelable.Creator<BundleSavedState> CREATOR =
|
||||
new Parcelable.Creator<BundleSavedState>()
|
||||
{
|
||||
@Override
|
||||
public BundleSavedState createFromParcel(Parcel source)
|
||||
ParcelableCompat.newCreator(
|
||||
new ParcelableCompatCreatorCallbacks<BundleSavedState>()
|
||||
{
|
||||
return new BundleSavedState(source, getClass().getClassLoader());
|
||||
}
|
||||
@Override
|
||||
public BundleSavedState createFromParcel(Parcel source,
|
||||
ClassLoader loader)
|
||||
{
|
||||
return new BundleSavedState(source, loader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleSavedState[] newArray(int size)
|
||||
{
|
||||
return new BundleSavedState[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public BundleSavedState[] newArray(int size)
|
||||
{
|
||||
return new BundleSavedState[size];
|
||||
}
|
||||
});
|
||||
|
||||
public final Bundle bundle;
|
||||
|
||||
@@ -50,7 +53,7 @@ public class BundleSavedState extends android.support.v4.view.AbsSavedState
|
||||
public BundleSavedState(Parcel source, ClassLoader loader)
|
||||
{
|
||||
super(source, loader);
|
||||
this.bundle = source.readBundle(getClass().getClassLoader());
|
||||
this.bundle = source.readBundle(loader);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,6 +107,12 @@ public abstract class ScrollableChart extends View
|
||||
@Override
|
||||
public void onRestoreInstanceState(Parcelable state)
|
||||
{
|
||||
if(!(state instanceof BundleSavedState))
|
||||
{
|
||||
super.onRestoreInstanceState(state);
|
||||
return;
|
||||
}
|
||||
|
||||
BundleSavedState bss = (BundleSavedState) state;
|
||||
int x = bss.bundle.getInt("x");
|
||||
int y = bss.bundle.getInt("y");
|
||||
|
||||
@@ -155,6 +155,12 @@ public class HabitCardListView extends RecyclerView
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state)
|
||||
{
|
||||
if(!(state instanceof BundleSavedState))
|
||||
{
|
||||
super.onRestoreInstanceState(state);
|
||||
return;
|
||||
}
|
||||
|
||||
BundleSavedState bss = (BundleSavedState) state;
|
||||
dataOffset = bss.bundle.getInt("dataOffset");
|
||||
super.onRestoreInstanceState(bss.getSuperState());
|
||||
|
||||
@@ -153,6 +153,7 @@ public class SQLiteCheckmarkList extends CheckmarkList
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Checkmark getOldestComputed()
|
||||
{
|
||||
check(habit.getId());
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.*;
|
||||
*/
|
||||
public class SQLiteRepetitionList extends RepetitionList
|
||||
{
|
||||
|
||||
private final SQLiteUtils<RepetitionRecord> sqlite;
|
||||
|
||||
@Nullable
|
||||
@@ -45,14 +46,17 @@ public class SQLiteRepetitionList extends RepetitionList
|
||||
|
||||
private SQLiteStatement addStatement;
|
||||
|
||||
public static final String ADD_QUERY =
|
||||
"insert into repetitions(habit, timestamp, value) " +
|
||||
"values (?,?,?)";
|
||||
|
||||
public SQLiteRepetitionList(@NonNull Habit habit)
|
||||
{
|
||||
super(habit);
|
||||
sqlite = new SQLiteUtils<>(RepetitionRecord.class);
|
||||
|
||||
SQLiteDatabase db = Cache.openDatabase();
|
||||
String addQuery = "insert into repetitions(habit, timestamp) values (?,?)";
|
||||
addStatement = db.compileStatement(addQuery);
|
||||
addStatement = db.compileStatement(ADD_QUERY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,6 +73,7 @@ public class SQLiteRepetitionList extends RepetitionList
|
||||
check(habit.getId());
|
||||
addStatement.bindLong(1, habit.getId());
|
||||
addStatement.bindLong(2, rep.getTimestamp());
|
||||
addStatement.bindLong(3, rep.getValue());
|
||||
addStatement.execute();
|
||||
observable.notifyListeners();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user