Skip to content

Commit cb4a1e3

Browse files
dakegu2Android (Google) Code Review
authored andcommitted
Merge "GuidedStepFragment: Fix addAsRoot restoring bug" into mnc-ub-dev
2 parents 4ad2378 + 0af1cf6 commit cb4a1e3

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ protected void onCreate(Bundle savedInstanceState) {
6868
Log.v(TAG, "onCreate");
6969
super.onCreate(savedInstanceState);
7070
setContentView(R.layout.guided_step_activity);
71-
GuidedStepFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
71+
if (savedInstanceState == null) {
72+
GuidedStepFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
73+
}
7274
}
7375

7476
@Override

samples/SupportLeanbackDemos/src/com/example/android/leanback/GuidedStepSupportActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ protected void onCreate(Bundle savedInstanceState) {
7070
Log.v(TAG, "onCreate");
7171
super.onCreate(savedInstanceState);
7272
setContentView(R.layout.guided_step_activity);
73-
GuidedStepSupportFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
73+
if (savedInstanceState == null) {
74+
GuidedStepSupportFragment.addAsRoot(this, new FirstStepFragment(), R.id.lb_guidedstep_host);
75+
}
7476
}
7577

7678
@Override

samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleActivity.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public class DialogExampleActivity extends Activity {
2929
super.onCreate(savedInstanceState);
3030
getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#21272A")));
3131

32-
GuidedStepFragment fragment = new DialogExampleFragment();
33-
GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
32+
if (savedInstanceState == null) {
33+
GuidedStepFragment fragment = new DialogExampleFragment();
34+
GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
35+
}
3436
}
3537
}

0 commit comments

Comments
 (0)