Skip to content

Commit bb51009

Browse files
committed
feat: add bottom navigation bar with home button and update theme colors
1 parent f72543f commit bb51009

File tree

7 files changed

+143
-36
lines changed

7 files changed

+143
-36
lines changed

android/PDFConverter/app/src/main/java/com/profullstack/pdfconverter/MainActivity.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import android.webkit.WebResourceError
88
import android.webkit.WebResourceRequest
99
import android.webkit.WebView
1010
import android.webkit.WebViewClient
11+
import android.widget.TextView
1112
import android.widget.Toast
1213
import androidx.annotation.RequiresApi
1314
import androidx.appcompat.app.AppCompatActivity
@@ -112,6 +113,20 @@ class MainActivity : AppCompatActivity() {
112113
// Load the PWA
113114
Log.d("PDFConverter", "Loading PWA URL: $pwaUrl")
114115
webView.loadUrl(pwaUrl)
116+
117+
// Set up bottom navigation
118+
setupBottomNavigation()
119+
}
120+
121+
/**
122+
* Set up the bottom navigation bar
123+
*/
124+
private fun setupBottomNavigation() {
125+
val homeButton = findViewById<TextView>(R.id.homeButton)
126+
homeButton.setOnClickListener {
127+
// Navigate to home page
128+
webView.loadUrl(pwaUrl)
129+
}
115130
}
116131

117132
// Handle back button to navigate within WebView history
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<FrameLayout
2+
<RelativeLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
xmlns:tools="http://schemas.android.com/tools"
@@ -10,6 +10,14 @@
1010
<WebView
1111
android:id="@+id/webView"
1212
android:layout_width="match_parent"
13-
android:layout_height="match_parent" />
13+
android:layout_height="match_parent"
14+
android:layout_above="@+id/bottomNavBar" />
1415

15-
</FrameLayout>
16+
<include
17+
android:id="@+id/bottomNavBar"
18+
layout="@layout/bottom_nav_bar"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:layout_alignParentBottom="true" />
22+
23+
</RelativeLayout>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="56dp"
5+
android:orientation="horizontal"
6+
android:gravity="center"
7+
android:background="@color/primary">
8+
9+
<TextView
10+
android:id="@+id/homeButton"
11+
android:layout_width="wrap_content"
12+
android:layout_height="match_parent"
13+
android:text="Home"
14+
android:textColor="@color/text_on_primary"
15+
android:textSize="16sp"
16+
android:gravity="center"
17+
android:padding="16dp"
18+
android:clickable="true"
19+
android:focusable="true"
20+
android:background="?attr/selectableItemBackground" />
21+
22+
</LinearLayout>
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
<resources xmlns:tools="http://schemas.android.com/tools">
2-
<!-- Base application theme. -->
3-
<style name="Theme.PDFConverter" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4-
<!-- Primary brand color. -->
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Dark theme -->
4+
<style name="Theme.PDFConverter" parent="Theme.AppCompat.DayNight.NoActionBar">
5+
<!-- Primary brand color -->
56
<item name="colorPrimary">@color/purple_200</item>
6-
<item name="colorPrimaryVariant">@color/purple_700</item>
7-
<item name="colorOnPrimary">@color/black</item>
8-
<!-- Secondary brand color. -->
9-
<item name="colorSecondary">@color/teal_200</item>
10-
<item name="colorSecondaryVariant">@color/teal_200</item>
11-
<item name="colorOnSecondary">@color/black</item>
12-
<!-- Status bar color. -->
13-
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
14-
<!-- Customize your theme here. -->
7+
<item name="colorPrimaryDark">@color/purple_700</item>
8+
<item name="colorAccent">@color/teal_200</item>
9+
10+
<!-- Background colors -->
11+
<item name="android:windowBackground">@color/black</item>
12+
13+
<!-- Text colors -->
14+
<item name="android:textColorPrimary">@color/white</item>
15+
<item name="android:textColorSecondary">@color/text_secondary</item>
16+
17+
<!-- No action bar -->
18+
<item name="windowActionBar">false</item>
19+
<item name="windowNoTitle">true</item>
1520
</style>
1621
</resources>
Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="purple_200">#FFBB86FC</color>
4-
<color name="purple_500">#FF6200EE</color>
5-
<color name="purple_700">#FF3700B3</color>
6-
<color name="teal_200">#FF03DAC5</color>
7-
<color name="teal_700">#FF018786</color>
8-
<color name="black">#FF000000</color>
9-
<color name="white">#FFFFFFFF</color>
3+
<!-- Default Android colors (required by the system) -->
4+
<color name="purple_200">#e54d5d</color>
5+
<color name="purple_500">#e02337</color>
6+
<color name="purple_700">#c01d2f</color>
7+
<color name="teal_200">#fd9c6a</color>
8+
<color name="teal_700">#e66a2c</color>
9+
<color name="black">#111827</color>
10+
<color name="white">#ffffff</color>
11+
12+
<!-- Base colors from theme.css -->
13+
<color name="primary">#e02337</color>
14+
<color name="primary_light">#e54d5d</color>
15+
<color name="primary_dark">#c01d2f</color>
16+
<color name="secondary">#fc7e3e</color>
17+
<color name="secondary_light">#fd9c6a</color>
18+
<color name="secondary_dark">#e66a2c</color>
19+
<color name="accent">#ba18aa</color>
20+
21+
<!-- Neutral colors -->
22+
<color name="background">#ffffff</color>
23+
<color name="surface">#f9fafb</color>
24+
<color name="surface_variant">#f3f4f6</color>
25+
<color name="border">#e5e7eb</color>
26+
<color name="divider">#d1d5db</color>
27+
28+
<!-- Text colors -->
29+
<color name="text_primary">#111827</color>
30+
<color name="text_secondary">#4b5563</color>
31+
<color name="text_tertiary">#6b7280</color>
32+
<color name="text_disabled">#9ca3af</color>
33+
<color name="text_on_primary">#ffffff</color>
34+
<color name="text_on_secondary">#ffffff</color>
35+
36+
<!-- Status colors -->
37+
<color name="success">#10b981</color>
38+
<color name="warning">#fc7e3e</color>
39+
<color name="error">#e02337</color>
40+
<color name="info">#ba18aa</color>
1041
</resources>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Base application theme -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5+
<!-- Primary brand color -->
6+
<item name="colorPrimary">@color/purple_500</item>
7+
<item name="colorPrimaryDark">@color/purple_700</item>
8+
<item name="colorAccent">@color/teal_200</item>
9+
10+
<!-- Background colors -->
11+
<item name="android:windowBackground">@color/white</item>
12+
13+
<!-- Text colors -->
14+
<item name="android:textColorPrimary">@color/black</item>
15+
<item name="android:textColorSecondary">@color/text_secondary</item>
16+
17+
<!-- No action bar -->
18+
<item name="windowActionBar">false</item>
19+
<item name="windowNoTitle">true</item>
20+
</style>
21+
</resources>
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
<resources xmlns:tools="http://schemas.android.com/tools">
2-
<!-- Base application theme. -->
3-
<style name="Theme.PDFConverter" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4-
<!-- Primary brand color. -->
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Light theme -->
4+
<style name="Theme.PDFConverter" parent="Theme.AppCompat.Light.NoActionBar">
5+
<!-- Primary brand color -->
56
<item name="colorPrimary">@color/purple_500</item>
6-
<item name="colorPrimaryVariant">@color/purple_700</item>
7-
<item name="colorOnPrimary">@color/white</item>
8-
<!-- Secondary brand color. -->
9-
<item name="colorSecondary">@color/teal_200</item>
10-
<item name="colorSecondaryVariant">@color/teal_700</item>
11-
<item name="colorOnSecondary">@color/black</item>
12-
<!-- Status bar color. -->
13-
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
14-
<!-- Customize your theme here. -->
7+
<item name="colorPrimaryDark">@color/purple_700</item>
8+
<item name="colorAccent">@color/teal_200</item>
9+
10+
<!-- Background colors -->
11+
<item name="android:windowBackground">@color/white</item>
12+
13+
<!-- Text colors -->
14+
<item name="android:textColorPrimary">@color/black</item>
15+
<item name="android:textColorSecondary">@color/text_secondary</item>
16+
17+
<!-- No action bar -->
18+
<item name="windowActionBar">false</item>
19+
<item name="windowNoTitle">true</item>
1520
</style>
1621
</resources>

0 commit comments

Comments
 (0)