Update codebase

Do a bunch of minor codebase changes that have accumulated.
This commit is contained in:
OxygenCobalt 2021-02-04 16:10:12 -07:00
parent 9c982ac512
commit a34850b9cb
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
14 changed files with 84 additions and 97 deletions

View file

@ -14,7 +14,7 @@
## About ## About
Auxio is a local music player designed to be simple, straightfoward, and customizable. It has a fast, reliable UI/UX, and it is not bloated with useless features. In short, **It plays music.** Auxio is a local music player designed to be simple, straightfoward, and customizable. It has a fast, reliable UI/UX, and it is not bloated with useless features. In short, **It plays music.** Auxio is still configurable however, with both the UI and behavior able to be changed to ones liking.
Unlike other music players, Auxio is based off of [ExoPlayer](https://exoplayer.dev/), allowing for much better listening experience compared to the native MediaPlayer API. Auxio's codebase is also designed to be extendable, allowing for the addition of features that are not included in the main app. Unlike other music players, Auxio is based off of [ExoPlayer](https://exoplayer.dev/), allowing for much better listening experience compared to the native MediaPlayer API. Auxio's codebase is also designed to be extendable, allowing for the addition of features that are not included in the main app.
@ -78,4 +78,4 @@ Auxio is Free Software: You can use, study share and improve it at your
will. Specifically you can redistribute and/or modify it under the terms of the will. Specifically you can redistribute and/or modify it under the terms of the
[GNU General Public License](https://www.gnu.org/licenses/gpl.html) as [GNU General Public License](https://www.gnu.org/licenses/gpl.html) as
published by the Free Software Foundation, either version 3 of the License, or published by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.

View file

@ -43,9 +43,8 @@ class MainActivity : AppCompatActivity() {
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
Intent(this, PlaybackService::class.java).also { // Start PlaybackService
startService(it) startService(Intent(this, PlaybackService::class.java))
}
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")

View file

@ -60,7 +60,7 @@ import org.oxycblt.auxio.settings.SettingsManager
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Callback, SettingsManager.Callback { class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Callback, SettingsManager.Callback {
private val player: SimpleExoPlayer by lazy { newPlayer() } private val player: SimpleExoPlayer by lazy(::newPlayer)
private val playbackManager = PlaybackStateManager.getInstance() private val playbackManager = PlaybackStateManager.getInstance()
private val settingsManager = SettingsManager.getInstance() private val settingsManager = SettingsManager.getInstance()
@ -456,8 +456,7 @@ class PlaybackService : Service(), Player.EventListener, PlaybackStateManager.Ca
* Handle a media button intent. * Handle a media button intent.
*/ */
private fun handleMediaButtonEvent(event: Intent): Boolean { private fun handleMediaButtonEvent(event: Intent): Boolean {
val item = event val item = event.getParcelableExtra<Parcelable>(Intent.EXTRA_KEY_EVENT) as KeyEvent
.getParcelableExtra<Parcelable>(Intent.EXTRA_KEY_EVENT) as KeyEvent
if (item.action == KeyEvent.ACTION_DOWN) { if (item.action == KeyEvent.ACTION_DOWN) {
return when (item.keyCode) { return when (item.keyCode) {

View file

@ -53,9 +53,8 @@ class SettingsListFragment : PreferenceFragmentCompat() {
pref.isVisible = true pref.isVisible = true
} }
pref.children.forEach { // If this preference is a category of its own, handle its own children
recursivelyHandleChildren(it) pref.children.forEach { recursivelyHandleChildren(it) }
}
} else { } else {
handlePreference(pref) handlePreference(pref)
} }

View file

@ -189,8 +189,6 @@ class SongsFragment : Fragment() {
) )
} }
binding.songFastScrollThumb.apply { binding.songFastScrollThumb.setupWithFastScroller(binding.songFastScroll)
setupWithFastScroller(binding.songFastScroll)
}
} }
} }

View file

@ -57,8 +57,6 @@ data class Accent(
/** /**
* Get the name (in bold) and the hex value of a accent. * Get the name (in bold) and the hex value of a accent.
* @param context [Context] required
* @return A rendered span with the name in bold + the hex value of the accent.
*/ */
@SuppressLint("ResourceType") @SuppressLint("ResourceType")
fun getDetailedSummary(context: Context): Spanned { fun getDetailedSummary(context: Context): Spanned {

View file

@ -26,8 +26,6 @@ import com.google.android.material.button.MaterialButton
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.logE import org.oxycblt.auxio.logE
// A Variety of shortcut, convenience, hacks, and extension functions used across Auxio.
// --- VIEW CONFIGURATION --- // --- VIEW CONFIGURATION ---
/** /**
@ -35,10 +33,7 @@ import org.oxycblt.auxio.logE
*/ */
fun ImageButton.disable() { fun ImageButton.disable() {
if (isEnabled) { if (isEnabled) {
imageTintList = ColorStateList.valueOf( imageTintList = R.color.inactive_color.toStateList(context)
R.color.inactive_color.toColor(context)
)
isEnabled = false isEnabled = false
} }
} }

View file

@ -160,6 +160,31 @@
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar" app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
tools:text="16:16" /> tools:text="16:16" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@+id/playback_duration_current"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:background="@drawable/ui_unbounded_ripple"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_play_pause" android:id="@+id/playback_play_pause"
style="@style/PlayPause" style="@style/PlayPause"
@ -184,18 +209,6 @@
app:layout_constraintStart_toEndOf="@+id/playback_play_pause" app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" /> app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:background="@drawable/ui_unbounded_ripple"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_shuffle" android:id="@+id/playback_shuffle"
@ -209,17 +222,5 @@
app:layout_constraintStart_toEndOf="@+id/playback_skip_next" app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
app:layout_constraintTop_toTopOf="@+id/playback_skip_next" /> app:layout_constraintTop_toTopOf="@+id/playback_skip_next" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@+id/playback_duration_current"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View file

@ -162,6 +162,30 @@
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar" app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
tools:text="16:16" /> tools:text="16:16" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@+id/playback_duration_current"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_play_pause" android:id="@+id/playback_play_pause"
style="@style/PlayPause" style="@style/PlayPause"
@ -185,18 +209,6 @@
app:layout_constraintStart_toEndOf="@+id/playback_play_pause" app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" /> app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_shuffle" android:id="@+id/playback_shuffle"
style="@style/Widget.Button.Unbounded" style="@style/Widget.Button.Unbounded"
@ -208,17 +220,5 @@
app:layout_constraintStart_toEndOf="@+id/playback_skip_next" app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
app:layout_constraintTop_toTopOf="@+id/playback_skip_next" /> app:layout_constraintTop_toTopOf="@+id/playback_skip_next" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="@+id/playback_duration_current"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View file

@ -149,6 +149,30 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:text="16:16" /> tools:text="16:16" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_play_pause" android:id="@+id/playback_play_pause"
style="@style/PlayPause" style="@style/PlayPause"
@ -172,18 +196,6 @@
app:layout_constraintStart_toEndOf="@+id/playback_play_pause" app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" /> app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton
android:id="@+id/playback_skip_prev"
style="@style/Widget.Button.Unbounded"
android:layout_marginStart="@dimen/margin_large"
android:contentDescription="@string/description_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_loop"
app:layout_constraintTop_toTopOf="@+id/playback_play_pause" />
<ImageButton <ImageButton
android:id="@+id/playback_shuffle" android:id="@+id/playback_shuffle"
style="@style/Widget.Button.Unbounded" style="@style/Widget.Button.Unbounded"
@ -195,17 +207,5 @@
app:layout_constraintStart_toEndOf="@+id/playback_skip_next" app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
app:layout_constraintTop_toTopOf="@+id/playback_skip_next" /> app:layout_constraintTop_toTopOf="@+id/playback_skip_next" />
<ImageButton
android:id="@+id/playback_loop"
style="@style/Widget.Button.Unbounded"
android:contentDescription="@string/description_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/playback_skip_prev" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View file

@ -1,6 +1,4 @@
Auxio is a local music player designed to be simple, straightfoward, and customizable. It has a fast, reliable UI/UX, and it is not bloated with useless features. In short, <b>It plays music.</b> Auxio is a local music player designed to be simple, straightfoward, and customizable. It has a fast, reliable UI/UX, and it is not bloated with useless features. In short, <b>It plays music.</b> Auxio is still configurable however, with both the UI and behavior able to be changed to ones liking. Unlike other music players, Auxio is also based off of <a href="https://exoplayer.dev/">Exoplayer</a>, allowing for much better listening experience compared to the native MediaPlayer API.
Unlike other music players, Auxio is based off of <a href="https://exoplayer.dev/">Exoplayer</a>, allowing for much better listening experience compared to the native MediaPlayer API. Auxio's codebase is also designed to be extendable, allowing for the addition of features that are not included in the main app.
<b>Features</b> <b>Features</b>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 303 KiB