package com.example.lookifyv2; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.PorterDuff; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class DecodeFail extends AppCompatActivity { private Button button_tryagain; String status; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_decode_fail); assert getSupportActionBar() != null; getSupportActionBar().setDisplayHomeAsUpEnabled(true); Bundle extras = getIntent().getExtras(); status = extras.getString("status"); showMessage(status); button_tryagain = findViewById(R.id.try_again_button); button_tryagain.getBackground().setColorFilter(0xFF67BAFF, PorterDuff.Mode.MULTIPLY); button_tryagain.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openScan(); } }); } public void openScan(){ Intent intent_Scan = new Intent(this, TakePhoto.class); startActivity(intent_Scan); finish(); } public void showMessage(String status){ if(status.equals("notfound")){ TextView message = findViewById(R.id.text_notfound); message.setVisibility(View.VISIBLE); } else if(status.equals("offline")){ TextView message = findViewById(R.id.text_offline); message.setVisibility(View.VISIBLE); } else{ TextView message = findViewById(R.id.text_notindatabase); message.setVisibility(View.VISIBLE); } } @Override public boolean onSupportNavigateUp(){ finish(); return true; } }