WIP reportes

This commit is contained in:
erik-everardo 2024-04-14 02:20:35 -06:00
parent 8730bbe796
commit 72568725d4
6 changed files with 106 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import com.isolaatti.posting.posts.presentation.CreatePostContract
import com.isolaatti.posting.posts.presentation.EditPostContract import com.isolaatti.posting.posts.presentation.EditPostContract
import com.isolaatti.posting.posts.presentation.PostsRecyclerViewAdapter import com.isolaatti.posting.posts.presentation.PostsRecyclerViewAdapter
import com.isolaatti.profile.ui.ProfileActivity import com.isolaatti.profile.ui.ProfileActivity
import com.isolaatti.reports.ui.NewReportBottomSheetDialogFragment
import com.isolaatti.settings.ui.SettingsActivity import com.isolaatti.settings.ui.SettingsActivity
import com.isolaatti.utils.UrlGen import com.isolaatti.utils.UrlGen
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@ -113,6 +114,7 @@ class FeedFragment : Fragment(), OnUserInteractedWithPostCallback {
} }
Options.Option.OPTION_REPORT -> { Options.Option.OPTION_REPORT -> {
optionsViewModel.handle() optionsViewModel.handle()
NewReportBottomSheetDialogFragment.newInstance().show(childFragmentManager, NewReportBottomSheetDialogFragment.LOG_TAG)
} }
} }
} }

View File

@ -36,6 +36,7 @@ import com.isolaatti.images.image_chooser.ui.ImageChooserContract
import com.isolaatti.posting.link_creator.presentation.LinkCreatorViewModel import com.isolaatti.posting.link_creator.presentation.LinkCreatorViewModel
import com.isolaatti.posting.link_creator.ui.LinkCreatorFragment import com.isolaatti.posting.link_creator.ui.LinkCreatorFragment
import com.isolaatti.profile.ui.ProfileActivity import com.isolaatti.profile.ui.ProfileActivity
import com.isolaatti.reports.ui.NewReportBottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import io.noties.markwon.AbstractMarkwonPlugin import io.noties.markwon.AbstractMarkwonPlugin
import io.noties.markwon.Markwon import io.noties.markwon.Markwon
@ -74,6 +75,7 @@ class BottomSheetPostComments() : BottomSheetDialogFragment(), OnUserInteractedC
} }
Options.Option.OPTION_REPORT -> { Options.Option.OPTION_REPORT -> {
optionsViewModel.handle() optionsViewModel.handle()
NewReportBottomSheetDialogFragment.newInstance().show(childFragmentManager, NewReportBottomSheetDialogFragment.LOG_TAG)
} }
} }
} }

View File

@ -49,6 +49,7 @@ import com.isolaatti.posting.posts.viewer.ui.PostViewerActivity
import com.isolaatti.profile.domain.entity.UserProfile import com.isolaatti.profile.domain.entity.UserProfile
import com.isolaatti.profile.presentation.EditProfileContract import com.isolaatti.profile.presentation.EditProfileContract
import com.isolaatti.profile.presentation.ProfileViewModel import com.isolaatti.profile.presentation.ProfileViewModel
import com.isolaatti.reports.ui.NewReportBottomSheetDialogFragment
import com.isolaatti.utils.UrlGen import com.isolaatti.utils.UrlGen
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import io.noties.markwon.AbstractMarkwonPlugin import io.noties.markwon.AbstractMarkwonPlugin
@ -265,6 +266,7 @@ class ProfileMainFragment : Fragment() {
} }
Options.Option.OPTION_REPORT -> { Options.Option.OPTION_REPORT -> {
optionsViewModel.handle() optionsViewModel.handle()
NewReportBottomSheetDialogFragment.newInstance().show(childFragmentManager, NewReportBottomSheetDialogFragment.LOG_TAG)
} }
} }
} }

View File

@ -0,0 +1,30 @@
package com.isolaatti.reports.ui
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.isolaatti.databinding.BottomSheetNewReportBinding
class NewReportBottomSheetDialogFragment : BottomSheetDialogFragment() {
private lateinit var binding: BottomSheetNewReportBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = BottomSheetNewReportBinding.inflate(inflater, container, false)
return binding.root
}
companion object {
const val LOG_TAG = "NewReportBottomSheetDialogFragment"
fun newInstance(): NewReportBottomSheetDialogFragment {
return NewReportBottomSheetDialogFragment()
}
}
}

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:tools="http://schemas.android.com/tools">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/drag_handle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold"
android:text="@string/new_report"
app:layout_constraintTop_toBottomOf="@id/drag_handle"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/menu"
style="@style/Widget.Material3.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/menu"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="4"
android:hint="Describe what made you want to report this"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Submit report"
app:layout_constraintTop_toBottomOf="@id/textField"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp"
app:layout_goneMarginTop="16dp"
style="?attr/materialIconButtonFilledTonalStyle"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -201,4 +201,5 @@
<string name="hashtags">Hashtags</string> <string name="hashtags">Hashtags</string>
<string name="newest_profiles">Newest profiles</string> <string name="newest_profiles">Newest profiles</string>
<string name="see_all">See all</string> <string name="see_all">See all</string>
<string name="new_report">New report</string>
</resources> </resources>