diff options
author | ByteHamster <info@bytehamster.com> | 2022-12-11 16:18:49 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-12-11 16:20:59 +0100 |
commit | ac4409bcf43360584192de9d101f2d78553ed43a (patch) | |
tree | 7a66bcfe09daaa5b22c1b082978d9124f692a18a /app | |
parent | 45137119811011eb41ed988407a314194d0db2c8 (diff) | |
download | AntennaPod-ac4409bcf43360584192de9d101f2d78553ed43a.zip |
Remove non-functional end icon of country selector
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java | 19 | ||||
-rw-r--r-- | app/src/main/res/layout/select_country_dialog.xml | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java index c87a43a9c..88b9ac8f1 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DiscoveryFragment.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.fragment; -import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -21,11 +20,11 @@ import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import com.google.android.material.appbar.MaterialToolbar; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.textfield.MaterialAutoCompleteTextView; import com.google.android.material.textfield.TextInputLayout; import de.danoeh.antennapod.core.BuildConfig; -import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; @@ -222,7 +221,7 @@ public class DiscoveryFragment extends Fragment implements Toolbar.OnMenuItemCli LayoutInflater inflater = getLayoutInflater(); View selectCountryDialogView = inflater.inflate(R.layout.select_country_dialog, null); - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setView(selectCountryDialogView); List<String> countryCodeArray = new ArrayList<>(Arrays.asList(Locale.getISOCountries())); @@ -245,11 +244,16 @@ public class DiscoveryFragment extends Fragment implements Toolbar.OnMenuItemCli editText.setAdapter(dataAdapter); editText.setText(countryCodeNames.get(countryCode)); editText.setOnClickListener(view -> { - if (StringUtils.isEmpty(editText.getText().toString())) { - return; + if (editText.getText().length() != 0) { + editText.setText(""); + editText.postDelayed(editText::showDropDown, 100); + } + }); + editText.setOnFocusChangeListener((v, hasFocus) -> { + if (hasFocus) { + editText.setText(""); + editText.postDelayed(editText::showDropDown, 100); } - editText.getText().clear(); - editText.postDelayed(editText::showDropDown, 100); }); builder.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> { @@ -267,6 +271,7 @@ public class DiscoveryFragment extends Fragment implements Toolbar.OnMenuItemCli EventBus.getDefault().post(new DiscoveryDefaultUpdateEvent()); loadToplist(countryCode); }); + builder.setNegativeButton(R.string.cancel_label, null); builder.show(); return true; } diff --git a/app/src/main/res/layout/select_country_dialog.xml b/app/src/main/res/layout/select_country_dialog.xml index 4b77492d3..e442a8023 100644 --- a/app/src/main/res/layout/select_country_dialog.xml +++ b/app/src/main/res/layout/select_country_dialog.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> @@ -11,6 +12,7 @@ android:layout_height="wrap_content" android:layout_margin="20dp" android:hint="@string/country" + app:endIconMode="none" style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"> <AutoCompleteTextView |