зеркало из https://github.com/nextcloud/android.git
Merge pull request #13134 from nextcloud/backport/13132/stable-3.29
[stable-3.29] Bug-Fix Add Last Media Item Position
This commit is contained in:
Коммит
f7510f9790
|
@ -30,6 +30,7 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager
|
|||
import com.owncloud.android.datamodel.ThumbnailsCacheManager.GalleryImageGenerationTask.GalleryListener
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.ui.activity.ComponentsGetter
|
||||
import com.owncloud.android.ui.fragment.GalleryFragment
|
||||
import com.owncloud.android.ui.fragment.SearchType
|
||||
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
|
||||
import com.owncloud.android.utils.BitmapUtils
|
||||
|
@ -109,7 +110,10 @@ class OCFileListDelegate(
|
|||
width
|
||||
)
|
||||
|
||||
imageView.setOnClickListener { ocFileListFragmentInterface.onItemClicked(file) }
|
||||
imageView.setOnClickListener {
|
||||
ocFileListFragmentInterface.onItemClicked(file)
|
||||
GalleryFragment.setLastMediaItemPosition(galleryRowHolder.absoluteAdapterPosition)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("ComplexMethod")
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.owncloud.android.ui.activity.FolderPickerActivity;
|
|||
import com.owncloud.android.ui.activity.ToolbarActivity;
|
||||
import com.owncloud.android.ui.adapter.CommonOCFileListAdapterInterface;
|
||||
import com.owncloud.android.ui.adapter.GalleryAdapter;
|
||||
import com.owncloud.android.ui.adapter.OCFileListDelegate;
|
||||
import com.owncloud.android.ui.asynctasks.GallerySearchTask;
|
||||
import com.owncloud.android.ui.events.ChangeMenuEvent;
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
private static final int MAX_ITEMS_PER_ROW = 10;
|
||||
private static final String FRAGMENT_TAG_BOTTOM_SHEET = "data";
|
||||
|
||||
private static Integer lastMediaItemPosition = null;
|
||||
public static final String REFRESH_SEARCH_EVENT_RECEIVER = "refreshSearchEventReceiver";
|
||||
|
||||
private boolean photoSearchQueryRunning = false;
|
||||
|
@ -112,9 +114,14 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
}
|
||||
};
|
||||
|
||||
public static void setLastMediaItemPosition(Integer position) {
|
||||
lastMediaItemPosition = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
LocalBroadcastManager.getInstance(requireContext()).unregisterReceiver(refreshSearchEventReceiver);
|
||||
setLastMediaItemPosition(null);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
@ -180,6 +187,10 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1);
|
||||
mAdapter.setLayoutManager(layoutManager);
|
||||
getRecyclerView().setLayoutManager(layoutManager);
|
||||
|
||||
if (lastMediaItemPosition != null) {
|
||||
layoutManager.scrollToPosition(lastMediaItemPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Загрузка…
Ссылка в новой задаче