Introduce constants for some Strings that indicate no data in Tab class
This commit is contained in:
parent
a163d5461d
commit
d71af9a625
|
@ -36,6 +36,10 @@ import java.util.Objects;
|
|||
public abstract class Tab {
|
||||
private static final String JSON_TAB_ID_KEY = "tab_id";
|
||||
|
||||
private static final String NO_NAME = "<no-name>";
|
||||
private static final String NO_ID = "<no-id>";
|
||||
private static final String NO_URL = "<no-url>";
|
||||
|
||||
Tab() {
|
||||
}
|
||||
|
||||
|
@ -185,7 +189,9 @@ public abstract class Tab {
|
|||
|
||||
@Override
|
||||
public String getTabName(final Context context) {
|
||||
return "NewPipe"; //context.getString(R.string.blank_page_summary);
|
||||
// TODO: find a better name for the blank tab (maybe "blank_tab") or replace it with
|
||||
// context.getString(R.string.app_name);
|
||||
return "NewPipe"; // context.getString(R.string.blank_page_summary);
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
|
@ -309,7 +315,7 @@ public abstract class Tab {
|
|||
private String kioskId;
|
||||
|
||||
private KioskTab() {
|
||||
this(-1, "<no-id>");
|
||||
this(-1, NO_ID);
|
||||
}
|
||||
|
||||
public KioskTab(final int kioskServiceId, final String kioskId) {
|
||||
|
@ -357,7 +363,7 @@ public abstract class Tab {
|
|||
@Override
|
||||
protected void readDataFromJson(final JsonObject jsonObject) {
|
||||
kioskServiceId = jsonObject.getInt(JSON_KIOSK_SERVICE_ID_KEY, -1);
|
||||
kioskId = jsonObject.getString(JSON_KIOSK_ID_KEY, "<no-id>");
|
||||
kioskId = jsonObject.getString(JSON_KIOSK_ID_KEY, NO_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -395,7 +401,7 @@ public abstract class Tab {
|
|||
private String channelName;
|
||||
|
||||
private ChannelTab() {
|
||||
this(-1, "<no-url>", "<no-name>");
|
||||
this(-1, NO_URL, NO_NAME);
|
||||
}
|
||||
|
||||
public ChannelTab(final int channelServiceId, final String channelUrl,
|
||||
|
@ -440,8 +446,8 @@ public abstract class Tab {
|
|||
@Override
|
||||
protected void readDataFromJson(final JsonObject jsonObject) {
|
||||
channelServiceId = jsonObject.getInt(JSON_CHANNEL_SERVICE_ID_KEY, -1);
|
||||
channelUrl = jsonObject.getString(JSON_CHANNEL_URL_KEY, "<no-url>");
|
||||
channelName = jsonObject.getString(JSON_CHANNEL_NAME_KEY, "<no-name>");
|
||||
channelUrl = jsonObject.getString(JSON_CHANNEL_URL_KEY, NO_URL);
|
||||
channelName = jsonObject.getString(JSON_CHANNEL_NAME_KEY, NO_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -527,7 +533,7 @@ public abstract class Tab {
|
|||
private LocalItemType playlistType;
|
||||
|
||||
private PlaylistTab() {
|
||||
this(-1, "<no-name>");
|
||||
this(-1, NO_NAME);
|
||||
}
|
||||
|
||||
public PlaylistTab(final long playlistId, final String playlistName) {
|
||||
|
@ -535,7 +541,7 @@ public abstract class Tab {
|
|||
this.playlistId = playlistId;
|
||||
this.playlistType = LocalItemType.PLAYLIST_LOCAL_ITEM;
|
||||
this.playlistServiceId = -1;
|
||||
this.playlistUrl = "<no-url>";
|
||||
this.playlistUrl = NO_URL;
|
||||
}
|
||||
|
||||
public PlaylistTab(final int playlistServiceId, final String playlistUrl,
|
||||
|
@ -589,8 +595,8 @@ public abstract class Tab {
|
|||
@Override
|
||||
protected void readDataFromJson(final JsonObject jsonObject) {
|
||||
playlistServiceId = jsonObject.getInt(JSON_PLAYLIST_SERVICE_ID_KEY, -1);
|
||||
playlistUrl = jsonObject.getString(JSON_PLAYLIST_URL_KEY, "<no-url>");
|
||||
playlistName = jsonObject.getString(JSON_PLAYLIST_NAME_KEY, "<no-name>");
|
||||
playlistUrl = jsonObject.getString(JSON_PLAYLIST_URL_KEY, NO_URL);
|
||||
playlistName = jsonObject.getString(JSON_PLAYLIST_NAME_KEY, NO_NAME);
|
||||
playlistId = jsonObject.getInt(JSON_PLAYLIST_ID_KEY, -1);
|
||||
playlistType = LocalItemType.valueOf(
|
||||
jsonObject.getString(JSON_PLAYLIST_TYPE_KEY,
|
||||
|
|
Loading…
Reference in New Issue