-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Julius Linus <[email protected]>
- Loading branch information
1 parent
a386a08
commit 6e3837c
Showing
15 changed files
with
529 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/nextcloud/talk/models/json/reminder/Reminder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Nextcloud Talk application | ||
* | ||
* @author Julius Linus | ||
* Copyright (C) 2023 Julius Linus <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.nextcloud.talk.models.json.reminder | ||
|
||
import android.os.Parcelable | ||
import com.bluelinelabs.logansquare.annotation.JsonField | ||
import com.bluelinelabs.logansquare.annotation.JsonObject | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
@JsonObject | ||
data class Reminder( | ||
@JsonField(name = ["userid"]) | ||
var userid: String? = null, | ||
@JsonField(name = ["token"]) | ||
var token: String? = null, | ||
@JsonField(name = ["messageId"]) | ||
var messageId: Int? = null, | ||
@JsonField(name = ["timestamp"]) | ||
var timestamp: Int? = null | ||
) : Parcelable { | ||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' | ||
constructor() : this(null, null, null, null) | ||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/nextcloud/talk/models/json/reminder/ReminderOCS.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Nextcloud Talk application | ||
* | ||
* @author Julius Linus | ||
* Copyright (C) 2023 Julius Linus <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.nextcloud.talk.models.json.reminder | ||
|
||
import android.os.Parcelable | ||
import com.bluelinelabs.logansquare.annotation.JsonField | ||
import com.bluelinelabs.logansquare.annotation.JsonObject | ||
import com.nextcloud.talk.models.json.generic.GenericMeta | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
@JsonObject | ||
data class ReminderOCS( | ||
@JsonField(name = ["meta"]) | ||
var meta: GenericMeta? = null, | ||
@JsonField(name = ["data"]) | ||
var data: Reminder? = null | ||
) : Parcelable { | ||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' | ||
constructor() : this(null, null) | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/nextcloud/talk/models/json/reminder/ReminderOverall.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Nextcloud Talk application | ||
* | ||
* @author Julius Linus | ||
* Copyright (C) 2023 Julius Linus <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.nextcloud.talk.models.json.reminder | ||
|
||
import android.os.Parcelable | ||
import com.bluelinelabs.logansquare.annotation.JsonField | ||
import com.bluelinelabs.logansquare.annotation.JsonObject | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
@JsonObject | ||
data class ReminderOverall( | ||
@JsonField(name = ["ocs"]) | ||
var ocs: ReminderOCS? = null | ||
) : Parcelable { | ||
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' | ||
constructor() : this(null) | ||
} |
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/nextcloud/talk/ui/dialog/DateTimePickerFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.nextcloud.talk.ui.dialog | ||
|
||
import android.app.DatePickerDialog | ||
import android.app.Dialog | ||
import android.os.Bundle | ||
import android.text.format.DateUtils | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.DialogFragment | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
import com.google.android.material.timepicker.MaterialTimePicker | ||
import com.nextcloud.talk.R | ||
import com.nextcloud.talk.databinding.DialogDateTimePickerBinding | ||
import java.util.Calendar | ||
|
||
class DateTimePickerFragment : DialogFragment() { | ||
lateinit var binding: DialogDateTimePickerBinding | ||
private var dialogView: View? = null | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
binding = DialogDateTimePickerBinding.inflate(LayoutInflater.from(context)) | ||
dialogView = binding.root | ||
// TODO theme all this too | ||
setListeners() | ||
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create() | ||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
return inflater.inflate(R.layout.dialog_date_time_picker, container, false) | ||
} | ||
|
||
private fun setUpDefaults() { | ||
// TODO set up date's, and hide or show them depending on current time | ||
} | ||
|
||
private fun setListeners() { | ||
binding.dateTimePickerCustom.setOnClickListener { | ||
val datePicker = DatePickerDialog(requireContext()) | ||
|
||
datePicker.setOnDateSetListener { _, year, month, day -> | ||
|
||
val timePicker = MaterialTimePicker | ||
.Builder() | ||
.setTitleText(R.string.nc_remind) | ||
.build() | ||
|
||
timePicker.addOnPositiveButtonClickListener { | ||
val calendar: Calendar = Calendar.getInstance() | ||
calendar.set(Calendar.YEAR, year) | ||
calendar.set(Calendar.MONTH, month) | ||
calendar.set(Calendar.DAY_OF_MONTH, day) | ||
calendar.set(Calendar.HOUR_OF_DAY, timePicker.hour) | ||
calendar.set(Calendar.MINUTE, timePicker.minute) | ||
calendar.set(Calendar.SECOND, 0) | ||
val timestamp = calendar.timeInMillis | ||
binding.dateTimePickerTimestamp.text = DateUtils.formatDateTime( | ||
requireContext(), timestamp, | ||
DateUtils.FORMAT_SHOW_DATE | ||
) + ", " + DateUtils.formatDateTime( | ||
requireContext(), timestamp, | ||
DateUtils.FORMAT_SHOW_TIME | ||
) | ||
} | ||
|
||
this.fragmentManager?.let { it1 -> timePicker.show(it1, TAG) } | ||
} | ||
datePicker.show() | ||
} | ||
|
||
binding.buttonClose.setOnClickListener { dismiss() } | ||
binding.buttonSet.setOnClickListener { | ||
//TODO set reminder here but call Marcel first to figure out how notifications work | ||
dismiss() | ||
} | ||
} | ||
|
||
companion object { | ||
val TAG = DateTimePickerFragment::class.simpleName | ||
|
||
@JvmStatic | ||
fun newInstance() = DateTimePickerFragment() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.