Java Code Examples for com.octo.android.robospice.persistence.DurationInMillis#ONE_HOUR
The following examples show how to use
com.octo.android.robospice.persistence.DurationInMillis#ONE_HOUR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StoresActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void executeSpiceRequest(boolean useCache) { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; if (storeId <= 0) { spiceManager.execute( AptoideUtils.RepoUtils.buildStoreRequest(storeName, Constants.STORE_CONTEXT), Constants.STORE_CONTEXT + "-" + storeName + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); } else { spiceManager.execute( AptoideUtils.RepoUtils.buildStoreRequest(storeId, Constants.STORE_CONTEXT), Constants.STORE_CONTEXT + "-" + storeId + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); } }
Example 2
Source File: AppViewActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void requestComments(boolean useCache) { long cacheExpiryDuration = (useCache || !forceReload) ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; // call list apkcomments, which need: storeName, packageName, versionName // http://webservices.aptoide.com/webservices/2/listApkComments/apps/com.android.vending/5.12.9/json AllCommentsRequest request = new AllCommentsRequest(); request.storeName = storeName; request.versionName = versionName; request.packageName = packageName; request.filters = Aptoide.filters; request.limit = MAX_COMMENTS_REQUEST; request.lang = AptoideUtils.StringUtils.getMyCountryCode(getActivity()); spiceManager.execute(request, "comments" + appName + appId + storeName + versionName + packageName, cacheExpiryDuration, requestCommentListener); }
Example 3
Source File: MoreReviewsActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
@Override protected void executeSpiceRequest(boolean useCache) { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; GetReviews.GetReviewList request = new GetReviews.GetReviewList(); if (homepage) { request.setOrderBy("rand"); } request.store_id = storeId; request.homePage = homepage; request.limit = REVIEWS_LIMIT; // in order to present the right info on screen after a screen rotation, always pass the bucketsize as cachekey spiceManager.execute(request, getBaseContext() + storeId + BUCKET_SIZE, cacheExpiryDuration,listener); }
Example 4
Source File: MoreSearchActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void executeEndlessSpiceRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute(AptoideUtils.RepoUtils.buildSearchRequest(query, SearchRequest.SEARCH_LIMIT, SearchRequest.OTHER_REPOS_SEARCH_LIMIT, offset, storeName), MoreSearchActivity.class.getSimpleName() + query + offset, cacheExpiryDuration, new RequestListener<SearchResults>() { @Override public void onRequestFailure(SpiceException spiceException) { if (mLoading && !displayableList.isEmpty()) { displayableList.remove(displayableList.size() - 1); getAdapter().notifyItemRemoved(displayableList.size()); } } @Override public void onRequestSuccess(SearchResults searchResults) { if (mLoading && !displayableList.isEmpty()) { displayableList.remove(displayableList.size() - 1); getAdapter().notifyItemRemoved(displayableList.size()); } List<SearchApk> apkList = searchResults.apkList; if (!apkList.isEmpty()) { displayableList.addAll(apkList); } offset += apkList.size(); getAdapter().notifyDataSetChanged(); swipeContainer.setEnabled(false); mLoading = false; } }); }
Example 5
Source File: MoreVersionsActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void executeEndlessSpiceRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute( AptoideUtils.RepoUtils.GetMoreAppVersionsRequest(getArguments().getString(Constants.PACKAGENAME_KEY), limit, offset), getBaseContext() + "-packageName-" + getArguments().getString(Constants.PACKAGENAME_KEY) + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false) + offset, cacheExpiryDuration, new RequestListener<DisplayableList>() { @Override public void onRequestFailure(SpiceException spiceException) { if (mLoading && !displayableList.isEmpty()) { displayableList.remove(displayableList.size() - 1); adapter.notifyItemRemoved(displayableList.size()); } } @Override public void onRequestSuccess(DisplayableList displayables) { if (mLoading && !displayableList.isEmpty()) { displayableList.remove(displayableList.size() - 1); adapter.notifyItemRemoved(displayableList.size()); } int index = displayableList.size(); displayableList.addAll(displayables); adapter.notifyItemRangeInserted(index, displayables.size()); offset += displayables.size(); mLoading = false; } }); }
Example 6
Source File: MoreVersionsActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { this.useCache = useCache; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; // in order to present the right info on screen after a screen rotation, always pass the bucketsize as cachekey spiceManager.execute( AptoideUtils.RepoUtils.GetMoreAppVersionsRequest(getArguments().getString(Constants.PACKAGENAME_KEY), limit, offset), getBaseContext() + "-packageName-" + getArguments().getString(Constants.PACKAGENAME_KEY) + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false) + offset, cacheExpiryDuration, listener); }
Example 7
Source File: MoreListViewItemsActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { this.useCache = useCache; this.offset = useCache ? offset : 0; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute( AptoideUtils.RepoUtils.buildViewItemsRequest(storeName, eventActionUrl, getLayoutMode(), offset), getBaseContext() + parseActionUrlIntoCacheKey(eventActionUrl) + getStoreId() + BUCKET_SIZE + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); }
Example 8
Source File: MoreStoreWidgetActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { this.useCache = useCache; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute( AptoideUtils.RepoUtils.buildStoreWidgetRequest(storeId, eventActionUrl), getBaseContext() + parseActionUrlIntoCacheKey(eventActionUrl) + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); }
Example 9
Source File: MoreFriendsInstallsActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; ListApksInstallsRequest request = new ListApksInstallsRequest(); // in order to present the right info on screen after a screen rotation, always pass the bucketsize as cachekey spiceManager.execute( request, getBaseContext() + BUCKET_SIZE + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, new RequestListener<TimelineListAPKsJson>() { @Override public void onRequestFailure(SpiceException spiceException) { handleErrorCondition(spiceException); } @Override public void onRequestSuccess(TimelineListAPKsJson timelineListAPKsJson) { handleSuccessCondition(); displayableList.clear(); setRecyclerAdapter(getAdapter()); if (timelineListAPKsJson != null && timelineListAPKsJson.usersapks != null && timelineListAPKsJson.usersapks.size() > 0) { for (TimelineListAPKsJson.UserApk userApk : timelineListAPKsJson.usersapks) { TimelineRow timeline = getTimelineRow(userApk); displayableList.add(timeline); } getAdapter().notifyDataSetChanged(); } } }); }
Example 10
Source File: MoreReviewsActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
protected void executeEndlessSpiceRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; GetReviews.GetReviewList request = new GetReviews.GetReviewList(); if (homepage) { request.setOrderBy("rand"); } request.store_id = storeId; request.homePage = homepage; request.limit = REVIEWS_LIMIT; request.offset = offset; spiceManager.execute(request, getBaseContext() + storeId + BUCKET_SIZE + offset, cacheExpiryDuration, endlessListener); }
Example 11
Source File: CommunityFragment.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { this.useCache = useCache; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; // in order to present the right info on screen after a screen rotation, always pass the bucketsize as cachekey spiceManager.execute( //AptoideUtils.RepoUtils.buildStoreRequest(getStoreId(), getFakeString(), getFakeString(), getBaseContext()), AptoideUtils.RepoUtils.buildStoreRequest(getStoreId(), getBaseContext(), AptoideUtils.UI.getEditorChoiceBucketSize()), getBaseContext() + "-" + getStoreId() + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); }
Example 12
Source File: AppViewActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void executeSpiceRequestWithPackageName(String packageName, String appName) { long cacheExpiryDuration = forceReload ? DurationInMillis.ALWAYS_EXPIRED : DurationInMillis.ONE_HOUR; spiceManager.execute( AptoideUtils.RepoUtils.buildGetAppRequestFromPackageName(packageName), packageName + appName + bucketSize, cacheExpiryDuration, listener); }
Example 13
Source File: LatestCommentsFragment.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override protected void executeSpiceRequest(boolean useCache) { mLoading = true; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; // hack: differentiate between coming from the storeActivity or from the AppviewActivity if (appView) { spiceManager.execute(buildAppRequest(), getBaseContext() + getPackageName() + BUCKET_SIZE, cacheExpiryDuration, listener); } else { // storeactivity spiceManager.execute(buildStoreRequest(), getBaseContext() + getStoreId() + BUCKET_SIZE, cacheExpiryDuration, listener); } }
Example 14
Source File: BaseWebserviceFragment.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
protected void executeSpiceRequest(boolean useCache) { this.swipeContainer.setEnabled(false); this.useCache = useCache; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; // in order to present the right info on screen after a screen rotation, always pass the bucketsize as cachekey spiceManager.execute( AptoideUtils.RepoUtils.buildStoreRequest(getStoreId(), getBaseContext()), getBaseContext() + "-" + getStoreId() + "-" + BUCKET_SIZE + "--" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); }
Example 15
Source File: AppViewActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void executeSpiceRequestWithMd5(String md5, String storeName) { long cacheExpiryDuration = forceReload ? DurationInMillis.ALWAYS_EXPIRED : DurationInMillis.ONE_HOUR; spiceManager.execute( AptoideUtils.RepoUtils.buildGetAppRequestFromMd5(md5, storeName), md5 + bucketSize, cacheExpiryDuration, listener); }
Example 16
Source File: MoreSearchActivity.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
@Override protected void executeSpiceRequest(boolean useCache) { mLoading = true; long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute(AptoideUtils.RepoUtils.buildSearchRequest(query, SearchRequest.SEARCH_LIMIT, SearchRequest.OTHER_REPOS_SEARCH_LIMIT, offset, storeName), query + offset + QUERY_BUNDLE_KEY + storeName, cacheExpiryDuration, listener); }
Example 17
Source File: LatestReviewsFragment.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
protected void executeEndlessSpiceRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; final GetReviewList request = buildRequest(); request.offset = offset; spiceManager.execute(request, getBaseContext() + storeId + BUCKET_SIZE + offset, cacheExpiryDuration, endlessListener); }
Example 18
Source File: LatestReviewsFragment.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
@Override protected void executeSpiceRequest(boolean useCache) { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; final GetReviewList request = buildRequest(); spiceManager.execute(request, getBaseContext() + storeId + BUCKET_SIZE, cacheExpiryDuration, listener); }
Example 19
Source File: MoreListViewItemsActivity.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
protected void executeEndlessSpiceRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; spiceManager.execute( AptoideUtils.RepoUtils.buildViewItemsRequest(storeName, eventActionUrl, getLayoutMode(), offset), getBaseContext() + parseActionUrlIntoCacheKey(eventActionUrl) + getStoreId() + BUCKET_SIZE + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false) + offset, cacheExpiryDuration, new RequestListener<StoreHomeTab>() { @Override public void onRequestFailure(SpiceException spiceException) { handleErrorCondition(spiceException); } @Override public void onRequestSuccess(StoreHomeTab tab) { if (getView() == null) { return; } if (mLoading && !displayableList.isEmpty()) { displayableList.remove(displayableList.size() - 1); adapter.notifyItemRemoved(displayableList.size()); } int index = displayableList.size(); displayableList.addAll(tab.list); adapter.notifyItemRangeInserted(index, tab.list.size()); // total and new offset is red here offset = tab.offset; total = tab.total; mLoading = false; // check for hidden items if (tab.hidden > 0 && AptoideUtils.getSharedPreferences().getBoolean(Constants.SHOW_ADULT_HIDDEN, true) && getFragmentManager().findFragmentByTag(Constants.HIDDEN_ADULT_DIALOG) == null) { AdultHiddenDialog dialog = new AdultHiddenDialog(); AptoideDialog.showDialogAllowingStateLoss(dialog, getFragmentManager(), Constants.HIDDEN_ADULT_DIALOG); } } } ); }
Example 20
Source File: CommunityFragment.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
private void executeCommentsRequest() { long cacheExpiryDuration = useCache ? DurationInMillis.ONE_HOUR * 6 : DurationInMillis.ALWAYS_EXPIRED; AllCommentsRequest request = new AllCommentsRequest(); request.storeName = getStoreName(); request.filters = Aptoide.filters; request.lang = AptoideUtils.StringUtils.getMyCountryCode(getContext()); request.limit = AptoideUtils.UI.getEditorChoiceBucketSize() * 4; spiceManager.execute(request, getBaseContext() + getStoreId()+BUCKET_SIZE, cacheExpiryDuration, new RequestListener<GetComments>() { @Override public void onRequestFailure(SpiceException spiceException) { Logger.printException(spiceException); } @Override public void onRequestSuccess(GetComments get) { if ("OK".equals(get.status) && get.list != null && get.list.size() > 0) { // range is the size of the list. Because the HeaderRow replaces the placeholder, it's not considered an insertion // why is this important? because of notifyItemRangeInserted int range = get.list.size(); int index = 0, originalIndex = 0; boolean placeHolderFound = false; for (Displayable display : displayableList) { if (display instanceof CommentPlaceHolderRow) { placeHolderFound = true; originalIndex = index = displayableList.indexOf(display); break; } } // prevent multiple requests adding to beginning of the list if (!placeHolderFound) { return; } HeaderRow header = new HeaderRow(getString(R.string.comments), true, COMMENTS_TYPE, BUCKET_SIZE, isHomePage(), getStoreId()); header.FULL_ROW = AptoideUtils.UI.getEditorChoiceBucketSize(); displayableList.set(index++, header); for (int i = 0; i < get.list.size(); i++) { // for (int i = 0; i < 7; i++) { Comment comment = get.list.get(i); CommentItem commentItem = getCommentRow(comment); displayableList.add(index++, commentItem); } getAdapter().notifyItemRangeInserted(originalIndex + 1, range); } } } ); }