Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ protected void onCreate(Bundle savedInstanceState) {
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseStorage = FirebaseStorage.getInstance();

mMessagesDatabaseReference = mFirebaseDatabase.getReference().child("messages");
mChatPhotosStorageReference = mFirebaseStorage.getReference().child("chat_photos");

// Initialize references to views
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
mMessageListView = (ListView) findViewById(R.id.messageListView);
mPhotoPickerButton = (ImageButton) findViewById(R.id.photoPickerButton);
mMessageEditText = (EditText) findViewById(R.id.messageEditText);
mSendButton = (Button) findViewById(R.id.sendButton);

// Initialize message ListView and its adapter
List<FriendlyMessage> friendlyMessages = new ArrayList<>();
Expand All @@ -111,19 +103,7 @@ public void onClick(View view) {
});

// Enable Send button when there's text to send
mMessageEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence.toString().trim().length() > 0) {
mSendButton.setEnabled(true);
} else {
mSendButton.setEnabled(false);
}
}

@Override
public void afterTextChanged(Editable editable) {
Expand Down Expand Up @@ -300,4 +280,4 @@ private void detachDatabaseReadListener() {
mChildEventListener = null;
}
}
}
}
5 changes: 2 additions & 3 deletions app/src/main/res/drawable-v24/button_selector.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#999999" android:state_enabled="false"/>
<item android:color="@color/colorAccent" android:state_enabled="true"/>
</selector>

</selector>