当前位置: 首页>>代码示例>>Java>>正文


Java DownloadProgressInfo类代码示例

本文整理汇总了Java中com.google.android.vending.expansion.downloader.DownloadProgressInfo的典型用法代码示例。如果您正苦于以下问题:Java DownloadProgressInfo类的具体用法?Java DownloadProgressInfo怎么用?Java DownloadProgressInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DownloadProgressInfo类属于com.google.android.vending.expansion.downloader包,在下文中一共展示了DownloadProgressInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
/**
 * Sets the state of the various controls based on the progressinfo object
 * sent from the downloader service.
 */
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mAverageSpeed.setText(getString(R.string.kilobytes_per_second,
            Helpers.getSpeedString(progress.mCurrentSpeed)));
    mTimeRemaining.setText(getString(R.string.time_remaining,
            Helpers.getTimeRemaining(progress.mTimeRemaining)));

    progress.mOverallTotal = progress.mOverallTotal;
    mPB.setMax((int) (progress.mOverallTotal >> 8));
    mPB.setProgress((int) (progress.mOverallProgress >> 8));
    mProgressPercent.setText(Long.toString(progress.mOverallProgress
            * 100 /
            progress.mOverallTotal) + "%");
    mProgressFraction.setText(Helpers.getDownloadProgressString
            (progress.mOverallProgress,
                    progress.mOverallTotal));
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:22,代码来源:DownloaderActivity.java

示例2: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mProgressInfo = progress;
    if (null != mClientProxy) {
        mClientProxy.onDownloadProgress(progress);
    }
    if (progress.mOverallTotal <= 0) {
        // we just show the text
        mBuilder.setTicker(mCurrentTitle);
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
        mBuilder.setContentTitle(mCurrentTitle);
        mBuilder.setContentText(mCurrentText);
        mCurrentBuilder = mBuilder;
    } else {
        mActiveDownloadBuilder.setProgress((int) progress.mOverallTotal, (int) progress.mOverallProgress, false);
        mActiveDownloadBuilder.setContentText(Helpers.getDownloadProgressString(progress.mOverallProgress, progress.mOverallTotal));
        mActiveDownloadBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
        mActiveDownloadBuilder.setTicker(mLabel + ": " + mCurrentText);
        mActiveDownloadBuilder.setContentTitle(mLabel);
        mActiveDownloadBuilder.setContentInfo(mContext.getString(Helpers.getStringResource(mContext, "time_remaining_notification"),
                Helpers.getTimeRemaining(progress.mTimeRemaining)));
        mCurrentBuilder = mActiveDownloadBuilder;
    }
    mNotificationManager.notify(NOTIFICATION_ID, mCurrentBuilder.build());
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:26,代码来源:DownloadNotification.java

示例3: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mProgressInfo = progress;
    if (null != mClientProxy) {
        mClientProxy.onDownloadProgress(progress);
    }
    if (progress.mOverallTotal <= 0) {
        // we just show the text
        mNotification.tickerText = mCurrentTitle;
        mNotification.icon = android.R.drawable.stat_sys_download;
        mNotification.setLatestEventInfo(mContext, mLabel, mCurrentText, mContentIntent);
        mCurrentNotification = mNotification;
    } else {
        mCustomNotification.setCurrentBytes(progress.mOverallProgress);
        mCustomNotification.setTotalBytes(progress.mOverallTotal);
        mCustomNotification.setIcon(android.R.drawable.stat_sys_download);
        mCustomNotification.setPendingIntent(mContentIntent);
        mCustomNotification.setTicker(mLabel + ": " + mCurrentText);
        mCustomNotification.setTitle(mLabel);
        mCustomNotification.setTimeRemaining(progress.mTimeRemaining);
        mCurrentNotification = mCustomNotification.updateNotification(mContext);
    }
    mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:25,代码来源:DownloadNotification.java

示例4: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mProgressInfo = progress;
    if (null != mClientProxy) {
        mClientProxy.onDownloadProgress(progress);
    }
    if (progress.mOverallTotal <= 0) {
        // we just show the text
        mBuilder.setTicker(mCurrentTitle);
        mBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
        mBuilder.setContentTitle(mCurrentTitle);
        mBuilder.setContentText(mCurrentText);
        mCurrentBuilder = mBuilder;
    } else {
        mActiveDownloadBuilder.setProgress((int) progress.mOverallTotal, (int) progress.mOverallProgress, false);
        mActiveDownloadBuilder.setContentText(Helpers.getDownloadProgressString(progress.mOverallProgress, progress.mOverallTotal));
        mActiveDownloadBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
        mActiveDownloadBuilder.setTicker(mLabel + ": " + mCurrentText);
        mActiveDownloadBuilder.setContentTitle(mLabel);
        mActiveDownloadBuilder.setContentInfo(mContext.getString(R.string.time_remaining_notification,
                Helpers.getTimeRemaining(progress.mTimeRemaining)));
        mCurrentBuilder = mActiveDownloadBuilder;
    }
    mNotificationManager.notify(NOTIFICATION_ID, mCurrentBuilder.build());
}
 
开发者ID:google,项目名称:play-apk-expansion,代码行数:26,代码来源:DownloadNotification.java

示例5: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mProgressInfo = progress;
    if (null != mClientProxy) {
        mClientProxy.onDownloadProgress(progress);
    }
    if (progress.mOverallTotal <= 0) {
        // we just show the text
        mNotification.setTicker(mCurrentTitle);
        mNotification.setSmallIcon(android.R.drawable.stat_sys_download);
        mNotification.setContentTitle(mLabel);
        mNotification.setContentText(mCurrentText);
        mNotification.setContentIntent(mContentIntent);
        mCurrentNotification = mNotification;
    } else {
        mCustomNotification.setCurrentBytes(progress.mOverallProgress);
        mCustomNotification.setTotalBytes(progress.mOverallTotal);
        mCustomNotification.setIcon(android.R.drawable.stat_sys_download);
        mCustomNotification.setPendingIntent(mContentIntent);
        mCustomNotification.setTicker(mLabel + ": " + mCurrentText);
        mCustomNotification.setTitle(mLabel);
        mCustomNotification.setTimeRemaining(progress.mTimeRemaining);
    }
    mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification.build());
}
 
开发者ID:thomasuster,项目名称:android-expansion,代码行数:26,代码来源:DownloadNotification.java

示例6: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
   public void onDownloadProgress(DownloadProgressInfo progress) {
       mProgressInfo = progress;
       if (null != mClientProxy) {
           mClientProxy.onDownloadProgress(progress);
       }
       if (progress.mOverallTotal <= 0) {
           // we just show the text
           mNotification.tickerText = mCurrentTitle;
           mNotification.icon = android.R.drawable.stat_sys_download;
           mNotification.setLatestEventInfo(mContext, mLabel, mCurrentText, mContentIntent);
           mCurrentNotification = mNotification;
       } else {
           mCustomNotification.setCurrentBytes(progress.mOverallProgress);
           mCustomNotification.setTotalBytes(progress.mOverallTotal);
           mCustomNotification.setIcon(android.R.drawable.stat_sys_download);
           mCustomNotification.setPendingIntent(mContentIntent);
           mCustomNotification.setTicker(mLabel + ": " + mCurrentText);
           mCustomNotification.setTitle(mLabel);
           mCustomNotification.setTimeRemaining(progress.mTimeRemaining);
           mCurrentNotification = mCustomNotification.updateNotification(mContext);
       }
       mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
   }
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:26,代码来源:DownloadNotification.java

示例7: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
  public void onDownloadProgress(DownloadProgressInfo progress) {
      mProgressInfo = progress;
      if (null != mClientProxy) {
          mClientProxy.onDownloadProgress(progress);
      }
      if (progress.mOverallTotal <= 0) {
          // we just show the text
          mNotification.tickerText = mCurrentTitle;
          mNotification.icon = android.R.drawable.stat_sys_download;
//          mNotification.setLatestEventInfo(mContext, mLabel, mCurrentText, mContentIntent);
          mCurrentNotification.contentIntent = mContentIntent;
          mCurrentNotification = mNotification;
      } else {
          mCustomNotification.setCurrentBytes(progress.mOverallProgress);
          mCustomNotification.setTotalBytes(progress.mOverallTotal);
          mCustomNotification.setIcon(android.R.drawable.stat_sys_download);
          mCustomNotification.setPendingIntent(mContentIntent);
          mCustomNotification.setTicker(mLabel + ": " + mCurrentText);
          mCustomNotification.setTitle(mLabel);
          mCustomNotification.setTimeRemaining(progress.mTimeRemaining);
          mCurrentNotification = mCustomNotification.updateNotification(mContext);
      }
      mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
  }
 
开发者ID:StoryMaker,项目名称:storypath,代码行数:26,代码来源:DownloadNotification.java

示例8: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
       mAverageSpeed.setText(getString(R.string.kilobytes_per_second,
               Helpers.getSpeedString(progress.mCurrentSpeed)));
       mTimeRemaining.setText(getString(R.string.time_remaining,
               Helpers.getTimeRemaining(progress.mTimeRemaining)));

       progress.mOverallTotal = progress.mOverallTotal;
       mPB.setMax((int) (progress.mOverallTotal >> 8));
       mPB.setProgress((int) (progress.mOverallProgress >> 8));
       mProgressPercent.setText(Long.toString(progress.mOverallProgress
               * 100 /
               progress.mOverallTotal) + "%");
       mProgressFraction.setText(Helpers.getDownloadProgressString
               (progress.mOverallProgress,
                       progress.mOverallTotal));
}
 
开发者ID:museumsvictoria,项目名称:mv-fieldguide-android,代码行数:18,代码来源:SplashActivity.java

示例9: call

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public FREObject call(FREContext context, FREObject[] args) {

    DownloadProgressInfo info = XAPKContext.client.info;

    String speed = Helpers.getSpeedString(info.mCurrentSpeed);
    String remaining = Helpers.getTimeRemaining(info.mTimeRemaining);

    FREObject result = null;
    try {
        result = FREObject.newObject("eu.alebianco.air.extensions.expansion.vo.ProgressInfo", null);
        result.setProperty("bytesTotal", FREObject.newObject((int) info.mOverallTotal));
        result.setProperty("bytesLoaded", FREObject.newObject((int) info.mOverallProgress));
        result.setProperty("speed", FREObject.newObject(speed));
        result.setProperty("remaining", FREObject.newObject(remaining));
    } catch (Exception e) {
        FREUtils.logEvent(context, LogLevel.FATAL, "Can't convert data to ProgressInfo. [%s: %s]", e.getClass(), e.getMessage());
    }

    return result;
}
 
开发者ID:alebianco,项目名称:ANE-Android-Expansion,代码行数:22,代码来源:GetDownloadProgress.java

示例10: notifyUpdateBytes

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
public void notifyUpdateBytes(long totalBytesSoFar) {
    long timeRemaining;
    long currentTime = SystemClock.uptimeMillis();
    if (0 != mMillisecondsAtSample) {
        // we have a sample.
        long timePassed = currentTime - mMillisecondsAtSample;
        long bytesInSample = totalBytesSoFar - mBytesAtSample;
        float currentSpeedSample = (float) bytesInSample / (float) timePassed;
        if (0 != mAverageDownloadSpeed) {
            mAverageDownloadSpeed = SMOOTHING_FACTOR * currentSpeedSample
                    + (1 - SMOOTHING_FACTOR) * mAverageDownloadSpeed;
        } else {
            mAverageDownloadSpeed = currentSpeedSample;
        }
        timeRemaining = (long) ((mTotalLength - totalBytesSoFar) / mAverageDownloadSpeed);
    } else {
        timeRemaining = -1;
    }
    mMillisecondsAtSample = currentTime;
    mBytesAtSample = totalBytesSoFar;
    mNotification.onDownloadProgress(
            new DownloadProgressInfo(mTotalLength,
                    totalBytesSoFar,
                    timeRemaining,
                    mAverageDownloadSpeed)
            );

}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:29,代码来源:DownloaderService.java

示例11: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
	progressUpdateCalls++;
	avgSpeed += progress.mCurrentSpeed;
	TextView report = (TextView) findViewById(R.id.downloadTextView);
	int mbRead = (int) (progress.mOverallProgress / 1024.0f / 1024.0f);
	int mbTotal = (int) (progress.mOverallTotal / 1024.0f / 1024.0f);
	report.setText("Downloading... " + mbRead + " of " + mbTotal + "MB read. Speed: " + String.format(Locale.getDefault(), "%4.2f", (avgSpeed / (float) progressUpdateCalls / 1024.0f)) + " MB/s. Time remaining: " + (int) ((float) progress.mTimeRemaining / 1000.0f) + "s.");
	((ProgressBar) findViewById(R.id.downloadProgressBar)).setMax((int) progress.mOverallTotal);
	((ProgressBar) findViewById(R.id.downloadProgressBar)).setProgress((int) progress.mOverallProgress);
	((TextView) findViewById(R.id.downloadProgressPercentTextView)).setText((int) (((float) progress.mOverallProgress / (float) progress.mOverallTotal * 100.0f)) + "%"); 
	AliteLog.d("Progress", "Current Speed: " + progress.mCurrentSpeed + ", Overall progress: " + progress.mOverallProgress + ", Total progress: " + progress.mOverallTotal + ", Time Remaining: " + progress.mTimeRemaining);
}
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:14,代码来源:AliteStartManager.java

示例12: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    mProgressInfo = progress;
    if (null != mClientProxy) {
        mClientProxy.onDownloadProgress(progress);
    }
    if (progress.mOverallTotal <= 0) {
        // we just show the text
        mBuilder.setTicker(mCurrentTitle)
        .setSmallIcon(android.R.drawable.stat_sys_download)
        .setContentTitle(mCurrentTitle)
        .setContentText(mCurrentText);
        mCurrentBuilder = mBuilder;
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            mActiveDownloadBuilder.setProgress((int) progress.mOverallTotal, (int) progress.mOverallProgress, false);
        }
        mActiveDownloadBuilder.setContentText(Helpers.getDownloadProgressString(progress.mOverallProgress, progress.mOverallTotal))
        .setSmallIcon(android.R.drawable.stat_sys_download)
        .setTicker(mLabel + ": " + mCurrentText)
        .setContentTitle(mLabel)
        .setContentInfo(mContext.getString(Helpers.getStringResource(mContext, "time_remaining_notification"),
                Helpers.getTimeRemaining(progress.mTimeRemaining)));
        mCurrentBuilder = mActiveDownloadBuilder;
    }
    Notification notification;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        notification = mCurrentBuilder.build();
    } else {
        notification = mCurrentBuilder.getNotification();
    }
    mNotificationManager.notify(NOTIFICATION_ID, notification);
}
 
开发者ID:Over17,项目名称:UnityOBBDownloader,代码行数:34,代码来源:DownloadNotification.java

示例13: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    int progressInPercent = (int) (progress.mOverallProgress * 100 / progress.mOverallTotal);
    Log.i("APKExpansionDownloader", "DownloadProgress: " + progressInPercent);
    mDownloadProgressDlg.setProgress(progressInPercent);
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:7,代码来源:ObbDownloadHelper.java

示例14: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
public void onDownloadProgress(DownloadProgressInfo progress) {
    this.progress = progress;
}
 
开发者ID:thomasuster,项目名称:android-expansion,代码行数:4,代码来源:DownloaderClientImpl.java

示例15: onDownloadProgress

import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
    Timber.d("DOWNLOAD PROGRESS RECEIVED, TIME REMAINING: " + progress.mTimeRemaining);
}
 
开发者ID:StoryMaker,项目名称:storypath,代码行数:5,代码来源:LigerDownloadActivity.java


注:本文中的com.google.android.vending.expansion.downloader.DownloadProgressInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。