Skip to content
Snippets Groups Projects
Commit bc606e1b authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

HomeFragment: check for request when creating dialog

Change-Id: Ib4d7a5e156d1b430198aa5da4cedfd34f7157c4d
parent 5b7805c5
No related branches found
No related tags found
No related merge requests found
......@@ -275,7 +275,8 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
}.root
private fun displayConversationRequestDialog(conversation: Conversation) {
if (conversation.request!!.mode == Conversation.Mode.OneToOne)
val request = conversation.request ?: return
if (request.mode == Conversation.Mode.OneToOne)
MaterialAlertDialogBuilder(requireContext())
.setItems(R.array.swarm_request_one_to_one_actions) { _, which ->
when (which) {
......@@ -299,11 +300,10 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
private fun startSearch() {
searchDisposable?.dispose()
val disposable = mConversationFacade.getSearchResults(debouncedQuery)
searchDisposable = mConversationFacade.getSearchResults(debouncedQuery)
.observeOn(DeviceUtils.uiScheduler)
.subscribe { searchAdapter?.update(it) }
searchDisposable = disposable
mDisposable.add(disposable)
.apply { mDisposable.add(this) }
}
/**
......@@ -502,11 +502,11 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
.switchMap { mAccountService.getObservableAccountProfile(it.accountId) }
.observeOn(DeviceUtils.uiScheduler)
.subscribe { profile ->
mBinding ?: return@subscribe
mBinding!!.searchBar.navigationIcon =
val binding = mBinding ?: return@subscribe
binding.searchBar.navigationIcon =
BitmapUtils.withPadding(
AvatarDrawable.build(
mBinding!!.root.context,
binding.root.context,
profile.first,
profile.second,
true,
......
......@@ -43,6 +43,7 @@ import net.jami.model.Uri
import net.jami.services.ConversationFacade
import net.jami.smartlist.SmartListPresenter
import net.jami.smartlist.SmartListView
import androidx.core.net.toUri
@AndroidEntryPoint
class SmartListFragment : BaseSupportFragment<SmartListPresenter, SmartListView>(),
......@@ -87,7 +88,7 @@ class SmartListFragment : BaseSupportFragment<SmartListPresenter, SmartListView>
val selected = numbers[which]
val intent = Intent(Intent.ACTION_CALL)
.setClass(context, CallActivity::class.java)
.setData(android.net.Uri.parse(selected.toString()))
.setData(selected.toString().toUri())
startActivityForResult(intent, HomeActivity.REQUEST_CODE_CALL)
}.show()
}
......
......@@ -20,7 +20,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
android:fitsSystemWindows="true"
tools:context=".client.HomeActivity">
<!-- Smartlist to display swarms -->
<androidx.fragment.app.FragmentContainerView
......@@ -28,8 +29,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
android:name="cx.ring.fragments.SmartListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/frag_smartlist"
app:layout_behavior="@string/searchbar_scrolling_view_behavior" />
app:layout_behavior="@string/searchbar_scrolling_view_behavior"
tools:layout="@layout/frag_smartlist" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
......@@ -48,24 +49,24 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<!-- Search bar to search for a swarm or for new contacts -->
<com.google.android.material.search.SearchBar
android:id="@+id/search_bar"
app:navigationContentDescription="@string/searchbar_navigation_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/searchbar_color"
android:hint="@string/searchbar_hint"
android:textAppearance="@style/TextAppearance.Material3.SearchBar"
app:autoShowKeyboard="true"
app:navigationContentDescription="@string/searchbar_navigation_account"
app:navigationIcon="@android:color/transparent" />
<!-- Donation card -->
<include
android:id="@+id/donation_card"
layout="@layout/frag_donation_card"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:visibility="gone" />
<!-- Received invitations -->
......@@ -84,6 +85,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:hint="@string/searchbar_hint"
app:animateNavigationIcon="false"
app:layout_anchor="@id/search_bar"
tools:visibility="gone">
......@@ -157,11 +159,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
android:id="@+id/searchResult"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="vertical"
android:clipToPadding="false"
android:divider="@null"
android:orientation="vertical"
android:paddingBottom="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_smartlist" />
</LinearLayout>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment