com.vk.sdk.api.VKParameters Java Examples
The following examples show how to use
com.vk.sdk.api.VKParameters.
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: AudioListFragment.java From vk_music_android with GNU General Public License v3.0 | 6 votes |
private void removeAudio(VKApiAudio audio, int position) { VKApi.audio().delete(VKParameters.from("audio_id", audio.id, "owner_id", audio.owner_id)).executeWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { try { int responseCode = response.json.getInt("response"); if (responseCode == 1) { audioArray.remove(position); adapter.notifyItemRemoved(position); Snackbar.make(binding.getRoot(), R.string.track_removed, Snackbar.LENGTH_SHORT).show(); } } catch (JSONException e) { onError(null); } } @Override public void onError(VKError error) { Snackbar.make(binding.getRoot(), R.string.error_deleting_track, Snackbar.LENGTH_LONG).show(); } }); }
Example #2
Source File: MainActivity.java From vk_music_android with GNU General Public License v3.0 | 6 votes |
private void onAddPlaylistClicked() { View alertView = LayoutInflater.from(this).inflate(R.layout.layout_dialog_createplaylist, null, false); EditText playlistTitle = (EditText) alertView.findViewById(R.id.playlist_title); new AlertDialog.Builder(this) .setTitle(R.string.create_playlist) .setView(alertView) .setNegativeButton(android.R.string.cancel, null) .setPositiveButton(android.R.string.ok, (dialog, which) -> { VKApi.audio().addAlbum(VKParameters.from("title", playlistTitle.getText())).executeWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { loadPlaylists(); } }); }) .show(); }
Example #3
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 6 votes |
private boolean friends_getRequests(int offset, int count, int extended, int needs_mutual, int out, int sort, int suggested, CallbackContext context) { try { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("offset", offset); params.put("count", count); params.put("extended", extended); params.put("needs_mutual", needs_mutual); params.put("out", out); params.put("sort", sort); params.put("suggested", suggested); VKRequest req = VKApi.friends().getRequests(new VKParameters(params)); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #4
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean callApiMethod(String method, JSONObject params, CallbackContext context) { try { VKRequest req = new VKRequest(method, new VKParameters(VKJsonHelper.toMap(params))); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #5
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean friends_getOnline(int user_id, String order, int count, int offset, CallbackContext context) { try { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("user_id", user_id); params.put("order", order); params.put("count", count); params.put("offset", offset); VKRequest req = VKApi.friends().getOnline(new VKParameters(params)); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #6
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean usersGet(Map<String, Object> params, CallbackContext context) { try { VKRequest req = VKApi.users().get(new VKParameters(params)); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #7
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean usersSearch(Map<String, Object> params, CallbackContext context) { try { VKRequest req = VKApi.users().search(new VKParameters(params)); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #8
Source File: VKUploadWallPhotoRequest.java From cordova-social-vk with Apache License 2.0 | 5 votes |
@Override protected VKRequest getSaveRequest(JSONObject response) { VKRequest saveRequest; try { saveRequest = VKApi.photos().saveWallPhoto(new VKParameters(VKJsonHelper.toMap(response))); } catch (JSONException e) { return null; } if (mUserId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.USER_ID, mUserId)); if (mGroupId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId)); return saveRequest; }
Example #9
Source File: VKUploadAlbumPhotoRequest.java From cordova-social-vk with Apache License 2.0 | 5 votes |
@Override protected VKRequest getSaveRequest(JSONObject response) { VKRequest saveRequest; try { saveRequest = VKApi.photos().save(new VKParameters(VKJsonHelper.toMap(response))); } catch (JSONException e) { return null; } if (mAlbumId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.ALBUM_ID, mAlbumId)); if (mGroupId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId)); return saveRequest; }
Example #10
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean friends_getRecent(int count, CallbackContext context) { try { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("count", count); VKRequest req = VKApi.friends().getRecent(new VKParameters(params)); performRequest(req, context); return true; } catch(Exception ex) { return false; } }
Example #11
Source File: VKApiMessages.java From cordova-social-vk with Apache License 2.0 | 5 votes |
/** * https://vk.com/dev/messages.getDialogs * * @param params use parameters from description with VKApiConst class * @return Request for load */ public VKRequest getDialogs(VKParameters params) { return prepareRequest("getDialogs", params, new VKParser() { @Override public Object createModel(JSONObject object) { return new VKApiGetDialogResponse(object); } }); }
Example #12
Source File: VKUploadWallDocRequest.java From cordova-social-vk with Apache License 2.0 | 5 votes |
@Override protected VKRequest getSaveRequest(JSONObject response) { VKRequest saveRequest; try { saveRequest = VKApi.docs().save(new VKParameters(VKJsonHelper.toMap(response))); } catch (JSONException e) { return null; } if (mGroupId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId)); return saveRequest; }
Example #13
Source File: VKUploadDocRequest.java From cordova-social-vk with Apache License 2.0 | 5 votes |
@Override protected VKRequest getSaveRequest(JSONObject response) { VKRequest saveRequest; try { saveRequest = VKApi.docs().save(new VKParameters(VKJsonHelper.toMap(response))); } catch (JSONException e) { return null; } if (mGroupId != 0) saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId)); return saveRequest; }
Example #14
Source File: VKApiFriends.java From cordova-social-vk with Apache License 2.0 | 5 votes |
public VKRequest get(VKParameters params) { if (params.get("fields") != null) { return prepareRequest("get", params, VKUsersArray.class); } else { return prepareRequest("get", params); } }
Example #15
Source File: VKApiMessages.java From cordova-social-vk with Apache License 2.0 | 5 votes |
/** * https://vk.com/dev/messages.get * * @param params use parameters from description with VKApiConst class * @return Request for load */ public VKRequest get(VKParameters params) { return prepareRequest("get", params, new VKParser() { @Override public Object createModel(JSONObject object) { return new VKApiGetMessagesResponse(object); } }); }
Example #16
Source File: VKShareDialogDelegate.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private void makePostWithAttachments(VKAttachments attachments) { if (attachments == null) { attachments = new VKAttachments(); } if (mExistingPhotos != null) { attachments.addAll(mExistingPhotos); } if (mAttachmentLink != null) { attachments.add(new VKApiLink(mAttachmentLink.linkUrl)); } String message = mShareTextField.getText().toString(); final Long userId = Long.parseLong(VKSdk.getAccessToken().userId); VKRequest wallPost = VKApi.wall().post(VKParameters.from(VKApiConst.OWNER_ID, userId, VKApiConst.MESSAGE, message, VKApiConst.ATTACHMENTS, attachments.toAttachmentsString())); wallPost.executeWithListener(new VKRequest.VKRequestListener() { @Override public void onError(VKError error) { setIsLoading(false); if (mListener != null) { mListener.onVkShareError(error); } } @Override public void onComplete(VKResponse response) { setIsLoading(false); VKWallPostResult res = (VKWallPostResult) response.parsedModel; if (mListener != null) { mListener.onVkShareComplete(res.post_id); } dialogFragmentI.dismissAllowingStateLoss(); } }); }
Example #17
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 5 votes |
public VKRequest leave(final int group_id) { return prepareRequest("leave", new VKParameters() { { put(VKApiConst.GROUP_ID, String.valueOf(group_id)); } }); }
Example #18
Source File: VKUploadMessagesPhotoRequest.java From cordova-social-vk with Apache License 2.0 | 5 votes |
@Override protected VKRequest getSaveRequest(JSONObject response) { VKRequest saveRequest; try { saveRequest = VKApi.photos().saveMessagesPhoto(new VKParameters(VKJsonHelper.toMap(response))); } catch (JSONException e) { return null; } return saveRequest; }
Example #19
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest isMember(VKParameters params) { return prepareRequest("isMember", params); }
Example #20
Source File: VKApiAudio.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest addAlbum(VKParameters params) { return prepareRequest("addAlbum", params); }
Example #21
Source File: VKApiAudio.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest delete(VKParameters params) { return prepareRequest("delete", params); }
Example #22
Source File: VKApiFriends.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest getSuggestions(VKParameters params) { return prepareRequest("getSuggestions", params); }
Example #23
Source File: VKApiWall.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest reportComment(VKParameters params) { return prepareRequest("reportComment", params); }
Example #24
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest join(VKParameters params) { return prepareRequest("join", params); }
Example #25
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest leave(VKParameters params) { return prepareRequest("leave", params); }
Example #26
Source File: VKApiVideo.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest removeTag(VKParameters params) { return prepareRequest("removeTag", params); }
Example #27
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest search(VKParameters params) { return prepareRequest("search", params, VKApiCommunityArray.class); }
Example #28
Source File: VKApiGroups.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest getInvites(VKParameters params) { return prepareRequest("getInvites", params, VKApiCommunityArray.class); }
Example #29
Source File: VKApiVideo.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public VKRequest getComments(VKParameters params) { return prepareRequest("getComments", params); }
Example #30
Source File: VKUtil.java From cordova-social-vk with Apache License 2.0 | 4 votes |
public static VKParameters paramsFrom(Object... args) { return new VKParameters(mapFrom(args)); }