Add start logical for onActivity result

This commit is contained in:
Jacques Foucry 2020-05-31 07:32:42 +02:00
parent cff6ad9cfc
commit 410ef5eb45

View file

@ -66,6 +66,7 @@ public class MedicamentListActivity extends AppCompatActivity {
final Boolean DBDEMO = true;
final static Random random = new Random();
public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;
public final int SAVE_RQUEST_CODE = 0x000000ff;
@Override
public void onStart() {
@ -286,13 +287,21 @@ public class MedicamentListActivity extends AppCompatActivity {
}
switch (requestCode) {
case CUSTOMIZED_REQUEST_CODE: {
Toast.makeText(this, "REQUEST_CODE = " + requestCode, Toast.LENGTH_LONG).show();
Toast.makeText(this, "REQUEST_CODE = " + requestCode + "RESULT_CODE == " + resultCode, Toast.LENGTH_LONG).show();
Log.d(TAG, "requestCode == "+ requestCode);
Log.d(TAG, "resultCode == " + resultCode);
break;
}
default:
case SAVE_RQUEST_CODE: {
Toast.makeText(this, "REQUEST_CODE = " + requestCode + "RESULT_CODE == " + resultCode, Toast.LENGTH_LONG).show();
Log.d(TAG, "requestCode == "+ requestCode);
Log.d(TAG, "resultCode == " + resultCode);
break;
}
default {
Toast.makeText(this, "REQUEST_CODE = " + requestCode + "RESULT_CODE == " + resultCode, Toast.LENGTH_LONG).show();
Log.d(TAG, "requestCode == "+ requestCode);
Log.d(TAG, "resultCode == " + resultCode);
IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);
if(result.getContents() == null) {
@ -309,6 +318,8 @@ public class MedicamentListActivity extends AppCompatActivity {
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
}
}
}
private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getApplicationContext()));