mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Open audio player from three dot menu
This commit is contained in:
parent
df40c8e50d
commit
4e9273f7cb
@ -27,12 +27,14 @@ import com.github.libretube.constants.IntentData
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.databinding.ActivityMainBinding
|
||||
import com.github.libretube.extensions.toID
|
||||
import com.github.libretube.helpers.BackgroundHelper
|
||||
import com.github.libretube.helpers.NavBarHelper
|
||||
import com.github.libretube.helpers.NavigationHelper
|
||||
import com.github.libretube.helpers.NetworkHelper
|
||||
import com.github.libretube.helpers.PreferenceHelper
|
||||
import com.github.libretube.helpers.ThemeHelper
|
||||
import com.github.libretube.helpers.WindowHelper
|
||||
import com.github.libretube.services.BackgroundMode
|
||||
import com.github.libretube.services.ClosingService
|
||||
import com.github.libretube.ui.base.BaseActivity
|
||||
import com.github.libretube.ui.dialogs.ErrorDialog
|
||||
@ -254,6 +256,12 @@ class MainActivity : BaseActivity() {
|
||||
searchView.onActionViewCollapsed()
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||
menu?.findItem(R.id.action_audio)?.isVisible = BackgroundHelper
|
||||
.isServiceRunning(this, BackgroundMode::class.java)
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
menuInflater.inflate(R.menu.action_bar, menu)
|
||||
@ -355,6 +363,10 @@ class MainActivity : BaseActivity() {
|
||||
startActivity(helpIntent)
|
||||
true
|
||||
}
|
||||
R.id.action_audio -> {
|
||||
navController.navigate(R.id.audioPlayerFragment)
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
@ -25,4 +25,10 @@
|
||||
android:title="@string/about"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:visible="false"
|
||||
android:id="@+id/action_audio"
|
||||
android:title="@string/audio_player"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user