本文整理汇总了Java中com.avos.avoscloud.AVUser类的典型用法代码示例。如果您正苦于以下问题:Java AVUser类的具体用法?Java AVUser怎么用?Java AVUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AVUser类属于com.avos.avoscloud包,在下文中一共展示了AVUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWith
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public void initWith(AddRequest item) {
AVUser avUser = item.getFromUser();
if (avUser != null) {
User user = UserBeanCacheHelper.AvUserToUser(avUser,new User());
nickTv.setText(user.getNick());
Glide.with(mAppCtx).load(user.getAvatar()).placeholder(R.drawable.default_avatar).into(iconIv);
infoTv.setText(mAppCtx.getText(R.string.preIntroduce)+user.getNick());
int status = item.getStatus();
if (status == AddRequest.STATUS_WAIT) {
acceptBtn.setSelected(false);
acceptBtn.setText(R.string.accept);
} else if (status == AddRequest.STATUS_DONE) {
acceptBtn.setSelected(true);
acceptBtn.setText(R.string.accepted);
}
}
}
示例2: findSendRequests
import com.avos.avoscloud.AVUser; //导入依赖的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);
}
示例3: createAddRequestInBackground
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public Task<Void> createAddRequestInBackground(final AVUser user) {
return Task.callInBackground(new Callable<Void>() {
@Override
public Void call() throws Exception {
createAddRequest(user);
return null;
}
}).continueWith(new Continuation<Void, Void>() {
@Override
public Void then(Task<Void> task) throws Exception {
if (task.getError() == null) {
PushManager.getInstance().pushMessage(user.getObjectId(), HiTalkApplication.mAppContext
.getString(R.string.push_add_request),
Constants.INVITATION_ACTION);
}else {
throw task.getError();
}
return null;
}
});
}
示例4: showQRDialog
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
private void showQRDialog(Bitmap qr) {
QRDialog qrDialog = BaseBlurDialog.newInstance(QRDialog.class
, Constants.BlurDialog.DEFAULT_RADIUS
, Constants.BlurDialog.DEFAULT_FACTOR
, Constants.BlurDialog.DEFAULT_DIMMING
, Constants.BlurDialog.DEFAULT_USE_RENDERSCRIPT
, false);
AVUser avUser = HiTalkHelper.getInstance().getCurrentUser();
qrDialog.show(getFragmentManager(),"Hitalk");
qrDialog.setCallback(()-> qrDialog.setAvatar(UserCacheHelper.getInstance().getAvatarUrl(avUser))
.setNick((String) avUser.get(Constants.User.NICKNAME_C))
.setCollege((String) avUser.get(Constants.User.COLLEGE_C))
.setQR(qr));
}
示例5: encoder
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
@Override
public Task<AVObject> encoder(final BnItem bnItem) {
return Task.callInBackground(new Callable<AVObject>() {
@Override
public AVObject call() throws Exception {
BnRemote bnRemote = new BnRemote();
bnRemote.put(BnItem.getUserName(), AVObject.createWithoutData(AVUser.class,bnItem.getUser().getObjectId()));
bnRemote.put(BnItem.getContentFieldName(),bnItem.getContent());
bnRemote.put(BnItem.getHasFavortFieldName(),bnItem.hasFavort());
bnRemote.put(BnItem.getHasCommentFieldName(),bnItem.hasComment());
bnRemote.put(BnItem.getCreateTimeFieldName(),bnItem.getCreateTime());
bnRemote.put(BnItem.getPhotosFieldName(),toRemoteHashMap(bnItem.getPhotos()));
bnRemote.put(BnItem.getTypeFieldName(),bnItem.getType());
bnRemote.put(BnItem.getLinkImgFieldName(),bnItem.getLinkImg());
bnRemote.put(BnItem.getLinkTitleFieldName(),bnItem.getLinkTitle());
bnRemote.put(BnItem.getVideoImgUrlFieldName(),bnItem.getVideoImgUrl());
bnRemote.put(BnItem.getVideoUrlFieldName(),bnItem.getVideoUrl());
bnRemote.put(BnItem.getIsAllFieldName(),bnItem.isAll());
return bnRemote;
}
});
}
示例6: encoder
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
@Override
public Task<AVObject> encoder(final CommentItem b) {
return Task.callInBackground(new Callable<AVObject>() {
@Override
public AVObject call() throws Exception {
BnCommentRemote bnCommentRemote = new BnCommentRemote();
bnCommentRemote.put(BnItem.asBnTargetName(),AVObject.createWithoutData(BnRemote.class,b.getBnRemoteId()));
bnCommentRemote.put(CommentItem.getContentFieldName(),b.getContent());
bnCommentRemote.put(CommentItem.getUserFieldName(),AVObject.createWithoutData(AVUser.class,b.getUser().getObjectId()));
if (b.getToReplyUser() != null) {
bnCommentRemote.put(CommentItem.getToReplyUserFieldName(), AVObject.createWithoutData(AVUser.class, b.getToReplyUser().getObjectId()));
}
bnCommentRemote.put(CommentItem.getCreateTimeFieldName(),b.getCreateTime());
return bnCommentRemote;
}
});
}
示例7: fillAvUser
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public static AVUser fillAvUser(User user,AVUser avUser){
if (user == null || avUser == null)
return null;
Field[] fields = user.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
field.setAccessible(true);
try {
if ("objectId".equals(field.getName())){
avUser.setObjectId((String) field.get(user));
}else {
avUser.put(field.getName(), field.get(user));
}
} catch (IllegalAccessException e) {
NLog.e(TagUtil.makeTag(UserCacheHelper.class),e);
}
}
return avUser;
}
示例8: initCurrentAVuser
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
private void initCurrentAVuser(final ActionCallback callback){
if (mCurrentUser == null) {
AVQuery<AVUser> query = AVUser.getQuery();
query.whereEqualTo("objectId",AVUser.getCurrentUser().getObjectId());
query.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.getFirstInBackground(new GetCallback<AVUser>() {
@Override
public void done(AVUser avUser, AVException e) {
if (avUser != null){
mCurrentUser = avUser;
callback.onSuccess();
}else {
mCurrentUser = AVUser.getCurrentUser();
callback.onError(0,e.getMessage());
}
}
});
}
}
示例9: remoteToFavort
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public static void remoteToFavort(BnFavortRemote remote,FavortItem favortItem){
favortItem.setId(remote.getObjectId());
if (remote.has(FavortItem.getUserFieldName())){
User user = new User();
AVUser avUser;
if ((avUser = remote.getAVUser(FavortItem.getUserFieldName())) != null) {
UserBeanCacheHelper.AvUserToUser(avUser, user);
favortItem.setUser(user);
}
}
if (remote.has(FavortItem.getCreateTimeFieldName())){
favortItem.setCreateTime(remote.getDate(FavortItem.getCreateTimeFieldName()));
}else {
favortItem.setCreateTime(remote.getCreatedAt());
}
}
示例10: onCreateView
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_person,
container, false);
nameTextView = (TextView) rootView.findViewById(R.id.textView_userName);
registerTimeTextView = (TextView) rootView
.findViewById(R.id.textView_register_time);
AVUser currentUser = AVUser.getCurrentUser();
nameTextView.setText(currentUser.getUsername());
String date = DateFormat.format("yyyy-MM-dd HH:mm",
currentUser.getCreatedAt()).toString();
registerTimeTextView.setText(getString(R.string.person_register_time)
.replace("{0}", date));
return rootView;
}
示例11: uploadStory
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
/**
* 上传指定信息的story
* @param username
* @param url
* @param lat
* @param lng
* @param title
*/
private void uploadStory(String username, final String url, final double lat, final double lng, final String title){
final AVUser avUser=new AVUser();
avUser.setUsername(username + title.hashCode());
avUser.setPassword("123456");
avUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if (e == null) {
AVGeoPoint geoPoint = new AVGeoPoint(lat, lng);
AVObject story = new AVObject("story");
story.put("provider", avUser);
story.put("geoPoint", geoPoint);
story.put("content", title);
story.put("url", url);
story.saveInBackground();
} else {
Log.e("upload story error", e.toString());
}
}
});
}
示例12: bindData
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
@Override
public void bindData(Object object)
{
User user = ((PersonalCenterHomeBean) object).getUser();
mTvDetailDesc.setText(user.getDetailDesc());
String genderTrend = Constant.GENDER_ALL;
if (!"".equals(user.getGenderTrend()))
genderTrend = user.getGenderTrend();
mTvGenderTrend.setText(genderTrend);
mTvFavoriteActivity.setText(user.getFavoriteActivity());
//如果当前展示用户为本人,不显示聊天按钮
if (user.getObjectId().equals(AVUser.getCurrentUser().getObjectId()))
{
mBtnChat.setVisibility(View.GONE);
} else
{
mBtnChat.setVisibility(View.VISIBLE);
}
}
示例13: updateLocation
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
/**
* 保存用户的位置
*
* @param longitude
* @param latitude
*/
public void updateLocation(double longitude, double latitude)
{
User user = AVUser.getCurrentUser(User.class);
// Logger.e(user.getLocation()+"");
user.setLocation(new AVGeoPoint(latitude, longitude));
mUserBll.updateLocation(user)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>()
{
@Override
public void call(Void aVoid)
{
// Logger.e("更新定位成功");
}
}, new Action1<Throwable>()
{
@Override
public void call(Throwable throwable)
{
// Logger.e("更新定位失败:" + throwable.getMessage());
}
});
}
示例14: registerUser
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public Observable<User> registerUser(final User user)
{
return Observable.create(new Observable.OnSubscribe<User>()
{
@Override
public void call(Subscriber<? super User> subscriber)
{
try
{
AVUser avUser = new AVUser();
avUser.setUsername(user.getUsername());
avUser.setPassword(user.getPassword());
avUser.put(User.FIELD_GENDER, user.getGender());
avUser.signUp();
//注册成功
subscriber.onNext(user);
} catch (AVException e)
{
e.printStackTrace();
subscriber.onError(e);
}
}
});
}
示例15: login
import com.avos.avoscloud.AVUser; //导入依赖的package包/类
public Observable<AVUser> login(final User user)
{
return Observable.create(new Observable.OnSubscribe<AVUser>()
{
@Override
public void call(Subscriber<? super AVUser> subscriber)
{
try
{
AVUser avUser = AVUser.logIn(user.getUsername(), user.getPassword());
subscriber.onNext(avUser);
} catch (AVException e)
{
e.printStackTrace();
subscriber.onError(e);
}
}
});
}