checks if file ends with .trackbook

master
y20k 2018-04-19 22:07:18 +02:00
parent 962275f04b
commit 1b249fb05e
1 changed files with 8 additions and 3 deletions

View File

@ -18,6 +18,7 @@
package org.y20k.trackbook.core;
import org.y20k.trackbook.helpers.LogHelper;
import org.y20k.trackbook.helpers.TrackbookKeys;
import java.io.File;
import java.text.DateFormat;
@ -30,7 +31,7 @@ import java.util.Locale;
/**
* TrackBundle class
*/
public class TrackBundle {
public class TrackBundle implements TrackbookKeys {
/* Define log tag */
private static final String LOG_TAG = TrackBundle.class.getSimpleName();
@ -62,9 +63,13 @@ public class TrackBundle {
/* Builds a readable track name from the track's file name */
private String buildTrackName(File file) {
// get file name without extension
// get file name
String readableTrackName = file.getName();
readableTrackName = readableTrackName.substring(0, readableTrackName.indexOf(".trackbook"));
// strip extension
if (readableTrackName.endsWith(FILE_TYPE_TRACKBOOK_EXTENSION)) {
readableTrackName = readableTrackName.substring(0, readableTrackName.indexOf(FILE_TYPE_TRACKBOOK_EXTENSION));
}
try {
// convert file name to date