Skip to content

Commit 0933e2f

Browse files
committed
Move simple Edit Button from top to right bottom corner to prevent cover note text
1 parent 524b708 commit 0933e2f

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎app/src/main/java/it/niedermann/owncloud/notes/edit/SearchableBaseNoteFragment.java‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
7575
@Override
7676
protected void onScroll(int scrollY, int oldScrollY) {
7777
super.onScroll(scrollY, oldScrollY);
78-
if (isDirectEditEnabled()) {
79-
// only show FAB if search is not active
80-
if (getSearchNextButton() == null || getSearchNextButton().getVisibility() != View.VISIBLE) {
81-
final ExtendedFloatingActionButton directFab = getDirectEditingButton();
78+
// only show FAB if search is not active
79+
if (getSearchNextButton() == null || getSearchNextButton().getVisibility() != View.VISIBLE) {
80+
final ExtendedFloatingActionButton directFab = getDirectEditingButton();
81+
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
82+
if (isDirectEditEnabled()) {
8283
ExtendedFabUtil.toggleVisibilityOnScroll(directFab, scrollY, oldScrollY);
84+
} else if (normalFab != null) {
85+
ExtendedFabUtil.toggleVisibilityOnScroll(normalFab, scrollY, oldScrollY);
8386
}
8487
}
8588
}
@@ -103,7 +106,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
103106
} else {
104107
getDirectEditingButton().setVisibility(View.GONE);
105108
ExtendedFloatingActionButton edit = getNormalEditButton();
106-
if(edit!=null) {
109+
if (edit != null) {
110+
edit.setExtended(false);
107111
edit.setVisibility(View.VISIBLE);
108112
edit.setOnClickListener(v -> {
109113
if (listener != null) {
@@ -285,6 +289,10 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
285289

286290
private void showSearchFabs() {
287291
ExtendedFabUtil.setExtendedFabVisibility(getDirectEditingButton(), false);
292+
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
293+
if (normalFab != null) {
294+
ExtendedFabUtil.setExtendedFabVisibility(normalFab, false);
295+
}
288296
final var next = getSearchNextButton();
289297
final var prev = getSearchPrevButton();
290298
if (prev != null) {
@@ -304,6 +312,14 @@ private void hideSearchFabs() {
304312
if (next != null) {
305313
next.hide();
306314
}
315+
if (isDirectEditEnabled()) {
316+
ExtendedFabUtil.setExtendedFabVisibility(getDirectEditingButton(), true);
317+
} else {
318+
final ExtendedFloatingActionButton normalFab = getNormalEditButton();
319+
if (normalFab != null) {
320+
ExtendedFabUtil.setExtendedFabVisibility(normalFab, true);
321+
}
322+
}
307323
}
308324

309325
private void jumpToOccurrence() {

‎app/src/main/res/layout/fragment_note_preview.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@
101101
android:visibility="visible"
102102
app:backgroundTint="@color/defaultBrand"
103103
app:icon="@drawable/ic_edit_grey600_24dp"
104-
app:layout_anchor="@+id/direct_editing"
105-
app:layout_anchorGravity="center" />
104+
app:layout_anchor="@id/scrollView"
105+
app:layout_anchorGravity="bottom|end" />
106106
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 commit comments

Comments
 (0)