本文整理汇总了Java中com.octo.android.robospice.request.listener.RequestListener类的典型用法代码示例。如果您正苦于以下问题:Java RequestListener类的具体用法?Java RequestListener怎么用?Java RequestListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RequestListener类属于com.octo.android.robospice.request.listener包,在下文中一共展示了RequestListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: voteComment
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
public static void voteComment(SpiceManager spiceManager, int commentId,
String repoName,
String token,
RequestListener<GenericResponseV2> commentRequestListener,
AddApkCommentVoteRequest.CommentVote vote) {
AddApkCommentVoteRequest commentVoteRequest = new AddApkCommentVoteRequest();
commentVoteRequest.setRepo(repoName);
commentVoteRequest.setToken(token);
commentVoteRequest.setCmtid(commentId);
commentVoteRequest.setVote(vote);
spiceManager.execute(commentVoteRequest, commentRequestListener);
Toast.makeText(Aptoide.getContext(), Aptoide.getContext().getString(R.string.casting_vote), Toast.LENGTH_SHORT).show();
}
示例2: voteComment
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Override
public void voteComment(int commentId, AddApkCommentVoteRequest.CommentVote vote) {
RequestListener<GenericResponseV2> commentRequestListener = new AlmostGenericResponseV2RequestListener() {
@Override
public void CaseOK() {
Toast.makeText(MainActivity.this, getString(R.string.vote_submitted), Toast.LENGTH_LONG).show();
}
};
AptoideUtils.VoteUtils.voteComment(
spiceManager,
commentId,
Defaults.DEFAULT_STORE_NAME,
SecurePreferences.getInstance().getString("token", "empty"),
commentRequestListener,
vote);
}
示例3: voteComment
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Override
public void voteComment(int commentId, AddApkCommentVoteRequest.CommentVote vote) {
RequestListener<GenericResponseV2> commentRequestListener = new AlmostGenericResponseV2RequestListener() {
@Override
public void CaseOK() {
Toast.makeText(MoreCommentsActivity.this, getString(R.string.vote_submitted), Toast.LENGTH_LONG).show();
}
};
AptoideUtils.VoteUtils.voteComment(
spiceManager,
commentId,
Defaults.DEFAULT_STORE_NAME,
SecurePreferences.getInstance().getString("token", "empty"),
commentRequestListener,
vote);
}
示例4: voteComment
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Override
public void voteComment(int commentId, AddApkCommentVoteRequest.CommentVote vote) {
RequestListener<GenericResponseV2> commentRequestListener = new AlmostGenericResponseV2RequestListener() {
@Override
public void CaseOK() {
Toast.makeText(StoresActivity.this, getString(R.string.vote_submitted), Toast.LENGTH_LONG).show();
}
};
AptoideUtils.VoteUtils.voteComment(
spiceManager,
commentId,
storeName,
SecurePreferences.getInstance().getString("token", "empty"),
commentRequestListener,
vote);
}
示例5: voteComment
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Override
public void voteComment(int commentId, AddApkCommentVoteRequest.CommentVote vote) {
RequestListener<GenericResponseV2> commentRequestListener = new AlmostGenericResponseV2RequestListener() {
@Override
public void CaseOK() {
Toast.makeText(getActivity(), getString(R.string.vote_submitted), Toast.LENGTH_LONG).show();
}
};
AptoideUtils.VoteUtils.voteComment(
spiceManager,
commentId,
storeName,
SecurePreferences.getInstance().getString("token", "empty"),
commentRequestListener,
vote);
}
示例6: executeSpiceRequestWithAppRate
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
private void executeSpiceRequestWithAppRate(long appId, float rating) {
mRatingBar.setIsIndicator(true);
spiceManager.execute(AptoideUtils.RepoUtils.buildRateRequest(appId, rating), new RequestListener<RateApp>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
Toast.makeText(getActivity(), getString(R.string.error_occured), Toast.LENGTH_SHORT).show();
mRatingBar.setIsIndicator(false);
}
@Override
public void onRequestSuccess(RateApp rateApp) {
mRatingBar.setIsIndicator(false);
Toast.makeText(getActivity(), getString(R.string.appview_rate_Success), Toast.LENGTH_SHORT).show();
}
});
}
示例7: onFinishInflate
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Override protected void onFinishInflate() {
super.onFinishInflate();
if (isInEditMode()) {
addItem("tag 1");
addItem("tag 2");
addItem("tag 3");
return;
}
ButterKnife.inject(this);
data.getTopTags(new RequestListener<List<String>>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
Log.e("tags", "Failed to retrieve tags", spiceException);
}
@Override
public void onRequestSuccess(List<String> tags) {
for (String tag : tags) {
addItem(tag);
}
}
}, false);
}
示例8: onRequestSuccess
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的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) {
}
});
}
示例9: menuAddAsFavorite
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@OptionsItem(R.id.menu_add_as_favorite)
public void menuAddAsFavorite() {
new AddEditFavoriteDialog(getActivity(), new AddEditFavoriteDialog.AddEditFavoriteDialogListener() {
@Override
public void onSave(String comment, String tags) {
JsonObject updateData = new JsonObject();
updateData.addProperty("type", "pattern");
updateData.addProperty("favorited_id", patternId);
updateData.addProperty("comment", comment);
updateData.addProperty("tag_names", tags);
spiceManager.execute(new AddFavoriteRequest(prefs, getActivity().getApplication(), updateData), new RequestListener<BookmarkShort>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
AQUtility.report(spiceException);
}
@Override
public void onRequestSuccess(BookmarkShort bookmarkShort) {
Toast.makeText(getActivity(), R.string.add_favorite_success, Toast.LENGTH_LONG).show();
}
});
}
}, prefs).show();
}
示例10: menuAddAsFavorite
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@OptionsItem(R.id.menu_add_as_favorite)
public void menuAddAsFavorite() {
new AddEditFavoriteDialog(getActivity(), new AddEditFavoriteDialog.AddEditFavoriteDialogListener() {
@Override
public void onSave(String comment, String tags) {
JsonObject updateData = new JsonObject();
updateData.addProperty("type", "project");
updateData.addProperty("favorited_id", projectId);
updateData.addProperty("comment", comment);
updateData.addProperty("tag_names", tags);
spiceManager.execute(new AddFavoriteRequest(prefs, getActivity().getApplication(), updateData), new RequestListener<BookmarkShort>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
AQUtility.report(spiceException);
}
@Override
public void onRequestSuccess(BookmarkShort bookmarkShort) {
Toast.makeText(getActivity(), R.string.add_favorite_success, Toast.LENGTH_LONG).show();
}
});
}
}, prefs).show();
}
示例11: menuAddAsFavorite
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@OptionsItem(R.id.menu_add_as_favorite)
public void menuAddAsFavorite() {
new AddEditFavoriteDialog(getActivity(), new AddEditFavoriteDialog.AddEditFavoriteDialogListener() {
@Override
public void onSave(String comment, String tags) {
JsonObject updateData = new JsonObject();
updateData.addProperty("type", "pattern");
updateData.addProperty("favorited_id", queuedProjectId);
updateData.addProperty("comment", comment);
updateData.addProperty("tag_names", tags);
spiceManager.execute(new AddFavoriteRequest(prefs, getActivity().getApplication(), updateData), new RequestListener<BookmarkShort>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
AQUtility.report(spiceException);
}
@Override
public void onRequestSuccess(BookmarkShort bookmarkShort) {
Toast.makeText(getActivity(), R.string.add_favorite_success, Toast.LENGTH_LONG).show();
}
});
}
}, prefs).show();
}
示例12: shouldAcceptSortOrders
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Test
public void shouldAcceptSortOrders() {
// given
reset(spiceManager);
assertTrue(activity.getResources().getStringArray(R.array.project_sort_option_values)[2].equals("happiness"));
// when
projectsFragment.sort.setSelection(2);
projectsFragment.sort.getOnItemSelectedListener().onItemSelected(projectsFragment.sort, null, 2, 0);
// then
verify(spiceManager).execute(request.capture(), anyString(), anyInt(), any(RequestListener.class));
assertTrue(request.getValue().getCacheKey().toString().contains("sort=happiness"));
// when
reset(spiceManager);
projectsFragment.sortReverse.setChecked(true);
// then
verify(spiceManager).execute(request.capture(), anyString(), anyInt(), any(RequestListener.class));
assertTrue(request.getValue().getCacheKey().toString().contains("sort=happiness_"));
}
示例13: shouldSearchForQuery
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@Test
public void shouldSearchForQuery() {
// given
reset(spiceManager);
// when
favoritesFragment.query.setText("Doctor");
favoritesFragment.query.onEditorAction(EditorInfo.IME_ACTION_SEARCH);
// then
verify(spiceManager).execute(request.capture(), anyString(), anyInt(), any(RequestListener.class));
request.getValue().getCacheKey().toString().endsWith("query=Doctor");
// when
reset(spiceManager);
favoritesFragment.searchOptions.setSelection(0);
favoritesFragment.searchOptions.getOnItemSelectedListener().onItemSelected(favoritesFragment.searchOptions, null, 0, 0);
// then
verify(spiceManager).execute(request.capture(), anyString(), anyInt(), any(RequestListener.class));
request.getValue().getCacheKey().toString().endsWith("tag=Doctor");
}
示例14: addRequest
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void addRequest(CachedSpiceRequest<?> request, Set<RequestListener<?>> listRequestListener) {
if (request.getSpiceRequest() instanceof RetrofitSpiceRequest) {
RetrofitSpiceRequest retrofitSpiceRequest = (RetrofitSpiceRequest) request.getSpiceRequest();
retrofitSpiceRequest.setService(getRetrofitService(retrofitSpiceRequest.getRetrofitedInterfaceClass()));
}
super.addRequest(request, listRequestListener);
}
示例15: executeEndlessSpiceRequest
import com.octo.android.robospice.request.listener.RequestListener; //导入依赖的package包/类
private void executeEndlessSpiceRequest() {
long cacheDuration = DurationInMillis.ONE_HOUR * 6;
spiceManager.execute(AptoideUtils.RepoUtils.buildSearchRequest(query, SearchRequest.SEARCH_LIMIT, SearchRequest.OTHER_REPOS_SEARCH_LIMIT, offset, u_offset),
SearchActivity.CONTEXT+query+u_offset,cacheDuration,new RequestListener<SearchResults>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
}
@Override
public void onRequestSuccess(SearchResults searchResults) {
if (mLoading && !displayables.isEmpty()) {
displayables.remove(displayables.size() - 1);
adapter.notifyItemRemoved(displayables.size());
}
List<SearchApk> uApkList = searchResults.uApkList;
if (!uApkList.isEmpty()) {
displayables.addAll(uApkList);
}
u_offset += uApkList.size();
adapter.notifyDataSetChanged();
mLoading = false;
}
});
}