Skip to content

Commit 3ceaaa9

Browse files
cypheropdomdomegg
authored andcommitted
Fix commons-app#2212: Fix back button behaviour in explore views (commons-app#2650)
1 parent 04d29fe commit 3ceaaa9

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
<activity
102102
android:name=".category.CategoryImagesActivity"
103103
android:label="@string/title_activity_featured_images"
104-
android:parentActivityName=".contributions.MainActivity" />
104+
android:parentActivityName=".contributions.MainActivity"
105+
android:configChanges="orientation|screenSize|keyboard"/>
105106

106107
<activity
107108
android:name=".category.CategoryDetailsActivity"
@@ -111,7 +112,8 @@
111112
<activity
112113
android:name=".explore.categories.ExploreActivity"
113114
android:label="@string/title_activity_explore"
114-
android:parentActivityName=".contributions.MainActivity" />
115+
android:parentActivityName=".contributions.MainActivity"
116+
android:configChanges="orientation|screenSize|keyboard" />
115117

116118
<activity
117119
android:name=".explore.SearchActivity"

app/src/main/java/fr/free/nrw/commons/category/CategoryImagesActivity.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,6 @@ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
127127
forceInitBackButton();
128128
}
129129

130-
/**
131-
* This method is called on backPressed when mediaDetailFragment is opened in the activity.
132-
*/
133-
@Override
134-
protected void onResume() {
135-
if (supportFragmentManager.getBackStackEntryCount()==1){
136-
//FIXME: Temporary fix for screen rotation inside media details. If we don't call onBackPressed then fragment stack is increasing every time.
137-
//FIXME: Similar issue like this https://github.com/commons-app/apps-android-commons/issues/894
138-
onBackPressed();
139-
}
140-
super.onResume();
141-
}
142-
143130
/**
144131
* Consumers should be simply using this method to use this activity.
145132
* @param context A Context of the application package implementing this class.

app/src/main/java/fr/free/nrw/commons/explore/categories/ExploreActivity.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,6 @@ public void unregisterDataSetObserver(DataSetObserver observer) {
177177

178178
}
179179

180-
/**
181-
* This method is called on Screen Rotation
182-
*/
183-
@Override
184-
protected void onResume() {
185-
if (supportFragmentManager.getBackStackEntryCount() == 1) {
186-
//FIXME: Temporary fix for screen rotation inside media details. If we don't call onBackPressed then fragment stack is increasing every time.
187-
//FIXME: Similar issue like this https://github.com/commons-app/apps-android-commons/issues/894
188-
//
189-
onBackPressed();
190-
}
191-
super.onResume();
192-
}
193-
194180
/**
195181
* This method is called on backPressed of anyFragment in the activity.
196182
* If condition is called when mediaDetailFragment is opened.

0 commit comments

Comments
 (0)