Skip to content

Commit

Permalink
created trackswrapped activity
Browse files Browse the repository at this point in the history
  • Loading branch information
rrhzhang committed Apr 20, 2024
1 parent a29004e commit e324fa2
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class SpotifyManager {
private static String mAccessToken = "BQAKcHbszfzRFDaaUkRpP0g6QASYEAa0Exz7NoCowFrjmFwAij0wsQ4V359JsPq0TtzeOoq0aDdHIrQQsEiapzx2p3NOhczUwYRI_gl4pU1ahZ2efWO3Y5tG5b0mpVglnBuWZzs8BQau3FumeCERV0J2ZNZ_gikYcGI_RP3wsS-rKARI46o3ZLeBTypqYgT3SPCg7DbTou2zwF418HaH_6fXEtKo1pVYl77Jqz8rx7Rc4H0";

private static String mAccessCode;


private final static OkHttpClient mOkHttpClient = new OkHttpClient();
private static Call mCall;
private static SpotifyManager instance;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.example.spotifywrapped2340;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.example.spotifywrapped2340.SpotifyDataManagers.SpotifyManager;

import jp.shts.android.storiesprogressview.StoriesProgressView;


public class TracksWrapped extends AppCompatActivity implements StoriesProgressView.StoriesListener{

private StoriesProgressView storiesProgressView;
private TextView topLabel;
private TextView trackName;

private TextView artistName;
private int currentIndex = 0;

private ImageView imageView;


@Override
protected void onStart() {
super.onStart();
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.wrapped);
topLabel = (TextView) findViewById(R.id.topLabel);
topLabel.setText("Top Artists!");

trackName = (TextView) findViewById(R.id.trackLabel);
artistName = (TextView) findViewById(R.id.artistLabel);
imageView = (ImageView) findViewById(R.id.mainImage);

artistName.setText("#" + (currentIndex + 1));
trackName.setText(SpotifyManager.topArtists.get(currentIndex).getName());
Glide.with(TracksWrapped.this).load(SpotifyManager.topArtists.get(currentIndex).getArtistImageUrl()).into(imageView);




// if (SpotifyManager.getInstance(getApplicationContext()).topArtists.size() == 0) {

// }
storiesProgressView = (StoriesProgressView) findViewById(R.id.stories);
storiesProgressView.setStoriesCount(10); // <- set stories
storiesProgressView.setStoryDuration(2400L); // <- set a story duration
storiesProgressView.setStoriesListener(this); // <- set listener
storiesProgressView.startStories(); // <- start progress
}


@Override
public void onNext() {
currentIndex++;
artistName.setText("#" + (currentIndex + 1));
trackName.setText(SpotifyManager.topArtists.get(currentIndex).getName());
Glide.with(TracksWrapped.this).load(SpotifyManager.topArtists.get(currentIndex).getArtistImageUrl()).into(imageView);

}

@Override
public void onPrev() {
// Call when finished revserse animation.
Toast.makeText(this, "onPrev", Toast.LENGTH_SHORT).show();
}

@Override
public void onComplete() {
Toast.makeText(this, "onComplete", Toast.LENGTH_SHORT).show();
}
}

0 comments on commit e324fa2

Please sign in to comment.