Merge pull request #6669 from nextcloud/duplicatedFAB

removed FAB from text file preview and use FDA one
This commit is contained in:
Andy Scherzinger 2020-08-07 14:17:34 +02:00 committed by GitHub
commit babbd23bf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 40 deletions

View file

@ -1054,6 +1054,7 @@ public class FileDisplayActivity extends FileActivity
if (listOfFiles != null) { // should never be null, indeed
setFile(listOfFiles.getCurrentFile());
listOfFiles.setFabVisible(true);
listOfFiles.registerFabListener();
showSortListGroup(true);
}
cleanSecondFragment();
@ -1101,6 +1102,7 @@ public class FileDisplayActivity extends FileActivity
searchView.setQuery(searchQuery, false);
} else if (ocFileListFragment != null && !ocFileListFragment.isSearchFragment() && startFile == null) {
updateListOfFilesFragment(false);
ocFileListFragment.registerFabListener();
} else {
if (ocFileListFragment != null) {
ocFileListFragment.listDirectory(startFile, false, false);

View file

@ -418,10 +418,11 @@ public class OCFileListFragment extends ExtendedListFragment implements
/**
* register listener on FAB.
*/
private void registerFabListener() {
public void registerFabListener() {
FileActivity activity = (FileActivity) getActivity();
if (mFabMain != null) { // is not available in FolderPickerActivity
ThemeUtils.colorFloatingActionButton(mFabMain, R.drawable.ic_plus, requireContext());
mFabMain.setOnClickListener(v -> new OCFileListBottomSheetDialog(activity,
this,
deviceInfo,
@ -1313,7 +1314,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
setFabVisible(false);
} else {
setFabVisible(true);
registerFabListener();
// registerFabListener();
}
// FAB

View file

@ -103,7 +103,7 @@ public class PreviewTextStringFragment extends PreviewTextFragment {
throw new RuntimeException("View may not be null");
}
FloatingActionButton fabMain = view.findViewById(R.id.text_preview_fab);
FloatingActionButton fabMain = requireActivity().findViewById(R.id.fab_main);
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
fabMain.setVisibility(View.GONE);

View file

@ -17,50 +17,29 @@
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.coordinatorlayout.widget.CoordinatorLayout
<TextView
android:id="@+id/text_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:textColor="@color/text_color"
android:textIsSelectable="true"
android:visibility="gone"
tools:maxLength="40"
tools:text="@tools:sample/lorem/random"
tools:visibility="visible" />
<TextView
android:id="@+id/text_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/standard_padding"
android:textIsSelectable="true"
android:textColor="@color/text_color"
android:visibility="gone"
tools:visibility="visible"
tools:maxLength="40"
tools:text="@tools:sample/lorem/random" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/empty_list" />
</ScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/text_preview_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_gravity="end|bottom"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_margin"
android:contentDescription="@string/edit_rich_workspace"
android:visibility="gone"
tools:visibility="visible" />
<include layout="@layout/empty_list" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>