/**
 * Copyright 2019 Carl-Philipp Harmant
 *
 *
 * 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 fr.cph.chicago.core.activity

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.RelativeLayout
import butterknife.BindView
import butterknife.ButterKnife
import fr.cph.chicago.R

/**
 * BusArrivalError activity that can be thrown from anywhere in the app
 *
 * @author Carl-Philipp Harmant
 * @version 1
 */
class ErrorActivity : Activity() {

    @BindView(R.id.retryButton)
    lateinit var button: Button
    @BindView(R.id.failureLayout)
    lateinit var failure: RelativeLayout

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.error)
        ButterKnife.bind(this)

        failure.visibility = View.VISIBLE
        button.setOnClickListener {
            val intent = Intent(this@ErrorActivity, BaseActivity::class.java)
            finish()
            startActivity(intent)
        }
    }
}

/**
 * Copyright 2019 Carl-Philipp Harmant
 *
 *
 * 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 fr.cph.chicago.core.activity

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import fr.cph.chicago.R
import kotlinx.android.synthetic.main.error.failureLayout
import kotlinx.android.synthetic.main.error.retryButton

/**
 * BusArrivalError activity that can be thrown from anywhere in the app
 *
 * @author Carl-Philipp Harmant
 * @version 1
 */
class ErrorActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.error)
        failureLayout.visibility = View.VISIBLE
        retryButton.setOnClickListener {
            val intent = Intent(this@ErrorActivity, BaseActivity::class.java)
            finish()
            startActivity(intent)
        }
    }
}

Remove butterknife from error activity
Remove butterknife from error activity

carlphilipp/chicago-commutes,carlphilipp/chicago-commutes,carlphilipp/chicago-commutes