Remove dagger
This commit is contained in:
parent
8a2b803286
commit
0f8b64534f
18 changed files with 33 additions and 249 deletions
|
@ -124,14 +124,14 @@ dependencies {
|
||||||
implementation 'androidx.annotation:annotation:1.1.0'
|
implementation 'androidx.annotation:annotation:1.1.0'
|
||||||
implementation 'androidx.preference:preference:1.1.1'
|
implementation 'androidx.preference:preference:1.1.1'
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.2.0'
|
implementation 'androidx.core:core-ktx:1.3.0'
|
||||||
implementation 'androidx.fragment:fragment-ktx:1.2.4'
|
implementation 'androidx.fragment:fragment-ktx:1.2.5'
|
||||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||||
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.2.0-alpha06'
|
implementation 'com.google.android.material:material:1.3.0-alpha01'
|
||||||
|
|
||||||
def retrofit_version = '2.8.1'
|
def retrofit_version = '2.8.1'
|
||||||
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
|
||||||
|
@ -170,10 +170,6 @@ dependencies {
|
||||||
implementation 'com.heinrichreimersoftware:material-intro:1.6'
|
implementation 'com.heinrichreimersoftware:material-intro:1.6'
|
||||||
implementation 'me.zhanghai.android.fastscroll:library:1.1.0'
|
implementation 'me.zhanghai.android.fastscroll:library:1.1.0'
|
||||||
|
|
||||||
def dagger_version = '2.27'
|
|
||||||
implementation "com.google.dagger:dagger:$dagger_version"
|
|
||||||
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
|
||||||
|
|
||||||
def lifecycle_version = "2.2.0"
|
def lifecycle_version = "2.2.0"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
||||||
|
|
|
@ -18,10 +18,8 @@ import android.widget.Toast
|
||||||
import androidx.multidex.MultiDexApplication
|
import androidx.multidex.MultiDexApplication
|
||||||
import code.name.monkey.appthemehelper.ThemeStore
|
import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.VersionUtils
|
import code.name.monkey.appthemehelper.util.VersionUtils
|
||||||
|
import code.name.monkey.retromusic.Constants.PRO_VERSION_PRODUCT_ID
|
||||||
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
|
||||||
import code.name.monkey.retromusic.dagger.DaggerMusicComponent
|
|
||||||
import code.name.monkey.retromusic.dagger.MusicComponent
|
|
||||||
import code.name.monkey.retromusic.dagger.module.AppModule
|
|
||||||
import com.anjlab.android.iab.v3.BillingProcessor
|
import com.anjlab.android.iab.v3.BillingProcessor
|
||||||
import com.anjlab.android.iab.v3.TransactionDetails
|
import com.anjlab.android.iab.v3.TransactionDetails
|
||||||
|
|
||||||
|
@ -32,7 +30,6 @@ class App : MultiDexApplication() {
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
instance = this
|
instance = this
|
||||||
musicComponent = initDagger(this)
|
|
||||||
|
|
||||||
// default theme
|
// default theme
|
||||||
if (!ThemeStore.isConfigured(this, 3)) {
|
if (!ThemeStore.isConfigured(this, 3)) {
|
||||||
|
@ -64,11 +61,6 @@ class App : MultiDexApplication() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initDagger(app: App): MusicComponent =
|
|
||||||
DaggerMusicComponent.builder()
|
|
||||||
.appModule(AppModule(app))
|
|
||||||
.build()
|
|
||||||
|
|
||||||
override fun onTerminate() {
|
override fun onTerminate() {
|
||||||
super.onTerminate()
|
super.onTerminate()
|
||||||
billingProcessor.release()
|
billingProcessor.release()
|
||||||
|
@ -86,9 +78,5 @@ class App : MultiDexApplication() {
|
||||||
PRO_VERSION_PRODUCT_ID
|
PRO_VERSION_PRODUCT_ID
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var musicComponent: MusicComponent
|
|
||||||
|
|
||||||
const val PRO_VERSION_PRODUCT_ID = "pro_version"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import android.provider.BaseColumns
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
|
const val PRO_VERSION_PRODUCT_ID = "pro_version"
|
||||||
const val RATE_ON_GOOGLE_PLAY =
|
const val RATE_ON_GOOGLE_PLAY =
|
||||||
"https://play.google.com/store/apps/details?id=code.name.monkey.retromusic"
|
"https://play.google.com/store/apps/details?id=code.name.monkey.retromusic"
|
||||||
const val TRANSLATE = "https://github.com/h4h13/RetroMusicPlayer"
|
const val TRANSLATE = "https://github.com/h4h13/RetroMusicPlayer"
|
||||||
|
|
|
@ -8,7 +8,6 @@ import androidx.recyclerview.widget.DefaultItemAnimator
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.retromusic.App
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||||
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
|
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
|
||||||
|
@ -18,13 +17,14 @@ import code.name.monkey.retromusic.interfaces.CabHolder
|
||||||
import code.name.monkey.retromusic.model.Genre
|
import code.name.monkey.retromusic.model.Genre
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
||||||
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter.GenreDetailsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
|
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsView
|
||||||
|
import code.name.monkey.retromusic.providers.RepositoryImpl
|
||||||
import code.name.monkey.retromusic.util.DensityUtil
|
import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
import com.afollestad.materialcab.MaterialCab
|
import com.afollestad.materialcab.MaterialCab
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hemanth S (h4h13).
|
* @author Hemanth S (h4h13).
|
||||||
|
@ -32,9 +32,8 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDetailsView {
|
class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDetailsView {
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var genreDetailsPresenter: GenreDetailsPresenter
|
|
||||||
|
|
||||||
|
private lateinit var genreDetailsPresenter: GenreDetailsPresenter
|
||||||
private lateinit var genre: Genre
|
private lateinit var genre: Genre
|
||||||
private lateinit var songAdapter: ShuffleButtonSongAdapter
|
private lateinit var songAdapter: ShuffleButtonSongAdapter
|
||||||
private var cab: MaterialCab? = null
|
private var cab: MaterialCab? = null
|
||||||
|
@ -71,7 +70,8 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet
|
||||||
setUpToolBar()
|
setUpToolBar()
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
|
|
||||||
App.musicComponent.inject(this)
|
genreDetailsPresenter =
|
||||||
|
GenreDetailsPresenterImpl(RepositoryImpl(this))
|
||||||
genreDetailsPresenter.attachView(this)
|
genreDetailsPresenter.attachView(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.view.View
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.retromusic.App
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity
|
||||||
import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
|
import code.name.monkey.retromusic.adapter.song.OrderablePlaylistSongAdapter
|
||||||
|
@ -21,7 +20,9 @@ import code.name.monkey.retromusic.model.AbsCustomPlaylist
|
||||||
import code.name.monkey.retromusic.model.Playlist
|
import code.name.monkey.retromusic.model.Playlist
|
||||||
import code.name.monkey.retromusic.model.Song
|
import code.name.monkey.retromusic.model.Song
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
|
||||||
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter.PlaylistSongsPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsView
|
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsView
|
||||||
|
import code.name.monkey.retromusic.providers.RepositoryImpl
|
||||||
import code.name.monkey.retromusic.util.DensityUtil
|
import code.name.monkey.retromusic.util.DensityUtil
|
||||||
import code.name.monkey.retromusic.util.PlaylistsUtil
|
import code.name.monkey.retromusic.util.PlaylistsUtil
|
||||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||||
|
@ -30,13 +31,11 @@ import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemA
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
||||||
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
import kotlinx.android.synthetic.main.activity_playlist_detail.*
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
|
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var playlistSongsPresenter: PlaylistSongsPresenter
|
|
||||||
|
|
||||||
|
private lateinit var presenter: PlaylistSongsPresenter
|
||||||
private lateinit var playlist: Playlist
|
private lateinit var playlist: Playlist
|
||||||
private var cab: MaterialCab? = null
|
private var cab: MaterialCab? = null
|
||||||
private lateinit var adapter: SongAdapter
|
private lateinit var adapter: SongAdapter
|
||||||
|
@ -52,8 +51,8 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
||||||
setLightNavigationBar(true)
|
setLightNavigationBar(true)
|
||||||
setBottomBarVisibility(View.GONE)
|
setBottomBarVisibility(View.GONE)
|
||||||
|
|
||||||
App.musicComponent.inject(this)
|
presenter = PlaylistSongsPresenterImpl(RepositoryImpl(this))
|
||||||
playlistSongsPresenter.attachView(this)
|
presenter.attachView(this)
|
||||||
|
|
||||||
if (intent.extras != null) {
|
if (intent.extras != null) {
|
||||||
playlist = intent.extras!!.getParcelable(EXTRA_PLAYLIST)!!
|
playlist = intent.extras!!.getParcelable(EXTRA_PLAYLIST)!!
|
||||||
|
@ -114,7 +113,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
playlistSongsPresenter.loadPlaylistSongs(playlist)
|
presenter.loadPlaylistSongs(playlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpToolBar() {
|
private fun setUpToolBar() {
|
||||||
|
@ -181,7 +180,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
||||||
setToolbarTitle(playlist.name)
|
setToolbarTitle(playlist.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playlistSongsPresenter.loadPlaylistSongs(playlist)
|
presenter.loadPlaylistSongs(playlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolbarTitle(title: String) {
|
private fun setToolbarTitle(title: String) {
|
||||||
|
@ -227,7 +226,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
||||||
wrappedAdapter = null
|
wrappedAdapter = null
|
||||||
}
|
}
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
playlistSongsPresenter.detachView()
|
presenter.detachView()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showEmptyView() {
|
override fun showEmptyView() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.MaterialUtil
|
import code.name.monkey.appthemehelper.util.MaterialUtil
|
||||||
import code.name.monkey.retromusic.App
|
import code.name.monkey.retromusic.App
|
||||||
import code.name.monkey.retromusic.BuildConfig
|
import code.name.monkey.retromusic.BuildConfig
|
||||||
|
import code.name.monkey.retromusic.Constants.PRO_VERSION_PRODUCT_ID
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||||
import com.anjlab.android.iab.v3.BillingProcessor
|
import com.anjlab.android.iab.v3.BillingProcessor
|
||||||
|
@ -49,7 +50,7 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
purchaseButton.setOnClickListener {
|
purchaseButton.setOnClickListener {
|
||||||
billingProcessor.purchase(this@PurchaseActivity, App.PRO_VERSION_PRODUCT_ID)
|
billingProcessor.purchase(this@PurchaseActivity, PRO_VERSION_PRODUCT_ID)
|
||||||
}
|
}
|
||||||
bannerContainer.backgroundTintList =
|
bannerContainer.backgroundTintList =
|
||||||
ColorStateList.valueOf(ThemeStore.accentColor(this))
|
ColorStateList.valueOf(ThemeStore.accentColor(this))
|
||||||
|
|
|
@ -21,23 +21,22 @@ import code.name.monkey.appthemehelper.ThemeStore
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import code.name.monkey.retromusic.App
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
||||||
import code.name.monkey.retromusic.adapter.SearchAdapter
|
import code.name.monkey.retromusic.adapter.SearchAdapter
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
||||||
|
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter.SearchPresenterImpl
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchView
|
import code.name.monkey.retromusic.mvp.presenter.SearchView
|
||||||
|
import code.name.monkey.retromusic.providers.RepositoryImpl
|
||||||
import code.name.monkey.retromusic.util.RetroUtil
|
import code.name.monkey.retromusic.util.RetroUtil
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import kotlinx.android.synthetic.main.activity_search.*
|
import kotlinx.android.synthetic.main.activity_search.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatcher, SearchView {
|
class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatcher, SearchView {
|
||||||
@Inject
|
|
||||||
lateinit var searchPresenter: SearchPresenter
|
|
||||||
|
|
||||||
|
private lateinit var presenter: SearchPresenter
|
||||||
private var searchAdapter: SearchAdapter? = null
|
private var searchAdapter: SearchAdapter? = null
|
||||||
private var query: String? = null
|
private var query: String? = null
|
||||||
|
|
||||||
|
@ -50,8 +49,8 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
setTaskDescriptionColorAuto()
|
setTaskDescriptionColorAuto()
|
||||||
setLightNavigationBar(true)
|
setLightNavigationBar(true)
|
||||||
|
|
||||||
App.musicComponent.inject(this)
|
presenter = SearchPresenterImpl(RepositoryImpl(this))
|
||||||
searchPresenter.attachView(this)
|
presenter.attachView(this)
|
||||||
|
|
||||||
setupRecyclerView()
|
setupRecyclerView()
|
||||||
setUpToolBar()
|
setUpToolBar()
|
||||||
|
@ -117,7 +116,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
searchPresenter.detachView()
|
presenter.detachView()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
@ -134,7 +133,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
TransitionManager.beginDelayedTransition(appBarLayout)
|
TransitionManager.beginDelayedTransition(appBarLayout)
|
||||||
voiceSearch.visibility = if (query.isNotEmpty()) View.GONE else View.VISIBLE
|
voiceSearch.visibility = if (query.isNotEmpty()) View.GONE else View.VISIBLE
|
||||||
clearText.visibility = if (query.isNotEmpty()) View.VISIBLE else View.GONE
|
clearText.visibility = if (query.isNotEmpty()) View.VISIBLE else View.GONE
|
||||||
searchPresenter.search(query)
|
presenter.search(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMediaStoreChanged() {
|
override fun onMediaStoreChanged() {
|
||||||
|
@ -176,7 +175,7 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
||||||
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
|
||||||
query = result?.get(0)
|
query = result?.get(0)
|
||||||
searchView.setText(query, BufferType.EDITABLE)
|
searchView.setText(query, BufferType.EDITABLE)
|
||||||
searchPresenter.search(query!!)
|
presenter.search(query!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Hemanth Savarala.
|
|
||||||
*
|
|
||||||
* Licensed under the GNU General Public License v3
|
|
||||||
*
|
|
||||||
* This is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package code.name.monkey.retromusic.dagger
|
|
||||||
|
|
||||||
import code.name.monkey.retromusic.activities.artists.ArtistDetailActivity
|
|
||||||
import code.name.monkey.retromusic.activities.GenreDetailsActivity
|
|
||||||
import code.name.monkey.retromusic.activities.PlaylistDetailActivity
|
|
||||||
import code.name.monkey.retromusic.activities.SearchActivity
|
|
||||||
import code.name.monkey.retromusic.dagger.module.AppModule
|
|
||||||
import code.name.monkey.retromusic.dagger.module.PresenterModule
|
|
||||||
import code.name.monkey.retromusic.fragments.albums.AlbumsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.genres.GenresFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.home.BannerHomeFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment
|
|
||||||
import code.name.monkey.retromusic.fragments.songs.SongsFragment
|
|
||||||
import dagger.Component
|
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by hemanths on 2019-09-04.
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
@Component(
|
|
||||||
modules = [
|
|
||||||
AppModule::class,
|
|
||||||
PresenterModule::class
|
|
||||||
]
|
|
||||||
)
|
|
||||||
interface MusicComponent {
|
|
||||||
|
|
||||||
fun inject(songsFragment: SongsFragment)
|
|
||||||
|
|
||||||
fun inject(albumsFragment: AlbumsFragment)
|
|
||||||
|
|
||||||
fun inject(artistsFragment: ArtistsFragment)
|
|
||||||
|
|
||||||
fun inject(genresFragment: GenresFragment)
|
|
||||||
|
|
||||||
fun inject(playlistsFragment: PlaylistsFragment)
|
|
||||||
|
|
||||||
fun inject(artistDetailActivity: ArtistDetailActivity)
|
|
||||||
|
|
||||||
fun inject(playlistDetailActivity: PlaylistDetailActivity)
|
|
||||||
|
|
||||||
fun inject(genreDetailsActivity: GenreDetailsActivity)
|
|
||||||
|
|
||||||
fun inject(searchActivity: SearchActivity)
|
|
||||||
|
|
||||||
fun inject(bannerHomeFragment: BannerHomeFragment)
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Hemanth Savarala.
|
|
||||||
*
|
|
||||||
* Licensed under the GNU General Public License v3
|
|
||||||
*
|
|
||||||
* This is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package code.name.monkey.retromusic.dagger.module
|
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import android.content.Context
|
|
||||||
|
|
||||||
import dagger.Module
|
|
||||||
import dagger.Provides
|
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by hemanths on 2019-09-04.
|
|
||||||
*/
|
|
||||||
@Module
|
|
||||||
class AppModule(private val application: Application) {
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
fun provideContext(): Context = application
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019 Hemanth Savarala.
|
|
||||||
*
|
|
||||||
* Licensed under the GNU General Public License v3
|
|
||||||
*
|
|
||||||
* This is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package code.name.monkey.retromusic.dagger.module
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter.GenreDetailsPresenterImpl
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.PlaylistSongsPresenter.PlaylistSongsPresenterImpl
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter
|
|
||||||
import code.name.monkey.retromusic.mvp.presenter.SearchPresenter.SearchPresenterImpl
|
|
||||||
import code.name.monkey.retromusic.providers.RepositoryImpl
|
|
||||||
import code.name.monkey.retromusic.providers.interfaces.Repository
|
|
||||||
import dagger.Module
|
|
||||||
import dagger.Provides
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by hemanths on 2019-12-30.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Module
|
|
||||||
class PresenterModule {
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
fun providesRepository(context: Context): Repository {
|
|
||||||
return RepositoryImpl(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
fun providesGenreDetailsPresenter(presenter: GenreDetailsPresenterImpl): GenreDetailsPresenter {
|
|
||||||
return presenter
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
fun providesPlaylistSongPresenter(presenter: PlaylistSongsPresenterImpl): PlaylistSongsPresenter {
|
|
||||||
return presenter
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
fun providesSearchPresenter(presenter: SearchPresenterImpl): SearchPresenter {
|
|
||||||
return presenter
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,6 @@ import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import code.name.monkey.retromusic.App
|
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.adapter.GenreAdapter
|
import code.name.monkey.retromusic.adapter.GenreAdapter
|
||||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewFragment
|
||||||
|
@ -27,11 +26,6 @@ import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||||
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
|
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
|
||||||
MainActivityFragmentCallbacks {
|
MainActivityFragmentCallbacks {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
App.musicComponent.inject(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
mainActivity.libraryViewModel.allGenres().observe(
|
mainActivity.libraryViewModel.allGenres().observe(
|
||||||
|
|
|
@ -38,7 +38,7 @@ interface GenreDetailsView : BaseView {
|
||||||
interface GenreDetailsPresenter : Presenter<GenreDetailsView> {
|
interface GenreDetailsPresenter : Presenter<GenreDetailsView> {
|
||||||
fun loadGenreSongs(genreId: Int)
|
fun loadGenreSongs(genreId: Int)
|
||||||
|
|
||||||
class GenreDetailsPresenterImpl @Inject constructor(
|
class GenreDetailsPresenterImpl constructor(
|
||||||
private val repository: Repository
|
private val repository: Repository
|
||||||
) : PresenterImpl<GenreDetailsView>(), GenreDetailsPresenter, CoroutineScope {
|
) : PresenterImpl<GenreDetailsView>(), GenreDetailsPresenter, CoroutineScope {
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ interface HomeView : BaseView {
|
||||||
interface HomePresenter : Presenter<HomeView> {
|
interface HomePresenter : Presenter<HomeView> {
|
||||||
fun loadSections()
|
fun loadSections()
|
||||||
|
|
||||||
class HomePresenterImpl @Inject constructor(
|
class HomePresenterImpl constructor(
|
||||||
private val repository: Repository
|
private val repository: Repository
|
||||||
) : PresenterImpl<HomeView>(), HomePresenter, CoroutineScope {
|
) : PresenterImpl<HomeView>(), HomePresenter, CoroutineScope {
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ interface PlaylistSongsView : BaseView {
|
||||||
interface PlaylistSongsPresenter : Presenter<PlaylistSongsView> {
|
interface PlaylistSongsPresenter : Presenter<PlaylistSongsView> {
|
||||||
fun loadPlaylistSongs(playlist: Playlist)
|
fun loadPlaylistSongs(playlist: Playlist)
|
||||||
|
|
||||||
class PlaylistSongsPresenterImpl @Inject constructor(
|
class PlaylistSongsPresenterImpl constructor(
|
||||||
private val repository: Repository
|
private val repository: Repository
|
||||||
) : PresenterImpl<PlaylistSongsView>(), PlaylistSongsPresenter, CoroutineScope {
|
) : PresenterImpl<PlaylistSongsView>(), PlaylistSongsPresenter, CoroutineScope {
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ interface SearchPresenter : Presenter<SearchView> {
|
||||||
|
|
||||||
fun search(query: String?)
|
fun search(query: String?)
|
||||||
|
|
||||||
class SearchPresenterImpl @Inject constructor(
|
class SearchPresenterImpl constructor(
|
||||||
private val repository: Repository
|
private val repository: Repository
|
||||||
) : PresenterImpl<SearchView>(), SearchPresenter, CoroutineScope {
|
) : PresenterImpl<SearchView>(), SearchPresenter, CoroutineScope {
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,8 @@ import code.name.monkey.retromusic.providers.interfaces.Repository
|
||||||
import code.name.monkey.retromusic.rest.LastFmClient
|
import code.name.monkey.retromusic.rest.LastFmClient
|
||||||
import code.name.monkey.retromusic.rest.model.LastFmAlbum
|
import code.name.monkey.retromusic.rest.model.LastFmAlbum
|
||||||
import code.name.monkey.retromusic.rest.model.LastFmArtist
|
import code.name.monkey.retromusic.rest.model.LastFmArtist
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class RepositoryImpl @Inject constructor(private val context: Context) : Repository {
|
class RepositoryImpl constructor(private val context: Context) : Repository {
|
||||||
|
|
||||||
override suspend fun allAlbums(): List<Album> = AlbumLoader.getAllAlbums(context)
|
override suspend fun allAlbums(): List<Album> = AlbumLoader.getAllAlbums(context)
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package code.name.monkey.retromusic.util
|
|
||||||
|
|
||||||
import com.google.android.material.slider.Slider
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class SliderReadTimeLabelFormatter : Slider.LabelFormatter {
|
|
||||||
|
|
||||||
override fun getFormattedValue(value: Float): String {
|
|
||||||
var minutes: Long = value.toLong() / 1000 / 60
|
|
||||||
val seconds: Long = value.toLong() / 1000 % 60
|
|
||||||
return if (minutes < 60) {
|
|
||||||
String.format(
|
|
||||||
Locale.getDefault(),
|
|
||||||
"%01d:%02d",
|
|
||||||
minutes,
|
|
||||||
seconds
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
val hours = minutes / 60
|
|
||||||
minutes %= 60
|
|
||||||
String.format(
|
|
||||||
Locale.getDefault(),
|
|
||||||
"%d:%02d:%02d",
|
|
||||||
hours,
|
|
||||||
minutes,
|
|
||||||
seconds
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -27,7 +27,6 @@ import androidx.core.view.ViewCompat
|
||||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||||
import com.google.android.material.slider.Slider
|
|
||||||
|
|
||||||
object ViewUtil {
|
object ViewUtil {
|
||||||
|
|
||||||
|
@ -48,16 +47,6 @@ object ViewUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setProgressDrawable(progressSlider: Slider, color: Int, thumbTint: Boolean = false) {
|
|
||||||
if (thumbTint) {
|
|
||||||
progressSlider.thumbColor = ColorStateList.valueOf(color)
|
|
||||||
}
|
|
||||||
val colorWithAlpha = ColorUtil.withAlpha(color, 0.25f)
|
|
||||||
progressSlider.haloColor = ColorStateList.valueOf(colorWithAlpha)
|
|
||||||
progressSlider.haloRadius = 0
|
|
||||||
progressSlider.trackColorActive = ColorStateList.valueOf(color)
|
|
||||||
progressSlider.trackColorInactive = ColorStateList.valueOf(colorWithAlpha)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
|
fun setProgressDrawable(progressSlider: ProgressBar, newColor: Int) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue