Search in sources :

Example 6 with TransactionObject

use of com.genonbeta.TrebleShot.object.TransactionObject in project TrebleShot by genonbeta.

the class AccessDatabase method calculateTransactionSize.

public void calculateTransactionSize(int groupId, TransactionObject.Group.Index indexObject) {
    indexObject.reset();
    ArrayList<TransactionObject> transactionList = castQuery(new SQLQuery.Select(AccessDatabase.TABLE_TRANSFER).setWhere(AccessDatabase.FIELD_TRANSFER_GROUPID + "=? AND " + AccessDatabase.FIELD_TRANSFER_FLAG + " != ?", String.valueOf(groupId), TransactionObject.Flag.REMOVED.toString()), TransactionObject.class);
    for (TransactionObject transactionObject : transactionList) {
        if (TransactionObject.Type.INCOMING.equals(transactionObject.type)) {
            indexObject.incoming += transactionObject.fileSize;
            indexObject.incomingCount++;
        } else {
            indexObject.outgoing += transactionObject.fileSize;
            indexObject.outgoingCount++;
        }
    }
}
Also used : TransactionObject(com.genonbeta.TrebleShot.object.TransactionObject)

Aggregations

TransactionObject (com.genonbeta.TrebleShot.object.TransactionObject)6 AlertDialog (android.support.v7.app.AlertDialog)3 ArrayList (java.util.ArrayList)3 DialogInterface (android.content.DialogInterface)2 View (android.view.View)2 IOException (java.io.IOException)2 Uri (android.net.Uri)1 Handler (android.os.Handler)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 CoolSocket (com.genonbeta.CoolSocket.CoolSocket)1 NetworkDeviceListAdapter (com.genonbeta.TrebleShot.adapter.NetworkDeviceListAdapter)1 TransactionListAdapter (com.genonbeta.TrebleShot.adapter.TransactionListAdapter)1 DocumentFile (com.genonbeta.TrebleShot.io.DocumentFile)1 WorkerService (com.genonbeta.TrebleShot.service.WorkerService)1 CommunicationBridge (com.genonbeta.TrebleShot.util.CommunicationBridge)1 DynamicNotification (com.genonbeta.TrebleShot.util.DynamicNotification)1 Interrupter (com.genonbeta.TrebleShot.util.Interrupter)1 SQLQuery (com.genonbeta.android.database.SQLQuery)1