Only compare directories if necessary

Signed-off-by: Unpublished <unpublished@gmx.net>
This commit is contained in:
Unpublished 2019-05-23 09:45:27 +02:00
parent e517451d94
commit 8c06097596

View file

@ -122,7 +122,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.core.util.ObjectsCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
@ -1192,7 +1191,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
mLimitToMimeType
);
boolean changedDirectory = !ObjectsCompat.equals(mFile, directory);
OCFile previousDirectory = mFile;
mFile = directory;
updateLayout();
@ -1200,7 +1199,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
mAdapter.setHighlightedItem(file);
int position = mAdapter.getItemPosition(file);
if (position == -1) {
if (changedDirectory) {
if (previousDirectory == null || !previousDirectory.equals(directory)) {
getRecyclerView().scrollToPosition(0);
}
} else {