Skip to content

Commit a35f2c9

Browse files
author
Appyown
committed
Paper On Boarding
1 parent bb774ba commit a35f2c9

26 files changed

+1003
-19
lines changed

app/src/main/java/com/dvinfosys/WidgetsExample/Activity/HomeActivity.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.dvinfosys.WidgetsExample.Fragments.FoldingCellFragment;
2222
import com.dvinfosys.WidgetsExample.Fragments.ImageviewFragment;
2323
import com.dvinfosys.WidgetsExample.Fragments.NumberCounterFragment;
24+
import com.dvinfosys.WidgetsExample.Fragments.PaperOnboardingFragment;
2425
import com.dvinfosys.WidgetsExample.Fragments.ProgressViewFragment;
2526
import com.dvinfosys.WidgetsExample.Fragments.RadioButtonFragment;
2627
import com.dvinfosys.WidgetsExample.Fragments.SearchableSpinnerFragment;
@@ -128,10 +129,8 @@ public boolean onNavigationItemSelected(MenuItem item) {
128129
fragment = new SearchableSpinnerFragment();
129130
} else if (id == R.id.nav_spotlight) {
130131
fragment = new SpotlightFragment();
131-
} else if (id == R.id.nav_share) {
132-
133-
} else if (id == R.id.nav_send) {
134-
132+
} else if (id == R.id.nav_paper_onboarding) {
133+
fragment = new PaperOnboardingFragment();
135134
}
136135
if (fragment != null) {
137136
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.dvinfosys.WidgetsExample.Fragments;
2+
3+
import android.graphics.Color;
4+
import android.os.Bundle;
5+
import android.support.annotation.NonNull;
6+
import android.support.annotation.Nullable;
7+
import android.support.v4.app.Fragment;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
import android.widget.Toast;
12+
13+
import com.dvinfosys.WidgetsExample.R;
14+
import com.dvinfosys.widgets.paperonboarding.PaperOnboardingEngine;
15+
import com.dvinfosys.widgets.paperonboarding.PaperOnboardingPage;
16+
import com.dvinfosys.widgets.paperonboarding.listeners.PaperOnboardingOnChangeListener;
17+
import com.dvinfosys.widgets.paperonboarding.listeners.PaperOnboardingOnRightOutListener;
18+
19+
import java.util.ArrayList;
20+
21+
public class PaperOnboardingFragment extends Fragment {
22+
23+
@Override
24+
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
25+
View v = inflater.inflate(R.layout.onboarding_main_layout, container, false);
26+
27+
PaperOnboardingEngine engine = new PaperOnboardingEngine(v.findViewById(R.id.onboardingRootView), getDataForOnboarding(), getContext());
28+
engine.setOnChangeListener(new PaperOnboardingOnChangeListener() {
29+
@Override
30+
public void onPageChanged(int oldElementIndex, int newElementIndex) {
31+
Toast.makeText(getContext(), "Swiped from " + oldElementIndex + " to " + newElementIndex, Toast.LENGTH_SHORT).show();
32+
}
33+
});
34+
35+
engine.setOnRightOutListener(new PaperOnboardingOnRightOutListener() {
36+
@Override
37+
public void onRightOut() {
38+
// Probably here will be your exit action
39+
Toast.makeText(getContext(), "Swiped out right", Toast.LENGTH_SHORT).show();
40+
}
41+
});
42+
return v;
43+
}
44+
45+
private ArrayList<PaperOnboardingPage> getDataForOnboarding() {
46+
// prepare data
47+
PaperOnboardingPage scr1 = new PaperOnboardingPage("Hotels", "All hotels and hostels are sorted by hospitality rating",
48+
Color.parseColor("#678FB4"), R.drawable.hotels, R.drawable.key);
49+
PaperOnboardingPage scr2 = new PaperOnboardingPage("Banks", "We carefully verify all banks before add them into the app",
50+
Color.parseColor("#65B0B4"), R.drawable.banks, R.drawable.wallet);
51+
PaperOnboardingPage scr3 = new PaperOnboardingPage("Stores", "All local stores are categorized for your convenience",
52+
Color.parseColor("#9B90BC"), R.drawable.stores, R.drawable.shopping_cart);
53+
54+
ArrayList<PaperOnboardingPage> elements = new ArrayList<>();
55+
elements.add(scr1);
56+
elements.add(scr2);
57+
elements.add(scr3);
58+
return elements;
59+
}
60+
61+
@Override
62+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
63+
super.onViewCreated(view, savedInstanceState);
64+
getActivity().setTitle("Paper On Boarding Example");
65+
}
66+
}

app/src/main/java/com/dvinfosys/WidgetsExample/Fragments/SpotlightFragment.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import android.app.Activity;
55
import android.os.Bundle;
6+
import android.support.annotation.NonNull;
7+
import android.support.annotation.Nullable;
68
import android.support.v4.app.Fragment;
79
import android.view.LayoutInflater;
810
import android.view.View;
@@ -114,5 +116,9 @@ public void onEnded() {
114116
});
115117
return v;
116118
}
117-
119+
@Override
120+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
121+
super.onViewCreated(view, savedInstanceState);
122+
getActivity().setTitle("Sport Light Example");
123+
}
118124
}
8.95 KB
Loading
8.45 KB
Loading

app/src/main/res/drawable/key.png

1.15 KB
Loading
1 KB
Loading
9.39 KB
Loading
873 Bytes
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:id="@+id/fragment_paper"
6+
android:layout_height="match_parent"
7+
tools:context=".Fragments.PaperOnboardingFragment">
8+
9+
</FrameLayout>

0 commit comments

Comments
 (0)