forked from mirrors/Fedilab
		
	Some improvements
This commit is contained in:
		
							parent
							
								
									66fb64c5d1
								
							
						
					
					
						commit
						99644a7e64
					
				
					 4 changed files with 15 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -364,7 +364,7 @@ public class ProfileActivity extends BaseActivity {
 | 
			
		|||
        //Fields for profile
 | 
			
		||||
        List<Field> fields = account.fields;
 | 
			
		||||
        if (fields != null && fields.size() > 0) {
 | 
			
		||||
            FieldAdapter fieldAdapter = new FieldAdapter(fields);
 | 
			
		||||
            FieldAdapter fieldAdapter = new FieldAdapter(fields, account);
 | 
			
		||||
            binding.fieldsContainer.setAdapter(fieldAdapter);
 | 
			
		||||
            binding.fieldsContainer.setLayoutManager(new LinearLayoutManager(ProfileActivity.this));
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,12 +52,11 @@ public class CustomEmoji extends ReplacementSpan {
 | 
			
		|||
        if (imageDrawable != null) {
 | 
			
		||||
            canvas.save();
 | 
			
		||||
            int emojiSize = (int) (paint.getTextSize() * scale);
 | 
			
		||||
            Drawable drawable = imageDrawable;
 | 
			
		||||
            drawable.setBounds(0, 0, emojiSize, emojiSize);
 | 
			
		||||
            int transY = bottom - drawable.getBounds().bottom;
 | 
			
		||||
            imageDrawable.setBounds(0, 0, emojiSize, emojiSize);
 | 
			
		||||
            int transY = bottom - imageDrawable.getBounds().bottom;
 | 
			
		||||
            transY -= paint.getFontMetrics().descent / 2;
 | 
			
		||||
            canvas.translate(x, (float) transY);
 | 
			
		||||
            drawable.draw(canvas);
 | 
			
		||||
            imageDrawable.draw(canvas);
 | 
			
		||||
            canvas.restore();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,10 +38,11 @@ public class FieldAdapter extends RecyclerView.Adapter<FieldAdapter.FieldViewHol
 | 
			
		|||
 | 
			
		||||
    private final List<Field> fields;
 | 
			
		||||
    private Context context;
 | 
			
		||||
    private Account account;
 | 
			
		||||
    private final Account account;
 | 
			
		||||
 | 
			
		||||
    public FieldAdapter(List<Field> fields) {
 | 
			
		||||
    public FieldAdapter(List<Field> fields, Account account) {
 | 
			
		||||
        this.fields = fields;
 | 
			
		||||
        this.account = account;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -68,12 +69,18 @@ public class FieldAdapter extends RecyclerView.Adapter<FieldAdapter.FieldViewHol
 | 
			
		|||
        if (field.verified_at != null) {
 | 
			
		||||
            holder.binding.value.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(context, R.drawable.ic_baseline_verified_24), null);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        holder.binding.value.setText(
 | 
			
		||||
                field.getValueSpan(context, account,
 | 
			
		||||
                        new WeakReference<>(holder.binding.value)),
 | 
			
		||||
                TextView.BufferType.SPANNABLE);
 | 
			
		||||
        holder.binding.value.setMovementMethod(LinkMovementMethod.getInstance());
 | 
			
		||||
        holder.binding.label.setText(field.name);
 | 
			
		||||
 | 
			
		||||
        holder.binding.label.setText(
 | 
			
		||||
                field.getValueSpan(context, account,
 | 
			
		||||
                        new WeakReference<>(holder.binding.label)),
 | 
			
		||||
                TextView.BufferType.SPANNABLE);
 | 
			
		||||
        holder.binding.label.setMovementMethod(LinkMovementMethod.getInstance());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,6 +122,7 @@ public class FragmentAdminDomain extends Fragment {
 | 
			
		|||
 | 
			
		||||
        adminVM = new ViewModelProvider(FragmentAdminDomain.this).get(viewModelKey, AdminVM.class);
 | 
			
		||||
 | 
			
		||||
        binding.noActionText.setText(R.string.no_blocked_domains);
 | 
			
		||||
        binding.loader.setVisibility(View.VISIBLE);
 | 
			
		||||
        binding.recyclerView.setVisibility(View.GONE);
 | 
			
		||||
        flagLoading = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue