-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from pranavkonidena/MOB188/Social_Features_Pr…
…ofile MOBILE-188/Features such as recommend,review in profile screen
- Loading branch information
Showing
11 changed files
with
339 additions
and
38 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
app/src/main/java/org/listenbrainz/android/model/SocialUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package org.listenbrainz.android.model | ||
|
||
data class SocialUiState( | ||
val error: ResponseError? = null | ||
val error: ResponseError? = null, | ||
val successMsgId : Int? = null | ||
) |
50 changes: 50 additions & 0 deletions
50
app/src/main/java/org/listenbrainz/android/ui/components/SuccessBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.listenbrainz.android.ui.components | ||
|
||
import android.content.res.Configuration.UI_MODE_NIGHT_YES | ||
import androidx.compose.animation.AnimatedVisibility | ||
import androidx.compose.animation.expandVertically | ||
import androidx.compose.animation.shrinkVertically | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import kotlinx.coroutines.delay | ||
import org.listenbrainz.android.ui.theme.ListenBrainzTheme | ||
import org.listenbrainz.android.R | ||
|
||
@Composable | ||
fun SuccessBar( | ||
resId : Int?, | ||
onMessageShown: () -> Unit, | ||
snackbarState : SnackbarHostState | ||
) { | ||
val context = LocalContext.current; | ||
LaunchedEffect(resId) { | ||
if (resId != null) { | ||
delay(4000) | ||
onMessageShown() | ||
} | ||
} | ||
|
||
AnimatedVisibility( | ||
visible = resId != null, | ||
enter = expandVertically(), | ||
exit = shrinkVertically() | ||
) { | ||
LaunchedEffect(key1 = resId){ | ||
if(resId != null){ | ||
snackbarState.showSnackbar(context.getString(resId)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Preview(uiMode = UI_MODE_NIGHT_YES) | ||
@Composable | ||
private fun SuccessBarPreview() { | ||
ListenBrainzTheme { | ||
SuccessBar(resId = R.string.about_title , onMessageShown = {} , snackbarState = SnackbarHostState()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.