blob: dea4d45454da98252d71f36f1cba24abcf1d1e95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package com.mapswithme.maps.base;
import android.content.Intent;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapswithme.maps.auth.Authorizer;
import com.mapswithme.maps.auth.TargetFragmentCallback;
public abstract class BaseAuthFragment extends BaseAsyncOperationFragment
implements Authorizer.Callback, TargetFragmentCallback
{
@NonNull
private final Authorizer mAuthorizer = new Authorizer(this);
protected void authorize()
{
mAuthorizer.authorize();
}
@Override
@CallSuper
public void onStart()
{
super.onStart();
mAuthorizer.attach(this);
}
@Override
@CallSuper
public void onStop()
{
super.onStop();
mAuthorizer.detach();
}
@Override
public void onTargetFragmentResult(int resultCode, @Nullable Intent data)
{
mAuthorizer.onTargetFragmentResult(resultCode, data);
}
@Override
public boolean isTargetAdded()
{
return isAdded();
}
protected boolean isAuthorized()
{
return mAuthorizer.isAuthorized();
}
}
|