mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes #4385 - App crash On categoryDetail activity when click on image after orientation change (#4397)
* fix issue 4385 * fix orientation change issue * added javadoc Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
parent
3577bd9e3e
commit
845a901604
2 changed files with 12 additions and 0 deletions
|
|
@ -111,11 +111,13 @@
|
|||
<activity
|
||||
android:name=".category.CategoryDetailsActivity"
|
||||
android:label="@string/title_activity_featured_images"
|
||||
android:configChanges="screenSize|keyboard|orientation"
|
||||
android:parentActivityName=".contributions.MainActivity" />
|
||||
|
||||
<activity
|
||||
android:name=".explore.depictions.WikidataItemDetailsActivity"
|
||||
android:label="@string/title_activity_featured_images"
|
||||
android:configChanges="screenSize|keyboard|orientation"
|
||||
android:parentActivityName=".contributions.MainActivity" />
|
||||
|
||||
<activity
|
||||
|
|
|
|||
|
|
@ -48,6 +48,16 @@ abstract class BasePagingFragment<T> : CommonsDaggerSupportFragment(),
|
|||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on configuration change, update the spanCount according to the orientation state.
|
||||
*/
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
paginatedSearchResultsList.apply {
|
||||
layoutManager = GridLayoutManager(context, if (isPortrait) 1 else 2)
|
||||
}
|
||||
}
|
||||
|
||||
override fun observePagingResults(searchResults: LiveData<PagedList<T>>) {
|
||||
this.searchResults?.removeObservers(viewLifecycleOwner)
|
||||
this.searchResults = searchResults
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue