mirror of
https://github.com/ChronosX88/Influence-P2P.git
synced 2024-11-22 07:12:19 +00:00
ChatActivity UI fixes
This commit is contained in:
parent
21a50bba5a
commit
740d29f8fb
@ -2,6 +2,7 @@ package io.github.chronosx88.influence.views;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -35,9 +36,11 @@ public class ChatActivity extends AppCompatActivity implements IChatViewContract
|
|||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
presenter = new ChatPresenter(this, intent.getStringExtra("chatID"));
|
presenter = new ChatPresenter(this, intent.getStringExtra("chatID"));
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar_chat_activity);
|
Toolbar toolbar = findViewById(R.id.toolbar_chat_activity);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
getSupportActionBar().setTitle("");
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
messageList = findViewById(R.id.message_list);
|
messageList = findViewById(R.id.message_list);
|
||||||
chatAdapter = new ChatAdapter();
|
chatAdapter = new ChatAdapter();
|
||||||
presenter.updateAdapter();
|
presenter.updateAdapter();
|
||||||
@ -48,10 +51,11 @@ public class ChatActivity extends AppCompatActivity implements IChatViewContract
|
|||||||
sendMessageButton = findViewById(R.id.send_button);
|
sendMessageButton = findViewById(R.id.send_button);
|
||||||
sendMessageButton.setOnClickListener((v) -> {
|
sendMessageButton.setOnClickListener((v) -> {
|
||||||
presenter.sendMessage(messageTextEdit.getText().toString());
|
presenter.sendMessage(messageTextEdit.getText().toString());
|
||||||
|
messageTextEdit.setText("");
|
||||||
|
messageList.scrollToPosition(chatAdapter.getItemCount()-1);
|
||||||
});
|
});
|
||||||
contactUsernameTextView.setText(intent.getStringExtra("contactUsername"));
|
contactUsernameTextView.setText(intent.getStringExtra("contactUsername"));
|
||||||
|
messageList.scrollToPosition(chatAdapter.getItemCount()-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -69,4 +73,14 @@ public class ChatActivity extends AppCompatActivity implements IChatViewContract
|
|||||||
chatAdapter.notifyDataSetChanged();
|
chatAdapter.notifyDataSetChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch(item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user