2015-01-16 00:04:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 The CyanogenMod Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.cyanogenmod.setupwizard.setup;
|
|
|
|
|
|
|
|
import android.app.Fragment;
|
2015-01-23 19:37:23 +00:00
|
|
|
import android.app.FragmentManager;
|
2015-01-16 00:04:44 +00:00
|
|
|
import android.os.Bundle;
|
2015-01-27 23:23:16 +00:00
|
|
|
|
|
|
|
import com.cyanogenmod.setupwizard.R;
|
|
|
|
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
|
2015-02-23 22:33:07 +00:00
|
|
|
import com.cyanogenmod.setupwizard.ui.SetupWizardActivity;
|
2015-01-16 00:04:44 +00:00
|
|
|
|
|
|
|
public class FinishPage extends SetupPage {
|
|
|
|
|
|
|
|
public static final String TAG = "FinishPage";
|
|
|
|
|
2015-01-21 23:55:03 +00:00
|
|
|
private FinishFragment mFinishFragment;
|
|
|
|
|
2015-02-23 22:33:07 +00:00
|
|
|
public FinishPage(SetupWizardActivity context, SetupDataCallbacks callbacks) {
|
2015-01-16 00:04:44 +00:00
|
|
|
super(context, callbacks);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-01-23 19:37:23 +00:00
|
|
|
public Fragment getFragment(FragmentManager fragmentManager, int action) {
|
|
|
|
mFinishFragment = (FinishFragment)fragmentManager.findFragmentByTag(getKey());
|
|
|
|
if (mFinishFragment == null) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putString(Page.KEY_PAGE_ARGUMENT, getKey());
|
|
|
|
args.putInt(Page.KEY_PAGE_ACTION, action);
|
|
|
|
mFinishFragment = new FinishFragment();
|
|
|
|
mFinishFragment.setArguments(args);
|
|
|
|
}
|
2015-01-21 23:55:03 +00:00
|
|
|
return mFinishFragment;
|
2015-01-16 00:04:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getKey() {
|
|
|
|
return TAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getTitleResId() {
|
|
|
|
return R.string.setup_complete;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean doNextAction() {
|
2015-01-27 23:23:16 +00:00
|
|
|
getCallbacks().onFinish();
|
2015-01-16 00:04:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getNextButtonTitleResId() {
|
|
|
|
return R.string.start;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class FinishFragment extends SetupPageFragment {
|
|
|
|
|
|
|
|
@Override
|
2015-01-27 23:23:16 +00:00
|
|
|
protected void initializePage() {}
|
2015-01-16 00:04:44 +00:00
|
|
|
|
|
|
|
@Override
|
2015-01-21 23:55:03 +00:00
|
|
|
protected int getLayoutResource() {
|
|
|
|
return R.layout.setup_finished_page;
|
2015-01-16 00:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|