mirror of
https://github.com/melihaksoy/Android-Kotlin-Modulerized-CleanArchitecture.git
synced 2026-03-29 05:41:53 +02:00
Feature/styling (#36)
* Working with material styles * Replaced deprecated ViewModelProviders.of and applied base styles with material components * Various code style fixes and styles.xml improvements
This commit is contained in:
@@ -12,12 +12,12 @@ import dagger.android.ContributesAndroidInjector
|
||||
@Module
|
||||
abstract class DetailContributor {
|
||||
|
||||
// region Contributes
|
||||
//region Contributes
|
||||
|
||||
@ContributesAndroidInjector(
|
||||
modules = [DetailFragmentModule::class]
|
||||
)
|
||||
@DetailFragmentScope
|
||||
abstract fun detailFragment(): DetailFragment
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ import dagger.multibindings.IntoMap
|
||||
@Module
|
||||
abstract class DetailFragmentModule {
|
||||
|
||||
// region ViewModels
|
||||
//region ViewModels
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ViewModelKey(DetailViewModel::class)
|
||||
abstract fun detailViewModel(detailViewModel: DetailViewModel): ViewModel
|
||||
// endregion
|
||||
//endregion
|
||||
|
||||
@Module
|
||||
companion object {
|
||||
|
||||
@@ -3,21 +3,20 @@ package com.melih.detail.ui
|
||||
import android.os.Bundle
|
||||
import android.text.method.ScrollingMovementMethod
|
||||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.melih.core.base.lifecycle.BaseDaggerFragment
|
||||
import com.melih.core.extensions.createFor
|
||||
import com.melih.core.extensions.observe
|
||||
import com.melih.detail.R
|
||||
import com.melih.detail.databinding.DetailBinding
|
||||
|
||||
class DetailFragment : BaseDaggerFragment<DetailBinding>() {
|
||||
|
||||
// region Properties
|
||||
//region Properties
|
||||
|
||||
private val viewModel: DetailViewModel
|
||||
get() = viewModelFactory.createFor(this)
|
||||
// endregion
|
||||
private val viewModel by viewModels<DetailViewModel> { viewModelFactory }
|
||||
//endregion
|
||||
|
||||
// region Functions
|
||||
//region Functions
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
@@ -34,5 +33,5 @@ class DetailFragment : BaseDaggerFragment<DetailBinding>() {
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_detail
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.melih.detail.ui
|
||||
|
||||
import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.Transformations.map
|
||||
import com.melih.core.base.viewmodel.BaseViewModel
|
||||
import com.melih.repository.entities.LaunchEntity
|
||||
import com.melih.repository.interactors.GetLaunchDetails
|
||||
@@ -13,13 +13,13 @@ class DetailViewModel @Inject constructor(
|
||||
private val getLaunchDetailsParams: GetLaunchDetails.Params
|
||||
) : BaseViewModel<LaunchEntity>() {
|
||||
|
||||
// region Properties
|
||||
//region Properties
|
||||
|
||||
val rocketName = Transformations.map(successData) {
|
||||
val rocketName = map(successData) {
|
||||
it.rocket.name
|
||||
}
|
||||
|
||||
val description = Transformations.map(successData) {
|
||||
val description = map(successData) {
|
||||
if (it.missions.isEmpty()) {
|
||||
""
|
||||
} else {
|
||||
@@ -27,12 +27,12 @@ class DetailViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val imageUrl = Transformations.map(successData) {
|
||||
val imageUrl = map(successData) {
|
||||
it.rocket.imageURL
|
||||
}
|
||||
// endregion
|
||||
//endregion
|
||||
|
||||
// region Functions
|
||||
//region Functions
|
||||
|
||||
/**
|
||||
* Triggering interactor in view model scope
|
||||
@@ -42,5 +42,5 @@ class DetailViewModel @Inject constructor(
|
||||
it.handle(::handleState, ::handleFailure, ::handleSuccess)
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -1,75 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
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">
|
||||
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">
|
||||
|
||||
<data class="DetailBinding">
|
||||
<data class="DetailBinding">
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.melih.detail.ui.DetailViewModel" />
|
||||
</data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.melih.detail.ui.DetailViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
android:id="@+id/imgRocket"
|
||||
imageUrl="@{viewModel.imageUrl}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="220dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:contentDescription="@string/cd_rocket_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars[14]" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgRocket"
|
||||
imageUrl="@{viewModel.imageUrl}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="220dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:contentDescription="@string/cd_rocket_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars[14]" />
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/AppTheme.TextViewStyle.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:text="@{viewModel.rocketName}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imgRocket"
|
||||
tools:text="@sample/launches.json/launches/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/TitleTextStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:text="@{viewModel.rocketName}"
|
||||
android:textAppearance="@style/TitleTextAppearance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imgRocket"
|
||||
tools:text="@sample/launches.json/launches/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:layout_marginBottom="@dimen/padding_standard"
|
||||
android:text="@{viewModel.description}"
|
||||
android:textAppearance="@style/DescriptionTextAppearance"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
|
||||
tools:text="@sample/launches.json/launches/missions/description" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tvDescription"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:layout_marginBottom="@dimen/padding_standard"
|
||||
android:text="@{viewModel.description}"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
|
||||
tools:text="@sample/launches.json/launches/missions/description" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
|
||||
@@ -8,6 +8,7 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation libraries.paging
|
||||
implementation libraries.swipeRefreshLayout
|
||||
|
||||
testImplementation testLibraries.coroutinesTest
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ import dagger.android.ContributesAndroidInjector
|
||||
@Module
|
||||
abstract class LaunchesContributor {
|
||||
|
||||
// region Contributes
|
||||
//region Contributes
|
||||
|
||||
@ContributesAndroidInjector(
|
||||
modules = [LaunchesFragmentModule::class]
|
||||
)
|
||||
@LaunchesFragmentScope
|
||||
abstract fun launchesFragment(): LaunchesFragment
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ import dagger.multibindings.IntoMap
|
||||
@Module
|
||||
abstract class LaunchesFragmentModule {
|
||||
|
||||
// region ViewModels
|
||||
//region ViewModels
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ViewModelKey(LaunchesViewModel::class)
|
||||
abstract fun listViewModel(listViewModel: LaunchesViewModel): ViewModel
|
||||
// endregion
|
||||
//endregion
|
||||
|
||||
@Module
|
||||
companion object {
|
||||
|
||||
@@ -2,29 +2,29 @@ package com.melih.list.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.melih.core.actions.openDetail
|
||||
import com.melih.core.base.lifecycle.BaseDaggerFragment
|
||||
import com.melih.core.extensions.createFor
|
||||
import com.melih.core.extensions.observe
|
||||
import com.melih.list.R
|
||||
import com.melih.list.databinding.ListBinding
|
||||
import com.melih.list.ui.adapters.LaunchesAdapter
|
||||
import com.melih.list.ui.vm.LaunchesViewModel
|
||||
import com.melih.repository.entities.LaunchEntity
|
||||
import com.melih.repository.interactors.base.PersistenceEmpty
|
||||
import com.melih.repository.interactors.base.State
|
||||
|
||||
class LaunchesFragment : BaseDaggerFragment<ListBinding>(), SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
// region Properties
|
||||
//region Properties
|
||||
|
||||
private val viewModel: LaunchesViewModel
|
||||
get() = viewModelFactory.createFor(this)
|
||||
private val viewModel by viewModels<LaunchesViewModel> { viewModelFactory }
|
||||
|
||||
private val launchesAdapter = LaunchesAdapter(::onItemSelected)
|
||||
// endregion
|
||||
//endregion
|
||||
|
||||
// region Functions
|
||||
//region Lifecyle
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
@@ -36,6 +36,23 @@ class LaunchesFragment : BaseDaggerFragment<ListBinding>(), SwipeRefreshLayout.O
|
||||
observeDataChanges()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
// Workaround for SwipeRefreshLayout leak -> https://issuetracker.google.com/issues/136153683
|
||||
binding.swipeRefreshLayout.isEnabled = true
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
// Workaround for SwipeRefreshLayout leak -> https://issuetracker.google.com/issues/136153683
|
||||
binding.swipeRefreshLayout.isEnabled = false
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Functions
|
||||
|
||||
private fun observeDataChanges() {
|
||||
|
||||
// Observing state to show loading
|
||||
@@ -45,8 +62,10 @@ class LaunchesFragment : BaseDaggerFragment<ListBinding>(), SwipeRefreshLayout.O
|
||||
|
||||
// Observing error to show toast with retry action
|
||||
observe(viewModel.errorData) {
|
||||
showSnackbarWithAction(it) {
|
||||
viewModel.retry()
|
||||
if (it !is PersistenceEmpty) {
|
||||
showSnackbarWithAction(it) {
|
||||
viewModel.retry()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,5 +83,5 @@ class LaunchesFragment : BaseDaggerFragment<ListBinding>(), SwipeRefreshLayout.O
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_launches
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -4,25 +4,30 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.melih.core.base.recycler.BasePagingListAdapter
|
||||
import com.melih.core.base.recycler.BaseViewHolder
|
||||
import com.melih.core.extensions.getDiffCallbackForType
|
||||
import com.melih.core.extensions.createDiffCallback
|
||||
import com.melih.list.databinding.LaunchRowBinding
|
||||
import com.melih.repository.entities.LaunchEntity
|
||||
|
||||
class LaunchesAdapter(itemClickListener: (LaunchEntity) -> Unit) : BasePagingListAdapter<LaunchEntity>(
|
||||
getDiffCallbackForType { oldItem, newItem -> oldItem.id == newItem.id },
|
||||
createDiffCallback { oldItem, newItem -> oldItem.id == newItem.id },
|
||||
itemClickListener
|
||||
) {
|
||||
|
||||
//region Functions
|
||||
|
||||
override fun createViewHolder(
|
||||
inflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): BaseViewHolder<LaunchEntity> =
|
||||
LaunchesViewHolder(LaunchRowBinding.inflate(inflater, parent, false))
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
class LaunchesViewHolder(private val binding: LaunchRowBinding) : BaseViewHolder<LaunchEntity>(binding) {
|
||||
|
||||
//region Functions
|
||||
|
||||
override fun bind(item: LaunchEntity) {
|
||||
binding.entity = item
|
||||
|
||||
@@ -31,4 +36,5 @@ class LaunchesViewHolder(private val binding: LaunchRowBinding) : BaseViewHolder
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Uses [GetLaunches] to get data for pagination
|
||||
*/
|
||||
class LaunchesPagingSource @Inject constructor(
|
||||
private val getLaunches: GetLaunches,
|
||||
private val getLaunchesParams: GetLaunches.Params
|
||||
|
||||
@@ -10,5 +10,8 @@ class LaunchesPagingSourceFactory @Inject constructor(
|
||||
private val sourceProvider: Provider<LaunchesPagingSource>
|
||||
) : BasePagingFactory<LaunchEntity>() {
|
||||
|
||||
//region Functions
|
||||
|
||||
override fun createSource(): BasePagingDataSource<LaunchEntity> = sourceProvider.get()
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -12,34 +12,12 @@ class LaunchesViewModel @Inject constructor(
|
||||
private val launchesPagingConfig: PagedList.Config
|
||||
) : BasePagingViewModel<LaunchEntity>() {
|
||||
|
||||
// region Properties
|
||||
//region Properties
|
||||
|
||||
override val factory: BasePagingFactory<LaunchEntity>
|
||||
get() = launchesPagingSourceFactory
|
||||
|
||||
override val config: PagedList.Config
|
||||
get() = launchesPagingConfig
|
||||
|
||||
//private val _filteredItems = MediatorLiveData<PagedList<LaunchEntity>>()
|
||||
|
||||
//val filteredItems: LiveData<PagedList<LaunchEntity>>
|
||||
// get() = _filteredItems
|
||||
// endregion
|
||||
|
||||
//init {
|
||||
// _filteredItems.addSource(pagedList, _filteredItems::setValue)
|
||||
//}
|
||||
|
||||
// region Functions
|
||||
|
||||
//fun filterItemListBy(query: String?) {
|
||||
//
|
||||
// _filteredItems.value = if (!query.isNullOrBlank()) {
|
||||
// pagedList.value
|
||||
// ?.snapshot() as PagedList<LaunchEntity>
|
||||
// } else {
|
||||
// pagedList.value
|
||||
// }
|
||||
//}
|
||||
// endregion
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
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">
|
||||
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">
|
||||
|
||||
<data class="ListBinding">
|
||||
<data class="ListBinding">
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.melih.list.ui.vm.LaunchesViewModel" />
|
||||
</data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.melih.list.ui.vm.LaunchesViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.melih.core.utils.SnackbarBehaviour">
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
app:layout_behavior="com.melih.core.utils.SnackbarBehaviour">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rocketList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layoutAnimation="@anim/layout_item_enter"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:listitem="@layout/row_launch" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rocketList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@null"
|
||||
android:layoutAnimation="@anim/layout_item_enter"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/row_launch" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</layout>
|
||||
|
||||
@@ -1,77 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
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">
|
||||
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">
|
||||
|
||||
<data class="LaunchRowBinding">
|
||||
<data class="LaunchRowBinding">
|
||||
|
||||
<variable
|
||||
name="entity"
|
||||
type="com.melih.repository.entities.LaunchEntity" />
|
||||
</data>
|
||||
<variable
|
||||
name="entity"
|
||||
type="com.melih.repository.entities.LaunchEntity" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
app:cardCornerRadius="@dimen/corner_radius_standard"
|
||||
app:cardElevation="10dp">
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginTop="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:background="@null"
|
||||
app:cardElevation="10dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgRocket"
|
||||
imageUrl="@{entity.rocket.imageURL}"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:contentDescription="@string/cd_rocket_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars[14]" />
|
||||
<ImageView
|
||||
android:id="@+id/imgRocket"
|
||||
imageUrl="@{entity.rocket.imageURL}"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginStart="@dimen/padding_large"
|
||||
android:contentDescription="@string/cd_rocket_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars[14]" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
style="@style/ShortDescriptionTextStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:textAppearance="@style/DescriptionTextAppearance"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imgRocket"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imgRocket"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
|
||||
tools:text="@sample/launches.json/launches/missions/description" />
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/AppTheme.TextViewStyle.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_large"
|
||||
android:text="@{entity.name}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imgRocket"
|
||||
app:layout_constraintTop_toTopOf="@+id/imgRocket"
|
||||
tools:text="@sample/launches.json/launches/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
style="@style/TitleTextStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginLeft="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_standard"
|
||||
android:layout_marginRight="@dimen/padding_standard"
|
||||
android:text="@{entity.name}"
|
||||
android:textAppearance="@style/TitleTextAppearance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imgRocket"
|
||||
app:layout_constraintTop_toTopOf="@+id/imgRocket"
|
||||
tools:text="@sample/launches.json/launches/name" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tvDescription"
|
||||
style="@style/AppTheme.TextViewStyle.Description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/padding_standard"
|
||||
android:layout_marginEnd="@dimen/padding_large"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imgRocket"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imgRocket"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
|
||||
tools:text="@sample/launches.json/launches/missions/description" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user