-
Notifications
You must be signed in to change notification settings - Fork 0
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 #273 from 6QuizOnTheBlock/and/feat-#244-create_group
And/feat #244 create group
- Loading branch information
Showing
26 changed files
with
609 additions
and
30 deletions.
There are no files selected for viewing
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 @@ | ||
plugins { | ||
alias(libs.plugins.sixkids.android.library) | ||
alias(libs.plugins.sixkids.android.hilt) | ||
} | ||
|
||
android { | ||
|
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
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
33 changes: 33 additions & 0 deletions
33
android/core/bluetooth/src/main/kotlin/com/sixkids/core/bluetooth/di/BluetoothModule.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,33 @@ | ||
package com.sixkids.core.bluetooth.di | ||
|
||
import android.content.Context | ||
import com.sixkids.core.bluetooth.BluetoothScanner | ||
import com.sixkids.core.bluetooth.BluetoothServer | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object BluetoothModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideBluetoothScanner( | ||
@ApplicationContext context: Context | ||
): BluetoothScanner { | ||
return BluetoothScanner(context) | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
fun provideBluetoothServer( | ||
@ApplicationContext context: Context | ||
): BluetoothServer { | ||
return BluetoothServer(context) | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
android/core/designsystem/src/main/res/drawable/ic_close_filled.xml
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,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="960" | ||
android:viewportHeight="960"> | ||
<path | ||
android:pathData="m336,680 l144,-144 144,144 56,-56 -144,-144 144,-144 -56,-56 -144,144 -144,-144 -56,56 144,144 -144,144 56,56ZM480,880q-83,0 -156,-31.5T197,763q-54,-54 -85.5,-127T80,480q0,-83 31.5,-156T197,197q54,-54 127,-85.5T480,80q83,0 156,31.5T763,197q54,54 85.5,127T880,480q0,83 -31.5,156T763,763q-54,54 -127,85.5T480,880Z" | ||
android:fillColor="#8B1A10"/> | ||
</vector> |
6 changes: 6 additions & 0 deletions
6
android/core/model/src/main/java/com/sixkids/model/GroupType.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,6 @@ | ||
package com.sixkids.model | ||
|
||
enum class GroupType { | ||
FREE, | ||
DESIGN | ||
} |
6 changes: 3 additions & 3 deletions
6
android/core/model/src/main/java/com/sixkids/model/MemberSimple.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,7 +1,7 @@ | ||
package com.sixkids.model | ||
|
||
data class MemberSimple( | ||
val id: Long, | ||
val name: String, | ||
val photo: String | ||
val id: Long = 0L, | ||
val name: String = "", | ||
val photo: String = "", | ||
) |
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
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
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
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
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
12 changes: 12 additions & 0 deletions
12
android/domain/src/main/java/com/sixkids/domain/usecase/user/GetMemberSimpleUseCase.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,12 @@ | ||
package com.sixkids.domain.usecase.user | ||
|
||
import com.sixkids.domain.repository.UserRepository | ||
import javax.inject.Inject | ||
|
||
class GetMemberSimpleUseCase @Inject constructor( | ||
private val userRepository: UserRepository | ||
){ | ||
suspend operator fun invoke(id: Long) = runCatching { | ||
userRepository.getMemberSimpleInfo(id) | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ android { | |
|
||
dependencies { | ||
implementation(libs.bundles.paging) | ||
implementation(projects.core.bluetooth) | ||
} |
3 changes: 2 additions & 1 deletion
3
android/feature/student/challenge/src/main/AndroidManifest.xml
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,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> | ||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> | ||
</manifest> |
126 changes: 126 additions & 0 deletions
126
...ure/student/challenge/src/main/kotlin/com/sixkids/student/group/component/GroupWaiting.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,126 @@ | ||
package com.sixkids.student.group.component | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyRow | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.sixkids.designsystem.component.button.UlbanFilledButton | ||
import com.sixkids.designsystem.theme.Cream | ||
import com.sixkids.designsystem.theme.UlbanTypography | ||
import com.sixkids.model.MemberSimple | ||
import com.sixkids.student.challenge.R | ||
|
||
@Composable | ||
fun GroupWaiting( | ||
leader: MemberSimple = MemberSimple(), | ||
memberList: List<MemberIconItem> = emptyList(), | ||
onDoneClick: () -> Unit = {}, | ||
onRemoveClick: (Long) -> Unit = {}, | ||
groupSize: Int = 0 | ||
) { | ||
Card( | ||
modifier = Modifier | ||
.padding(top = 16.dp) | ||
.fillMaxWidth(), | ||
shape = RoundedCornerShape( | ||
topStart = 12.dp, | ||
topEnd = 12.dp, | ||
bottomStart = 0.dp, | ||
bottomEnd = 0.dp | ||
), | ||
elevation = CardDefaults.cardElevation(16.dp), | ||
colors = CardDefaults.cardColors( | ||
containerColor = Cream | ||
) | ||
) { | ||
val remainingMember = groupSize - memberList.size - 1 | ||
Column( | ||
modifier = Modifier.padding(16.dp), | ||
verticalArrangement = Arrangement.spacedBy(16.dp) | ||
) { | ||
Text( | ||
modifier = Modifier.padding(top = 16.dp), | ||
text = if(remainingMember != 0) { | ||
stringResource(R.string.friend_waiting_message, remainingMember) | ||
} else { | ||
stringResource(R.string.can_create_group) | ||
}, | ||
style = UlbanTypography.bodyMedium | ||
) | ||
LazyRow( | ||
horizontalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
if(leader.id != 0L) { | ||
item { | ||
MemberIcon( | ||
member = leader, | ||
showX = false, | ||
isActive = true, | ||
onRemoveClick = {} | ||
) | ||
} | ||
} | ||
items(memberList) { item -> | ||
MemberIcon( | ||
member = MemberSimple( | ||
id = item.memberId, | ||
name = item.name, | ||
photo = item.photo | ||
), | ||
showX = item.showX, | ||
isActive = item.isActive, | ||
onRemoveClick = onRemoveClick | ||
) | ||
} | ||
} | ||
UlbanFilledButton( | ||
modifier = Modifier.fillMaxWidth(), | ||
text = stringResource(R.string.done), | ||
onClick = onDoneClick, | ||
enabled = remainingMember == 0 | ||
) | ||
} | ||
} | ||
} | ||
|
||
data class MemberIconItem( | ||
val memberId: Long, | ||
val name: String, | ||
val photo: String, | ||
val showX: Boolean = false, | ||
val isActive: Boolean = false | ||
) | ||
|
||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun GroupWaitingPreview() { | ||
GroupWaiting( | ||
leader = MemberSimple( | ||
id = 1, | ||
name = "leader", | ||
photo = "" | ||
), | ||
memberList = List(4) { | ||
MemberIconItem( | ||
memberId = it.toLong(), | ||
name = "name$it", | ||
photo = "", | ||
showX = false, | ||
isActive = it % 2 == 0 | ||
) | ||
}, | ||
groupSize = 5 | ||
) | ||
} |
Oops, something went wrong.