Skip to content

Commit 5f5732f

Browse files
committed
removed involvement of nearbyFragment
1 parent 9b5eb1f commit 5f5732f

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import fr.free.nrw.commons.quiz.QuizChecker;
4343
import fr.free.nrw.commons.theme.NavigationBaseActivity;
4444
import fr.free.nrw.commons.upload.UploadService;
45+
import fr.free.nrw.commons.utils.ViewUtil;
4546
import io.reactivex.android.schedulers.AndroidSchedulers;
4647
import io.reactivex.schedulers.Schedulers;
4748
import timber.log.Timber;
@@ -179,7 +180,7 @@ public void onPageSelected(int position) {
179180
Timber.d("Contributions tab selected");
180181
tabLayout.getTabAt(CONTRIBUTIONS_TAB_POSITION).select();
181182
isContributionsFragmentVisible = true;
182-
((NearbyParentFragment)contributionsActivityPagerAdapter.getItem(NEARBY_TAB_POSITION)).hideKeyboard();
183+
ViewUtil.hideKeyboard(tabLayout.getRootView());
183184
updateMenuItem();
184185
break;
185186
case NEARBY_TAB_POSITION:

app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
package fr.free.nrw.commons.nearby.fragments;
22

33
import android.Manifest;
4-
import android.app.Activity;
54
import android.app.AlertDialog;
65
import android.content.BroadcastReceiver;
76
import android.content.Context;
87
import android.content.Intent;
98
import android.content.IntentFilter;
109
import android.content.res.Configuration;
1110
import android.os.Bundle;
12-
import android.os.IBinder;
1311
import android.util.Log;
1412
import android.view.Gravity;
1513
import android.view.LayoutInflater;
1614
import android.view.View;
1715
import android.view.ViewGroup;
1816
import android.view.animation.Animation;
1917
import android.view.animation.AnimationUtils;
20-
import android.view.inputmethod.InputMethodManager;
2118
import android.widget.Button;
2219
import android.widget.FrameLayout;
2320
import android.widget.ImageView;
@@ -494,20 +491,6 @@ public void centerMapToPlace(Place place) {
494491
}
495492
}
496493

497-
/**
498-
* Hides the keyboard in case the tab is switched
499-
*/
500-
public void hideKeyboard(){
501-
if(!searchView.isIconified()) {
502-
searchView.clearFocus();
503-
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
504-
final IBinder windowToken = this.getView().getRootView().getWindowToken();
505-
if (view != null) {
506-
imm.hideSoftInputFromWindow(windowToken, InputMethodManager.HIDE_NOT_ALWAYS);
507-
}
508-
}
509-
}
510-
511494

512495
/**
513496
* Thanks to this method we make sure NearbyMapFragment is ready and attached. So that we can

0 commit comments

Comments
 (0)