package com.duopoints.android.fragments.base

import android.os.Bundle
import com.duopoints.android.utils.logging.LogLevel
import com.duopoints.android.utils.logging.log
import com.evernote.android.state.StateSaver

import com.trello.rxlifecycle2.components.support.RxFragment


abstract class BasePresenter<View : RxFragment> protected constructor(protected var view: View) {

    internal fun onCreate(savedState: Bundle?) {
        StateSaver.restoreInstanceState(this, savedState)
    }

    internal fun onSave(state: Bundle) {
        StateSaver.saveInstanceState(this, state)
    }

    fun log(logLevel: LogLevel, message: String) {
        javaClass.log(logLevel, message)
    }

    fun log(logLevel: LogLevel, throwable: Throwable) {
        javaClass.log(logLevel, throwable)
    }
}