mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
WIP filter conversations feature, implemented small fixes + license
Signed-off-by: Julius Linus julius.linus@nextcloud.com Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ffdae1552d
commit
715cbedcfe
@ -34,7 +34,6 @@ import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
@ -68,6 +67,7 @@ import coil.transform.CircleCropTransformation
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.BaseActivity
|
||||
import com.nextcloud.talk.activities.CallActivity
|
||||
@ -194,8 +194,8 @@ class ConversationsListActivity :
|
||||
private var searchViewDisposable: Disposable? = null
|
||||
private var filterState =
|
||||
mutableMapOf(
|
||||
MENTION to false,
|
||||
UNREAD to false
|
||||
FilterConversationFragment.MENTION to false,
|
||||
FilterConversationFragment.UNREAD to false
|
||||
)
|
||||
|
||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||
@ -789,17 +789,6 @@ class ConversationsListActivity :
|
||||
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
|
||||
}
|
||||
|
||||
fun updateFilterConversationButtonColor() {
|
||||
val colorInt: Int = if (filterState.containsValue(true)) {
|
||||
context.getColor(R.color.colorPrimary)
|
||||
} else {
|
||||
context.getColor(R.color.grey_200)
|
||||
}
|
||||
|
||||
val csl = ColorStateList.valueOf(colorInt)
|
||||
binding.filterConversationsButton.iconTint = csl
|
||||
}
|
||||
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
private fun checkToShowUnreadBubble() {
|
||||
try {
|
||||
@ -1490,12 +1479,23 @@ class ConversationsListActivity :
|
||||
}
|
||||
|
||||
fun updateFilterState(mention: Boolean, unread: Boolean) {
|
||||
filterState[MENTION] = mention
|
||||
filterState[UNREAD] = unread
|
||||
filterState[FilterConversationFragment.MENTION] = mention
|
||||
filterState[FilterConversationFragment.UNREAD] = unread
|
||||
}
|
||||
|
||||
fun setFilterableItems(items: MutableList<AbstractFlexibleItem<*>>) { filterableConversationItems = items }
|
||||
|
||||
fun updateFilterConversationButtonColor() {
|
||||
if (filterState.containsValue(true)) {
|
||||
binding.filterConversationsButton.let { viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY) }
|
||||
} else {
|
||||
binding.filterConversationsButton.let { viewThemeUtils.platform.colorImageView(
|
||||
it,
|
||||
ColorRole.ON_SURFACE_VARIANT
|
||||
) }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "ConvListController"
|
||||
const val UNREAD_BUBBLE_DELAY = 2500
|
||||
@ -1509,7 +1509,5 @@ class ConversationsListActivity :
|
||||
const val CLIENT_UPGRADE_GPLAY_LINK = "https://play.google.com/store/apps/details?id="
|
||||
const val HTTP_SERVICE_UNAVAILABLE = 503
|
||||
const val MAINTENANCE_MODE_HEADER_KEY = "X-Nextcloud-Maintenance-Mode"
|
||||
const val MENTION: String = "mention"
|
||||
const val UNREAD: String = "unread"
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Julius Linus
|
||||
* Copyright (C) 2023 Julius Linus <julius.linus@nextcloud.com>
|
||||
*
|
||||
* 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.ui.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
|
@ -1,3 +1,19 @@
|
||||
<!--
|
||||
@author Google LLC
|
||||
Copyright (C) 2023 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
@ -87,22 +87,16 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Search in Nextcloud" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<ImageView
|
||||
android:id="@+id/filter_conversations_button"
|
||||
style="@style/Widget.AppTheme.Button.IconButton"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:contentDescription="@string/nc_filter"
|
||||
android:scaleType="fitCenter"
|
||||
android:transitionName="userAvatar.transitionTag"
|
||||
app:cornerRadius="@dimen/button_corner_radius"
|
||||
app:icon="@drawable/ic_baseline_filter_list_24"
|
||||
app:iconTint="@color/disabled_text"
|
||||
app:iconSize="@dimen/avatar_size_app_bar"
|
||||
android:src="@drawable/ic_baseline_filter_list_24"
|
||||
app:layout_constraintBaseline_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/rightContainer"
|
||||
tools:visibility="visible" />
|
||||
app:layout_constraintEnd_toStartOf="@+id/rightContainer"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/rightContainer"
|
||||
|
@ -1,6 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Nextcloud Talk application
|
||||
~
|
||||
~ @author Julius Linus
|
||||
~ Copyright (C) 2023 Julius Linus <julius.linus@nextcloud.com>
|
||||
~
|
||||
~ 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/>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -40,4 +58,4 @@
|
||||
android:text="@string/mentioned" />
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user