forked from organicmaps/organicmaps
[android] Inlined methods, added suppress annotations
https://github.com/mapsme/omim/pull/10273#discussion_r252117813 https://github.com/mapsme/omim/pull/10273#discussion_r252117511 https://github.com/mapsme/omim/pull/10273#discussion_r252117215
This commit is contained in:
parent
e2cad930c9
commit
fa75730e48
6 changed files with 28 additions and 29 deletions
android/src/com/mapswithme/maps
|
@ -1,6 +1,5 @@
|
|||
package com.mapswithme.maps.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
|
@ -12,6 +11,7 @@ public abstract class BaseAsyncOperationFragment extends BaseMwmFragment
|
|||
{
|
||||
private static final String PROGRESS_DIALOG_TAG = "base_progress_dialog";
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
protected void showProgress()
|
||||
{
|
||||
int resId = getProgressDialogTitle();
|
||||
|
@ -29,6 +29,7 @@ public abstract class BaseAsyncOperationFragment extends BaseMwmFragment
|
|||
return R.string.downloading;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
protected void hideProgress()
|
||||
{
|
||||
FragmentManager fm = getFragmentManager();
|
||||
|
|
|
@ -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 BaseAuthFragment extends BaseAsyncOperationFragment
|
||||
/**
|
||||
* A base toolbar fragment which is responsible for the <b>authorization flow</b>,
|
||||
* 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
|
||||
implements Authorizer.Callback, TargetFragmentCallback
|
||||
{
|
||||
@NonNull
|
||||
|
@ -22,17 +27,17 @@ public abstract class BaseAuthFragment 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package com.mapswithme.maps.auth;
|
||||
package com.mapswithme.maps.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.CallSuper;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapswithme.maps.base.BaseMwmToolbarFragment;
|
||||
import com.mapswithme.maps.auth.Authorizer;
|
||||
import com.mapswithme.maps.auth.TargetFragmentCallback;
|
||||
|
||||
/**
|
||||
* A base toolbar fragment which is responsible for the <b>authorization flow</b>,
|
||||
* 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 BaseToolbarAuthFragment extends BaseAsyncOperationFragment
|
||||
implements Authorizer.Callback, TargetFragmentCallback
|
||||
{
|
||||
@NonNull
|
||||
|
@ -25,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();
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ import android.widget.EditText;
|
|||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.BaseAuthFragment;
|
||||
import com.mapswithme.maps.base.BaseAuthFragment;
|
||||
import com.mapswithme.maps.background.Notifier;
|
||||
import com.mapswithme.maps.bookmarks.data.FeatureId;
|
||||
import com.mapswithme.maps.metrics.UserActionsLogger;
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseAuthFragment;
|
||||
import com.mapswithme.maps.base.BaseToolbarAuthFragment;
|
||||
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 BaseAuthFragment implements BookmarkManager.BookmarksCatalogListener
|
||||
public class SendLinkPlaceholderFragment extends BaseToolbarAuthFragment implements BookmarkManager.BookmarksCatalogListener
|
||||
{
|
||||
public static final String EXTRA_CATEGORY = "bookmarks_category";
|
||||
private static final String BODY_STRINGS_SEPARATOR = "\n\n";
|
||||
|
@ -43,6 +43,7 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo
|
|||
mCategory = Objects.requireNonNull(args.getParcelable(EXTRA_CATEGORY));
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
|
@ -95,18 +96,13 @@ public class SendLinkPlaceholderFragment extends BaseAuthFragment implements Boo
|
|||
if (uploadResult == BookmarkManager.UploadResult.UPLOAD_RESULT_SUCCESS)
|
||||
onUploadSucceeded();
|
||||
else if (uploadResult == BookmarkManager.UploadResult.UPLOAD_RESULT_AUTH_ERROR)
|
||||
onAuthError();
|
||||
authorize();
|
||||
else
|
||||
onUploadFailed();
|
||||
|
||||
hideProgress();
|
||||
}
|
||||
|
||||
private void onAuthError()
|
||||
{
|
||||
authorize();
|
||||
}
|
||||
|
||||
private void onUploadFailed()
|
||||
{
|
||||
/* FIXME text*/
|
||||
|
|
|
@ -18,7 +18,7 @@ import android.widget.Toast;
|
|||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.BaseAuthFragment;
|
||||
import com.mapswithme.maps.base.BaseAuthFragment;
|
||||
import com.mapswithme.maps.base.FinishActivityToolbarController;
|
||||
import com.mapswithme.maps.bookmarks.data.AbstractCategoriesSnapshot;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
|
|
Loading…
Add table
Reference in a new issue