-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSliderAdapter.java
More file actions
82 lines (58 loc) · 2.38 KB
/
SliderAdapter.java
File metadata and controls
82 lines (58 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package org.colibrisoft.colibri;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class SliderAdapter extends PagerAdapter {
Context context;
LayoutInflater LayoutInflater;
public SliderAdapter(Context context){
this.context=context;
}
public int[] slide_images = {
R.drawable.rocket,
R.drawable.padlock,
R.drawable.free
};
public String[] slide_headings = {
"Cosmic Speed",
"Stay Private",
"Save Money"
};
public String[] slide_desc = {
"Colibri delivers text, document, video and picture messages faster than any other application.",
"Messages are encrypted so only you and the person you are chatting with can read them.",
"Colibri is made for everyone. Just open an account for a fast, secure and free messaging experience."
};
@Override
public int getCount() {
return slide_headings.length;
}
@Override
public boolean isViewFromObject(@NonNull View view, Object o) {
return view == (RelativeLayout) o;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
LayoutInflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
View view = LayoutInflater.inflate(R.layout.slide_layout, container, false);
ImageView slideImageView = (ImageView) view.findViewById(R.id.slide_icon);
TextView slideHeading = (TextView) view.findViewById(R.id.slideHeading);
TextView slideDescription = (TextView) view.findViewById(R.id.slide_desc);
slideImageView.setImageResource(slide_images[position]);
slideHeading.setText(slide_headings[position]);
slideDescription.setText(slide_desc[position]);
container.addView(view);
return view;
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((RelativeLayout)object);
}
}