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

import android.os.Bundle;
import android.view.View;

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

/**
 * 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_error);

    View buttonRetry = findViewById(R.id.button_confirm);
    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.hide();
  }

  @Override
  NetworkErrorPresenter definePresenter() {
    return new NetworkErrorPresenter(getModel(BlankModel.class), this);
  }
}
