import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.ktnx.mobileledger.App;
import net.ktnx.mobileledger.utils.Digest;
import net.ktnx.mobileledger.utils.Globals;
import net.ktnx.mobileledger.utils.SimpleDate;
accounts.add(item);
dataHash = null;
}
+ @Nullable
+ public SimpleDate getDateIfAny() {
+ return date;
+ }
+ @NonNull
public SimpleDate getDate() {
+ loadData(App.getDatabase());
+ if (date == null)
+ throw new IllegalStateException("Transaction has no date");
return date;
}
public void setDate(SimpleDate date) {
public void finishLoading() {
dataLoaded = true;
}
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (obj == null)
+ return false;
+ if (!obj.getClass()
+ .equals(this.getClass()))
+ return false;
+
+ return ((LedgerTransaction) obj).getDataHash()
+ .equals(getDataHash());
+ }
+
+ public boolean hasAccountNamedLike(String name) {
+ name = name.toUpperCase();
+ for (LedgerTransactionAccount acc : accounts) {
+ if (acc.getAccountName()
+ .toUpperCase()
+ .contains(name))
+ return true;
+ }
+
+ return false;
+ }
}