Skip to content

Commit fc71939

Browse files
committed
dependencies update
add support screen moved status bar color controller to a separate file as a composable fixed test cases settings screen redesign add bymac card to settings screen
1 parent 12c4ef3 commit fc71939

20 files changed

Lines changed: 489 additions & 160 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,51 @@
1515

1616
<!-- Feature declaration for Bluetooth -->
1717
<uses-feature
18-
android:name="android.hardware.bluetooth"
19-
android:required="true" />
18+
android:name="android.hardware.bluetooth"
19+
android:required="true" />
2020

2121
<application
22-
android:allowBackup="true"
23-
android:icon="@mipmap/ic_launcher"
24-
android:label="@string/app_name"
25-
android:roundIcon="@mipmap/ic_launcher_round"
26-
android:supportsRtl="true"
27-
android:theme="@style/Theme.ClipSync">
22+
android:allowBackup="true"
23+
android:icon="@mipmap/ic_launcher"
24+
android:label="@string/app_name"
25+
android:roundIcon="@mipmap/ic_launcher_round"
26+
android:supportsRtl="true"
27+
android:theme="@style/Theme.ClipSync">
2828

2929
<activity
30-
android:name=".activities.MainActivity"
31-
android:exported="true">
30+
android:name=".activities.MainActivity"
31+
android:exported="true">
3232
<intent-filter>
3333
<action android:name="android.intent.action.MAIN" />
3434
<category android:name="android.intent.category.LAUNCHER" />
3535
</intent-filter>
3636
</activity>
3737

3838
<activity
39-
android:name=".activities.ShareClipboardActivity"
40-
android:exported="false"
41-
android:taskAffinity=""
42-
android:theme="@style/Theme.Transparent" />
39+
android:name=".activities.ShareClipboardActivity"
40+
android:exported="false"
41+
android:taskAffinity=""
42+
android:theme="@style/Theme.Transparent" />
4343

4444
<service
45-
android:name=".bluetooth.BluetoothService"
46-
android:enabled="true"
47-
android:exported="false"
48-
android:foregroundServiceType="dataSync" />
45+
android:name=".bluetooth.BluetoothService"
46+
android:enabled="true"
47+
android:exported="false"
48+
android:foregroundServiceType="dataSync" />
4949

5050
<provider
51-
android:name="androidx.core.content.FileProvider"
52-
android:authorities="${applicationId}.fileProvider"
53-
android:exported="false"
54-
android:grantUriPermissions="true">
51+
android:name="androidx.core.content.FileProvider"
52+
android:authorities="${applicationId}.fileProvider"
53+
android:exported="false"
54+
android:grantUriPermissions="true">
5555
<meta-data
56-
android:name="android.support.FILE_PROVIDER_PATHS"
57-
android:resource="@xml/file_paths" />
56+
android:name="android.support.FILE_PROVIDER_PATHS"
57+
android:resource="@xml/file_paths" />
5858
</provider>
5959

6060
<receiver
61-
android:name=".notification.NotificationReceiver"
62-
android:exported="false" />
61+
android:name=".notification.NotificationReceiver"
62+
android:exported="false" />
6363
</application>
6464

6565
</manifest>

app/src/main/java/com/aubynsamuel/clipsync/core/ObjectsStore.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ object Essentials {
3535
val isServiceBound: Boolean
3636
get() = _isServiceBound
3737

38+
39+
/**
40+
* Observable state indicating if the service is currently bound and active
41+
*/
42+
val bluetoothService: BluetoothService?
43+
get() = _bluetoothService
44+
3845
/**
3946
* Currently selected device addresses for clipboard sharing
4047
*/
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package com.aubynsamuel.clipsync.ui.component
2+
3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Arrangement
5+
import androidx.compose.foundation.layout.Column
6+
import androidx.compose.foundation.layout.Row
7+
import androidx.compose.foundation.layout.Spacer
8+
import androidx.compose.foundation.layout.fillMaxWidth
9+
import androidx.compose.foundation.layout.height
10+
import androidx.compose.foundation.layout.padding
11+
import androidx.compose.foundation.layout.width
12+
import androidx.compose.foundation.shape.RoundedCornerShape
13+
import androidx.compose.material3.Button
14+
import androidx.compose.material3.ButtonDefaults
15+
import androidx.compose.material3.Icon
16+
import androidx.compose.material3.IconButton
17+
import androidx.compose.material3.IconButtonDefaults
18+
import androidx.compose.material3.MaterialTheme.colorScheme
19+
import androidx.compose.material3.Text
20+
import androidx.compose.runtime.Composable
21+
import androidx.compose.ui.Alignment
22+
import androidx.compose.ui.Modifier
23+
import androidx.compose.ui.platform.LocalUriHandler
24+
import androidx.compose.ui.res.painterResource
25+
import androidx.compose.ui.res.stringResource
26+
import androidx.compose.ui.text.font.FontWeight
27+
import androidx.compose.ui.unit.dp
28+
import androidx.compose.ui.unit.sp
29+
import com.aubynsamuel.clipsync.R
30+
31+
@Composable
32+
fun AppInfoCard() {
33+
val uriHandler = LocalUriHandler.current
34+
35+
val buyMeACoffee = stringResource(R.string.buy_me_a_coffee)
36+
val sourceCodeUrl = stringResource(R.string.sourceCode)
37+
38+
Column(
39+
modifier = Modifier
40+
.fillMaxWidth()
41+
.padding(15.dp)
42+
.background(
43+
colorScheme.primaryContainer,
44+
shape = RoundedCornerShape(30.dp)
45+
)
46+
.padding(15.dp)
47+
) {
48+
Row(
49+
horizontalArrangement = Arrangement.SpaceBetween,
50+
verticalAlignment = Alignment.CenterVertically,
51+
modifier = Modifier.fillMaxWidth()
52+
) {
53+
Column(verticalArrangement = Arrangement.spacedBy((-5).dp)) {
54+
Text(
55+
"ClipSync",
56+
fontWeight = FontWeight.ExtraBold,
57+
fontSize = 18.sp,
58+
color = colorScheme.onPrimaryContainer
59+
)
60+
Text(
61+
"1.0.0",
62+
fontWeight = FontWeight.Bold,
63+
fontSize = 15.sp,
64+
color = colorScheme.onPrimaryContainer
65+
)
66+
}
67+
Row {
68+
IconButton(
69+
{ uriHandler.openUri(sourceCodeUrl) },
70+
colors = IconButtonDefaults.iconButtonColors()
71+
.copy(containerColor = colorScheme.onPrimaryContainer)
72+
) {
73+
Icon(
74+
painter = painterResource(id = R.drawable.ic_github),
75+
contentDescription = "Source Code Url",
76+
tint = colorScheme.onPrimary
77+
)
78+
}
79+
}
80+
}
81+
82+
Spacer(Modifier.height(10.dp))
83+
84+
Button(
85+
onClick = { uriHandler.openUri(buyMeACoffee) },
86+
modifier = Modifier.fillMaxWidth(),
87+
colors = ButtonDefaults.buttonColors()
88+
.copy(
89+
containerColor = colorScheme.onPrimaryContainer,
90+
contentColor = colorScheme.onPrimary
91+
)
92+
) {
93+
Row(verticalAlignment = Alignment.CenterVertically) {
94+
Icon(
95+
painter = painterResource(R.drawable.ic_buymeacoffee),
96+
contentDescription = "Buy me a coffee"
97+
)
98+
Spacer(Modifier.width(5.dp))
99+
Text("Sponsor", fontWeight = FontWeight.Bold, fontSize = 15.sp)
100+
}
101+
}
102+
}
103+
}

app/src/main/java/com/aubynsamuel/clipsync/ui/component/PullToRefreshContainer.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.aubynsamuel.clipsync.ui.component
22

33
import androidx.compose.material3.ExperimentalMaterial3Api
4-
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
54
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
6-
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.LoadingIndicator
5+
import androidx.compose.material3.pulltorefresh.PullToRefreshDefaults.Indicator
76
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState
87
import androidx.compose.runtime.Composable
98
import androidx.compose.runtime.getValue
@@ -16,7 +15,7 @@ import androidx.compose.ui.Modifier
1615
import kotlinx.coroutines.delay
1716
import kotlinx.coroutines.launch
1817

19-
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
18+
@OptIn(ExperimentalMaterial3Api::class)
2019
@Composable
2120
fun CustomPullToRefreshBox(
2221
refreshPairedDevices: () -> Unit,
@@ -34,13 +33,13 @@ fun CustomPullToRefreshBox(
3433
onRefresh = {
3534
isRefreshing = true
3635
scope.launch {
37-
delay(2500)
3836
refreshPairedDevices()
37+
delay(1000)
3938
isRefreshing = false
4039
}
4140
},
4241
indicator = {
43-
LoadingIndicator(
42+
Indicator(
4443
modifier = Modifier
4544
.align(Alignment.TopCenter),
4645
isRefreshing = isRefreshing,

app/src/main/java/com/aubynsamuel/clipsync/ui/component/SettingItem.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.aubynsamuel.clipsync.ui.component
22

3+
import androidx.compose.foundation.clickable
34
import androidx.compose.foundation.layout.Arrangement
45
import androidx.compose.foundation.layout.Column
56
import androidx.compose.foundation.layout.Row
67
import androidx.compose.foundation.layout.fillMaxWidth
8+
import androidx.compose.foundation.layout.padding
79
import androidx.compose.material3.Icon
810
import androidx.compose.material3.Text
911
import androidx.compose.runtime.Composable
@@ -19,22 +21,26 @@ fun SettingItem(
1921
title: String,
2022
subTitle: String,
2123
icon: ImageVector,
22-
actionButton: @Composable (() -> Unit),
24+
actionButton: @Composable (() -> Unit) = {},
25+
pressAction: () -> Unit = {}
2326
) {
2427
Row(
2528
verticalAlignment = Alignment.CenterVertically,
2629
horizontalArrangement = Arrangement.SpaceBetween,
27-
modifier = Modifier.fillMaxWidth()
30+
modifier = Modifier
31+
.fillMaxWidth()
32+
.clickable { pressAction() }
33+
.padding(vertical = 10.dp, horizontal = 16.dp)
2834
) {
2935
Row(
3036
verticalAlignment = Alignment.CenterVertically,
31-
horizontalArrangement = Arrangement.spacedBy(10.dp)
37+
horizontalArrangement = Arrangement.spacedBy(10.dp),
38+
modifier = Modifier.weight(1f)
3239
) {
33-
Icon(imageVector = icon, contentDescription = "")
40+
Icon(imageVector = icon, contentDescription = "settingItemIcon")
3441
Column {
35-
Text(title, fontWeight = FontWeight.SemiBold, fontSize = 17.sp)
42+
Text(title, fontWeight = FontWeight.SemiBold, fontSize = 16.sp)
3643
Text(subTitle, fontSize = 14.sp)
37-
3844
}
3945
}
4046
actionButton()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.aubynsamuel.clipsync.ui.component
2+
3+
import androidx.compose.runtime.Composable
4+
import androidx.compose.runtime.SideEffect
5+
import androidx.compose.ui.graphics.Color
6+
import com.google.accompanist.systemuicontroller.rememberSystemUiController
7+
8+
@Composable
9+
fun StatusBarColor(darkIcons: Boolean) {
10+
val systemUiController = rememberSystemUiController()
11+
12+
SideEffect {
13+
systemUiController.setStatusBarColor(
14+
color = Color.Transparent,
15+
darkIcons = darkIcons
16+
)
17+
}
18+
}

app/src/main/java/com/aubynsamuel/clipsync/ui/navigation/Navigation.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.navigation.compose.composable
77
import androidx.navigation.compose.rememberNavController
88
import com.aubynsamuel.clipsync.ui.screen.MainScreen
99
import com.aubynsamuel.clipsync.ui.screen.SettingsScreen
10+
import com.aubynsamuel.clipsync.ui.screen.SupportScreen
1011
import com.aubynsamuel.clipsync.ui.viewModel.SettingsViewModel
1112

1213
@Composable
@@ -39,5 +40,12 @@ fun Navigation(
3940
settingsViewModel = settingsViewModel,
4041
)
4142
}
43+
44+
composable("SupportScreen") {
45+
SupportScreen(
46+
navController = navController,
47+
settingsViewModel = settingsViewModel,
48+
)
49+
}
4250
}
4351
}

0 commit comments

Comments
 (0)