Java Code Examples for com.avos.avoscloud.AVUser#getUsername()

The following examples show how to use com.avos.avoscloud.AVUser#getUsername() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContactFragment.java    From LoveTalkClient with Apache License 2.0 6 votes vote down vote up
private void fillFriendsData(List<AVUser> datas) {
	friends.clear();
	int total = datas.size();
	for (int i = 0; i < total; i++) {
		AVUser user = datas.get(i);
		AVUser sortUser = new AVUser();
		sortUser.put("avatar", user.getAVFile("avatar"));
		sortUser.setUsername(user.getUsername());
		sortUser.setObjectId(user.getObjectId());
		String username = sortUser.getUsername();
		if (username != null) {
			String pinyin = CharacterParser.getPingYin(user.getUsername());
			String sortString = pinyin.substring(0, 1).toUpperCase();
			if (sortString.matches("[A-Z]")) {
				Log.d("lan", sortString.toUpperCase());
			} else {
				Log.d("lan", "#");
			}
		} else {
			Log.d("lan", "#");
		}
		friends.add(sortUser);
	}
	Collections.sort(friends, pinyinComparator);
}
 
Example 2
Source File: MeetAdapter.java    From LoveTalkClient with Apache License 2.0 6 votes vote down vote up
@Override
public Object getItem(int position) {
	// TODO Auto-generated method stub
	final Map<String, Object> item = new HashMap<String, Object>();

	AVUser user = (AVUser) MeetList.get(position).get("user");
	String name = user.getUsername();
	AVFile avatar = user.getAVFile("avatar");
	String avatarUrl = getAvatarUrl(user);
	String times = MeetList.get(position).get("times").toString();
	times = "相遇" + times + "次";

	item.put("name", name);
	item.put("avatar", avatarUrl);
	item.put("times", times);

	return item;

}
 
Example 3
Source File: MeetingInfo.java    From LoveTalkClient with Apache License 2.0 6 votes vote down vote up
public static void addMeeting(AVObject meetinfo) {
	AVUser adduser = meetinfo.getAVUser("YourUser");
	String username = adduser.getUsername();
	for (HashMap<String, Object> meet : list) {
		AVUser user = (AVUser) meet.get("user");
		String name = user.getUsername();
		if (name.equals(username)) {
			int times = Integer.valueOf(meet.get("times").toString());
			meet.put("times", times + 1);
			return;
		}
	}

	HashMap<String, Object> newuser = new HashMap<String, Object>();
	newuser.put("user", adduser);
	newuser.put("times", 1);

	list.add(newuser);
}
 
Example 4
Source File: MeetFragment.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
private void addMeet(AVObject meet) {
    String objectId = meet.getObjectId();
    MeetInfo meetInfo = meetInfoHashMap.get(objectId);

    if (meetInfo != null) {
        meetInfo.addTimes();
    } else {
        AVUser user = meet.getAVUser("YourUser");
        meetInfo = new MeetInfo(user.getUsername(), 1);
    }

    meetInfoHashMap.put(objectId, meetInfo);
}
 
Example 5
Source File: LoveFragment.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
private void initView() {
	mContext = context;
	View fragmentView = getView();

	AVUser user = AVUser.getCurrentUser();
	userStr = user.getUsername();
	pass = user.getString("password");

	toQuery();
	container = (RelativeLayout) fragmentView.findViewById(R.id.container);
	status = (TextView) fragmentView.findViewById(R.id.txt_loveStatus);
	statusWord = (TextView) fragmentView.findViewById(R.id.txt_statusWord);
	loverPhone = (EditText) fragmentView.findViewById(R.id.edit_loverPhone);
	loverName = (EditText) fragmentView.findViewById(R.id.edit_loverName);
	toSay = (EditText) fragmentView.findViewById(R.id.edit_blog);
	bind = (Button) fragmentView.findViewById(R.id.btn_bind);
	writeBlog = (Button) fragmentView.findViewById(R.id.btn_toSay);
	myBlog = (Button) fragmentView.findViewById(R.id.btn_myBlog);
	itsBlog = (Button) fragmentView.findViewById(R.id.btn_itsBlog);
	changeLove = (Button) fragmentView.findViewById(R.id.changeLove);
	arrow = (ImageView) fragmentView.findViewById(R.id.img_arrow);

	bind.setOnClickListener(this);
	writeBlog.setOnClickListener(this);
	myBlog.setOnClickListener(this);
	itsBlog.setOnClickListener(this);
	changeLove.setOnClickListener(this);
}
 
Example 6
Source File: UserFriendAdapter.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = LayoutInflater.from(context).inflate(
				R.layout.item_user_friend, null);
	}
	TextView alpha = ViewHolder.findViewById(convertView, R.id.alpha);
	TextView nameView = ViewHolder.findViewById(convertView,
			R.id.tv_friend_name);
	ImageView avatarView = ViewHolder.findViewById(convertView,
			R.id.img_friend_avatar);

	AVUser friend = data.get(position);
	final String name = friend.getUsername();

	final String avatarUrl = getAvatarUrl(friend);

	UserService.displayAvatar(avatarUrl, avatarView);
	nameView.setText(name);

	int section = getSectionForPosition(position);
	if (position == getPositionForSection(section)) {
		alpha.setVisibility(View.VISIBLE);
		alpha.setText(getSortLetters(friend));
	} else {
		alpha.setVisibility(View.GONE);
	}

	return convertView;
}
 
Example 7
Source File: UserFriendAdapter.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
private String getSortLetters(AVUser user) {
	String username = user.getUsername();
	if (username != null) {
		String pinyin = CharacterParser.getPingYin(user.getUsername());
		String sortString = pinyin.substring(0, 1).toUpperCase();
		if (sortString.matches("[A-Z]")) {
			return sortString.toUpperCase();
		} else {
			return "#";
		}
	} else {
		return "#";
	}
}
 
Example 8
Source File: MeetActivity.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
private void updateView() {
	AVUser Myuser = AVUser.getCurrentUser();
	String MyUrl = getAvatarUrl(Myuser);
	String MyName = Myuser.getUsername();

	String YourUrl = getAvatarUrl(yourUser);
	String YourName = yourUser.getUsername();

	UserService.displayAvatar(MyUrl, myAvatar);
	UserService.displayAvatar(YourUrl, yourAvatar);
	myName.setText(MyName);
	yournName.setText(YourName);
}
 
Example 9
Source File: PinyinComparator.java    From LoveTalkClient with Apache License 2.0 5 votes vote down vote up
private String getSortLetters(AVUser user) {
	String username = user.getUsername();
	if (username != null) {
		String pinyin = CharacterParser.getPingYin(user.getUsername());
		String sortString = pinyin.substring(0, 1).toUpperCase();
		if (sortString.matches("[A-Z]")) {
			return sortString.toUpperCase();
		} else {
			return "#";
		}
	} else {
		return "#";
	}
}
 
Example 10
Source File: Msg.java    From LoveTalkClient with Apache License 2.0 4 votes vote down vote up
public String getFromName() {
	String peerId = getFromPeerId();
	AVUser user = DemoApplication.lookupUser(peerId);
	return user.getUsername();
}