Improved design.
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>404 - Not Found</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>404 - Not Found</h1>
|
||||||
|
<p>The requested page could not be found. Please check the URL and try again.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Error</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Error</h1>
|
||||||
|
<p>Sorry, an error occurred while processing your request. Please try again later.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Network Error</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Network Error</h1>
|
||||||
|
<p>Sorry, there is an issue with your network connection. Please check your internet connection and try again.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 54 KiB |
|
|
@ -22,10 +22,8 @@ import com.google.zxing.integration.android.IntentResult;
|
||||||
|
|
||||||
public class WebViewActivity extends AppCompatActivity implements View.OnClickListener {
|
public class WebViewActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
|
||||||
// private ProgressBar progressBar;
|
|
||||||
private LottieAnimationView lottieAnimationView;
|
private LottieAnimationView lottieAnimationView;
|
||||||
Button scanAgainButton;
|
private WebView webView;
|
||||||
Button btnHome;
|
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -33,48 +31,67 @@ public class WebViewActivity extends AppCompatActivity implements View.OnClickLi
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_webview);
|
setContentView(R.layout.activity_webview);
|
||||||
|
|
||||||
scanAgainButton = findViewById(R.id.scanAgain);
|
Button scanAgainButton = findViewById(R.id.scanAgain);
|
||||||
btnHome = findViewById(R.id.btnHome);
|
Button btnHome = findViewById(R.id.btnHome);
|
||||||
// progressBar = findViewById(R.id.progressBar);
|
|
||||||
lottieAnimationView = findViewById(R.id.lottieAnimationView);
|
lottieAnimationView = findViewById(R.id.lottieAnimationView);
|
||||||
|
webView = findViewById(R.id.webView);
|
||||||
|
|
||||||
// Retrieve the URL from the intent
|
// Retrieve the URL from the intent
|
||||||
String url = getIntent().getStringExtra("url");
|
String url = getIntent().getStringExtra("url");
|
||||||
|
|
||||||
// Load the URL in the WebView
|
// Load the URL in the WebView
|
||||||
WebView webView = findViewById(R.id.webView);
|
|
||||||
webView.getSettings().setJavaScriptEnabled(true);
|
webView.getSettings().setJavaScriptEnabled(true);
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new CustomWebViewClient());
|
||||||
@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);
|
|
||||||
|
|
||||||
// Set click listeners
|
// Set click listeners
|
||||||
scanAgainButton.setOnClickListener(this);
|
scanAgainButton.setOnClickListener(this);
|
||||||
btnHome.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
|
@Override
|
||||||
|
|
|
||||||
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
|
@ -8,6 +8,19 @@
|
||||||
android:background="@drawable/app_background_14"
|
android:background="@drawable/app_background_14"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:src="@drawable/bh_logo"
|
||||||
|
android:layout_margin="10dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_marginTop="-125dp"
|
||||||
|
android:src="@drawable/plant_logo" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textContent"
|
android:id="@+id/textContent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
@ -27,10 +40,10 @@
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:lottie_autoPlay="true"
|
app:lottie_autoPlay="true"
|
||||||
android:layout_marginTop="90dp"
|
android:layout_marginTop="-150dp"
|
||||||
app:lottie_loop="true"
|
app:lottie_loop="true"
|
||||||
app:lottie_rawRes="@raw/qr_scan_big_2" />
|
app:lottie_rawRes="@raw/qr_scan_big_2" />
|
||||||
|
|
||||||
|
|
@ -39,8 +52,59 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="10dp"
|
android:layout_marginTop="-120dp"
|
||||||
android:backgroundTint="#0F9D58"
|
android:backgroundTint="#0F9D58"
|
||||||
android:text="Scan QR Code" />
|
android:text="Scan QR Code" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="#F44336"
|
||||||
|
android:text="v1.0.25"
|
||||||
|
android:textSize="12sp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="#F44336"
|
||||||
|
android:text="Plant Database"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textStyle="normal"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:text="The Database is managed by \nAlumni Association of \nBotany Department \nBH College, Howly"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textStyle="italic"
|
||||||
|
android:textColor="#090200"
|
||||||
|
android:text="Developed by:\n Sultan Mustafijul Hoque \nEmail: support@niutech.in"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="144dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="© All Rights Reserved!"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#E91E63"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 13 KiB |
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#E5E5E5</color>
|
||||||
|
</resources>
|
||||||