Skip to content

Commit 2e7b6ba

Browse files
committed
ComposeAppBar fixed title text style
renamed navgraph code cleanup - removed unused AddFolderActivity
1 parent 22febb4 commit 2e7b6ba

File tree

23 files changed

+197
-451
lines changed

23 files changed

+197
-451
lines changed

app/src/debug/AndroidManifest.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<application>
6+
<!--
7+
DEBUG ONLY: HomeActivity for testing purposes
8+
This activity will only be included in debug builds
9+
-->
10+
<activity
11+
android:name=".features.main.HomeActivity"
12+
android:exported="true"
13+
android:screenOrientation="portrait">
14+
15+
<!-- Intent filter for sending text or images; accepts SEND action and various data types -->
16+
<intent-filter>
17+
<action android:name="android.intent.action.SEND" />
18+
<category android:name="android.intent.category.DEFAULT" />
19+
<data android:mimeType="*/*" />
20+
</intent-filter>
21+
22+
<intent-filter>
23+
<action android:name="android.intent.action.SEND" />
24+
<category android:name="android.intent.category.DEFAULT" />
25+
26+
<data android:mimeType="application/*" />
27+
<data android:mimeType="audio/*" />
28+
<data android:mimeType="image/*" />
29+
<data android:mimeType="message/*" />
30+
<data android:mimeType="multipart/*" />
31+
<data android:mimeType="text/*" />
32+
<data android:mimeType="video/*" />
33+
</intent-filter>
34+
35+
<intent-filter>
36+
<action android:name="android.intent.action.VIEW" />
37+
<category android:name="android.intent.category.DEFAULT" />
38+
<category android:name="android.intent.category.BROWSABLE" />
39+
<data android:scheme="save+dweb" />
40+
</intent-filter>
41+
</activity>
42+
</application>
43+
44+
</manifest>

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -108,46 +108,6 @@
108108
</intent-filter>
109109
</activity>
110110

111-
<activity
112-
android:name=".features.main.HomeActivity"
113-
android:exported="true"
114-
android:screenOrientation="portrait">
115-
<!-- <intent-filter>-->
116-
<!-- <action android:name="android.intent.action.MAIN" />-->
117-
118-
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
119-
<!-- </intent-filter>-->
120-
121-
<!-- filter for sending text or images; accepts SEND action and audio/photo/video data -->
122-
<intent-filter>
123-
<action android:name="android.intent.action.SEND" />
124-
125-
<category android:name="android.intent.category.DEFAULT" />
126-
127-
<data android:mimeType="*/*" />
128-
</intent-filter>
129-
<intent-filter>
130-
<action android:name="android.intent.action.SEND" />
131-
<category android:name="android.intent.category.DEFAULT" />
132-
133-
<data android:mimeType="application/*" />
134-
<data android:mimeType="audio/*" />
135-
<data android:mimeType="image/*" />
136-
<data android:mimeType="message/*" />
137-
<data android:mimeType="multipart/*" />
138-
<data android:mimeType="text/*" />
139-
<data android:mimeType="video/*" />
140-
</intent-filter>
141-
<intent-filter>
142-
<action android:name="android.intent.action.VIEW" />
143-
144-
<category android:name="android.intent.category.DEFAULT" />
145-
<category android:name="android.intent.category.BROWSABLE" />
146-
147-
<data android:scheme="save+dweb" />
148-
</intent-filter>
149-
</activity>
150-
151111
<activity
152112
android:name=".upload.UploadManagerActivity"
153113
android:exported="false"
@@ -221,17 +181,6 @@
221181
android:taskAffinity=""
222182
android:theme="@style/SaveAppTheme.NoActionBar" />
223183

224-
<!-- <activity-->
225-
<!-- android:name=".features.folders.CreateNewFolderActivity"-->
226-
<!-- android:label="@string/new_folder"-->
227-
<!-- android:taskAffinity=""-->
228-
<!-- android:theme="@style/SaveAppTheme.NoActionBar" />-->
229-
230-
<activity
231-
android:name=".features.folders.AddFolderActivity"
232-
android:taskAffinity=""
233-
android:theme="@style/SaveAppTheme.NoActionBar" />
234-
235184
<activity
236185
android:name=".features.settings.EditFolderActivity"
237186
android:taskAffinity=""

app/src/main/java/net/opendasharchive/openarchive/core/presentation/theme/Preview.kt

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,40 @@ import androidx.compose.material3.Surface
88
import androidx.compose.runtime.Composable
99
import androidx.compose.ui.Alignment
1010
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.platform.LocalContext
1112
import androidx.compose.ui.unit.dp
12-
import net.opendasharchive.openarchive.features.internetarchive.presentation.login.ComposeAppBar
13+
import net.opendasharchive.openarchive.core.di.passcodeModule
14+
import net.opendasharchive.openarchive.features.core.ComposeAppBar
15+
import org.koin.android.ext.koin.androidContext
16+
import org.koin.compose.KoinApplicationPreview
1317

1418
@Composable
1519
fun DefaultScaffoldPreview(
1620
content: @Composable () -> Unit
1721
) {
22+
val context = LocalContext.current
23+
KoinApplicationPreview(
24+
application = {
25+
androidContext(context)
26+
modules(passcodeModule)
27+
}
28+
) {
29+
SaveAppTheme {
1830

19-
SaveAppTheme {
31+
Scaffold(
32+
topBar = {
33+
ComposeAppBar(
34+
title = "Save App"
35+
)
36+
}
37+
) { paddingValues ->
2038

21-
Scaffold(
22-
topBar = {
23-
ComposeAppBar()
24-
}
25-
) { paddingValues ->
26-
27-
Box(
28-
modifier = Modifier.Companion.padding(paddingValues),
29-
contentAlignment = Alignment.Companion.Center
30-
) {
31-
content()
39+
Box(
40+
modifier = Modifier.Companion.padding(paddingValues),
41+
contentAlignment = Alignment.Companion.Center
42+
) {
43+
content()
44+
}
3245
}
3346
}
3447
}
@@ -39,16 +52,23 @@ fun DefaultScaffoldPreview(
3952
fun DefaultEmptyScaffoldPreview(
4053
content: @Composable () -> Unit
4154
) {
55+
val context = LocalContext.current
56+
KoinApplicationPreview(
57+
application = {
58+
androidContext(context)
59+
modules(passcodeModule)
60+
}
61+
) {
62+
SaveAppTheme {
4263

43-
SaveAppTheme {
44-
45-
Scaffold { paddingValues ->
64+
Scaffold { paddingValues ->
4665

47-
Box(
48-
modifier = Modifier.Companion.padding(paddingValues),
49-
contentAlignment = Alignment.Companion.Center
50-
) {
51-
content()
66+
Box(
67+
modifier = Modifier.Companion.padding(paddingValues),
68+
contentAlignment = Alignment.Companion.Center
69+
) {
70+
content()
71+
}
5272
}
5373
}
5474
}
@@ -59,18 +79,26 @@ fun DefaultEmptyScaffoldPreview(
5979
fun DefaultBoxPreview(
6080
content: @Composable () -> Unit
6181
) {
62-
SaveAppTheme {
63-
Surface(
64-
color = MaterialTheme.colorScheme.surface
65-
) {
66-
Box(
67-
modifier = Modifier.padding(12.dp),
68-
contentAlignment = Alignment.Center
82+
val context = LocalContext.current
83+
KoinApplicationPreview(
84+
application = {
85+
androidContext(context)
86+
modules(passcodeModule)
87+
}
88+
) {
89+
SaveAppTheme {
90+
Surface(
91+
color = MaterialTheme.colorScheme.surface
6992
) {
70-
content()
93+
Box(
94+
modifier = Modifier.padding(12.dp),
95+
contentAlignment = Alignment.Center
96+
) {
97+
content()
98+
}
7199
}
72-
}
73100

74101

102+
}
75103
}
76104
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package net.opendasharchive.openarchive.features.core
2+
3+
import androidx.compose.foundation.layout.fillMaxWidth
4+
import androidx.compose.material3.ExperimentalMaterial3Api
5+
import androidx.compose.material3.Icon
6+
import androidx.compose.material3.IconButton
7+
import androidx.compose.material3.MaterialTheme
8+
import androidx.compose.material3.Text
9+
import androidx.compose.material3.TopAppBar
10+
import androidx.compose.material3.TopAppBarDefaults
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.graphics.Color
14+
import androidx.compose.ui.res.painterResource
15+
import androidx.compose.ui.text.style.TextOverflow
16+
import net.opendasharchive.openarchive.R
17+
18+
@OptIn(ExperimentalMaterial3Api::class)
19+
@Composable
20+
fun ComposeAppBar(
21+
title: String = "",
22+
onNavigationAction: () -> Unit = {}
23+
) {
24+
TopAppBar(
25+
modifier = Modifier.fillMaxWidth(),
26+
title = {
27+
Text(
28+
text = title,
29+
style = MaterialTheme.typography.headlineSmall,
30+
maxLines = 1,
31+
overflow = TextOverflow.Ellipsis
32+
)
33+
},
34+
navigationIcon = {
35+
IconButton(onClick = onNavigationAction) {
36+
Icon(
37+
painter = painterResource(R.drawable.ic_arrow_back_ios),
38+
contentDescription = null
39+
)
40+
}
41+
},
42+
colors = TopAppBarDefaults.topAppBarColors(
43+
containerColor = MaterialTheme.colorScheme.tertiary,
44+
navigationIconContentColor = Color.White,
45+
titleContentColor = Color.White,
46+
actionIconContentColor = Color.White
47+
)
48+
)
49+
}

app/src/main/java/net/opendasharchive/openarchive/features/folders/AddFolderActivity.kt

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)