add support for mute/speaker
This commit is contained in:
parent
0c1705227d
commit
8f94e5f38b
13 changed files with 157 additions and 71 deletions
BIN
res/drawable/mic_active.png
Normal file
BIN
res/drawable/mic_active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable/mic_muted.png
Normal file
BIN
res/drawable/mic_muted.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
BIN
res/drawable/speaker_32_off.png
Normal file
BIN
res/drawable/speaker_32_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 615 B |
BIN
res/drawable/speaker_32_on.png
Normal file
BIN
res/drawable/speaker_32_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 569 B |
|
@ -3,9 +3,9 @@
|
||||||
android:orientation="vertical" android:layout_width="fill_parent"
|
android:orientation="vertical" android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
<EditText android:id="@+id/SipUri" android:layout_height="wrap_content"
|
<LinearLayout android:id="@+id/LinearLayout02" android:layout_height="wrap_content" android:layout_width="fill_parent"><EditText android:id="@+id/SipUri" android:layout_height="wrap_content" android:hint="sip:" android:layout_width="fill_parent" android:lines="1" android:layout_weight="0.8"></EditText>
|
||||||
android:hint="sip:" android:layout_width="fill_parent"
|
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Erase" android:text=" <- "></Button>
|
||||||
android:singleLine="true"></EditText>
|
</LinearLayout>
|
||||||
|
|
||||||
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
|
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
@ -13,77 +13,81 @@
|
||||||
android:layout_weight="1" android:id="@+id/DialerRow01"
|
android:layout_weight="1" android:id="@+id/DialerRow01"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
<Button android:id="@+id/Button01" android:text="1"
|
<Button android:id="@+id/Button01" android:text="1"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:id="@+id/Button02" android:text="2"
|
<Button android:id="@+id/Button02" android:text="2"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:id="@+id/Button03" android:text="3"
|
<Button android:id="@+id/Button03" android:text="3"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.5"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_height="fill_parent"
|
<TableRow android:layout_height="fill_parent"
|
||||||
android:layout_weight="1" android:id="@+id/DialerRow02"
|
android:layout_weight="1" android:id="@+id/DialerRow02"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
<Button android:id="@+id/Button04" android:text="4"
|
<Button android:id="@+id/Button04" android:text="4"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:text="5" android:id="@+id/Button05"
|
<Button android:text="5" android:id="@+id/Button05"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:id="@+id/Button06" android:text="6"
|
<Button android:id="@+id/Button06" android:text="6"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.5"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
||||||
<Button android:text="7" android:id="@+id/Button07"
|
<Button android:text="7" android:id="@+id/Button07"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:id="@+id/Button08" android:text="8"
|
<Button android:id="@+id/Button08" android:text="8"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:text="9" android:id="@+id/Button09"
|
<Button android:text="9" android:id="@+id/Button09"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.5"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:text="*"
|
android:layout_height="fill_parent" android:text="*"
|
||||||
android:layout_weight="0.25" android:id="@+id/ButtonStar"></Button>
|
android:id="@+id/ButtonStar" android:layout_weight="0.33"></Button>
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:text="0+" android:id="@+id/Button00"
|
android:layout_height="fill_parent" android:text="0+" android:id="@+id/Button00" android:layout_weight="0.33"></Button>
|
||||||
android:layout_weight="0.25"></Button>
|
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:id="@+id/ButtonHash"
|
android:layout_height="fill_parent" android:id="@+id/ButtonHash"
|
||||||
android:text="#" android:layout_weight="0.5"></Button>
|
android:text="#" android:layout_weight="0.33"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent" android:layout_weight="1"
|
|
||||||
android:id="@+id/DialerRow05">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/LinearLayout01"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
||||||
|
<ToggleButton android:id="@+id/mic_mute_button"
|
||||||
|
android:textOn="" android:textOff=""
|
||||||
|
android:layout_weight="0.25" android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent" android:drawableTop="@drawable/mic_active" android:checked="true"></ToggleButton>
|
||||||
|
<ImageButton android:src="@drawable/red"
|
||||||
|
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="0.25" android:id="@+id/HangUp"></ImageButton>
|
||||||
|
<ToggleButton android:id="@+id/speaker_button"
|
||||||
|
android:textOn="" android:textOff=""
|
||||||
|
android:layout_weight="0.25" android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent" android:drawableTop="@drawable/speaker_32_on"></ToggleButton>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent" android:id="@+id/CallControlRow">
|
||||||
<ImageButton android:id="@+id/Call"
|
<ImageButton android:id="@+id/Call"
|
||||||
android:layout_height="fill_parent" android:src="@drawable/green"
|
android:layout_height="fill_parent" android:src="@drawable/green"
|
||||||
android:layout_width="fill_parent" android:layout_weight="0.25">
|
android:layout_width="fill_parent" android:layout_weight="0.25">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
|
<ImageButton android:src="@drawable/red"
|
||||||
|
|
||||||
<ImageButton android:id="@+id/HangUp" android:src="@drawable/red"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
||||||
android:layout_weight="0.25"></ImageButton>
|
android:layout_weight="0.25" android:id="@+id/Decline"></ImageButton>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
|
||||||
|
android:clickable="false" android:focusable="false"
|
||||||
</TableRow>
|
android:cursorVisible="false" android:textSize="12sp" android:height="15sp"
|
||||||
|
android:layout_height="wrap_content" android:background="@android:color/transparent"
|
||||||
|
android:textColor="@android:color/white"></EditText>
|
||||||
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
|
|
||||||
android:clickable="false" android:focusable="false"
|
|
||||||
android:cursorVisible="false" android:textSize="12sp" android:height="15sp"
|
|
||||||
android:layout_height="wrap_content"></EditText>
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="pref_audio">Audio</string>
|
||||||
<string name="menu_exit">Exit</string>
|
<string name="menu_exit">Exit</string>
|
||||||
<string name="pref_prefix">Prefix</string>
|
<string name="pref_prefix">Prefix</string>
|
||||||
<string name="pref_advanced">Advanced</string>
|
<string name="pref_advanced">Advanced</string>
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceCategory android:title="@string/pref_sipaccount">
|
||||||
<PreferenceCategory android:title="@string/pref_sipaccount"><EditTextPreference android:title="@string/pref_username" android:key="@string/pref_username_key"></EditTextPreference>
|
<EditTextPreference android:title="@string/pref_username"
|
||||||
<EditTextPreference android:title="@string/pref_passwd" android:key="@string/pref_passwd_key"></EditTextPreference>
|
android:key="@string/pref_username_key"></EditTextPreference>
|
||||||
<EditTextPreference android:title="@string/pref_domain" android:key="@string/pref_domain_key"></EditTextPreference>
|
<EditTextPreference android:title="@string/pref_passwd"
|
||||||
<EditTextPreference android:title="@string/pref_proxy" android:key="@string/pref_proxy_key"></EditTextPreference>
|
android:key="@string/pref_passwd_key"></EditTextPreference>
|
||||||
</PreferenceCategory>
|
<EditTextPreference android:title="@string/pref_domain"
|
||||||
<PreferenceCategory android:title="@string/pref_advanced"><EditTextPreference android:title="@string/pref_prefix" android:key="@string/pref_prefix_key"></EditTextPreference>
|
android:key="@string/pref_domain_key"></EditTextPreference>
|
||||||
</PreferenceCategory>
|
<EditTextPreference android:title="@string/pref_proxy"
|
||||||
|
android:key="@string/pref_proxy_key"></EditTextPreference>
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory android:title="@string/pref_advanced">
|
||||||
|
<EditTextPreference android:title="@string/pref_prefix"
|
||||||
|
android:key="@string/pref_prefix_key"></EditTextPreference>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -36,6 +36,8 @@ import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -44,6 +46,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
private TextView mAddress;
|
private TextView mAddress;
|
||||||
private TextView mStatus;
|
private TextView mStatus;
|
||||||
private ImageButton mCall;
|
private ImageButton mCall;
|
||||||
|
private ImageButton mDecline;
|
||||||
private ImageButton mHangup;
|
private ImageButton mHangup;
|
||||||
private Button mZero;
|
private Button mZero;
|
||||||
private Button mOne;
|
private Button mOne;
|
||||||
|
@ -57,6 +60,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
private Button mNine;
|
private Button mNine;
|
||||||
private Button mStar;
|
private Button mStar;
|
||||||
private Button mHash;
|
private Button mHash;
|
||||||
|
|
||||||
|
private LinearLayout mCallControlRow;
|
||||||
|
private LinearLayout mInCallControlRow;
|
||||||
|
|
||||||
private static DialerActivity theDialer;
|
private static DialerActivity theDialer;
|
||||||
|
|
||||||
private String mDisplayName;
|
private String mDisplayName;
|
||||||
|
@ -120,16 +127,19 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
mDecline= (ImageButton) findViewById(R.id.Decline);
|
||||||
mHangup = (ImageButton) findViewById(R.id.HangUp);
|
mHangup = (ImageButton) findViewById(R.id.HangUp);
|
||||||
mHangup.setEnabled(false);
|
|
||||||
mHangup.setOnClickListener(new OnClickListener() {
|
OnClickListener lHangupListener = new OnClickListener() {
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||||
lLinphoneCore.terminateCall();
|
lLinphoneCore.terminateCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
};
|
||||||
|
mHangup.setOnClickListener(lHangupListener);
|
||||||
|
mDecline.setOnClickListener(lHangupListener);
|
||||||
|
|
||||||
class DialKeyListener implements OnClickListener {
|
class DialKeyListener implements OnClickListener {
|
||||||
final String mKeyCode;
|
final String mKeyCode;
|
||||||
|
@ -143,7 +153,18 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
||||||
|
mInCallControlRow = (LinearLayout) findViewById(R.id.IncallControlRow);
|
||||||
|
mInCallControlRow.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (LinphoneService.isready()) {
|
||||||
|
if (LinphoneService.instance().getLinphoneCore().isIncall()) {
|
||||||
|
mCall.setEnabled(false);
|
||||||
|
mHangup.setEnabled(!mCall.isEnabled());
|
||||||
|
mCallControlRow.setVisibility(View.GONE);
|
||||||
|
mInCallControlRow.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mZero = (Button) findViewById(R.id.Button00) ;
|
mZero = (Button) findViewById(R.id.Button00) ;
|
||||||
if (mZero != null) {
|
if (mZero != null) {
|
||||||
|
@ -172,6 +193,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mHash = (Button) findViewById(R.id.ButtonHash);
|
mHash = (Button) findViewById(R.id.ButtonHash);
|
||||||
mHash.setOnClickListener(new DialKeyListener(mAddress,'#'));
|
mHash.setOnClickListener(new DialKeyListener(mAddress,'#'));
|
||||||
}
|
}
|
||||||
|
|
||||||
mStatus = (TextView) findViewById(R.id.status_label);
|
mStatus = (TextView) findViewById(R.id.status_label);
|
||||||
theDialer = this;
|
theDialer = this;
|
||||||
|
|
||||||
|
@ -180,6 +202,11 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
@ -202,12 +229,18 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
public void generalState(LinphoneCore lc, GeneralState state) {
|
public void generalState(LinphoneCore lc, GeneralState state) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
|
|
||||||
|
case GSTATE_POWER_ON:
|
||||||
|
mCall.setEnabled(!LinphoneService.instance().getLinphoneCore().isIncall());
|
||||||
|
mHangup.setEnabled(!mCall.isEnabled());
|
||||||
|
break;
|
||||||
case GSTATE_REG_OK: {
|
case GSTATE_REG_OK: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_OUT_INVITE: {
|
case GSTATE_CALL_OUT_INVITE: {
|
||||||
//de-activate green button
|
//de-activate green button
|
||||||
mCall.setEnabled(false);
|
mCall.setEnabled(false);
|
||||||
|
mCallControlRow.setVisibility(View.GONE);
|
||||||
|
mInCallControlRow.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_IN_INVITE: {
|
case GSTATE_CALL_IN_INVITE: {
|
||||||
// activate red button
|
// activate red button
|
||||||
|
@ -256,6 +289,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitCallMode() {
|
private void exitCallMode() {
|
||||||
|
mCallControlRow.setVisibility(View.VISIBLE);
|
||||||
|
mInCallControlRow.setVisibility(View.GONE);
|
||||||
mCall.setEnabled(true);
|
mCall.setEnabled(true);
|
||||||
mHangup.setEnabled(false);
|
mHangup.setEnabled(false);
|
||||||
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
|
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class HistoryActivity extends ListActivity {
|
||||||
lView = mInflater.inflate(R.layout.history_cell, parent,false);
|
lView = mInflater.inflate(R.layout.history_cell, parent,false);
|
||||||
|
|
||||||
}
|
}
|
||||||
LinphoneCallLog lLog = mLogs.get(mLogs.size()-position-1);
|
LinphoneCallLog lLog = mLogs.get(position);
|
||||||
LinphoneAddress lAddress;
|
LinphoneAddress lAddress;
|
||||||
TextView lFirstLineView = (TextView) lView.findViewById(R.id.history_cell_first_line);
|
TextView lFirstLineView = (TextView) lView.findViewById(R.id.history_cell_first_line);
|
||||||
TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
|
TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
|
||||||
|
|
|
@ -61,6 +61,11 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
theLinphoneActivity = this;
|
theLinphoneActivity = this;
|
||||||
|
// start linphone as background
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.setClass(this, LinphoneService.class);
|
||||||
|
startService(intent);
|
||||||
|
|
||||||
mMainFrame = (FrameLayout) findViewById(R.id.main_frame);
|
mMainFrame = (FrameLayout) findViewById(R.id.main_frame);
|
||||||
|
|
||||||
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||||
|
@ -70,7 +75,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
}
|
}
|
||||||
mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE));
|
mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE));
|
||||||
|
|
||||||
TabHost lTabHost = getTabHost(); // The activity TabHost
|
TabHost lTabHost = getTabHost(); // The activity TabHost
|
||||||
TabHost.TabSpec spec; // Reusable TabSpec for each tab
|
TabHost.TabSpec spec; // Reusable TabSpec for each tab
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,17 +105,16 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
lTabHost.addTab(spec);
|
lTabHost.addTab(spec);
|
||||||
|
|
||||||
lTabHost.setCurrentTabByTag("dialer");
|
lTabHost.setCurrentTabByTag("dialer");
|
||||||
// start linphone as background
|
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
|
||||||
intent.setClass(this, LinphoneService.class);
|
|
||||||
startService(intent);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onPause() {
|
||||||
super.onDestroy();
|
// TODO Auto-generated method stub
|
||||||
|
super.onPause();
|
||||||
if (isFinishing()) {
|
if (isFinishing()) {
|
||||||
//restaure audio settings
|
//restaure audio settings
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
|
||||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||||
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
||||||
|
@ -121,8 +125,21 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
intent.setClass(this, LinphoneService.class);
|
intent.setClass(this, LinphoneService.class);
|
||||||
stopService(intent);
|
stopService(intent);
|
||||||
|
theLinphoneActivity = null;
|
||||||
}
|
}
|
||||||
theLinphoneActivity = null;
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
@ -182,15 +199,15 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||||
//nop
|
//nop
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
WindowManager.LayoutParams lAttrs =getWindow().getAttributes();
|
WindowManager.LayoutParams lAttrs =getWindow().getAttributes();
|
||||||
if (event.values[0] == 0) {
|
if (LinphoneService.instance().getLinphoneCore().isIncall() && event.values[0] == 0) {
|
||||||
lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
mMainFrame.setVisibility(View.INVISIBLE);
|
mMainFrame.setVisibility(View.INVISIBLE);
|
||||||
} else if (event.values[0] == 1) {
|
} else if (mMainFrame.getVisibility() != View.VISIBLE && event.values[0] == 1) {
|
||||||
lAttrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
lAttrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
mMainFrame.setVisibility(View.VISIBLE);
|
mMainFrame.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,9 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
||||||
Timer mTimer = new Timer("Linphone scheduler");
|
Timer mTimer = new Timer("Linphone scheduler");
|
||||||
|
|
||||||
private Handler mHandler = new Handler() ;
|
private Handler mHandler = new Handler() ;
|
||||||
|
static boolean isready() {
|
||||||
|
return (theLinphone!=null);
|
||||||
|
}
|
||||||
static LinphoneService instance() {
|
static LinphoneService instance() {
|
||||||
if (theLinphone == null) {
|
if (theLinphone == null) {
|
||||||
throw new RuntimeException("LinphoneActivity not instanciated yet");
|
throw new RuntimeException("LinphoneActivity not instanciated yet");
|
||||||
|
@ -83,6 +85,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
||||||
, new File(LINPHONE_FACTORY_RC)
|
, new File(LINPHONE_FACTORY_RC)
|
||||||
, null);
|
, null);
|
||||||
|
|
||||||
|
mLinphoneCore.setSoftPlayLevel(3);
|
||||||
initFromConf();
|
initFromConf();
|
||||||
|
|
||||||
TimerTask lTask = new TimerTask() {
|
TimerTask lTask = new TimerTask() {
|
||||||
|
|
|
@ -136,5 +136,15 @@ public interface LinphoneCore {
|
||||||
* destroy linphone core and free all underlying resources
|
* destroy linphone core and free all underlying resources
|
||||||
*/
|
*/
|
||||||
public void destroy();
|
public void destroy();
|
||||||
|
/**
|
||||||
|
* Allow to control play level before entering sound card:
|
||||||
|
* @param level in db
|
||||||
|
*/
|
||||||
|
public void setSoftPlayLevel(float gain);
|
||||||
|
/**
|
||||||
|
* get play level before entering sound card:
|
||||||
|
* @return level in db
|
||||||
|
*/
|
||||||
|
public float getSoftPlayLevel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
private native long getCallLog(long nativePtr,int position);
|
private native long getCallLog(long nativePtr,int position);
|
||||||
private native int getNumberOfCallLogs(long nativePtr);
|
private native int getNumberOfCallLogs(long nativePtr);
|
||||||
private native void delete(long nativePtr);
|
private native void delete(long nativePtr);
|
||||||
private native void setNetworkStateReachable(long nativePtr,boolean isReachable);
|
private native void setNetworkStateReachable(long nativePtr,boolean isReachable);
|
||||||
|
private native void setSoftPlayLevel(long nativeptr, float gain);
|
||||||
|
private native float getSoftPlayLevel(long nativeptr);
|
||||||
|
|
||||||
|
|
||||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||||
|
@ -159,4 +161,11 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public void setNetworkStateReachable(boolean isReachable) {
|
public void setNetworkStateReachable(boolean isReachable) {
|
||||||
setNetworkStateReachable(nativePtr,isReachable);
|
setNetworkStateReachable(nativePtr,isReachable);
|
||||||
}
|
}
|
||||||
|
public void setSoftPlayLevel(float gain) {
|
||||||
|
setSoftPlayLevel(nativePtr,gain);
|
||||||
|
|
||||||
|
}
|
||||||
|
public float getSoftPlayLevel() {
|
||||||
|
return getSoftPlayLevel(nativePtr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue