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


Java ParseQuery.whereContainedIn方法代碼示例

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


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

示例1: getContactInfos

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
	ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
	pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
	pQuery.findInBackground(new FindCallback<ParseObject>() {

		@Override
		public void done(List<ParseObject> arg0, ParseException arg1) {
			if (arg0 != null) {
				List<EaseUser> mList = new ArrayList<EaseUser>();
				for (ParseObject pObject : arg0) {
				    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
					ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
					if (parseFile != null) {
						user.setAvatar(parseFile.getUrl());
					}
					user.setNick(pObject.getString(CONFIG_NICK));
					EaseCommonUtils.setUserInitialLetter(user);
					mList.add(user);
				}
				callback.onSuccess(mList);
			} else {
				callback.onError(arg1.getCode(), arg1.getMessage());
			}
		}
	});
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:27,代碼來源:ParseManager.java

示例2: 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

示例3: 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

示例4: getContactInfos

import com.parse.ParseQuery; //導入方法依賴的package包/類
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
    ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
    pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
    pQuery.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(List<ParseObject> arg0, ParseException arg1) {
            if (arg0 != null) {
                List<EaseUser> mList = new ArrayList<EaseUser>();
                for (ParseObject pObject : arg0) {
                    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
                    ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
                    if (parseFile != null) {
                        user.setAvatar(parseFile.getUrl());
                    }
                    user.setNick(pObject.getString(CONFIG_NICK));
                    EaseCommonUtils.setUserInitialLetter(user);
                    mList.add(user);
                }
                callback.onSuccess(mList);
            } else {
                callback.onError(arg1.getCode(), arg1.getMessage());
            }
        }
    });
}
 
開發者ID:nggirl,項目名稱:EaseChatDemo,代碼行數:27,代碼來源:ParseManager.java

示例5: getUsersIn

import com.parse.ParseQuery; //導入方法依賴的package包/類
public static void getUsersIn(List<String> ids, final UserDataCallbacks callbacks) {
    ParseQuery<ParseUser> query = ParseUser.getQuery();
    query.whereContainedIn(COLUMN_ID, ids);
    query.findInBackground(new FindCallback<ParseUser>() {
        @Override
        public void done(List<ParseUser> list, ParseException e) {
            formatCallback(list, e, callbacks);
        }
    });
}
 
開發者ID:fadelakin,項目名稱:bitdate,代碼行數:11,代碼來源:UserDataSource.java

示例6: sendPushNotifications

import com.parse.ParseQuery; //導入方法依賴的package包/類
protected void sendPushNotifications() {
	ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
	query.whereContainedIn(ParseConstants.KEY_USER_ID, getRecipientIds());
	
	// send push notification
	ParsePush push = new ParsePush();
	push.setQuery(query);
	push.setMessage(getString(R.string.push_message, 
			ParseUser.getCurrentUser().getUsername()));
	push.sendInBackground();
}
 
開發者ID:NagabhushanS,項目名稱:AmazingFriends,代碼行數:12,代碼來源:RecipientsActivity.java

示例7: 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

示例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: FollowingCommentsAdapter

import com.parse.ParseQuery; //導入方法依賴的package包/類
public FollowingCommentsAdapter(Context context, List<ParseObject> myWubbleDataSet, ArrayList<String> myUserDataSet, int movieId) {
    myWubbles = myWubbleDataSet;

    ParseQuery userQuery = ParseUser.getQuery();
    userQuery.whereContainedIn("username", myUserDataSet);
    try {
        mUserList = (ArrayList<ParseUser>) userQuery.find();
    } catch (ParseException e) {
        e.printStackTrace();
    }
    myContext = context;
    layoutInflater = LayoutInflater.from(myContext);
}
 
開發者ID:MovieNetwork,項目名稱:Wubble,代碼行數:14,代碼來源:FollowingCommentsAdapter.java

示例10: loadConversationList

import com.parse.ParseQuery; //導入方法依賴的package包/類
/**
 * Load the conversation list from Parse server and save the date of last
 * message that will be used to load only recent new messages
 */
private void loadConversationList()
{
	ParseQuery<ParseObject> q = ParseQuery.getQuery("Chat");
	if (convList.size() == 0)
	{
		// load all messages...
		ArrayList<String> al = new ArrayList<String>();
		al.add(buddy);
		al.add(UserList.user.getUsername());
		q.whereContainedIn("sender", al);
		q.whereContainedIn("receiver", al);
	}
	else
	{
		// load only newly received message..
		if (lastMsgDate != null)
			q.whereGreaterThan("createdAt", lastMsgDate);
		q.whereEqualTo("sender", buddy);
		q.whereEqualTo("receiver", UserList.user.getUsername());
	}
	q.orderByDescending("createdAt");
	q.setLimit(30);
	q.findInBackground(new FindCallback<ParseObject>() {

		@Override
		public void done(List<ParseObject> li, ParseException e)
		{
			if (li != null && li.size() > 0)
			{
				for (int i = li.size() - 1; i >= 0; i--)
				{
					ParseObject po = li.get(i);
					Conversation c = new Conversation(po
							.getString("message"), po.getCreatedAt(), po
							.getString("sender"));
					convList.add(c);
					if (lastMsgDate == null
							|| lastMsgDate.before(c.getDate()))
						lastMsgDate = c.getDate();
					adp.notifyDataSetChanged();
				}
			}
			handler.postDelayed(new Runnable() {

				@Override
				public void run()
				{
					if (isRunning)
						loadConversationList();
				}
			}, 1000);
		}
	});

}
 
開發者ID:tamzi,項目名稱:sophia,代碼行數:60,代碼來源:Chat.java


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