mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix issue #72 - When composing, some elements are missing
This commit is contained in:
		
							parent
							
								
									d7564cb293
								
							
						
					
					
						commit
						cba32bd12b
					
				
					 2 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -299,6 +299,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
 | 
			
		|||
        statusList.addAll(0, context.ancestors);
 | 
			
		||||
        composeAdapter.setStatusCount(context.ancestors.size() + 1);
 | 
			
		||||
        composeAdapter.notifyItemRangeInserted(0, context.ancestors.size());
 | 
			
		||||
        composeAdapter.notifyItemChanged(context.ancestors.size() + 1);
 | 
			
		||||
        if (binding.recyclerView.getItemDecorationCount() > 0) {
 | 
			
		||||
            for (int i = 0; i < binding.recyclerView.getItemDecorationCount(); i++) {
 | 
			
		||||
                binding.recyclerView.removeItemDecorationAt(i);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -380,7 +380,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
     * @param uris     List<Uri> - uris of the media
 | 
			
		||||
     */
 | 
			
		||||
    public void addAttachment(int position, List<Uri> uris) {
 | 
			
		||||
 | 
			
		||||
        if (position == -1) {
 | 
			
		||||
            position = statusList.size() - 1;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -638,7 +637,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
        AccountsVM accountsVM = new ViewModelProvider((ViewModelStoreOwner) context).get(AccountsVM.class);
 | 
			
		||||
        SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class);
 | 
			
		||||
        textw = new TextWatcher() {
 | 
			
		||||
            private int position;
 | 
			
		||||
            private int cPosition;
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 | 
			
		||||
| 
						 | 
				
			
			@ -649,7 +648,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
                if (count > 2) {
 | 
			
		||||
                    holder.binding.addRemoveStatus.setVisibility(View.VISIBLE);
 | 
			
		||||
                }
 | 
			
		||||
                position = start;
 | 
			
		||||
                cPosition = start;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -659,7 +658,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
                if (currentLength > instanceInfo.configuration.statusesConf.max_characters + 1) {
 | 
			
		||||
                    holder.binding.content.setText(s.delete(instanceInfo.configuration.statusesConf.max_characters - holder.binding.contentSpoiler.getText().length(), (currentLength - holder.binding.contentSpoiler.getText().length())));
 | 
			
		||||
                } else if (currentLength > instanceInfo.configuration.statusesConf.max_characters) {
 | 
			
		||||
                    holder.binding.content.setText(s.delete(position, position + 1));
 | 
			
		||||
                    holder.binding.content.setText(s.delete(cPosition, cPosition + 1));
 | 
			
		||||
                }
 | 
			
		||||
                statusList.get(holder.getAdapterPosition()).text = s.toString();
 | 
			
		||||
                if (s.toString().trim().length() < 2) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1163,7 +1162,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
            }
 | 
			
		||||
            holder.binding.characterProgress.setMax(instanceInfo.configuration.statusesConf.max_characters);
 | 
			
		||||
            holder.binding.contentSpoiler.addTextChangedListener(new TextWatcher() {
 | 
			
		||||
                private int position;
 | 
			
		||||
                private int cPosition;
 | 
			
		||||
 | 
			
		||||
                @Override
 | 
			
		||||
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1171,7 +1170,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
 | 
			
		||||
                @Override
 | 
			
		||||
                public void onTextChanged(CharSequence s, int start, int before, int count) {
 | 
			
		||||
                    position = start;
 | 
			
		||||
                    cPosition = start;
 | 
			
		||||
                    if (count > 2) {
 | 
			
		||||
                        holder.binding.addRemoveStatus.setVisibility(View.VISIBLE);
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1185,7 +1184,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
 | 
			
		|||
                        buttonVisibility(holder);
 | 
			
		||||
                    } else if (currentLength > instanceInfo.configuration.statusesConf.max_characters) {
 | 
			
		||||
                        buttonVisibility(holder);
 | 
			
		||||
                        holder.binding.contentSpoiler.setText(s.delete(position, position + 1));
 | 
			
		||||
                        holder.binding.contentSpoiler.setText(s.delete(cPosition, cPosition + 1));
 | 
			
		||||
                    }
 | 
			
		||||
                    statusList.get(holder.getAdapterPosition()).spoiler_text = s.toString();
 | 
			
		||||
                    if (s.toString().trim().length() < 2) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue