mirror of
				https://github.com/lacerta-doc/Lacerta.git
				synced 2025-09-09 12:09:25 +00:00 
			
		
		
		
	CheckBoxの変化に応じてインスタンス変数のTagListを変化させるように
This commit is contained in:
		
							parent
							
								
									f2f4c77016
								
							
						
					
					
						commit
						d66546a567
					
				| 
						 | 
				
			
			@ -98,14 +98,12 @@ public class LacertaApplyTagDialog extends DialogFragment {
 | 
			
		|||
        lacertaApplyTagAdapter.setListener(new LacertaApplyTagAdapter.LacertaApplyTagDialogListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void itemChecked(View view, String tagId) {
 | 
			
		||||
                // Do something
 | 
			
		||||
                Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show();
 | 
			
		||||
                applyChangeToVariable(true, tagId);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void itemUnchecked(View view, String tagId) {
 | 
			
		||||
                // Do something
 | 
			
		||||
                Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show();
 | 
			
		||||
                applyChangeToVariable(false, tagId);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -132,6 +130,14 @@ public class LacertaApplyTagDialog extends DialogFragment {
 | 
			
		|||
        return builder.create();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void applyChangeToVariable(boolean isChecked, String tagId) {
 | 
			
		||||
        if (isChecked) {
 | 
			
		||||
            this.registeredTags.stream().findAny().filter(tag -> tag.getId().equals(tagId)).ifPresent(tag -> this.appliedTags.add(tag));
 | 
			
		||||
        } else {
 | 
			
		||||
            this.appliedTags.stream().findAny().filter(tag -> tag.getId().equals(tagId)).ifPresent(tag -> this.appliedTags.remove(tag));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private CompletableFuture<ArrayList<DocumentTagApplyTagDialogExtendedModel>> getDocumentTagArrayList(String documentId) {
 | 
			
		||||
        return CompletableFuture.supplyAsync(() -> {
 | 
			
		||||
            ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList = new ArrayList<>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user