|
36 | 36 | public abstract class Tab { |
37 | 37 | private static final String JSON_TAB_ID_KEY = "tab_id"; |
38 | 38 |
|
| 39 | + private static final String NO_NAME = "<no-name>"; |
| 40 | + private static final String NO_ID = "<no-id>"; |
| 41 | + private static final String NO_URL = "<no-url>"; |
| 42 | + |
39 | 43 | Tab() { |
40 | 44 | } |
41 | 45 |
|
@@ -185,7 +189,9 @@ public int getTabId() { |
185 | 189 |
|
186 | 190 | @Override |
187 | 191 | public String getTabName(final Context context) { |
188 | | - return "NewPipe"; //context.getString(R.string.blank_page_summary); |
| 192 | + // TODO: find a better name for the blank tab (maybe "blank_tab") or replace it with |
| 193 | + // context.getString(R.string.app_name); |
| 194 | + return "NewPipe"; // context.getString(R.string.blank_page_summary); |
189 | 195 | } |
190 | 196 |
|
191 | 197 | @DrawableRes |
@@ -309,7 +315,7 @@ public static class KioskTab extends Tab { |
309 | 315 | private String kioskId; |
310 | 316 |
|
311 | 317 | private KioskTab() { |
312 | | - this(-1, "<no-id>"); |
| 318 | + this(-1, NO_ID); |
313 | 319 | } |
314 | 320 |
|
315 | 321 | public KioskTab(final int kioskServiceId, final String kioskId) { |
@@ -357,7 +363,7 @@ protected void writeDataToJson(final JsonSink writerSink) { |
357 | 363 | @Override |
358 | 364 | protected void readDataFromJson(final JsonObject jsonObject) { |
359 | 365 | kioskServiceId = jsonObject.getInt(JSON_KIOSK_SERVICE_ID_KEY, -1); |
360 | | - kioskId = jsonObject.getString(JSON_KIOSK_ID_KEY, "<no-id>"); |
| 366 | + kioskId = jsonObject.getString(JSON_KIOSK_ID_KEY, NO_ID); |
361 | 367 | } |
362 | 368 |
|
363 | 369 | @Override |
@@ -395,7 +401,7 @@ public static class ChannelTab extends Tab { |
395 | 401 | private String channelName; |
396 | 402 |
|
397 | 403 | private ChannelTab() { |
398 | | - this(-1, "<no-url>", "<no-name>"); |
| 404 | + this(-1, NO_URL, NO_NAME); |
399 | 405 | } |
400 | 406 |
|
401 | 407 | public ChannelTab(final int channelServiceId, final String channelUrl, |
@@ -440,8 +446,8 @@ protected void writeDataToJson(final JsonSink writerSink) { |
440 | 446 | @Override |
441 | 447 | protected void readDataFromJson(final JsonObject jsonObject) { |
442 | 448 | channelServiceId = jsonObject.getInt(JSON_CHANNEL_SERVICE_ID_KEY, -1); |
443 | | - channelUrl = jsonObject.getString(JSON_CHANNEL_URL_KEY, "<no-url>"); |
444 | | - channelName = jsonObject.getString(JSON_CHANNEL_NAME_KEY, "<no-name>"); |
| 449 | + channelUrl = jsonObject.getString(JSON_CHANNEL_URL_KEY, NO_URL); |
| 450 | + channelName = jsonObject.getString(JSON_CHANNEL_NAME_KEY, NO_NAME); |
445 | 451 | } |
446 | 452 |
|
447 | 453 | @Override |
@@ -527,15 +533,15 @@ public static class PlaylistTab extends Tab { |
527 | 533 | private LocalItemType playlistType; |
528 | 534 |
|
529 | 535 | private PlaylistTab() { |
530 | | - this(-1, "<no-name>"); |
| 536 | + this(-1, NO_NAME); |
531 | 537 | } |
532 | 538 |
|
533 | 539 | public PlaylistTab(final long playlistId, final String playlistName) { |
534 | 540 | this.playlistName = playlistName; |
535 | 541 | this.playlistId = playlistId; |
536 | 542 | this.playlistType = LocalItemType.PLAYLIST_LOCAL_ITEM; |
537 | 543 | this.playlistServiceId = -1; |
538 | | - this.playlistUrl = "<no-url>"; |
| 544 | + this.playlistUrl = NO_URL; |
539 | 545 | } |
540 | 546 |
|
541 | 547 | public PlaylistTab(final int playlistServiceId, final String playlistUrl, |
@@ -589,8 +595,8 @@ protected void writeDataToJson(final JsonSink writerSink) { |
589 | 595 | @Override |
590 | 596 | protected void readDataFromJson(final JsonObject jsonObject) { |
591 | 597 | playlistServiceId = jsonObject.getInt(JSON_PLAYLIST_SERVICE_ID_KEY, -1); |
592 | | - playlistUrl = jsonObject.getString(JSON_PLAYLIST_URL_KEY, "<no-url>"); |
593 | | - playlistName = jsonObject.getString(JSON_PLAYLIST_NAME_KEY, "<no-name>"); |
| 598 | + playlistUrl = jsonObject.getString(JSON_PLAYLIST_URL_KEY, NO_URL); |
| 599 | + playlistName = jsonObject.getString(JSON_PLAYLIST_NAME_KEY, NO_NAME); |
594 | 600 | playlistId = jsonObject.getInt(JSON_PLAYLIST_ID_KEY, -1); |
595 | 601 | playlistType = LocalItemType.valueOf( |
596 | 602 | jsonObject.getString(JSON_PLAYLIST_TYPE_KEY, |
|
0 commit comments