Java源码示例:com.github.paolorotolo.appintro.AppIntroBaseFragment

示例1
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setThings = new SetThings(this);
    //activity = this;

    TypedValue typedValue = new TypedValue();
    Resources.Theme theme = getTheme();
    theme.resolveAttribute(R.attr.colorAccent, typedValue, true);

    int backgroundColor = typedValue.data;

    AppIntroFragment introFrag = AppIntroFragment.newInstance(getResources().getText(R.string.app_name).toString(), getResources().getText(R.string.welcome).toString(), R.drawable.ic_launcher_large, backgroundColor);
    AppIntroBaseFragment askRootFrag = AskRoot.newInstance(getResources().getText(R.string.setup).toString(), getResources().getText(R.string.setup_ask).toString(), 0, backgroundColor);
    AppIntroBaseFragment noRootFrag = NoRoot.newInstance(getResources().getText(R.string.no_root_setup).toString(), getResources().getText(R.string.adb_instructions).toString(), 0, backgroundColor);
    AppIntroFragment doneFrag = AppIntroFragment.newInstance(getResources().getText(R.string.done_button).toString(), "", R.drawable.ic_check_accent, backgroundColor);

    addSlide(introFrag);
    addSlide(askRootFrag);
    addSlide(noRootFrag);
    addSlide(doneFrag);

    showSkipButton(false);
    setSwipeLock(true);

    finish_activity = new BroadcastReceiver() {

        @Override
        public void onReceive(Context arg0, Intent intent) {
            String action = intent.getAction();
            if (action.equals("finish_systemuituner_activity")) {
                finish();
            }
        }
    };
    registerReceiver(finish_activity, new IntentFilter("finish_systemuituner_activity"));
}