mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 13:02:35 +00:00
Stop playback when there are incoming phonecalls.
Larger text in categoryView.
This commit is contained in:
parent
29ac94bc27
commit
035ce2c756
@ -26,4 +26,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
|
||||||
</manifest>
|
</manifest>
|
@ -7,6 +7,6 @@
|
|||||||
<TextView android:id="@+id/text"
|
<TextView android:id="@+id/text"
|
||||||
android:layout_width="0dip"
|
android:layout_width="0dip"
|
||||||
android:layout_weight="1.0"
|
android:layout_weight="1.0"
|
||||||
android:layout_height="wrap_content" android:textSize="24sp" android:fadingEdge="horizontal" android:maxLines="1" android:fadingEdgeLength="10sp"/>
|
android:layout_height="wrap_content" android:textSize="28sp" android:fadingEdge="horizontal" android:maxLines="1" android:fadingEdgeLength="10sp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -14,6 +14,10 @@ import android.app.PendingIntent;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.telephony.PhoneStateListener;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author doy
|
* @author doy
|
||||||
@ -49,8 +53,25 @@ public class Service extends android.app.Service {
|
|||||||
this.player.service = this;
|
this.player.service = this;
|
||||||
this.library = org.musikcube.core.Library.GetInstance();
|
this.library = org.musikcube.core.Library.GetInstance();
|
||||||
this.library.Startup(this);
|
this.library.Startup(this);
|
||||||
|
|
||||||
|
TelephonyManager telephony = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
telephony.listen(phoneStateListener,PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PhoneStateListener phoneStateListener = new PhoneStateListener() {
|
||||||
|
public void onCallStateChanged(int state,String incomingNumber){
|
||||||
|
switch(state)
|
||||||
|
{
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
Intent intent = new Intent(Service.this, org.musikcube.Service.class);
|
||||||
|
intent.putExtra("org.musikcube.Service.action", "stop");
|
||||||
|
startService(intent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see android.app.Service#onStart(android.content.Intent, int)
|
* @see android.app.Service#onStart(android.content.Intent, int)
|
||||||
*/
|
*/
|
||||||
|
@ -206,7 +206,6 @@ public class Library implements Runnable{
|
|||||||
}
|
}
|
||||||
//Log.v("Library::socket","Successfully connected to "+this.host+":"+this.queryPort);
|
//Log.v("Library::socket","Successfully connected to "+this.host+":"+this.queryPort);
|
||||||
|
|
||||||
this.SetStatus(STATUS_AUTHENTICATING);
|
|
||||||
|
|
||||||
doep.xml.Reader reader = new doep.xml.Reader(this.socket.getInputStream());
|
doep.xml.Reader reader = new doep.xml.Reader(this.socket.getInputStream());
|
||||||
//Log.v("Library::run","Reader started");
|
//Log.v("Library::run","Reader started");
|
||||||
@ -318,6 +317,8 @@ public class Library implements Runnable{
|
|||||||
|
|
||||||
public void WriteThread(WriterThreadHelper thread){
|
public void WriteThread(WriterThreadHelper thread){
|
||||||
//Log.v("Library::WriteThread","Started");
|
//Log.v("Library::WriteThread","Started");
|
||||||
|
this.SetStatus(STATUS_AUTHENTICATING);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
doep.xml.Writer writer = new doep.xml.Writer(this.socket.getOutputStream());
|
doep.xml.Writer writer = new doep.xml.Writer(this.socket.getOutputStream());
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user