33import android .app .Activity ;
44import android .content .Context ;
55import android .content .Intent ;
6+ import android .content .SharedPreferences ;
67import android .graphics .Color ;
8+ import android .preference .PreferenceManager ;
79import android .support .annotation .ColorRes ;
810import android .support .v4 .view .PagerAdapter ;
911import android .view .LayoutInflater ;
@@ -53,6 +55,9 @@ private Tutorial getItem(int position) {
5355 @ Override
5456 public Object instantiateItem (ViewGroup container , final int position ) {
5557
58+ SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences (mActivity );
59+ boolean SkipTutorial = prefs .getBoolean ("SkipTutorial" ,false );
60+
5661 LayoutInflater inflater = (LayoutInflater ) container .getContext ()
5762 .getSystemService (Context .LAYOUT_INFLATER_SERVICE );
5863
@@ -74,6 +79,8 @@ public void onClick(View v) {
7479 });
7580 } else {
7681 convertView = inflater .inflate (R .layout .tutorial_layout , null );
82+ View skip_button = convertView .findViewById (R .id .skip_button );
83+ skip_button .setVisibility (View .GONE );
7784 ImageView deviceImage = (ImageView ) convertView
7885 .findViewById (R .id .device_image );
7986 TextView title = (TextView ) convertView
@@ -88,6 +95,22 @@ public void onClick(View v) {
8895 deviceImage .setImageResource (tutorial .getImage ());
8996 title .setText (tutorial .getTitle ());
9097 description .setText (tutorial .getDescription ());
98+ if (!SkipTutorial ) {
99+ if ("Welcome to BuildmLearn Toolkit" .equals (title .getText ().toString ())) {
100+ skip_button .setVisibility (View .VISIBLE );
101+ } else {
102+ skip_button .setVisibility (View .GONE );
103+ }
104+ }
105+ convertView .findViewById (R .id .skip_button ).setOnClickListener (new View .OnClickListener () {
106+ @ Override
107+ public void onClick (View v ) {
108+ if (mStartActivity ) {
109+ mActivity .startActivity (new Intent (mActivity , HomeActivity .class ));
110+ }
111+ mActivity .finish ();
112+ }
113+ });
91114 }
92115 container .addView (convertView , 0 );
93116
0 commit comments