Commit b406770c authored by Sajal Narang's avatar Sajal Narang

Make view population independent of profile card loading

parent 1a50bc82
...@@ -55,13 +55,15 @@ public class SettingsFragment extends Fragment { ...@@ -55,13 +55,15 @@ public class SettingsFragment extends Fragment {
String userID = bundle.getString(Constants.USER_ID); String userID = bundle.getString(Constants.USER_ID);
populateViews();
RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class); RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
retrofitInterface.getUser("sessionid=" + getArguments().getString(Constants.SESSION_ID), userID).enqueue(new Callback<User>() { retrofitInterface.getUser("sessionid=" + getArguments().getString(Constants.SESSION_ID), userID).enqueue(new Callback<User>() {
@Override @Override
public void onResponse(Call<User> call, Response<User> response) { public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
user = response.body(); user = response.body();
populateViews(); populateUserCard();
} }
} }
...@@ -72,7 +74,7 @@ public class SettingsFragment extends Fragment { ...@@ -72,7 +74,7 @@ public class SettingsFragment extends Fragment {
}); });
} }
private void populateViews() { private void populateUserCard() {
ImageView userProfilePictureImageView = getActivity().findViewById(R.id.user_card_avatar); ImageView userProfilePictureImageView = getActivity().findViewById(R.id.user_card_avatar);
TextView userNameTextView = getActivity().findViewById(R.id.user_card_name); TextView userNameTextView = getActivity().findViewById(R.id.user_card_name);
...@@ -82,7 +84,9 @@ public class SettingsFragment extends Fragment { ...@@ -82,7 +84,9 @@ public class SettingsFragment extends Fragment {
.placeholder(R.drawable.user_placeholder) .placeholder(R.drawable.user_placeholder)
.into(userProfilePictureImageView); .into(userProfilePictureImageView);
userNameTextView.setText(user.getUserName()); userNameTextView.setText(user.getUserName());
}
private void populateViews() {
Button updateProfileButton = getActivity().findViewById(R.id.settings_update_profile); Button updateProfileButton = getActivity().findViewById(R.id.settings_update_profile);
Button feedbackButton = getActivity().findViewById(R.id.settings_feedback); Button feedbackButton = getActivity().findViewById(R.id.settings_feedback);
Button aboutButton = getActivity().findViewById(R.id.settings_about); Button aboutButton = getActivity().findViewById(R.id.settings_about);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment