am 8ab0d48a: Merge "Showcase: Update SDK to 23 and support lib to 23.0.1" into mnc-ub-dev

* commit '8ab0d48a61987446c782d2d5816c522b2768adc6':
  Showcase: Update SDK to 23 and support lib to 23.0.1
This commit is contained in:
Dake Gu
2015-10-01 21:11:25 +00:00
committed by Android Git Automerger
7 changed files with 14 additions and 61 deletions

View File

@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 'android-MNC' compileSdkVersion 'android-23'
buildToolsVersion "22.0.1" buildToolsVersion "23.0.1"
defaultConfig { defaultConfig {
applicationId "android.support.v17.leanback.supportleanbackshowcase" applicationId "android.support.v17.leanback.supportleanbackshowcase"
minSdkVersion 17 minSdkVersion 17
targetSdkVersion 'MNC' targetSdkVersion '23'
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
@@ -22,15 +22,15 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:23.0.0-rc1' compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:leanback-v17:23.0.0-rc1' compile 'com.android.support:leanback-v17:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.0-rc1' compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:preference-v7:23.0.0-rc1' compile 'com.android.support:preference-v7:23.0.1'
compile 'com.android.support:preference-leanback-v17:23.0.0-rc1' compile 'com.android.support:preference-leanback-v17:23.0.1'
compile 'com.android.support:preference-v14:23.0.0-rc1' compile 'com.android.support:preference-v14:23.0.1'
compile 'com.google.code.gson:gson:1.7.2' compile 'com.google.code.gson:gson:1.7.2'
compile 'com.squareup.picasso:picasso:2.3.2' compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.android.support:palette-v7:23.0.0-rc1' compile 'com.android.support:palette-v7:23.0.1'
} }

View File

@@ -30,6 +30,6 @@ public class DialogExampleActivity extends Activity {
getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#21272A"))); getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#21272A")));
GuidedStepFragment fragment = new DialogExampleFragment(); GuidedStepFragment fragment = new DialogExampleFragment();
GuidedStepFragment.add(getFragmentManager(), fragment); GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
} }
} }

View File

@@ -32,12 +32,6 @@ public class WizardExample1stStepFragment extends WizardExampleBaseStepFragment
private static final int ACTION_ID_BUY_HD = 1; private static final int ACTION_ID_BUY_HD = 1;
private static final int ACTION_ID_BUY_SD = ACTION_ID_BUY_HD + 1; private static final int ACTION_ID_BUY_SD = ACTION_ID_BUY_HD + 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWizardActivity().setStep(1);
}
@NonNull @NonNull
@Override @Override
public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {

View File

@@ -45,12 +45,6 @@ public class WizardExample2ndStepFragment extends WizardExampleBaseStepFragment
return fragment; return fragment;
} }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWizardActivity().setStep(2);
}
@NonNull @NonNull
@Override @Override
public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {

View File

@@ -35,12 +35,6 @@ public class WizardExample3rdStepFragment extends WizardExampleBaseStepFragment
private static final int ACTION_ID_PROCESSING = 1; private static final int ACTION_ID_PROCESSING = 1;
private final Handler mFakeHttpHandler = new Handler(); private final Handler mFakeHttpHandler = new Handler();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWizardActivity().setStep(3);
}
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();

View File

@@ -33,12 +33,6 @@ public class WizardExample4thStepFragment extends WizardExampleBaseStepFragment
private static final int ACTION_ID_WATCH = 1; private static final int ACTION_ID_WATCH = 1;
private static final int ACTION_ID_LATER = ACTION_ID_WATCH + 1; private static final int ACTION_ID_LATER = ACTION_ID_WATCH + 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWizardActivity().setStep(4);
}
@NonNull @NonNull
@Override @Override
public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {

View File

@@ -25,46 +25,23 @@ import android.support.v17.leanback.supportleanbackshowcase.R;
*/ */
public class WizardExampleActivity extends Activity { public class WizardExampleActivity extends Activity {
// When the user 'bought' the product and presses back, we don't want to show the 'Processing..'
// screen again, instead we want to go back to the very first step or close the wizard. Thus, we
// have to save the current step of the wizard and make it accessible to it's children.
private int mStep = 0;
@Override public void onCreate(Bundle savedInstanceState) { @Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawableResource(R.drawable.wizard_background_blackned); getWindow().setBackgroundDrawableResource(R.drawable.wizard_background_blackned);
// Recover old step state.
if (savedInstanceState != null) {
mStep = savedInstanceState.getInt("step");
}
GuidedStepFragment fragment = new WizardExample1stStepFragment(); GuidedStepFragment fragment = new WizardExample1stStepFragment();
fragment.setArguments(getIntent().getExtras()); // Delegate Movie to first step. fragment.setArguments(getIntent().getExtras()); // Delegate Movie to first step.
GuidedStepFragment.add(getFragmentManager(), fragment); GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
}
public int getStep() {
return mStep;
}
public void setStep(int step) {
mStep = step;
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (4 == getStep()) { if (GuidedStepFragment.getCurrentGuidedStepFragment(getFragmentManager())
instanceof WizardExample4thStepFragment) {
// The user 'bought' the product. When he presses 'Back' the Wizard will be closed and // The user 'bought' the product. When he presses 'Back' the Wizard will be closed and
// he will not be send back to 'Processing Payment...'-Screen. // he will not be send back to 'Processing Payment...'-Screen.
finish(); finish();
} else super.onBackPressed(); } else super.onBackPressed();
} }
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
// Save current step persitently.
outPersistentState.putInt("step", mStep);
super.onSaveInstanceState(outState, outPersistentState);
}
} }