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


Java SpiceRequest类代码示例

本文整理汇总了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;
}
 
开发者ID:offerHere,项目名称:offer,代码行数:22,代码来源:CascadeExtension.java

示例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) {

        }
    });
}
 
开发者ID:stairs,项目名称:intermine-android,代码行数:17,代码来源:GetListsListener.java

示例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);
    }
}
 
开发者ID:anotherdev,项目名称:robospice-fluent-request,代码行数:37,代码来源:RequestCreator.java

示例4: onAddRequest

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
  if (spicerequest instanceof Client)
  {
    ((Client) spicerequest).setPersistentJsonStore(mPersistentJsonStore);
  }
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:JsonStoreExtension.java

示例5: onAddRequest

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
  if (spicerequest instanceof CacheManagerInterface)
  {
    ((CacheManagerInterface) spicerequest).setCacheManager(mCacheManager);
  }
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:CacheManagerExtension.java

示例6: onAddRequest

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
  if (spicerequest instanceof Client)
  {
    ((Client) spicerequest).setCascadeExtension(this);
  }
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:CascadeExtension.java

示例7: onAddRequest

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
  if (spicerequest instanceof Client)
  {
    ((Client) spicerequest).addRetrofitExtension(this);
  }
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:RetrofitExtension.java

示例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);
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:CoreService.java

示例9: onAddRequest

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void onAddRequest(SpiceRequest spicerequest)
{
  if (spicerequest instanceof Client)
  {
    ((Client) spicerequest).setContext(getContext().getApplicationContext());
  }
}
 
开发者ID:offerHere,项目名称:offer,代码行数:8,代码来源:ApplicationContextExtension.java

示例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));
}
 
开发者ID:KoljaTM,项目名称:Yarrn,代码行数:8,代码来源:ProjectsFragmentUnitTest.java

示例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"));
}
 
开发者ID:KoljaTM,项目名称:Yarrn,代码行数:36,代码来源:ProjectFragmentUnitTest.java

示例12: execute

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
public void execute(SpiceRequest<T> request) {
    mCreator.execute(request, mListener.orNull());
}
 
开发者ID:anotherdev,项目名称:robospice-fluent-request,代码行数:4,代码来源:RequestExecutor.java

示例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)) {}
}
 
开发者ID:offerHere,项目名称:offer,代码行数:6,代码来源:CascadeExtension.java

示例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);
}
 
开发者ID:offerHere,项目名称:offer,代码行数:6,代码来源:ApiRequest.java

示例15: execute

import com.octo.android.robospice.request.SpiceRequest; //导入依赖的package包/类
protected <T> void execute(SpiceRequest<T> request, RequestListener<T> listener) {
    mSpiceManager.execute(request, listener);
}
 
开发者ID:stairs,项目名称:intermine-android,代码行数:4,代码来源:BaseFragment.java


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