Search in sources :

Example 1 with PaperOnboardingOnRightOutListener

use of com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener in project paper-onboarding-android by Ramotion.

the class FragmentsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragments_activity_layout);
    fragmentManager = getSupportFragmentManager();
    final PaperOnboardingFragment onBoardingFragment = PaperOnboardingFragment.newInstance(getDataForOnboarding());
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.add(R.id.fragment_container, onBoardingFragment);
    fragmentTransaction.commit();
    onBoardingFragment.setOnRightOutListener(new PaperOnboardingOnRightOutListener() {

        @Override
        public void onRightOut() {
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            Fragment bf = new BlankFragment();
            fragmentTransaction.replace(R.id.fragment_container, bf);
            fragmentTransaction.commit();
        }
    });
}
Also used : PaperOnboardingFragment(com.ramotion.paperonboarding.PaperOnboardingFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment) PaperOnboardingFragment(com.ramotion.paperonboarding.PaperOnboardingFragment) PaperOnboardingOnRightOutListener(com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener)

Example 2 with PaperOnboardingOnRightOutListener

use of com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener in project paper-onboarding-android by Ramotion.

the class PaperOnboardingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.onboarding_main_layout);
    PaperOnboardingEngine engine = new PaperOnboardingEngine(findViewById(R.id.onboardingRootView), getDataForOnboarding(), getApplicationContext());
    engine.setOnChangeListener(new PaperOnboardingOnChangeListener() {

        @Override
        public void onPageChanged(int oldElementIndex, int newElementIndex) {
            Toast.makeText(getApplicationContext(), "Swiped from " + oldElementIndex + " to " + newElementIndex, Toast.LENGTH_SHORT).show();
        }
    });
    engine.setOnRightOutListener(new PaperOnboardingOnRightOutListener() {

        @Override
        public void onRightOut() {
            // Probably here will be your exit action
            Toast.makeText(getApplicationContext(), "Swiped out right", Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : PaperOnboardingOnChangeListener(com.ramotion.paperonboarding.listeners.PaperOnboardingOnChangeListener) PaperOnboardingEngine(com.ramotion.paperonboarding.PaperOnboardingEngine) PaperOnboardingOnRightOutListener(com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener)

Aggregations

PaperOnboardingOnRightOutListener (com.ramotion.paperonboarding.listeners.PaperOnboardingOnRightOutListener)2 Fragment (android.support.v4.app.Fragment)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 PaperOnboardingEngine (com.ramotion.paperonboarding.PaperOnboardingEngine)1 PaperOnboardingFragment (com.ramotion.paperonboarding.PaperOnboardingFragment)1 PaperOnboardingOnChangeListener (com.ramotion.paperonboarding.listeners.PaperOnboardingOnChangeListener)1