Fix plurals
This commit is contained in:
parent
3ae88a4e5d
commit
0c9525834e
8 changed files with 80 additions and 133 deletions
|
@ -24,7 +24,7 @@ android {
|
|||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
applicationId "code.name.monkey.retromusic"
|
||||
versionCode 417
|
||||
versionCode 418
|
||||
versionName '3.5.100'
|
||||
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -176,6 +176,14 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
|||
this.album = album
|
||||
|
||||
albumTitle.text = album.title
|
||||
val songText =
|
||||
resources.getQuantityString(
|
||||
R.plurals.albumSongs,
|
||||
album.songCount,
|
||||
album.songCount
|
||||
)
|
||||
songTitle.text = songText
|
||||
|
||||
if (MusicUtil.getYearString(album.year) == "-") {
|
||||
albumText.text = String.format(
|
||||
"%s • %s",
|
||||
|
@ -193,7 +201,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
|||
loadAlbumCover()
|
||||
simpleSongAdapter.swapDataSet(album.songs)
|
||||
albumDetailsPresenter.loadMore(album.artistId)
|
||||
albumDetailsPresenter.aboutAlbum(album.artistName!!, album.title!!)
|
||||
albumDetailsPresenter.aboutAlbum(album.artistName ?: "-", album.title ?: "-")
|
||||
}
|
||||
|
||||
override fun moreAlbums(albums: List<Album>) {
|
||||
|
@ -216,7 +224,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
|||
if (lastFmAlbum.album.wiki != null) {
|
||||
aboutAlbumText.show()
|
||||
aboutAlbumTitle.show()
|
||||
aboutAlbumTitle.text = String.format(getString(R.string.about_album_label), lastFmAlbum.album.name)
|
||||
aboutAlbumTitle.text =
|
||||
String.format(getString(R.string.about_album_label), lastFmAlbum.album.name)
|
||||
aboutAlbumText.text = lastFmAlbum.album.wiki.content
|
||||
}
|
||||
if (lastFmAlbum.album.listeners.isNotEmpty()) {
|
||||
|
|
|
@ -2,9 +2,7 @@ package code.name.monkey.retromusic.activities
|
|||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.text.Spanned
|
||||
import android.transition.Slide
|
||||
import android.view.Menu
|
||||
|
@ -188,7 +186,20 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
|||
MusicUtil.getArtistInfoString(this, artist),
|
||||
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(artist.songs))
|
||||
)
|
||||
|
||||
val songText =
|
||||
resources.getQuantityString(
|
||||
R.plurals.albumSongs,
|
||||
artist.songCount,
|
||||
artist.songCount
|
||||
)
|
||||
val albumText =
|
||||
resources.getQuantityString(
|
||||
R.plurals.albums,
|
||||
artist.songCount,
|
||||
artist.songCount
|
||||
)
|
||||
songTitle.text = songText
|
||||
albumTitle.text =albumText
|
||||
songAdapter.swapDataSet(artist.songs)
|
||||
albumAdapter.swapDataSet(artist.albums!!)
|
||||
}
|
||||
|
@ -208,7 +219,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
|||
if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) {
|
||||
biographyText.visibility = View.VISIBLE
|
||||
biographyTitle.visibility = View.VISIBLE
|
||||
biography = HtmlCompat.fromHtml(bioContent,HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
biography = HtmlCompat.fromHtml(bioContent, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
biographyText.text = biography
|
||||
if (lastFmArtist.artist.stats.listeners.isNotEmpty()) {
|
||||
listeners.show()
|
||||
|
|
|
@ -51,21 +51,20 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog;
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
||||
import code.name.monkey.retromusic.fragments.albums.AlbumsFragment;
|
||||
import code.name.monkey.retromusic.fragments.artists.ArtistsFragment;
|
||||
import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
|
||||
import code.name.monkey.retromusic.fragments.genres.GenresFragment;
|
||||
import code.name.monkey.retromusic.fragments.home.BannerHomeFragment;
|
||||
import code.name.monkey.retromusic.fragments.mainactivity.FoldersFragment;
|
||||
import code.name.monkey.retromusic.fragments.genres.GenresFragment;
|
||||
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment;
|
||||
import code.name.monkey.retromusic.fragments.playlists.PlaylistsFragment;
|
||||
import code.name.monkey.retromusic.fragments.queue.PlayingQueueFragment;
|
||||
import code.name.monkey.retromusic.fragments.songs.SongsFragment;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.helper.SearchQueryHelper;
|
||||
|
@ -765,16 +764,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
@Override
|
||||
public void run() {
|
||||
TransitionManager.beginDelayedTransition(mToolbar);
|
||||
Log.i(TAG, "run: " + Thread.currentThread().getName());
|
||||
mAppTitle.setVisibility(View.GONE);
|
||||
setTitle(R.string.action_search);
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
Locale[] locales = Locale.getAvailableLocales();
|
||||
|
||||
for (Locale l : locales) {
|
||||
Log.d(TAG, "setupToolbar: " + l.toLanguageTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@ package code.name.monkey.retromusic.adapter.song
|
|||
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.interfaces.CabHolder
|
||||
import code.name.monkey.retromusic.model.Song
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.google.android.material.textview.MaterialTextView
|
||||
import com.google.android.material.button.MaterialButton
|
||||
|
||||
class ShuffleButtonSongAdapter(
|
||||
activity: AppCompatActivity,
|
||||
|
@ -17,75 +15,38 @@ class ShuffleButtonSongAdapter(
|
|||
cabHolder: CabHolder?
|
||||
) : AbsOffsetSongAdapter(activity, dataSet, itemLayoutRes, cabHolder) {
|
||||
|
||||
override fun createViewHolder(view: View): ViewHolder {
|
||||
override fun createViewHolder(view: View): SongAdapter.ViewHolder {
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
|
||||
if (holder.itemViewType == OFFSET_ITEM) {
|
||||
val viewHolder = holder as ViewHolder
|
||||
val info =
|
||||
activity.resources.getQuantityString(
|
||||
R.plurals.numSongs,
|
||||
dataSet.size,
|
||||
dataSet.size
|
||||
)
|
||||
viewHolder.info?.text = info
|
||||
viewHolder.shuffleAction?.setOnClickListener {
|
||||
viewHolder.playAction?.let {
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openQueue(dataSet, 0, true)
|
||||
}
|
||||
}
|
||||
viewHolder.shuffleAction?.let {
|
||||
it.setOnClickListener {
|
||||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
||||
}
|
||||
showChangeLayout(viewHolder)
|
||||
showSortMenu(viewHolder)
|
||||
|
||||
}
|
||||
} else {
|
||||
super.onBindViewHolder(holder, position - 1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showChangeLayout(viewHolder: ViewHolder) {
|
||||
viewHolder.changeLayoutType?.setOnClickListener {
|
||||
val popupMenu = PopupMenu(activity, viewHolder.changeLayoutType)
|
||||
popupMenu.inflate(R.menu.menu_layout_types)
|
||||
popupMenu.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.layout.item_card ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_card).isChecked = true
|
||||
R.layout.item_grid ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_normal).isChecked = true
|
||||
|
||||
R.layout.item_card_color ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_colored_card).isChecked = true
|
||||
|
||||
R.layout.item_grid_circle ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_circular).isChecked = true
|
||||
|
||||
R.layout.image ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_image).isChecked = true
|
||||
|
||||
R.layout.item_image_gradient ->
|
||||
popupMenu.menu.findItem(R.id.action_layout_gradient_image).isChecked = true
|
||||
}
|
||||
PreferenceUtil.getInstance(activity).songGridStyle = it.itemId
|
||||
true
|
||||
}
|
||||
popupMenu.show()
|
||||
popupMenu.menu
|
||||
.findItem(PreferenceUtil.getInstance(activity).songGridStyle).isChecked = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSortMenu(viewHolder: ViewHolder) {
|
||||
viewHolder.sortOrder?.setOnClickListener {
|
||||
val popupMenu = PopupMenu(activity, viewHolder.sortOrder)
|
||||
popupMenu.inflate(R.menu.menu_song_sort_order)
|
||||
popupMenu.show()
|
||||
}
|
||||
}
|
||||
|
||||
inner class ViewHolder(itemView: View) : AbsOffsetSongAdapter.ViewHolder(itemView) {
|
||||
val sortOrder: View? = itemView.findViewById(R.id.sortOrder)
|
||||
val changeLayoutType: View? = itemView.findViewById(R.id.changeLayoutType)
|
||||
val shuffleAction: View? = itemView.findViewById(R.id.shuffleAction)
|
||||
val info: MaterialTextView? = itemView.findViewById(R.id.info)
|
||||
val playAction: MaterialButton? = itemView.findViewById(R.id.playAction)
|
||||
val shuffleAction: MaterialButton? = itemView.findViewById(R.id.shuffleAction)
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
if (itemViewType == OFFSET_ITEM) {
|
||||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
|
||||
return
|
||||
}
|
||||
super.onClick(v)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -125,6 +125,7 @@ public class ArtistGlideRequest {
|
|||
.asBitmap()
|
||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.animate(DEFAULT_ANIMATION)
|
||||
.error(DEFAULT_ERROR_IMAGE)
|
||||
.priority(Priority.LOW)
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.dontTransform()
|
||||
|
@ -150,6 +151,7 @@ public class ArtistGlideRequest {
|
|||
.asBitmap()
|
||||
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
|
||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||
.error(DEFAULT_ERROR_IMAGE)
|
||||
.animate(DEFAULT_ANIMATION)
|
||||
.priority(Priority.LOW)
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
|
|
|
@ -12,71 +12,35 @@
|
|||
~ See the GNU General Public License for more details.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/gridSize"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/gridSize"
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/playAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/action_play_all"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/sortOrder"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_grid_size_white_24dp"
|
||||
app:tint="?android:attr/colorControlNormal" />
|
||||
app:backgroundTint="?attr/colorSurface"
|
||||
app:icon="@drawable/ic_play_arrow_white_24dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sortOrder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/action_play_all"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/changeLayoutType"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_sort_white_24dp"
|
||||
app:tint="?android:attr/colorControlNormal" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/changeLayoutType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/action_play_all"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/shuffleAction"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_dashboard_white_24dp"
|
||||
app:tint="?android:attr/colorControlNormal" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/shuffleAction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/shuffle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_shuffle_white_24dp"
|
||||
app:tint="?android:attr/colorControlNormal" />
|
||||
app:backgroundTint="?attr/colorSurface"
|
||||
app:icon="@drawable/ic_shuffle_white_24dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
|
@ -851,6 +851,14 @@
|
|||
<string name="translators">Translators</string>
|
||||
<string name="translators_summary">The people who helped translate this app</string>
|
||||
|
||||
<plurals name="albumSongs">
|
||||
<item quantity="one">Song</item>
|
||||
<item quantity="other">Songs</item>
|
||||
</plurals>
|
||||
<plurals name="albums">
|
||||
<item quantity="one">Album</item>
|
||||
<item quantity="other">Albums</item>
|
||||
</plurals>
|
||||
<plurals name="numSongs">
|
||||
<item quantity="one">%d Song</item>
|
||||
<item quantity="other">%d Songs</item>
|
||||
|
|
Loading…
Reference in a new issue