Minor tweaks
This commit is contained in:
@@ -88,6 +88,7 @@ object BillsListUtils {
|
||||
shareIntent,
|
||||
context.getString(R.string.title_settle)
|
||||
)
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(chooserIntent)
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
||||
val isSyncPossible: Boolean
|
||||
get() {
|
||||
updateNetworkStatus()
|
||||
return networkConnected
|
||||
val offlineMode = preferences.getBoolean(appContext.getString(R.string.pref_key_offline_mode), false)
|
||||
return networkConnected && !offlineMode
|
||||
}
|
||||
|
||||
fun addCallbackPull(callback: ICallback) {
|
||||
@@ -1214,7 +1215,7 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
||||
}
|
||||
}
|
||||
|
||||
private fun hasChanged(localBill: DBBill, remoteBill: DBBill): Boolean {
|
||||
internal fun hasChanged(localBill: DBBill, remoteBill: DBBill): Boolean {
|
||||
if (localBill.payerId == remoteBill.payerId &&
|
||||
localBill.amount == remoteBill.amount &&
|
||||
localBill.timestamp == remoteBill.timestamp &&
|
||||
|
||||
@@ -5,9 +5,11 @@ fun evalMath(expression: String): Double {
|
||||
var result = 0.0
|
||||
var db: SQLiteDatabase? = null
|
||||
try {
|
||||
// Force floating point division by replacing / with * 1.0 /
|
||||
val forcedRealExpr = expression.replace("/", "* 1.0 /")
|
||||
// Opens a temporary, in-memory system database block
|
||||
db = SQLiteDatabase.create(null)
|
||||
val cursor = db.rawQuery("SELECT ($expression);", null)
|
||||
val cursor = db.rawQuery("SELECT ($forcedRealExpr);", null)
|
||||
if (cursor.moveToFirst()) {
|
||||
result = cursor.getDouble(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user