diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5d113f2d6..3551088b3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -28,7 +28,7 @@
+ android:theme="@style/NoTitle">
@@ -51,7 +51,7 @@
@@ -61,7 +61,7 @@
@@ -71,7 +71,7 @@
@@ -80,18 +80,18 @@
+ android:theme="@style/NoTitle">
+ android:theme="@style/NoTitle">
diff --git a/res/layout-land/incall.xml b/res/layout-land/incall.xml
index 5711885af..2b6c32975 100644
--- a/res/layout-land/incall.xml
+++ b/res/layout-land/incall.xml
@@ -5,35 +5,28 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
-
-
-
-
-
-
+ android:layout_height="match_parent"
+ android:orientation="horizontal" />
+ android:visibility="invisible" />
+
+
@@ -42,6 +35,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
+ android:visibility="gone"
android:orientation="vertical" >
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent"
+ android:orientation="horizontal" />
+ android:layout_marginTop="20dp"
+ android:visibility="invisible"
+ android:src="@drawable/switch_camera" />
+
+
@@ -78,6 +80,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java
index 02d599170..6195be9ea 100644
--- a/src/org/linphone/InCallActivity.java
+++ b/src/org/linphone/InCallActivity.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
+import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCallParams;
@@ -82,6 +83,7 @@ public class InCallActivity extends FragmentActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
+ Compatibility.setFullScreen(getWindow());
setContentView(R.layout.incall);
isVideoEnabled = getIntent().getExtras() != null && getIntent().getExtras().getBoolean("VideoEnabled");
@@ -151,8 +153,8 @@ public class InCallActivity extends FragmentActivity implements
dialer.setEnabled(false);
numpad = (Numpad) findViewById(R.id.numpad);
- switchCamera = (ImageView) findViewById(R.id.switchCamera);
- switchCamera.setOnClickListener(this);
+ switchCamera = (ImageView) findViewById(R.id.switchCamera);
+ switchCamera.setOnClickListener(this);
mControlsLayout = (LinearLayout) findViewById(R.id.menu);
@@ -300,6 +302,10 @@ public class InCallActivity extends FragmentActivity implements
}
private void replaceFragmentAudioByVideo() {
+ //Hiding controls to let displayVideoCallControlsIfHidden add them plus the callback
+ mControlsLayout.setVisibility(View.GONE);
+ switchCamera.setVisibility(View.INVISIBLE);
+
videoCallFragment = new VideoCallFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
@@ -308,10 +314,6 @@ public class InCallActivity extends FragmentActivity implements
transaction.commitAllowingStateLoss();
} catch (Exception e) {
}
-
- if (AndroidCameraConfiguration.retrieveCameras().length > 1) {
- switchCamera.setVisibility(View.VISIBLE);
- }
}
private void toogleMicro() {
@@ -394,7 +396,9 @@ public class InCallActivity extends FragmentActivity implements
}
});
mControlsLayout.startAnimation(animation);
- switchCamera.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_top_to_bottom));
+ if (AndroidCameraConfiguration.retrieveCameras().length > 1) {
+ switchCamera.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_top_to_bottom));
+ }
}
resetControlsHidingCallBack();
@@ -442,7 +446,9 @@ public class InCallActivity extends FragmentActivity implements
}
});
mControlsLayout.startAnimation(animation);
- switchCamera.startAnimation(AnimationUtils.loadAnimation(instance, R.anim.slide_out_bottom_to_top));
+ if (AndroidCameraConfiguration.retrieveCameras().length > 1) {
+ switchCamera.startAnimation(AnimationUtils.loadAnimation(instance, R.anim.slide_out_bottom_to_top));
+ }
}
}
}, SECONDS_BEFORE_HIDING_CONTROLS);
diff --git a/src/org/linphone/IncomingCallActivity.java b/src/org/linphone/IncomingCallActivity.java
index e65a7a6e4..53201b899 100644
--- a/src/org/linphone/IncomingCallActivity.java
+++ b/src/org/linphone/IncomingCallActivity.java
@@ -50,7 +50,7 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
private AvatarWithShadow mPictureView;
private LinphoneCall mCall;
private LinphoneSliders mIncomingCallWidget;
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@@ -61,8 +61,7 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
mPictureView = (AvatarWithShadow) findViewById(R.id.incoming_picture);
// set this flag so this activity will stay in front of the keyguard
- int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
- flags |= WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
+ int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
getWindow().addFlags(flags);
@@ -70,7 +69,6 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
mIncomingCallWidget = (LinphoneSliders) findViewById(R.id.sliding_widget);
mIncomingCallWidget.setOnTriggerListener(this);
-
super.onCreate(savedInstanceState);
}
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index d3eb9802c..ea89b59a3 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -1402,6 +1402,5 @@ public final class LinphoneManager implements LinphoneCoreListener {
@Override
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
LinphoneAddress from, byte[] event) {
-
}
}
diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java
index 3f0599b40..a6c126807 100644
--- a/src/org/linphone/StatusFragment.java
+++ b/src/org/linphone/StatusFragment.java
@@ -51,7 +51,7 @@ public class StatusFragment extends Fragment {
private Handler mHandler = new Handler();
private Handler refreshHandler = new Handler();
private TextView statusText, exit;
- private ImageView statusLed, callQuality, encryption;
+ private ImageView statusLed, callQuality, encryption, background;
private ListView sliderContent;
private SlidingDrawer drawer;
// private LinearLayout allAccountsLed;
@@ -67,6 +67,7 @@ public class StatusFragment extends Fragment {
statusLed = (ImageView) view.findViewById(R.id.statusLed);
callQuality = (ImageView) view.findViewById(R.id.callQuality);
encryption = (ImageView) view.findViewById(R.id.encryption);
+ background = (ImageView) view.findViewById(R.id.background);
// allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
@@ -299,6 +300,7 @@ public class StatusFragment extends Fragment {
MediaEncryption mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
exit.setVisibility(View.GONE);
+ background.setVisibility(View.GONE);
encryption.setVisibility(View.VISIBLE);
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified())) {
@@ -310,6 +312,7 @@ public class StatusFragment extends Fragment {
}
} else {
exit.setVisibility(View.VISIBLE);
+ background.setVisibility(View.VISIBLE);
}
}
diff --git a/src/org/linphone/compatibility/ApiElevenPlus.java b/src/org/linphone/compatibility/ApiElevenPlus.java
index 0fee020a3..13b2182b0 100644
--- a/src/org/linphone/compatibility/ApiElevenPlus.java
+++ b/src/org/linphone/compatibility/ApiElevenPlus.java
@@ -7,6 +7,9 @@ import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
/*
ApiElevenPlus.java
@@ -80,4 +83,13 @@ public class ApiElevenPlus {
Context context, String title, String content, PendingIntent intent) {
notif.setLatestEventInfo(context, title, content, intent);
}
+
+ @SuppressWarnings("deprecation")
+ public static void setFullScreen(Window window) {
+ window.getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
+
+ WindowManager.LayoutParams lAttrs = window.getAttributes();
+ lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ window.setAttributes(lAttrs);
+ }
}
diff --git a/src/org/linphone/compatibility/ApiFivePlus.java b/src/org/linphone/compatibility/ApiFivePlus.java
index 363b7ffca..6a5b2f7dc 100644
--- a/src/org/linphone/compatibility/ApiFivePlus.java
+++ b/src/org/linphone/compatibility/ApiFivePlus.java
@@ -32,6 +32,8 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Intents.Insert;
import android.view.Display;
+import android.view.Window;
+import android.view.WindowManager;
/*
ApiFivePlus.java
@@ -321,4 +323,10 @@ public class ApiFivePlus {
public static void setNotificationLatestEventInfo(Notification notif, Context context, String title, String content, PendingIntent intent) {
notif.setLatestEventInfo(context, title, content, intent);
}
+
+ public static void setFullScreen(Window window) {
+ WindowManager.LayoutParams lAttrs = window.getAttributes();
+ lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ window.setAttributes(lAttrs);
+ }
}
diff --git a/src/org/linphone/compatibility/ApiFourteenPlus.java b/src/org/linphone/compatibility/ApiFourteenPlus.java
new file mode 100644
index 000000000..59b04323c
--- /dev/null
+++ b/src/org/linphone/compatibility/ApiFourteenPlus.java
@@ -0,0 +1,38 @@
+package org.linphone.compatibility;
+
+import android.annotation.TargetApi;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+/*
+ApiFourteenPlus.java
+Copyright (C) 2012 Belledonne Communications, Grenoble, France
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+/**
+ * @author Sylvain Berfini
+ */
+
+@TargetApi(14)
+public class ApiFourteenPlus {
+ public static void setFullScreen(Window window) {
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
+
+ WindowManager.LayoutParams lAttrs = window.getAttributes();
+ lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ window.setAttributes(lAttrs);
+ }
+}
diff --git a/src/org/linphone/compatibility/ApiSixteenPlus.java b/src/org/linphone/compatibility/ApiSixteenPlus.java
index 14d2b8d3f..88a544550 100644
--- a/src/org/linphone/compatibility/ApiSixteenPlus.java
+++ b/src/org/linphone/compatibility/ApiSixteenPlus.java
@@ -7,6 +7,9 @@ import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
/*
ApiSixteenPlus.java
Copyright (C) 2012 Belledonne Communications, Grenoble, France
@@ -76,4 +79,12 @@ public class ApiSixteenPlus {
return notif;
}
+
+ public static void setFullScreen(Window window) {
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LOW_PROFILE);
+
+ WindowManager.LayoutParams lAttrs = window.getAttributes();
+ lAttrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ window.setAttributes(lAttrs);
+ }
}
diff --git a/src/org/linphone/compatibility/Compatibility.java b/src/org/linphone/compatibility/Compatibility.java
index 275664d56..c9cb6c0b1 100644
--- a/src/org/linphone/compatibility/Compatibility.java
+++ b/src/org/linphone/compatibility/Compatibility.java
@@ -34,6 +34,7 @@ import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.view.Display;
+import android.view.Window;
/**
* @author Sylvain Berfini
*/
@@ -170,4 +171,16 @@ public class Compatibility {
}
return null;
}
+
+ public static void setFullScreen(Window window) {
+ if (Version.sdkAboveOrEqual(16)) {
+ ApiSixteenPlus.setFullScreen(window);
+ } else if (Version.sdkAboveOrEqual(14)) {
+ ApiFourteenPlus.setFullScreen(window);
+ } else if (Version.sdkAboveOrEqual(11)) {
+ ApiElevenPlus.setFullScreen(window);
+ } else {
+ ApiFivePlus.setFullScreen(window);
+ }
+ }
}
diff --git a/src/org/linphone/ui/AddressText.java b/src/org/linphone/ui/AddressText.java
index 4ea908130..c47495dad 100644
--- a/src/org/linphone/ui/AddressText.java
+++ b/src/org/linphone/ui/AddressText.java
@@ -15,36 +15,47 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
package org.linphone.ui;
import org.linphone.LinphoneManager.AddressType;
import android.content.Context;
+import android.graphics.Paint;
import android.net.Uri;
import android.util.AttributeSet;
+import android.util.TypedValue;
import android.widget.EditText;
/**
* @author Guillaume Beraudo
- *
+ *
*/
public class AddressText extends EditText implements AddressType {
private String displayedName;
private Uri pictureUri;
- public void setPictureUri(Uri uri) {pictureUri = uri;}
- public Uri getPictureUri() {return pictureUri;}
+ private Paint mTestPaint;
+ public void setPictureUri(Uri uri) {
+ pictureUri = uri;
+ }
+
+ public Uri getPictureUri() {
+ return pictureUri;
+ }
public AddressText(Context context, AttributeSet attrs) {
super(context, attrs);
+
+ mTestPaint = new Paint();
+ mTestPaint.set(this.getPaint());
}
public void clearDisplayedName() {
displayedName = "";
}
-
+
public String getDisplayedName() {
return displayedName;
}
@@ -63,7 +74,63 @@ public class AddressText extends EditText implements AddressType {
int after) {
clearDisplayedName();
pictureUri = null;
+
+ String resizedText = getText().toString();
+ if (resizedText.equals("") && getHint() != null) {
+ resizedText = getHint().toString();
+ }
+ refitText(resizedText, getWidth());
+
super.onTextChanged(text, start, before, after);
}
+ @Override
+ protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
+ if (width != oldWidth) {
+ String resizedText = getText().toString();
+ if (resizedText.equals("") && getHint() != null) {
+ resizedText = getHint().toString();
+ }
+ refitText(resizedText, getWidth());
+ }
+ }
+
+ private void refitText(String text, int textWidth) {
+ if (textWidth <= 0) {
+ return;
+ }
+
+ int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
+ float hi = 90;
+ float lo = 2;
+ final float threshold = 0.5f;
+
+ mTestPaint.set(getPaint());
+
+ while ((hi - lo) > threshold) {
+ float size = (hi + lo) / 2;
+ mTestPaint.setTextSize(size);
+ if (mTestPaint.measureText(text) >= targetWidth) {
+ hi = size;
+ }
+ else {
+ lo = size;
+ }
+ }
+
+ setTextSize(TypedValue.COMPLEX_UNIT_PX, lo);
+ }
+
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
+ int height = getMeasuredHeight();
+
+ String resizedText = getText().toString();
+ if (resizedText.equals("") && getHint() != null) {
+ resizedText = getHint().toString();
+ }
+ refitText(resizedText, parentWidth);
+ setMeasuredDimension(parentWidth, height);
+ }
}