Skip to content

Commit fdd6dd3

Browse files
committed
1:调整目录结构,增加Fragment组件化示例;
1 parent 2c22394 commit fdd6dd3

25 files changed

+146
-60
lines changed

module_news/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ dependencies {
4242
compile fileTree(dir: 'libs', include: ['*.jar'])
4343
annotationProcessor "com.alibaba:arouter-compiler:$rootProject.annotationProcessor"
4444
compile project(':lib_common')
45+
compile 'com.android.support:support-v4:25.3.1'
4546
}

module_news/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.guiying.news">
2+
package="com.guiying.module.news">
33

44
<application android:theme="@style/AppTheme">
55
<activity

module_news/src/main/java/com/guiying/news/Constants.java renamed to module_news/src/main/java/com/guiying/module/news/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.guiying.news;
1+
package com.guiying.module.news;
22

33
/**
44
* 保存项目中用到的常量
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.guiying.module.news;
2+
3+
import com.guiying.module.common.base.ApplicationDelegate;
4+
import com.guiying.module.common.base.ViewManager;
5+
6+
/**
7+
* <p>类说明</p>
8+
*
9+
* @author 张华洋 2017/9/20 22:29
10+
* @version V2.8.3
11+
* @name MyDelegate
12+
*/
13+
14+
15+
public class MyDelegate implements ApplicationDelegate {
16+
17+
@Override
18+
public void onCreate() {
19+
ViewManager.getInstance().addFragment(0, new NewsFragment());
20+
}
21+
22+
@Override
23+
public void onTerminate() {
24+
25+
}
26+
27+
@Override
28+
public void onLowMemory() {
29+
30+
}
31+
32+
@Override
33+
public void onTrimMemory(int level) {
34+
35+
}
36+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.guiying.module.news;
2+
3+
4+
import android.os.Bundle;
5+
import android.support.v4.app.Fragment;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
10+
import com.guiying.module.common.base.BaseFragment;
11+
12+
13+
/**
14+
* A simple {@link Fragment} subclass.
15+
*/
16+
public class NewsFragment extends BaseFragment {
17+
18+
19+
public NewsFragment() {
20+
// Required empty public constructor
21+
}
22+
23+
24+
@Override
25+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
26+
Bundle savedInstanceState) {
27+
// Inflate the layout for this fragment
28+
return inflater.inflate(R.layout.fragment_news, container, false);
29+
}
30+
31+
32+
}

module_news/src/main/java/com/guiying/news/data/NewsDataSource.java renamed to module_news/src/main/java/com/guiying/module/news/data/NewsDataSource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.guiying.news.data;
1+
package com.guiying.module.news.data;
22

3-
import com.guiying.common.base.InfoCallback;
4-
import com.guiying.news.data.bean.MessageDetail;
5-
import com.guiying.news.data.bean.StoryList;
3+
import com.guiying.module.common.base.InfoCallback;
4+
import com.guiying.module.news.data.bean.MessageDetail;
5+
import com.guiying.module.news.data.bean.StoryList;
66

77
/**
88
* <p>类说明</p>

module_news/src/main/java/com/guiying/news/data/bean/MessageDetail.java renamed to module_news/src/main/java/com/guiying/module/news/data/bean/MessageDetail.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.guiying.news.data.bean;
1+
package com.guiying.module.news.data.bean;
22

33
import java.util.List;
44

module_news/src/main/java/com/guiying/news/data/bean/Story.java renamed to module_news/src/main/java/com/guiying/module/news/data/bean/Story.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.guiying.news.data.bean;
1+
package com.guiying.module.news.data.bean;
22

33
/**
44
* 日报新闻实体类

module_news/src/main/java/com/guiying/news/data/bean/StoryList.java renamed to module_news/src/main/java/com/guiying/module/news/data/bean/StoryList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.guiying.news.data.bean;
1+
package com.guiying.module.news.data.bean;
22

33
import java.util.List;
44

module_news/src/main/java/com/guiying/news/data/source/RemoteNewsDataSource.java renamed to module_news/src/main/java/com/guiying/module/news/data/source/RemoteNewsDataSource.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package com.guiying.news.data.source;
1+
package com.guiying.module.news.data.source;
22

3-
import com.guiying.common.base.InfoCallback;
4-
import com.guiying.common.http.DataType;
5-
import com.guiying.common.http.HttpClient;
6-
import com.guiying.common.http.OnResultListener;
7-
import com.guiying.news.Constants;
8-
import com.guiying.news.data.NewsDataSource;
9-
import com.guiying.news.data.bean.MessageDetail;
10-
import com.guiying.news.data.bean.StoryList;
3+
import com.guiying.module.common.base.InfoCallback;
4+
import com.guiying.module.common.http.DataType;
5+
import com.guiying.module.common.http.HttpClient;
6+
import com.guiying.module.common.http.OnResultListener;
7+
import com.guiying.module.news.Constants;
8+
import com.guiying.module.news.data.NewsDataSource;
9+
import com.guiying.module.news.data.bean.MessageDetail;
10+
import com.guiying.module.news.data.bean.StoryList;
1111

1212
/**
1313
* <p>类说明</p>

0 commit comments

Comments
 (0)