本文整理汇总了Java中com.octo.android.robospice.request.SpiceRequest类的典型用法代码示例。如果您正苦于以下问题:Java SpiceRequest类的具体用法?Java SpiceRequest怎么用?Java SpiceRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpiceRequest类属于com.octo.android.robospice.request包,在下文中一共展示了SpiceRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public Object execute(SpiceRequest spicerequest, Object obj, long l)
throws Exception
{
prepare(spicerequest);
Object obj2 = null;
if (obj != null)
{
obj2 = mCacheManager.loadDataFromCache(spicerequest.getResultType(), obj, l);
}
Object obj1 = obj2;
if (obj2 == null)
{
spicerequest = ((SpiceRequest) (spicerequest.loadDataFromNetwork()));
obj1 = spicerequest;
if (obj != null)
{
obj1 = mCacheManager.saveDataToCacheAndReturnData(spicerequest, obj);
}
}
return obj1;
}
示例2: onRequestSuccess
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
@Override
public void onRequestSuccess(GetListsRequest.Lists result) {
SpiceRequest req = new AppendGenesToListRequest(mBaseActivity, mMine,
mBaseActivity.getString(R.string.gene_favorites_list_name), mGenes);
mBaseActivity.execute(req, new RequestListener<Void>() {
@Override
public void onRequestFailure(SpiceException ex) {
ResponseHelper.handleSpiceException(ex, mBaseActivity, mMine);
}
@Override
public void onRequestSuccess(Void aVoid) {
}
});
}
示例3: execute
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
<T> void execute(SpiceRequest<T> request, RequestListener<T> listener) {
if (request == null) {
throw new IllegalArgumentException("SpiceRequest must not be null");
}
Optional<String> requestKey = Optional.absent();
Optional<Long> requestExpiry = Optional.absent();
Optional<Boolean> requestAcceptDirty = Optional.absent();
if (request instanceof Cacheable) {
Cacheable cacheable = (Cacheable) request;
requestKey = Optional.from(cacheable.getCacheKey());
requestExpiry = Optional.from(cacheable.getCacheDurationInMillis());
requestAcceptDirty = Optional.from(cacheable.isAcceptingDirtyCache());
}
if (mRetryPolicy.isPresent()) {
// Override RetryPolicy
request.setRetryPolicy(mRetryPolicy.get());
}
if (mPriority.isPresent()) {
// Override priority
request.setPriority(mPriority.get());
}
final String key = mCacheKey.or(requestKey).orNull();
final long expiry = mCacheExpiry.or(requestExpiry).or(DurationInMillis.ALWAYS_EXPIRED);
final boolean acceptDirtyCache = mAcceptDirtyCache.or(requestAcceptDirty).or(false);
if (acceptDirtyCache) {
mManager.getFromCacheAndLoadFromNetworkIfExpired(request, key, expiry, listener);
} else {
mManager.execute(request, key, expiry, listener);
}
}
示例4: onAddRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
if (spicerequest instanceof Client)
{
((Client) spicerequest).setPersistentJsonStore(mPersistentJsonStore);
}
}
示例5: onAddRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
if (spicerequest instanceof CacheManagerInterface)
{
((CacheManagerInterface) spicerequest).setCacheManager(mCacheManager);
}
}
示例6: onAddRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
if (spicerequest instanceof Client)
{
((Client) spicerequest).setCascadeExtension(this);
}
}
示例7: onAddRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
if (spicerequest instanceof Client)
{
((Client) spicerequest).addRetrofitExtension(this);
}
}
示例8: addRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void addRequest(CachedSpiceRequest cachedspicerequest, Set set)
{
SpiceRequest spicerequest = cachedspicerequest.getSpiceRequest();
for (Iterator iterator = mExtensionMap.values().iterator(); iterator.hasNext(); ((Extension) iterator
.next()).onAddRequest(spicerequest)) {}
super.addRequest(cachedspicerequest, set);
}
示例9: onAddRequest
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
if (spicerequest instanceof Client)
{
((Client) spicerequest).setContext(getContext().getApplicationContext());
}
}
示例10: shouldLoadAndDisplayList
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
@Test
public void shouldLoadAndDisplayList() {
// when (starting)
// then
verify(spiceManager).execute(any(SpiceRequest.class), anyString(), anyInt(), any(RequestListener.class));
}
示例11: shouldRearrangePhotos
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
@Test
public void shouldRearrangePhotos() {
// given
mockSpiceCall(createProjectResult());
projectFragment.onProjectSelected(PROJECT_ID, USERNAME);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
reorderRequest = (ReorderProjectPhotosRequest) invocationOnMock.getArguments()[0];
RequestListener<PhotoResult> listener = (RequestListener<PhotoResult>) invocationOnMock.getArguments()[1];
PhotoResult photoResult = new PhotoResult();
photoResult.photos = new ArrayList<Photo>();
listener.onRequestSuccess(photoResult);
return null;
}
}).when(spiceManager).execute(any(SpiceRequest.class), any(RequestListener.class));
// when
HorizontalListView gallery = projectFragment.gallery;
gallery.getOnItemLongClickListener().onItemLongClick(gallery, null, 0, 0);
PhotoAdapter adapter = (PhotoAdapter) gallery.getAdapter();
PhotoAdapter.PhotoAdapterListener adapterListener = adapter.getPhotoAdapterListener();
adapterListener.onMoveLeft(1); // 2 1 3
adapterListener.onMoveRight(1); // 2 3 1
adapterListener.onMoveAllRight(0); // 3 1 2
adapterListener.onMoveAllLeft(1); // 1 3 2
projectFragment.galleryEditDone.performClick();
// then
List<Photo> photos = reorderRequest.getPhotos();
assertThat(photos.size(), is(3));
assertThat(photos.get(0).id, is("1"));
assertThat(photos.get(1).id, is("3"));
assertThat(photos.get(2).id, is("2"));
}
示例12: execute
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void execute(SpiceRequest<T> request) {
mCreator.execute(request, mListener.orNull());
}
示例13: prepare
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void prepare(SpiceRequest spicerequest)
{
for (Iterator iterator = getExtensionMap().values().iterator(); iterator.hasNext(); ((CoreService.Extension) iterator
.next()).onAddRequest(spicerequest)) {}
}
示例14: execute
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
protected Object execute(SpiceRequest spicerequest, Object obj, long l)
throws Exception
{
return mCascadeExtension.execute(spicerequest, obj, l);
}
示例15: execute
import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
protected <T> void execute(SpiceRequest<T> request, RequestListener<T> listener) {
mSpiceManager.execute(request, listener);
}