Updated translations

This commit is contained in:
h4h13 2019-11-21 20:10:02 +05:30
parent 7e8054eab9
commit f922e29071
19 changed files with 471 additions and 1138 deletions

View file

@ -16,53 +16,48 @@ package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.Result
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.mvp.BaseView
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
import code.name.monkey.retromusic.mvp.*
import code.name.monkey.retromusic.providers.interfaces.Repository
import kotlinx.coroutines.*
import java.util.*
import javax.inject.Inject
import kotlin.coroutines.CoroutineContext
/**
* Created by hemanths on 12/08/17.
*/
interface AlbumsView : BaseView {
fun albums(albums: ArrayList<Album>)
fun albums(albums: ArrayList<Album>)
}
interface AlbumsPresenter : Presenter<AlbumsView> {
fun loadAlbums()
fun loadAlbums()
class AlbumsPresenterImpl @Inject constructor(
private val repository: Repository
) : PresenterImpl<AlbumsView>(), AlbumsPresenter, CoroutineScope {
private val job = Job()
class AlbumsPresenterImpl @Inject constructor(
private val repository: Repository
) : PresenterImpl<AlbumsView>(), AlbumsPresenter, CoroutineScope {
private val job = Job()
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + job
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + job
override fun detachView() {
super.detachView()
job.cancel()
}
override fun detachView() {
super.detachView()
job.cancel()
}
override fun loadAlbums() {
launch {
when (val result = repository.allAlbums()) {
is Result.Success -> {
withContext(Dispatchers.Main) {
view?.albums(result.data)
}
}
is Result.Error -> {
view?.showEmptyView()
}
}
}
}
}
override fun loadAlbums() {
launch {
when (val result = repository.allAlbums()) {
is Result.Success -> {
withContext(Dispatchers.Main) {
view?.albums(result.data)
}
}
is Result.Error -> withContext(Dispatchers.Main) { view?.showEmptyView() }
}
}
}
}
}

View file

@ -16,9 +16,7 @@ package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.Result
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.mvp.BaseView
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
import code.name.monkey.retromusic.mvp.*
import code.name.monkey.retromusic.providers.interfaces.Repository
import kotlinx.coroutines.*
import javax.inject.Inject
@ -57,9 +55,7 @@ interface PlaylistsPresenter : Presenter<PlaylistView> {
is Result.Success -> withContext(Dispatchers.Main) {
view?.playlists(result.data)
}
is Result.Error -> withContext(Dispatchers.Main) {
view?.showEmptyView()
}
is Result.Error -> withContext(Dispatchers.Main) { view?.showEmptyView() }
}
}
}

View file

@ -15,11 +15,8 @@
package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.Result
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.mvp.BaseView
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.mvp.*
import code.name.monkey.retromusic.providers.interfaces.Repository
import kotlinx.coroutines.*
import javax.inject.Inject
@ -50,9 +47,7 @@ interface PlaylistSongsPresenter : Presenter<PlaylistSongsView> {
is Result.Success -> withContext(Dispatchers.Main) {
view?.songs(songs.data)
}
is Result.Error -> withContext(Dispatchers.Main) {
view?.showEmptyView()
}
is Result.Error -> withContext(Dispatchers.Main) { view?.showEmptyView() }
}
}
}

View file

@ -16,8 +16,7 @@ package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.Result
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
import code.name.monkey.retromusic.mvp.*
import code.name.monkey.retromusic.providers.interfaces.Repository
import kotlinx.coroutines.*
import java.util.*
@ -28,36 +27,36 @@ import kotlin.coroutines.CoroutineContext
* Created by hemanths on 10/08/17.
*/
interface SongView {
fun songs(songs: ArrayList<Song>)
fun songs(songs: ArrayList<Song>)
fun showEmptyView()
fun showEmptyView()
}
interface SongPresenter : Presenter<SongView> {
fun loadSongs()
class SongPresenterImpl @Inject constructor(
private val repository: Repository
) : PresenterImpl<SongView>(), SongPresenter, CoroutineScope {
fun loadSongs()
class SongPresenterImpl @Inject constructor(
private val repository: Repository
) : PresenterImpl<SongView>(), SongPresenter, CoroutineScope {
private var job: Job = Job()
private var job: Job = Job()
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + job
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + job
override fun loadSongs() {
launch {
when (val songs = repository.allSongs()) {
is Result.Success -> withContext(Dispatchers.Main) { view?.songs(songs.data) }
is Result.Error -> view?.showEmptyView()
}
}
}
override fun loadSongs() {
launch {
when (val songs = repository.allSongs()) {
is Result.Success -> withContext(Dispatchers.Main) { view?.songs(songs.data) }
is Result.Error -> withContext(Dispatchers.Main) { view?.showEmptyView() }
}
}
}
override fun detachView() {
super.detachView()
job.cancel();
}
}
override fun detachView() {
super.detachView()
job.cancel();
}
}
}