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

i need sleep

parent 1ec78012
package com.example.soulfood_assignment2; package com.example.soulfood_assignment2;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList; 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.american;
import static com.example.soulfood_assignment2.databaseInterface.Cuisine.any; import static com.example.soulfood_assignment2.databaseInterface.Cuisine.any;
...@@ -107,24 +113,24 @@ public class playlistView extends AppCompatActivity { ...@@ -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
} }
/* public void saveStuff(View view) {
needs an array list of songs SharedPreferences saves = getApplicationContext().getSharedPreferences("Saves", 0);
saves them in the databasee as a new playlist SharedPreferences.Editor e = saves.edit();
saves the playlist as a shared preference
hopefully String searchTags = cuisine + " " + timeOfDay + " " + vibe;
*/ Set<String> allSaves = saves.getStringSet("saves", null);
private void save(ArrayList<String> songs) { allSaves.add(searchTags);
databaseInterface dbi = new databaseInterface(); // so we can use database methods e.putStringSet("saves", allSaves);
// String id = dbi.savePlaylist(songs); // save in the database, hopefully e.commit();
// that method returns the saved id so we can put it in the shared preference Toast.makeText(this,"Playlist saved", Toast.LENGTH_SHORT).show();
SavedPlaylists savedPlaylists = new SavedPlaylists(); //so we can save in the shared preference }
// savedPlaylists.savePlaylist(id); // saves as a shared preference
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