Android Open Source - VisEQ Viz E Q






From Project

Back to project page VisEQ.

License

The source code is released under:

Copyright (c) 2012, Spotify AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:...

If you think the Android project VisEQ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lsu.vizeq;
//  w  w  w .  j  a v  a 2s . co  m
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class VizEQ extends Activity
{
  static int numRand;
  
  static int colorScheme;
  
  public static String nowPlaying = "nothing playing!";
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    ActionBar actionBar = getActionBar();
    actionBar.hide();
//    Log.d("Flow", "onCreate VizEQ");
    //Makes volume buttons control music stream even when nothing playing
    setVolumeControlStream(AudioManager.STREAM_MUSIC); 
    Random r = new Random();    
    
    SharedPreferences memory = getSharedPreferences("VizEQ",MODE_PRIVATE);
    int posi = memory.getInt("colorPos", -1);
    
    if (posi != -1) numRand = posi;
    if (posi <= 0) numRand = r.nextInt(5) + 1;

    switch (numRand)
    {
      case 1:
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.Red)));
        colorScheme = getResources().getColor(R.color.Red);
        break;
      case 2:
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.Green)));    
        colorScheme = getResources().getColor(R.color.Green);
        break;
      case 3:
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.Blue)));
        colorScheme = getResources().getColor(R.color.Blue);
        break;
      case 4:
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.Purple)));  
        colorScheme = getResources().getColor(R.color.Purple);
        break;
      case 5:
        actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.Orange)));
        colorScheme = getResources().getColor(R.color.Orange);
        break;      
    }            
    
    //load anything if necessary
    
    Thread splashThread = new Thread()
    {
       public void run() { 
           try
           {
            MediaPlayer mediaPlayer = MediaPlayer.create(VizEQ.this, R.raw.vizeqintro);
            AudioManager audio = (AudioManager) VizEQ.this.getSystemService(VizEQ.this.AUDIO_SERVICE);
            if (audio.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) mediaPlayer.start(); // no need to call prepare(); create() does that for you
            sleep(mediaPlayer.getDuration()); //length of track
            mediaPlayer.release();
           }
           catch (Exception e)
           {
//             Log.d("Activity", "Login activity not started.");
           }
           finally
           {
             
             finish();
             Intent nextIntent = new Intent(VizEQ.this, RoleActivity.class);
            startActivity(nextIntent);  
           }
            }
    };
    splashThread.start();

  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu)
  {
    // Inflate the menu; this adds items to the action bar if it is present.
    //getMenuInflater().inflate(R.menu., menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.action_settings:
      Intent nextIntent  = new Intent(VizEQ.this, ProfileActivity.class);
      startActivity(nextIntent);
      break;
    case R.id.about:
      Intent nextIntent2 = new Intent(VizEQ.this, AboutActivity.class);
      startActivity(nextIntent2);
      break;
    }
    return true;
  }
}




Java Source Code List

com.lsu.vizeq.AboutActivity.java
com.lsu.vizeq.Artist.java
com.lsu.vizeq.BackableActivity.java
com.lsu.vizeq.HostActivity.java
com.lsu.vizeq.HostMenuActivity.java
com.lsu.vizeq.HostProfileActivity.java
com.lsu.vizeq.HostSoundVisualizationActivity.java
com.lsu.vizeq.Installation.java
com.lsu.vizeq.LibSpotifyWrapper.java
com.lsu.vizeq.LoginActivity.java
com.lsu.vizeq.MyApplication.java
com.lsu.vizeq.MyCanvas.java
com.lsu.vizeq.PVCircle.java
com.lsu.vizeq.PacketParser.java
com.lsu.vizeq.PlayerActivity.java
com.lsu.vizeq.PreferenceCircle.java
com.lsu.vizeq.PreferenceVisualizationActivity.java
com.lsu.vizeq.PreferenceVisualizer.java
com.lsu.vizeq.ProfileActivity.java
com.lsu.vizeq.RemoteControlReceiver.java
com.lsu.vizeq.RequestDetailsActivity.java
com.lsu.vizeq.RoleActivity.java
com.lsu.vizeq.SearchActivity.java
com.lsu.vizeq.SearchPartyActivity.java
com.lsu.vizeq.ServiceBinder.java
com.lsu.vizeq.SettingsActivity.java
com.lsu.vizeq.SoundVisualizationActivity.java
com.lsu.vizeq.SpotifyService.java
com.lsu.vizeq.TrackRow.java
com.lsu.vizeq.Track.java
com.lsu.vizeq.VisualizerView.java
com.lsu.vizeq.VizEQ.java
com.lsu.vizeq.WebService.java
com.lsu.vizeq.util.SystemPropertiesProxy.java
com.lsu.vizeq.util.SystemUiHiderBase.java
com.lsu.vizeq.util.SystemUiHiderHoneycomb.java
com.lsu.vizeq.util.SystemUiHider.java
com.lsu.vizeq.util.TunnelPlayerWorkaround.java