當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseQuery.orderByDescending方法代碼示例

本文整理匯總了Java中com.parse.ParseQuery.orderByDescending方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseQuery.orderByDescending方法的具體用法?Java ParseQuery.orderByDescending怎麽用?Java ParseQuery.orderByDescending使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.parse.ParseQuery的用法示例。


在下文中一共展示了ParseQuery.orderByDescending方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: refresh

import com.parse.ParseQuery; //導入方法依賴的package包/類
/**
 * Refreshes the SnackList. That is, queries Parse for the current user's SnackEntrys and
 * repopulates the SnackList with the result. If the query fails, the SnackList remains
 * unchanged.
 *
 * @param callback Optional. The callback to invoke after completion.
 */
public void refresh(@Nullable final FindCallback<SnackEntry> callback){
    Log.d(TAG, "Refresh start");
    notifyUpdateStart();

    ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class);
    query.orderByDescending("createdAt");
    query.whereEqualTo("owner", targetUser);
    query.setLimit(10);
    query.findInBackground(new FindCallback<SnackEntry>() {
        @Override
        public void done(List<SnackEntry> refreshedSnacks, ParseException e) {
            if (e == null) {
                snacks.clear();
                snacks.addAll(refreshedSnacks);
            }

            if (callback != null) {
                callback.done(refreshedSnacks, e);
            }
            notifyUpdateComplete(e);
        }
    });
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:31,代碼來源:SnackList.java

示例2: getMatches

import com.parse.ParseQuery; //導入方法依賴的package包/類
public static void getMatches(final ActionDataCallbacks callbacks) {
    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(TABLE_NAME);
    query.whereEqualTo(COLUMN_BY_USER, ParseUser.getCurrentUser().getObjectId());
    query.whereEqualTo(COLUMN_TYPE, TYPE_MATCHED);
    query.orderByDescending(COLUMN_UPDATED_AT);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, ParseException e) {
            if(e == null) {
                List<String> ids = new ArrayList<String>();
                for(ParseObject object : list) {
                    ids.add(object.getString(COLUMN_TO_USER));
                }

                if(callbacks != null) {
                    callbacks.onFetchedMatches(ids);
                }
            }
        }
    });
}
 
開發者ID:fadelakin,項目名稱:bitdate,代碼行數:22,代碼來源:ActionDataSource.java

示例3: onCreate

import com.parse.ParseQuery; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    ParseQuery<ParseObject> query = ParseQuery.getQuery("EventData");
    query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> events, ParseException e) {
            if (e == null) {
                mEvents = events;

                EventAdapter adapter = new EventAdapter(getListView().getContext(), mEvents);
                setListAdapter(adapter);

            } else {

            }
        }
    });


}
 
開發者ID:gokcan,項目名稱:Volo,代碼行數:23,代碼來源:HomeFragment.java

示例4: onCreate

import com.parse.ParseQuery; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    ParseQuery<ParseObject> query = ParseQuery.getQuery("event_user");
    query.whereEqualTo("userID", ParseUser.getCurrentUser().getObjectId() );
    query.whereEqualTo("isPart", true);
            query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> events, ParseException e) {
            if (e == null) {
                mParticipatedEvents= events;

                ProfileListAdapter adapter = new ProfileListAdapter(getListView().getContext(), mParticipatedEvents);
                setListAdapter(adapter);



            } else {

            }
        }
    });


}
 
開發者ID:gokcan,項目名稱:Volo,代碼行數:27,代碼來源:ProfileListFragment.java

示例5: UserViewAdapter

import com.parse.ParseQuery; //導入方法依賴的package包/類
public UserViewAdapter(Context context) {
	super(context, new ParseQueryAdapter.QueryFactory<Photo>() {
		public ParseQuery<Photo> create() {
			
			// Get the current user's photos
			ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo");
			photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser());
			photosFromCurrentUserQuery.whereExists("thumbnail");
			
			photosFromCurrentUserQuery.include("user");
			photosFromCurrentUserQuery.orderByDescending("createdAt");
			
			return photosFromCurrentUserQuery;
		}
	});
}
 
開發者ID:salmank888,項目名稱:Anypic-Android,代碼行數:17,代碼來源:UserViewAdapter.java

示例6: loadMoreData

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void loadMoreData(Integer currentCount){
    if(!isUpdating){
        notifyUpdateStart();
        ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class);
        query.orderByDescending("createdAt");
        query.whereEqualTo("owner", targetUser);
        query.setLimit(10);
        query.setSkip(currentCount);
        query.findInBackground(new FindCallback<SnackEntry>() {
            @Override
            public void done(List<SnackEntry> moreSnacks, ParseException e) {
                if (e == null) {
                    snacks.addAll(moreSnacks);
                }

                notifyUpdateComplete(e);
            }
        });
    }
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:21,代碼來源:SnackList.java

示例7: doInBackground

import com.parse.ParseQuery; //導入方法依賴的package包/類
@Override
protected Integer doInBackground(String... params) {
    if (!mNetworkCallback.checkNetworkStatus()){
        return -1;
    }
    try { //Query Parse for the user's pings
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Pings");
        query.whereEqualTo("User", user);
        query.orderByDescending("createdAt");
        pingsList = query.find();
    } catch (ParseException e) {return e.getCode();}//return exception code
    return 0;//no issues
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:14,代碼來源:PingsPageFragment.java

示例8: populateTrainers

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void populateTrainers() {
    final TrainersListFragment finalFragment = fragment;
    ParseQuery<Trainer> query = ParseQuery.getQuery("Trainer");
    query.include("favorited_by");
    query.orderByDescending("createdAt");
    query.findInBackground(new FindCallback<Trainer>() {
        public void done(List<Trainer> trainers, ParseException e) {
            hideProgressWheel();
            if (e == null) {
                hideProgressWheel();
                Log.d("DEBUG", "Retrieved " + trainers.size() + " trainers");
                refreshFragment(trainers);
            } else {
                Log.d("DEBUG", "Error: " + e.getMessage());
            }
        }
    });
}
 
開發者ID:fitness-buddy,項目名稱:Fitness-Buddy-Group-Project,代碼行數:19,代碼來源:HomeActivity.java

示例9: getNotes

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void getNotes() {
    clear_lists();
    ParseQuery<ParseObject> query = new ParseQuery<>(
            "Notes");

    query.orderByDescending("createdAt");
    query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, ParseException e) {
            for (ParseObject notes : parseObjects) {

                notesBranchName.add((String) notes.get("branchName"));
                notesSubjectName.add((String) notes.get("subjectName"));
                notesCollegeName.add((String) notes.get("collegeName"));
                notesTopicName.add((String) notes.get("topicName"));
                uploadedBy.add((String) notes.get("userName"));
                notesFirstImage.add((ArrayList<ParseFile>) notes.get("notesImages"));


            }
            notesCustomGridViewAdapter = new NotesCustomGridViewAdapter(getActivity(), notesCollegeName,
                    notesBranchName, notesTopicName, notesSubjectName, notesFirstImage, uploadedBy);

            mRecyclerView.setAdapter(notesCustomGridViewAdapter);
        }

    });
}
 
開發者ID:teamOSC,項目名稱:Studddinv2_android,代碼行數:30,代碼來源:NotesSearchFragment.java

示例10: loadConversation

import com.parse.ParseQuery; //導入方法依賴的package包/類
private void loadConversation() {
    ParseQuery<ParseObject> chatquery = new ParseQuery<ParseObject>("Chat");
    if (convList.size() == 0) {
        ArrayList<String> chatl = new ArrayList<>();
        chatquery.whereContainedIn("sender", chatl);
        chatquery.whereContainedIn("receiver", chatl);
    } else {
        if (lastmsgDate != null) {
            chatquery.whereGreaterThan("createdAt", lastmsgDate);
            chatquery.whereEqualTo("sender", UserList.user.getUsername());
            chatquery.whereEqualTo("receiver", UserList.nameFromList);
        }
    }
    chatquery.orderByDescending("createdAt");
    chatquery.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> objects, ParseException e) {
            if (objects != null && objects.size() > 0) {
                for (int i = objects.size() - 1; i >= 0; i--) {
                    ParseObject pobject = objects.get(i);
                    Conversation c = new Conversation(pobject.get("message").toString(),
                            pobject.get("sender").toString(), pobject.getCreatedAt());
                    convList.add(c);
                    if (lastmsgDate == null || lastmsgDate.before(c.getDate())) {
                        lastmsgDate = c.getDate();
                    }
                    adapter.notifyDataSetChanged();
                }
            }
        }
    });
}
 
開發者ID:getsadzeg,項目名稱:mtredi,代碼行數:33,代碼來源:Chat.java

示例11: doInBackground

import com.parse.ParseQuery; //導入方法依賴的package包/類
@Override
protected Void doInBackground(Void... params) {

    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("ToDoApp");
    query.orderByDescending("_created_at");
    query.whereEqualTo("userID",currentUser.get("userID"));
    try {
        noteList = query.find();
    } catch (ParseException e) {
        Crouton.makeText(getActivity(), getString(R.string.wentWrong) + e.getMessage(), Style.ALERT).show();
    }
    return null;
}
 
開發者ID:safakesberk,項目名稱:Cloud_Base-To-Do-App,代碼行數:14,代碼來源:MyNotes.java

示例12: HomeViewAdapter

import com.parse.ParseQuery; //導入方法依賴的package包/類
public HomeViewAdapter(Context context) {
	super(context, new ParseQueryAdapter.QueryFactory<Photo>() {
		public ParseQuery<Photo> create() {
			
			// First, query for the friends whom the current user follows
			ParseQuery<com.parse.anypic.Activity> followingActivitiesQuery = new ParseQuery<com.parse.anypic.Activity>("Activity");
			followingActivitiesQuery.whereMatches("type", "follow");
			followingActivitiesQuery.whereEqualTo("fromUser", ParseUser.getCurrentUser());
			
			// Get the photos from the Users returned in the previous query
			ParseQuery<Photo> photosFromFollowedUsersQuery = new ParseQuery<Photo>("Photo");
			photosFromFollowedUsersQuery.whereMatchesKeyInQuery("user", "toUser", followingActivitiesQuery);
			photosFromFollowedUsersQuery.whereExists("image");
			
			// Get the current user's photos
			ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo");
			photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser());
			photosFromCurrentUserQuery.whereExists("image");
			
			// We create a final compound query that will find all of the photos that were
		    // taken by the user's friends or by the user
			ParseQuery<Photo> query = ParseQuery.or(Arrays.asList( photosFromFollowedUsersQuery, photosFromCurrentUserQuery ));
			query.include("user");
			query.orderByDescending("createdAt");
			
			return query;
		}
	});
}
 
開發者ID:salmank888,項目名稱:Anypic-Android,代碼行數:30,代碼來源:HomeViewAdapter.java

示例13: fetchMessages

import com.parse.ParseQuery; //導入方法依賴的package包/類
/**
 * Fetches a full list of messages between two users.
 *
 * @param user1 The first user
 * @param user2 The second user
 * @param callback The callback to invoke upon completion.
 */
private void fetchMessages(ParseUser user1, ParseUser user2, int limit, int skip, final FindCallback<Message> callback) {
    List<ParseQuery<Message>> orQueries = new ArrayList<>();
    ParseQuery<Message> oredQuery;

    isUpdating = true;

    Log.d("Conversations", "Skip is " + skip);

    orQueries.add(ParseQuery.getQuery(Message.class)
                    .whereEqualTo(Message.FROM_KEY, user1)
                    .whereEqualTo(Message.TO_KEY, user2)
    );
    orQueries.add(ParseQuery.getQuery(Message.class)
                    .whereEqualTo(Message.TO_KEY, user1)
                    .whereEqualTo(Message.FROM_KEY, user2)
    );
    oredQuery = ParseQuery.or(orQueries);
    oredQuery.include(Message.FROM_KEY).include(Message.TO_KEY);
    oredQuery.orderByDescending("createdAt");
    oredQuery.setLimit(limit);
    oredQuery.setSkip(skip);
    oredQuery.findInBackground(new FindCallback<Message>() {
        @Override
        public void done(List<Message> messages, ParseException e) {
            if (e == null) {
                if (messages.size() > 0) {
                    ParseUser fromUser = messages.get(0).getFromUser();
                    ParseUser toUser = messages.get(0).getToUser();
                    // Null users not allowed
                    if (fromUser == null || toUser == null) {
                        messages.clear();
                    }
                }
                callback.done(messages, e);
                isUpdating = false;
            }
        }
    });
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:47,代碼來源:Conversations.java

示例14: getLatestEntryData

import com.parse.ParseQuery; //導入方法依賴的package包/類
private String getLatestEntryData(ParseUser user) {
    String returnValue = "Unable to retrieve";
    ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class);
    query.orderByDescending("updatedAt");
    query.whereEqualTo("owner", user);
    try {
        Format formatter = new SimpleDateFormat("EEE MMM dd, h:mm a");
        returnValue = formatter.format(query.getFirst().getCreatedAt());
    } catch (ParseException e) {

    }
    return returnValue;
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:14,代碼來源:ClientListAdapter.java

示例15: refreshQuestions

import com.parse.ParseQuery; //導入方法依賴的package包/類
public static void refreshQuestions(final Context context) {


        ParseQuery<ParseObject> query = ParseQuery.getQuery("Ques");
        query.orderByDescending("createdAt");
        query.include("user_profile");
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> parseObjects, ParseException e) {

                final List<SetterGetterQuestions> setterGetterQuestionsArrayList=new ArrayList<SetterGetterQuestions>();
                SetterGetterQuestions setterGetterQuestions=null;


                if (e == null && parseObjects.size() > 0) {

                    ParseObject.unpinAllInBackground(parseObjects);
                    ParseObject.pinAllInBackground(parseObjects);


                  //  String question[] = new String[parseObjects.size()];

                    for (int i = 0; i < parseObjects.size(); i++) {
                      //  question[i] = parseObjects.get(i).getString("question");
                        setterGetterQuestions=new SetterGetterQuestions();
                        String question= parseObjects.get(i).getString("question");
                        String  ObjectId = parseObjects.get(i).getObjectId();
                        String user=parseObjects.get(i).getString("User");

                        ParseObject profile_obj=parseObjects.get(i).getParseObject("user_profile");
                        ParseFile file =profile_obj.getParseFile("image");

                        String url="http://www.kybrdbnd.in";

                        if(file !=null)
                         url=file.getUrl();


                        String count=(parseObjects.get(i).getNumber("answer")).toString();

                        String times[]=parseObjects.get(i).getCreatedAt().toString().split(" ");
                        String time=times[1]+" "+times[2]+"  "+times[3];


                        setterGetterQuestions.setQuestion(question);
                        setterGetterQuestions.setObject_id(ObjectId);
                        setterGetterQuestions.setUser(user);
                        setterGetterQuestions.setTime(time);
                        setterGetterQuestions.setImageUrl(url);
                        setterGetterQuestions.answerCount(count);



                        setterGetterQuestionsArrayList.add(setterGetterQuestions);
                        setterGetterQuestions=null;

                    }
                    Ques.refreshQuestionsCallback(setterGetterQuestionsArrayList);
                   // Toast.makeText(context, " Ques Updated", Toast.LENGTH_LONG).show();
                } else {
                    Ques.refreshQuestionsCallback(null);
                }
            }
        });
    }
 
開發者ID:salRoid,項目名稱:Clasick,代碼行數:66,代碼來源:QAworks.java


注:本文中的com.parse.ParseQuery.orderByDescending方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。