Commit 82b73eab authored by charley.punshon's avatar charley.punshon

Song screen view with Title, tags and button.

parent cdd3785a
<component name="ProjectDictionaryState">
<dictionary name="charleypunshon">
<words>
<w>successully</w>
</words>
</dictionary>
</component>
\ No newline at end of file
This diff is collapsed.
......@@ -11,18 +11,19 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SongInformationPage"></activity>
<activity android:name=".SongScreenView" />
<activity android:name=".playlistView" />
<activity android:name=".SavedPlaylists" />
<activity
android:name="com.spotify.sdk.android.authentication.LoginActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name=".homeScreen" />
<activity android:name=".settings" />
<activity android:name=".swtViewScreen" />
<activity android:name=".searchScreen" />
<activity android:name=".build_playlist" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -6,6 +6,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.spotify.android.appremote.api.ConnectionParams;
import com.spotify.android.appremote.api.Connector;
......@@ -157,12 +158,14 @@ public class MainActivity extends AppCompatActivity {
SpotifyAppRemote.connect(this, connP, new Connector.ConnectionListener() {
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
spotifyClass.mSpotifyAppRemote = spotifyAppRemote;
Toast.makeText(MainActivity.this,"Connected to Spotify", Toast.LENGTH_LONG).show();
Log.d("Testing!!!", "Connected");
connected();
}
public void onFailure(Throwable throwable) {
Toast.makeText(MainActivity.this,"Not Connected to Spotify", Toast.LENGTH_LONG).show();
Log.e("Testing!!!", throwable.getMessage(), throwable);
//Something went wrong when attempting to connect! Handle errors here
}
......
package com.example.soulfood_assignment2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class SavedPlaylists extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_playlists);
}
}
package com.example.soulfood_assignment2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class SongInformationPage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_song_information_page);
String title = getIntent().getStringExtra("song_name");
String tag1 = getIntent().getStringExtra("tag1_name");
String tag2 = getIntent().getStringExtra("tag2_name");
String tag3 = getIntent().getStringExtra("tag3_name");
TextView songNameView = findViewById(R.id.songNameView);
TextView tag1View = findViewById(R.id.tag1View);
TextView tag2View = findViewById(R.id.tag2View);
TextView tag3View = findViewById(R.id.tag3View);
songNameView.setText(title);
tag1View.setText(tag1);
tag2View.setText(tag2);
tag3View.setText(tag3);
}
}
package com.example.soulfood_assignment2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class SongScreenView extends AppCompatActivity {
String id = getIntent().getStringExtra("id");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_song_screen_view);
setContentView(R.layout.activity_song_screen_view2);
String title = getIntent().getStringExtra("song_name");
String tag1 = getIntent().getStringExtra("tag1_name");
String tag2 = getIntent().getStringExtra("tag2_name");
String tag3 = getIntent().getStringExtra("tag3_name");
TextView songNameView = findViewById(R.id.songName);
TextView tag1View = findViewById(R.id.tag1);
TextView tag2View = findViewById(R.id.tag2);
TextView tag3View = findViewById(R.id.tag3);
songNameView.setText(title);
tag1View.setText(tag1);
tag2View.setText(tag2);
tag3View.setText(tag3);
}
String song = getIntent().getStringExtra("song_name");
TextView tagNameView = findViewById(R.id.songName);
tagNameView.setText(song);
public void playPlaylistOnClick(View view) {
//SpotifyClass spotifyClass = MainActivity.spotifyClass;
//spotifyClass.pauseSong();
//spotifyClass.playSong(id);
}
}
......@@ -12,6 +12,15 @@ import java.util.ArrayList;
public class ThaiAsyncTask extends AsyncTask<Void, Void, ArrayAdapter<String>> {
public ArrayList<String> thaiResults = new ArrayList<>();
public ArrayList<String> attributesSong1 = new ArrayList<>();
public ArrayList<String> attributesSong2 = new ArrayList<>();
public ArrayList<String> attributesSong3 = new ArrayList<>();
public ArrayList<String> attributesSong4 = new ArrayList<>();
public ArrayList<String> attributesSong5 = new ArrayList<>();
public ArrayList<String> attributesSong6 = new ArrayList<>();
public ArrayList<String> attributesSong7 = new ArrayList<>();
public String[] songNames = new String[7];
public String test;
public ListView listView;
public Context context;
......@@ -28,8 +37,16 @@ public class ThaiAsyncTask extends AsyncTask<Void, Void, ArrayAdapter<String>>
databaseInterface dbi = new databaseInterface();
thaiResults = dbi.getPlaylistByAttributes(databaseInterface.Cuisine.thai, databaseInterface.Vibe.any, databaseInterface.Time.any);
for(int i = 0; i < thaiResults.size(); i++) {
Log.d("ThaiResults!!!", thaiResults.get(i));
songNames[i] = dbi.getSongTitle(thaiResults.get(i));
}
attributesSong1 = dbi.getAttributesBySongID(thaiResults.get(0));
attributesSong2 = dbi.getAttributesBySongID(thaiResults.get(1));
attributesSong3 = dbi.getAttributesBySongID(thaiResults.get(2));
attributesSong4 = dbi.getAttributesBySongID(thaiResults.get(3));
attributesSong5 = dbi.getAttributesBySongID(thaiResults.get(4));
attributesSong6 = dbi.getAttributesBySongID(thaiResults.get(5));
attributesSong7 = dbi.getAttributesBySongID(thaiResults.get(6));
ArrayAdapter thaiAdapter = new ArrayAdapter<String>(
context, android.R.layout.simple_list_item_1, thaiResults
);
......
......@@ -33,8 +33,8 @@ public class build_playlist extends AppCompatActivity {
}
public void buildPlaylistOnClick(View view) {
// Intent intent = new Intent(this, PlaylistView.class);
// startActivity(intent);
Intent intent = new Intent(this, playlistView.class);
startActivity(intent);
}
......
package com.example.soulfood_assignment2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class playlistView extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist_view);
}
}
......@@ -11,6 +11,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.Toast;
import java.util.AbstractList;
import java.util.ArrayList;
......@@ -65,9 +66,6 @@ public class searchScreen extends AppCompatActivity {
tagNamePage("Chinese", chineseResults);
break;
case 1:
ThaiAsyncTask thaiAsyncTask = new ThaiAsyncTask(searchScreen.this);
thaiAsyncTask.listView = songResults;
thaiAsyncTask.execute();
tagNamePage("Thai", thaiResults);
break;
case 2:
......@@ -150,6 +148,8 @@ public class searchScreen extends AppCompatActivity {
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Toast.makeText(searchScreen.this,"No tags to match this result.", Toast.LENGTH_LONG).show();
return false;
}
......
......@@ -12,6 +12,7 @@ import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.Toast;
import static android.R.layout.simple_spinner_dropdown_item;
......@@ -67,7 +68,7 @@ public class settings extends AppCompatActivity {
public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
am.setStreamVolume(AudioManager.STREAM_MUSIC,
progress, AudioManager.FLAG_PLAY_SOUND);
System.out.print(progress);
Toast.makeText(settings.this,"Volume successully changed - Click test to test volume", Toast.LENGTH_SHORT).show();
}
});
} catch (Exception e) {
......
......@@ -106,7 +106,7 @@ public class swtViewScreen extends AppCompatActivity {
);
tagResults = findViewById(R.id.charleyNeedsHelp);
//tagResults = findViewById(R.id.charleyNeedsHelp);
if (tagNameView.getText().toString().equals("Songs with 'Chinese' Tag")) {
......@@ -117,56 +117,62 @@ public class swtViewScreen extends AppCompatActivity {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
songPage(chineseResults.get(0));
//songPage(chineseResults.get(0));
break;
case 1:
songPage(chineseResults.get(1));
//songPage(chineseResults.get(1));
break;
case 2:
songPage(chineseResults.get(2));
//songPage(chineseResults.get(2));
break;
case 3:
songPage(chineseResults.get(3));
//songPage(chineseResults.get(3));
break;
case 4:
songPage(chineseResults.get(4));
//songPage(chineseResults.get(4));
break;
case 5:
songPage(chineseResults.get(5));
//songPage(chineseResults.get(5));
break;
case 6:
songPage(chineseResults.get(6));
//songPage(chineseResults.get(6));
break;
}
}
});
} else if(tagNameView.getText().toString().equals("Songs with 'Thai' Tag")) {
ThaiAsyncTask thaiAsyncTask = new ThaiAsyncTask(swtViewScreen.this);
thaiAsyncTask.listView = findViewById(R.id.charleyNeedsHelp);
thaiAsyncTask.execute();
tagResults = thaiAsyncTask.listView;
tagResults.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
SpotifyClass spotifyClass = MainActivity.spotifyClass;
spotifyClass.pauseSong();
spotifyClass.playSong("0RvQJoaiQC3sYafoDTdiEJ");
Log.d("endmysuffering", thaiAsyncTask.songNames[0]);
songPage(thaiAsyncTask.songNames[0], thaiAsyncTask.attributesSong1.get(0), thaiAsyncTask.attributesSong1.get(1), thaiAsyncTask.attributesSong1.get(2));
break;
case 1:
songPage(thaiResults.get(1));
//songPage(thaiResults.get(1));
break;
case 2:
songPage(thaiResults.get(2));
//songPage(thaiResults.get(2));
break;
case 3:
songPage(chineseResults.get(3));
//songPage(chineseResults.get(3));
break;
case 4:
songPage(chineseResults.get(4));
//songPage(chineseResults.get(4));
break;
case 5:
songPage(chineseResults.get(5));
//songPage(chineseResults.get(5));
break;
case 6:
songPage(chineseResults.get(6));
//songPage(chineseResults.get(6));
break;
}
}
......@@ -453,9 +459,12 @@ public class swtViewScreen extends AppCompatActivity {
}
public void songPage(String songName) {
songView = new Intent(this, SongScreenView.class);
public void songPage(String songName, String tag1, String tag2, String tag3) {
songView = new Intent(this, SongInformationPage.class);
songView.putExtra("song_name", songName);
songView.putExtra("tag1_name", tag1);
songView.putExtra("tag2_name", tag2);
songView.putExtra("tag3_name", tag3);
startActivity(songView);
}
......
......@@ -34,6 +34,7 @@
android:layout_marginTop="84dp"
android:layout_marginEnd="48dp"
android:layout_marginRight="48dp"
android:onClick="settingsViewOnClick"
android:text="Settings"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.soulfood_assignment2.playlistView">
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:text="SoulFood"
android:textColor="#000000"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="@+id/playlistView"
android:layout_width="wrap_content"
android:layout_height="400dp"
android:layout_marginTop="200dp"
android:layout_marginBottom="153dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10"></ListView>
<Button
android:id="@+id/saveButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="72dp"
android:layout_marginLeft="72dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="39dp"
android:layout_marginRight="39dp"
android:layout_marginBottom="49dp"
android:text="Save"
app:layout_constraintBottom_toTopOf="@+id/playlistView"
app:layout_constraintEnd_toStartOf="@+id/button5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="39dp"
android:layout_marginLeft="39dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="100dp"
android:layout_marginRight="100dp"
android:layout_marginBottom="49dp"
android:text="New Search"
app:layout_constraintBottom_toTopOf="@+id/playlistView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/saveButton"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.soulfood_assignment2.SavedPlaylists">
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:text="SoulFood"
android:textColor="#000000"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="@+id/savedPlaylists"
android:layout_width="wrap_content"
android:layout_height="500dp"
android:layout_marginTop="76dp"
android:layout_marginBottom="77dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView9"></ListView>
</android.support.constraint.ConstraintLayout>
......@@ -16,7 +16,7 @@
android:layout_marginEnd="44dp"
android:layout_marginRight="44dp"
android:layout_marginBottom="41dp"
android:text="Revert to factory settings"
android:text="Test"
android:textColor="#000000"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -4,80 +4,77 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.soulfood_assignment2.SongScreenView">
tools:context="com.example.soulfood_assignment2.SongInformationPage">
<TextView
android:id="@+id/songName"
android:id="@+id/songNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="165dp"
android:layout_marginBottom="40dp"
android:layout_marginBottom="550dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="36sp"
app:layout_constraintBottom_toTopOf="@+id/textView7"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView7"
android:id="@+id/associatedTags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="45dp"
android:text="Associated Tags"
android:textColor="#000000"
android:layout_height="43dp"
android:layout_marginBottom="400dp"
android:text="Associated Tags "
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="@+id/vibeTagView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/songName" />
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/vibeTagView"
android:id="@+id/tag1View"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_marginBottom="375dp"
android:text="TextView"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/timeOfDayTagView"
android:id="@+id/tag2View"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_marginBottom="45dp"
android:layout_marginBottom="325dp"
android:text="TextView"
android:textColor="#000000"
app:layout_constraintBottom_toTopOf="@+id/cuisineTagView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vibeTagView" />
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/cuisineTagView"
android:id="@+id/tag3View"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_marginBottom="275dp"
android:text="TextView"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/timeOfDayTagView" />
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/playView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="96dp"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/pauseView"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/button2"
android:id="@+id/pauseView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play/Pause"
android:layout_marginBottom="96dp"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="611dp" />
app:layout_constraintStart_toEndOf="@+id/playView" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.soulfood_assignment2.SongScreenView">
<TextView
android:id="@+id/songName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="500dp"
android:text="Song Name"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="116dp"
android:layout_marginLeft="116dp"
android:layout_marginEnd="116dp"
android:layout_marginRight="116dp"
android:layout_marginBottom="400dp"
android:text="Associated Tags"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/tag1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="275dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/tag2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="200dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/tag3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="350dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
......@@ -32,8 +32,7 @@
<item>m i s t</item>
<item>Deja Vu</item>
</string-array>
<string-array name="thaiSearchResultsArray">
</string-array>
<string-array name="thaiSearchResultsArray"></string-array>
<string-array name="indianSearchResultsArray">
<item>Lullaby from Home</item>
<item>Rebel Warrior</item>
......@@ -115,5 +114,6 @@
<string name="title_activity_home_screen_navigation">homeScreenNavigation</string>
<string name="title_activity_individual_playlist_screen">IndividualPlaylistScreen</string>
<string name="title_activity_individual_playlist">Playlist</string>
<string name="title_activity_song_screen_view">SongScreenView</string>
</resources>
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