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 {
|
||||
|
||||
// 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() {
|
||||
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 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);
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
assert url != null;
|
||||
webView.loadUrl(url);
|
||||
|
||||
// Set click listeners
|
||||
scanAgainButton.setOnClickListener(this);
|
||||
btnHome.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@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"
|
||||
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
|
||||
android:id="@+id/textContent"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -27,10 +40,10 @@
|
|||
android:visibility="gone"/>
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:lottie_autoPlay="true"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_marginTop="-150dp"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/qr_scan_big_2" />
|
||||
|
||||
|
|
@ -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" />
|
||||
|
||||
<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>
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</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>
|
||||