package dev.garrettmills.starship.hyperlink; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Hyperlink.preferences = getSharedPreferences(Hyperlink.SHARED_PREFERENCES_NAME, MODE_PRIVATE); setContentView(R.layout.activity_main); } public void onScanTokenClick(View view) { Intent intent = new Intent(this, LoginTokenScannerActivity.class); startActivityForResult(intent, Hyperlink.REQUEST_LOGIN_TOKEN); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ( resultCode == RESULT_OK && requestCode == Hyperlink.REQUEST_LOGIN_TOKEN ) { if ( data.hasExtra(Hyperlink.EXTRA_LOGIN_TOKEN) ) { if ( BuildConfig.DEBUG ) { Toast.makeText(getApplicationContext(), data.getExtras().getString(Hyperlink.EXTRA_LOGIN_TOKEN), Toast.LENGTH_SHORT).show(); } } } } }