java.lang.Object
az.araezarzosa.spotifyoverlay.spotify_in_game_overlay.App

public class App
extends java.lang.Object
Displays the initial window used to manage the overlay and activate authentication.
Author:
Arae
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static javax.swing.JButton button
    The button clicked to authenticate with Spotify.
    private static javax.swing.JFrame frame
    The window displayed on screen.
    private static boolean guiInitialized
    Keeps track of whether the GUI has been displayed or otherwise.
    private static int OPACITY_INIT
    The initial opacity of the overlay.
    private static int OPACITY_MAX
    The maximum opacity of the overlay.
    private static int OPACITY_MIN
    The minimum opacity of the overlay.
    private static javax.swing.JSlider opacitySlider
    The slider used to change the opacity of the overlay.
    private static javax.swing.JComboBox positionList
    Combo box storing Strings for choosing the position of the overlay.
    private static java.lang.String[] positionStrings
    List of Strings for choosing the position of the overlay.
    private static javax.swing.JComboBox sizeList
    Combo box storing Strings for choosing the size of the overlay
    private static java.lang.String[] sizeStrings
    List of Strings for choosing the size of the overlay.
    private static se.michaelthelin.spotify.SpotifyApi spotifyApi
    The API object responsible for making calls to Spotify.
  • Constructor Summary

    Constructors
    Constructor Description
    App()  
  • Method Summary

    Modifier and Type Method Description
    static void afterAuth()
    What occurs in the GUI after authentication.
    static se.michaelthelin.spotify.SpotifyApi getSpotifyApi()
    Getter for the API object.
    static se.michaelthelin.spotify.model_objects.specification.Track getTrack​(java.lang.String id)
    Returns the Track object of a track using its ID and the API.
    static se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying getUsersCurrentlyPlayingTrack()
    Returns the CurrentlyPlaying object used to retrieve information such as Track id.
    static se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlayingContext getUsersCurrentPlaybackInfo()
    Gets information on the playback of the user.
    static void main​(java.lang.String[] args)
    The main method - displays the first window.
    static void pauseUsersPlayback()
    Pauses the user's playback.
    static void seekToPositionInCurrentlyPlayingTrack​(int position)
    Seeks the user's playback to the specified position.
    static void setVolumePlayback​(int volume)
    Change's the user's volume on Spotify to the specified value.
    static void skipUsersPlaybackToNextTrack()
    Switches the user's playback to the next track in the queue.
    static void skipUsersPlaybackToPreviousTrack()
    Switches the user's playback to the previous track in the queue.
    static void startResumeUsersPlayback()
    Resumes the user's playback.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • frame

      private static javax.swing.JFrame frame
      The window displayed on screen.
    • button

      private static javax.swing.JButton button
      The button clicked to authenticate with Spotify.
    • opacitySlider

      private static javax.swing.JSlider opacitySlider
      The slider used to change the opacity of the overlay.
    • positionList

      private static javax.swing.JComboBox positionList
      Combo box storing Strings for choosing the position of the overlay.
    • sizeList

      private static javax.swing.JComboBox sizeList
      Combo box storing Strings for choosing the size of the overlay
    • guiInitialized

      private static boolean guiInitialized
      Keeps track of whether the GUI has been displayed or otherwise.
    • OPACITY_MIN

      private static final int OPACITY_MIN
      The minimum opacity of the overlay.
      See Also:
      Constant Field Values
    • OPACITY_MAX

      private static final int OPACITY_MAX
      The maximum opacity of the overlay.
      See Also:
      Constant Field Values
    • OPACITY_INIT

      private static final int OPACITY_INIT
      The initial opacity of the overlay.
      See Also:
      Constant Field Values
    • positionStrings

      private static final java.lang.String[] positionStrings
      List of Strings for choosing the position of the overlay.
    • sizeStrings

      private static final java.lang.String[] sizeStrings
      List of Strings for choosing the size of the overlay.
    • spotifyApi

      private static final se.michaelthelin.spotify.SpotifyApi spotifyApi
      The API object responsible for making calls to Spotify.
  • Constructor Details

    • App

      public App()
  • Method Details

    • getTrack

      public static se.michaelthelin.spotify.model_objects.specification.Track getTrack​(java.lang.String id)
      Returns the Track object of a track using its ID and the API.
      Parameters:
      id - The Track id that will be used to retrieve Track object.
      Returns:
      the Track object.
    • getUsersCurrentlyPlayingTrack

      public static se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying getUsersCurrentlyPlayingTrack()
      Returns the CurrentlyPlaying object used to retrieve information such as Track id.
      Returns:
      the CurrentlyPlaying object.
    • getUsersCurrentPlaybackInfo

      public static se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlayingContext getUsersCurrentPlaybackInfo()
      Gets information on the playback of the user.
      Returns:
      the CurrentlyPlayingContext object.
    • seekToPositionInCurrentlyPlayingTrack

      public static void seekToPositionInCurrentlyPlayingTrack​(int position)
      Seeks the user's playback to the specified position.
      Parameters:
      position - The position in milliseconds to seek to.
    • skipUsersPlaybackToPreviousTrack

      public static void skipUsersPlaybackToPreviousTrack()
      Switches the user's playback to the previous track in the queue.
    • skipUsersPlaybackToNextTrack

      public static void skipUsersPlaybackToNextTrack()
      Switches the user's playback to the next track in the queue.
    • pauseUsersPlayback

      public static void pauseUsersPlayback()
      Pauses the user's playback.
    • startResumeUsersPlayback

      public static void startResumeUsersPlayback()
      Resumes the user's playback.
    • setVolumePlayback

      public static void setVolumePlayback​(int volume)
      Change's the user's volume on Spotify to the specified value.
      Parameters:
      volume - The desired volume percentage.
    • main

      public static void main​(java.lang.String[] args) throws java.lang.Exception
      The main method - displays the first window.
      Parameters:
      args -
      Throws:
      java.lang.Exception
    • afterAuth

      public static void afterAuth()
      What occurs in the GUI after authentication.
    • getSpotifyApi

      public static se.michaelthelin.spotify.SpotifyApi getSpotifyApi()
      Getter for the API object.
      Returns:
      API object.