Fix back from conf map/screen

This commit is contained in:
max-klaus 2020-02-09 17:53:28 +03:00
parent 2231923bca
commit e98193c29d
2 changed files with 17 additions and 4 deletions

View file

@ -26,6 +26,7 @@ import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentManager.BackStackEntry;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
@ -136,6 +137,7 @@ import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.settings.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.settings.ConfigureProfileFragment;
import net.osmand.plus.settings.DataStorageFragment;
import net.osmand.plus.settings.ProfileAppearanceFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
@ -2509,6 +2511,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(QuickActionListFragment.TAG);
}
public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
if (backStackEntryCount > 0) {
BackStackEntry entry = fragmentManager.getBackStackEntryAt(backStackEntryCount - 1);
if (ConfigureProfileFragment.TAG.equals(entry.getName())) {
fragmentManager.popBackStack();
}
}
}
<T> T getFragment(String fragmentTag){
Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;

View file

@ -1041,22 +1041,22 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
public boolean onBackPressed() {
if (isVisible()) {
return backPressed();
backPressed();
return true;
}
return false;
}
private boolean backPressed() {
private void backPressed() {
if (previousVisibleType != visibleType && previousVisibleType != null) {
if (visibleType == DashboardType.MAPILLARY) {
hideKeyboard();
}
visibleType = null;
setDashboardVisibility(true, previousVisibleType);
return true;
} else {
hideDashboard();
return false;
mapActivity.backToConfigureProfileFragment();
}
}