Landscape incall view

This commit is contained in:
Sylvain Berfini 2012-07-20 16:20:16 +02:00
parent 64732160e5
commit 1cef2ca364
50 changed files with 434 additions and 201 deletions

View file

@ -83,8 +83,8 @@
<activity android:name="org.linphone.InCallActivity" <activity android:name="org.linphone.InCallActivity"
android:theme="@android:style/Theme.NoTitleBar" android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait"> android:configChanges="orientation">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

218
res/layout-land/incall.xml Normal file
View file

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingTop="20dp" />
<fragment
android:id="@+id/status"
android:name="org.linphone.StatusFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/status" />
</FrameLayout>
<ImageView
android:id="@+id/switchCamera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/content_description_switch_camera"
android:paddingTop="20dp"
android:src="@drawable/switch_camera"
android:visibility="gone" />
<LinearLayout
android:id="@+id/menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="0.5"
android:orientation="horizontal" >
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<ImageView
android:id="@+id/transfer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options_transfer"
android:visibility="gone" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="0.5"
android:orientation="horizontal" >
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
<ImageView
android:id="@+id/addCall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options_add_call_alt"
android:visibility="gone" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="0.5"
android:orientation="horizontal" >
<ImageView
android:id="@+id/pause"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_pause"
android:scaleType="fitXY"
android:src="@drawable/pause_off" />
<ImageView
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_switch_video"
android:scaleType="fitXY"
android:src="@drawable/video_off" />
<ImageView
android:id="@+id/micro"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_toggle_micro"
android:scaleType="fitXY"
android:src="@drawable/micro_on" />
<ImageView
android:id="@+id/hangUp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_hang_up"
android:scaleType="fitXY"
android:src="@drawable/hangup" />
<ImageView
android:id="@+id/speaker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_toggle_speaker"
android:scaleType="fitXY"
android:src="@drawable/speaker_off" />
<ImageView
android:id="@+id/options"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options" />
<ImageView
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_numpad"
android:scaleType="fitXY"
android:src="@drawable/dialer_alt" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,192 +1,189 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent" >
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content" >
<LinearLayout <LinearLayout
android:id="@+id/fragmentContainer" android:id="@+id/fragmentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="20dp" android:orientation="horizontal"
android:orientation="horizontal" /> android:paddingTop="20dp" />
<fragment android:name="org.linphone.StatusFragment" <fragment
android:id="@+id/status" android:id="@+id/status"
android:layout_width="match_parent" android:name="org.linphone.StatusFragment"
android:layout_height="wrap_content" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/status" />
</FrameLayout>
</FrameLayout> <ImageView
android:id="@+id/switchCamera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/content_description_switch_camera"
android:paddingTop="20dp"
android:src="@drawable/switch_camera"
android:visibility="gone" />
<ImageView <LinearLayout
android:id="@+id/switchCamera" android:id="@+id/menu"
android:visibility="gone" android:layout_width="match_parent"
android:paddingTop="20dp" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_alignParentBottom="true"
android:layout_height="wrap_content" android:orientation="vertical" >
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/content_description_switch_camera"
android:src="@drawable/switch_camera" />
<LinearLayout <LinearLayout
android:id="@+id/menu" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_weight="0.5"
android:layout_alignParentBottom="true" android:orientation="horizontal" >
android:orientation="vertical">
<LinearLayout <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="75dp"
android:orientation="horizontal" android:layout_weight="0.25"
android:layout_weight="0.5"> android:visibility="invisible" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:layout_weight="0.25" android:layout_weight="0.25"
android:visibility="invisible"/> android:visibility="invisible" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:layout_weight="0.25" android:layout_weight="0.25"
android:visibility="invisible"/> android:visibility="invisible" />
<View <ImageView
android:layout_width="match_parent" android:id="@+id/transfer"
android:layout_height="75dp" android:layout_width="match_parent"
android:layout_weight="0.25" android:layout_height="75dp"
android:visibility="invisible"/> android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options_transfer"
android:visibility="gone" />
</LinearLayout>
<ImageView <LinearLayout
android:id="@+id/transfer" android:layout_width="match_parent"
android:visibility="gone" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_weight="0.5"
android:layout_height="75dp" android:orientation="horizontal" >
android:src="@drawable/options_transfer"
android:scaleType="fitXY"
android:layout_weight="0.25" />
</LinearLayout> <View
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:visibility="invisible" />
<LinearLayout <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="75dp"
android:orientation="horizontal" android:layout_weight="0.25"
android:layout_weight="0.5"> android:visibility="invisible" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:layout_weight="0.25" android:layout_weight="0.25"
android:visibility="invisible"/> android:visibility="invisible" />
<View <ImageView
android:id="@+id/addCall"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options_add_call_alt"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="horizontal" >
<ImageView
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_switch_video"
android:scaleType="fitXY"
android:src="@drawable/video_off" />
<ImageView
android:id="@+id/micro"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_toggle_micro"
android:scaleType="fitXY"
android:src="@drawable/micro_on" />
<ImageView
android:id="@+id/speaker"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:contentDescription="@string/content_description_toggle_speaker"
android:scaleType="fitXY"
android:src="@drawable/speaker_off" />
<ImageView
android:id="@+id/options"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/options" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:layout_weight="0.25" android:layout_weight="0.5"
android:visibility="invisible"/> android:orientation="horizontal" >
<View <ImageView
android:layout_width="match_parent" android:id="@+id/pause"
android:layout_height="75dp" android:layout_width="match_parent"
android:layout_weight="0.25" android:layout_height="match_parent"
android:visibility="invisible"/> android:layout_weight="0.3"
android:contentDescription="@string/content_description_pause"
android:scaleType="fitXY"
android:src="@drawable/pause_off" />
<ImageView <ImageView
android:id="@+id/addCall" android:id="@+id/hangUp"
android:visibility="gone" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="75dp" android:layout_weight="0.3"
android:src="@drawable/options_add_call_alt" android:contentDescription="@string/content_description_hang_up"
android:scaleType="fitXY" android:scaleType="fitXY"
android:layout_weight="0.25" /> android:src="@drawable/hangup" />
</LinearLayout> <ImageView
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:contentDescription="@string/content_description_numpad"
android:scaleType="fitXY"
android:src="@drawable/dialer_alt" />
</LinearLayout>
</LinearLayout>
<LinearLayout </RelativeLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.5">
<ImageView
android:contentDescription="@string/content_description_switch_video"
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="0.25"
android:scaleType="fitXY"
android:src="@drawable/video_off" />
<ImageView
android:contentDescription="@string/content_description_toggle_micro"
android:id="@+id/micro"
android:layout_width="match_parent"
android:layout_height="75dp"
android:src="@drawable/micro_on"
android:scaleType="fitXY"
android:layout_weight="0.25"/>
<ImageView
android:contentDescription="@string/content_description_toggle_speaker"
android:id="@+id/speaker"
android:layout_width="match_parent"
android:layout_height="75dp"
android:src="@drawable/speaker_off"
android:scaleType="fitXY"
android:layout_weight="0.25"/>
<ImageView
android:id="@+id/options"
android:layout_width="match_parent"
android:layout_height="75dp"
android:src="@drawable/options"
android:scaleType="fitXY"
android:layout_weight="0.25" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="75dp"
android:orientation="horizontal"
android:layout_weight="0.5">
<ImageView
android:contentDescription="@string/content_description_pause"
android:id="@+id/pause"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/pause_off"
android:scaleType="fitXY"
android:layout_weight="0.3"/>
<ImageView
android:contentDescription="@string/content_description_hang_up"
android:id="@+id/hangUp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/hangup"
android:scaleType="fitXY"
android:layout_weight="0.3"/>
<ImageView
android:contentDescription="@string/content_description_numpad"
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/dialer_alt"
android:scaleType="fitXY"
android:layout_weight="0.3"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -142,12 +142,22 @@ public class AudioCallFragment extends Fragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
if (InCallActivity.instance() == null) {
return;
}
InCallActivity.instance().bindAudioFragment(this); InCallActivity.instance().bindAudioFragment(this);
// Just to be sure we have incall controls // Just to be sure we have incall controls
InCallActivity.instance().setCallControlsVisibleAndRemoveCallbacks(); InCallActivity.instance().setCallControlsVisibleAndRemoveCallbacks();
} }
@Override
public void onDestroy() {
instance = null;
super.onDestroy();
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();

View file

@ -76,15 +76,12 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.incall);
instance = this; instance = this;
setContentView(R.layout.incall);
isVideoEnabled = getIntent().getExtras() != null && getIntent().getExtras().getBoolean("VideoEnabled"); isVideoEnabled = getIntent().getExtras() != null && getIntent().getExtras().getBoolean("VideoEnabled");
if (findViewById(R.id.fragmentContainer) != null) { if (findViewById(R.id.fragmentContainer) != null) {
if (savedInstanceState != null) {
return;
}
initUI(); initUI();
if (LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.getLc().getCallsNb() > 0) {
@ -497,6 +494,10 @@ public class InCallActivity extends FragmentActivity implements
private boolean isCallRunning(LinphoneCall call) private boolean isCallRunning(LinphoneCall call)
{ {
if (call == null) {
return false;
}
LinphoneCall.State state = call.getState(); LinphoneCall.State state = call.getState();
return state == LinphoneCall.State.Connected || return state == LinphoneCall.State.Connected ||
@ -507,6 +508,10 @@ public class InCallActivity extends FragmentActivity implements
} }
private boolean isCallEstablished(LinphoneCall call) { private boolean isCallEstablished(LinphoneCall call) {
if (call == null) {
return false;
}
LinphoneCall.State state = call.getState(); LinphoneCall.State state = call.getState();
return isCallRunning(call) || return isCallRunning(call) ||
@ -552,6 +557,12 @@ public class InCallActivity extends FragmentActivity implements
} }
} }
@Override
protected void onDestroy() {
instance = null;
super.onDestroy();
}
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
@ -563,13 +574,6 @@ public class InCallActivity extends FragmentActivity implements
} }
} }
@Override
protected void onPause() {
super.onPause();
setCallControlsVisibleAndRemoveCallbacks();
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (LinphoneUtils.onKeyVolumeAdjust(keyCode)) return true; if (LinphoneUtils.onKeyVolumeAdjust(keyCode)) return true;

View file

@ -153,6 +153,8 @@ public class VideoCallFragment extends Fragment {
// Prevent linphone from crashing if correspondent hang up while you are rotating // Prevent linphone from crashing if correspondent hang up while you are rotating
androidVideoWindowImpl.release(); androidVideoWindowImpl.release();
} }
instance = null;
super.onDestroy(); super.onDestroy();
} }

View file

@ -127,7 +127,9 @@ public class SetupActivity extends FragmentActivity implements OnClickListener {
public void logIn(String username, String password, String domain) { public void logIn(String username, String password, String domain) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0); if (imm != null) {
imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
}
saveCreatedAccount(username, password, domain); saveCreatedAccount(username, password, domain);
LinphoneManager.getInstance().initializePayloads(); LinphoneManager.getInstance().initializePayloads();