WIP: Update morefiles #152

Closed
RecentRunner wants to merge 183 commits from main into morefiles
4 changed files with 23 additions and 0 deletions
Showing only changes of commit 313ec4a57b - Show all commits

View File

@@ -3,6 +3,7 @@ package com.example.petstoremobile.activities;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@@ -69,6 +70,15 @@ public class MainActivity extends AppCompatActivity {
//clear login status
tvLoginStatus.setText("");
// Set editor action listener for password field to login on when enter is pressed
etPassword.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_NULL) {
btnLogin.performClick();
return true;
}
return false;
});
//Set click listener for login button
btnLogin.setOnClickListener(v -> {
//Get username and password from text fields

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.provider.OpenableColumns;
import android.util.Log;
import android.view.*;
import android.view.inputmethod.EditorInfo;
import android.widget.*;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
@@ -121,6 +122,16 @@ public class ChatFragment extends Fragment implements ChatAdapter.OnChatClickLis
ImageButton hamburger = view.findViewById(R.id.btnHamburger);
hamburger.setOnClickListener(v -> drawerLayout.openDrawer(GravityCompat.START));
// Set editor action listener for message field to send when enter is pressed
etMessage.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_NULL) {
btnSend.performClick();
return true;
}
return false;
});
//When the send button is clicked check if there is an attachment and send using the correct helper function
btnSend.setOnClickListener(v -> {
if (pendingAttachmentUri != null) {

View File

@@ -96,6 +96,7 @@
android:layout_height="wrap_content"
android:hint="Enter password"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:layout_marginBottom="24dp"
android:textColor="@color/text_dark"/>

View File

@@ -109,6 +109,7 @@
android:layout_weight="1"
android:hint="Type a message..."
android:inputType="text"
android:imeOptions="actionSend"
android:layout_marginEnd="8dp"
android:textColor="@color/text_dark"/>