Skip to content

Commit

Permalink
Removed button for spotify login (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: yours-aditya <[email protected]>
  • Loading branch information
VigneshSK17 and yours-aditya authored Mar 26, 2024
1 parent 16ebe09 commit e907fa4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

20 changes: 15 additions & 5 deletions app/src/main/java/com/t1r2340/spotifystats/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.t1r2340.spotifystats.models.api.SpotifyProfile;
import com.t1r2340.spotifystats.models.api.TopArtists;
import com.t1r2340.spotifystats.models.api.TopTracks;
import com.t1r2340.spotifystats.models.api.TrackObject;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -57,7 +58,7 @@ protected void onCreate(Bundle savedInstanceState) {

// Initialize the buttons

Button profileBtn = (Button) findViewById(R.id.profile_btn);
//Button profileBtn = (Button) findViewById(R.id.profile_btn);

// Set the click listeners for the buttons
//
Expand All @@ -69,10 +70,11 @@ protected void onCreate(Bundle savedInstanceState) {
// getCode();
// });

profileBtn.setOnClickListener((v) -> {
// onGetUserProfileClicked();
getToken();
});
// profileBtn.setOnClickListener((v) -> {
// //onGetUserProfileClicked();
// getToken();
// });
getToken();

}

Expand All @@ -85,6 +87,7 @@ protected void onCreate(Bundle savedInstanceState) {
public void getToken() {
final AuthorizationRequest request = getAuthenticationRequest(AuthorizationResponse.Type.TOKEN);
AuthorizationClient.openLoginActivity(MainActivity.this, AUTH_TOKEN_REQUEST_CODE, request);

}

/**
Expand Down Expand Up @@ -116,6 +119,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
spotifyApi = new SpotifyApi(this, mAccessToken, mOkHttpClient, mCall);
onGetUserProfileClicked();


}
}

Expand All @@ -141,8 +145,14 @@ public void onGetUserProfileClicked() {

spotifyApi.getTopTracks((TopTracks jsonObject) -> {
Log.d("JSON", jsonObject.toString());
TrackObject[] tracks = jsonObject.getItems();
tracks[3].getAlbum();
}, 5, SpotifyApi.TimeRange.SHORT_TERM);

spotifyApi.getProfile((SpotifyProfile jsonObject) -> {
Log.d("JSON", jsonObject.toString());
});

}

/**
Expand Down
12 changes: 1 addition & 11 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/profile_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="8dp"
android:layout_weight="1"
android:text="Get User Profile" />
</LinearLayout>
android:layout_height="wrap_content"/>
</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.2" apply false
id("com.android.application") version "8.3.1" apply false


id("com.google.gms.google-services") version "4.4.1" apply false
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Mar 01 18:40:18 EST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit e907fa4

Please sign in to comment.