Fix AlertDialog inputs colors

Closes #287
This commit is contained in:
emanuele-f 2022-12-28 11:20:13 +01:00
parent 916e5cf89b
commit b407a3fc04
7 changed files with 34 additions and 13 deletions

View File

@ -20,7 +20,6 @@
package com.emanuelef.remote_capture;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.VpnService;
@ -32,6 +31,7 @@ import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
public class CaptureHelper {

View File

@ -20,7 +20,6 @@
package com.emanuelef.remote_capture.fragments;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@ -44,6 +43,7 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.core.view.MenuProvider;
import androidx.fragment.app.Fragment;

View File

@ -19,7 +19,6 @@
package com.emanuelef.remote_capture.fragments;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -38,6 +37,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.view.MenuProvider;
import androidx.fragment.app.Fragment;

View File

@ -19,7 +19,6 @@
package com.emanuelef.remote_capture.views;
import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@ -27,8 +26,9 @@ import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.emanuelef.remote_capture.R;
import com.emanuelef.remote_capture.model.MatchList;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
@ -74,7 +74,7 @@ public class RuleAddDialog implements View.OnClickListener {
.setNegativeButton(R.string.cancel_action, (dialogInterface, i) -> {})
.show();
mDialog.setCanceledOnTouchOutside(false);
mDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE)
mDialog.getButton(AlertDialog.BUTTON_POSITIVE)
.setOnClickListener(this);
}

View File

@ -14,7 +14,8 @@
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlinedDropdown">
<AutoCompleteTextView
android:id="@+id/proto"
@ -28,7 +29,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/original_port"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlined" >
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/orig_port"
@ -43,7 +45,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:hint="@string/destination_ip"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlined" >
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/redirect_ip"
@ -57,7 +60,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/destination_port"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlined" >
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/redirect_port"

View File

@ -18,7 +18,8 @@
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlinedDropdown">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="@+id/combo_text"
@ -36,7 +37,8 @@
android:visibility="gone"
tools:visibility="visible"
tools:hint="Text"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" >
android:theme="@style/Theme.TextInputLayoutOutlined"
style="@style/TextInputLayoutOutlined" >
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/text_value"
@ -46,4 +48,4 @@
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@ -15,6 +15,21 @@
<!-- Make the Widget.MaterialComponents.Button.TextButton of AlertDialog use the accent color -->
<style name="AppAlertDialogTheme" parent="Theme.MaterialComponents.DayNight.Dialog">
<item name="colorPrimary">@color/colorAccent</item>
<item name="windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
<item name="windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Make the TextInputLayout of AlertDialog use the accent color -->
<style name="TextInputLayoutOutlined" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="boxStrokeColor">@color/colorAccent</item>
<item name="hintTextColor">@color/colorAccent</item>
</style>
<style name="TextInputLayoutOutlinedDropdown" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<item name="boxStrokeColor">@color/colorAccent</item>
<item name="hintTextColor">@color/colorAccent</item>
</style>
<style name="Theme.TextInputLayoutOutlined" parent="">
<item name="colorPrimary">@color/colorAccent</item>
</style>
<!-- White app theme. See values-night-v8 for the dark customizations -->