Display avatars in account chooser

This commit is contained in:
stefan-niedermann 2019-10-04 20:16:32 +02:00
parent 22b195bb54
commit a8f32f02c8
2 changed files with 12 additions and 3 deletions

View file

@ -16,6 +16,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -227,7 +228,13 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
accountChooser.removeAllViews();
for (LocalAccount account : db.getAccounts()) {
View v = getLayoutInflater().inflate(R.layout.item_account, null);
((TextView) v.findViewById(R.id.accountItemLabel)).setText(account.getUserName());
((TextView) v.findViewById(R.id.accountItemLabel)).setText(account.getAccountName());
Glide
.with(this)
.load(account.getUrl() + "/index.php/avatar/" + Uri.encode(account.getUserName()) + "/64")
.error(R.drawable.ic_account_circle_grey_24dp)
.apply(RequestOptions.circleCropTransform())
.into(((ImageView) v.findViewById(R.id.accountItemAvatar)));
v.setOnClickListener(clickedView -> {
SingleAccountHelper.setCurrentAccount(getApplicationContext(), account.getAccountName());
db.getNoteServerSyncHelper().updateAccount();

View file

@ -26,8 +26,10 @@
android:layout_centerVertical="true"
android:layout_marginLeft="64dp"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:lines="1"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:ellipsize="middle"
android:singleLine="true"
android:textAppearance="@style/NavigationItem"
tools:hint="Username"/>