Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
@Override
protected void onScroll(int scrollY, int oldScrollY) {
super.onScroll(scrollY, oldScrollY);
if (isDirectEditEnabled()) {
// only show FAB if search is not active
if (getSearchNextButton() == null || getSearchNextButton().getVisibility() != View.VISIBLE) {
final ExtendedFloatingActionButton directFab = getDirectEditingButton();
// only show FAB if search is not active
if (getSearchNextButton() == null || getSearchNextButton().getVisibility() != View.VISIBLE) {
final ExtendedFloatingActionButton directFab = getDirectEditingButton();
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
if (isDirectEditEnabled()) {
ExtendedFabUtil.toggleVisibilityOnScroll(directFab, scrollY, oldScrollY);
} else if (normalFab != null) {
ExtendedFabUtil.toggleVisibilityOnScroll(normalFab, scrollY, oldScrollY);
}
}
}
Expand All @@ -103,7 +106,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
} else {
getDirectEditingButton().setVisibility(View.GONE);
ExtendedFloatingActionButton edit = getNormalEditButton();
if(edit!=null) {
if (edit != null) {
edit.setExtended(false);
edit.setVisibility(View.VISIBLE);
edit.setOnClickListener(v -> {
if (listener != null) {
Expand Down Expand Up @@ -285,6 +289,10 @@ public void onSaveInstanceState(@NonNull Bundle outState) {

private void showSearchFabs() {
ExtendedFabUtil.setExtendedFabVisibility(getDirectEditingButton(), false);
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
if (normalFab != null) {
ExtendedFabUtil.setExtendedFabVisibility(normalFab, false);
}
final var next = getSearchNextButton();
final var prev = getSearchPrevButton();
if (prev != null) {
Expand All @@ -304,6 +312,14 @@ private void hideSearchFabs() {
if (next != null) {
next.hide();
}
if (isDirectEditEnabled()) {
ExtendedFabUtil.setExtendedFabVisibility(getDirectEditingButton(), true);
} else {
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
if (normalFab != null) {
ExtendedFabUtil.setExtendedFabVisibility(normalFab, true);
}
}
}

private void jumpToOccurrence() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_note_preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@
android:visibility="visible"
app:backgroundTint="@color/defaultBrand"
app:icon="@drawable/ic_edit_grey600_24dp"
app:layout_anchor="@+id/direct_editing"
app:layout_anchorGravity="center" />
app:layout_anchor="@id/scrollView"
app:layout_anchorGravity="bottom|end" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>