本文整理汇总了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));
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
示例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)
);
}
示例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);
}
示例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);
}
示例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);
}
示例14: onDownloadProgress
import com.google.android.vending.expansion.downloader.DownloadProgressInfo; //导入依赖的package包/类
public void onDownloadProgress(DownloadProgressInfo progress) {
this.progress = progress;
}
示例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);
}