From 8d54d7cc5569600d0b63fb78484936780b7e8f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 11 Jan 2024 16:52:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?ChromeCustomTabs=E3=82=92=E4=BE=9D=E5=AD=98?= =?UTF-8?q?=E9=96=A2=E4=BF=82=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 5e7e062..6150f78 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,4 +64,6 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation 'com.journeyapps:zxing-android-embedded:4.3.0'//QR用zxingライブラリ + + implementation 'androidx.browser:browser:1.5.0' } \ No newline at end of file -- 2.45.1 From 5af6a41bab51ef09f44c5d858922d624fffe623a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 11 Jan 2024 16:56:51 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=A3=E3=83=B3?= =?UTF-8?q?=E7=B5=90=E6=9E=9C=E3=82=92=E3=83=91=E3=83=BC=E3=82=B9=E3=81=97?= =?UTF-8?q?=E3=81=A6ChromeCustomTabs=E3=81=A7=E9=96=8B=E3=81=8F=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/childguard/QRFragment.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/childguard/QRFragment.java b/app/src/main/java/com/example/childguard/QRFragment.java index 71b0f96..ed63a6a 100644 --- a/app/src/main/java/com/example/childguard/QRFragment.java +++ b/app/src/main/java/com/example/childguard/QRFragment.java @@ -2,10 +2,12 @@ package com.example.childguard; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; +import androidx.browser.customtabs.CustomTabsIntent; import androidx.fragment.app.Fragment; import android.util.Log; @@ -20,6 +22,8 @@ import com.google.zxing.integration.android.IntentResult; import com.journeyapps.barcodescanner.ScanContract; import com.journeyapps.barcodescanner.ScanOptions; +import java.util.Objects; + /** * A simple {@link Fragment} subclass. * Use the {@link QRFragment#newInstance} factory method to @@ -83,8 +87,12 @@ public class QRFragment extends Fragment { // dataPass.onDataPass(result.getContents()); //画面遷移 Toast.makeText(getContext(), result.getContents(), Toast.LENGTH_SHORT).show(); - Intent intent=new Intent(getActivity(),UrlPageActivity.class); - startActivity(intent); +// Intent intent=new Intent(getActivity(),UrlPageActivity.class); +// startActivity(intent); + + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(requireContext(), Uri.parse(result.getContents())); } }); -- 2.45.1