Some improvements

This commit is contained in:
stom79 2019-02-08 07:43:06 +01:00
parent 6c987e611b
commit a205d072ca
8 changed files with 26 additions and 12 deletions

View File

@ -102,7 +102,7 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
}
//Redraws icon for locked accounts
final float scale = context.getResources().getDisplayMetrics().density;
if( account != null && account.isLocked()){
if( account.isLocked()){
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_lock_outline);
assert img != null;
img.setBounds(0,0,(int) (20 * scale + 0.5f),(int) (20 * scale + 0.5f));
@ -110,31 +110,38 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
}else{
holder.account_dn.setCompoundDrawables( null, null, null, null);
}
if( account.isFollowing()){
holder.account_follow.hide();
}else{
holder.account_follow.show();
}
if( !account.getSocial().contains("OPENCOLLECTIVE")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
assert account != null;
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
holder.account_un.setText(String.format("@%s", account.getAcct()));
} else {
assert account != null;
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
holder.account_un.setText(String.format("@%s", account.getAcct()));
}
if( account.isFollowing()){
holder.account_follow.hide();
}else{
holder.account_follow.show();
}
}else{
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));
holder.account_un.setText(account.getAcct());
holder.account_follow.hide();
}
Helper.changeDrawableColor(context, R.drawable.ic_lock_outline,R.color.mastodonC4);
//Profile picture
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
.into(holder.account_pp);
if( account.getAvatar().startsWith("http")) {
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
.into(holder.account_pp);
}else if(account.getSocial().contains("OPENCOLLECTIVE")){
Glide.with(holder.account_pp.getContext())
.load(R.drawable.missing)
.into(holder.account_pp);
}
if( !account.getSocial().contains("OPENCOLLECTIVE")) {
@ -156,6 +163,13 @@ public class AccountSearchDevAdapter extends BaseAdapter implements OnPostAction
context.startActivity(intent);
}
});
}else{
holder.acccount_container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.openBrowser(context, account.getUrl());
}
});
}
return convertView;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -161,7 +161,7 @@
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_opencollective"
android:icon="@drawable/ic_attach_money"
android:icon="@drawable/ic_opencollective"
android:title="Open Collective" />
<item
android:id="@+id/nav_how_to"