diff --git a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java index e42e3c8eb2..5afde4c870 100644 --- a/android/src/com/mapswithme/maps/base/BaseAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseAuthFragment.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.base; +import android.content.Context; import android.content.Intent; import android.support.annotation.CallSuper; import android.support.annotation.NonNull; @@ -7,14 +8,8 @@ import android.support.annotation.Nullable; import com.mapswithme.maps.auth.Authorizer; import com.mapswithme.maps.auth.TargetFragmentCallback; -import com.mapswithme.maps.base.BaseMwmToolbarFragment; -/** - * A base toolbar fragment which is responsible for the authorization flow, - * starting from the getting an auth token from a social network and passing it to the core - * to get user authorized for the MapsMe server (Passport). - */ -public abstract class BaseAuthFragment extends BaseMwmToolbarFragment +public abstract class BaseAuthFragment extends BaseAsyncOperationFragment implements Authorizer.Callback, TargetFragmentCallback { @NonNull @@ -27,17 +22,17 @@ public abstract class BaseAuthFragment extends BaseMwmToolbarFragment @Override @CallSuper - public void onStart() + public void onAttach(Context context) { - super.onStart(); + super.onAttach(context); mAuthorizer.attach(this); } @Override @CallSuper - public void onStop() + public void onDestroyView() { - super.onStop(); + super.onDestroyView(); mAuthorizer.detach(); } diff --git a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java index 7ea26b43f5..c06ecc8fb6 100644 --- a/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java +++ b/android/src/com/mapswithme/maps/base/BaseToolbarAuthFragment.java @@ -1,6 +1,5 @@ package com.mapswithme.maps.base; -import android.content.Context; import android.content.Intent; import android.support.annotation.CallSuper; import android.support.annotation.NonNull; @@ -8,8 +7,14 @@ import android.support.annotation.Nullable; import com.mapswithme.maps.auth.Authorizer; import com.mapswithme.maps.auth.TargetFragmentCallback; +import com.mapswithme.maps.base.BaseMwmToolbarFragment; -public abstract class BaseToolbarAuthFragment extends BaseAsyncOperationFragment +/** + * A base toolbar fragment which is responsible for the authorization flow, + * starting from the getting an auth token from a social network and passing it to the core + * to get user authorized for the MapsMe server (Passport). + */ +public abstract class BaseToolbarAuthFragment extends BaseMwmToolbarFragment implements Authorizer.Callback, TargetFragmentCallback { @NonNull @@ -22,17 +27,17 @@ public abstract class BaseToolbarAuthFragment extends BaseAsyncOperationFragment @Override @CallSuper - public void onAttach(Context context) + public void onStart() { - super.onAttach(context); + super.onStart(); mAuthorizer.attach(this); } @Override @CallSuper - public void onDestroyView() + public void onStop() { - super.onDestroyView(); + super.onStop(); mAuthorizer.detach(); } diff --git a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java index 3cb1703eca..d171d3aec6 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java +++ b/android/src/com/mapswithme/maps/ugc/UGCEditorFragment.java @@ -12,7 +12,7 @@ import android.widget.EditText; import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; -import com.mapswithme.maps.base.BaseAuthFragment; +import com.mapswithme.maps.base.BaseToolbarAuthFragment; import com.mapswithme.maps.background.Notifier; import com.mapswithme.maps.bookmarks.data.FeatureId; import com.mapswithme.maps.metrics.UserActionsLogger; @@ -25,7 +25,7 @@ import com.mapswithme.util.statistics.Statistics; import java.util.List; -public class UGCEditorFragment extends BaseAuthFragment +public class UGCEditorFragment extends BaseToolbarAuthFragment { static final String ARG_FEATURE_ID = "arg_feature_id"; static final String ARG_TITLE = "arg_title"; diff --git a/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java b/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java index 2afe9eacba..6bde37edd7 100644 --- a/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java +++ b/android/src/com/mapswithme/maps/ugc/routes/SendLinkPlaceholderFragment.java @@ -9,7 +9,7 @@ import android.view.View; import android.view.ViewGroup; import com.mapswithme.maps.R; -import com.mapswithme.maps.base.BaseToolbarAuthFragment; +import com.mapswithme.maps.base.BaseAuthFragment; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; import com.mapswithme.maps.bookmarks.data.BookmarkManager; import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty; @@ -21,7 +21,7 @@ import com.mapswithme.util.statistics.Statistics; import java.util.List; import java.util.Objects; -public class SendLinkPlaceholderFragment extends BaseToolbarAuthFragment implements BookmarkManager.BookmarksCatalogListener +public class SendLinkPlaceholderFragment extends BaseAuthFragment implements BookmarkManager.BookmarksCatalogListener { public static final String EXTRA_CATEGORY = "bookmarks_category"; private static final String BODY_STRINGS_SEPARATOR = "\n\n"; diff --git a/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java b/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java index 4da1732cd2..50583becaf 100644 --- a/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java +++ b/android/src/com/mapswithme/maps/ugc/routes/UgcSharingOptionsFragment.java @@ -18,7 +18,7 @@ import android.widget.Toast; import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; -import com.mapswithme.maps.base.BaseAuthFragment; +import com.mapswithme.maps.base.BaseToolbarAuthFragment; import com.mapswithme.maps.base.FinishActivityToolbarController; import com.mapswithme.maps.bookmarks.data.AbstractCategoriesSnapshot; import com.mapswithme.maps.bookmarks.data.BookmarkCategory; @@ -40,8 +40,8 @@ import com.mapswithme.util.statistics.Statistics; import java.util.List; import java.util.Objects; -public class UgcSharingOptionsFragment extends BaseAuthFragment implements BookmarkManager.BookmarksCatalogListener, - AlertDialogCallback +public class UgcSharingOptionsFragment extends BaseToolbarAuthFragment implements BookmarkManager.BookmarksCatalogListener, + AlertDialogCallback { public static final int REQ_CODE_CUSTOM_PROPERTIES = 101; private static final int REQ_CODE_NO_NETWORK_CONNECTION_DIALOG = 103;