Last active
May 6, 2017 19:19
-
-
Save KucherenkoIhor/5ba1eccc9cc90b23f75ca82f1238053f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseActivity<P extends BasePresenter> extends AppCompatActivity | |
implements BaseView { | |
private Unbinder mUnBinder; | |
private ProgressDialog mProgressDialog = null; | |
protected @NonNull abstract P getPresenterInstance(); | |
protected P mPresenter; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
mPresenter = getPresenterInstance(); | |
mPresenter.attachView(this); | |
} | |
@Override | |
public void setContentView(@LayoutRes int layoutResID) { | |
super.setContentView(layoutResID); | |
mUnBinder = ButterKnife.bind(this); | |
} | |
@Override | |
protected void onDestroy() { | |
mPresenter.detachView(); | |
mUnBinder.unbind(); | |
super.onDestroy(); | |
} | |
@Override | |
public View getContentView() { | |
return getWindow().getDecorView(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment