Skip to content

Commit

Permalink
#80 - Added snackbar to show server error on chat list
Browse files Browse the repository at this point in the history
  • Loading branch information
Xero-Hige committed Jun 22, 2016
1 parent 0195d96 commit a9defcd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/ar/uba/fi/drtinder/ChatFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
*/
public class ChatFragment extends Fragment {

private String mToken;

/**
* TODO
*
Expand All @@ -47,23 +45,27 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle bundle) {
View view = inflater.inflate(R.layout.chat_fragment, container, false);

mToken = getActivity().getIntent().getExtras().getString(MainActivity.EXTRA_TOKEN);

LinearLayout bar = (LinearLayout) view.findViewById(R.id.chat_item);

StringResourcesHandler.executeQuery(StringResourcesHandler.USER_MATCHES, mToken,
StringResourcesHandler.executeQuery(StringResourcesHandler.USER_MATCHES,
UserHandler.getToken(),
data -> {
if (data == null) {
Utility.showMessage("Error de conexion con el servidor", getView());
}
for (int i = 0; i < data.size(); i++) {
String name = data.get(i)[0];
String age = data.get(i)[1];
String user = data.get(i)[2];

View layout = inflater.inflate(R.layout.chat_user_layout_left, container, false);
View layout = inflater.inflate(R.layout.chat_user_layout_left,
container, false);
ImageView imageView = addUserChat(name, age, user, layout);

imageView.setOnClickListener(listener -> {
assert container != null;//DEBUG Assert
Intent menuIntent = new Intent(container.getContext(), ChatSession.class);
Intent menuIntent = new Intent(container.getContext(),
ChatSession.class);
menuIntent.putExtra("User", name);
menuIntent.putExtra("ID", user);
startActivity(menuIntent);
Expand Down Expand Up @@ -92,7 +94,7 @@ private ImageView addUserChat(String name, String age, String username, View cha
ageTextView.setText(age);
ImageView imageView = (ImageView) chatLayout.findViewById(R.id.chat_user_img);
ImageResourcesHandler.fillImageResource(username, ImageResourcesHandler.RES_USER_IMG,
mToken, imageView, getContext());
UserHandler.getToken(), imageView, getContext());
return imageView;
}
}

0 comments on commit a9defcd

Please # to comment.