diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml index 1036bd4d7..dbcb31e37 100644 --- a/src/android/AndroidManifest.xml +++ b/src/android/AndroidManifest.xml @@ -1,11 +1,10 @@ + android:versionName="1.0.2" android:versionCode="2"> + android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> diff --git a/src/android/res/layout/category_select.xml b/src/android/res/layout/category_select.xml index e2c3f0214..7d121f282 100644 --- a/src/android/res/layout/category_select.xml +++ b/src/android/res/layout/category_select.xml @@ -1,5 +1,5 @@ - + android:drawSelectorOnTop="false" + android:choiceMode="multipleChoice" android:fastScrollEnabled="true" /> + + + + diff --git a/src/android/res/layout/category_select_item.xml b/src/android/res/layout/category_select_item.xml index e439023d6..ec1e04ebb 100644 --- a/src/android/res/layout/category_select_item.xml +++ b/src/android/res/layout/category_select_item.xml @@ -1,7 +1,8 @@ - - - \ No newline at end of file + diff --git a/src/android/res/layout/help.xml b/src/android/res/layout/help.xml index 94c6f576e..fad5a7d21 100644 --- a/src/android/res/layout/help.xml +++ b/src/android/res/layout/help.xml @@ -3,8 +3,10 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> - - - - + + + + + + diff --git a/src/android/res/layout/main.xml b/src/android/res/layout/main.xml index 80c2b1a5f..08da5636d 100644 --- a/src/android/res/layout/main.xml +++ b/src/android/res/layout/main.xml @@ -10,11 +10,13 @@ - + - + + + diff --git a/src/android/res/layout/play_bpm_control.xml b/src/android/res/layout/play_bpm_control.xml index 50c57109c..6133d85b8 100644 --- a/src/android/res/layout/play_bpm_control.xml +++ b/src/android/res/layout/play_bpm_control.xml @@ -4,42 +4,38 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="8dp" - android:paddingRight="8dp" android:gravity="center_vertical|center_horizontal"> + android:paddingRight="8dp" android:gravity="center_horizontal"> - + - + + + + + + + - - - - + + + + + + + - - - + + - - - - - - - - - - - - \ No newline at end of file diff --git a/src/android/res/values/strings.xml b/src/android/res/values/strings.xml index c9a38ce26..206169a07 100644 --- a/src/android/res/values/strings.xml +++ b/src/android/res/values/strings.xml @@ -19,6 +19,6 @@ Player controls Browse Now playing -musikCube is a application that connects to you musikServer that you have installed on your desktop/server computer. Once musikCube is connected you are able to browse and play all your music directly on your phone without having to copy them to you SD card. +musikCube is a application that connects to your musikServer that you have installed on your desktop/server computer. The musikServer can be downloaded from http://code.google.com/p/musikcube/\nOnce musikCube is connected you are able to browse and play all your music directly on your phone without having to copy them to you SD card.\n diff --git a/src/android/src/org/musikcube/CategoryList.java b/src/android/src/org/musikcube/CategoryList.java index db5a62aae..161b871b0 100644 --- a/src/android/src/org/musikcube/CategoryList.java +++ b/src/android/src/org/musikcube/CategoryList.java @@ -5,7 +5,6 @@ package org.musikcube; import java.util.ArrayList; -import org.musikcube.TrackListBase.TrackViewHolder; import org.musikcube.core.IQuery; import org.musikcube.core.ListQuery; import org.musikcube.core.IQuery.OnQueryResultListener; @@ -21,7 +20,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; diff --git a/src/android/src/org/musikcube/CategorySelect.java b/src/android/src/org/musikcube/CategorySelect.java index 5d114a24f..de4cb08e2 100644 --- a/src/android/src/org/musikcube/CategorySelect.java +++ b/src/android/src/org/musikcube/CategorySelect.java @@ -5,26 +5,28 @@ package org.musikcube; import java.util.ArrayList; -import org.musikcube.TrackListBase.TrackViewHolder; import org.musikcube.core.IQuery; import org.musikcube.core.ListQuery; +import org.musikcube.core.Workout; import org.musikcube.core.IQuery.OnQueryResultListener; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; +import android.util.Log; +import android.util.SparseBooleanArray; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.View.OnClickListener; import android.widget.BaseAdapter; -import android.widget.CheckBox; -import android.widget.ImageView; +import android.widget.Button; +import android.widget.CheckedTextView; import android.widget.ListView; -import android.widget.TextView; /** * @author doy @@ -51,7 +53,7 @@ public class CategorySelect extends ListActivity implements OnQueryResultListene }; static class CategoryViewHolder{ - CheckBox title; + CheckedTextView title; } public class ResultAdapter extends BaseAdapter{ @@ -66,28 +68,15 @@ public class CategorySelect extends ListActivity implements OnQueryResultListene } public int getCount() { - int size = this.query.resultsInts.size(); - if(size==0){ - return 0; - }else{ - return size+1; - } + return this.query.resultsInts.size(); } public Object getItem(int position) { - if(position==0){ - return 0; - }else{ - return this.query.resultsInts.get(position-1); - } + return this.query.resultsInts.get(position); } public long getItemId(int position) { - if(position==0){ - return 0; - }else{ - return this.query.resultsInts.get(position-1); - } + return this.query.resultsInts.get(position); } public View getView(int position, View view, ViewGroup parent) { @@ -95,23 +84,43 @@ public class CategorySelect extends ListActivity implements OnQueryResultListene if(view==null){ view = inflator.inflate(R.layout.category_select_item, null); holder = new CategoryViewHolder(); - holder.title = (CheckBox) view.findViewById(R.id.text); + holder.title = (CheckedTextView) view.findViewById(R.id.text); view.setTag(holder); }else{ holder = (CategoryViewHolder)view.getTag(); } // - if(position==0){ - holder.title.setText("- All -"); - }else{ - holder.title.setText(this.query.resultsStrings.get(position-1)); - } + holder.title.setText(this.query.resultsStrings.get(position)); return view; } } + private OnClickListener onSaveClick = new OnClickListener() { + public void onClick(View v){ + final Intent intent = new Intent(CategorySelect.this, PlayerBPMControl.class); + + // Get selection + final SparseBooleanArray selectionList = CategorySelect.this.getListView().getCheckedItemPositions(); + final ArrayList selections = new ArrayList(); + ArrayList list = CategorySelect.this.query.resultsInts; + int listSize = list.size(); + for(int i=0;i{ @@ -184,7 +237,6 @@ public class PlayerBPMControl extends Activity implements OnTrackUpdateListener Bitmap bm = BitmapFactory.decodeStream(is); return bm; } catch (Exception e) { - Log.v("mC2:PLAYER","Error "+e.getMessage()); // e.printStackTrace(); return null; } @@ -231,6 +283,16 @@ public class PlayerBPMControl extends Activity implements OnTrackUpdateListener } } + // Update BPM + SeekBar bpmBar = (SeekBar)findViewById(R.id.BPM); + final int startBPM = 50; + final int endBPM = 200; + final float currentBPM = Workout.GetInstance().GetBPM(); + bpmBar.setProgress( (int) (((float)currentBPM-startBPM)*1000/(endBPM-startBPM)) ); + + TextView bpmTitle = (TextView)findViewById(R.id.BPMTitle); + bpmTitle.setText("BPM: "+currentBPM); + // Next callback in 0.5 seconds this.callbackTrackPositionsUpdateHandler.postDelayed(callbackTrackPositionsUpdateRunnable,500); @@ -249,5 +311,8 @@ public class PlayerBPMControl extends Activity implements OnTrackUpdateListener return super.onContextItemSelected(item); } } + public void OnBPMUpdate() { + this.callbackTrackUpdateHandler.post(this.callbackTrackUpdateRunnable); + } } diff --git a/src/android/src/org/musikcube/PlayerControl.java b/src/android/src/org/musikcube/PlayerControl.java index 96aa3c8b8..5a73646c2 100644 --- a/src/android/src/org/musikcube/PlayerControl.java +++ b/src/android/src/org/musikcube/PlayerControl.java @@ -15,7 +15,6 @@ import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; -import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -33,10 +32,10 @@ public class PlayerControl extends Activity implements OnTrackUpdateListener { private Object lock = new Object(); private boolean enable = false; private int currentAlbumCoverId = 0; + private boolean playing = false; @Override public void onCreate(Bundle savedInstanceState) { - Log.v("MC2::PC","OnCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.play_control); @@ -74,7 +73,11 @@ public class PlayerControl extends Activity implements OnTrackUpdateListener { private OnClickListener onPauseClick = new OnClickListener() { public void onClick(View v){ Intent intent = new Intent(PlayerControl.this, org.musikcube.Service.class); - intent.putExtra("org.musikcube.Service.action", "stop"); + if(Player.GetInstance().Playing()){ + intent.putExtra("org.musikcube.Service.action", "stop"); + }else{ + intent.putExtra("org.musikcube.Service.action", "play"); + } startService(intent); } }; @@ -124,14 +127,14 @@ public class PlayerControl extends Activity implements OnTrackUpdateListener { @Override protected void onPause() { this.enable = false; - Log.v("MC2::PC","OnPause"); + org.musikcube.core.Library.GetInstance().RemovePointer(); Player.GetInstance().SetUpdateListener(null); super.onPause(); } @Override protected void onResume() { this.enable = true; - Log.v("MC2::PC","OnResume"); + org.musikcube.core.Library.GetInstance().AddPointer(); Player.GetInstance().SetUpdateListener(this); super.onResume(); this.OnUpdateTrackPositionsUI(); @@ -213,6 +216,14 @@ public class PlayerControl extends Activity implements OnTrackUpdateListener { } } + // Update play button + ImageButton playButton = (ImageButton)findViewById(R.id.MediaPause); + if(Player.GetInstance().Playing()){ + playButton.setImageResource(R.drawable.ic_media_pause); + }else{ + playButton.setImageResource(R.drawable.ic_media_play); + } + } private class DownloadAlbumCoverTask extends AsyncTask{ @@ -228,8 +239,6 @@ public class PlayerControl extends Activity implements OnTrackUpdateListener { Bitmap bm = BitmapFactory.decodeStream(is); return bm; } catch (Exception e) { - Log.v("mC2:PLAYER","Error "+e.getMessage()); -// e.printStackTrace(); return null; } } diff --git a/src/android/src/org/musikcube/Service.java b/src/android/src/org/musikcube/Service.java index f789d6bee..30690b2b5 100644 --- a/src/android/src/org/musikcube/Service.java +++ b/src/android/src/org/musikcube/Service.java @@ -4,9 +4,9 @@ package org.musikcube; import org.musikcube.core.Library; -import org.musikcube.core.PaceDetector; import org.musikcube.core.Player; import org.musikcube.core.Track; +import org.musikcube.core.Workout; import android.app.Notification; import android.app.NotificationManager; @@ -16,7 +16,6 @@ import android.content.Intent; import android.os.IBinder; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; -import android.util.Log; /** * @author doy @@ -27,7 +26,8 @@ public class Service extends android.app.Service { Library library; Player player; boolean showingNotification = false; - PaceDetector paceDetector; + boolean bpmMode = false; + Workout workout; /** * @@ -47,7 +47,6 @@ public class Service extends android.app.Service { @Override public void onCreate(){ - Log.i("musikcube::Service","CREATE"); this.player = Player.GetInstance(); this.player.service = this; this.library = org.musikcube.core.Library.GetInstance(); @@ -78,19 +77,22 @@ public class Service extends android.app.Service { public void onStart(Intent intent, int startId) { // TODO Auto-generated method stub super.onStart(intent, startId); - + + boolean stopWorkout = false; + String action = intent.getStringExtra("org.musikcube.Service.action"); if(action==null){ return; } - if(action.equals("playlist")){ Player player = Player.GetInstance(); player.Play(intent.getIntegerArrayListExtra("org.musikcube.Service.tracklist"), intent.getIntExtra("org.musikcube.Service.position", 0)); + stopWorkout = true; } if(action.equals("appendlist")){ Player player = Player.GetInstance(); player.Append(intent.getIntegerArrayListExtra("org.musikcube.Service.tracklist")); + stopWorkout = true; } if(action.equals("remove_from_list")){ Player player = Player.GetInstance(); @@ -113,9 +115,7 @@ public class Service extends android.app.Service { if(action.equals("stop")){ Player player = Player.GetInstance(); player.Stop(); - if(this.paceDetector!=null){ - this.paceDetector.StopSensor(this); - } + stopWorkout = true; } if(action.equals("play")){ Player player = Player.GetInstance(); @@ -124,21 +124,30 @@ public class Service extends android.app.Service { if(action.equals("shutdown")){ //Log.i("musikcube::Service","Shutdown"); this.stopSelf(); + stopWorkout = true; } - if(action.equals("bpmstart")){ - Player.GetInstance().SetBPMMode(true); - if(this.paceDetector==null){ - this.paceDetector = new PaceDetector(); - this.paceDetector.StartSensor(this); + + if(stopWorkout){ + if(this.workout!=null){ + this.workout.Stop(); + this.workout = null; } } - if(action.equals("bpmstop")){ - if(this.paceDetector!=null){ - this.paceDetector.StopSensor(this); + + if(action.equals("workoutstart")){ + this.workout = Workout.GetInstance(); + this.workout.Startup(this); + } + if(action.equals("workoutstop")){ + if(this.workout!=null){ + this.workout.Stop(); + this.workout = null; } + Player player = Player.GetInstance(); + player.Stop(); } - if(action.equals("player_start")){ + if(action.equals("player_start") || this.workout!=null){ Track track = Player.GetInstance().GetCurrentTrack(); this.showingNotification = true; @@ -165,7 +174,13 @@ public class Service extends android.app.Service { contentText += trackArtist; } } - Intent notificationIntent = new Intent(this, Player.GetInstance().GetBPMMode()?PlayerBPMControl.class:PlayerControl.class); + Intent notificationIntent; + if(this.workout==null){ + notificationIntent = new Intent(this, PlayerControl.class); + }else{ + notificationIntent = new Intent(this, PlayerBPMControl.class); + } + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.flags |= Notification.FLAG_ONGOING_EVENT|Notification.FLAG_NO_CLEAR; @@ -174,7 +189,7 @@ public class Service extends android.app.Service { mNotificationManager.notify(1, notification); } - if(action.equals("player_end")){ + if(action.equals("player_end") && this.workout==null){ this.showingNotification = false; String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); diff --git a/src/android/src/org/musikcube/core/PaceDetector.java b/src/android/src/org/musikcube/core/PaceDetector.java index b47f2c76d..e08822429 100644 --- a/src/android/src/org/musikcube/core/PaceDetector.java +++ b/src/android/src/org/musikcube/core/PaceDetector.java @@ -2,31 +2,28 @@ package org.musikcube.core; import java.util.Collections; -import org.musikcube.core.IQuery.OnQueryResultListener; - import android.content.Context; -import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; -import android.util.Log; -public class PaceDetector implements Runnable, SensorEventListener, OnQueryResultListener { +public class PaceDetector implements Runnable, SensorEventListener{ - static public float MAX_BPM = 85; - static public float MIN_BPM = 40; - static public int WAVE_MEMORY = 20; - static public int WAVE_MIN_CALC = 10; - static public float WAVE_MIN_BPM_DIFF = 120; // This is in miliseconds - static public int WAVE_COMPARE = 4; - static public int MIN_PLAYTIME = 20000; // Play at leased 20 seconds of a track - static public float BPM_THRESHOLD = 10; // if BPM is off by more than 10 bpm, switch track + static final public float MAX_BPM = 100; + static final public float MIN_BPM = 40; + static final public int WAVE_MEMORY = 20; + static final public int WAVE_MIN_CALC = 10; + static final public float WAVE_MIN_BPM_DIFF = 100; // This is in miliseconds + static final public int WAVE_COMPARE = 4; + static final public int MIN_PLAYTIME = 20000; // Play at leased 20 seconds of a track + //static final public float BPM_THRESHOLD = 10; // if BPM is off by more than 10 bpm, switch track private float currentBPM = 0; private float currentAccuracy = 0; private long currentBPMstart = 0; + private Object lock = new Object(); private Context context; @@ -43,7 +40,7 @@ public class PaceDetector implements Runnable, SensorEventListener, OnQueryResul public float currentAccuracy = 0; final public void NextValue(float value){ - float diff = value-this.lastValue; + final float diff = value-this.lastValue; if(value=0 && diff<0){ // Amplitude must be at leased 5 - if(this.currentMax-this.currentMin<7){ + if(this.currentMax-this.currentMin<4){ this.currentMin = value; this.currentMax = value; -// Log.v("APM","-- "+(this.currentMax-this.currentMin)); }else{ -// Log.v("APM","B "+(this.currentMax-this.currentMin)); // this is a top on the curve this.beatTimes.add(android.os.SystemClock.elapsedRealtime()); this.amplitude.add(this.currentMax-this.currentMin); @@ -143,6 +138,21 @@ public class PaceDetector implements Runnable, SensorEventListener, OnQueryResul } + public interface OnBPMListener{ + public void OnBPMUpdate(); + } + protected OnBPMListener listener = null; + + public void SetListener(OnBPMListener listener){ + synchronized(this.lock){ + this.listener = listener; + if(this.listener!=null){ + this.listener.OnBPMUpdate(); + } + } + } + + private PaceDimension xAxis = new PaceDimension(); private PaceDimension yAxis = new PaceDimension(); private PaceDimension zAxis = new PaceDimension(); @@ -159,38 +169,40 @@ public class PaceDetector implements Runnable, SensorEventListener, OnQueryResul } public void ChangeBPM(float bpm,float accuracy){ - bpm *= 2; // BPM should be the double + while(bpm<85){ + bpm *= 2; + } + while(bpm>200){ + bpm *= 0.5; + } if(accuracy>=this.xAxis.currentAccuracy && accuracy>=this.yAxis.currentAccuracy && accuracy>=this.zAxis.currentAccuracy && accuracy>150){ // The BPM has changed long currentTime = android.os.SystemClock.elapsedRealtime(); - if(currentTime>this.currentBPMstart+MIN_PLAYTIME){ +// if(currentTime>this.currentBPMstart+MIN_PLAYTIME){ //Log.v("BPM","3 "+bpm); // We have played more than minimum time - if(bpm>this.currentBPM+BPM_THRESHOLD || bpmthis.currentBPM+BPM_THRESHOLD || bpm selectedCategories = new ArrayList(); + private String category = ""; + + public static final synchronized Workout GetInstance(){ + if(Workout.workout==null){ + Workout.workout = new org.musikcube.core.Workout(); + } + return Workout.workout; + } + + protected Workout(){ + this.bpm = 100+(float)Math.random(); + } + + public void Startup(Context context){ + synchronized (lock) { + this.context = context; + if(this.active==false){ + org.musikcube.core.Library.GetInstance().AddPointer(); + } + this.active = true; + if(this.listener!=null){ + this.listener.OnBPMUpdate(); + } + this.UseAccelerometer(this.useAccelerometer); + this.QueryTracks(true); + } + } + + public void Stop(){ + synchronized (lock) { + if(this.active==true){ + org.musikcube.core.Library.GetInstance().RemovePointer(); + } + this.active = false; + this.UseAccelerometer(this.useAccelerometer); + if(this.listener!=null){ + this.listener.OnBPMUpdate(); + } + } + } + + public void SetCategory(ArrayList selectedCategories,String category){ + synchronized (lock) { + this.selectedCategories = selectedCategories; + this.category = category; + } + } + + public boolean Active(){ + synchronized (lock) { + return this.active; + } + } + + + public void UseAccelerometer(boolean use){ + synchronized(lock){ + this.useAccelerometer = use; + if(this.context!=null){ + if(use && this.active){ + if(this.paceDetector==null){ + this.paceDetector = new PaceDetector(); + this.paceDetector.SetListener(this); + this.paceDetector.StartSensor(this.context); + } + } + if(!use || !this.active){ + if(this.paceDetector!=null){ + this.paceDetector.StopSensor(this.context); + this.paceDetector = null; + } + } + } + } + } + public boolean Accelerometer(){ + synchronized(lock){ + return this.useAccelerometer; + } + } + + public void SetBPM(float bpm){ + synchronized(lock){ + if(this.paceDetector==null){ + this.bpm = bpm; + if(this.active){ + this.QueryTracks(true); + } + } + } + } + + public float GetBPM(){ + synchronized(lock){ + return this.bpm; + } + } + + public void OnBPMUpdate() { + synchronized(lock){ + final float bpm = this.paceDetector.GetBPM(); + if(bpm>0.0){ + if(bpm>this.bpm+BPM_THRESHOLD || bpmthis.lastQueryTime+this.minimumPlaytime || force){ + this.lastQueryTime = currentTime; + // Get new tracks + BPMQuery query = new BPMQuery(); + query.queryForBPM = this.bpm; + query.selectionInts = (ArrayList) this.selectedCategories.clone(); + query.selectionStrings.add(this.category); + query.SetResultListener(this); + Library.GetInstance().AddQuery(query); + } + } + } + + public interface OnWorkoutListener{ + public void OnBPMUpdate(); + } + protected OnWorkoutListener listener = null; + + public void SetListener(OnWorkoutListener listener){ + synchronized(this.lock){ + this.listener = listener; + if(this.listener!=null){ + this.listener.OnBPMUpdate(); + } + } + } + + public void run() { + } + + public void OnQueryResults(IQuery query) { + synchronized(this.lock){ + this.lastQueryTime = android.os.SystemClock.elapsedRealtime(); + BPMQuery bpmQuery = (BPMQuery)query; + if(!bpmQuery.trackList.isEmpty() && this.context!=null){ + Intent intent = new Intent(this.context, org.musikcube.Service.class); + intent.putExtra("org.musikcube.Service.tracklist", bpmQuery.trackList); + intent.putExtra("org.musikcube.Service.position", 0); + intent.putExtra("org.musikcube.Service.action", "playlist_prepare"); + this.context.startService(intent); + } + } + } + +} diff --git a/src/android/src/org/musikcube/main.java b/src/android/src/org/musikcube/main.java index fe6689c9e..8d19fabd5 100644 --- a/src/android/src/org/musikcube/main.java +++ b/src/android/src/org/musikcube/main.java @@ -4,7 +4,6 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; -import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -38,9 +37,12 @@ public class main extends Activity implements OnLibraryStatusListener { yearButton.setOnClickListener(this.onYearClick); yearButton.setEnabled(false); - Button bpmButton = (Button)findViewById(R.id.BPMButton); - bpmButton.setOnClickListener(this.onBPMClick); - bpmButton.setEnabled(false); + Button bpmGenreButton = (Button)findViewById(R.id.BPMGenreButton); + bpmGenreButton.setOnClickListener(this.onBPMGenreClick); + bpmGenreButton.setEnabled(false); + Button bpmArtistButton = (Button)findViewById(R.id.BPMArtistButton); + bpmArtistButton.setOnClickListener(this.onBPMArtistClick); + bpmArtistButton.setEnabled(false); } @@ -68,18 +70,22 @@ public class main extends Activity implements OnLibraryStatusListener { } }; - private OnClickListener onBPMClick = new OnClickListener() { + private OnClickListener onBPMGenreClick = new OnClickListener() { public void onClick(View v){ -/* Log.v("mC2::main","onBPMClick 1"); - Intent intent2 = new Intent(main.this, PlayerBPMControl.class); - startActivity(intent2); - Log.v("mC2::main","onBPMClick 2");*/ Intent intent = new Intent(main.this, CategorySelect.class); intent.putExtra("org.musikcube.CategorySelect.listCategory", "genre"); startActivity(intent); } }; + private OnClickListener onBPMArtistClick = new OnClickListener() { + public void onClick(View v){ + Intent intent = new Intent(main.this, CategorySelect.class); + intent.putExtra("org.musikcube.CategorySelect.listCategory", "artist"); + startActivity(intent); + } + }; + public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.default_menu, menu); @@ -104,7 +110,6 @@ public class main extends Activity implements OnLibraryStatusListener { @Override protected void onResume() { - Log.v("mC2::Main","onResume"); super.onResume(); startService(new Intent(this, org.musikcube.Service.class)); org.musikcube.core.Library.GetInstance().AddPointer(); @@ -129,18 +134,21 @@ public class main extends Activity implements OnLibraryStatusListener { Button genreButton = (Button)findViewById(R.id.GenresButton); Button artistsButton = (Button)findViewById(R.id.ArtistsButton); Button yearButton = (Button)findViewById(R.id.YearButton); - Button bpmButton = (Button)findViewById(R.id.BPMButton); + Button bpmGenreButton = (Button)findViewById(R.id.BPMGenreButton); + Button bpmArtistButton = (Button)findViewById(R.id.BPMArtistButton); if(status==Library.STATUS_CONNECTED){ genreButton.setEnabled(true); artistsButton.setEnabled(true); yearButton.setEnabled(true); - bpmButton.setEnabled(false); + bpmGenreButton.setEnabled(true); + bpmArtistButton.setEnabled(true); }else{ genreButton.setEnabled(false); artistsButton.setEnabled(false); yearButton.setEnabled(false); - bpmButton.setEnabled(false); + bpmGenreButton.setEnabled(false); + bpmArtistButton.setEnabled(false); } TextView statusText = (TextView)findViewById(R.id.StatusView);