Skip to content

Commit 3fc3ad7

Browse files
authored
Merge pull request #215 from PatilShreyas/v1.2.0
Release v1.2.0
2 parents c7fc724 + 1eedd6a commit 3fc3ad7

File tree

13 files changed

+70
-38
lines changed

13 files changed

+70
-38
lines changed

docs/pages/changelog.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ You can see [GitHub releases](https://github.com/PatilShreyas/NotyKT/releases) w
44

55
---
66

7+
## _v1.2.0_ (2021-08-29)
8+
9+
This release includes User experience improvements in the Jetpack Compose Application. Minor fixes in Simple app.
10+
11+
### 🔮 What's New?
12+
13+
- [[#209](https://github.com/PatilShreyas/NotyKT/issues/209)] Added connectivity indicator in compose app.
14+
15+
### ✅ Bug Fixes / Improvements
16+
17+
- [[#202](https://github.com/PatilShreyas/NotyKT/issues/202)] Fixed continuous flickering issue after Signup/Login in compose app.
18+
- [[#203](https://github.com/PatilShreyas/NotyKT/issues/203)] Avoided/Fixed re-syncing of notes after configuration changes in compose app.
19+
20+
### 🎯 Codebase Improvements
21+
22+
- [[#201](https://github.com/PatilShreyas/NotyKT/issues/201)] Optimized APK size by enabling R8.
23+
- [[#206](https://github.com/PatilShreyas/NotyKT/issues/206)] Fixed memory leak of `mAdapter` in simple app.
24+
- Set flag `android:exported="true"` for Activity to support Android 12 and above.
25+
- Provide content padding to `LazyColumn` _(to achieve same behavior as `clipToPadding` in RecyclerView)_.
26+
- Cleaned up code.
27+
28+
---
29+
730
## _v1.1.0_ (2021-08-06)
831

932
This release includes User experience improvements in the Jetpack Compose Application. No change in simple app.

noty-android/app/composeapp/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<activity
3333
android:name=".ui.MainActivity"
3434
android:configChanges="keyboard|keyboardHidden|orientation|navigation|screenSize|screenLayout"
35+
android:exported="true"
3536
android:label="@string/app_name"
3637
android:theme="@style/AppTheme.Splash">
3738
<intent-filter>

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/component/NotesList.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616

1717
package dev.shreyaspatil.noty.composeapp.component
1818

19+
import androidx.compose.foundation.layout.PaddingValues
1920
import androidx.compose.foundation.lazy.LazyColumn
2021
import androidx.compose.foundation.lazy.items
2122
import androidx.compose.runtime.Composable
23+
import androidx.compose.ui.unit.dp
2224
import dev.shreyaspatil.noty.core.model.Note
2325

2426
@Composable
2527
fun NotesList(notes: List<Note>, onClick: (Note) -> Unit) {
26-
LazyColumn {
28+
LazyColumn(contentPadding = PaddingValues(vertical = 4.dp)) {
2729
items(
2830
items = notes,
2931
itemContent = { note ->

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/component/action/NotyActions.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun DeleteAction(onClick: () -> Unit) {
3232
painter = icon,
3333
contentDescription = "Delete",
3434
modifier = Modifier
35-
.padding(end = 8.dp)
35+
.padding(8.dp)
3636
.clickable(onClick = onClick)
3737
)
3838
}
@@ -44,7 +44,7 @@ fun ShareAction(onClick: () -> Unit) {
4444
icon,
4545
"share",
4646
Modifier
47-
.padding(end = 8.dp)
47+
.padding(8.dp)
4848
.clickable(onClick = onClick)
4949
)
5050
}
@@ -56,7 +56,7 @@ fun ThemeSwitchAction(onToggle: () -> Unit) {
5656
icon,
5757
"Theme switch",
5858
Modifier
59-
.padding(end = 8.dp)
59+
.padding(8.dp)
6060
.clickable(onClick = onToggle)
6161
)
6262
}
@@ -68,7 +68,7 @@ fun LogoutAction(onLogout: () -> Unit) {
6868
icon,
6969
"Logout",
7070
Modifier
71-
.padding(end = 8.dp)
71+
.padding(8.dp)
7272
.clickable(onClick = onLogout)
7373
)
7474
}
@@ -80,7 +80,7 @@ fun AboutAction(onClick: () -> Unit) {
8080
icon,
8181
"About",
8282
Modifier
83-
.padding(end = 8.dp)
83+
.padding(8.dp)
8484
.clickable(onClick = onClick)
8585
)
8686
}

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/ui/screens/AddNotesScreen.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fun AddNoteScreen(
9797
)
9898
}
9999
},
100-
backgroundColor = MaterialTheme.colors.background,
100+
backgroundColor = MaterialTheme.colors.surface,
101101
contentColor = MaterialTheme.colors.onPrimary,
102102
elevation = 0.dp,
103103
)
@@ -107,13 +107,12 @@ fun AddNoteScreen(
107107
Modifier.scrollable(
108108
rememberScrollState(),
109109
orientation = Orientation.Vertical
110-
)
110+
).padding(16.dp)
111111
) {
112112

113113
NoteTitleField(
114114
modifier = Modifier
115115
.fillMaxWidth()
116-
.padding(16.dp, 0.dp, 16.dp, 0.dp)
117116
.background(MaterialTheme.colors.background),
118117
value = titleText.value,
119118
onTextChange = { titleText.value = it },
@@ -123,7 +122,7 @@ fun AddNoteScreen(
123122
modifier = Modifier
124123
.fillMaxWidth()
125124
.fillMaxHeight()
126-
.padding(16.dp, 8.dp, 16.dp, 0.dp)
125+
.padding(top = 8.dp)
127126
.background(MaterialTheme.colors.background),
128127
value = noteText.value,
129128
onTextChange = { noteText.value = it }

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/ui/screens/NoteDetailsScreen.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fun NoteDetailsScreen(
105105
)
106106
}
107107
},
108-
backgroundColor = MaterialTheme.colors.background,
108+
backgroundColor = MaterialTheme.colors.surface,
109109
contentColor = MaterialTheme.colors.onPrimary,
110110
elevation = 0.dp,
111111
actions = {
@@ -119,12 +119,11 @@ fun NoteDetailsScreen(
119119
Modifier.scrollable(
120120
rememberScrollState(),
121121
orientation = Orientation.Vertical
122-
)
122+
).padding(16.dp)
123123
) {
124124
NoteTitleField(
125125
modifier = Modifier
126126
.fillMaxWidth()
127-
.padding(16.dp, 0.dp, 16.dp, 0.dp)
128127
.background(MaterialTheme.colors.background),
129128
value = titleText,
130129
onTextChange = { titleText = it }
@@ -134,7 +133,7 @@ fun NoteDetailsScreen(
134133
modifier = Modifier
135134
.fillMaxWidth()
136135
.wrapContentHeight()
137-
.padding(16.dp, 8.dp, 16.dp, 0.dp)
136+
.padding(top = 8.dp)
138137
.background(MaterialTheme.colors.background),
139138
value = noteText,
140139
onTextChange = { noteText = it }

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/ui/screens/NotesScreen.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import dev.shreyaspatil.noty.composeapp.component.action.AboutAction
4949
import dev.shreyaspatil.noty.composeapp.component.action.LogoutAction
5050
import dev.shreyaspatil.noty.composeapp.component.action.ThemeSwitchAction
5151
import dev.shreyaspatil.noty.composeapp.component.dialog.FailureDialog
52+
import dev.shreyaspatil.noty.composeapp.navigation.NOTY_NAV_HOST_ROUTE
5253
import dev.shreyaspatil.noty.composeapp.ui.Screen
5354
import dev.shreyaspatil.noty.core.ui.UIDataState
5455
import dev.shreyaspatil.noty.view.viewmodel.NotesViewModel
@@ -61,7 +62,9 @@ import kotlinx.coroutines.launch
6162
@ExperimentalCoroutinesApi
6263
@Composable
6364
fun NotesScreen(navController: NavHostController, viewModel: NotesViewModel) {
64-
if (!viewModel.isUserLoggedIn()) {
65+
val isUserLoggedIn by viewModel.userLoggedInState.collectAsState()
66+
67+
if (!isUserLoggedIn) {
6568
navigateToLogin(navController)
6669
return
6770
}
@@ -81,7 +84,7 @@ fun NotesScreen(navController: NavHostController, viewModel: NotesViewModel) {
8184
modifier = Modifier.fillMaxWidth()
8285
)
8386
},
84-
backgroundColor = MaterialTheme.colors.background,
87+
backgroundColor = MaterialTheme.colors.surface,
8588
contentColor = MaterialTheme.colors.onPrimary,
8689
elevation = 0.dp,
8790
actions = {
@@ -93,10 +96,7 @@ fun NotesScreen(navController: NavHostController, viewModel: NotesViewModel) {
9396
}
9497
LogoutAction(
9598
onLogout = {
96-
scope.launch {
97-
viewModel.clearUserSession()
98-
navigateToLogin(navController)
99-
}
99+
scope.launch { viewModel.clearUserSession() }
100100
}
101101
)
102102
}
@@ -157,6 +157,7 @@ private fun navigateToLogin(navController: NavHostController) {
157157
navController.navigate(
158158
Screen.Login.route,
159159
builder = {
160+
popUpTo(NOTY_NAV_HOST_ROUTE)
160161
launchSingleTop = true
161162
}
162163
)

noty-android/app/composeapp/src/main/java/dev/shreyaspatil/noty/composeapp/ui/screens/SignUpScreen.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import dev.shreyaspatil.noty.composeapp.component.text.ConfirmPasswordTextField
4545
import dev.shreyaspatil.noty.composeapp.component.text.PasswordTextField
4646
import dev.shreyaspatil.noty.composeapp.component.text.TextFieldValue.Valid
4747
import dev.shreyaspatil.noty.composeapp.component.text.UsernameTextField
48-
import dev.shreyaspatil.noty.composeapp.navigation.NOTY_NAV_HOST_ROUTE
4948
import dev.shreyaspatil.noty.composeapp.ui.Screen
5049
import dev.shreyaspatil.noty.composeapp.ui.theme.typography
5150
import dev.shreyaspatil.noty.core.ui.UIDataState
@@ -64,13 +63,10 @@ fun SignUpScreen(
6463
when (viewState) {
6564
is UIDataState.Loading -> LoaderDialog()
6665
is UIDataState.Success -> {
67-
navController.navigate(
68-
route = Screen.Notes.route,
69-
builder = {
70-
launchSingleTop = true
71-
popUpTo(NOTY_NAV_HOST_ROUTE) { inclusive = true }
72-
}
73-
)
66+
navController.navigate(Screen.Notes.route) {
67+
launchSingleTop = true
68+
popUpTo(Screen.SignUp.route) { inclusive = true }
69+
}
7470
}
7571
is UIDataState.Failed -> FailureDialog(viewState.message)
7672
}

noty-android/app/simpleapp/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<activity
3333
android:name=".view.MainActivity"
3434
android:configChanges="keyboard|keyboardHidden|orientation|navigation|screenSize|screenLayout"
35+
android:exported="true"
3536
android:windowSoftInputMode="adjustResize">
3637
<intent-filter>
3738
<action android:name="android.intent.action.MAIN" />

noty-android/app/simpleapp/src/main/java/dev/shreyaspatil/noty/simpleapp/view/notes/NotesFragment.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,13 @@ class NotesFragment : BaseFragment<NotesFragmentBinding, NotesViewModel>() {
159159
}
160160

161161
private fun checkAuthentication() {
162-
if (!viewModel.isUserLoggedIn()) {
163-
logout()
164-
}
162+
viewModel.userLoggedInState
163+
.shareWhileObserved(viewLifecycleOwner.lifecycleScope)
164+
.asLiveData().observe(viewLifecycleOwner) { isLoggedIn ->
165+
if (!isLoggedIn) {
166+
logout()
167+
}
168+
}
165169
}
166170

167171
private fun onNoteClicked(note: Note) {

0 commit comments

Comments
 (0)