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

Commit 53a7b198 authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz
Browse files

Allow localization of default not provided Metadata text

Bug: 177605620
Test: manual
Change-Id: I64c44aadd9537b0902d92259e4d9e09dc67dbe16
parent 825b5535
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";