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