本文整理汇总了Java中com.avos.avoscloud.AVUser.getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:Java AVUser.getCurrentUser方法的具体用法?Java AVUser.getCurrentUser怎么用?Java AVUser.getCurrentUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVUser
的用法示例。
在下文中一共展示了AVUser.getCurrentUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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());
}
});
}
示例3: afterCreate
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
@Override
public void afterCreate()
{
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) actionBar.setTitle("");
User me = AVUser.getCurrentUser(User.class);
if (me == null)
{
Toast.makeText(this, "请先进行登录,", Toast.LENGTH_SHORT).show();
finish();
}
//初始化用户信息
mTvUsername.setText(me.getUsername());
AVFile avAvatar = me.getAvatar();
if (avAvatar != null)
PicassoUtils.displayFitImage(this, Uri.parse(avAvatar.getThumbnailUrl(true, Constant
.AVATAR_WIDTH, Constant.AVATAR_HEIGHT)), mIvAvatar, null);
//初始化事件
initEvent();
//初始化viewpager
initViewPagerAndTabLayout();
}
示例4: findShots2
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static List<AVStatus> findShots2() {
AVUser user = AVUser.getCurrentUser();
AVStatusQuery query = AVStatus.inboxQuery(user, AVStatus.INBOX_TYPE.TIMELINE.toString());
// 最大返回1000条
query.limit(15);
query.setMaxId(15);
query.orderByDescending("updatedAt");
try {
return query.find();
} catch (AVException exception) {
Log.e("tag", "Query todos failed.", exception);
return Collections.emptyList();
}
}
示例5: loadData
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void loadData(boolean isRefresh) {
if (isRefresh) {
AVUser user = AVUser.getCurrentUser();
AVRelation<AVObject> relation = user.getRelation("follow");
relation.getQuery().findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mRefreshLayout.setRefreshing(false);
if (e == null) {
if (list.isEmpty()) {
} else {
mData.addAll(list);
mAdapter.notifyDataSetChanged();
}
} else {
e.printStackTrace();
}
}
});
}
}
示例6: refreshData
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void refreshData() {
AVUser user = AVUser.getCurrentUser();
AVQuery<AVObject> query = new AVQuery<>("user_join");
query.setLimit(1);
query.whereEqualTo("user", user);
query.include("idea");
query.include("idea.user");
query.orderByDescending("createAt");
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (e == null) {
if (!list.isEmpty()) {
mData.clear();
mData.addAll(list);
mAdapter.notifyDataSetChanged();
mOffset = list.get(list.size() - 1).getInt("ideaId");
}
} else {
e.printStackTrace();
}
}
});
}
示例7: join
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
@Click(R.id.id_btn_join)
void join() {
AVUser user = AVUser.getCurrentUser();
final AVObject object = new AVObject("user_join");
object.put("user", user);
object.put("idea", mIdea);
object.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
showToast("保存成功");
mIdea.increment("joinNum");
mIdea.saveInBackground();
}
}
});
}
示例8: deleteFriend
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void deleteFriend(final AVUser user) {
new MyAsyncTask(context) {
@Override
protected void doInBack() throws Exception {
// TODO Auto-generated method stub
AVUser curUser = AVUser.getCurrentUser();
CloudService.removeFriendForBoth(curUser, user);
}
@Override
protected void onSucceed() {
Utils.toast("删除成功");
userAdapter.remove(user);
}
};
}
示例9: showSexChooseDialog
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void showSexChooseDialog() {
AVUser user = AVUser.getCurrentUser();
int checkItem = user.getInt("gender") == 0 ? 0 : 1;
new AlertDialog.Builder(context)
.setTitle(R.string.sex)
.setSingleChoiceItems(genderStrings, checkItem,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int gender;
if (which == 0) {
gender = 0;
} else {
gender = 1;
}
UserService.saveSex(gender, saveCallback);
dialog.dismiss();
}
}).setNegativeButton(R.string.cancel, null).show();
}
示例10: initData
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void initData(Intent intent) {
mCurUser = AVUser.getCurrentUser();
mDbHelper = new DBHelper(ctx, "chat.db", 1);
int roomTypeInt = intent.getIntExtra(ROOM_TYPE, RoomType.Single.getValue());
roomType = RoomType.fromInt(roomTypeInt);
msgSize = PAGE_SIZE;
if (roomType == RoomType.Single) {
String chatUserId = intent.getStringExtra(CHAT_USER_ID);
chatUser = DemoApplication.lookupUser(chatUserId);
if (chatUser != null) {
ChatService.withUserToWatch(chatUser, true);
msgAgent = new MsgAgent(roomType, chatUser.getObjectId());
} else {
Log.d("test1", chatUserId);
}
} else {
// String groupId = intent.getStringExtra(GROUP_ID);
// Session session = ChatService.getSession();
// group = session.getGroup(groupId);
// chatGroup = App.lookupChatGroup(groupId);
// msgAgent = new MsgAgent(roomType, groupId);
}
}
示例11: saveUserToCloud
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void saveUserToCloud(UserWrap datas){
if (datas != null) {
AVUser avUser = AVUser.getCurrentUser();
if (avUser != null) {
for (String key : datas.keySet()) {
avUser.put(key, datas.get(key));
}
avUser.saveInBackground();
}
}
}
示例12: onCreate
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activity = this;
userId = null;
AVUser currentUser = AVUser.getCurrentUser();
if (currentUser != null) {
userId = currentUser.getObjectId();
}
}
示例13: refresh
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
/**
* 刷新显示,如从登录activity返回后
*/
public void refresh(){
user=AVUser.getCurrentUser();
getListViewData();
if(user!=null){
user.fetchInBackground("logo", new GetCallback<AVObject>() {
@Override
public void done(AVObject avObject, AVException e) {
if(e==null){
AVFile file=avObject.getAVFile("logo");
if(file!=null&&civ_user!=null){
Glide.with(getActivity()).load(file.getThumbnailUrl(true,120,120)).crossFade().into(civ_user);//改用缩略图
}
AVFile file1=avObject.getAVFile("blurBack");
if(file1!=null&&iv_back_blur!=null){
Glide.with(getActivity()).load(file1.getThumbnailUrl(true,480,320)).crossFade().into(iv_back_blur);
}
}
}
});
tv_name.setText(user.getUsername());
tv_setting.setVisibility(View.VISIBLE);
iv_setting.setVisibility(View.VISIBLE);
}else {
tv_name.setText("注册/登录");
civ_user.setImageDrawable(getResources().getDrawable(R.drawable.iconfont_no_avatar2));
tv_setting.setVisibility(View.GONE);
iv_setting.setVisibility(View.GONE);
}
}
示例14: getUserInfo
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void getUserInfo(String userId)
{
User currentUser = AVUser.getCurrentUser(User.class);
if (userId.equals(currentUser.getObjectId()))
{
mActivity.getUserInfoSuccess(currentUser);
return;
}
mUserBll.getUserById(userId)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Action1<User>()
{
@Override
public void call(User user)
{
mActivity.getUserInfoSuccess(user);
}
}, new Action1<Throwable>()
{
@Override
public void call(Throwable throwable)
{
throwable.printStackTrace();
mActivity.getUserInfoFail("获取用户信息失败");
}
});
}
示例15: onCreate
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (AVUser.getCurrentUser() == null) {
Intent intent = new Intent(NoteListActivity.this, AuthActivity.class);
startActivityForResult(intent, ACTIVITY_AUTH);
}
setContentView(R.layout.activity_note_list);
new RemoteDataTask().execute();
}