Skip to content

Commit

Permalink
Finished adding prev wrapped functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
VigneshSK17 committed Apr 9, 2024
1 parent c49dd7d commit c4b50a9
Show file tree
Hide file tree
Showing 20 changed files with 331 additions and 501 deletions.
Binary file modified .idea/copilot/chatSessions/00000000000.xd
Binary file not shown.
4 changes: 2 additions & 2 deletions .idea/copilot/chatSessions/xd.lck

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -12,6 +14,12 @@
android:supportsRtl="true"
android:theme="@style/Theme.SpotifyStats"
tools:targetApi="31">
<activity
android:name=".PrevWrappedActivity"
android:exported="false" />
<activity
android:name=".PrevWrappedsActivity"
android:exported="false" />
<activity
android:name=".WrappedActivity"
android:exported="false" />
Expand All @@ -27,9 +35,6 @@
<activity
android:name=".SettingsActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false"></activity>
</application>

</manifest>
25 changes: 0 additions & 25 deletions app/src/main/java/com/t1r2340/spotifystats/FireBaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

// TODO: Implement into wrapped generation
/**
* Creates a UI thread to update a TextView in the background Reduces UI latency and makes the
* system perform more consistently
*
* @param text the text to set
* @param textView TextView object to update
*/
private void setTextAsync(final String text, TextView textView) {
runOnUiThread(() -> textView.setText(text));
}

/**
* Get authentication request
Expand All @@ -138,18 +127,4 @@ public void onFailure(Exception e) {
Toast.makeText(FireBaseActivity.this, "Failed to fetch data", Toast.LENGTH_SHORT).show();
}

// TODO: INclude in wrapped generation
// private void cancelCall() {
// if (mCall != null) {
// mCall.cancel();
// }
// }

// TODO: include in wrapped generation
// @Override
// protected void onDestroy() {
// cancelCall();
// spotifyAppRemoteHelper.disconnect(); // TODO: Add this for app remote use cases
// super.onDestroy();
// }
}
12 changes: 10 additions & 2 deletions app/src/main/java/com/t1r2340/spotifystats/HomePageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,29 @@ private void setupButtons() {

setupSettingsButton();
setupCreateWrappedButton();
setupPreviousWrappedButton();
}

private void setupCreateWrappedButton() {

Button createWrappedButton = binding.btnCreateWrapped;

// TODO: Create dropdown dialog for time range

createWrappedButton.setOnClickListener(
v -> {
TimeRangeDialog dialog = new TimeRangeDialog(accessToken);
dialog.show(getParentFragmentManager(), "TimeRangeDialog");
});
}

private void setupPreviousWrappedButton() {
Button previousWrappedButton = binding.btnViewWrappeds;

previousWrappedButton.setOnClickListener(v -> {
Intent intent = new Intent(getActivity(), PrevWrappedsActivity.class);
startActivity(intent);
});
}

private void setupSettingsButton() {

ImageButton settingsButton = binding.btnSettings;
Expand Down
179 changes: 0 additions & 179 deletions app/src/main/java/com/t1r2340/spotifystats/MainActivity.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.t1r2340.spotifystats;

import android.content.Intent;
import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.t1r2340.spotifystats.models.api.Wrapped;

public class PrevWrappedActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_prev_wrapped);

Intent intent = getIntent();
String wrappedTitle = intent.getStringExtra("wrappedTitle");
Wrapped wrapped = (Wrapped) intent.getSerializableExtra("wrapped");

WrappedDetailsFragment fragment = new WrappedDetailsFragment();
Bundle bundle = new Bundle();
bundle.putString("wrappedTitle", wrappedTitle);
bundle.putSerializable("wrapped", wrapped);
fragment.setArguments(bundle);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container_view, fragment)
.commit();
}
}
Loading

0 comments on commit c4b50a9

Please sign in to comment.