|
|
@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.ui.drawer;
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
@ -23,11 +24,13 @@ import android.widget.Filter;
|
|
|
|
import android.widget.Filterable;
|
|
|
|
import android.widget.Filterable;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import app.fedilab.android.R;
|
|
|
|
import app.fedilab.android.databinding.DrawerAccountSearchBinding;
|
|
|
|
import app.fedilab.android.databinding.DrawerAccountSearchBinding;
|
|
|
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
|
|
|
import app.fedilab.android.mastodon.client.entities.api.Account;
|
|
|
|
import app.fedilab.android.mastodon.client.entities.api.Field;
|
|
|
|
import app.fedilab.android.mastodon.client.entities.api.Field;
|
|
|
@ -120,12 +123,16 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt
|
|
|
|
holder.binding.accountDn.setText(account.display_name);
|
|
|
|
holder.binding.accountDn.setText(account.display_name);
|
|
|
|
holder.binding.accountDn.setVisibility(View.VISIBLE);
|
|
|
|
holder.binding.accountDn.setVisibility(View.VISIBLE);
|
|
|
|
account.pronouns = null;
|
|
|
|
account.pronouns = null;
|
|
|
|
|
|
|
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
boolean pronounsSupport = sharedpreferences.getBoolean(getContext().getString(R.string.SET_PRONOUNS_SUPPORT), true);
|
|
|
|
|
|
|
|
if(pronounsSupport) {
|
|
|
|
for (Field field : account.fields) {
|
|
|
|
for (Field field : account.fields) {
|
|
|
|
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
|
|
|
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
|
|
|
account.pronouns = Helper.parseHtml(field.value);
|
|
|
|
account.pronouns = Helper.parseHtml(field.value);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (account.pronouns != null) {
|
|
|
|
if (account.pronouns != null) {
|
|
|
|
holder.binding.pronouns.setText(account.pronouns);
|
|
|
|
holder.binding.pronouns.setText(account.pronouns);
|
|
|
|
holder.binding.pronouns.setVisibility(View.VISIBLE);
|
|
|
|
holder.binding.pronouns.setVisibility(View.VISIBLE);
|
|
|
|