• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VKRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vk.sdk.api.VKRequest的典型用法代码示例。如果您正苦于以下问题:Java VKRequest类的具体用法?Java VKRequest怎么用?Java VKRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VKRequest类属于com.vk.sdk.api包,在下文中一共展示了VKRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onClick

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
@Override
public void onClick(View view) {
	setIsLoading(true);
	if (mAttachmentImages != null && VKSdk.getAccessToken() != null) {
		final Long userId = Long.parseLong(VKSdk.getAccessToken().userId);
		VKUploadWallPhotoRequest photoRequest = new VKUploadWallPhotoRequest(mAttachmentImages, userId, 0);
		photoRequest.executeWithListener(new VKRequest.VKRequestListener() {
			@Override
			public void onComplete(VKResponse response) {
				VKPhotoArray photos = (VKPhotoArray) response.parsedModel;
				VKAttachments attachments = new VKAttachments(photos);
				makePostWithAttachments(attachments);
			}

			@Override
			public void onError(VKError error) {
				setIsLoading(false);
				if (mListener != null) {
					mListener.onVkShareError(error);
				}
			}
		});
	} else {
		makePostWithAttachments(null);
	}
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:27,代码来源:VKShareDialogDelegate.java


示例2: removeAudio

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
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();
        }
    });
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:23,代码来源:AudioListFragment.java


示例3: onAddPlaylistClicked

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
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();
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:19,代码来源:MainActivity.java


示例4: onPlaylistItemLongClicked

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
private void onPlaylistItemLongClicked(VkApiAlbum playlist) {
    new AlertDialog.Builder(this)
            .setMessage("Are you sure you want to delete " + playlist.getTitle() + "?")
            .setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(android.R.string.ok, (dialog, which) -> {
                VKApi.audio().deleteAlbum(VKParameters.from(VKApiConst.ALBUM_ID, playlist.getId())).executeWithListener(new VKRequest.VKRequestListener() {
                    @Override
                    public void onComplete(VKResponse response) {
                        drawer.removeItem(playlist.getId());
                        loadPlaylists();
                        Snackbar.make(binding.slidinglayout, R.string.deleted_playlist, Snackbar.LENGTH_SHORT).show();
                    }
                });
            })
            .show();
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:17,代码来源:MainActivity.java


示例5: setPhoto

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public void setPhoto(final ImageView imageView, final Button button){
    VKParameters params = new VKParameters();
    params.put(VKApiConst.FIELDS, "photo_max_orig");

    VKRequest request = new VKRequest("users.get",params);
    request.executeWithListener(new VKRequest.VKRequestListener() {

        @Override
        public void onComplete(VKResponse response) {
            super.onComplete(response);
            JSONArray resp = null;
            try {
                resp = response.json.getJSONArray("response");
                JSONObject user = resp.getJSONObject(0);
                String photo_max_orig_url = user.getString("photo_max_orig");
                imageView.setVisibility(View.VISIBLE);
                button.setVisibility(View.GONE);
                Glide.with(context).load(photo_max_orig_url).into(imageView);
            } catch (JSONException e) {
                Log.d("VkSdkHelper", String.valueOf(e));
            }
            }

        @Override
        public void onError(VKError error) {
            super.onError(error);
        }
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:30,代码来源:VkSdkHelper.java


示例6: notificationBlock

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public void notificationBlock(){
    VKParameters params = new VKParameters();
    params.put("time","-1");
    VKRequest request = new VKRequest("account.setSilenceMode",params);
    request.executeWithListener(new VKRequest.VKRequestListener() {

        /*@Override
        public void onError(VKError error) {
            Log.d("Block", error.errorMessage);
        }*/
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:13,代码来源:VkSdkHelper.java


示例7: notificationReturn

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public void notificationReturn(){
    VKParameters params = new VKParameters();
    params.put("time","0");
    VKRequest request = new VKRequest("account.setSilenceMode",params);
    request.executeWithListener(new VKRequest.VKRequestListener() {

        /*@Override
        public void onError(VKError error) {
            Log.d("RETURN NOTIFICATION",error.errorMessage);
        }*/
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:13,代码来源:VkSdkHelper.java


示例8: get

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public VKRequest get(VKParameters params) {
    if (params.containsKey(VKApiConst.EXTENDED) && ((Integer) params.get(VKApiConst.EXTENDED)) == 1) {
        return prepareRequest("get", params, VKApiCommunityArray.class);
    } else {
        return prepareRequest("get", params);
    }
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:8,代码来源:VKApiGroups.java


示例9: getSaveRequest

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
@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;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:15,代码来源:VKUploadWallPhotoRequest.java


示例10: getSaveRequest

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
@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;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:11,代码来源:VKUploadMessagesPhotoRequest.java


示例11: wakeUpSession

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
/**
 * Checks if an access token exist and performs a try to use it again
 *
 * @param context            An application context for store an access token
 * @param loginStateCallback if callback specified, {@link VKCallback#onResult(Object)} method will be called after login state changed
 * @return true, if an access token exists and not expired
 */
public static boolean wakeUpSession(@NonNull final Context context, final VKCallback<LoginState> loginStateCallback) {
    final Context appContext = context.getApplicationContext();
    VKUIHelper.setApplicationContext(appContext);

    VKAccessToken token = VKAccessToken.currentToken();

    if (token != null && token.accessToken != null && !token.isExpired()) {
        forceLoginState(LoginState.Pending, loginStateCallback);
        trackVisitor(new VKRequest.VKRequestListener() {
            @Override
            public void onComplete(VKResponse response) {
                updateLoginState(context, loginStateCallback);
            }

            @Override
            public void onError(VKError error) {
                //Possible double call of access token invalid
                if (error != null && error.apiError != null && error.apiError.errorCode == 5) {
                    onAccessTokenIsInvalid(appContext);
                }
                updateLoginState(context, loginStateCallback);
            }
        });
        return true;
    }
    updateLoginState(context, loginStateCallback);
    return false;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:36,代码来源:VKSdk.java


示例12: get

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public VKRequest get(VKParameters params) {
    if (params.containsKey(EXTENDED) && (Integer) (params.get(EXTENDED)) == 1) {
        return prepareRequest("get", params, VKPostArray.class);
    } else {
        return prepareRequest("get", params);
    }
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:8,代码来源:VKApiWall.java


示例13: getDialogs

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
/**
 * 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);
        }
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:15,代码来源:VKApiMessages.java


示例14: getServerRequest

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
@Override
protected VKRequest getServerRequest() {
    if (mGroupId != 0)
        return VKApi.photos().getWallUploadServer(mGroupId);
    else
        return VKApi.photos().getWallUploadServer();
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:8,代码来源:VKUploadWallPhotoRequest.java


示例15: get

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
/**
 * https://vk.com/dev/users.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 VKList<>(object, VKApiUserFull.class);
        }
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:15,代码来源:VKApiUsers.java


示例16: get

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public VKRequest get() {
    return get(null);
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:4,代码来源:VKApiAudio.java


示例17: edit

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public VKRequest edit(VKParameters params) {
    return prepareRequest("edit", params);
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:4,代码来源:VKApiFriends.java


示例18: trackVisitor

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
private static void trackVisitor(VKRequest.VKRequestListener l) {
    VKRequest r = new VKRequest("stats.trackVisitor");
    r.attempts = 0;
    r.executeWithListener(l);
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:6,代码来源:VKSdk.java


示例19: getBanned

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public VKRequest getBanned(VKParameters params) {
    return prepareRequest("getBanned", params, VKUsersArray.class);
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:4,代码来源:VKApiGroups.java


示例20: Listener

import com.vk.sdk.api.VKRequest; //导入依赖的package包/类
public Listener(VKRequest.VKRequestListener listener) {
    this.listener = listener;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:4,代码来源:VKSyncRequestUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IEntityAdditionalSpawnData类代码示例发布时间:2022-05-21
下一篇:
Java IconView类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap