mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Support pronouns
This commit is contained in:
		
							parent
							
								
									7ab24d900b
								
							
						
					
					
						commit
						394d72bd01
					
				
					 3 changed files with 29 additions and 0 deletions
				
			
		|  | @ -88,6 +88,7 @@ public class Account implements Serializable { | |||
|     @SerializedName("role") | ||||
|     public Role role; | ||||
|     public transient RelationShip relationShip; | ||||
|     public transient String pronouns = null; | ||||
| 
 | ||||
| 
 | ||||
|     public synchronized Spannable getSpanDisplayName(Context context, WeakReference<View> viewWeakReference) { | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ import java.util.List; | |||
| 
 | ||||
| import app.fedilab.android.databinding.DrawerAccountSearchBinding; | ||||
| import app.fedilab.android.mastodon.client.entities.api.Account; | ||||
| import app.fedilab.android.mastodon.client.entities.api.Field; | ||||
| import app.fedilab.android.mastodon.helper.MastodonHelper; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -116,6 +117,19 @@ public class AccountsSearchAdapter extends ArrayAdapter<Account> implements Filt | |||
|         holder.binding.accountUn.setText(String.format("@%s", account.acct)); | ||||
|         holder.binding.accountDn.setText(account.display_name); | ||||
|         holder.binding.accountDn.setVisibility(View.VISIBLE); | ||||
|         account.pronouns = null; | ||||
|         for(Field field: account.fields) { | ||||
|             if(field.name.trim().equalsIgnoreCase("pronouns")) { | ||||
|                 account.pronouns = field.value; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         if(account.pronouns != null) { | ||||
|             holder.binding.pronouns.setText(account.pronouns); | ||||
|             holder.binding.pronouns.setVisibility(View.VISIBLE); | ||||
|         } else { | ||||
|             holder.binding.pronouns.setVisibility(View.GONE); | ||||
|         } | ||||
|         MastodonHelper.loadPPMastodon(holder.binding.accountPp, account); | ||||
|         return holder.view; | ||||
|     } | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ | |||
|     see <http://www.gnu.org/licenses> | ||||
| --> | ||||
| <androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/account_container" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|  | @ -27,16 +28,29 @@ | |||
|         android:layout_height="30dp" | ||||
|         android:layout_gravity="center" | ||||
|         android:layout_margin="5dp" | ||||
|         tools:src="@tools:sample/avatars" | ||||
|         android:contentDescription="@string/profile_picture" /> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/account_un" | ||||
|         tools:text="@tools:sample/lorem" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_gravity="center_vertical" | ||||
|         android:layout_marginStart="10dp" | ||||
|         android:singleLine="true" /> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:layout_marginStart="2dp" | ||||
|         android:id="@+id/pronouns" | ||||
|         android:layout_width="wrap_content" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_gravity="center_vertical" | ||||
|         android:visibility="gone" | ||||
|         tools:visibility="visible" | ||||
|         android:textColor="?colorPrimary" | ||||
|         tools:text="He/Him" /> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@+id/account_dn" | ||||
|         android:layout_width="wrap_content" | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue