1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 12:44:42 +00:00

Localize swipe target

This commit is contained in:
M66B 2020-06-06 11:18:11 +02:00
parent b8e0f65f0d
commit 1f07643918

View file

@ -490,7 +490,27 @@ public class FragmentAccount extends FragmentBase {
spTrash.setAdapter(adapter);
spJunk.setAdapter(adapter);
adapterSwipe = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList<EntityFolder>());
adapterSwipe = new ArrayAdapter<EntityFolder>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList<EntityFolder>()) {
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
return localize(position, super.getView(position, convertView, parent));
}
@Override
public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
return localize(position, super.getDropDownView(position, convertView, parent));
}
private View localize(int position, View view) {
EntityFolder folder = getItem(position);
if (folder != null) {
TextView tv = view.findViewById(android.R.id.text1);
tv.setText(EntityFolder.localizeName(view.getContext(), folder.name));
}
return view;
}
};
adapterSwipe.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spLeft.setAdapter(adapterSwipe);