Commit 416043f4 authored by jake.ejraee's avatar jake.ejraee

i need sleep

parent 1ec78012
package com.example.soulfood_assignment2;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Set;
import static com.example.soulfood_assignment2.databaseInterface.Cuisine.american;
import static com.example.soulfood_assignment2.databaseInterface.Cuisine.any;
......@@ -107,24 +113,24 @@ public class playlistView extends AppCompatActivity {
}
});
Button save = (Button)findViewById(R.id.saveButton);
//save.setOnClickListener(save()); //when the button is pressed save should be implemeted
// but unfortunately i cant find the array list to put in
}
/*
needs an array list of songs
saves them in the databasee as a new playlist
saves the playlist as a shared preference
hopefully
*/
private void save(ArrayList<String> songs) {
databaseInterface dbi = new databaseInterface(); // so we can use database methods
// String id = dbi.savePlaylist(songs); // save in the database, hopefully
// that method returns the saved id so we can put it in the shared preference
SavedPlaylists savedPlaylists = new SavedPlaylists(); //so we can save in the shared preference
// savedPlaylists.savePlaylist(id); // saves as a shared preference
public void saveStuff(View view) {
SharedPreferences saves = getApplicationContext().getSharedPreferences("Saves", 0);
SharedPreferences.Editor e = saves.edit();
String searchTags = cuisine + " " + timeOfDay + " " + vibe;
Set<String> allSaves = saves.getStringSet("saves", null);
allSaves.add(searchTags);
e.putStringSet("saves", allSaves);
e.commit();
Toast.makeText(this,"Playlist saved", Toast.LENGTH_SHORT).show();
}
public void newSearchViewOnClick(View view) {
Intent intent = new Intent(this, build_playlist.class);
startActivity(intent);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment