From fd25a41a113295844779812524dead100f603fbd Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:18:13 +0200 Subject: [PATCH 1/5] Optimize import --- .../java/net/foucry/pilldroid/DrugDetailFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java index d6152e2..5bce19f 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java @@ -1,16 +1,16 @@ package net.foucry.pilldroid; import android.app.Activity; - -import com.google.android.material.appbar.CollapsingToolbarLayout; import android.os.Bundle; -import androidx.fragment.app.Fragment; - import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; + +import com.google.android.material.appbar.CollapsingToolbarLayout; + /** * A fragment representing a single Drug detail screen. * This fragment is either contained in a {@link DrugListActivity} From 2ce346a276c2d90e7d8f53e041213f6cebf8ddb5 Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:19:31 +0200 Subject: [PATCH 2/5] 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); } }); From 7600596fb7328d370e63fa434b3a6080681e4621 Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:21:34 +0200 Subject: [PATCH 3/5] Downgrade appcompat to 1.2.0 in order to eliministe startActivityForResult depreated issue upgrade other dependencies --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7c02cdb..1250c4b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,14 +59,14 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.13.2' - implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'com.google.android.material:material:1.3.0' + implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.journeyapps:zxing-android-embedded:4.1.0' implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'androidx.core:core:1.5.0' + implementation 'androidx.core:core:1.6.0' // debugImplementation 'com.amitshekhar.android:debug-db:1.0.6' From e50102067a6d414b50c919b02577587c17ebf2bb Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:38:22 +0200 Subject: [PATCH 4/5] Remove duplicate depencie Update build tool version --- app/build.gradle | 1 - build.gradle | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1250c4b..350c60d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,7 +65,6 @@ dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.journeyapps:zxing-android-embedded:4.1.0' - implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.core:core:1.6.0' // debugImplementation 'com.amitshekhar.android:debug-db:1.0.6' diff --git a/build.gradle b/build.gradle index 3675274..2d0aef0 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.1' + classpath 'com.android.tools.build:gradle:4.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 99436ae75eb78bd4ece67c75f205cf7c3edbaddf Mon Sep 17 00:00:00 2001 From: jacques Date: Fri, 9 Jul 2021 11:38:39 +0200 Subject: [PATCH 5/5] fix typo --- app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java index 5bce19f..9466bb8 100644 --- a/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java +++ b/app/src/main/java/net/foucry/pilldroid/DrugDetailFragment.java @@ -70,7 +70,7 @@ public class DrugDetailFragment extends Fragment { // Show the dummy content as text in a TextView. if (drug != null) { - // Find each conponment of rootView + // Find each component of rootView nameView = detailView.findViewById(R.id.name_cell); TextView nameLabel = nameView.findViewById(R.id.label); TextView nameValue = nameView.findViewById(R.id.value);