本文整理汇总了Java中com.avos.avoscloud.FindCallback类的典型用法代码示例。如果您正苦于以下问题:Java FindCallback类的具体用法?Java FindCallback怎么用?Java FindCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FindCallback类属于com.avos.avoscloud包,在下文中一共展示了FindCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSendRequests
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
public void findSendRequests(FindCallback findCallback,boolean orderAsc,Map<String,Object> conditions){
AVUser user = HiTalkHelper.getInstance().getCurrentUser();
AVQuery<AddRequest> q = AVObject.getQuery(AddRequest.class);
q.whereEqualTo(AddRequest.FROM_USER, user);
if (conditions != null) {
for (Map.Entry<String,Object> entry : conditions.entrySet()){
q.whereEqualTo(entry.getKey(),entry.getValue());
}
}
if (orderAsc) {
q.orderByAscending(AVObject.CREATED_AT);
} else {
q.orderByDescending(AVObject.CREATED_AT);
}
q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
q.findInBackground(findCallback);
}
示例2: queryAllSchoolMatesWithState
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
public Task<List<SchoolMate>> queryAllSchoolMatesWithState(Map<String,Object> conditions){
return queryAllSchoolMates(conditions).continueWithTask(task -> {
FriendsManager.getInstance().findSendRequests(new FindCallback<AddRequest>() {
@Override
public void done(List<AddRequest> list, AVException e) {
if (list != null){
for (AddRequest addRequest : list) {
if (addRequest.getStatus() == AddRequest.STATUS_DONE){
SchoolmatesCacheHelper.getInstance()
.update(addRequest.getToUser().getObjectId(),SchoolmatesCacheHelper.REQUEST_STATE_SUCCESS);
} else if (addRequest.getStatus() == AddRequest.STATUS_WAIT){
SchoolmatesCacheHelper.getInstance()
.update(addRequest.getToUser().getObjectId(),SchoolmatesCacheHelper.REQUEST_STATE_WATING);
}
}
EaterManager.getInstance().broadcast(new SchoolMateStateParam());
}
}
},true,null);
return task;
});
}
示例3: loadMoreAddRequest
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
private void loadMoreAddRequest(boolean isRefresh, DoneCallback<AddRequest> doneCallback) {
FriendsManager.getInstance().findAddRequests(isRefresh ? 0 : mLayout.getCurrentSize(), 20, new FindCallback<AddRequest>() {
@Override
public void done(List<AddRequest> list, AVException e) {
final List<AddRequest> filters = new ArrayList<>();
if (list != null) {
FriendsManager.getInstance().markAddRequestsRead(list);
for (AddRequest addRequest : list) {
if (addRequest.getFromUser() != null) {
filters.add(addRequest);
}
}
}
if (doneCallback != null) {
doneCallback.done(filters,e);
}
}
});
}
示例4: runQuerySync
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
public static <T extends AVObject> List<T> runQuerySync(AVQuery<T> avQuery) throws InterruptedException, AVException {
final CountDownLatch lock = new CountDownLatch(1);
final List<T> result = new ArrayList<>();
final AVException[] exceptions = new AVException[1];
avQuery.findInBackground(new FindCallback<T>() {
@Override
public void done(List<T> list, AVException e) {
if (list != null) {
result.addAll(list);
}else {
exceptions[0] = e;
}
lock.countDown();
}
});
lock.await();
if (exceptions[0] != null){
throw exceptions[0];
}
return result;
}
示例5: LoadingData
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
private void LoadingData() {
FindCallback<AVObject> findCallback = new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> avObjects, AVException e) {
if (e == null) {
for (AVObject avo : avObjects) {
mDoingListData.add(new DoingListData(avo.getObjectId(),
avo.getString("GroupName")));
}
mHandler.obtainMessage(1).sendToTarget();
adapter.notifyDataSetChanged();
} else {
ERROR();
}
}
};
AVService.findDoingListGroup(findCallback);
}
示例6: SetChildrenList
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
private void SetChildrenList(final String groupObjectId) {
FindCallback<AVObject> findCallback=new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> avObjects, AVException e) {
if (e == null) {
ArrayList<DoingListData> childrenList = new ArrayList<DoingListData>();
for (AVObject avo : avObjects) {
childrenList.add(new DoingListData(avo.getObjectId(),
avo.getString("ChildName")));
}
for (DoingListData dld : mDoingListData) {
if (dld.objectId.equals(groupObjectId)) {
dld.doingListData = childrenList;
}
}
adapter.setGroups(mDoingListData);
expandableListView.setVisibility(View.VISIBLE);
messageText.setVisibility(View.INVISIBLE);
adapter.notifyDataSetChanged();
} else {
ERROR();
}
}
};
AVService.findChildrenList(groupObjectId, findCallback);
}
示例7: onCreate
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about_app);
//this.getActionBar().setDisplayHomeAsUpEnabled(true);
submitButton = (Button) findViewById(R.id.button_about_app_submit_user_input);
submitEditText = (EditText) findViewById(R.id.editText_about_app_user_input);
mUserResponseListView = (ListView) findViewById(R.id.listView_user_back);
submitButton.setOnClickListener(buttonListener);
FindCallback<AVObject> findCallback=new FindCallback<AVObject>() {
public void done(List<AVObject> avObjects, AVException e) {
if (e == null) {
Message msg = new Message();
msg.what = 3;
msg.obj = avObjects;
mHandler.sendMessage(msg);
} else {
showError(activity.getString(R.string.network_error));
}
}
};
AVQuery<AVObject> query = new AVQuery<AVObject>("SuggestionByUser");
query.whereEqualTo("UserObjectId", getUserId());
query.findInBackground(findCallback);
}
示例8: getNewWords
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
/**
* 获取最新词条
*/
private void getNewWords(){
newWords = new ArrayList<>();
AVQuery<AVObject> query=new AVQuery<>("word");
query.setLimit(21);
query.orderByDescending("updatedAt");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
HashSet<String> set=new HashSet<>();//去重
for (AVObject item : list) {
if(!set.contains(item.getString("name"))){
newWords.add(item);
set.add(item.getString("name"));
}
}
newWordAdapter.notifyDataSetChanged();
refreshLayout.setRefreshing(false);
} else {
Log.e("get new words error",e.toString());
}
}
});
}
示例9: getData
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
/**
* 获取音/视频资源
*/
private void getData(){
AVQuery<AVObject> query=new AVQuery<>("jxh");
// query.whereEqualTo("isVoice",false);
query.setLimit(1000);
query.orderByDescending("viewcount");
query.include("cover");
query.whereExists("cover");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if(e==null){
mList= (LinkedList<AVObject>) list;
if(adapter!=null)
adapter.notifyDataSetChanged();
}else {
Log.e("getVoice",e.toString());
}
}
});
}
示例10: onCreate
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jxh);
AVQuery<AVObject> query=new AVQuery<>("jxh");
query.setLimit(1000);
// query.whereDoesNotExist("coverPic");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if(e==null){
for(AVObject item:list){
attachCover(item);
// attachVoice(item);
// item.put("isVoice", isVoice(item));
item.saveInBackground();
}
Log.e("list size",list.size()+"");
}
}
});
}
示例11: uploadStoryFile
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
/**
* 为story添加file
*/
private void uploadStoryFile(){
AVQuery<AVObject> query=new AVQuery<>("story");
query.whereExists("url");
query.whereDoesNotExist("voiceFile");
query.setLimit(1000);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
for (AVObject item : list) {
String url = item.getString("url");
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(item.getString("content") + ".mp3", "sdcard/storyFile/" + url + ".mp3");
item.put("voiceFile", avFile);
item.saveInBackground();
} catch (IOException e1) {
Log.e("upload file error", e1.toString());
}
}
}
}
});
}
示例12: addTimeLong
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
/**
* 为story添加timelong
*/
private void addTimeLong(){
AVQuery<AVObject> query=new AVQuery<>("story");
query.setLimit(1000);
query.whereExists("voiceFile");
query.whereExists("url");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
for (AVObject item : list) {
int timeLong = getTimeLong(item.getString("url"));
item.put("timelong", timeLong);
item.saveInBackground();
}
}
}
});
}
示例13: getComments
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
private void getComments(){
if(comments==null){
comments = new ArrayList<>();
}else {
comments.clear();
}
AVQuery<AVObject> query=new AVQuery<>("storycomment");
query.whereEqualTo("story",story);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if(e==null){
for(AVObject item:list){
comments.add(item);
adapter.notifyDataSetChanged();
}
} else {
Log.e("get story comm err",e.toString());
}
}
});
}
示例14: onCreate
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AVQuery<AVObject> query=new AVQuery<>("Other");
query.whereEqualTo("name", "UpdateActivity跳转至的Url");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if(e==null){
if (list.size()>0){
String url=list.get(0).getString("url");
Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
finish();
}
}
}
});
//V1.0&V1.1:
// Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.zhagame.com/fangyan"));
// startActivity(intent);
// finish();
}
示例15: checkFriendAdded
import com.avos.avoscloud.FindCallback; //导入依赖的package包/类
private void checkFriendAdded(final String friendId) {
AVQuery<AVObject> queryUserId1 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
queryUserId1.whereStartsWith(Constants.KEY_USER_ID, userId);
AVQuery<AVObject> queryUserId2 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
queryUserId2.whereEndsWith(Constants.KEY_USER_ID, userId);
AVQuery<AVObject> queryFriendId1 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
queryFriendId1.whereStartsWith(Constants.KEY_FRIEND_ID, friendId);
AVQuery<AVObject> queryFriendId2 = new AVQuery<>(Constants.TABLE_NAME_FRIEND);
queryFriendId2.whereEndsWith(Constants.KEY_FRIEND_ID, friendId);
AVQuery<AVObject> query = AVQuery.and(Arrays.asList(queryUserId1, queryUserId2, queryFriendId1, queryFriendId2));
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (list.isEmpty()) {
Log.d(TAG, "username is not added!");
addFriend(friendId);
} else {
Log.e(TAG, "username is already added!");
ToastUtil.showToastShort(FriendActivity.this, "username is already added!");
}
}
});
}