Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8501cf87 authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz Committed by Gerrit Code Review
Browse files

Merge "Allow localization of default not provided Metadata text"

parents cff5b390 53a7b198
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@
    <!-- string for "unknown" phone number" -->
    <string name="unknownNumber">Unknown</string>

    <!-- string for "Not Provided" metadata" -->
    <string name="not_provided">Not Provided</string>

    <!-- string for "the title of airplane mode error" -->
    <string name="airplane_error_title">Airplane mode</string>
    <!-- string for "error message in airplane mode" -->
+12 −2
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.media.browse.MediaBrowser.MediaItem;
import android.media.session.MediaSession;
import android.os.Bundle;

import com.android.bluetooth.R;

import java.util.Objects;

public class Metadata implements Cloneable {
@@ -232,8 +234,16 @@ public class Metadata implements Cloneable {
         * Elect to use default values in the Metadata in place of any missing values
         */
        public Builder useDefaults() {
            if (mMetadata.mediaId == null) mMetadata.mediaId = "Not Provided";
            if (mMetadata.title == null) mMetadata.title = "Not Provided";
            if (mMetadata.mediaId == null) {
                mMetadata.mediaId =
                        mContext != null ? mContext.getString(R.string.not_provided)
                                : "Not Provided";
            }
            if (mMetadata.title == null) {
                mMetadata.title =
                        mContext != null ? mContext.getString(R.string.not_provided)
                                : "Not Provided";
            }
            if (mMetadata.artist == null) mMetadata.artist = "";
            if (mMetadata.album == null) mMetadata.album = "";
            if (mMetadata.trackNum == null) mMetadata.trackNum = "1";