com.octo.android.robospice.persistence.DurationInMillis Java Examples
The following examples show how to use
com.octo.android.robospice.persistence.DurationInMillis.
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: 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 #3
Source File: TimeLineFriendsInviteActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void rebuildList(final Bundle savedInstanceState) { final TimeLineFriendsInviteActivity c = this; ListUserFriendsRequest request = new ListUserFriendsRequest(); request.setOffset(0); request.setLimit(150); manager.execute(request,"friendslist" + SecurePreferences.getInstance().getString("access_token", "") , DurationInMillis.ONE_HOUR / 2, new TimelineRequestListener<ListUserFriendsJson>(){ @Override protected void caseFAIL() { Toast.makeText(c,R.string.error_occured,Toast.LENGTH_LONG).show(); finish(); } @Override protected void caseOK(ListUserFriendsJson response) { adapter = new TimeLineFriendsCheckableListAdapter(c, response.getInactiveFriends()); //adapter.setOnItemClickListener(this); //adapter.setAdapterView(listView); listView.setAdapter(adapter); setFriends(response.getActiveFriends()); c.findViewById(android.R.id.empty).setVisibility(View.GONE); } }); }
Example #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: AppViewActivity.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void executeSpiceRequestWithAppId(long appId, @Nullable String storeName, String packageName) { long cacheExpiryDuration = forceReload ? DurationInMillis.ALWAYS_EXPIRED : DurationInMillis.ONE_HOUR; spiceManager.execute( AptoideUtils.RepoUtils.buildGetAppRequestFromAppId(appId, storeName, packageName), appId + bucketSize, cacheExpiryDuration, listener); }
Example #13
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 #14
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 #15
Source File: CategoryFragment.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; spiceManager.execute( buildStoreWidgetRequest(storeId, actionUrl), cacheKey + "-categoryStore-" + getStoreId() + "-" + BUCKET_SIZE + "-" + AptoideUtils.getSharedPreferences().getBoolean(Constants.MATURE_CHECK_BOX, false), cacheExpiryDuration, listener); }
Example #16
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 #17
Source File: SearchFragment.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
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; } }); }
Example #18
Source File: PostListEndlessAdapter.java From Broadsheet.ie-Android with MIT License | 5 votes |
public void fetchPosts() { if (postListRequest == null) { postListRequest = new PostListRequest(); postListRequest.setPage(currentPage); postListRequest.setSearchTerm(searchTerm); BaseFragmentActivity activity = (BaseFragmentActivity) getContext(); activity.getSpiceManager().execute(postListRequest, postListRequest.generateUrl(), DurationInMillis.ONE_MINUTE, new PostListListener()); } }
Example #19
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 #20
Source File: PostDetailFragment.java From Broadsheet.ie-Android with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mApp = (BroadsheetApplication) getActivity().getApplication(); if (savedInstanceState != null) { Log.d(TAG, "saved instance"); mPost = (Post) savedInstanceState.getSerializable(CURRENT_POST); mPostIndex = savedInstanceState.getInt(CURRENT_POST_ID, -1); } else { String url = getArguments().getString(ARG_ITEM_URL); if (url != null) { ((BaseFragmentActivity) getActivity()).onPreExecute(getResources().getString(R.string.posting_comment)); BaseFragmentActivity activity = (BaseFragmentActivity) getActivity(); PostRequest postRequest = new PostRequest(url); activity.getSpiceManager().execute(postRequest, url, DurationInMillis.ONE_MINUTE, new PostListener()); } else if (getArguments().containsKey(ARG_ITEM_ID)) { mPostIndex = getArguments().getInt(ARG_ITEM_ID); if (mPostIndex < mApp.getPosts().size()) { mPost = mApp.getPosts().get(mPostIndex); } } } setHasOptionsMenu(true); getActivity().setTitle(""); }
Example #21
Source File: DownloadSpiceRequest.java From Local-GSM-Backend with Apache License 2.0 | 5 votes |
public static void executeWith(Context context, SpiceManager spiceManager) { spiceManager.execute(new DownloadSpiceRequest(context.getApplicationContext()), DownloadSpiceRequest.CACHE_KEY, DurationInMillis.ALWAYS_EXPIRED, new RequestListener<Result>() { @Override public void onRequestFailure(SpiceException spiceException) { // ignore } @Override public void onRequestSuccess(DownloadSpiceRequest.Result result) { // ignore } }); }
Example #22
Source File: FragmentSocialTimeline.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
public void runRequest() { listAPKsInstallsRequest = new ListApksInstallsRequest(); if (lastId != null) { listAPKsInstallsRequest.setOffset_id(String.valueOf(lastId.intValue())); listAPKsInstallsRequest.setDownwardsDirection(); } manager.execute(listAPKsInstallsRequest, "timeline-posts-id" + (lastId != null ? lastId.intValue() : "") + username, DurationInMillis.ONE_HOUR / 2, listener); }
Example #23
Source File: FragmentSocialTimeline.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
public void refreshRequest() { listAPKsInstallsRequest = new ListApksInstallsRequest(); //listAPKsInstallsRequest.setOffset(String.valueOf(firstId.intValue())); //listAPKsInstallsRequest.setUpwardsDirection(); Logger.d("FragmentSocialTimeline", "notifydatasetchanged"); adapter.notifyDataSetChanged(); Logger.d("FragmentSocialTimeline", "restartAppending"); adapter.restartAppending(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { Logger.d("FragmentSocialTimeline", "RemovingData from Cache"); manager.removeDataFromCache(TimelineListAPKsJson.class, "timeline-posts-id" + username).get(); } catch (InterruptedException | ExecutionException e) { Logger.printException(e); } Logger.d("FragmentSocialTimeline", "Executing request"); manager.execute(listAPKsInstallsRequest, "timeline-posts-id" + username, DurationInMillis.ONE_HOUR / 2, listenerRefresh); } }); }
Example #24
Source File: FragmentSocialTimelineLayouts.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
public void getFriends(){ ListUserFriendsRequest request = new ListUserFriendsRequest(); String username = SecurePreferences.getInstance().getString("access_token", ""); manager.execute(request, "facebook-friends-" + username, DurationInMillis.ONE_HOUR ,new TimelineRequestListener<ListUserFriendsJson>() { @Override protected void caseOK(ListUserFriendsJson response) { setFriends((response)); } }); }
Example #25
Source File: FragmentSocialTimelineLayouts.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
private void rebuildList() { ListUserFriendsRequest request = new ListUserFriendsRequest(); request.setOffset(0); request.setLimit(150); manager.execute(request, "friendslist" + SecurePreferences.getInstance().getString("access_token", "") , DurationInMillis.ONE_HOUR ,new TimelineRequestListener<ListUserFriendsJson>() { @Override protected void caseOK(ListUserFriendsJson response) { loading.setVisibility(View.GONE); adapter = new TimeLineFriendsCheckableListAdapter(getActivity(), response.getInactiveFriends()); //adapter.setOnItemClickListener(this); //adapter.setAdapterView(listView); if(response.getInactiveFriends().isEmpty()){ layout.setVisibility(View.VISIBLE); email_friends.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TimeLineNoFriendsInviteActivity.sendMail(getActivity()); } }); }else{ layout_with_friends.setVisibility(View.VISIBLE); listView.setAdapter(adapter); } } }); }
Example #26
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 #27
Source File: OperationProgressDialog.java From wifi_backend with GNU General Public License v3.0 | 5 votes |
@Override public void onStart() { super.onStart(); if(!hasStartedRequest) { getSpiceManager().execute(getRequest(), getCacheKey(), DurationInMillis.ALWAYS_EXPIRED, this); hasStartedRequest = true; } else { getSpiceManager().addListenerIfPending(getRequest().getResultType(), getCacheKey(), this); } }
Example #28
Source File: ResetProgressDialog.java From wifi_backend with GNU General Public License v3.0 | 5 votes |
@Override public void onStart() { super.onStart(); getSpiceManager().execute( new ResetSpiceRequest(getContext().getApplicationContext()), TAG, DurationInMillis.ALWAYS_EXPIRED, this ); }
Example #29
Source File: DownloadService.java From aptoide-client with GNU General Public License v2.0 | 4 votes |
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(); }
Example #30
Source File: UpdateDatabaseFragment.java From Local-GSM-Backend with Apache License 2.0 | 4 votes |
@Click protected void update() { onDownloadStarted(); getSpiceManager().execute(new DownloadSpiceRequest(getContext()), DownloadSpiceRequest.CACHE_KEY, DurationInMillis.ALWAYS_EXPIRED, this); }