From d5965658c4afd0f52cfe3209c5ff46ed01808bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:28:14 +0900 Subject: [PATCH 01/30] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=A2=E3=82=A4?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/drawable/baseline_app_settings_alt_24.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/src/main/res/drawable/baseline_app_settings_alt_24.xml diff --git a/app/src/main/res/drawable/baseline_app_settings_alt_24.xml b/app/src/main/res/drawable/baseline_app_settings_alt_24.xml new file mode 100644 index 0000000..875e221 --- /dev/null +++ b/app/src/main/res/drawable/baseline_app_settings_alt_24.xml @@ -0,0 +1,5 @@ + + + + + From 9332bff6abff5d6c504a90b8802e168981b89bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:29:01 +0900 Subject: [PATCH 02/30] =?UTF-8?q?=E3=83=8A=E3=83=93=E3=82=B2=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AB=E8=A8=AD=E5=AE=9A=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0,=20QR=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/menu/bottom_menu.xml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/menu/bottom_menu.xml b/app/src/main/res/menu/bottom_menu.xml index 118849b..c3e8d9a 100644 --- a/app/src/main/res/menu/bottom_menu.xml +++ b/app/src/main/res/menu/bottom_menu.xml @@ -3,16 +3,13 @@ - + android:title="home"/> + \ No newline at end of file From 7156c1b900d42f98c263f14415f8da3afd9711af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:29:27 +0900 Subject: [PATCH 03/30] =?UTF-8?q?=E3=83=8A=E3=83=93=E3=82=B2=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=8B=E3=82=89QR=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/example/childguard/MainActivity.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index f33c9e3..fa612de 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -86,10 +86,6 @@ public class MainActivity extends AppCompatActivity { .replace(findViewById(R.id.fragmentContainerView).getId(), this.homeFragment) .addToBackStack(null) .commit(); - } else if (v.getItemId() == findViewById(R.id.navigation_QR).getId()) { - getSupportFragmentManager().beginTransaction() - .replace(findViewById(R.id.fragmentContainerView).getId(), QRFragment.newInstance("test", "tset")) - .commit(); } else if (v.getItemId() == findViewById(R.id.navigation_notification).getId()) { getSupportFragmentManager().beginTransaction() .replace(findViewById(R.id.fragmentContainerView).getId(), NotificationFragment.newInstance("test", "test")) From 8dd1745c1f3136816e456d310f157bfe07071a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:53:54 +0900 Subject: [PATCH 04/30] =?UTF-8?q?Fab=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_main.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 80425d1..90b2a97 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -36,5 +36,14 @@ app:layout_constraintRight_toRightOf="parent" app:menu="@menu/bottom_menu" /> + \ No newline at end of file From ae7af9d01a66874065f74846e7edc036d2bf31ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:54:02 +0900 Subject: [PATCH 05/30] =?UTF-8?q?=E4=BE=8B=E5=A4=96=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=83=81=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/example/childguard/HomeFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/childguard/HomeFragment.java b/app/src/main/java/com/example/childguard/HomeFragment.java index 499a8b6..732633c 100644 --- a/app/src/main/java/com/example/childguard/HomeFragment.java +++ b/app/src/main/java/com/example/childguard/HomeFragment.java @@ -207,10 +207,13 @@ public class HomeFragment extends Fragment implements OnEventListener{ FrameLayout fl; try { tv = requireView().findViewById(R.id.situation); - fl = getView().findViewById(R.id.situation_bg); + fl = requireView().findViewById(R.id.situation_bg); } catch (NullPointerException e) { Log.d("HomeFragment", "updateUiState: view is null"); return; + } catch (Exception e) { + Log.d("HomeFragment", "updateUiState: unknown error"); + return; } String get_on = "\n乗車状態"; String get_off = "\n降車状態"; From 8bd8900286ece5fca087971cd719d5045b62e8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:54:21 +0900 Subject: [PATCH 06/30] =?UTF-8?q?MainActivity=E4=B8=8A=E3=81=A7QR=E3=83=AA?= =?UTF-8?q?=E3=83=BC=E3=83=80=E3=83=BC=E3=82=92=E5=91=BC=E3=81=B6=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 --- .../com/example/childguard/MainActivity.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index fa612de..a8600be 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -1,7 +1,11 @@ package com.example.childguard; +import static java.security.AccessController.getContext; + +import androidx.activity.result.ActivityResultLauncher; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import androidx.browser.customtabs.CustomTabsIntent; import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @@ -19,6 +23,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.graphics.Color; +import android.net.Uri; import android.os.Bundle; import android.os.Vibrator; @@ -49,6 +54,10 @@ import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.EventListener; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.FirebaseFirestoreException; +import com.google.zxing.integration.android.IntentIntegrator; +import com.google.zxing.integration.android.IntentResult; +import com.journeyapps.barcodescanner.ScanContract; +import com.journeyapps.barcodescanner.ScanOptions; public class MainActivity extends AppCompatActivity { @@ -68,6 +77,24 @@ public class MainActivity extends AppCompatActivity { return df.format(date); } + private final ActivityResultLauncher QrLauncher = registerForActivityResult( + new ScanContract(), + result -> { + if (result != null) { + String url = result.getContents(); + Log.d("QRFragment", "onActivityResult: " + url); + if (url != null) { + Uri uri = Uri.parse(url); + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(this, uri); + } + } else { + Log.d("QRFragment", "onActivityResult: null"); + } + } + ); + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -94,6 +121,14 @@ public class MainActivity extends AppCompatActivity { return true; }); + findViewById(R.id.fab_scan_qr_code).setOnClickListener(v -> { + Log.d("QRFragment", "onClick: called"); + //QRリーダ起動 + ScanOptions options = new ScanOptions(); + options.setPrompt("QRコードを読み取ってください"); + QrLauncher.launch(options); + }); + //Bluetooth検知機能 IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); From c09ba30fa19b9e382682a4b9a1679eb07f0b87f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:55:05 +0900 Subject: [PATCH 07/30] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/childguard/MainActivity.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index a8600be..6d0c63a 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -80,17 +80,18 @@ public class MainActivity extends AppCompatActivity { private final ActivityResultLauncher QrLauncher = registerForActivityResult( new ScanContract(), result -> { - if (result != null) { - String url = result.getContents(); - Log.d("QRFragment", "onActivityResult: " + url); - if (url != null) { - Uri uri = Uri.parse(url); - CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); - CustomTabsIntent customTabsIntent = builder.build(); - customTabsIntent.launchUrl(this, uri); - } + String contents = result.getContents(); + if (contents == null) { + Toast.makeText(this, "QRコードが読み取れませんでした", Toast.LENGTH_LONG).show(); + } else if (!contents.contains("https://practicefirestore1-8808c.web.app/")) { + Toast.makeText(this, "Chiled Guardに対応するQRコードではありません", Toast.LENGTH_LONG).show(); } else { - Log.d("QRFragment", "onActivityResult: null"); + //URLの表示 + Toast.makeText(this, contents, Toast.LENGTH_SHORT).show(); + //ブラウザを起動し、URL先のサイトを開く + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(this, Uri.parse(contents)); } } ); From 2a8231f544bd1246d19ac5a6ec2e2cf1378f0dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:55:44 +0900 Subject: [PATCH 08/30] =?UTF-8?q?SettingFragment=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/childguard/SettingFragment.java | 64 +++++++++++++++++++ app/src/main/res/layout/fragment_setting.xml | 14 ++++ 2 files changed, 78 insertions(+) create mode 100644 app/src/main/java/com/example/childguard/SettingFragment.java create mode 100644 app/src/main/res/layout/fragment_setting.xml diff --git a/app/src/main/java/com/example/childguard/SettingFragment.java b/app/src/main/java/com/example/childguard/SettingFragment.java new file mode 100644 index 0000000..1ffbc9c --- /dev/null +++ b/app/src/main/java/com/example/childguard/SettingFragment.java @@ -0,0 +1,64 @@ +package com.example.childguard; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link SettingFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class SettingFragment extends Fragment { + + // TODO: Rename parameter arguments, choose names that match + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER + private static final String ARG_PARAM1 = "param1"; + private static final String ARG_PARAM2 = "param2"; + + // TODO: Rename and change types of parameters + private String mParam1; + private String mParam2; + + public SettingFragment() { + // Required empty public constructor + } + + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment SettingFragment. + */ + // TODO: Rename and change types and number of parameters + public static SettingFragment newInstance(String param1, String param2) { + SettingFragment fragment = new SettingFragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mParam1 = getArguments().getString(ARG_PARAM1); + mParam2 = getArguments().getString(ARG_PARAM2); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_setting, container, false); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_setting.xml b/app/src/main/res/layout/fragment_setting.xml new file mode 100644 index 0000000..627400d --- /dev/null +++ b/app/src/main/res/layout/fragment_setting.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file From 495672eddec94a6f812c1dda177d6b6b9adb452a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:56:14 +0900 Subject: [PATCH 09/30] =?UTF-8?q?=E5=BC=95=E6=95=B0=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/childguard/SettingFragment.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/app/src/main/java/com/example/childguard/SettingFragment.java b/app/src/main/java/com/example/childguard/SettingFragment.java index 1ffbc9c..db9b3ad 100644 --- a/app/src/main/java/com/example/childguard/SettingFragment.java +++ b/app/src/main/java/com/example/childguard/SettingFragment.java @@ -14,34 +14,13 @@ import android.view.ViewGroup; * create an instance of this fragment. */ public class SettingFragment extends Fragment { - - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; - - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; - public SettingFragment() { // Required empty public constructor } - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment SettingFragment. - */ - // TODO: Rename and change types and number of parameters - public static SettingFragment newInstance(String param1, String param2) { + public static SettingFragment newInstance() { SettingFragment fragment = new SettingFragment(); Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @@ -49,10 +28,6 @@ public class SettingFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } } @Override From f9804c1569b3eac5d6e4d3511569300755ddce4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Wed, 17 Jan 2024 16:59:59 +0900 Subject: [PATCH 10/30] =?UTF-8?q?UI=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_setting.xml | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/layout/fragment_setting.xml b/app/src/main/res/layout/fragment_setting.xml index 627400d..8281437 100644 --- a/app/src/main/res/layout/fragment_setting.xml +++ b/app/src/main/res/layout/fragment_setting.xml @@ -1,14 +1,21 @@ - + android:orientation="vertical" + tools:context=".SettingFragment" > - - + android:layout_height="wrap_content" + android:text="QRコード印刷" /> - \ No newline at end of file +