/*
 * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
 */
package kr.co.zumo.app.lifeplus.activity;

import android.os.Bundle;
import android.widget.Button;

import kr.co.zumo.app.R;
import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
import kr.co.zumo.app.lifeplus.view.INetworkErrorView;
import kr.co.zumo.app.lifeplus.model.NetworkErrorModel;
import kr.co.zumo.app.lifeplus.view.presenter.NetworkErrorPresenter;
import kr.co.zumo.app.lifeplus.view.Event;

/**
 * NetworkErrorActivity
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 9. 21.]   [최초 작성]
 * @since 2018. 9. 21.
 */
public class NetworkErrorActivity extends ActivityBase<NetworkErrorPresenter> implements INetworkErrorView {

  @Override
  void onAfterCreate(Bundle savedInstanceState) {
    setContentView(R.layout.fragment_network_disconnected);

    Button buttonRetry = findViewById(R.id.button_retry);
    buttonRetry.setOnClickListener(v -> {
      presenter.onEvent(new Event.Builder(Event.RETRY).build());
    });

  }

  @Override
  void defineActionBar() {
    ActionBarManager actionBarManager = ActionBarManager.getInstance();
    actionBarManager.setTitle(R.string.network_disconnected);
    actionBarManager.setDisplayHomeAsUpEnabled(false);
  }

  @Override
  NetworkErrorPresenter definePresenter() {
    return new NetworkErrorPresenter(new NetworkErrorModel(), this);
  }
}
