From 88bae4fce1c0af6e18d0fa563530c89b48011326 Mon Sep 17 00:00:00 2001 From: Mat Date: Fri, 22 Mar 2024 10:24:24 +0200 Subject: [PATCH] Material Design 3-style command text field --- app/build.gradle | 1 - .../android/fragments/ConsoleFragment.java | 6 ++-- app/src/main/res/layout/fragment_console.xml | 31 +++++++------------ 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fb6ec15..9219fb8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,7 +17,6 @@ android { } buildTypes { release { - signingConfig signingConfigs.debug minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile( diff --git a/app/src/main/java/org/cuberite/android/fragments/ConsoleFragment.java b/app/src/main/java/org/cuberite/android/fragments/ConsoleFragment.java index a864929..14696ac 100644 --- a/app/src/main/java/org/cuberite/android/fragments/ConsoleFragment.java +++ b/app/src/main/java/org/cuberite/android/fragments/ConsoleFragment.java @@ -25,6 +25,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.google.android.material.color.MaterialColors; +import com.google.android.material.textfield.TextInputLayout; import org.cuberite.android.R; import org.cuberite.android.helpers.CuberiteHelper; @@ -55,13 +56,12 @@ public void onViewCreated(View view, Bundle savedInstanceState) { return false; }); - ImageView sendCommandButton = view.findViewById(R.id.executeLine); - sendCommandButton.setOnClickListener(v -> { + final TextInputLayout textInputLayout = view.findViewById(R.id.inputWrapper); + textInputLayout.setEndIconOnClickListener(v -> { String command = inputLine.getText().toString(); sendExecuteCommand(command); inputLine.setText(""); }); - TooltipCompat.setTooltipText(sendCommandButton, getString(R.string.do_execute_line)); } private void sendExecuteCommand(String command) { diff --git a/app/src/main/res/layout/fragment_console.xml b/app/src/main/res/layout/fragment_console.xml index b8c85b1..5759f6f 100644 --- a/app/src/main/res/layout/fragment_console.xml +++ b/app/src/main/res/layout/fragment_console.xml @@ -18,37 +18,30 @@ android:textIsSelectable="true" /> - + android:paddingStart="12dp" + android:paddingEnd="12dp" + android:paddingTop="6dp" + android:paddingBottom="12dp" + app:endIconMode="custom" + app:endIconDrawable="@drawable/ic_execute" + app:endIconContentDescription="@string/do_execute_line"> - - - +