// Path: app/src/main/java/cc/echonet/coolmicapp/Configuration/Profile.java
// public class Profile extends ProfileBase {
//     private static final int DEFAULT_VOLUME = 100;
// 
//     public Profile(@NotNull Profile profile) {
//         super(profile);
//     }
// 
//     public Profile(@NotNull Context context, @NotNull String profile) {
//         super(context, profile);
//     }
// 
//     //Stolen from: http://stackoverflow.com/a/23704728 & http://stackoverflow.com/a/18879453 (removed the shortening because it did not work reliably)
//     public @NotNull Track getTrack() {
//         return new Track(this);
//     }
// 
//     public @NotNull Station getStation() {
//         return new Station(this);
//     }
// 
//     public @NotNull Server getServer() {
//         return new Server(this);
//     }
// 
//     public @NotNull Audio getAudio() {
//         return new Audio(this);
//     }
// 
//     public @NotNull Codec getCodec() {
//         return new Codec(this, getAudio());
//     }
// 
//     public @NotNull VUMeter getVUMeter() {
//         return new VUMeter(this);
//     }
// 
//     public @NotNull Volume getVolume() {
//         return new Volume(this, getAudio());
//     }
// 
//     public @NotNull DialogState getDialogState(DialogIdentifier dialogIdentifier) {
//         return new DialogState(this, dialogIdentifier);
//     }
// }


import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.echonet.coolmicapp.Configuration.Profile;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
            this.profile = profile;
            reloadData();
        }

        public void reloadData() {
            clear();
            addAll(getKeys());
            notifyDataSetChanged();
        }

        @NonNull
        @Override
        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
            final @NonNull View view = super.getView(position, convertView, parent);
            final @NonNull String key = Objects.requireNonNull(super.getItem(position));
            final @NonNull String value = getValue(key, "");
            final @NonNull String keyDisplayName = getKeyDisplayName(key);

            ((TextView)view.findViewById(R.id.metadata_key)).setText(keyDisplayName);
            ((TextView)view.findViewById(R.id.metadata_value)).setText(value);

            view.setOnClickListener(v -> PromptDialog.prompt(getContext(), keyDisplayName, value, result -> setMetadata(key, result)));

            view.findViewById(R.id.metadata_delete_key).setOnClickListener(v -> setMetadata(key, null));

            return view;
        }
    }

    protected final @NotNull Context context;
// Path: app/src/main/java/cc/echonet/coolmicapp/Configuration/Profile.java
// public class Profile extends ProfileBase {
//     private static final int DEFAULT_VOLUME = 100;
// 
//     public Profile(@NotNull Profile profile) {
//         super(profile);
//     }
// 
//     public Profile(@NotNull Context context, @NotNull String profile) {
//         super(context, profile);
//     }
// 
//     //Stolen from: http://stackoverflow.com/a/23704728 & http://stackoverflow.com/a/18879453 (removed the shortening because it did not work reliably)
//     public @NotNull Track getTrack() {
//         return new Track(this);
//     }
// 
//     public @NotNull Station getStation() {
//         return new Station(this);
//     }
// 
//     public @NotNull Server getServer() {
//         return new Server(this);
//     }
// 
//     public @NotNull Audio getAudio() {
//         return new Audio(this);
//     }
// 
//     public @NotNull Codec getCodec() {
//         return new Codec(this, getAudio());
//     }
// 
//     public @NotNull VUMeter getVUMeter() {
//         return new VUMeter(this);
//     }
// 
//     public @NotNull Volume getVolume() {
//         return new Volume(this, getAudio());
//     }
// 
//     public @NotNull DialogState getDialogState(DialogIdentifier dialogIdentifier) {
//         return new DialogState(this, dialogIdentifier);
//     }
// }


// Path: app/src/main/java/cc/echonet/coolmicapp/MetadataDialog.java
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.echonet.coolmicapp.Configuration.Profile;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

            this.profile = profile;
            reloadData();
        }

        public void reloadData() {
            clear();
            addAll(getKeys());
            notifyDataSetChanged();
        }

        @NonNull
        @Override
        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
            final @NonNull View view = super.getView(position, convertView, parent);
            final @NonNull String key = Objects.requireNonNull(super.getItem(position));
            final @NonNull String value = getValue(key, "");
            final @NonNull String keyDisplayName = getKeyDisplayName(key);

            ((TextView)view.findViewById(R.id.metadata_key)).setText(keyDisplayName);
            ((TextView)view.findViewById(R.id.metadata_value)).setText(value);

            view.setOnClickListener(v -> PromptDialog.prompt(getContext(), keyDisplayName, value, result -> setMetadata(key, result)));

            view.findViewById(R.id.metadata_delete_key).setOnClickListener(v -> setMetadata(key, null));

            return view;
        }
    }

    protected final @NotNull Context context;
    protected final @NotNull Profile profile;