From 8284809e09d40e6e4b9cfc3da9bb19859778335a Mon Sep 17 00:00:00 2001 From: Dmitry Yunitsky Date: Sat, 23 Jan 2016 14:54:02 +0300 Subject: [PATCH] [android] Added convenience methods to base fragments. --- android/src/com/mapswithme/maps/base/BaseMwmFragment.java | 5 +++++ .../com/mapswithme/maps/base/BaseMwmFragmentActivity.java | 2 +- .../src/com/mapswithme/maps/base/BaseMwmListFragment.java | 1 + .../com/mapswithme/maps/base/BaseMwmRecyclerFragment.java | 5 +++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/android/src/com/mapswithme/maps/base/BaseMwmFragment.java b/android/src/com/mapswithme/maps/base/BaseMwmFragment.java index 126de69fb0..a79049469d 100644 --- a/android/src/com/mapswithme/maps/base/BaseMwmFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseMwmFragment.java @@ -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(); + } } diff --git a/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java b/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java index 51fd7a0a05..fe8b6f75b7 100644 --- a/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java +++ b/android/src/com/mapswithme/maps/base/BaseMwmFragmentActivity.java @@ -149,7 +149,7 @@ public class BaseMwmFragmentActivity extends AppCompatActivity /** * Replace attached fragment with the new one. */ - public void replaceFragment(Class fragmentClass, Bundle args, @Nullable Runnable completionListener) + public void replaceFragment(Class fragmentClass, @Nullable Bundle args, @Nullable Runnable completionListener) { final int resId = getFragmentContentResId(); if (resId <= 0 || findViewById(resId) == null) diff --git a/android/src/com/mapswithme/maps/base/BaseMwmListFragment.java b/android/src/com/mapswithme/maps/base/BaseMwmListFragment.java index 85052c3399..2a715b2113 100644 --- a/android/src/com/mapswithme/maps/base/BaseMwmListFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseMwmListFragment.java @@ -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; diff --git a/android/src/com/mapswithme/maps/base/BaseMwmRecyclerFragment.java b/android/src/com/mapswithme/maps/base/BaseMwmRecyclerFragment.java index 4f32c2a1fa..920f355a5f 100644 --- a/android/src/com/mapswithme/maps/base/BaseMwmRecyclerFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseMwmRecyclerFragment.java @@ -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(); + } }