diff --git a/res/drawable/mic_active.png b/res/drawable/mic_active.png
new file mode 100644
index 000000000..662526993
Binary files /dev/null and b/res/drawable/mic_active.png differ
diff --git a/res/drawable/mic_muted.png b/res/drawable/mic_muted.png
new file mode 100644
index 000000000..f813691fc
Binary files /dev/null and b/res/drawable/mic_muted.png differ
diff --git a/res/drawable/speaker_32_off.png b/res/drawable/speaker_32_off.png
new file mode 100644
index 000000000..e93ae232f
Binary files /dev/null and b/res/drawable/speaker_32_off.png differ
diff --git a/res/drawable/speaker_32_on.png b/res/drawable/speaker_32_on.png
new file mode 100644
index 000000000..de8d4460e
Binary files /dev/null and b/res/drawable/speaker_32_on.png differ
diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml
index b2af87cec..db93411f3 100644
--- a/res/layout/dialer.xml
+++ b/res/layout/dialer.xml
@@ -3,9 +3,9 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
-
+
+
+
@@ -13,77 +13,81 @@
android:layout_weight="1" android:id="@+id/DialerRow01"
android:layout_width="fill_parent">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33">
+ android:id="@+id/ButtonStar" android:layout_weight="0.33">
+ android:layout_height="fill_parent" android:text="0+" android:id="@+id/Button00" android:layout_weight="0.33">
+ android:text="#" android:layout_weight="0.33">
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_weight="0.25" android:id="@+id/Decline">
+
+
+
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f5abae018..8c8fbed04 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,6 @@
+ Audio
Exit
Prefix
Advanced
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index ddce3aae4..c160892aa 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -1,11 +1,18 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java
index a600c37f6..7124eabf7 100644
--- a/src/org/linphone/DialerActivity.java
+++ b/src/org/linphone/DialerActivity.java
@@ -36,6 +36,8 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
@@ -44,6 +46,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private TextView mAddress;
private TextView mStatus;
private ImageButton mCall;
+ private ImageButton mDecline;
private ImageButton mHangup;
private Button mZero;
private Button mOne;
@@ -57,6 +60,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private Button mNine;
private Button mStar;
private Button mHash;
+
+ private LinearLayout mCallControlRow;
+ private LinearLayout mInCallControlRow;
+
private static DialerActivity theDialer;
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.setEnabled(false);
- mHangup.setOnClickListener(new OnClickListener() {
+
+ OnClickListener lHangupListener = new OnClickListener() {
public void onClick(View v) {
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
lLinphoneCore.terminateCall();
}
- });
+ };
+ mHangup.setOnClickListener(lHangupListener);
+ mDecline.setOnClickListener(lHangupListener);
class DialKeyListener implements OnClickListener {
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) ;
if (mZero != null) {
@@ -172,6 +193,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
mHash = (Button) findViewById(R.id.ButtonHash);
mHash.setOnClickListener(new DialKeyListener(mAddress,'#'));
}
+
mStatus = (TextView) findViewById(R.id.status_label);
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) {
// TODO Auto-generated method stub
@@ -202,12 +229,18 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
public void generalState(LinphoneCore lc, GeneralState state) {
switch(state) {
+ case GSTATE_POWER_ON:
+ mCall.setEnabled(!LinphoneService.instance().getLinphoneCore().isIncall());
+ mHangup.setEnabled(!mCall.isEnabled());
+ break;
case GSTATE_REG_OK: {
break;
}
case GSTATE_CALL_OUT_INVITE: {
//de-activate green button
mCall.setEnabled(false);
+ mCallControlRow.setVisibility(View.GONE);
+ mInCallControlRow.setVisibility(View.VISIBLE);
}
case GSTATE_CALL_IN_INVITE: {
// activate red button
@@ -256,6 +289,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
}
private void exitCallMode() {
+ mCallControlRow.setVisibility(View.VISIBLE);
+ mInCallControlRow.setVisibility(View.GONE);
mCall.setEnabled(true);
mHangup.setEnabled(false);
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
diff --git a/src/org/linphone/HistoryActivity.java b/src/org/linphone/HistoryActivity.java
index ee60fc7e9..821c2758d 100644
--- a/src/org/linphone/HistoryActivity.java
+++ b/src/org/linphone/HistoryActivity.java
@@ -97,7 +97,7 @@ public class HistoryActivity extends ListActivity {
lView = mInflater.inflate(R.layout.history_cell, parent,false);
}
- LinphoneCallLog lLog = mLogs.get(mLogs.size()-position-1);
+ LinphoneCallLog lLog = mLogs.get(position);
LinphoneAddress lAddress;
TextView lFirstLineView = (TextView) lView.findViewById(R.id.history_cell_first_line);
TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index 70292b4fb..f649ff749 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -61,6 +61,11 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
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);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
@@ -70,7 +75,7 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
}
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
@@ -100,17 +105,16 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
lTabHost.addTab(spec);
lTabHost.setCurrentTabByTag("dialer");
- // start linphone as background
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClass(this, LinphoneService.class);
- startService(intent);
+
}
+
@Override
- protected void onDestroy() {
- super.onDestroy();
+ protected void onPause() {
+ // TODO Auto-generated method stub
+ super.onPause();
if (isFinishing()) {
- //restaure audio settings
+ //restaure audio settings
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
mAudioManager.setMode(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.setClass(this, LinphoneService.class);
stopService(intent);
+ theLinphoneActivity = null;
}
- theLinphoneActivity = null;
+
+ }
+
+ @Override
+ protected void onStop() {
+ // TODO Auto-generated method stub
+ super.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -182,15 +199,15 @@ public class LinphoneActivity extends TabActivity implements SensorEventListener
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
- //nop
+ //nop
}
public void onSensorChanged(SensorEvent event) {
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;
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);
mMainFrame.setVisibility(View.VISIBLE);
}
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index c61e55f93..186a9064a 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -60,7 +60,9 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
Timer mTimer = new Timer("Linphone scheduler");
private Handler mHandler = new Handler() ;
-
+ static boolean isready() {
+ return (theLinphone!=null);
+ }
static LinphoneService instance() {
if (theLinphone == null) {
throw new RuntimeException("LinphoneActivity not instanciated yet");
@@ -83,6 +85,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
, new File(LINPHONE_FACTORY_RC)
, null);
+ mLinphoneCore.setSoftPlayLevel(3);
initFromConf();
TimerTask lTask = new TimerTask() {
diff --git a/src/org/linphone/core/LinphoneCore.java b/src/org/linphone/core/LinphoneCore.java
index 1f8e73449..915062118 100644
--- a/src/org/linphone/core/LinphoneCore.java
+++ b/src/org/linphone/core/LinphoneCore.java
@@ -136,5 +136,15 @@ public interface LinphoneCore {
* destroy linphone core and free all underlying resources
*/
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();
}
diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java
index b1dedfeb4..81685e886 100644
--- a/src/org/linphone/core/LinphoneCoreImpl.java
+++ b/src/org/linphone/core/LinphoneCoreImpl.java
@@ -51,7 +51,9 @@ class LinphoneCoreImpl implements LinphoneCore {
private native long getCallLog(long nativePtr,int position);
private native int getNumberOfCallLogs(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 {
@@ -159,4 +161,11 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setNetworkStateReachable(boolean isReachable) {
setNetworkStateReachable(nativePtr,isReachable);
}
+ public void setSoftPlayLevel(float gain) {
+ setSoftPlayLevel(nativePtr,gain);
+
+ }
+ public float getSoftPlayLevel() {
+ return getSoftPlayLevel(nativePtr);
+ }
}