From 2ce346a276c2d90e7d8f53e041213f6cebf8ddb5 Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:19:31 +0200 Subject: [PATCH] Optimize import; Add sentry import; Keep test code commented. --- .../foucry/pilldroid/DrugListActivity.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java index 394a095..687c4b7 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugListActivity.java @@ -36,8 +36,6 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import io.sentry.Sentry; - import static net.foucry.pilldroid.UtilDate.date2String; import static net.foucry.pilldroid.Utils.intRandomExclusive; @@ -377,9 +375,31 @@ public class DrugListActivity extends AppCompatActivity { Intent intent = new Intent(context, DrugDetailActivity.class); intent.putExtra("drug", aDrug); startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo deprecated + //openActivityForResult(intent); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); } + /* void openActivityForResult(Intent intent) { + // Intent intent = new Intent(this,DrugDetailActivity.class); + DrugDetailActivityLaucher.launch(intent); + } + + ActivityResultLauncher DrugDetailActivityLaucher = registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), + new ActivityResultCallback() { + @Override + public void onActivityResult(ActivityResult result) { + if (result.getResultCode() == Activity.RESULT_OK) { + // Here, no request code + try { + result.getData(); + Intent data = result.getData(); + Log.d(TAG, "Result data = " +data.getDataString()); + } + catch (Exception ignored){}; + } + } + });*/ /** * setupRecyclerView (list of drugs * @param recyclerView RecyclerView @@ -474,6 +494,7 @@ public class DrugListActivity extends AppCompatActivity { Intent intent = new Intent(context, DrugDetailActivity.class); intent.putExtra("drug", drugCourant); startActivityForResult(intent, CUSTOMIZED_REQUEST_CODE); // todo: deprecated + //openActivityForResult(intent); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); } });