Use RecyclerView for list of gateway options 2 (Cheogram)

This commit is contained in:
Arne 2023-05-18 20:41:56 +02:00
parent 7a6884b159
commit 592bf970ba
2 changed files with 48 additions and 2 deletions

View file

@ -105,9 +105,9 @@ dependencies {
implementation 'com.github.woltapp:blurhash:master'
implementation 'org.tomlj:tomlj:1.1.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'io.michaelrocks:libphonenumber-android:8.12.49'
implementation 'io.github.nishkarsh:android-permissions:2.1.6'
implementation 'org.solovyev.android.views:linear-layout-manager:0.5@aar'
}
ext {

View file

@ -17,7 +17,6 @@ import android.widget.AdapterView;
import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Map;
import eu.siacs.conversations.entities.Account;
@ -50,6 +49,51 @@ import eu.siacs.conversations.ui.util.DelayedHintHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.utils.PhoneNumberUtilWrapper;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.widget.ToggleButton;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.solovyev.android.views.llm.LinearLayoutManager;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.EnterJidDialogBinding;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Presence;
import eu.siacs.conversations.entities.ServiceDiscoveryResult;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
import eu.siacs.conversations.ui.util.DelayedHintHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnGatewayPromptResult;
public class EnterJidDialog extends DialogFragment implements OnBackendConnected, TextWatcher {
@ -152,8 +196,10 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
adapter.setDropDownViewResource(R.layout.simple_list_item);
binding.account.setAdapter(adapter);
}
binding.gatewayList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
binding.gatewayList.setAdapter(gatewayListAdapter);
gatewayListAdapter.setOnEmpty(() -> binding.gatewayList.setVisibility(View.GONE));
gatewayListAdapter.setOnNonEmpty(() -> binding.gatewayList.setVisibility(View.VISIBLE));