Minor refactoring duplicated code.
This commit is contained in:
parent
05af6974fe
commit
fa0dae54c5
1 changed files with 16 additions and 17 deletions
|
@ -2263,33 +2263,32 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuickSearchDialogFragment getQuickSearchDialogFragment() {
|
public QuickSearchDialogFragment getQuickSearchDialogFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(QuickSearchDialogFragment.TAG);
|
return getFragment(QuickSearchDialogFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (QuickSearchDialogFragment) fragment : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlanRouteFragment getPlanRouteFragment() {
|
public PlanRouteFragment getPlanRouteFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(PlanRouteFragment.TAG);
|
return getFragment(PlanRouteFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (PlanRouteFragment) fragment : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MeasurementToolFragment getMeasurementToolFragment() {
|
public MeasurementToolFragment getMeasurementToolFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(MeasurementToolFragment.TAG);
|
return getFragment(MeasurementToolFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (MeasurementToolFragment) fragment : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChooseRouteFragment getChooseRouteFragment() {
|
public ChooseRouteFragment getChooseRouteFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(ChooseRouteFragment.TAG);
|
return getFragment(ChooseRouteFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (ChooseRouteFragment) fragment : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditProfileFragment getEditProfileFragment() {
|
public EditProfileFragment getEditProfileFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(EditProfileFragment.TAG);
|
return getFragment(EditProfileFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (EditProfileFragment) fragment : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuickActionListFragment getQuickActionListFragment() {
|
public QuickActionListFragment getQuickActionListFragment() {
|
||||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag(QuickActionListFragment.TAG);
|
return getFragment(QuickActionListFragment.TAG);
|
||||||
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (QuickActionListFragment) fragment : null;
|
}
|
||||||
|
|
||||||
|
<T> T getFragment(String fragmentTag){
|
||||||
|
Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||||
|
return fragment != null && !fragment.isDetached() && !fragment.isRemoving() ? (T) fragment : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTopToolbarActive() {
|
public boolean isTopToolbarActive() {
|
||||||
|
|
Loading…
Reference in a new issue