Quicksy: theme choose country activity

This commit is contained in:
Daniel Gultsch 2021-09-29 10:51:25 +02:00
parent ea9b73c1fe
commit 586fff5485
2 changed files with 15 additions and 12 deletions

View File

@ -2,10 +2,7 @@ package eu.siacs.conversations.ui;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.Menu; import android.view.Menu;
@ -15,6 +12,10 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
@ -25,6 +26,7 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivityChooseCountryBinding; import eu.siacs.conversations.databinding.ActivityChooseCountryBinding;
import eu.siacs.conversations.ui.adapter.CountryAdapter; import eu.siacs.conversations.ui.adapter.CountryAdapter;
import eu.siacs.conversations.utils.PhoneNumberUtilWrapper; import eu.siacs.conversations.utils.PhoneNumberUtilWrapper;
import eu.siacs.conversations.utils.ThemeHelper;
public class ChooseCountryActivity extends ActionBarActivity implements CountryAdapter.OnCountryClicked { public class ChooseCountryActivity extends ActionBarActivity implements CountryAdapter.OnCountryClicked {
@ -70,16 +72,17 @@ public class ChooseCountryActivity extends ActionBarActivity implements CountryA
return true; return true;
} }
}; };
private TextView.OnEditorActionListener mSearchDone = (v, actionId, event) -> { private TextView.OnEditorActionListener mSearchDone = (v, actionId, event) -> {
if (countries.size() == 1) { if (countries.size() == 1) {
onCountryClicked(countries.get(0)); onCountryClicked(countries.get(0));
} }
return true; return true;
}; };
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setTheme(ThemeHelper.find(this));
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_choose_country); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_choose_country);
setSupportActionBar((Toolbar) this.binding.toolbar); setSupportActionBar((Toolbar) this.binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
@ -115,9 +118,9 @@ public class ChooseCountryActivity extends ActionBarActivity implements CountryA
private void filterCountries(String needle) { private void filterCountries(String needle) {
List<PhoneNumberUtilWrapper.Country> countries = PhoneNumberUtilWrapper.getCountries(this); List<PhoneNumberUtilWrapper.Country> countries = PhoneNumberUtilWrapper.getCountries(this);
Iterator<PhoneNumberUtilWrapper.Country> iterator = countries.iterator(); Iterator<PhoneNumberUtilWrapper.Country> iterator = countries.iterator();
while(iterator.hasNext()) { while (iterator.hasNext()) {
final PhoneNumberUtilWrapper.Country country = iterator.next(); final PhoneNumberUtilWrapper.Country country = iterator.next();
if(needle != null && !country.getName().toLowerCase(Locale.getDefault()).contains(needle.toLowerCase(Locale.getDefault()))) { if (needle != null && !country.getName().toLowerCase(Locale.getDefault()).contains(needle.toLowerCase(Locale.getDefault()))) {
iterator.remove(); iterator.remove();
} }
} }

View File

@ -20,7 +20,7 @@ public class EnterNameActivity extends XmppActivity implements XmppConnectionSer
private Account account; private Account account;
private AtomicBoolean setNick = new AtomicBoolean(false); private final AtomicBoolean setNick = new AtomicBoolean(false);
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {