retoques en diseño de perfil
This commit is contained in:
parent
f6c6d103f6
commit
df008ea7fd
@ -33,6 +33,8 @@ import com.isolaatti.common.options_bottom_sheet.presentation.BottomSheetPostOpt
|
||||
import com.isolaatti.common.options_bottom_sheet.ui.BottomSheetPostOptionsFragment
|
||||
import com.isolaatti.databinding.FragmentDiscussionsBinding
|
||||
import com.isolaatti.followers.domain.FollowingState
|
||||
import com.isolaatti.images.image_chooser.ui.ImageChooserActivity
|
||||
import com.isolaatti.images.image_chooser.ui.ImageChooserContract
|
||||
import com.isolaatti.images.image_list.ui.ImagesFragment
|
||||
import com.isolaatti.posting.comments.ui.BottomSheetPostComments
|
||||
import com.isolaatti.posting.posts.domain.entity.Post
|
||||
@ -82,6 +84,10 @@ class ProfileMainFragment : Fragment() {
|
||||
viewModel.onPostAddedAtTheBeginning(it)
|
||||
}
|
||||
|
||||
private val chooseImageLauncher = registerForActivityResult(ImageChooserContract()) {
|
||||
// here change profile picture
|
||||
}
|
||||
|
||||
private val editDiscussion = registerForActivityResult(EditPostContract()) {
|
||||
if(it != null) {
|
||||
viewModel.onPostUpdate(it)
|
||||
@ -179,7 +185,9 @@ class ProfileMainFragment : Fragment() {
|
||||
Options.PROFILE_PHOTO_OPTIONS -> {
|
||||
val profile = optionClicked.payload as? UserProfile
|
||||
when(optionClicked.optionId) {
|
||||
Options.Option.OPTION_PROFILE_PHOTO_CHANGE_PHOTO -> {}
|
||||
Options.Option.OPTION_PROFILE_PHOTO_CHANGE_PHOTO -> {
|
||||
chooseImageLauncher.launch(ImageChooserContract.Requester.UserPost)
|
||||
}
|
||||
Options.Option.OPTION_PROFILE_PHOTO_REMOVE_PHOTO -> {}
|
||||
Options.Option.OPTION_PROFILE_PHOTO_VIEW_PHOTO -> {
|
||||
val profilePictureUrl = profile?.profilePictureUrl
|
||||
@ -245,27 +253,17 @@ class ProfileMainFragment : Fragment() {
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
viewBinding.bottomAppBar.setOnMenuItemClickListener {
|
||||
when(it.itemId) {
|
||||
R.id.audios_menu_item -> {
|
||||
findNavController().navigate(ProfileMainFragmentDirections.actionDiscussionsFragmentToAudiosFragment(AudiosFragment.SOURCE_PROFILE, userId.toString()))
|
||||
true
|
||||
}
|
||||
R.id.images_menu_item -> {
|
||||
if(userId != null) {
|
||||
findNavController().navigate(
|
||||
ProfileMainFragmentDirections.actionDiscussionsFragmentToImagesFragment(ImagesFragment.SOURCE_PROFILE, userId.toString())
|
||||
)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
else -> { false }
|
||||
}
|
||||
viewBinding.audiosButton.setOnClickListener {
|
||||
findNavController().navigate(ProfileMainFragmentDirections.actionDiscussionsFragmentToAudiosFragment(AudiosFragment.SOURCE_PROFILE, userId.toString()))
|
||||
}
|
||||
|
||||
viewBinding.newPost.setOnClickListener {
|
||||
viewBinding.imagesButton.setOnClickListener {
|
||||
findNavController().navigate(
|
||||
ProfileMainFragmentDirections.actionDiscussionsFragmentToImagesFragment(ImagesFragment.SOURCE_PROFILE, userId.toString())
|
||||
)
|
||||
}
|
||||
|
||||
viewBinding.createPostButton.setOnClickListener {
|
||||
createDiscussion.launch(Unit)
|
||||
}
|
||||
|
||||
@ -333,7 +331,7 @@ class ProfileMainFragment : Fragment() {
|
||||
if(isOwnProfile) {
|
||||
viewBinding.followButton.visibility = View.GONE
|
||||
} else {
|
||||
viewBinding.newPost.visibility = View.GONE
|
||||
viewBinding.createPostButton.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -146,6 +146,45 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/go_to_followers_btn" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/profile_actions_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/follow_button"
|
||||
android:layout_marginHorizontal="16dp">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/create_post_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Material3.Button.IconButton.Filled"
|
||||
android:text="@string/new_post"
|
||||
app:icon="@drawable/baseline_post_add_24"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/images_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/images"
|
||||
app:icon="@drawable/baseline_image_24"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/audios_button"
|
||||
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/audios"
|
||||
app:icon="@drawable/baseline_audio_file_24" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
@ -178,19 +217,4 @@
|
||||
app:layout_anchor="@id/swipe_to_refresh"
|
||||
app:layout_anchorGravity="bottom"/>
|
||||
|
||||
<com.google.android.material.bottomappbar.BottomAppBar
|
||||
android:id="@+id/bottomAppBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="bottom"
|
||||
app:menu="@menu/profile_bottom_bar_menu"
|
||||
style="@style/Widget.Material3.BottomAppBar" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/new_post"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/baseline_add_24"
|
||||
app:layout_anchorGravity="bottom"
|
||||
app:layout_anchor="@id/bottomAppBar" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@ -133,4 +133,5 @@
|
||||
<string name="text">Text</string>
|
||||
<string name="insert_url">Insert url</string>
|
||||
<string name="enlarge_text_box">Enlarge text box</string>
|
||||
<string name="create_a_new_discussion">Create a new discussion</string>
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user