0

so, i am following MVP pattern and i am delegating every view task to presenter, just the way it should be done

for ex. :

@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
    if(textureView.getVisibility != View.GONE)        
        mPresenter.onSurfaceTextureAvailable(surfaceTexture);
}

i wanted to know if checking for the visibility of a view directly like this inside my activity(which is the View in MVP) is permitted?

thanks!

Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
Abhishek Tiwari
  • 936
  • 10
  • 25

1 Answers1

1

View layer has responsibility to only display views to user. It does not have business logic. Presenter layer responsible for presenting data from Model to View layer. It handles background task, invokes operations on model and setting data in view. You should check it in your Activity like this.

public class YourActivity extends BaseActivity implements MainMvpView {

@Inject YourPresenter yourPresenter;

......


@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
    if(textureView.getVisibility != View.GONE)        
        mPresenter.onSurfaceTextureAvailable(surfaceTexture);
}

......

}
Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85