Rca/fix UI #15

Merged
r-ca merged 30 commits from rca/fix_ui into main 2024-01-17 10:27:28 +00:00
Showing only changes of commit c09ba30fa1 - Show all commits

View File

@ -80,17 +80,18 @@ public class MainActivity extends AppCompatActivity {
private final ActivityResultLauncher<ScanOptions> 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);
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 {
//URLの表示
Toast.makeText(this, contents, Toast.LENGTH_SHORT).show();
//ブラウザを起動しURL先のサイトを開く
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, uri);
}
} else {
Log.d("QRFragment", "onActivityResult: null");
customTabsIntent.launchUrl(this, Uri.parse(contents));
}
}
);