Fix incall icons lost state when rotation

This commit is contained in:
Sylvain Berfini 2012-10-30 11:46:19 +01:00
parent 7f7b2d5eae
commit 35f05e03be
3 changed files with 21 additions and 0 deletions

View file

@ -31,6 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_switch_camera"
android:layout_marginTop="40dp"
android:src="@drawable/switch_camera"
@ -175,6 +176,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="fitXY"
android:src="@drawable/pause_off" />
@ -185,6 +187,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_conference"
android:scaleType="fitXY"
android:src="@drawable/conference" />
@ -216,6 +219,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_hang_up"
android:scaleType="fitXY"
android:src="@drawable/hangup" />
@ -247,6 +251,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_numpad"
android:scaleType="fitXY"
android:src="@drawable/dialer_alt" />

View file

@ -31,6 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_switch_camera"
android:layout_marginTop="40dp"
android:visibility="invisible"
@ -191,6 +192,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="fitXY"
android:src="@drawable/pause_off" />
@ -201,6 +203,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_conference"
android:scaleType="fitXY"
android:src="@drawable/conference" />
@ -210,6 +213,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_hang_up"
android:scaleType="fitXY"
android:src="@drawable/hangup" />
@ -219,6 +223,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_numpad"
android:scaleType="fitXY"
android:src="@drawable/dialer_alt" />

View file

@ -124,6 +124,9 @@ public class InCallActivity extends FragmentActivity implements
if (savedInstanceState != null) {
// Fragment already created, no need to create it again (else it will generate a memory leak with duplicated fragments)
isSpeakerEnabled = savedInstanceState.getBoolean("Speaker");
isMicMuted = savedInstanceState.getBoolean("Mic");
refreshInCallActions();
return;
}
@ -145,6 +148,14 @@ public class InCallActivity extends FragmentActivity implements
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean("Speaker", isSpeakerEnabled);
outState.putBoolean("Mic", isMicMuted);
super.onSaveInstanceState(outState);
}
private void initUI() {
video = (TextView) findViewById(R.id.video);
video.setOnClickListener(this);