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


Java ParseQuery.orderByAscending方法代码示例

本文整理汇总了Java中com.parse.ParseQuery.orderByAscending方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.orderByAscending方法的具体用法?Java ParseQuery.orderByAscending怎么用?Java ParseQuery.orderByAscending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.parse.ParseQuery的用法示例。


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

示例1: localQuery

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void localQuery(){
    ParseQuery<Kid> lQuery = ParseQuery.getQuery(Kid.class).fromLocalDatastore();
    lQuery.orderByAscending("createdAt");
    lQuery.findInBackground(new FindCallback<Kid>() {
        @Override
        public void done(List<Kid> list, ParseException e) {
            if (e == null) {

                kidArrayList.clear();
                kidArrayList.addAll(list);
                fillHashMap();
                adapter = new AddAttendanceAdapter(AddAttendance.this,kidArrayList,activityMap);
                listView.setAdapter(adapter);
                listView.invalidate();
            }

        }
    });
}
 
开发者ID:amir511,项目名称:My-Sheep,代码行数:20,代码来源:AddAttendance.java

示例2: localQuery

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void localQuery(){
    ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class).fromLocalDatastore();
    query.orderByAscending("createdAt");
    query.findInBackground(new FindCallback<Kid>() {
        @Override
        public void done(List<Kid> list, @Nullable ParseException e) {
            if (e == null && list.size()!=0) {
                kidArrayList.clear();
                kidArrayList.addAll(list);
                applyAttendanceToKids();
                adapter.notifyDataSetChanged();
                listView.invalidate();
                   }
                    }
                });
}
 
开发者ID:amir511,项目名称:My-Sheep,代码行数:17,代码来源:MainActivity.java

示例3: serverQuery

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void serverQuery() {
ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class);
query.orderByAscending("createdAt");
query.findInBackground(new FindCallback<Kid>() {
    @Override
    public void done(List<Kid> list, @Nullable ParseException e) {
        if (e == null){
            kidArrayList.clear();
            kidArrayList.addAll(list);
            Kid.pinAllInBackground(kidArrayList);
            applyAttendanceToKids();
            adapter.notifyDataSetChanged();
            listView.invalidate();
        }else if(checkConnection()){
            toaster("Error getting data from Server\nWorking offline!","l");
        }
    }
});
        }
 
开发者ID:amir511,项目名称:My-Sheep,代码行数:20,代码来源:MainActivity.java

示例4: populateMessageHistory

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void populateMessageHistory() {
    String[] userIds = {currentUserId, recipientId};
    ParseQuery<ParseObject> query = ParseQuery.getQuery("ParseMessage");
    query.whereContainedIn("senderId", Arrays.asList(userIds));
    query.whereContainedIn("recipientId", Arrays.asList(userIds));
    query.orderByAscending("createdAt");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> messageList, com.parse.ParseException e) {
            if (e == null) {
                for (int i = 0; i < messageList.size(); i++) {
                    WritableMessage message = new WritableMessage(messageList.get(i).get("recipientId").toString(), messageList.get(i).get("messageText").toString());
                    if (messageList.get(i).get("senderId").toString().equals(currentUserId)) {
                        messageAdapter.addMessage(message, MessageAdapter.DIRECTION_OUTGOING);
                    } else {
                        messageAdapter.addMessage(message, MessageAdapter.DIRECTION_INCOMING);
                    }
                }
            }
        }
    });
}
 
开发者ID:Paulocajr,项目名称:IPRJapp,代码行数:23,代码来源:MessagingActivity.java

示例5: addNewMessages

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void addNewMessages() {
    String[] objectIds = {m_me.objectId, m_other.objectId};
    ParseQuery<Message> query = ParseQuery.getQuery("Message");
    query.whereContainedIn("fromObjectId", Arrays.asList(objectIds));
    query.whereContainedIn("toObjectId", Arrays.asList(objectIds));
    query.orderByAscending("createdAt");
    query.findInBackground(new FindCallback<Message>() {
        public void done(List<Message> messages, ParseException e) {
            if (e == null) {
                // Set the value of global current user object
                for (int i = 0; i < messages.size(); i++) {
                    Message message = messages.get(i);
                    if (!m_messages.contains(message)) {
                        messagesAdapter.add(message);
                        lvMessages.setSelection(lvMessages.getCount() - 1);
                    }
                }
            } else {
                Log.d("DEBUG", "Error: " + e.getMessage());
            }
        }
    });
}
 
开发者ID:fitness-buddy,项目名称:Fitness-Buddy-Group-Project,代码行数:24,代码来源:ChatActivity.java

示例6: visitHistoryDialog

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void visitHistoryDialog(){
    AlertDialog.Builder visitHistoryBuilder = new AlertDialog.Builder(KidDetail.this);
    visitHistoryBuilder.setCancelable(true);
    LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
    View view = inflater.inflate(R.layout.visit_history,null);
    visitHistoryBuilder.setView(view);
    final TextView historyText = (TextView) view.findViewById(R.id.historyText);
    final StringBuilder historyString = new StringBuilder();
    ParseQuery<Visit> query = ParseQuery.getQuery(Visit.class);//.fromLocalDatastore();
    query.whereContains("kidId",myKid.getObjectId());
    query.orderByAscending("createdAt");
    query.findInBackground(new FindCallback<Visit>() {
        @Override
        public void done(@NonNull List<Visit> list, @Nullable ParseException e) {
            if (e == null){
                if(list.size()!=0){
                for (int i = 0; i < list.size() ; i++) {
                    Visit visit = list.get(i);
                    historyString.append("Visit No. : "+ (i+1)+"\n");
                    historyString.append("Visit Date: "+visit.getVisitDate()+"\n");
                    historyString.append("Servants:\n "+visit.getServants()+"\n");
                    historyString.append("Visit summary:\n "+visit.getSummary()+"\n\n\n");
                    }
                    historyText.setText(historyString);
                }else{
                    historyText.setText("No visit history found!\nPlease pay a visit asap.");
                }

            }else{Toast.makeText(getApplicationContext(),"Error!",Toast.LENGTH_LONG).show();}
        }
    });

    AlertDialog historyDialog = visitHistoryBuilder.create();
    historyDialog.show();
}
 
开发者ID:amir511,项目名称:My-Sheep,代码行数:36,代码来源:KidDetail.java

示例7: fetchData

import com.parse.ParseQuery; //导入方法依赖的package包/类
public void fetchData(){
    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
            "Events");
    query.orderByAscending(ParseTables.Events.CREATED_AT);
    if(check_my_events){
        query.whereEqualTo(ParseTables.Events.CREATED_BY, ParseUser.getCurrentUser().getString("NAME"));
    }
    query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, ParseException e) {
            doneFetching(parseObjects);
        }
    });
}
 
开发者ID:teamOSC,项目名称:Studddinv2_android,代码行数:16,代码来源:EventsListFragment.java

示例8: receiveMessage

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void receiveMessage() {
    // Construct query to execute
    ParseQuery<Message> query = ParseQuery.getQuery(Message.class);
    // Configure limit and sort order
    query.setLimit(MAX_CHAT_MESSAGES_TO_SHOW);
    Log.d("me", ParseUser.getCurrentUser().getUsername().toString());
    String[] names = {ParseUser.getCurrentUser().getString("username"), profiles.displayProfile.getUserName()};
    query.whereContainedIn("userId", Arrays.asList(names));
    query.whereContainedIn("Receiver", Arrays.asList(names));
    query.orderByAscending("createdAt");
    // Execute query to fetch all messages from Parse asynchronously
    // This is equivalent to a SELECT query with SQL
    query.findInBackground(new FindCallback<Message>() {
        public void done(List<Message> messages, ParseException e) {
            if (e == null) {
                if (mMessages != null) {
                    mMessages.clear();
                    mMessages.addAll(messages);
                    mAdapter.notifyDataSetChanged(); // update adapter
                    lvChat.invalidate(); // redraw listview
                }
            } else {
                Log.d("message", "Error: " + e.getMessage());
            }
        }
    });
}
 
开发者ID:cfudge,项目名称:ClassDiscuss,代码行数:28,代码来源:ChatActivity.java

示例9: onResume

import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected void onResume() {
	super.onResume();
	
	mCurrentUser = ParseUser.getCurrentUser();
	mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);
	
	setProgressBarIndeterminateVisibility(true);
	
	ParseQuery<ParseUser> query = ParseUser.getQuery();
	query.orderByAscending(ParseConstants.KEY_USERNAME);
	query.setLimit(1000);
	query.findInBackground(new FindCallback<ParseUser>() {
		@Override
		public void done(List<ParseUser> users, ParseException e) {
			setProgressBarIndeterminateVisibility(false);
			
			if (e == null) {
				// Success
				mUsers = users;
				String[] usernames = new String[mUsers.size()];
				int i = 0;
				for(ParseUser user : mUsers) {
					usernames[i] = user.getUsername();
					i++;
				}
				if (mGridView.getAdapter() == null) {
					UserAdapter adapter = new UserAdapter(EditFriendsActivity.this, mUsers);
					mGridView.setAdapter(adapter);
				}
				else {
					((UserAdapter)mGridView.getAdapter()).refill(mUsers);
				}
				
				addFriendCheckmarks();
			}
			else {
				Log.e(TAG, e.getMessage());
				AlertDialog.Builder builder = new AlertDialog.Builder(EditFriendsActivity.this);
				builder.setMessage(e.getMessage())
					.setTitle(R.string.error_title)
					.setPositiveButton(android.R.string.ok, null);
				AlertDialog dialog = builder.create();
				dialog.show();
			}
		}
	});
}
 
开发者ID:NagabhushanS,项目名称:AmazingFriends,代码行数:49,代码来源:EditFriendsActivity.java

示例10: Build

import com.parse.ParseQuery; //导入方法依赖的package包/类
public static ParseQuery Build(String className, HashMap[] conditions) {

    ParseQuery<ParseObject> query = new ParseQuery(className);

    // Create a composite query via chaining
    for (int i = 0; i < conditions.length; ++i) {
      HashMap map = conditions[i];

      // These fields must be named exactly the same in the calling application
      String key = (String)map.get("key");
      String condition = (String)map.get("condition");
      Object value = map.get("value");

      if (HasValidConditions(map)) {

        // This sucks, but I don't really want to try to be clever and use
        // reflection to map conditions to method names. It's not by any means
        // a complete implementation, as it only contains condition matching
        // for basic operations.
        if (condition.equals("==")) {
          query = query.whereEqualTo(key, value);
        }
        else if (condition.equals("!=")) {
          query = query.whereNotEqualTo(key, value);
        }
        else if (condition.equals(">")) {
          query = query.whereGreaterThan(key, value);
        }
        else if (condition.equals("<")) {
          query = query.whereLessThan(key, value);
        }
        else if (condition.equals(">=")) {
          query = query.whereGreaterThanOrEqualTo(key, value);
        }
        else if (condition.equals("<=")) {
          query = query.whereLessThanOrEqualTo(key, value);
        }
        else if (condition.equals("exists")) {
          query = query.whereExists(key);
        }
        else if (condition.equals("notexists")) {
          query = query.whereDoesNotExist(key);
        }
        else if (condition.equals("orderby")) {
          if (value.equals("asc")) {
            query = query.orderByAscending(key);
          }
          else if (value.equals("desc")) {
            query = query.orderByDescending(key);
          }
          else {
            Log.e(TAG, "Unrecognized sorting order, use 'asc' or 'desc'.");
          }
        }
        else {
          Log.e(TAG, "The condition '"+ condition + "' was not recognized by " +
          "the module. Create a request for implementation on GitHub, or " +
          "implemented it and create a pull request.");
        }
      }
    }

    return query;
  }
 
开发者ID:E2010,项目名称:android-parse-module-titanium-3-5,代码行数:65,代码来源:QueryFactory.java

示例11: populateEvents

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void populateEvents() {

        String currentUser;
        final ProgressWheel progressWheel = (ProgressWheel) findViewById(R.id.progress_wheel);
        currentDate = Calendar.getInstance().getTime();// get current date
        final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
        final String strCurrentDate = simpleDateStrFormat.format(currentDate);
        if (SimpleUser.currentUserObjectId == null) {
            SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            currentUser = pref.getString("userId", "");
        } else {
            currentUser = SimpleUser.currentUserObjectId;
        }
        ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
        ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
        ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
        query.selectKeys(Arrays.asList("slot_date", "slot_time"));
        query.include("trainer_id");
        query.whereEqualTo("trainer_id", trainer);
        query.whereEqualTo("user_id", user);
        query.whereEqualTo("status", "addtocart");
        query.orderByAscending("slot_date");
        adSlots.clear();
        query.findInBackground(new FindCallback<ParseObject>() {
            public void done(List<ParseObject> trainerSlots, ParseException e) {
                if (e == null) {
                    for (ParseObject slots : trainerSlots) {
                        BlockedSlots b = new BlockedSlots();
                        b.setSlotDate(slots.getString("slot_date"));
                        b.setSlotTime(slots.getString("slot_time"));
                        try {
                            Date cDate = simpleDateStrFormat.parse(strCurrentDate);
                            Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
                            if (slotDate.after(cDate) || slotDate.equals(cDate)) {
                                alSlots.add(b);
                            }
                            adSlots.notifyDataSetChanged();
                        } catch (java.text.ParseException e1) {
                            e1.printStackTrace();
                        }
                        progressWheel.setVisibility(View.INVISIBLE);
                        adSlots.notifyDataSetChanged();
                    }
                } else {
                    Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>>         " + e);
                    progressWheel.setVisibility(View.INVISIBLE);
                }
            }
        });
        bHome.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent intent = new Intent(UpcomingEventsActivity.this, HomeActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
            }
        });
    }
 
开发者ID:fitness-buddy,项目名称:Fitness-Buddy-Group-Project,代码行数:60,代码来源:UpcomingEventsActivity.java

示例12: populateCart

import com.parse.ParseQuery; //导入方法依赖的package包/类
private void populateCart(){

        String currentUser;
        currentDate = Calendar.getInstance().getTime();// get current date
        final SimpleDateFormat simpleDateStrFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
        final String strCurrentDate = simpleDateStrFormat.format(currentDate);
        if (SimpleUser.currentUserObjectId == null){
            SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            currentUser = pref.getString("userId","n");
        }else {
            currentUser = SimpleUser.currentUserObjectId;
        }
        ParseObject trainer = ParseObject.createWithoutData("Trainer", Trainer.currentTrainerObjectId);
        ParseObject user = ParseObject.createWithoutData("SimpleUser", currentUser);
        ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
        query.selectKeys(Arrays.asList("slot_date","slot_time"));
        query.include("trainer_id");
        query.whereEqualTo("trainer_id", trainer);
        query.whereEqualTo("user_id", user);
        query.whereEqualTo("status", Constants.ADD_TO_CART);
        query.orderByAscending("slot_date");
        adSlots.clear();
        query.findInBackground(new FindCallback<ParseObject>() {
            public void done(List<ParseObject> trainerSlots, ParseException e) {
                if (e == null) {
                    for (ParseObject slots : trainerSlots) {
                        BlockedSlots b = new BlockedSlots();
                        b.setSlotDate(slots.getString("slot_date"));
                        b.setSlotTime(slots.getString("slot_time"));
                        try {
                            Date cDate = simpleDateStrFormat.parse(strCurrentDate);
                            Date slotDate = simpleDateStrFormat.parse(slots.getString("slot_date"));
                            if (slotDate.after(cDate) || slotDate.equals(cDate)) {
                                alSlots.add(b);
                            }
                            if (alSlots.size() > 0) {
                                int slotAmount = Trainer.currentPrice*alSlots.size();
                                int aSize = alSlots.size();
                                tvNoOfSlots.setText(aSize+" * $" +Trainer.currentPrice+".00 = $"+slotAmount+".00");
                                tvFooterTotalAmt.setText(Html.fromHtml("Total Amount: <b>$" + slotAmount + ".00</b>"));
                            }
                            adSlots.notifyDataSetChanged();
                        } catch (java.text.ParseException e1) {
                            e1.printStackTrace();
                        }
                        adSlots.notifyDataSetChanged();
                    }
                } else {
                    Log.v("DEBUG!!!!!!!!!!!!!", "Error occured >>>>>>>>>>>>>>>>>>         " + e);
                }
            }
        });
        bProceedtoPayment.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent intent = new Intent(CartActivity.this, PaymentActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.enter_from_bottom, R.anim.stay_in_place);
            }
        });
    }
 
开发者ID:fitness-buddy,项目名称:Fitness-Buddy-Group-Project,代码行数:63,代码来源:CartActivity.java

示例13: retreieveAnswers

import com.parse.ParseQuery; //导入方法依赖的package包/类
public static void retreieveAnswers(String objectId) {
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Answers");
    query.orderByAscending("createdAt");
    query.whereEqualTo("quesObjId",objectId);

   query.findInBackground(new FindCallback<ParseObject>() {
       @Override
       public void done(List<ParseObject> parseObjects, ParseException e) {
           final List<SetterGetterAnswers> setterGetterAnswersArrayList = new ArrayList<SetterGetterAnswers>();
           SetterGetterAnswers setterGetterAnswers = null;

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

               ParseObject.pinAllInBackground(parseObjects);


               for (int i = 0; i < parseObjects.size(); i++) {
                   setterGetterAnswers = new SetterGetterAnswers();
                   String answer = parseObjects.get(i).getString("User");
                   String answer_user = parseObjects.get(i).getString("answer");
                   String times[] = parseObjects.get(i).getCreatedAt().toString().split(" ");

                   String time[]=times[3].split(":");
                   String answer_time=times[1] + " " + times[2] + "  " + time[0]+":"+time[1];



                   setterGetterAnswers.setAnswer(answer);
                   setterGetterAnswers.setAnswer_user(answer_user);
                   setterGetterAnswers.setAnswer_time(answer_time);


                   setterGetterAnswersArrayList.add(setterGetterAnswers);
                   setterGetterAnswers = null;

               }

               AnswerShow.retrieveAnswersCallback(setterGetterAnswersArrayList, true);


           } else {
               //faild to download
               AnswerShow.retrieveAnswersCallback(setterGetterAnswersArrayList, false);
           }

       }
   });
}
 
开发者ID:salRoid,项目名称:Clasick,代码行数:49,代码来源:Answers.java

示例14: onCreateView

import com.parse.ParseQuery; //导入方法依赖的package包/类
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {


        Profile activity=(Profile)getActivity();
        String selected_user=activity.sendmydata();


        View view = inflater.inflate(R.layout.activity_timeline_query, container, false);


        user_query_list=(ListView)view.findViewById(R.id.timeline_user_query);

        ParseQuery<ParseObject> query=ParseQuery.getQuery("Ques");
       query.whereEqualTo("User", selected_user);
        query.orderByAscending("createdAt");
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> list, ParseException e) {
                if (e == null && list.size() > 0) {

                    String user_queries[]=new String[list.size()];

                    for (int i = 0; i < list.size(); i++) {
                        user_queries[i]=list.get(i).getString("question");
                    }

                    ArrayAdapter<String> adapter=new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,user_queries);
                    user_query_list.setAdapter(adapter);
                }
                else{

                }
            }
        });








        return view;
    }
 
开发者ID:salRoid,项目名称:Clasick,代码行数:45,代码来源:TimelineQuery.java


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