Skip to content

Commit c1f07ef

Browse files
committed
1:创建知乎日报组件。
1 parent a02b4b9 commit c1f07ef

26 files changed

Lines changed: 735 additions & 127 deletions

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ ext {
5353
//不成熟开源库,需经常检查升级版本
5454
aptCompilerVersion = "1.1.7"
5555
routerVersion = "1.2.2"
56-
easyRecyclerVersion = "4.3.8"
56+
easyRecyclerVersion = "4.4.0"
5757
cookieVersion = "v1.0.1"
5858
}

common/src/main/java/com/guiying/common/base/BaseActionBarActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ protected void onCreate(Bundle savedInstanceState) {
3838
}
3939
}
4040

41+
42+
/**
43+
* 更新标题
44+
*
45+
* @param title 标题
46+
*/
47+
protected void setTitle(String title) {
48+
ActionBar actionBar = getSupportActionBar();
49+
if (actionBar != null) {
50+
actionBar.setTitle(title);
51+
}
52+
}
53+
54+
4155
@Override
4256
public boolean onSupportNavigateUp() {
4357
onBackPressed();

common/src/main/java/com/guiying/common/base/BaseActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
import android.content.Intent;
44
import android.os.Bundle;
55
import android.support.annotation.IdRes;
6+
import android.support.v7.app.ActionBar;
67
import android.support.v7.app.AppCompatActivity;
8+
import android.support.v7.widget.Toolbar;
79
import android.view.View;
810

911
/**
@@ -39,6 +41,17 @@ protected void onCreate(Bundle savedInstanceState) {
3941
}
4042
}
4143

44+
protected void setToolbar(Toolbar toolbar, String title) {
45+
setSupportActionBar(toolbar);
46+
ActionBar actionBar = getSupportActionBar();
47+
if (null != actionBar) {
48+
actionBar.setDisplayHomeAsUpEnabled(true);
49+
actionBar.setDisplayShowHomeEnabled(true);
50+
//actionBar.setDisplayShowTitleEnabled(false);//隐藏Title
51+
actionBar.setTitle(title);
52+
}
53+
}
54+
4255
@Override
4356
protected void onDestroy() {
4457
super.onDestroy();

common/src/main/java/com/guiying/common/http/HttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ private void parseJson(String data, Class clazz, int bodyType, OnResultListener
318318
onResultListener.onSuccess(DataParseUtil.parseObject(data, clazz));
319319
break;
320320
case ARRAY:
321-
onResultListener.onSuccess(DataParseUtil.parseToArrayList(data, clazz));
321+
onResultListener.onSuccess(DataParseUtil.parseToList(data, clazz));
322322
break;
323323
case XML:
324324
onResultListener.onSuccess(DataParseUtil.parseXml(data, clazz));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.guiying.common.http;
2+
3+
/**
4+
* <p>数据回调接口</p>
5+
*
6+
* @author 张华洋 2017/3/22 13:36
7+
* @version V1.2.0
8+
* @name InfoCallback
9+
*/
10+
public interface InfoCallback<T> {
11+
12+
void onSuccess(T info);
13+
14+
void onError(int code, String message);
15+
16+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ localBuildToolsVersion=25.0.2
2222
localGradlePluginVersion=2.3.0
2323

2424
# 每次更改“isModule”的值后,需要点击 "Sync Project" 按钮
25-
isModule=false
25+
isModule=true

news/src/main/debug/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
1212
<activity
13-
android:name=".main.NewsActivity"
13+
android:name=".main.NewsCenterActivity"
14+
android:theme="@style/AppTheme.NoActionBar"
1415
android:screenOrientation="portrait">
1516
<intent-filter>
1617
<action android:name="android.intent.action.MAIN" />

news/src/main/java/com/guiying/news/News.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* @version V1.2.0
1010
* @name news
1111
*/
12-
1312
@Module("news")
1413
public class News {
1514
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.guiying.news.data;
2+
3+
import com.guiying.common.http.InfoCallback;
4+
import com.guiying.news.data.bean.StoryList;
5+
6+
/**
7+
* <p>类说明</p>
8+
*
9+
* @author 张华洋 2017/4/20 22:02
10+
* @version V1.2.0
11+
* @name NewsDataSource
12+
*/
13+
public interface NewsDataSource {
14+
15+
16+
/**
17+
* 获取
18+
*
19+
* @param date
20+
* @param callback 回调
21+
*/
22+
void getNewsList(String date, InfoCallback<StoryList> callback);
23+
24+
25+
}
26+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package com.guiying.news.data.bean;
2+
3+
import java.util.List;
4+
5+
public class MessageDetail {
6+
private String body;
7+
private String image_source;
8+
private String title;
9+
private String image;
10+
private String share_url;
11+
private List<String> recommenders;
12+
private String ga_prefix;
13+
private String type;
14+
private String id;
15+
16+
public String getBody() {
17+
return body;
18+
}
19+
20+
public void setBody(String body) {
21+
this.body = body;
22+
}
23+
24+
public String getImage_source() {
25+
return image_source;
26+
}
27+
28+
public void setImage_source(String image_source) {
29+
this.image_source = image_source;
30+
}
31+
32+
public String getTitle() {
33+
return title;
34+
}
35+
36+
public void setTitle(String title) {
37+
this.title = title;
38+
}
39+
40+
public String getImage() {
41+
return image;
42+
}
43+
44+
public void setImage(String image) {
45+
this.image = image;
46+
}
47+
48+
public String getShare_url() {
49+
return share_url;
50+
}
51+
52+
public void setShare_url(String share_url) {
53+
this.share_url = share_url;
54+
}
55+
56+
public List<String> getRecommenders() {
57+
return recommenders;
58+
}
59+
60+
public void setRecommenders(List<String> recommenders) {
61+
this.recommenders = recommenders;
62+
}
63+
64+
public String getGa_prefix() {
65+
return ga_prefix;
66+
}
67+
68+
public void setGa_prefix(String ga_prefix) {
69+
this.ga_prefix = ga_prefix;
70+
}
71+
72+
public String getType() {
73+
return type;
74+
}
75+
76+
public void setType(String type) {
77+
this.type = type;
78+
}
79+
80+
public String getId() {
81+
return id;
82+
}
83+
84+
public void setId(String id) {
85+
this.id = id;
86+
}
87+
}

0 commit comments

Comments
 (0)