├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── cn
│ │ └── bluemobi
│ │ └── dylan
│ │ └── welcomevideopager
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── cn
│ │ │ └── bluemobi
│ │ │ └── dylan
│ │ │ └── welcomevideopager
│ │ │ ├── CustomVideoView.java
│ │ │ ├── Guild2Fragment.java
│ │ │ ├── GuildFragment.java
│ │ │ ├── LazyLoadFragment.java
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── fm_guild.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ ├── bt_start.png
│ │ ├── dot_focus.png
│ │ ├── dot_normal.png
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── raw
│ │ ├── guide_1.mp4
│ │ ├── guide_2.mp4
│ │ ├── guide_3.mp4
│ │ ├── test1.mp4
│ │ ├── test2.mp4
│ │ └── test3.mp4
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── cn
│ └── bluemobi
│ └── dylan
│ └── welcomevideopager
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── import-summary.txt
├── screenshorts
├── effect.gif
└── mafengwo.gif
└── settings.gradle
/README.md:
--------------------------------------------------------------------------------
1 | Android酷炫欢迎页播放视频,仿蚂蜂窝自由行和慕课网
2 | >今天无意间看到了蚂蜂窝自由行的app,启动页很酷炫。我记得以前慕课网有个版本的app欢迎页也是播放视频的。
3 | 今天就顺手写一个,代码比较简单,高手请略过。
4 |
5 | 先看效果图:
6 |
7 | 
8 |
9 | #一.资源准备
10 |
11 | 三个比较短小的视频:[视频下载](https://github.com/linglongxin24/WelcomeVideoPager/tree/master/app/src/main/res/raw)
12 |
13 | #二.开始编写代码
14 |
15 | * 1.在项目的res下新建一个raw文件夹,放入准备好的这三个视频
16 |
17 | * 2.自定义播放视频的CustomVideoView
18 | 在这个自定义View里面提供一个播放视频的方法。用户只需要传入播放路径就可以了,并且可一循环播放。
19 |
20 | ```java
21 | package cn.bluemobi.dylan.welcomevideopager;
22 | import android.content.Context;
23 | import android.media.MediaPlayer;
24 | import android.net.Uri;
25 | import android.util.AttributeSet;
26 | import android.view.View;
27 | import android.widget.VideoView;
28 |
29 | /**
30 | * 可以播放视频的View
31 | * Created by yuandl on 2016-11-10.
32 | */
33 |
34 | public class CustomVideoView extends VideoView {
35 | public CustomVideoView(Context context) {
36 | super(context);
37 | }
38 |
39 | public CustomVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
40 | super(context, attrs, defStyleAttr);
41 | }
42 |
43 | public CustomVideoView(Context context, AttributeSet attrs) {
44 | super(context, attrs);
45 | }
46 |
47 | @Override
48 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
49 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
50 | setMeasuredDimension(View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(heightMeasureSpec));
51 | }
52 |
53 | /**
54 | * 播放视频
55 | *
56 | * @param uri 播放地址
57 | */
58 | public void playVideo(Uri uri) {
59 | if (uri == null) {
60 | throw new IllegalArgumentException("Uri can not be null");
61 | }
62 | /**设置播放路径**/
63 | setVideoURI(uri);
64 | /**开始播放**/
65 | start();
66 | setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
67 |
68 | @Override
69 | public void onPrepared(MediaPlayer mp) {
70 | /**设置循环播放**/
71 | mp.setLooping(true);
72 | }
73 | });
74 | setOnErrorListener(new MediaPlayer.OnErrorListener() {
75 |
76 | @Override
77 | public boolean onError(MediaPlayer mp, int what, int extra) {
78 | return true;
79 | }
80 | });
81 | }
82 | }
83 | ```
84 |
85 | * 3.建立没个欢迎页面的Fragment去加载自定义视频View的视图
86 |
87 | ```java
88 | package cn.bluemobi.dylan.welcomevideopager;
89 |
90 | import android.net.Uri;
91 | import android.os.Bundle;
92 | import android.support.annotation.Nullable;
93 | import android.support.v4.app.Fragment;
94 | import android.view.LayoutInflater;
95 | import android.view.View;
96 | import android.view.ViewGroup;
97 |
98 | /**
99 | * Created by yuandl on 2016-11-10.
100 | */
101 |
102 | public class GuildFragment extends Fragment {
103 |
104 | private CustomVideoView customVideoView;
105 |
106 | @Nullable
107 | @Override
108 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
109 | customVideoView = new CustomVideoView(getContext());
110 | /**获取参数,根据不同的参数播放不同的视频**/
111 | int index = getArguments().getInt("index");
112 | Uri uri;
113 | if (index == 1) {
114 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_1);
115 | } else if (index == 2) {
116 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_2);
117 | } else {
118 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_3);
119 | }
120 | /**播放视频**/
121 | customVideoView.playVideo(uri);
122 | return customVideoView;
123 | }
124 |
125 | /**
126 | * 记得在销毁的时候让播放的视频终止
127 | */
128 | @Override
129 | public void onDestroy() {
130 | super.onDestroy();
131 | if (customVideoView != null) {
132 | customVideoView.stopPlayback();
133 | }
134 | }
135 | }
136 |
137 | ```
138 | * 4.界面布局
139 |
140 | ```xml
141 |
144 |
145 |
149 |
150 |
157 |
158 |
163 |
164 |
170 |
171 |
177 |
178 |
179 |
189 |
190 |
191 | ```
192 |
193 | * 5.给界面添加Fragment
194 |
195 | ```java
196 | package cn.bluemobi.dylan.welcomevideopager;
197 |
198 | import android.os.Bundle;
199 | import android.support.v4.app.Fragment;
200 | import android.support.v4.app.FragmentManager;
201 | import android.support.v4.app.FragmentPagerAdapter;
202 | import android.support.v4.view.ViewPager;
203 | import android.support.v7.app.AppCompatActivity;
204 | import android.view.View;
205 | import android.widget.Button;
206 | import android.widget.ImageView;
207 |
208 | import java.util.ArrayList;
209 | import java.util.List;
210 |
211 | public class MainActivity extends AppCompatActivity {
212 | private ViewPager vp;
213 | private ImageView iv1;
214 | private ImageView iv2;
215 | private ImageView iv3;
216 | private Button bt_start;
217 | private List fragments;
218 |
219 | private void assignViews() {
220 | vp = (ViewPager) findViewById(R.id.vp);
221 | iv1 = (ImageView) findViewById(R.id.iv1);
222 | iv2 = (ImageView) findViewById(R.id.iv2);
223 | iv3 = (ImageView) findViewById(R.id.iv3);
224 | bt_start = (Button) findViewById(R.id.bt_start);
225 | }
226 |
227 | @Override
228 | protected void onCreate(Bundle savedInstanceState) {
229 | super.onCreate(savedInstanceState);
230 | setContentView(R.layout.activity_main);
231 | assignViews();
232 | initData();
233 | initView();
234 |
235 | }
236 |
237 | /**
238 | * 初始化数据,添加三个Fragment
239 | */
240 | private void initData() {
241 | fragments = new ArrayList<>();
242 |
243 | Fragment fragment1 = new GuildFragment();
244 | Bundle bundle1 = new Bundle();
245 | bundle1.putInt("index", 1);
246 | fragment1.setArguments(bundle1);
247 | fragments.add(fragment1);
248 |
249 | Fragment fragment2 = new GuildFragment();
250 | Bundle bundle2 = new Bundle();
251 | bundle2.putInt("index", 2);
252 | fragment2.setArguments(bundle2);
253 | fragments.add(fragment2);
254 |
255 | Fragment fragment3 = new GuildFragment();
256 | Bundle bundle3 = new Bundle();
257 | bundle3.putInt("index", 3);
258 | fragment3.setArguments(bundle3);
259 | fragments.add(fragment3);
260 | }
261 |
262 | /**
263 | * 设置ViewPager的适配器和滑动监听
264 | */
265 | private void initView() {
266 | vp.setOffscreenPageLimit(3);
267 | vp.setAdapter(new MyPageAdapter(getSupportFragmentManager()));
268 | vp.addOnPageChangeListener(new MyPageChangeListener());
269 | }
270 |
271 | /**
272 | * ViewPager适配器
273 | */
274 | private class MyPageAdapter extends FragmentPagerAdapter {
275 |
276 |
277 | public MyPageAdapter(FragmentManager fm) {
278 | super(fm);
279 | }
280 |
281 | @Override
282 | public Fragment getItem(int position) {
283 | return fragments.get(position);
284 | }
285 |
286 | @Override
287 | public int getCount() {
288 | return fragments.size();
289 | }
290 | }
291 |
292 | /**
293 | * ViewPager滑动页面监听器
294 | */
295 | private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
296 | @Override
297 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
298 |
299 | }
300 |
301 | /**
302 | * 根据页面不同动态改变红点和在最后一页显示立即体验按钮
303 | *
304 | * @param position
305 | */
306 | @Override
307 | public void onPageSelected(int position) {
308 | bt_start.setVisibility(View.GONE);
309 | iv1.setImageResource(R.mipmap.dot_normal);
310 | iv2.setImageResource(R.mipmap.dot_normal);
311 | iv3.setImageResource(R.mipmap.dot_normal);
312 | if (position == 0) {
313 | iv1.setImageResource(R.mipmap.dot_focus);
314 | } else if (position == 1) {
315 | iv2.setImageResource(R.mipmap.dot_focus);
316 | } else {
317 | iv3.setImageResource(R.mipmap.dot_focus);
318 | bt_start.setVisibility(View.VISIBLE);
319 | }
320 | }
321 |
322 | @Override
323 | public void onPageScrollStateChanged(int state) {
324 |
325 | }
326 | }
327 | }
328 |
329 | ```
330 | #三.[GitHub](https://github.com/linglongxin24/WelcomeVideoPager)
331 |
332 | >注意:如果视频是有声音的话是会有问题的,由于Fragment的预加载机制。具体解决方案请看这里[Android中ViewPager+Fragment取消(禁止)预加载延迟加载(懒加载)问题解决方案](http://blog.csdn.net/linglongxin24/article/details/53205878)
333 | 在本Demo中可以将GuildFragment替换为Guild2Fragment可以查看解决后的效果。
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.0"
6 | defaultConfig {
7 | applicationId "cn.bluemobi.dylan.welcomevideopager"
8 | minSdkVersion 9
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.0.0'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\kejiang\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/cn/bluemobi/dylan/welcomevideopager/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("cn.bluemobi.dylan.welcomevideopager", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/bluemobi/dylan/welcomevideopager/CustomVideoView.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.content.Context;
4 | import android.media.MediaPlayer;
5 | import android.net.Uri;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.VideoView;
9 |
10 | /**
11 | * 可以播放视频的View
12 | * Created by yuandl on 2016-11-10.
13 | */
14 |
15 | public class CustomVideoView extends VideoView {
16 | public CustomVideoView(Context context) {
17 | super(context);
18 | }
19 |
20 | public CustomVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | public CustomVideoView(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | }
27 |
28 | @Override
29 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
30 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
31 | setMeasuredDimension(View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(heightMeasureSpec));
32 | }
33 |
34 | /**
35 | * 播放视频
36 | *
37 | * @param uri 播放地址
38 | */
39 | public void playVideo(Uri uri) {
40 | if (uri == null) {
41 | throw new IllegalArgumentException("Uri can not be null");
42 | }
43 | /**设置播放路径**/
44 | setVideoURI(uri);
45 | /**开始播放**/
46 | start();
47 | setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
48 |
49 | @Override
50 | public void onPrepared(MediaPlayer mp) {
51 | /**设置循环播放**/
52 | mp.setLooping(true);
53 | }
54 | });
55 | setOnErrorListener(new MediaPlayer.OnErrorListener() {
56 |
57 | @Override
58 | public boolean onError(MediaPlayer mp, int what, int extra) {
59 | return true;
60 | }
61 | });
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/bluemobi/dylan/welcomevideopager/Guild2Fragment.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.net.Uri;
4 | import android.util.Log;
5 |
6 | /**
7 | * Created by yuandl on 2016-11-10.
8 | */
9 |
10 | public class Guild2Fragment extends LazyLoadFragment {
11 | private CustomVideoView customVideoView;
12 | private int index;
13 |
14 | @Override
15 | protected int setContentView() {
16 | return R.layout.fm_guild;
17 | }
18 |
19 | @Override
20 | protected void lazyLoad() {
21 |
22 | customVideoView = findViewById(R.id.cv);
23 | /**获取参数,根据不同的参数播放不同的视频**/
24 | index = getArguments().getInt("index");
25 | Log.d("Guild2Fragment","开始播放视频="+index);
26 | Uri uri;
27 | if (index == 1) {
28 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.test1);
29 | } else if (index == 2) {
30 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.test2);
31 | } else {
32 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.test3);
33 | }
34 | /**播放视频**/
35 | customVideoView.playVideo(uri);
36 | }
37 |
38 | @Override
39 | protected void stopLoad() {
40 | super.stopLoad();
41 | if (customVideoView != null) {
42 | customVideoView.stopPlayback();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/bluemobi/dylan/welcomevideopager/GuildFragment.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.net.Uri;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | /**
12 | * Created by yuandl on 2016-11-10.
13 | */
14 |
15 | public class GuildFragment extends Fragment {
16 |
17 | private CustomVideoView customVideoView;
18 |
19 | @Nullable
20 | @Override
21 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
22 | customVideoView = new CustomVideoView(getContext());
23 | /**获取参数,根据不同的参数播放不同的视频**/
24 | int index = getArguments().getInt("index");
25 | Uri uri;
26 | if (index == 1) {
27 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_1);
28 | } else if (index == 2) {
29 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_2);
30 | } else {
31 | uri = Uri.parse("android.resource://" + getActivity().getPackageName() + "/" + R.raw.guide_3);
32 | }
33 | /**播放视频**/
34 | customVideoView.playVideo(uri);
35 | return customVideoView;
36 | }
37 |
38 | /**
39 | * 记得在销毁的时候让播放的视频终止
40 | */
41 | @Override
42 | public void onDestroyView() {
43 | super.onDestroyView();
44 | if (customVideoView != null) {
45 | customVideoView.stopPlayback();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/bluemobi/dylan/welcomevideopager/LazyLoadFragment.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.text.TextUtils;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.Toast;
11 |
12 | /**
13 | * Fragment预加载问题的解决方案:
14 | * 1.可以懒加载的Fragment
15 | * 2.切换到其他页面时停止加载数据(可选)
16 | * Created by yuandl on 2016-11-17.
17 | */
18 |
19 | public abstract class LazyLoadFragment extends Fragment {
20 | /**
21 | * 视图是否已经初初始化
22 | */
23 | protected boolean isInit = false;
24 | protected boolean isLoad = false;
25 | protected final String TAG = "LazyLoadFragment";
26 | private View view;
27 |
28 | @Nullable
29 | @Override
30 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
31 | view = inflater.inflate(setContentView(), container, false);
32 | isInit = true;
33 | /**初始化的时候去加载数据**/
34 | isCanLoadData();
35 | return view;
36 | }
37 |
38 | /**
39 | * 视图是否已经对用户可见,系统的方法
40 | */
41 | @Override
42 | public void setUserVisibleHint(boolean isVisibleToUser) {
43 | super.setUserVisibleHint(isVisibleToUser);
44 | isCanLoadData();
45 | }
46 |
47 | /**
48 | * 是否可以加载数据
49 | * 可以加载数据的条件:
50 | * 1.视图已经初始化
51 | * 2.视图对用户可见
52 | */
53 | private void isCanLoadData() {
54 | if (!isInit) {
55 | return;
56 | }
57 |
58 | if (getUserVisibleHint()) {
59 | lazyLoad();
60 | isLoad = true;
61 | } else {
62 | if (isLoad) {
63 | stopLoad();
64 | }
65 | }
66 | }
67 |
68 | /**
69 | * 视图销毁的时候讲Fragment是否初始化的状态变为false
70 | */
71 | @Override
72 | public void onDestroyView() {
73 | super.onDestroyView();
74 | isInit = false;
75 | isLoad = false;
76 |
77 | }
78 |
79 | protected void showToast(String message) {
80 | if (!TextUtils.isEmpty(message)) {
81 | Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
82 | }
83 |
84 | }
85 |
86 | /**
87 | * 设置Fragment要显示的布局
88 | *
89 | * @return 布局的layoutId
90 | */
91 | protected abstract int setContentView();
92 |
93 | /**
94 | * 获取设置的布局
95 | *
96 | * @return
97 | */
98 | protected View getContentView() {
99 | return view;
100 | }
101 |
102 | /**
103 | * 找出对应的控件
104 | *
105 | * @param id
106 | * @param
107 | * @return
108 | */
109 | protected T findViewById(int id) {
110 |
111 | return (T) getContentView().findViewById(id);
112 | }
113 |
114 | /**
115 | * 当视图初始化并且对用户可见的时候去真正的加载数据
116 | */
117 | protected abstract void lazyLoad();
118 |
119 | /**
120 | * 当视图已经对用户不可见并且加载过数据,如果需要在切换到其他页面时停止加载数据,可以调用此方法
121 | */
122 | protected void stopLoad() {
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/bluemobi/dylan/welcomevideopager/MainActivity.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v4.app.FragmentPagerAdapter;
7 | import android.support.v4.view.ViewPager;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.ImageView;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | public class MainActivity extends AppCompatActivity {
17 | private ViewPager vp;
18 | private ImageView iv1;
19 | private ImageView iv2;
20 | private ImageView iv3;
21 | private Button bt_start;
22 | private List fragments;
23 |
24 | private void assignViews() {
25 | vp = (ViewPager) findViewById(R.id.vp);
26 | iv1 = (ImageView) findViewById(R.id.iv1);
27 | iv2 = (ImageView) findViewById(R.id.iv2);
28 | iv3 = (ImageView) findViewById(R.id.iv3);
29 | bt_start = (Button) findViewById(R.id.bt_start);
30 | }
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_main);
36 | assignViews();
37 | initData();
38 | initView();
39 |
40 | }
41 |
42 | /**
43 | * 初始化数据,添加三个Fragment
44 | */
45 | private void initData() {
46 | fragments = new ArrayList<>();
47 |
48 | Fragment fragment1 = new GuildFragment();
49 | Bundle bundle1 = new Bundle();
50 | bundle1.putInt("index", 1);
51 | fragment1.setArguments(bundle1);
52 | fragments.add(fragment1);
53 |
54 | Fragment fragment2 = new GuildFragment();
55 | Bundle bundle2 = new Bundle();
56 | bundle2.putInt("index", 2);
57 | fragment2.setArguments(bundle2);
58 | fragments.add(fragment2);
59 |
60 | Fragment fragment3 = new GuildFragment();
61 | Bundle bundle3 = new Bundle();
62 | bundle3.putInt("index", 3);
63 | fragment3.setArguments(bundle3);
64 | fragments.add(fragment3);
65 | }
66 |
67 | /**
68 | * 设置ViewPager的适配器和滑动监听
69 | */
70 | private void initView() {
71 | vp.setOffscreenPageLimit(3);
72 | vp.setAdapter(new MyPageAdapter(getSupportFragmentManager()));
73 | vp.addOnPageChangeListener(new MyPageChangeListener());
74 | }
75 |
76 | /**
77 | * ViewPager适配器
78 | */
79 | private class MyPageAdapter extends FragmentPagerAdapter {
80 |
81 |
82 | public MyPageAdapter(FragmentManager fm) {
83 | super(fm);
84 | }
85 |
86 | @Override
87 | public Fragment getItem(int position) {
88 | return fragments.get(position);
89 | }
90 |
91 | @Override
92 | public int getCount() {
93 | return fragments.size();
94 | }
95 | }
96 |
97 | /**
98 | * ViewPager滑动页面监听器
99 | */
100 | private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
101 | @Override
102 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
103 |
104 | }
105 |
106 | /**
107 | * 根据页面不同动态改变红点和在最后一页显示立即体验按钮
108 | *
109 | * @param position
110 | */
111 | @Override
112 | public void onPageSelected(int position) {
113 | bt_start.setVisibility(View.GONE);
114 | iv1.setImageResource(R.mipmap.dot_normal);
115 | iv2.setImageResource(R.mipmap.dot_normal);
116 | iv3.setImageResource(R.mipmap.dot_normal);
117 | if (position == 0) {
118 | iv1.setImageResource(R.mipmap.dot_focus);
119 | } else if (position == 1) {
120 | iv2.setImageResource(R.mipmap.dot_focus);
121 | } else {
122 | iv3.setImageResource(R.mipmap.dot_focus);
123 | bt_start.setVisibility(View.VISIBLE);
124 | }
125 | }
126 |
127 | @Override
128 | public void onPageScrollStateChanged(int state) {
129 |
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
23 |
24 |
30 |
31 |
37 |
38 |
39 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fm_guild.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/bt_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xxhdpi/bt_start.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/dot_focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xxhdpi/dot_focus.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/dot_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xxhdpi/dot_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/guide_1.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/guide_1.mp4
--------------------------------------------------------------------------------
/app/src/main/res/raw/guide_2.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/guide_2.mp4
--------------------------------------------------------------------------------
/app/src/main/res/raw/guide_3.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/guide_3.mp4
--------------------------------------------------------------------------------
/app/src/main/res/raw/test1.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/test1.mp4
--------------------------------------------------------------------------------
/app/src/main/res/raw/test2.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/test2.mp4
--------------------------------------------------------------------------------
/app/src/main/res/raw/test3.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/app/src/main/res/raw/test3.mp4
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | WelcomeVideoPager
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/test/java/cn/bluemobi/dylan/welcomevideopager/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package cn.bluemobi.dylan.welcomevideopager;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Manifest Merging:
5 | -----------------
6 | Your project uses libraries that provide manifests, and your Eclipse
7 | project did not explicitly turn on manifest merging. In Android Gradle
8 | projects, manifests are always merged (meaning that contents from your
9 | libraries' manifests will be merged into the app manifest. If you had
10 | manually copied contents from library manifests into your app manifest
11 | you may need to remove these for the app to build correctly.
12 |
13 | Ignored Files:
14 | --------------
15 | The following files were *not* copied into the new Gradle project; you
16 | should evaluate whether these are still needed in your project and if
17 | so manually move them:
18 |
19 | * ic_launcher-web.png
20 | * proguard-project.txt
21 |
22 | Replaced Jars with Dependencies:
23 | --------------------------------
24 | The importer recognized the following .jar files as third party
25 | libraries and replaced them with Gradle dependencies instead. This has
26 | the advantage that more explicit version information is known, and the
27 | libraries can be updated automatically. However, it is possible that
28 | the .jar file in your project was of an older version than the
29 | dependency we picked, which could render the project not compileable.
30 | You can disable the jar replacement in the import wizard and try again:
31 |
32 | android-support-v4.jar => com.android.support:support-v4:19.+
33 | android-support-v7-appcompat.jar => com.android.support:appcompat-v7:19.+
34 |
35 | Replaced Libraries with Dependencies:
36 | -------------------------------------
37 | The importer recognized the following library projects as third party
38 | libraries and replaced them with Gradle dependencies instead. This has
39 | the advantage that more explicit version information is known, and the
40 | libraries can be updated automatically. However, it is possible that
41 | the source files in your project were of an older version than the
42 | dependency we picked, which could render the project not compileable.
43 | You can disable the library replacement in the import wizard and try
44 | again:
45 |
46 | android-support-v7-appcompat => [com.android.support:appcompat-v7:19.+]
47 |
48 | Moved Files:
49 | ------------
50 | Android Gradle projects use a different directory structure than ADT
51 | Eclipse projects. Here's how the projects were restructured:
52 |
53 | * AndroidManifest.xml => moocTest\src\main\AndroidManifest.xml
54 | * assets\ => moocTest\src\main\assets
55 | * lint.xml => moocTest\lint.xml
56 | * res\ => moocTest\src\main\res\
57 | * src\ => moocTest\src\main\java\
58 |
59 | Missing Android Support Repository:
60 | -----------------------------------
61 | Some useful libraries, such as the Android Support Library, are
62 | installed from a special Maven repository, which should be installed
63 | via the SDK manager.
64 |
65 | It looks like this library is missing from your SDK installation at:
66 | null
67 |
68 | To install it, open the SDK manager, and in the Extras category,
69 | select "Android Support Repository". You may also want to install the
70 | "Google Repository" if you want to use libraries like Google Play
71 | Services.
72 |
73 | Next Steps:
74 | -----------
75 | You can now build the project. The Gradle project needs network
76 | connectivity to download dependencies.
77 |
78 | Bugs:
79 | -----
80 | If for some reason your project does not build, and you determine that
81 | it is due to a bug or limitation of the Eclipse to Gradle importer,
82 | please file a bug at http://b.android.com with category
83 | Component-Tools.
84 |
85 | (This import summary is for your information only, and can be deleted
86 | after import once you are satisfied with the results.)
87 |
--------------------------------------------------------------------------------
/screenshorts/effect.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/screenshorts/effect.gif
--------------------------------------------------------------------------------
/screenshorts/mafengwo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linglongxin24/WelcomeVideoPager/1ecee749be6ddb555861f8ac0ad1e90532797446/screenshorts/mafengwo.gif
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------