// Path: nimble/src/main/java/com/lenguyenthanh/nimble/BasePresenter.java
// public abstract class BasePresenter<View extends NimbleView> implements NimblePresenter<View> {
//   private View view = null;
// 
//   protected final boolean hasView() {
//     return view != null;
//   }
// 
//   protected final View getView() {
//     return view;
//   }
// 
//   @Override
//   public void takeView(View view) {
//     if (this.view != view) {
//       if (this.view != null) {
//         dropView(this.view);
//       }
//       this.view = view;
//     }
//   }
// 
//   @Override
//   @CallSuper
//   public void dropView(@NonNull final View view) {
//     if (view == this.view) {
//       this.view = null;
//     }
//   }
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/UserRepository.java
// public interface UserRepository {
//   User getUser();
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/UserRepositoryImpl.java
// public class UserRepositoryImpl implements UserRepository {
//   @Override
//   public User getUser() {
//     return new User("Nimble", "Library");
//   }
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/model/User.java
// public class User {
//   public final String firstName;
//   public final String lastName;
// 
//   public User(String firstName, String lastName) {
//     this.firstName = firstName;
//     this.lastName = lastName;
//   }
// 
//   @Override
//   public String toString() {
//     return firstName + " " + lastName;
//   }
// }


import android.os.Bundle;
import android.support.annotation.NonNull;
import com.lenguyenthanh.nimble.BasePresenter;
import com.lenguyenthanh.nimbleexample.data.UserRepository;
import com.lenguyenthanh.nimbleexample.data.UserRepositoryImpl;
import com.lenguyenthanh.nimbleexample.data.model.User;
/*
 * Copyright 2016 Thanh Le.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lenguyenthanh.nimbleexample.ui.main;


public class MainPresenterImpl extends BasePresenter<MainView> implements MainPresenter {

  @NonNull
  private final UserRepository userRepository;

  public MainPresenterImpl() {
    this.userRepository = new UserRepositoryImpl();
  }

  @Override
  public void onSave(Bundle outState) {
    // This method is intentionally empty.
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    // This method is intentionally empty.
  }

  @Override
  public void getUser() {
    User user = userRepository.getUser();
// Path: nimble/src/main/java/com/lenguyenthanh/nimble/BasePresenter.java
// public abstract class BasePresenter<View extends NimbleView> implements NimblePresenter<View> {
//   private View view = null;
// 
//   protected final boolean hasView() {
//     return view != null;
//   }
// 
//   protected final View getView() {
//     return view;
//   }
// 
//   @Override
//   public void takeView(View view) {
//     if (this.view != view) {
//       if (this.view != null) {
//         dropView(this.view);
//       }
//       this.view = view;
//     }
//   }
// 
//   @Override
//   @CallSuper
//   public void dropView(@NonNull final View view) {
//     if (view == this.view) {
//       this.view = null;
//     }
//   }
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/UserRepository.java
// public interface UserRepository {
//   User getUser();
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/UserRepositoryImpl.java
// public class UserRepositoryImpl implements UserRepository {
//   @Override
//   public User getUser() {
//     return new User("Nimble", "Library");
//   }
// }
// 
// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/data/model/User.java
// public class User {
//   public final String firstName;
//   public final String lastName;
// 
//   public User(String firstName, String lastName) {
//     this.firstName = firstName;
//     this.lastName = lastName;
//   }
// 
//   @Override
//   public String toString() {
//     return firstName + " " + lastName;
//   }
// }


// Path: nimble-example/src/main/java/com/lenguyenthanh/nimbleexample/ui/main/MainPresenterImpl.java
import android.os.Bundle;
import android.support.annotation.NonNull;
import com.lenguyenthanh.nimble.BasePresenter;
import com.lenguyenthanh.nimbleexample.data.UserRepository;
import com.lenguyenthanh.nimbleexample.data.UserRepositoryImpl;
import com.lenguyenthanh.nimbleexample.data.model.User;

/*
 * Copyright 2016 Thanh Le.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lenguyenthanh.nimbleexample.ui.main;


public class MainPresenterImpl extends BasePresenter<MainView> implements MainPresenter {

  @NonNull
  private final UserRepository userRepository;

  public MainPresenterImpl() {
    this.userRepository = new UserRepositoryImpl();
  }

  @Override
  public void onSave(Bundle outState) {
    // This method is intentionally empty.
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    // This method is intentionally empty.
  }

  @Override
  public void getUser() {
    User user = userRepository.getUser();
    getView().sayHello(user.toString());