package com.example.patrice.notification_message;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;

public class token extends AppCompatActivity
{
    private TextView text_Token;

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

        getSupportActionBar().setTitle("  Token ");
        getSupportActionBar().setLogo(R.drawable.key);
        getSupportActionBar().setDisplayUseLogoEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);

        text_Token = (TextView) findViewById(R.id.text_Token);

        String token = SharedPrefManager.getInstance(token.this).getDeviceToken();

        if (token != null)
        {
            text_Token.setText(token);
        }
        else
        {
            text_Token.setText("Token not generated");
        }

    }

    /*************************************************************************/

    // pour le retour - inclus dans l'action bar ( < )
    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        switch (item.getItemId())
        {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    /*************************************************************************/


}
