Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnDestroy view now should call presenter with unbind #45

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ abstract class InFullMvpBottomSheetDialogFragment<
val rootView = View.inflate(context, presentedView.layoutResId, null)
dialog.setContentView(rootView)
presentedView.bindUiElements(dialog, presenter)
presenter.bind(arguments?: Bundle(), Bundle(), activity.intent.data)
presenter.bind(arguments ?: Bundle(), Bundle(), activity.intent.data)
}

override fun onContextItemSelected(item: MenuItem?): Boolean {
return presenter.onContextItemSelected(item) || super.onContextItemSelected(item)
return presenter.onContextItemSelected(item) || super.onContextItemSelected(item)
}

override fun onDestroyView() {
presenter.unbind()
super.onDestroyView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.infullmobile.android.infullmvp

import android.app.Dialog
import android.os.Bundle
import android.support.annotation.CallSuper
import android.support.v4.app.DialogFragment
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -34,4 +33,9 @@ abstract class InFullMvpDialogFragment<
override fun onContextItemSelected(item: MenuItem?): Boolean {
return presenter.onContextItemSelected(item) || super.onContextItemSelected(item)
}

override fun onDestroyView() {
presenter.unbind()
super.onDestroyView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ public void setupDialog(Dialog dialog, int style) {
public boolean onContextItemSelected(final MenuItem item) {
return getPresenter().onContextItemSelected(item) || super.onContextItemSelected(item);
}

@Override
public void onDestroyView() {
getPresenter().unbind();
super.onDestroyView();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.v4.app.DialogFragment;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -14,6 +13,9 @@ public abstract class InFullMvpDialogFragment<
PresentedViewType extends PresentedDialogView<PresenterType>
> extends DialogFragment {

private static final int NO_INPUT_FLAGS =
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;

protected abstract PresenterType getPresenter();

protected abstract PresentedViewType getPresentedView();
Expand Down Expand Up @@ -54,11 +56,14 @@ void unrestrictedSetup(Dialog dialog, int style) {
}
}

private static final int NO_INPUT_FLAGS =
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;

@Override
public boolean onContextItemSelected(final MenuItem item) {
return getPresenter().onContextItemSelected(item) || super.onContextItemSelected(item);
}

@Override
public void onDestroyView() {
getPresenter().unbind();
super.onDestroyView();
}
}