Java Code Examples for com.google.android.vending.expansion.downloader.Constants#MIN_PROGRESS_TIME

The following examples show how to use com.google.android.vending.expansion.downloader.Constants#MIN_PROGRESS_TIME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadThread.java    From QtAndroidTools with MIT License 6 votes vote down vote up
/**
 * Report download progress through the database if necessary.
 */
private void reportProgress(State state, InnerState innerState) {
    long now = System.currentTimeMillis();
    if (innerState.mBytesSoFar - innerState.mBytesNotified
            > Constants.MIN_PROGRESS_STEP
            && now - innerState.mTimeLastNotification
            > Constants.MIN_PROGRESS_TIME) {
        // we store progress updates to the database here
        mInfo.mCurrentBytes = innerState.mBytesSoFar;
        mDB.updateDownloadCurrentBytes(mInfo);

        innerState.mBytesNotified = innerState.mBytesSoFar;
        innerState.mTimeLastNotification = now;

        long totalBytesSoFar = innerState.mBytesThisSession + mService.mBytesSoFar;

        if (Constants.LOGVV) {
            Log.v(Constants.TAG, "downloaded " + mInfo.mCurrentBytes + " out of "
                    + mInfo.mTotalBytes);
            Log.v(Constants.TAG, "     total " + totalBytesSoFar + " out of "
                    + mService.mTotalLength);
        }

        mService.notifyUpdateBytes(totalBytesSoFar);
    }
}
 
Example 2
Source File: DownloadThread.java    From play-apk-expansion with Apache License 2.0 6 votes vote down vote up
/**
 * Report download progress through the database if necessary.
 */
private void reportProgress(State state, InnerState innerState) {
    long now = System.currentTimeMillis();
    if (innerState.mBytesSoFar - innerState.mBytesNotified
            > Constants.MIN_PROGRESS_STEP
            && now - innerState.mTimeLastNotification
            > Constants.MIN_PROGRESS_TIME) {
        // we store progress updates to the database here
        mInfo.mCurrentBytes = innerState.mBytesSoFar;
        mDB.updateDownloadCurrentBytes(mInfo);

        innerState.mBytesNotified = innerState.mBytesSoFar;
        innerState.mTimeLastNotification = now;

        long totalBytesSoFar = innerState.mBytesThisSession + mService.mBytesSoFar;

        if (Constants.LOGVV) {
            Log.v(Constants.TAG, "downloaded " + mInfo.mCurrentBytes + " out of "
                    + mInfo.mTotalBytes);
            Log.v(Constants.TAG, "     total " + totalBytesSoFar + " out of "
                    + mService.mTotalLength);
        }

        mService.notifyUpdateBytes(totalBytesSoFar);
    }
}
 
Example 3
Source File: DownloadThread.java    From travelguide with Apache License 2.0 6 votes vote down vote up
/**
 * Report download progress through the database if necessary.
 */
private void reportProgress(State state, InnerState innerState) {
    long now = System.currentTimeMillis();
    if (innerState.mBytesSoFar - innerState.mBytesNotified
            > Constants.MIN_PROGRESS_STEP
            && now - innerState.mTimeLastNotification
            > Constants.MIN_PROGRESS_TIME) {
        // we store progress updates to the database here
        mInfo.mCurrentBytes = innerState.mBytesSoFar;
        mDB.updateDownloadCurrentBytes(mInfo);

        innerState.mBytesNotified = innerState.mBytesSoFar;
        innerState.mTimeLastNotification = now;

        long totalBytesSoFar = innerState.mBytesThisSession + mService.mBytesSoFar;

        if (Constants.LOGVV) {
            Log.v(Constants.TAG, "downloaded " + mInfo.mCurrentBytes + " out of "
                    + mInfo.mTotalBytes);
            Log.v(Constants.TAG, "     total " + totalBytesSoFar + " out of "
                    + mService.mTotalLength);
        }

        mService.notifyUpdateBytes(totalBytesSoFar);
    }
}
 
Example 4
Source File: DownloadThread.java    From Alite with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Report download progress through the database if necessary.
 */
private void reportProgress(State state, InnerState innerState) {
    long now = System.currentTimeMillis();
    if (innerState.mBytesSoFar - innerState.mBytesNotified
            > Constants.MIN_PROGRESS_STEP
            && now - innerState.mTimeLastNotification
            > Constants.MIN_PROGRESS_TIME) {
        // we store progress updates to the database here
        mInfo.mCurrentBytes = innerState.mBytesSoFar;
        mDB.updateDownloadCurrentBytes(mInfo);

        innerState.mBytesNotified = innerState.mBytesSoFar;
        innerState.mTimeLastNotification = now;

        long totalBytesSoFar = innerState.mBytesThisSession + mService.mBytesSoFar;

        if (Constants.LOGVV) {
            Log.v(Constants.TAG, "downloaded " + mInfo.mCurrentBytes + " out of "
                    + mInfo.mTotalBytes);
            Log.v(Constants.TAG, "     total " + totalBytesSoFar + " out of "
                    + mService.mTotalLength);
        }

        mService.notifyUpdateBytes(totalBytesSoFar);
    }
}
 
Example 5
Source File: DownloadThread.java    From UnityOBBDownloader with Apache License 2.0 6 votes vote down vote up
/**
 * Report download progress through the database if necessary.
 */
private void reportProgress(State state, InnerState innerState) {
    long now = System.currentTimeMillis();
    if (innerState.mBytesSoFar - innerState.mBytesNotified
            > Constants.MIN_PROGRESS_STEP
            && now - innerState.mTimeLastNotification
            > Constants.MIN_PROGRESS_TIME) {
        // we store progress updates to the database here
        mInfo.mCurrentBytes = innerState.mBytesSoFar;
        mDB.updateDownloadCurrentBytes(mInfo);

        innerState.mBytesNotified = innerState.mBytesSoFar;
        innerState.mTimeLastNotification = now;

        long totalBytesSoFar = innerState.mBytesThisSession + mService.mBytesSoFar;

        if (Constants.LOGVV) {
            Log.v(Constants.TAG, "downloaded " + mInfo.mCurrentBytes + " out of "
                    + mInfo.mTotalBytes);
            Log.v(Constants.TAG, "     total " + totalBytesSoFar + " out of "
                    + mService.mTotalLength);
        }

        mService.notifyUpdateBytes(totalBytesSoFar);
    }
}