use of com.instructure.canvasapi.model.User in project instructure-android by instructure.
the class GuessWhoStudentFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (container == null) {
return null;
}
View view = inflater.inflate(R.layout.guess_who_student_fragment, container, false);
rootView = (RelativeLayout) view.findViewById(R.id.rootView);
rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FlipAnimation flipAnimation = new FlipAnimation(cardFront, cardBack);
if (cardFront.getVisibility() == View.GONE) {
flipAnimation.reverse();
hasFlipped = false;
} else {
hasFlipped = true;
}
rootView.startAnimation(flipAnimation);
}
});
cardFront = (RelativeLayout) view.findViewById(R.id.cardFront);
cardBack = (RelativeLayout) view.findViewById(R.id.cardBack);
User user = this.getArguments().getParcelable(Const.USER);
name = (TextView) view.findViewById(R.id.studentName);
name.setText(user.getShortName());
avatar = (ImageView) view.findViewById(R.id.avatar);
Picasso.with(getActivity()).load(user.getAvatarURL()).into(avatar);
// show the back view
if (savedInstanceState != null && savedInstanceState.getBoolean(Const.GUESS_WHO_CARD_FLIPPED)) {
// we want the card to flip, but we don't want the animation. So use the same logic but set the
// duration to 0 so it happens instantly
FlipAnimation flipAnimation = new FlipAnimation(cardFront, cardBack);
flipAnimation.setDuration(0);
rootView.startAnimation(flipAnimation);
hasFlipped = true;
}
return view;
}
use of com.instructure.canvasapi.model.User in project instructure-android by instructure.
the class StudentChooserCarouselFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (container == null) {
return null;
}
RelativeLayout l = (RelativeLayout) inflater.inflate(R.layout.user_fragment, container, false);
User user = this.getArguments().getParcelable(Const.USER);
TextView tv = (TextView) l.findViewById(R.id.viewID);
tv.setText(user.getShortName());
ImageView imageView = (ImageView) l.findViewById(R.id.content);
Picasso.with(getActivity()).load(user.getAvatarURL()).into(imageView);
return l;
}
use of com.instructure.canvasapi.model.User in project instructure-android by instructure.
the class APIHelpers method setCachedShortName.
/**
* setCachedShortName is a helper to set a value on the cached user.
* @param context
* @param shortName
* @return
*/
public static boolean setCachedShortName(Context context, String shortName) {
User user = getCacheUser(context);
if (user == null) {
return false;
}
user.setShortName(shortName);
return setCacheUser(context, user);
}
use of com.instructure.canvasapi.model.User in project instructure-android by instructure.
the class APIHelpers method setCachedEmail.
/**
* setCachedEmail is a helper to set a value on the cached user.
* @param context
* @param email
* @return
*/
public static boolean setCachedEmail(Context context, String email) {
User user = getCacheUser(context);
if (user == null) {
return false;
}
user.setEmail(email);
return setCacheUser(context, user);
}
use of com.instructure.canvasapi.model.User in project instructure-android by instructure.
the class APIHelpers method setCachedAvatarURL.
/**
* setCachedAvatarURL is a helper to set a value on the cached user.
* @param context
* @param avatarURL
* @return
*/
public static boolean setCachedAvatarURL(Context context, String avatarURL) {
User user = getCacheUser(context);
if (user == null) {
return false;
}
user.setAvatarURL(avatarURL);
return setCacheUser(context, user);
}
Aggregations