Skip to content

Commit 7548eeb

Browse files
committed
[SEViewFragment] Resolve Title Update Issue in Editing View
Previously, an issue was identified wherein the title failed to update within the view fragment while editing. This commit rectifies the bug by implementing the necessary logic to ensure the title updates dynamically when edited within the view.
1 parent 19a7510 commit 7548eeb

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

app/src/main/java/de/davis/passwordmanager/ui/elements/SEViewFragment.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ public SecureElement getElement() {
3838

3939
protected void setElement(SecureElement element) {
4040
this.element = element;
41-
getParentFragmentManager().beginTransaction()
42-
.detach(this)
43-
.attach(this)
44-
.commit();
41+
fillInElement(element);
4542
}
4643
}

app/src/main/java/de/davis/passwordmanager/ui/elements/ViewSecureElementFragment.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,24 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
2828

2929
ActivityResultManager arm = ActivityResultManager.getOrCreateManager(getClass(), this);
3030
arm.registerEdit(this::setElement);
31+
}
3132

32-
InformationView titleInformationView = view.findViewById(R.id.title);
33-
if(titleInformationView == null)
34-
return;
33+
@Override
34+
public void fillInElement(@NonNull SecureElement e){
35+
toolbar = requireView().findViewById(R.id.toolbar);
36+
37+
handleFavIcon(e.isFavorite());
3538

36-
if(getElement() == null)
39+
InformationView titleInformationView = requireView().findViewById(R.id.title);
40+
if(titleInformationView == null)
3741
return;
3842

3943
titleInformationView.setInformationText(getElement().getTitle());
40-
titleInformationView.setOnChangedListener(new OnInformationChangedListener<>(getElement(), (e, changes) -> {
44+
titleInformationView.setOnChangedListener(new OnInformationChangedListener<>(getElement(), (el, changes) -> {
4145
getElement().setTitle(changes);
4246
toolbar.setTitle(changes);
4347
return null;
4448
}));
45-
}
46-
47-
@Override
48-
public void fillInElement(@NonNull SecureElement e){
49-
toolbar = requireView().findViewById(R.id.toolbar);
50-
51-
handleFavIcon(e.isFavorite());
5249

5350
toolbar.setTitle(e.getTitle());
5451
toolbar.setSubtitle(SecureElementDetail.getFor(e).getTitle());

0 commit comments

Comments
 (0)