本文整理汇总了Java中com.octo.android.robospice.SpiceManager.start方法的典型用法代码示例。如果您正苦于以下问题:Java SpiceManager.start方法的具体用法?Java SpiceManager.start怎么用?Java SpiceManager.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.octo.android.robospice.SpiceManager
的用法示例。
在下文中一共展示了SpiceManager.start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startScheduledDownload
import com.octo.android.robospice.SpiceManager; //导入方法依赖的package包/类
public void startScheduledDownload(@NonNull final ScheduledDownloadItem scheduledDownload) {
final GetApkInfoRequestFromMd5 requestFromMd5 = new GetApkInfoRequestFromMd5(this);
requestFromMd5.setRepoName(scheduledDownload.getRepo_name());
requestFromMd5.setMd5Sum(scheduledDownload.getMd5());
final SpiceManager spiceManager = new SpiceManager(AptoideSpiceHttpService.class);
if (!spiceManager.isStarted()){
spiceManager.start(getApplicationContext());
}
spiceManager.execute(requestFromMd5, new RequestListener<GetApkInfoJson>() {
@Override
public void onRequestFailure(SpiceException spiceException) { }
@Override
public void onRequestSuccess(final GetApkInfoJson getApkInfoJson) {
if (getApkInfoJson == null) {
return;
}
final GetApkInfoJson.Apk apk = getApkInfoJson.apk;
final Download download = new Download();
download.setMd5(scheduledDownload.getMd5());
download.setId(scheduledDownload.getMd5().hashCode());
download.setName(scheduledDownload.getName());
download.setVersion(apk.getVername());
download.setIcon(apk.getIcon());
download.setPackageName(apk.getPackageName());
startDownloadFromJson(getApkInfoJson, apk.getId().longValue(), download);
}
});
}
示例2: onStart
import com.octo.android.robospice.SpiceManager; //导入方法依赖的package包/类
@Override
protected void onStart() {
for(SpiceManager manager : spiceManagerMap.values()) {
if(!manager.isStarted()) {
manager.start(this);
}
}
super.onStart();
}
示例3: setupNetworkServices
import com.octo.android.robospice.SpiceManager; //导入方法依赖的package包/类
private void setupNetworkServices() throws AuthenticationError {
AccessToken accessToken = null;
if(this.bundle!=null) {
accessToken = this.bundle.getParcelable(ACCESS_TOKEN);
}
if(accessToken==null) {
accessToken = FiveHundredPxAccessToken.build(FiveHundredPxConfiguration.INSTANCE);
}
FiveHundredPxClient.INSTANCE.setConsumer(accessToken);
//final SpiceManager spiceManager = new SpiceManager(FiveHundredPxGsonSpiceService.class);
final SpiceManager spiceManager = new SpiceManager(FiveHundredPxJacksonSpiceService.class);
addToSpiceManager(MainActivity.class.getName(), spiceManager);
spiceManager.start(this);
}
示例4: startDownloadFromAppId
import com.octo.android.robospice.SpiceManager; //导入方法依赖的package包/类
public void startDownloadFromAppId(final long id) {
startService(new Intent(getApplicationContext(), DownloadService.class));
if (mBuilder == null) mBuilder = createDefaultNotification();
startForeground(-3, mBuilder.build());
final SpiceManager manager = new SpiceManager(AptoideSpiceHttpService.class);
if (!manager.isStarted()) manager.start(getApplicationContext());
final String sizeString = IconSizeUtils.generateSizeString(getApplicationContext());
new Thread(new Runnable() {
@Override
public void run() {
Cursor apkCursor = new AptoideDatabase(Aptoide.getDb()).getApkInfo(id);
if (apkCursor.moveToFirst()) {
String repoName = apkCursor.getString(apkCursor.getColumnIndex("reponame"));
final String name = apkCursor.getString(apkCursor.getColumnIndex("name"));
String package_name = apkCursor.getString(apkCursor.getColumnIndex("package_name"));
final String versionName = apkCursor.getString(apkCursor.getColumnIndex("version_name"));
final int versionCode = apkCursor.getInt(apkCursor.getColumnIndex("version_code"));
final String md5sum = apkCursor.getString(apkCursor.getColumnIndex("md5"));
String icon = apkCursor.getString(apkCursor.getColumnIndex("icon"));
final String iconpath = apkCursor.getString(apkCursor.getColumnIndex("iconpath"));
GetApkInfoRequestFromVercode request = new GetApkInfoRequestFromVercode(getApplicationContext());
request.setRepoName(repoName);
request.setPackageName(package_name);
request.setVersionName(versionName);
request.setVercode(versionCode);
Download download = new Download();
download.setId(md5sum.hashCode());
download.setName(name);
download.setPackageName(package_name);
download.setVersion(versionName);
download.setMd5(md5sum);
if (icon.contains("_icon")) {
String[] splittedUrl = icon.split("\\.(?=[^\\.]+$)");
icon = splittedUrl[0] + "_" + sizeString + "." + splittedUrl[1];
}
download.setIcon(iconpath + icon);
manager.getFromCacheAndLoadFromNetworkIfExpired(request, repoName + md5sum, DurationInMillis.ONE_HOUR, new DownloadRequest(download.getId(), download));
apkCursor.close();
}
}
}).start();
}