Skip to content
Snippets Groups Projects
Commit b0544c9b authored by Taras's avatar Taras
Browse files

Create ui

parent 45d50cf2
No related branches found
No related tags found
No related merge requests found
package org.futo.circles.core.feature.circles.filter package org.futo.circles.core.feature.circles.filter
import androidx.lifecycle.SavedStateHandle
import org.futo.circles.core.extensions.getOrThrow
import org.futo.circles.core.provider.MatrixSessionProvider
import javax.inject.Inject import javax.inject.Inject
class FilterTimelinesDataSource @Inject constructor() { class FilterTimelinesDataSource @Inject constructor(
savedStateHandle: SavedStateHandle
) {
private val circleId: String = savedStateHandle.getOrThrow("circleId")
val circleSummaryLiveData =
MatrixSessionProvider.getSessionOrThrow().roomService().getRoomSummaryLive(circleId)
} }
\ No newline at end of file
package org.futo.circles.core.feature.circles.filter package org.futo.circles.core.feature.circles.filter
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import org.futo.circles.core.R
import org.futo.circles.core.base.fragment.BaseFullscreenDialogFragment import org.futo.circles.core.base.fragment.BaseFullscreenDialogFragment
import org.futo.circles.core.base.fragment.HasLoadingState
import org.futo.circles.core.databinding.DialogFragmentFilterTimelineBinding import org.futo.circles.core.databinding.DialogFragmentFilterTimelineBinding
import org.futo.circles.core.extensions.observeData
import org.futo.circles.core.mapping.nameOrId
@AndroidEntryPoint @AndroidEntryPoint
class FilterTimelinesDialogFragment : class FilterTimelinesDialogFragment :
BaseFullscreenDialogFragment(DialogFragmentFilterTimelineBinding::inflate) { BaseFullscreenDialogFragment(DialogFragmentFilterTimelineBinding::inflate), HasLoadingState {
override val fragment: Fragment = this
private val viewModel by viewModels<FilterTimelinesViewModel>()
private val binding by lazy {
getBinding() as DialogFragmentFilterTimelineBinding
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupViews()
setupObservers()
}
private fun setupViews() {
}
private fun setupObservers() {
viewModel.circleInfoLiveData.observeData(this) {
it.getOrNull()?.let { info ->
binding.tvSubtitle.text =
getString(R.string.select_timelines_format, info.nameOrId())
}
}
}
} }
\ No newline at end of file
...@@ -6,7 +6,10 @@ import javax.inject.Inject ...@@ -6,7 +6,10 @@ import javax.inject.Inject
@HiltViewModel @HiltViewModel
class FilterTimelinesViewModel @Inject constructor( class FilterTimelinesViewModel @Inject constructor(
private val dataSource: FilterTimelinesDataSource dataSource: FilterTimelinesDataSource
) : ViewModel() { ) : ViewModel() {
val circleInfoLiveData = dataSource.circleSummaryLiveData
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="?attr/homeAsUpIndicator"
app:title="@string/filter_timelines"
app:titleCentered="true"
app:titleMarginEnd="72dp">
<org.futo.circles.core.view.LoadingButton
android:id="@+id/btnSave"
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginVertical="8dp"
android:layout_marginEnd="8dp"
android:enabled="false"
android:text="@string/save"
android:textSize="13sp"
app:textPadding="1dp" />
</com.google.android.material.appbar.MaterialToolbar>
<View
android:id="@+id/toolbarDivider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/divider_color" />
<TextView
android:id="@+id/tvSubtitle"
style="@style/subheadline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:paddingHorizontal="8dp"
android:text="@string/select_timelines_format" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSelectAll"
style="@style/NegativeButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="8dp"
android:text="@string/select_all"
android:textSize="12sp" />
<org.futo.circles.core.view.LoadingRecyclerView
android:id="@+id/rvUsers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:paddingHorizontal="8dp" />
</LinearLayout>
\ No newline at end of file
...@@ -171,4 +171,6 @@ ...@@ -171,4 +171,6 @@
<string name="invite_to_connect">Invite to connect</string> <string name="invite_to_connect">Invite to connect</string>
<string name="follow">Follow</string> <string name="follow">Follow</string>
<string name="default_user_role">Default user role</string> <string name="default_user_role">Default user role</string>
<string name="select_timelines_format">Select timelines which posts you want to read in %s</string>
<string name="select_all">Select all</string>
</resources> </resources>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment