package net.heartshield.prevent;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import net.heartshield.data.UserMeta;

/**
 * @author David Madl (git@abanbytes.eu)
 * @date 2017-06-01
 */
public class ErrorActivity extends Activity {
    private UserMeta mUser;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_error);
    }

    @Override
    protected void onResume() {
        super.onResume();
        String message = getIntent().getStringExtra("message");
        mUser = (UserMeta) getIntent().getSerializableExtra("meta");
        if(message == null)
            message = "";

        TextView description = (TextView) findViewById(R.id.description);
        description.setText(message);
    }

    public void ok(View view) {
        Intent intent = new Intent(ErrorActivity.this, MeasureActivity.class);
        intent.putExtra("meta", mUser);
        startActivity(intent);
    }
}
