本文整理匯總了Java中com.parse.ParseQuery.addDescendingOrder方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseQuery.addDescendingOrder方法的具體用法?Java ParseQuery.addDescendingOrder怎麽用?Java ParseQuery.addDescendingOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.addDescendingOrder方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCachedNotes
import com.parse.ParseQuery; //導入方法依賴的package包/類
public void getCachedNotes(final NoteAdapter adapter){
ParseQuery<Note> noteQuery = ParseQuery.getQuery(Note.class);
noteQuery.fromPin(NOTE);
noteQuery.addDescendingOrder("createdAt");
noteQuery.findInBackground(new FindCallback<Note>() {
@Override
public void done(List<Note> objects, ParseException e) {
adapter.updateItems(objects);
}
});
Log.d("RV", "NOTIFIED IN DATASYNC");
}
示例2: loadInternal
import com.parse.ParseQuery; //導入方法依賴的package包/類
private Observable<LoadResult<ExampleMessage>> loadInternal(@NonNull String conversationId, @NonNull LoadQuery.Type type, long timestamp) {
final ParseQuery<ParseObject> parseQuery = new ParseQuery<>(MessagesTable.NAME);
parseQuery.whereEqualTo(MessagesTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, conversationId));
parseQuery.addDescendingOrder(MessagesTable.Fields.CREATED_AT);
if (type == Type.OLDER) {
parseQuery.whereLessThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
else if (type == Type.NEWER) {
parseQuery.whereGreaterThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
parseQuery.setLimit(MAX_CHUNK_SIZE);
parseQuery.include(MessagesTable.Fields.IMAGE);
return mParseHelper.find(parseQuery)
.doOnNext(mSortMessagesAscending)
.flatMap(Observable::from)
.map(in -> ParseUtils.from(in, mParseHelper))
.toList()
.map(messages -> {
final boolean canLoadOlder;
final boolean canLoadNewer;
if (type == Type.OLDER) {
canLoadOlder = !messages.isEmpty();
canLoadNewer = true; // This will be ignored in any case since we are loading older messages
}
else if (type == Type.NEWER) {
canLoadOlder = true; // This will be ignored in any case since we are loading newer messages
canLoadNewer = !messages.isEmpty();
}
else {
canLoadOlder = !messages.isEmpty();
canLoadNewer = !messages.isEmpty();
}
return new LoadResult<>(messages, canLoadOlder, canLoadNewer);
})
.subscribeOn(Schedulers.io());
}
示例3: retrieveMessages
import com.parse.ParseQuery; //導入方法依賴的package包/類
private void retrieveMessages() {
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(ParseConstants.CLASS_MESSAGES);
query.whereEqualTo(ParseConstants.KEY_RECIPIENT_IDS, ParseUser.getCurrentUser().getObjectId());
query.addDescendingOrder(ParseConstants.KEY_CREATED_AT);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> messages, ParseException e) {
getActivity().setProgressBarIndeterminateVisibility(false);
if (mSwipeRefreshLayout.isRefreshing()) {
mSwipeRefreshLayout.setRefreshing(false);
}
if (e == null) {
// We found messages!
mMessages = messages;
String[] usernames = new String[mMessages.size()];
int i = 0;
for(ParseObject message : mMessages) {
usernames[i] = message.getString(ParseConstants.KEY_SENDER_NAME);
i++;
}
if (getListView().getAdapter() == null) {
MessageAdapter adapter = new MessageAdapter(
getListView().getContext(),
mMessages);
setListAdapter(adapter);
}
else {
// refill the adapter!
((MessageAdapter)getListView().getAdapter()).refill(mMessages);
}
}
}
});
}
示例4: refreshAdapter
import com.parse.ParseQuery; //導入方法依賴的package包/類
public void refreshAdapter(final boolean afterAdd){
ParseQuery<Guest> query = ParseQuery.getQuery("Guest");
query.whereEqualTo("partyID",id);
query.addDescendingOrder("createdAt");
if(afterAdd){
query.fromLocalDatastore();
}
query.findInBackground(new FindCallback<Guest>() {
@Override
public void done(List<Guest> parseObjects, ParseException e) {
if (e == null) {
Log.d("STATUS FINDING","SUCCESS " + parseObjects.size());
if(afterAdd){
Log.d("CLICK",click + "");
adapter.insert(parseObjects.get(parseObjects.size()-1),0);
}else {
adapter.clear();
adapter.addAll(parseObjects);
}
adapter.notifyDataSetChanged();
Log.d("LENGTH OF INFO", info.size() + "");
}
else{
Log.e("STATUS FINDING", "ERROR: " + e.getMessage());
}
}
});
}