当前位置: 首页>>代码示例>>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;未经允许,请勿转载。