3
3
import android .app .Activity ;
4
4
import android .content .Context ;
5
5
import android .content .Intent ;
6
+ import android .content .SharedPreferences ;
6
7
import android .graphics .Color ;
8
+ import android .preference .PreferenceManager ;
7
9
import android .support .annotation .ColorRes ;
8
10
import android .support .v4 .view .PagerAdapter ;
9
11
import android .view .LayoutInflater ;
@@ -53,6 +55,9 @@ private Tutorial getItem(int position) {
53
55
@ Override
54
56
public Object instantiateItem (ViewGroup container , final int position ) {
55
57
58
+ SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences (mActivity );
59
+ boolean SkipTutorial = prefs .getBoolean ("SkipTutorial" ,false );
60
+
56
61
LayoutInflater inflater = (LayoutInflater ) container .getContext ()
57
62
.getSystemService (Context .LAYOUT_INFLATER_SERVICE );
58
63
@@ -74,6 +79,8 @@ public void onClick(View v) {
74
79
});
75
80
} else {
76
81
convertView = inflater .inflate (R .layout .tutorial_layout , null );
82
+ View skip_button = convertView .findViewById (R .id .skip_button );
83
+ skip_button .setVisibility (View .GONE );
77
84
ImageView deviceImage = (ImageView ) convertView
78
85
.findViewById (R .id .device_image );
79
86
TextView title = (TextView ) convertView
@@ -88,6 +95,22 @@ public void onClick(View v) {
88
95
deviceImage .setImageResource (tutorial .getImage ());
89
96
title .setText (tutorial .getTitle ());
90
97
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
+ });
91
114
}
92
115
container .addView (convertView , 0 );
93
116
0 commit comments