diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
index 9dc649dec13..e6620b0c1ba 100644
--- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
@@ -4215,11 +4215,7 @@ class ChatActivity :
fun remindMeLater(message: ChatMessage?) {
Log.d(TAG, "remindMeLater called")
- val newFragment: DialogFragment = DateTimePickerFragment.newInstance(
- roomToken,
- message!!.id,
- chatViewModel
- )
+ val newFragment = DateTimePickerFragment.newInstance(roomToken, message!!.id)
newFragment.show(supportFragmentManager, DateTimePickerFragment.TAG)
}
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/DateTimePickerFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/DateTimePickerFragment.kt
index 93a8d42dbfc..9afd17d6eeb 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/DateTimePickerFragment.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/DateTimePickerFragment.kt
@@ -37,6 +37,7 @@ import com.google.android.material.timepicker.TimeFormat
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
+import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.chat.viewmodels.ChatViewModel
import com.nextcloud.talk.databinding.DialogDateTimePickerBinding
import com.nextcloud.talk.ui.theme.ViewThemeUtils
@@ -47,17 +48,13 @@ import javax.inject.Inject
@Suppress("TooManyFunctions")
@AutoInjector(NextcloudTalkApplication::class)
-class DateTimePickerFragment(
- token: String,
- id: String,
- chatViewModel: ChatViewModel
-) : DialogFragment() {
+class DateTimePickerFragment : DialogFragment() {
lateinit var binding: DialogDateTimePickerBinding
private var dialogView: View? = null
- private var viewModel = chatViewModel
+ private lateinit var viewModel: ChatViewModel
private var currentTimeStamp: Long? = null
- private var roomToken = token
- private var messageId = id
+ private lateinit var roomToken: String
+ private lateinit var messageId: String
private var laterTodayTimeStamp = 0L
private var tomorrowTimeStamp = 0L
private var weekendTimeStamp = 0L
@@ -72,6 +69,11 @@ class DateTimePickerFragment(
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
binding = DialogDateTimePickerBinding.inflate(LayoutInflater.from(context))
dialogView = binding.root
+ viewModel = (requireActivity() as ChatActivity).chatViewModel
+ arguments?.let {
+ roomToken = it.getString(TOKEN_ARG, "")
+ messageId = it.getString(ID_ARG, "")
+ }
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create()
}
@@ -297,13 +299,18 @@ class DateTimePickerFragment(
private const val ONE_SEC = 1000
private const val HOUR_EIGHT_AM = 8
private const val HOUR_SIX_PM = 18
+ private const val TOKEN_ARG = "TOKEN_ARG"
+ private const val ID_ARG = "ID_ARG"
@JvmStatic
- fun newInstance(token: String, id: String, chatViewModel: ChatViewModel) =
- DateTimePickerFragment(
- token,
- id,
- chatViewModel
- )
+ fun newInstance(token: String, id: String): DateTimePickerFragment {
+ val args = Bundle()
+ args.putString(TOKEN_ARG, token)
+ args.putString(ID_ARG, id)
+
+ val dateTimePickerFragment = DateTimePickerFragment()
+ dateTimePickerFragment.arguments = args
+ return dateTimePickerFragment
+ }
}
}
diff --git a/app/src/main/res/layout/dialog_date_time_picker.xml b/app/src/main/res/layout/dialog_date_time_picker.xml
index 2fd1e51a643..96d21a382d8 100644
--- a/app/src/main/res/layout/dialog_date_time_picker.xml
+++ b/app/src/main/res/layout/dialog_date_time_picker.xml
@@ -17,202 +17,208 @@
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see .
-->
-
+ android:orientation="vertical">
-
+ android:layout_margin="@dimen/standard_margin"
+ android:orientation="horizontal">
-
+
-
+
+
-
-
+
-
+ android:background="?android:attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
-
-
+
-
+
+
-
+ android:background="?android:attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
-
-
+
-
+
+
-
+ android:background="?android:attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
-
-
+
-
+
+
-
+ android:background="?android:attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
-
-
+
-
+
+
-
+
-
+ android:background="?android:attr/selectableItemBackground"
+ android:orientation="horizontal"
+ android:padding="@dimen/standard_padding">
-
-
+
-
+
+
+ android:orientation="horizontal">
+
+
+
+
+
+
+ android:text="@string/set" />
-
+
-
+
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file