Skip to content

Commit

Permalink
В базовый класс Presenter-ов добавлены абстрактные методы жизненного …
Browse files Browse the repository at this point in the history
…цикла.
  • Loading branch information
SpertsyanKM committed Mar 7, 2017
1 parent 334af05 commit 821e501
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/ru/profi/vkphotov2/PhotoPresenterBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
*/
public abstract class PhotoPresenterBase {

/**
* Методы жизненного цикла
*/
public abstract void onCreate();
public abstract void onPause();
public abstract void onResume();
public abstract void onDestroy();

/**
* Загрузить фотографию по ссылке
* @param url ссылка на фотографию
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ public void instantiateView(int id) {
uploadPhoto(url, id, view.getActiveWidth());
}

@Override
public void onCreate() {

}

@Override
public void onPause() {

}

@Override
public void onResume() {

}

@Override
public void onDestroy() {

}

@Override
protected void photoUploaded(Bitmap photo, int photoId) {
view.showPhoto(photo, photoId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
grid = (PhotosGridLayout) findViewById(R.id.preview_grid);

presenter = new ProfilePhotosPresenter(this);
presenter.activityCreated();
presenter.onCreate();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public ProfilePhotosPresenter(ProfilePhotosView view) {
this.view = view;
}

/**
* Актиновность создана
*/
public void activityCreated() {
@Override
public void onCreate() {
// Если фотографии уже были загружены, то не надо этого делать снова
if (ProfilePhotos.getProfilePhotoCount() > 0) {
photoInfoUploadFinished();
Expand All @@ -48,6 +46,21 @@ protected void onPostExecute(Void result) {
}.execute();
}

@Override
public void onPause() {

}

@Override
public void onResume() {

}

@Override
public void onDestroy() {

}

@Override
protected void photoUploaded(Bitmap photo, int id) {
view.showPhoto(photo, id);
Expand Down

0 comments on commit 821e501

Please sign in to comment.