Having issue with repeat a song when pressing the next button or if the song ends (which proceeds to the next song). Need to work on shuffling

This commit is contained in:
kdeng00
2019-10-29 21:13:51 -04:00
parent 6221969d6b
commit 2ba9dfd57a
6 changed files with 117 additions and 64 deletions
+3
View File
@@ -54,6 +54,7 @@ jobject songToObj(JNIEnv *env, const model::Song& song)
jmethodID songGenre = env->GetMethodID( songClass, "setGenre", "(Ljava/lang/String;)V" );
jmethodID songDuration = env->GetMethodID( songClass, "setDuration", "(I)V" );
jmethodID songYear = env->GetMethodID( songClass, "setYear", "(I)V" );
jmethodID songCoverArtId = env->GetMethodID(songClass, "setCoverArtId", "(I)V");
jint id = song.id;
jstring title = env->NewStringUTF(song.title.c_str());
@@ -62,6 +63,7 @@ jobject songToObj(JNIEnv *env, const model::Song& song)
jstring genre = env->NewStringUTF(song.genre.c_str());
jint duration = song.duration;
jint year = song.year;
jint coverArtId = song.coverArtId;
env->CallVoidMethod( songObj, songId, id );
env->CallVoidMethod(songObj, songTitle, title);
@@ -70,6 +72,7 @@ jobject songToObj(JNIEnv *env, const model::Song& song)
env->CallVoidMethod(songObj, songGenre, genre);
env->CallVoidMethod(songObj, songDuration, duration);
env->CallVoidMethod(songObj, songYear, year);
env->CallVoidMethod(songObj, songCoverArtId, coverArtId);
return songObj;
}
+7 -1
View File
@@ -22,7 +22,7 @@ namespace repository { namespace local {
const auto result = query.executeStep();
auto repeatType = query.getColumn(1).getInt();
auto val = static_cast<RepeatTypes>(result);
auto val = static_cast<RepeatTypes>(repeatType);
return val;
} catch (std::exception& ex) {
auto msg = ex.what();
@@ -40,6 +40,12 @@ namespace repository { namespace local {
queryString.append(" (Id INTEGER PRIMARY KEY, RepeatMode INT)");
db.exec(queryString);
queryString = "INSERT INTO " + m_tableName + " (RepeatMode) VALUES(?)";
SQLite::Statement query(db, queryString);
query.bind(1, static_cast<int>(RepeatTypes::RepeatOff));
query.exec();
} catch (std::exception& ex) {
auto msg = ex.what();
}