ui block
This commit is contained in:
parent
4dafc261ef
commit
eef34f19f8
app/src/main
java/ru/myitschool/work
domain/profile
ui
res
@ -0,0 +1,18 @@
|
||||
package ru.myitschool.work.domain.profile
|
||||
|
||||
import ru.myitschool.work.domain.auth.GetLoginUseCase
|
||||
import ru.myitschool.work.domain.profile.entities.UserInfoEntity
|
||||
import ru.myitschool.work.domain.profile.repo.UserInfoRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class AdminGetUserInfo @Inject constructor(
|
||||
private val repo: UserInfoRepository,
|
||||
private val getLoginUseCase: GetLoginUseCase,
|
||||
) {
|
||||
suspend operator fun invoke(): Result<UserInfoEntity> {
|
||||
return getLoginUseCase().fold(
|
||||
onSuccess = { basicAuth -> repo.getInfo(basicAuth) },
|
||||
onFailure = { error -> Result.failure(error) }
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package ru.myitschool.work.domain.profile.repo
|
||||
|
||||
import ru.myitschool.work.domain.profile.entities.UserInfoEntity
|
||||
|
||||
interface AdminInfoEntity {
|
||||
suspend fun getInfoUser(basicAuth: String,userName: String) : Result<UserInfoEntity>
|
||||
|
||||
suspend fun changeStateUser(basicAuth: String,userName: String) : Result<Unit>
|
||||
}
|
@ -23,8 +23,6 @@ import ru.myitschool.work.ui.searchuser.SearchUserDestination
|
||||
import ru.myitschool.work.ui.searchuser.SearchUserFragment
|
||||
import ru.myitschool.work.ui.splash.SplashDestination
|
||||
import ru.myitschool.work.ui.splash.SplashFragment
|
||||
import ru.myitschool.work.ui.userInfo.UserInfoDestination
|
||||
import ru.myitschool.work.ui.userInfo.UserInfoFragment
|
||||
|
||||
@AndroidEntryPoint
|
||||
class RootActivity : AppCompatActivity() {
|
||||
|
@ -53,7 +53,7 @@ class SearchUserFragment : Fragment(R.layout.fragment_search_user) {
|
||||
}
|
||||
}
|
||||
is SearchUserViewModel.Action.OpenInfo ->{
|
||||
//TODO отобразить инфу о юзере
|
||||
binding.cardViewUser?.visibility = View.VISIBLE
|
||||
|
||||
}
|
||||
}
|
||||
@ -70,11 +70,11 @@ class SearchUserFragment : Fragment(R.layout.fragment_search_user) {
|
||||
is SearchUserViewModel.State.Error -> {
|
||||
// Set error text
|
||||
binding.error?.text = state.errorText.localizedMessage
|
||||
binding.cardViewUser?.visibility = View.GONE
|
||||
// binding.loading?.visibility = View.GONE
|
||||
}
|
||||
is SearchUserViewModel.State.Loading -> {
|
||||
// Additional logic can be added here if needed
|
||||
// binding.loading?.visibility = View.VISIBLE
|
||||
binding.cardViewUser?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import ru.myitschool.work.R
|
||||
import ru.myitschool.work.ui.login.LoginViewModel.State
|
||||
import ru.myitschool.work.utils.MutablePublishFlow
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -46,9 +47,9 @@ class SearchUserViewModel @Inject constructor(
|
||||
|
||||
fun searchUser(userName: String) {
|
||||
viewModelScope.launch {
|
||||
setLoadingState()
|
||||
_state.update { State.Loading }
|
||||
// Simulating delay for data retrieval
|
||||
kotlinx.coroutines.delay(1000) // Delay for 1 second
|
||||
|
||||
|
||||
// Mock user check
|
||||
val existingUsers = listOf("user1", "user2", "user3") // Mock users
|
||||
|
@ -1,26 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:progressTint="@color/AccentBlue"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <ProgressBar-->
|
||||
<!-- android:id="@+id/loading"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dashboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:orientation="vertical">
|
||||
android:visibility="visible">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton2"
|
||||
style="@style/Theme.UiTemplate.FAB.Gray"
|
||||
@ -30,41 +32,134 @@
|
||||
android:src="@drawable/ic_back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_login"
|
||||
android:padding="35dp"
|
||||
style="@style/Theme.UiTemplate.TextH1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center"
|
||||
android:padding="35dp"
|
||||
android:text="@string/admin_main" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Theme.UiTemplate.Input"
|
||||
android:id="@+id/input_username"
|
||||
style="@style/Theme.UiTemplate.Input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="58dp"
|
||||
android:layout_marginTop="45dp"
|
||||
app:errorEnabled="false"
|
||||
app:layout_constraintWidth_max="400dp"
|
||||
app:layout_constraintWidth_percent="0.8"
|
||||
android:layout_height="58dp">
|
||||
app:layout_constraintWidth_percent="0.8">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/username"
|
||||
style="@style/Theme.UiTemplate.Input.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:hint="@string/admin_input_hint"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/admin_input_hint">
|
||||
</com.google.android.material.textfield.TextInputEditText>
|
||||
android:maxLines="1"></com.google.android.material.textfield.TextInputEditText>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
style="@style/Theme.UiTemplate.Button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Theme.UiTemplate.Button"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/admin_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error"
|
||||
style="@style/Theme.UiTemplate.TextH4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textColor="@color/ErrorRed"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/photo2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_margin="5dp"
|
||||
android:elevation="10dp"
|
||||
app:cardCornerRadius="12dp">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/photo"
|
||||
style="@style/roundedImageView"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:contentDescription="@null"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fullname"
|
||||
style="@style/Theme.UiTemplate.TextH3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/photo2"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/position"
|
||||
style="@style/Theme.UiTemplate.TextH4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="@tools:sample/cities" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastEntry"
|
||||
style="@style/Theme.UiTemplate.TextH4_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/block"
|
||||
style="@style/Theme.UiTemplate.OutlineButton.Error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/admin_block" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- <ProgressBar-->
|
||||
<!-- android:id="@+id/loading"-->
|
||||
@ -69,7 +70,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="58dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/admin_button" />
|
||||
|
||||
<TextView
|
||||
@ -80,5 +81,87 @@
|
||||
android:layout_marginTop="16dp"
|
||||
android:textColor="@color/ErrorRed"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cardViewUser"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/photo2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_margin="5dp"
|
||||
android:elevation="10dp"
|
||||
app:cardCornerRadius="12dp">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/photo"
|
||||
style="@style/roundedImageView"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:contentDescription="@null"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fullname"
|
||||
style="@style/Theme.UiTemplate.TextH3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/photo2"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/position"
|
||||
style="@style/Theme.UiTemplate.TextH4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="@tools:sample/cities" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastEntry"
|
||||
style="@style/Theme.UiTemplate.TextH4_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/block"
|
||||
style="@style/Theme.UiTemplate.OutlineButton.Error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/admin_block" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
@ -4,5 +4,6 @@
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">20dp</item>
|
||||
<item name="cornerRadius">50dp</item>
|
||||
<item name="elevation">0dp</item>
|
||||
</style>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user