Closed PrasannaVenkadesh closed 8 years ago
This feature is so needed. :)
Thanks for your commit Prasanna, However I am not enterely satisfied with the NetworCoordinator keeping a state about the UserInterface, I think both logic should be kept enterely separated.
I would suggest that under reception of a ChatMessage, the NetworkCoordinator might send a "probe"-event like "ProbeChatFocus" that, if "catched" by the ChatFragment class would set an attribute of this event to true so something like that:
public void onEvent(ChatMessageReceived event) {
ProbeChatFocus event = new ProbeChatFocus;
EventBus.getDefault().post(event)
if(event.hasAnybodyCatchedThisEvent()) {
Vibrator vibrator = (Vibrator)
getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(300);
}
}
By doing so you don't have to "export" the state of ChatFragment through the use of two new event (UserEntered and UserLeft) but instead you request for it using an event.
There seem to be a problem with your indentation, your code appear shifted to the left in my android-studio IDE
I merged the first commit (Display Image in Gallery) but didn't merge the NetworkCoordinator yet for the reason above.
I am not enterely satisfied with the NetworCoordinator keeping a state about the UserInterface, I think both logic should be kept enterely separated.
I understand the reason for you concern and that's a good practice too, thanks for pointing it out. I will try to rewrite those.
5 Commits in this Pull Request:
Commit 1: When attached image file is displayed, people would like to Zoom in / Zoom out & Share on other platforms too. With
DisplayImage.java
only the image is displayed, but can't zoom in / zoom out or share. Instead of re-writing inDisplayImage.java
we could just re-use the in-built gallery view.Commit 2: Moved the vibration logic to be handled by Network Coordinator, so the device will vibrate on
ChatMessageReceived
even when the app is not in focus.Commit 3: Display notifications when new chat messages are received.
Commit 4: Rectified incorrect comment statements made along with Commit 3.
Commit 5: Touching on Notification opens the Chat Tab instead of default Status Tab.