[android] Added convenience methods to base fragments.

This commit is contained in:
Dmitry Yunitsky 2016-01-23 14:54:02 +03:00 committed by Sergey Yershov
parent b973c417d4
commit 8284809e09
4 changed files with 12 additions and 1 deletions

View file

@ -18,4 +18,9 @@ public class BaseMwmFragment extends Fragment
super.onPause();
org.alohalytics.Statistics.logEvent("$onPause", this.getClass().getSimpleName());
}
public BaseMwmFragmentActivity getMwmActivity()
{
return (BaseMwmFragmentActivity) getActivity();
}
}

View file

@ -149,7 +149,7 @@ public class BaseMwmFragmentActivity extends AppCompatActivity
/**
* Replace attached fragment with the new one.
*/
public void replaceFragment(Class<? extends Fragment> fragmentClass, Bundle args, @Nullable Runnable completionListener)
public void replaceFragment(Class<? extends Fragment> fragmentClass, @Nullable Bundle args, @Nullable Runnable completionListener)
{
final int resId = getFragmentContentResId();
if (resId <= 0 || findViewById(resId) == null)

View file

@ -9,6 +9,7 @@ import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
@Deprecated
public abstract class BaseMwmListFragment extends ListFragment
{
private Toolbar mToolbar;

View file

@ -89,4 +89,9 @@ public abstract class BaseMwmRecyclerFragment extends Fragment
super.onPause();
org.alohalytics.Statistics.logEvent("$onPause", this.getClass().getSimpleName());
}
public BaseMwmFragmentActivity getMwmActivity()
{
return (BaseMwmFragmentActivity) getActivity();
}
}