mirror of
				https://github.com/lacerta-doc/Lacerta.git
				synced 2025-11-04 08:50:47 +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() {
 | 
					        lacertaApplyTagAdapter.setListener(new LacertaApplyTagAdapter.LacertaApplyTagDialogListener() {
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void itemChecked(View view, String tagId) {
 | 
					            public void itemChecked(View view, String tagId) {
 | 
				
			||||||
                // Do something
 | 
					                applyChangeToVariable(true, tagId);
 | 
				
			||||||
                Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show();
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void itemUnchecked(View view, String tagId) {
 | 
					            public void itemUnchecked(View view, String tagId) {
 | 
				
			||||||
                // Do something
 | 
					                applyChangeToVariable(false, tagId);
 | 
				
			||||||
                Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show();
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -132,6 +130,14 @@ public class LacertaApplyTagDialog extends DialogFragment {
 | 
				
			|||||||
        return builder.create();
 | 
					        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) {
 | 
					    private CompletableFuture<ArrayList<DocumentTagApplyTagDialogExtendedModel>> getDocumentTagArrayList(String documentId) {
 | 
				
			||||||
        return CompletableFuture.supplyAsync(() -> {
 | 
					        return CompletableFuture.supplyAsync(() -> {
 | 
				
			||||||
            ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList = new ArrayList<>();
 | 
					            ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList = new ArrayList<>();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user