本文整理汇总了Java中com.avos.avoscloud.AVQuery.orderByDescending方法的典型用法代码示例。如果您正苦于以下问题:Java AVQuery.orderByDescending方法的具体用法?Java AVQuery.orderByDescending怎么用?Java AVQuery.orderByDescending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVQuery
的用法示例。
在下文中一共展示了AVQuery.orderByDescending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSendRequests
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public void findSendRequests(FindCallback findCallback,boolean orderAsc,Map<String,Object> conditions){
AVUser user = HiTalkHelper.getInstance().getCurrentUser();
AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class);
q.whereEqualTo(AddRequest.FROM_USER, user);
if (conditions != null) {
for (Map.Entry<String,Object> entry : conditions.entrySet()){
q.whereEqualTo(entry.getKey(),entry.getValue());
}
}
if (orderAsc) {
q.orderByAscending(AVObject.CREATED_AT);
} else {
q.orderByDescending(AVObject.CREATED_AT);
}
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(findCallback);
}
示例2: getNewWords
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
* 获取最新词条
*/
private void getNewWords(){
newWords = new ArrayList<>();
AVQuery<AVObject> query=new AVQuery<>("word");
query.setLimit(21);
query.orderByDescending("updatedAt");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
HashSet<String> set=new HashSet<>();//去重
for (AVObject item : list) {
if(!set.contains(item.getString("name"))){
newWords.add(item);
set.add(item.getString("name"));
}
}
newWordAdapter.notifyDataSetChanged();
refreshLayout.setRefreshing(false);
} else {
Log.e("get new words error",e.toString());
}
}
});
}
示例3: getData
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
* 获取音/视频资源
*/
private void getData(){
AVQuery<AVObject> query=new AVQuery<>("jxh");
// query.whereEqualTo("isVoice",false);
query.setLimit(1000);
query.orderByDescending("viewcount");
query.include("cover");
query.whereExists("cover");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if(e==null){
mList= (LinkedList<AVObject>) list;
if(adapter!=null)
adapter.notifyDataSetChanged();
}else {
Log.e("getVoice",e.toString());
}
}
});
}
示例4: refreshData
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void refreshData() {
AVUser user = AVUser.getCurrentUser();
AVQuery<AVObject> query = new AVQuery<>("user_join");
query.setLimit(1);
query.whereEqualTo("user", user);
query.include("idea");
query.include("idea.user");
query.orderByDescending("createAt");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (e == null) {
if (!list.isEmpty()) {
mData.clear();
mData.addAll(list);
mAdapter.notifyDataSetChanged();
mOffset = list.get(list.size() - 1).getInt("ideaId");
}
} else {
e.printStackTrace();
}
}
});
}
示例5: loadMoreData
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void loadMoreData() {
AVUser user = AVUser.getCurrentUser();
AVQuery<AVObject> query = new AVQuery<>("user_join");
query.setLimit(1);
query.whereEqualTo("user", user);
query.include("idea");
query.include("idea.user");
query.orderByDescending("createAt");
query.whereLessThan("ideaId", mOffset);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (e == null) {
if (!list.isEmpty()) {
mData.addAll(list);
mAdapter.notifyDataSetChanged();
mOffset = list.get(list.size() - 1).getInt("ideaId");
}
} else {
e.printStackTrace();
}
}
});
}
示例6: refreshData
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void refreshData() {
AVQuery<AVObject> query = new AVQuery<>("idea");
query.whereEqualTo("user", AVUser.getCurrentUser());
query.orderByDescending("createdAt");
query.setLimit(1);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (e == null) {
Log.i("list.size()", list.size() + "");
if (!list.isEmpty()) {
mData.clear();
mData.addAll(list);
mAdapter.notifyDataSetChanged();
mOffset = mData.get(mData.size() - 1).getInt("ideaId");
}
} else {
e.printStackTrace();
}
}
});
}
示例7: loadMoreData
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private void loadMoreData() {
AVQuery<AVObject> query = new AVQuery<>("idea");
query.setLimit(1);
query.whereEqualTo("user", AVUser.getCurrentUser());
query.orderByDescending("createdAt");
query.whereLessThan("ideaId", mOffset);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (e == null) {
if (!list.isEmpty()) {
mData.addAll(list);
mAdapter.notifyDataSetChanged();
mOffset = list.get(list.size() - 1).getInt("ideaId");
}
}else {
e.printStackTrace();
}
}
});
}
示例8: isDownloadImage
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
* 从服务器查看是否需要下载图片
*
* @param callBack
*/
public void isDownloadImage(final IsDownloadCallBack callBack) {
AVQuery<AVObject> query = new AVQuery<AVObject>(CLASS_NAME);
query.orderByDescending(ID);
query.setLimit(1);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (null == e) {
if (list.size() == 1) {
if (sp.getInt("image", -1) < list.get(0).getInt(ID)) {
callBack.done(true, list.get(0));
} else {
callBack.done(false, null);
}
} else
callBack.done(false, null);
} else
callBack.done(false, null);
}
});
}
示例9: findAddRequests
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public void findAddRequests(int skip, int limit, FindCallback findCallback) {
AVUser user = HiTalkHelper.getInstance().getCurrentUser();
AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class);
q.include(AddRequest.FROM_USER);
q.skip(skip);
q.limit(limit);
q.whereEqualTo(AddRequest.TO_USER, user);
q.orderByDescending(AVObject.CREATED_AT);
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(findCallback);
}
示例10: loadMoreDataQuery
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private AVQuery<BnRemote> loadMoreDataQuery(BnItem lastBnItem){
AVQuery<BnRemote> query = AVQuery.getQuery(BnRemote.class);
initQuery(query);
query.limit(18);
query.whereEqualTo("isAll",true);
query.orderByDescending(BnItem.getCreateTimeFieldName());
query.include(BnItem.getUserName());
query.whereLessThan(BnItem.getCreateTimeFieldName(),lastBnItem.getCreateTime());
return query;
}
示例11: refreshDataQuery
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
private AVQuery<BnRemote> refreshDataQuery(){
AVQuery<BnRemote> query = AVQuery.getQuery(BnRemote.class);
initQuery(query);
query.limit(18);
query.whereEqualTo("isAll",true);
query.orderByDescending(BnItem.getCreateTimeFieldName());
query.include(BnItem.getUserName());
return query;
}
示例12: getMoreNote
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public static List<AVObject> getMoreNote(String user, int skip, int limit, boolean isFirst)
throws AVException {
AVQuery<AVObject> query = new AVQuery<>("Note");
query.whereEqualTo("user_tel", user);
query.orderByDescending("note_editedAt");
query.setLimit(limit);
query.setSkip(isFirst ? skip : 0);
return query.find();
}
示例13: getStory
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
/**
* 获取故事列表
*/
public void getStory(){
AVQuery<AVObject> query=new AVQuery<>("story");
query.setSkip(skip);
skip=skip+30;
query.setLimit(30);
query.orderByDescending("createdAt");
query.include("provider");//包括provider 避免重复查询
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
for (AVObject item : list) {
storyList.add(item);
}
adapter.notifyDataSetChanged();
refreshLayout.setRefreshing(false);
} else {
Log.e("get story list error", e.toString());
}
}
});
}
示例14: findShots
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public static List<Shot> findShots() {
// 查询当前Todo列表
AVQuery<Shot> query = AVQuery.getQuery(Shot.class);
// 按照更新时间降序排序
query.orderByDescending("updatedAt");
// 最大返回1000条
query.limit(1000);
try {
return query.find();
} catch (AVException exception) {
Log.e("tag", "Query todos failed.", exception);
return Collections.emptyList();
}
}
示例15: findNotes
import com.avos.avoscloud.AVQuery; //导入方法依赖的package包/类
public static List<Note> findNotes() {
AVQuery<Note> query = AVQuery.getQuery(Note.class);
query.orderByDescending("updatedAt");
query.limit(1000);
try {
return query.find();
} catch (AVException e) {
Log.e("tag", "Query notes failed.", e);
return Collections.emptyList();
}
}