Browse Source

#15: added "Add to playlist" action from the Now Playing screen.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
a7b469d690
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 4
      app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt
  2. 10
      app/src/main/res/drawable/add_to_playlist.xml
  3. 9
      app/src/main/res/layout-land/partial_now_playing.xml
  4. 10
      app/src/main/res/layout/partial_now_playing.xml

4
app/src/main/java/com/github/apognu/otter/activities/MainActivity.kt

@ -533,6 +533,10 @@ class MainActivity : AppCompatActivity() { @@ -533,6 +533,10 @@ class MainActivity : AppCompatActivity() {
favoriteRepository.fetch(Repository.Origin.Network.origin)
}
now_playing_details_add_to_playlist.setOnClickListener {
CommandBus.send(Command.AddToPlaylist(listOf(track)))
}
}
}
}

10
app/src/main/res/drawable/add_to_playlist.xml

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M14,10L2,10v2h12v-2zM14,6L2,6v2h12L14,6zM18,14v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2,16h8v-2L2,14v2z"/>
</vector>

9
app/src/main/res/layout-land/partial_now_playing.xml

@ -130,6 +130,15 @@ @@ -130,6 +130,15 @@
</LinearLayout>
<ImageButton
android:id="@+id/now_playing_details_add_to_playlist"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:contentDescription="@string/alt_album_cover"
android:src="@drawable/add_to_playlist" />
<ImageButton
android:id="@+id/now_playing_details_favorite"
style="@style/IconButton"

10
app/src/main/res/layout/partial_now_playing.xml

@ -170,12 +170,20 @@ @@ -170,12 +170,20 @@
</LinearLayout>
<ImageButton
android:id="@+id/now_playing_details_add_to_playlist"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:contentDescription="@string/playlist_add_to"
android:src="@drawable/add_to_playlist" />
<ImageButton
android:id="@+id/now_playing_details_favorite"
style="@style/IconButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="bottom|end"
android:layout_margin="8dp"
android:contentDescription="@string/alt_album_cover"
android:src="@drawable/favorite" />

Loading…
Cancel
Save