From e62684110d8c773206614d7f85bea195224a8abe Mon Sep 17 00:00:00 2001 From: JSunde Date: Mon, 2 Oct 2023 23:50:48 +0000 Subject: [PATCH] Fix missing labels on some tasks --- .../components/TaskHeaderPopupView.kt | 2 +- .../ui/datacollection/components/TaskView.kt | 18 ------------------ .../components/TaskViewFactory.kt | 4 ---- .../location/CaptureLocationTaskFragment.kt | 6 +----- .../tasks/point/DropAPinTaskFragment.kt | 6 +----- .../polygon/PolygonDrawingTaskFragment.kt | 6 +----- .../layout/task_frag_with_combined_header.xml | 1 + ground/src/main/res/values/strings.xml | 3 --- 8 files changed, 5 insertions(+), 41 deletions(-) diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskHeaderPopupView.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskHeaderPopupView.kt index 2f6dea3c7b..4a390302e2 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskHeaderPopupView.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskHeaderPopupView.kt @@ -26,7 +26,7 @@ import android.view.WindowManager import android.widget.PopupWindow import com.google.android.ground.databinding.PopupLayoutBinding -/** PopupView for displaying label for [TaskViewWithoutHeader]. */ +/** PopupView for displaying label for tasks. */ class TaskHeaderPopupView(val context: Context) { private var binding: PopupLayoutBinding private var window: PopupWindow diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskView.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskView.kt index 0474b86baf..8d3a541780 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskView.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskView.kt @@ -20,7 +20,6 @@ import android.view.ViewGroup import androidx.fragment.app.Fragment import com.google.android.ground.databinding.TaskFragWithCombinedHeaderBinding import com.google.android.ground.databinding.TaskFragWithHeaderBinding -import com.google.android.ground.databinding.TaskFragWithoutHeaderBinding import com.google.android.ground.ui.datacollection.tasks.AbstractTaskViewModel /** Wrapper class for holding entire task's view (except toolbar). */ @@ -56,23 +55,6 @@ data class TaskViewWithHeader(private val binding: TaskFragWithHeaderBinding) : } } -/** Implementation of [TaskView] without an embedded header. */ -data class TaskViewWithoutHeader(private val binding: TaskFragWithoutHeaderBinding) : TaskView { - - override val actionButtonsContainer = binding.actionButtonsContainer - - override val root = binding.root - - override fun bind(fragment: Fragment, viewModel: AbstractTaskViewModel) { - binding.viewModel = viewModel - binding.lifecycleOwner = fragment - } - - override fun addTaskView(view: View) { - binding.taskContainer.addView(view) - } -} - /** Implementation of [TaskView] with a header that is an extension of the title bar. */ data class TaskViewWithCombinedHeader(private val binding: TaskFragWithCombinedHeaderBinding) : TaskView { diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskViewFactory.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskViewFactory.kt index 1bdb575fcc..89edd35f8c 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskViewFactory.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/components/TaskViewFactory.kt @@ -21,7 +21,6 @@ import androidx.annotation.StringRes import androidx.appcompat.content.res.AppCompatResources import com.google.android.ground.databinding.TaskFragWithCombinedHeaderBinding import com.google.android.ground.databinding.TaskFragWithHeaderBinding -import com.google.android.ground.databinding.TaskFragWithoutHeaderBinding /** Factory for creating a [TaskView]. */ object TaskViewFactory { @@ -29,9 +28,6 @@ object TaskViewFactory { fun createWithHeader(layoutInflater: LayoutInflater): TaskView = TaskViewWithHeader(TaskFragWithHeaderBinding.inflate(layoutInflater)) - fun createWithoutHeader(layoutInflater: LayoutInflater): TaskView = - TaskViewWithoutHeader(TaskFragWithoutHeaderBinding.inflate(layoutInflater)) - /** Creates a TaskView with a header that is an extension of the app bar. */ fun createWithCombinedHeader( layoutInflater: LayoutInflater, diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/location/CaptureLocationTaskFragment.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/location/CaptureLocationTaskFragment.kt index 4fcfe64426..ef23e5b01f 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/location/CaptureLocationTaskFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/location/CaptureLocationTaskFragment.kt @@ -37,11 +37,7 @@ class CaptureLocationTaskFragment : @Inject lateinit var map: MapFragment override fun onCreateTaskView(inflater: LayoutInflater, container: ViewGroup?): TaskView = - TaskViewFactory.createWithCombinedHeader( - inflater, - R.drawable.outline_pin_drop, - R.string.capture_location - ) + TaskViewFactory.createWithCombinedHeader(inflater, R.drawable.outline_pin_drop) override fun onCreateTaskBody(inflater: LayoutInflater): View { val rowLayout = LinearLayout(requireContext()).apply { id = View.generateViewId() } diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/point/DropAPinTaskFragment.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/point/DropAPinTaskFragment.kt index 3b19cbd467..61b3377a41 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/point/DropAPinTaskFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/point/DropAPinTaskFragment.kt @@ -38,11 +38,7 @@ class DropAPinTaskFragment : Hilt_DropAPinTaskFragment() @Inject lateinit var map: MapFragment override fun onCreateTaskView(inflater: LayoutInflater, container: ViewGroup?): TaskView = - TaskViewFactory.createWithCombinedHeader( - inflater, - R.drawable.outline_pin_drop, - R.string.drop_a_pin - ) + TaskViewFactory.createWithCombinedHeader(inflater, R.drawable.outline_pin_drop) override fun onCreateTaskBody(inflater: LayoutInflater): View { val rowLayout = LinearLayout(requireContext()).apply { id = View.generateViewId() } diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/polygon/PolygonDrawingTaskFragment.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/polygon/PolygonDrawingTaskFragment.kt index 5490af2362..5586755c62 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/polygon/PolygonDrawingTaskFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/tasks/polygon/PolygonDrawingTaskFragment.kt @@ -42,11 +42,7 @@ class PolygonDrawingTaskFragment : Hilt_PolygonDrawingTaskFragment diff --git a/ground/src/main/res/values/strings.xml b/ground/src/main/res/values/strings.xml index 375cdfd99b..b376f573b5 100644 --- a/ground/src/main/res/values/strings.xml +++ b/ground/src/main/res/values/strings.xml @@ -139,9 +139,7 @@ New data collection site Add new site and submit related data - Drop a pin Drag your map until the center pin is on the desired location - Draw an area Current location Loading… Skip this step? @@ -165,7 +163,6 @@ … Cancel Download this area? - Capture location Capture Surveys Icon shown when the survey is available offline