-
-
Notifications
You must be signed in to change notification settings - Fork 150
feat: status choosing #2882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: status choosing #2882
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ccd89d3
feat: status choosing
alperozturk96 d765f03
add user status repo
alperozturk96 7c7f464
add SetStatusMessageBottomSheet
alperozturk96 956d4f5
add SetStatusMessageBottomSheet
alperozturk96 0e78de0
add SetOnlineStatusBottomSheet
alperozturk96 48d1e9c
use showBottomSheetDialog
alperozturk96 9628af5
use showBottomSheetDialog
alperozturk96 2daad49
use showBottomSheetDialog
alperozturk96 ab9a3d8
add missing license
alperozturk96 4a1deea
move package places
alperozturk96 ed92712
fix tests
alperozturk96 ed35a10
update license header
alperozturk96 f242b1a
update license header
alperozturk96 2c4207b
add status icon
alperozturk96 71492ac
update license header
alperozturk96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
.../owncloud/notes/accountswitcher/adapter/predefinedStatus/PredefinedStatusClickListener.kt
This file contains hidden or 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,13 @@ | ||
| /* | ||
| * Nextcloud Talk - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2022 Tim Krüger <t@timkrueger.me | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
| package it.niedermann.owncloud.notes.accountswitcher.adapter.predefinedStatus | ||
|
|
||
| import com.owncloud.android.lib.resources.users.PredefinedStatus | ||
|
|
||
| interface PredefinedStatusClickListener { | ||
| fun onClick(predefinedStatus: PredefinedStatus) | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
...nn/owncloud/notes/accountswitcher/adapter/predefinedStatus/PredefinedStatusListAdapter.kt
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Nextcloud Talk - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias@kaminsky.me> | ||
| * SPDX-FileCopyrightText: 2020 Nextcloud GmbH | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
| package it.niedermann.owncloud.notes.accountswitcher.adapter.predefinedStatus | ||
|
|
||
| import android.content.Context | ||
| import android.view.LayoutInflater | ||
| import android.view.ViewGroup | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import com.owncloud.android.lib.resources.users.PredefinedStatus | ||
| import it.niedermann.owncloud.notes.databinding.PredefinedStatusBinding | ||
|
|
||
| class PredefinedStatusListAdapter(private val clickListener: PredefinedStatusClickListener, val context: Context) : | ||
| RecyclerView.Adapter<PredefinedStatusViewHolder>() { | ||
| internal var list: List<PredefinedStatus> = emptyList() | ||
|
|
||
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PredefinedStatusViewHolder { | ||
| val itemBinding = PredefinedStatusBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
| return PredefinedStatusViewHolder(itemBinding) | ||
| } | ||
|
|
||
| override fun onBindViewHolder(holder: PredefinedStatusViewHolder, position: Int) { | ||
| holder.bind(list[position], clickListener, context) | ||
| } | ||
|
|
||
| override fun getItemCount(): Int = list.size | ||
| } |
44 changes: 44 additions & 0 deletions
44
...ann/owncloud/notes/accountswitcher/adapter/predefinedStatus/PredefinedStatusViewHolder.kt
This file contains hidden or 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,44 @@ | ||
| /* | ||
| * Nextcloud Talk - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias@kaminsky.me> | ||
| * SPDX-FileCopyrightText: 2020 Nextcloud GmbH | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
| package it.niedermann.owncloud.notes.accountswitcher.adapter.predefinedStatus | ||
|
|
||
| import android.content.Context | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import com.owncloud.android.lib.resources.users.PredefinedStatus | ||
| import it.niedermann.owncloud.notes.R | ||
| import it.niedermann.owncloud.notes.databinding.PredefinedStatusBinding | ||
| import it.niedermann.owncloud.notes.shared.util.DisplayUtils | ||
|
|
||
| private const val ONE_SECOND_IN_MILLIS = 1000 | ||
|
|
||
| class PredefinedStatusViewHolder(private val binding: PredefinedStatusBinding) : RecyclerView.ViewHolder(binding.root) { | ||
|
|
||
| fun bind(status: PredefinedStatus, clickListener: PredefinedStatusClickListener, context: Context) { | ||
| binding.root.setOnClickListener { clickListener.onClick(status) } | ||
| binding.icon.text = status.icon | ||
| binding.name.text = status.message | ||
|
|
||
| if (status.clearAt == null) { | ||
| binding.clearAt.text = context.getString(R.string.dontClear) | ||
| } else { | ||
| val clearAt = status.clearAt | ||
| if (clearAt?.type == "period") { | ||
| binding.clearAt.text = DisplayUtils.getRelativeTimestamp( | ||
| context, | ||
| System.currentTimeMillis() + clearAt.time.toInt() * ONE_SECOND_IN_MILLIS, | ||
| true | ||
| ) | ||
| } else { | ||
| // end-of | ||
| if (clearAt?.time == "day") { | ||
| binding.clearAt.text = context.getString(R.string.today) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
...it/niedermann/owncloud/notes/accountswitcher/bottomSheet/AccountSwitcherBottomSheetTag.kt
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Nextcloud Notes - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2015-2025 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
| package it.niedermann.owncloud.notes.accountswitcher.bottomSheet | ||
|
|
||
| import com.owncloud.android.lib.resources.users.Status | ||
| import it.niedermann.owncloud.notes.accountswitcher.repository.UserStatusRepository | ||
| import it.niedermann.owncloud.notes.branding.BrandedBottomSheetDialogFragment | ||
|
|
||
| enum class AccountSwitcherBottomSheetTag(tag: String) { | ||
| ONLINE_STATUS("fragment_set_status"), | ||
| MESSAGE_STATUS("fragment_set_status_message"); | ||
|
|
||
| fun fragment( | ||
| repository: UserStatusRepository, | ||
| currentStatus: Status | ||
| ): BrandedBottomSheetDialogFragment { | ||
| return when (this) { | ||
| ONLINE_STATUS -> { | ||
| SetOnlineStatusBottomSheet(repository, currentStatus) | ||
| } | ||
|
|
||
| MESSAGE_STATUS -> { | ||
| SetStatusMessageBottomSheet(repository, currentStatus) | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.