本文整理汇总了Java中org.jivesoftware.smack.packet.PrivacyItem.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java PrivacyItem.setValue方法的具体用法?Java PrivacyItem.setValue怎么用?Java PrivacyItem.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.packet.PrivacyItem
的用法示例。
在下文中一共展示了PrivacyItem.setValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPrivacyList
import org.jivesoftware.smack.packet.PrivacyItem; //导入方法依赖的package包/类
@Override
public void createPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
Log.d(TAG, "BEGIN createPrivacyList.");
try {
List<PrivacyItem> privacyItems = new ArrayList<PrivacyItem>();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.subscription.name(), true, 2);
item.setValue(PrivacyRule.SUBSCRIPTION_BOTH);
privacyItems.add(item);
mPrivacyListManager.createPrivacyList(listName, privacyItems);
} catch (XMPPException e) {
Log.e(TAG, e.getMessage());
}
Log.d(TAG, "END createPrivacyList.");
}
示例2: parseItem
import org.jivesoftware.smack.packet.PrivacyItem; //导入方法依赖的package包/类
public PrivacyItem parseItem(XmlPullParser parser) throws Exception {
boolean done = false;
// Retrieves the required attributes
String actionValue = parser.getAttributeValue("", "action");
String orderValue = parser.getAttributeValue("", "order");
String type = parser.getAttributeValue("", "type");
/*
* According the action value it sets the allow status. The fall-through action is assumed
* to be "allow"
*/
boolean allow = true;
if ("allow".equalsIgnoreCase(actionValue)) {
allow = true;
} else if ("deny".equalsIgnoreCase(actionValue)) {
allow = false;
}
// Set the order number
int order = Integer.parseInt(orderValue);
// Create the privacy item
PrivacyItem item = new PrivacyItem(type, allow, order);
item.setValue(parser.getAttributeValue("", "value"));
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("iq")) {
item.setFilterIQ(true);
}
if (parser.getName().equals("message")) {
item.setFilterMessage(true);
}
if (parser.getName().equals("presence-in")) {
item.setFilterPresence_in(true);
}
if (parser.getName().equals("presence-out")) {
item.setFilterPresence_out(true);
}
}
else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("item")) {
done = true;
}
}
}
return item;
}
示例3: parseItem
import org.jivesoftware.smack.packet.PrivacyItem; //导入方法依赖的package包/类
public PrivacyItem parseItem(XmlPullParser parser) throws Exception {
boolean done = false;
// Retrieves the required attributes
String actionValue = parser.getAttributeValue("", "action");
String orderValue = parser.getAttributeValue("", "order");
String type = parser.getAttributeValue("", "type");
/*
* According the action value it sets the allow status. The fall-through
* action is assumed to be "allow"
*/
boolean allow = true;
if ("allow".equalsIgnoreCase(actionValue)) {
allow = true;
} else if ("deny".equalsIgnoreCase(actionValue)) {
allow = false;
}
// Set the order number
int order = Integer.parseInt(orderValue);
// Create the privacy item
PrivacyItem item = new PrivacyItem(type, allow, order);
item.setValue(parser.getAttributeValue("", "value"));
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("iq")) {
item.setFilterIQ(true);
}
if (parser.getName().equals("message")) {
item.setFilterMessage(true);
}
if (parser.getName().equals("presence-in")) {
item.setFilterPresence_in(true);
}
if (parser.getName().equals("presence-out")) {
item.setFilterPresence_out(true);
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("item")) {
done = true;
}
}
}
return item;
}