Skip to content

Commit

Permalink
merging anmed fixes with moamen's,new fix for stop on playlist mode
Browse files Browse the repository at this point in the history
  • Loading branch information
moamenam committed Jul 3, 2011
1 parent 517d085 commit fe53e56
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/com/android/QuranSteaming/PlayingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void moveToNext()
}
public void moveToPrev()
{
plManger.setPlayingIndex(plManger.getPlayingIndex(-2));
plManger.setPlayingIndex(plManger.getPlayingIndex(-1));
mp.stop();
}
public static boolean isConnected(Context context)
Expand Down
43 changes: 25 additions & 18 deletions src/com/android/QuranSteaming/QuranSteaming.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public int getDismissDialog() {
final int showSorryMessage = 2;
final int showWaitMessage= 3;
final int showPlayMenu = 4;
final int onPauseAction = 5;
};
static HandlerAction myHandlerAction= new HandlerAction();
public static boolean isRunning = false;
Expand Down Expand Up @@ -170,6 +171,11 @@ else if(msg.what==myHandlerAction.showPlayMenu)
{
showHideMenu();
}
else if(msg.what==myHandlerAction.onPauseAction)
{
alaMenuLayout.findViewById(R.id.btnStartStream).setVisibility(View.VISIBLE);
alaMenuLayout.findViewById(R.id.btnStopStream).setVisibility(View.INVISIBLE);
}
}
};
/** Called when the activity is first created. */
Expand Down Expand Up @@ -409,7 +415,14 @@ private void fillCategoy()
else
from = new String[] { "category_name_a"};
int[] to = new int[] { android.R.id.text1 };
SimpleCursorAdapter sca = new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item, cr, from, to);
SimpleCursorAdapter sca = new SimpleCursorAdapter
(this,android.R.layout.simple_spinner_item, cr, from, to){
@Override
public void setViewText(TextView v, String text){
v.setText(ArabicUtilities.reshape(text));
}
};

sca.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCategory.setAdapter(sca);
spnShaikh.setSelection(0);
Expand Down Expand Up @@ -466,7 +479,14 @@ public void fillShaikh(long categoryId,String selectMode)
else
from = new String[] { "shaikh_name_a"};
int[] to = new int[] { android.R.id.text1 };
SimpleCursorAdapter sca = new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item, cr, from, to);
SimpleCursorAdapter sca = new SimpleCursorAdapter
(this,android.R.layout.simple_spinner_item, cr, from, to){
@Override
public void setViewText(TextView v, String text){
v.setText(ArabicUtilities.reshape(text));
}
};

sca.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnShaikh.setAdapter(sca);
spnShaikh.setSelection(0);
Expand Down Expand Up @@ -1071,6 +1091,7 @@ private void onPauseClick(View v)
else
{
s.isRunning= false;
handler.sendEmptyMessage(myHandlerAction.onPauseAction);
}
}
private void moveToNext(View view)
Expand Down Expand Up @@ -1186,6 +1207,7 @@ protected void onDestroy() {

try {
//api.removeListener(collectorListener);
s.isRunning= false;
stopService(new Intent(this, PlayingService.class));
unbindService(mConnection);
} catch (Throwable t) {
Expand Down Expand Up @@ -1296,22 +1318,7 @@ public void run() {
}
}
}
private void startService(){
Intent intent = new Intent(this, PlayingService.class);
//intent.putExtra(QuranDataService.DWONLOAD_TYPE_KEY, PlayingService.DOWNLOAD_QURAN_IMAGES);
try{
if ((s==null) ||(!s.isRunning))
startService(intent);
boolean b=getApplicationContext().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
if(b)
{
return;
}
}
catch (Exception e) {
e.printStackTrace();
}
}

private boolean isMyServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
Expand Down

0 comments on commit fe53e56

Please sign in to comment.