diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..b366460 Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..006b18b --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.sultan.plantdatabse", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0.beta", + "outputFile": "app-release.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/app/src/main/assets/error_404.html b/app/src/main/assets/error_404.html new file mode 100644 index 0000000..022a438 --- /dev/null +++ b/app/src/main/assets/error_404.html @@ -0,0 +1,13 @@ + + + + + + + 404 - Not Found + + +

404 - Not Found

+

The requested page could not be found. Please check the URL and try again.

+ + diff --git a/app/src/main/assets/error_generic.html b/app/src/main/assets/error_generic.html new file mode 100644 index 0000000..88b100c --- /dev/null +++ b/app/src/main/assets/error_generic.html @@ -0,0 +1,13 @@ + + + + + + + Error + + +

Error

+

Sorry, an error occurred while processing your request. Please try again later.

+ + diff --git a/app/src/main/assets/network_error.html b/app/src/main/assets/network_error.html new file mode 100644 index 0000000..473b7c2 --- /dev/null +++ b/app/src/main/assets/network_error.html @@ -0,0 +1,13 @@ + + + + + + + Network Error + + +

Network Error

+

Sorry, there is an issue with your network connection. Please check your internet connection and try again.

+ + diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000..ac22132 Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/sultan/plantdatabse/WebViewActivity.java b/app/src/main/java/com/sultan/plantdatabse/WebViewActivity.java index 909e9af..eeb4a8d 100644 --- a/app/src/main/java/com/sultan/plantdatabse/WebViewActivity.java +++ b/app/src/main/java/com/sultan/plantdatabse/WebViewActivity.java @@ -22,10 +22,8 @@ import com.google.zxing.integration.android.IntentResult; public class WebViewActivity extends AppCompatActivity implements View.OnClickListener { - // private ProgressBar progressBar; private LottieAnimationView lottieAnimationView; - Button scanAgainButton; - Button btnHome; + private WebView webView; @SuppressLint("SetJavaScriptEnabled") @Override @@ -33,48 +31,67 @@ public class WebViewActivity extends AppCompatActivity implements View.OnClickLi super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); - scanAgainButton = findViewById(R.id.scanAgain); - btnHome = findViewById(R.id.btnHome); - // progressBar = findViewById(R.id.progressBar); + Button scanAgainButton = findViewById(R.id.scanAgain); + Button btnHome = findViewById(R.id.btnHome); lottieAnimationView = findViewById(R.id.lottieAnimationView); + webView = findViewById(R.id.webView); // Retrieve the URL from the intent String url = getIntent().getStringExtra("url"); // Load the URL in the WebView - WebView webView = findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); - webView.setWebViewClient(new WebViewClient() { - @Override - public void onPageStarted(WebView view, String url, Bitmap favicon) { - // Show the progress bar when the page starts loading - // progressBar.setVisibility(View.VISIBLE); - // Show the Lottie animation when the page starts loading - lottieAnimationView.setVisibility(View.VISIBLE); - } - @Override - public void onPageFinished(WebView view, String url) { - // Hide the progress bar when the page finishes loading - // progressBar.setVisibility(View.INVISIBLE); - // Hide the Lottie animation when the page finishes loading - lottieAnimationView.setVisibility(View.INVISIBLE); - } - - @Override - public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { - // Handle page load error - Toast.makeText(WebViewActivity.this, "Failed to load the page", Toast.LENGTH_SHORT).show(); - // progressBar.setVisibility(View.INVISIBLE); - lottieAnimationView.setVisibility(View.INVISIBLE); - } - }); - - assert url != null; - webView.loadUrl(url); + webView.setWebViewClient(new CustomWebViewClient()); // Set click listeners scanAgainButton.setOnClickListener(this); btnHome.setOnClickListener(this); + + // Load the URL in the WebView + if (url != null) { + webView.loadUrl(url); + } else { + // Handle invalid URL + Toast.makeText(this, "Invalid URL", Toast.LENGTH_SHORT).show(); + finish(); + } + } + + private class CustomWebViewClient extends WebViewClient { + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + // Show the Lottie animation when the page starts loading + lottieAnimationView.setVisibility(View.VISIBLE); + } + + @Override + public void onPageFinished(WebView view, String url) { + // Hide the Lottie animation when the page finishes loading + lottieAnimationView.setVisibility(View.INVISIBLE); + } + + @Override + public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { + super.onReceivedError(view, request, error); + // Handle different types of errors + if (error.getErrorCode() == -2) { + // Network error (no internet connection) + showCustomErrorPage("file:///android_asset/network_error.html"); + } else if (error.getErrorCode() == 404) { + // 404 error (page not found) + showCustomErrorPage("file:///android_asset/error_404.html"); + } else { + // Other errors + showCustomErrorPage("file:///android_asset/error_generic.html"); + } + } + + private void showCustomErrorPage(String errorPageUrl) { + // Load the custom error page in the WebView + webView.loadUrl(errorPageUrl); + // Hide the Lottie animation + lottieAnimationView.setVisibility(View.INVISIBLE); + } } @Override diff --git a/app/src/main/res/drawable/bh_logo.png b/app/src/main/res/drawable/bh_logo.png new file mode 100644 index 0000000..7641841 Binary files /dev/null and b/app/src/main/res/drawable/bh_logo.png differ diff --git a/app/src/main/res/drawable/logo_a.png b/app/src/main/res/drawable/logo_a.png new file mode 100644 index 0000000..f113c2b Binary files /dev/null and b/app/src/main/res/drawable/logo_a.png differ diff --git a/app/src/main/res/drawable/logo_c_c.png b/app/src/main/res/drawable/logo_c_c.png new file mode 100644 index 0000000..104e911 Binary files /dev/null and b/app/src/main/res/drawable/logo_c_c.png differ diff --git a/app/src/main/res/drawable/logo_e.png b/app/src/main/res/drawable/logo_e.png new file mode 100644 index 0000000..4e08241 Binary files /dev/null and b/app/src/main/res/drawable/logo_e.png differ diff --git a/app/src/main/res/drawable/plant_logo.png b/app/src/main/res/drawable/plant_logo.png new file mode 100644 index 0000000..3ba47cc Binary files /dev/null and b/app/src/main/res/drawable/plant_logo.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3d0adf2..f1b9c4e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -8,6 +8,19 @@ android:background="@drawable/app_background_14" tools:context=".MainActivity"> + + + + @@ -39,8 +52,59 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:layout_margin="10dp" + android:layout_marginTop="-120dp" android:backgroundTint="#0F9D58" android:text="Scan QR Code" /> + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 6f3b755..036d09b 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,6 +1,5 @@ - - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 6f3b755..036d09b 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,6 +1,5 @@ - - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp index c209e78..71425f4 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..8e612fa Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp index b2dfe3d..aa7c033 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp index 4f0f1d6..00f1cde 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..d9564d9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp index 62b611d..c711c44 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp index 948a307..ad248e8 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..c2505ed Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp index 1b9a695..6735d0f 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp index 28d4b77..fd750a6 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..ac2aaa0 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp index 9287f50..118dc49 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp index aa7d642..f36d7ff 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp new file mode 100644 index 0000000..3151ff0 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp index 9126ae3..3fb91f9 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..79e72b2 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #E5E5E5 + \ No newline at end of file