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.setDropDownViewResource(R.layout.spinner_dropdown_item);
adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList<EntityFolder>());
adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spDrafts.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(1, new Provider(getString(R.string.title_custom)));
ArrayAdapter<Provider> padapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item, providers);
padapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spProvider.setAdapter(padapter);
ArrayAdapter<Provider> aaProvider =
new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, providers);
aaProvider.setDropDownViewResource(R.layout.spinner_item1_dropdown);
spProvider.setAdapter(aaProvider);
if (savedInstanceState == null) {
if (account != null) {

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

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

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

Loading…
Cancel
Save