当前位置: 首页>>代码示例>>Java>>正文


Java VKParameters类代码示例

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


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

示例1: onPlaylistClicked

import com.vk.sdk.api.VKParameters; //导入依赖的package包/类
@Override
public void onPlaylistClicked(VkApiAlbum playlist, int position) {
    if(binding.loadingIndicator.getVisibility() == View.VISIBLE){
        return; // Don't accept click events when loading
    }

    binding.loadingIndicator.setVisibility(View.VISIBLE);

    VKApi.audio().add(VKParameters.from("audio_id", audioToAdd.id, "owner_id", audioToAdd.owner_id, VKApiConst.ALBUM_ID, playlist.getId())).executeWithListener(new VKRequest.VKRequestListener() {
        @Override
        public void onComplete(VKResponse response) {
            if(listener != null){
                listener.onAudioAddedToPlaylist(audioToAdd, playlist);
            }
            dismissAllowingStateLoss();
        }
    });
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:19,代码来源:AddTrackToPlaylistDialogFragment.java

示例2: setVkParameters

import com.vk.sdk.api.VKParameters; //导入依赖的package包/类
/**
 * Serialize VKParameters map into http query parameters list
 *
 * @param params parameters map
 */
void setVkParameters(VKParameters params) {
    ArrayList<Pair<String, String>> pairs = new ArrayList<>(params.size());
    for (Map.Entry<String, Object> entry : params.entrySet()) {
        Object value = entry.getValue();
        if (value instanceof VKAttachments) {
            pairs.add(new Pair<>(entry.getKey(), ((VKAttachments) value).toAttachmentsString()));
        } else if (value instanceof Collection) {
            Collection<?> values = (Collection<?>) value;
            //VK style
            pairs.add(new Pair<>(entry.getKey(), TextUtils.join(",", values)));
        } else {
            pairs.add(new Pair<>(entry.getKey(), value == null ? null : String.valueOf(value)));
        }
    }
    this.parameters = pairs;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:22,代码来源:VKHttpClient.java

示例3: removeAudio

import com.vk.sdk.api.VKParameters; //导入依赖的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

示例4: onPlaylistItemLongClicked

import com.vk.sdk.api.VKParameters; //导入依赖的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.VKParameters; //导入依赖的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: getSaveRequest

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

示例7: getSaveRequest

import com.vk.sdk.api.VKParameters; //导入依赖的package包/类
@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;

}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:16,代码来源:VKUploadAlbumPhotoRequest.java

示例8: get

import com.vk.sdk.api.VKParameters; //导入依赖的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

示例9: get

import com.vk.sdk.api.VKParameters; //导入依赖的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

示例10: onResume

import com.vk.sdk.api.VKParameters; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    binding.loadingIndicator.setVisibility(View.VISIBLE);
    VKApi.audio().getAlbums(VKParameters.from(VKApiConst.OWNER_ID, user.getId())).executeWithListener(new VKRequest.VKRequestListener() {
        @Override
        public void onComplete(VKResponse response) {
            VkApiAlbumArrayResponse albumsResponse = gson.fromJson(response.responseString, VkApiAlbumArrayResponse.class);
            playlists.clear();
            playlists.addAll(albumsResponse.getResponse().getItems());

            for (VkApiAlbum album : playlists) {
                String fixedTitle;
                if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
                    fixedTitle = Html.fromHtml(album.getTitle(), Html.FROM_HTML_MODE_LEGACY).toString();
                } else {
                    fixedTitle = Html.fromHtml(album.getTitle()).toString();
                }
                album.setTitle(fixedTitle);
            }

            adapter.notifyDataSetChanged();
            binding.loadingIndicator.setVisibility(View.GONE);
        }

        @Override
        public void onError(VKError error) {
            binding.loadingIndicator.setVisibility(View.VISIBLE);
            Snackbar.make(binding.rcvPlaylists, "Error loading playlists", Snackbar.LENGTH_LONG).show();
        }
    });
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:34,代码来源:AddTrackToPlaylistDialogFragment.java

示例11: addAlbum

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

示例12: add

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

示例13: get

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

示例14: edit

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

示例15: getAlbumsByVideo

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


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