formatting

This commit is contained in:
Felix 2020-04-04 19:57:12 +02:00
parent 9f51e7be92
commit 8c3d182239
10 changed files with 23 additions and 24 deletions

View file

@ -7,4 +7,4 @@ data class ImportItem(
val lecture: FahrplanLecture,
var event: Event?,
var selected: Boolean = false
)
)

View file

@ -3,4 +3,4 @@ package de.nicidienase.chaosflix.common.eventimport
data class FahrplanExport(
val conference: String,
val lectures: List<FahrplanLecture>
)
)

View file

@ -3,11 +3,11 @@ package de.nicidienase.chaosflix.common.eventimport
import com.google.gson.annotations.SerializedName
data class FahrplanLecture(
@SerializedName("lecture_id")
var lectureId: String? = null,
var title: String,
var subtitle: String? = null,
var links: String? = null,
var track: String? = null,
var description: String? = null
)
@SerializedName("lecture_id")
var lectureId: String? = null,
var title: String,
var subtitle: String? = null,
var links: String? = null,
var track: String? = null,
var description: String? = null
)

View file

@ -236,7 +236,7 @@ class MediaRepository(
if (searchEvents.events.isNotEmpty()) {
val eventDto = searchEvents.events[0]
val conference = updateConferencesAndGet(eventDto.conferenceUrl.split("/").last())
if(updateConference && conference != null){
if (updateConference && conference != null) {
updateEventsForConference(conference)
}
if (conference?.id != null) {

View file

@ -9,7 +9,6 @@ import androidx.lifecycle.viewModelScope
import com.google.gson.Gson
import de.nicidienase.chaosflix.common.ImportItem
import de.nicidienase.chaosflix.common.eventimport.FahrplanExport
import de.nicidienase.chaosflix.common.eventimport.FahrplanLecture
import de.nicidienase.chaosflix.common.mediadata.MediaRepository
import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItem
import de.nicidienase.chaosflix.common.util.LiveEvent
@ -37,8 +36,8 @@ class FavoritesImportViewModel(
val working: LiveData<Boolean>
get() = _working
private val _processCount = MutableLiveData<Pair<Int,Int>> (0 to 0)
val processCount: LiveData<Pair<Int,Int>>
private val _processCount = MutableLiveData<Pair<Int, Int>> (0 to 0)
val processCount: LiveData<Pair<Int, Int>>
get() = _processCount
val importItemCount: LiveData<Int> = Transformations.map(items) { items ->

View file

@ -67,4 +67,4 @@ class ViewModelFactory private constructor(context: Context) : ViewModelProvider
}
companion object : SingletonHolder<ViewModelFactory, Context>(::ViewModelFactory)
}
}

View file

@ -95,4 +95,4 @@ internal class FavoritesImportViewModelTest {
"\"links\":\"2019-12-30\"}" +
"]}"
}
}
}

View file

@ -5,8 +5,8 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import de.nicidienase.chaosflix.touch.databinding.ItemFavoritImportBinding
import de.nicidienase.chaosflix.common.ImportItem
import de.nicidienase.chaosflix.touch.databinding.ItemFavoritImportBinding
import java.lang.NumberFormatException
class ImportItemAdapter(private val onListItemClick: ((ImportItem) -> Unit)? = null) : ListAdapter<ImportItem, ImportItemAdapter.ViewHolder>(
@ -44,4 +44,4 @@ class ImportItemAdapter(private val onListItemClick: ((ImportItem) -> Unit)? = n
}
class ViewHolder(val binding: ItemFavoritImportBinding) : RecyclerView.ViewHolder(binding.root)
}
}

View file

@ -18,4 +18,4 @@ class FavoritesImportActivity : AppCompatActivity() {
companion object {
private val TAG = FavoritesImportActivity::class.java.simpleName
}
}
}

View file

@ -66,11 +66,11 @@ class FavoritesImportFragment : Fragment() {
viewModel.working.observe(viewLifecycleOwner, Observer { working ->
binding.incOverlay.loadingOverlay.visibility = if (working) View.VISIBLE else View.GONE
})
viewModel.processCount.observe(viewLifecycleOwner, Observer {pair ->
Log.i(TAG,"Progress ${pair.first}/${pair.second}")
viewModel.processCount.observe(viewLifecycleOwner, Observer { pair ->
Log.i(TAG, "Progress ${pair.first}/${pair.second}")
binding.incOverlay.progressbar.apply {
if(pair.second != 0){
visibility = View.VISIBLE
if (pair.second != 0) {
visibility = View.VISIBLE
progress = (100 * pair.first / pair.second)
}
}
@ -142,4 +142,4 @@ class FavoritesImportFragment : Fragment() {
companion object {
private val TAG = FavoritesImportFragment::class.java.simpleName
}
}
}