Layout improvements

pull/146/head
M66B 6 years ago
parent 45657d026e
commit 27597da217

@ -864,8 +864,8 @@ public class FragmentAccount extends FragmentEx {
} }
}); });
adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item, new ArrayList<EntityFolder>()); adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList<EntityFolder>());
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spDrafts.setAdapter(adapter); spDrafts.setAdapter(adapter);
spSent.setAdapter(adapter); spSent.setAdapter(adapter);
@ -931,9 +931,10 @@ public class FragmentAccount extends FragmentEx {
providers.add(0, new Provider(getString(R.string.title_select))); providers.add(0, new Provider(getString(R.string.title_select)));
providers.add(1, new Provider(getString(R.string.title_custom))); providers.add(1, new Provider(getString(R.string.title_custom)));
ArrayAdapter<Provider> padapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item, providers); ArrayAdapter<Provider> aaProvider =
padapter.setDropDownViewResource(R.layout.spinner_dropdown_item); new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, providers);
spProvider.setAdapter(padapter); aaProvider.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spProvider.setAdapter(aaProvider);
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (account != null) { if (account != null) {

@ -1318,7 +1318,7 @@ public class FragmentCompose extends FragmentEx {
// Show accounts // Show accounts
AccountAdapter adapter = new AccountAdapter(getContext(), accounts); AccountAdapter adapter = new AccountAdapter(getContext(), accounts);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spAccount.setAdapter(adapter); spAccount.setAdapter(adapter);
spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@ -1345,7 +1345,7 @@ public class FragmentCompose extends FragmentEx {
// Show identities // Show identities
IdentityAdapter adapter = new IdentityAdapter(getContext(), identities); IdentityAdapter adapter = new IdentityAdapter(getContext(), identities);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spIdentity.setAdapter(adapter); spIdentity.setAdapter(adapter);
boolean found = false; boolean found = false;
@ -1387,7 +1387,7 @@ public class FragmentCompose extends FragmentEx {
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
IdentityAdapter adapter = new IdentityAdapter(getContext(), new ArrayList<EntityIdentity>()); IdentityAdapter adapter = new IdentityAdapter(getContext(), new ArrayList<EntityIdentity>());
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spIdentity.setAdapter(adapter); spIdentity.setAdapter(adapter);
} }
}); });
@ -1675,16 +1675,16 @@ public class FragmentCompose extends FragmentEx {
@NonNull @NonNull
@Override @Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
return getLayout(position, convertView, parent); return getLayout(position, convertView, parent, R.layout.spinner_item1);
} }
@Override @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) { public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getLayout(position, convertView, parent); return getLayout(position, convertView, parent, R.layout.spinner_item1_dropdown);
} }
View getLayout(int position, View convertView, ViewGroup parent) { View getLayout(int position, View convertView, ViewGroup parent, int resid) {
View view = LayoutInflater.from(context).inflate(R.layout.spinner_item1, parent, false); View view = LayoutInflater.from(context).inflate(resid, parent, false);
EntityAccount account = accounts.get(position); EntityAccount account = accounts.get(position);

@ -645,17 +645,19 @@ public class FragmentIdentity extends FragmentEx {
unselected.primary = false; unselected.primary = false;
accounts.add(0, unselected); accounts.add(0, unselected);
ArrayAdapter<EntityAccount> aa = new ArrayAdapter<>(getContext(), R.layout.spinner_item, accounts); ArrayAdapter<EntityAccount> aaAccount =
aa.setDropDownViewResource(R.layout.spinner_dropdown_item); new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, accounts);
spAccount.setAdapter(aa); aaAccount.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spAccount.setAdapter(aaAccount);
// Get providers // Get providers
List<Provider> providers = Provider.loadProfiles(getContext()); List<Provider> providers = Provider.loadProfiles(getContext());
providers.add(0, new Provider(getString(R.string.title_custom))); providers.add(0, new Provider(getString(R.string.title_custom)));
ArrayAdapter<Provider> adapterProfile = new ArrayAdapter<>(getContext(), R.layout.spinner_item, providers); ArrayAdapter<Provider> aaProfile =
adapterProfile.setDropDownViewResource(R.layout.spinner_dropdown_item); new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, providers);
spProvider.setAdapter(adapterProfile); aaProfile.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spProvider.setAdapter(aaProfile);
if (savedInstanceState == null) { if (savedInstanceState == null) {
spProvider.setTag(0); spProvider.setTag(0);

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Title"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:textColorPrimary" />

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Title"
android:textAlignment="inherit"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:textColorPrimary" />

@ -10,8 +10,9 @@
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Name" android:text="Text1"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="?android:attr/listPreferredItemHeightSmall"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<TextView
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text1"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -10,7 +10,7 @@
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Name" android:text="Text1"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -19,7 +19,7 @@
android:id="@android:id/text2" android:id="@android:id/text2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Email" android:text="Text2"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@android:id/text1" /> app:layout_constraintTop_toBottomOf="@android:id/text1" />

Loading…
Cancel
Save