Initial setup for flavors and Chromecast support.
This commit is contained in:
parent
2b9eb789e8
commit
f2d6281d7f
|
@ -77,6 +77,22 @@ android {
|
|||
proguardFile("proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions("version")
|
||||
|
||||
productFlavors {
|
||||
create("full") {
|
||||
setDimension("version")
|
||||
|
||||
applicationId = "com.github.apognu.otter"
|
||||
}
|
||||
|
||||
create("foss") {
|
||||
setDimension("version")
|
||||
|
||||
applicationId = "com.github.apognu.otter.foss"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ktlint {
|
||||
|
@ -122,4 +138,7 @@ dependencies {
|
|||
implementation("com.google.code.gson:gson:2.8.5")
|
||||
implementation("com.squareup.picasso:picasso:2.71828")
|
||||
implementation("jp.wasabeef:picasso-transformations:2.2.1")
|
||||
|
||||
"fullImplementation"("com.google.android.gms:play-services-cast-framework:18.1.0")
|
||||
"fullImplementation"("com.google.android.exoplayer:extension-cast:2.11.5")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.github.apognu.otter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Menu
|
||||
import com.github.apognu.otter.utils.log
|
||||
|
||||
object Cast {
|
||||
fun init(context: Context) {}
|
||||
fun setupButton(context: Context, menu: Menu?) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:node="merge">
|
||||
|
||||
<application>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||
android:value="com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,17 @@
|
|||
package com.github.apognu.otter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Menu
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||
import com.google.android.gms.cast.framework.CastContext
|
||||
|
||||
object Cast {
|
||||
fun init(context: Context) {
|
||||
CastContext.getSharedInstance(context)
|
||||
}
|
||||
|
||||
fun setupButton(context: Context, menu: Menu?) {
|
||||
CastButtonFactory.setUpMediaRouteButton(context, menu, R.id.cast)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.github.apognu.otter">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.github.apognu.otter"
|
||||
tools:node="merge">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
@ -17,10 +19,6 @@
|
|||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<!-- <meta-data
|
||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||
android:value="com.google.android.exoplayer2.ext.cast.DefaultCastOptionsProvider"/> -->
|
||||
|
||||
<activity
|
||||
android:name="com.github.apognu.otter.activities.SplashActivity"
|
||||
android:launchMode="singleInstance"
|
||||
|
|
|
@ -19,6 +19,7 @@ import androidx.core.graphics.drawable.toDrawable
|
|||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.github.apognu.otter.Cast
|
||||
import com.github.apognu.otter.R
|
||||
import com.github.apognu.otter.fragments.*
|
||||
import com.github.apognu.otter.playback.MediaControlsManager
|
||||
|
@ -157,7 +158,7 @@ class MainActivity : AppCompatActivity() {
|
|||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.toolbar, menu)
|
||||
|
||||
// CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.cast)
|
||||
Cast.setupButton(applicationContext, menu)
|
||||
|
||||
menu?.findItem(R.id.nav_only_my_music)?.isChecked = Settings.getScope() == "me"
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.content.BroadcastReceiver
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.github.apognu.otter.Cast
|
||||
import com.github.apognu.otter.R
|
||||
import com.github.kittinunf.fuel.core.FuelManager
|
||||
import com.github.kittinunf.fuel.core.Method
|
||||
|
@ -26,7 +27,7 @@ object AppContext {
|
|||
fun init(context: Activity) {
|
||||
setupNotificationChannels(context)
|
||||
|
||||
// CastContext.getSharedInstance(context)
|
||||
Cast.init(context)
|
||||
|
||||
FuelManager.instance.addResponseInterceptor { next ->
|
||||
{ request, response ->
|
||||
|
|
|
@ -68,6 +68,7 @@ sealed class Response {
|
|||
object EventBus {
|
||||
fun send(event: Event) {
|
||||
GlobalScope.launch(IO) {
|
||||
Otter.get().eventBus.log()
|
||||
Otter.get().eventBus.offer(event)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,20 +6,19 @@
|
|||
android:id="@+id/nav_queue"
|
||||
android:icon="@drawable/queue"
|
||||
android:title="@string/playback_queue"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="always" />
|
||||
|
||||
<!-- <item
|
||||
<item
|
||||
android:id="@+id/cast"
|
||||
android:iconTint="@android:color/white"
|
||||
android:title="@string/toolbar_cast"
|
||||
android:title="Cast!"
|
||||
app:actionProviderClass="androidx.mediarouter.app.MediaRouteActionProvider"
|
||||
app:showAsAction="ifRoom" /> -->
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_search"
|
||||
android:icon="@drawable/search"
|
||||
android:title="@string/toolbar_search"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_only_my_music"
|
||||
|
@ -36,7 +35,6 @@
|
|||
<item
|
||||
android:id="@+id/settings"
|
||||
android:icon="@drawable/settings"
|
||||
android:iconTint="@android:color/white"
|
||||
android:title="@string/title_settings"
|
||||
app:showAsAction="never" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue