diff --git a/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 96e02c7043..73995628f7 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -57,6 +57,7 @@ import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.client.preferences.AppPreferencesImpl; import com.owncloud.android.MainApp; import com.owncloud.android.R; +import com.owncloud.android.databinding.ListFragmentBinding; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.files.SearchRemoteOperation; import com.owncloud.android.lib.resources.status.OwnCloudVersion; @@ -142,6 +143,8 @@ public class ExtendedListFragment extends Fragment implements private float mScale = AppPreferencesImpl.DEFAULT_GRID_COLUMN; + private ListFragmentBinding binding; + @Parcel public enum SearchType { NO_SEARCH, @@ -366,12 +369,14 @@ public class ExtendedListFragment extends Fragment implements public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.d(TAG, "onCreateView"); - View v = inflater.inflate(R.layout.list_fragment, null); + binding = ListFragmentBinding.inflate(inflater, container, false); + View v = binding.getRoot(); + setupEmptyList(v); - mRecyclerView = v.findViewById(R.id.list_root); + mRecyclerView = binding.listRoot; mRecyclerView.setHasFooter(true); - mRecyclerView.setEmptyView(v.findViewById(R.id.empty_list_view)); + mRecyclerView.setEmptyView(binding.emptyList.emptyListView); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); @@ -391,7 +396,7 @@ public class ExtendedListFragment extends Fragment implements }); // Pull-down to refresh layout - mRefreshListLayout = v.findViewById(R.id.swipe_containing_list); + mRefreshListLayout = binding.swipeContainingList; ThemeLayoutUtils.colorSwipeRefreshLayout(getContext(), mRefreshListLayout); mRefreshListLayout.setOnRefreshListener(this); @@ -401,6 +406,12 @@ public class ExtendedListFragment extends Fragment implements return v; } + @Override + public void onDestroyView() { + super.onDestroyView(); + binding = null; + } + private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { @Override public boolean onScale(ScaleGestureDetector detector) { @@ -430,10 +441,10 @@ public class ExtendedListFragment extends Fragment implements } protected void setupEmptyList(View view) { - mEmptyListContainer = view.findViewById(R.id.empty_list_view); - mEmptyListMessage = view.findViewById(R.id.empty_list_view_text); - mEmptyListHeadline = view.findViewById(R.id.empty_list_view_headline); - mEmptyListIcon = view.findViewById(R.id.empty_list_icon); + mEmptyListContainer = binding.emptyList.emptyListView; + mEmptyListMessage = binding.emptyList.emptyListViewText; + mEmptyListHeadline = binding.emptyList.emptyListViewHeadline; + mEmptyListIcon = binding.emptyList.emptyListIcon; } /**