Skip to content

Commit

Permalink
add daily
Browse files Browse the repository at this point in the history
  • Loading branch information
codeestX committed Aug 13, 2016
1 parent 26b1c77 commit aa9d472
Show file tree
Hide file tree
Showing 54 changed files with 1,592 additions and 75 deletions.
7 changes: 1 addition & 6 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ dependencies {
compile 'com.orhanobut:logger:1.15'
compile 'me.yokeyword:fragmentation:0.7.9'
compile 'me.yokeyword:fragmentation-swipeback:0.7.9'
compile 'com.victor:lib:1.0.4'
compile 'com.prolificinteractive:material-calendarview:1.4.0'

//canary
debugCompile 'com.github.moduth:blockcanary-android:1.2.1'
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:hardwareAccelerated="true"
android:theme="@style/AppTheme">
<activity android:name="com.codeest.geeknews.ui.main.MainActivity">
<intent-filter>
Expand All @@ -22,6 +23,9 @@
</intent-filter>
</activity>

//知乎
<activity android:name=".ui.zhihu.activity.CalendarActivity"/>

<meta-data
android:value="YOUR_APP_KEY"
android:name="UMENG_APPKEY"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.codeest.geeknews.di.module.ActivityModule;
import com.codeest.geeknews.model.http.RetrofitHelper;
import com.codeest.geeknews.ui.main.MainActivity;
import com.codeest.geeknews.ui.zhihu.activity.ZhihuDetailActivity;

import dagger.Component;

Expand All @@ -23,4 +24,6 @@ public interface ActivityComponent {

void inject(MainActivity mainActivity);

void inject(ZhihuDetailActivity zhihuDetailActivity);

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import com.codeest.geeknews.di.FragmentScope;
import com.codeest.geeknews.di.module.FragmentModule;
import com.codeest.geeknews.model.http.RetrofitHelper;
import com.codeest.geeknews.ui.zhihu.fragment.DailyFragment;
import com.codeest.geeknews.ui.zhihu.fragment.HotFragment;
import com.codeest.geeknews.ui.zhihu.fragment.SectionFragment;
import com.codeest.geeknews.ui.zhihu.fragment.ZhihuMainFragment;
import com.codeest.geeknews.ui.zhihu.fragment.ThemeFragment;

import dagger.Component;

Expand All @@ -23,4 +27,12 @@ public interface FragmentComponent {

void inject(ZhihuMainFragment zhihuMainFragment);

void inject(DailyFragment dailyFragment);

void inject(ThemeFragment themeFragment);

void inject(SectionFragment sectionFragment);

void inject(HotFragment hotFragment);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.codeest.geeknews.model.bean;

/**
* Created by codeest on 16/8/13.
*/

public class CalendarBean {

public CalendarBean(int year, int month, int day) {
this.year = year;
this.month = month;
this.day = day;
}

private int year;

private int month;

private int day;

public int getDay() {
return day;
}

public int getMonth() {
return month;
}

public int getYear() {
return year;
}

public void setDay(int day) {
this.day = day;
}

public void setMonth(int month) {
this.month = month;
}

public void setYear(int year) {
this.year = year;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.codeest.geeknews.model.bean;

import java.util.List;

/**
* Created by codeest on 16/8/12.
*/

public class DailyBeforeListBean {
/**
* date : 20160812
* stories : [{"images":["http://pic4.zhimg.com/ffdf4a47a087c3968e5142d8b73fcf2b.jpg"],"type":0,"id":8668470,"ga_prefix":"081222","title":"小事 · 骗了骗子的钱"},{"images":["http://pic1.zhimg.com/5601592dcd487f70f72a63fa518c1590.jpg"],"type":0,"id":8679591,"ga_prefix":"081221","title":"看起来很「割裂」的故事,其实是有意为之"},{"title":"整点儿奥运 · 为一位明天凌晨参加奥运比赛的知乎用户加油","ga_prefix":"081220","images":["http://pic3.zhimg.com/78d776b567dd41950f525fce3ddca232.jpg"],"multipic":true,"type":0,"id":8679315},{"images":["http://pic1.zhimg.com/25abcbf1da060f9bf3de64859dcaac74.jpg"],"type":0,"id":8679678,"ga_prefix":"081219","title":"为什么学习英语的过程中,很长时间一直会受到汉语干扰?"},{"title":"一个值得全世界起立致敬的男人:因为我们再也不沉默了","ga_prefix":"081218","images":["http://pic3.zhimg.com/a036e6f2a4c94a011c5b0335bd84868e.jpg"],"multipic":true,"type":0,"id":8679133},{"images":["http://pic3.zhimg.com/1ab4cbe65f5e8295106288106f904376.jpg"],"type":0,"id":8679125,"ga_prefix":"081217","title":"知乎好问题 · 一天吃几个鸡蛋比较好?"},{"images":["http://pic2.zhimg.com/f02fc1ff2ca9b2de687953f2e2d0bc91.jpg"],"type":0,"id":8651703,"ga_prefix":"081216","title":"哥特式建筑,是一种什么样的存在?"},{"images":["http://pic2.zhimg.com/c64a5c2a63d04a989fdd58b9f35ffe41.jpg"],"type":0,"id":8676431,"ga_prefix":"081215","title":"地产入门:商业地产和住宅地产到底有什么区别?"},{"images":["http://pic1.zhimg.com/c41a49510ca44a620e15d3f8bdf42420.jpg"],"type":0,"id":8673887,"ga_prefix":"081214","title":"天才都有点神经质?嗯\u2026\u2026好像是的"},{"images":["http://pic4.zhimg.com/13471bb8c17a7e98f7e4677fd06a7287.jpg"],"type":0,"id":8678092,"ga_prefix":"081213","title":"为了娶到女神,我只好把她的恋女癖爸爸杀了"},{"title":"大误 · 小智的臂力简直可怕","ga_prefix":"081212","images":["http://pic4.zhimg.com/d60a9322c988a8b7a1f49933d33f120f.jpg"],"multipic":true,"type":0,"id":8674919},{"images":["http://pic4.zhimg.com/7d04382b9e4a5b997a0575a4b126348b.jpg"],"type":0,"id":8670773,"ga_prefix":"081211","title":"堵车已经够烦了,为什么还要收「拥堵费」?"},{"images":["http://pic1.zhimg.com/f8184a6b56fc0ea3bb16889848a36200.jpg"],"type":0,"id":8676516,"ga_prefix":"081210","title":"想改变世界只差一个工程师?不如自己做「全栈工程师」"},{"images":["http://pic4.zhimg.com/ff9f92f6ce6bc0e2a16e41686902bdbb.jpg"],"type":0,"id":8669401,"ga_prefix":"081209","title":"抑郁症的发病机制都没弄清,人类是怎么发现抗抑郁药的?"},{"images":["http://pic2.zhimg.com/07ee4967655f3ef2b29d43abc4e09365.jpg"],"type":0,"id":8674728,"ga_prefix":"081208","title":"你可能不了解的世界第一:中国女子扫雷"},{"title":"从此以后见到每一条河,我都如数家珍","ga_prefix":"081207","images":["http://pic4.zhimg.com/0df540aa7b3076e51f93962bce306c93.jpg"],"multipic":true,"type":0,"id":8676539},{"images":["http://pic1.zhimg.com/5b40c986acf759953a1f875837bb8600.jpg"],"type":0,"id":8676057,"ga_prefix":"081207","title":"Facebook 分析师列给你,7 周入行互联网数据分析教程"},{"images":["http://pic3.zhimg.com/9eb54944dc591df518cf63a1f40f09b6.jpg"],"type":0,"id":8676049,"ga_prefix":"081207","title":"苹果资深公关经理总结了十年来的经验,and, one more thing\u2026"},{"images":["http://pic4.zhimg.com/2c8a3f4d43d996807b258813e07e9c5b.jpg"],"type":0,"id":8676899,"ga_prefix":"081207","title":"读读日报 24 小时热门 TOP 5 · TFBOYS 三周年"},{"images":["http://pic3.zhimg.com/bd493885f45a5a06a26259d7278a621e.jpg"],"type":0,"id":8674308,"ga_prefix":"081206","title":"瞎扯 · 如何正确地吐槽"}]
*/

private String date;
/**
* images : ["http://pic4.zhimg.com/ffdf4a47a087c3968e5142d8b73fcf2b.jpg"]
* type : 0
* id : 8668470
* ga_prefix : 081222
* title : 小事 · 骗了骗子的钱
*/

private List<DailyListBean.StoriesBean> stories;

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public List<DailyListBean.StoriesBean> getStories() {
return stories;
}

public void setStories(List<DailyListBean.StoriesBean> stories) {
this.stories = stories;
}

// public static class StoriesBean {
// private int type;
// private int id;
// private String ga_prefix;
// private String title;
// private List<String> images;
//
// public int getType() {
// return type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
//
// public int getId() {
// return id;
// }
//
// public void setId(int id) {
// this.id = id;
// }
//
// public String getGa_prefix() {
// return ga_prefix;
// }
//
// public void setGa_prefix(String ga_prefix) {
// this.ga_prefix = ga_prefix;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public List<String> getImages() {
// return images;
// }
//
// public void setImages(List<String> images) {
// this.images = images;
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Created by codeest on 16/8/12.
*/

public class ZhihuDailyListInfo {
public class DailyListBean {
/**
* date : 20160811
* stories : [{"images":["http://pic4.zhimg.com/95625b7bacfff0f6b1105ff3e71f37cb.jpg"],"type":0,"id":8675619,"ga_prefix":"081122","title":"小事 · 我在戒网瘾学校里经历了什么"},{"title":"有人看到情欲,有人看到暗黑,有人认为这是年度最值得期待的佳作","ga_prefix":"081121","images":["http://pic4.zhimg.com/67cbc856dbed2503dffe5afbdcccfc57.jpg"],"multipic":true,"type":0,"id":8675273},{"title":"整点儿奥运 · 别走啊,我用锅铲跟你打,行吗?","ga_prefix":"081120","images":["http://pic4.zhimg.com/af18477180b614d5f438c2dd06496bb3.jpg"],"multipic":true,"type":0,"id":8673847},{"title":"照片调色加俩黑条 = 电影感?一群导演和摄影师哭瞎","ga_prefix":"081119","images":["http://pic1.zhimg.com/6555bcf2b733a3cb0e26225ea5dcc548.jpg"],"multipic":true,"type":0,"id":8675601},{"images":["http://pic4.zhimg.com/c3fd1923a8f012b2a7770cffa6c8a0c3.jpg"],"type":0,"id":8675582,"ga_prefix":"081118","title":"性别不同,更有可能站在不同的「政」营?"},{"images":["http://pic2.zhimg.com/dc11586a263af5bbcfa27d7fd80bd835.jpg"],"type":0,"id":8671349,"ga_prefix":"081117","title":"知乎好问题 · 低学历是否比高学历更加会赚钱?"},{"title":"整个彩虹合唱团都出动了,只为让你唱好合唱","ga_prefix":"081116","images":["http://pic3.zhimg.com/d530aaba3304e52c8543a416e6d4670e.jpg"],"multipic":true,"type":0,"id":8664572},{"title":"柠檬 + 酸奶 + 冰淇淋,每一样都能让被蒸熟的我复活","ga_prefix":"081114","images":["http://pic2.zhimg.com/272d4bcd106271178620c864490c6039.jpg"],"multipic":true,"type":0,"id":8671431},{"images":["http://pic4.zhimg.com/944d3062d9709285763b276894679443.jpg"],"type":0,"id":8665792,"ga_prefix":"081112","title":"大误 · 我无法砸了我的手机"},{"images":["http://pic3.zhimg.com/92d67149451bfc24228e84b00dcdd316.jpg"],"type":0,"id":8673963,"ga_prefix":"081111","title":"有大公司 offer 却选择了小公司是为什么?"},{"images":["http://pic3.zhimg.com/3f734ae8eaa2c919f9df7bdadb258572.jpg"],"type":0,"id":8672587,"ga_prefix":"081110","title":"把加密算法本身保密起来,不就是绝对安全了?"},{"images":["http://pic4.zhimg.com/1818c8c204592c03d2322ee958261d4b.jpg"],"type":0,"id":8671284,"ga_prefix":"081109","title":"「孙杨夺冠把泳帽误扔泳池里以后,我发现我更喜欢他了」"},{"images":["http://pic4.zhimg.com/d2d586e6b82902c30a17605cdfb894ef.jpg"],"type":0,"id":8672664,"ga_prefix":"081108","title":"只是寄个快递,结果律师被「坑惨」了"},{"images":["http://pic4.zhimg.com/8adbdaad1daaad81e09cc55eb3a6b553.jpg"],"type":0,"id":8652559,"ga_prefix":"081107","title":"还在比较「唱功」的人,听不懂李宗盛"},{"images":["http://pic2.zhimg.com/efa0c4d9b0dba8d1b45fb9161bb9c9b1.jpg"],"type":0,"id":8672657,"ga_prefix":"081107","title":"有时也会迷惑,我到底是来种地,还是来读硕士的"},{"title":"吃河豚会死吗?不吃河豚会死吗?","ga_prefix":"081107","images":["http://pic4.zhimg.com/c11e628e679fa30b30a0103f757edadf.jpg"],"multipic":true,"type":0,"id":8655025},{"images":["http://pic4.zhimg.com/7eabe3ce21a0728cc7e149d7f92865f7.jpg"],"type":0,"id":8672907,"ga_prefix":"081107","title":"读读日报 24 小时热门 TOP 5 · 为什么孙杨总会被别人质疑「服药」"},{"images":["http://pic1.zhimg.com/00da4103ad41aa4f39118004a4dd7078.jpg"],"type":0,"id":8670451,"ga_prefix":"081106","title":"瞎扯 · 如何正确地吐槽"}]
Expand Down
18 changes: 0 additions & 18 deletions app/src/main/java/com/codeest/geeknews/model/http/Apis.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import com.codeest.geeknews.BuildConfig;
import com.codeest.geeknews.app.Constants;
import com.codeest.geeknews.bean.UserCardInfo;
import com.codeest.geeknews.util.LogUtil;
import com.codeest.geeknews.model.bean.DailyBeforeListBean;
import com.codeest.geeknews.model.bean.DailyListBean;
import com.codeest.geeknews.util.SystemUtil;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.Interceptor;
Expand All @@ -29,14 +27,12 @@
*/
public class RetrofitHelper {

private static Apis apiService = null;
private static Retrofit retrofit = null;
private static OkHttpClient okHttpClient = null;
private static ZhihuApis zhihuApiService = null;

private void init() {
initOkHttp();
initRetrofit();
apiService = retrofit.create(Apis.class);
zhihuApiService = getZhihuApiService();
}

public RetrofitHelper() {
Expand Down Expand Up @@ -98,16 +94,21 @@ public Response intercept(Chain chain) throws IOException {
okHttpClient = builder.build();
}

private static void initRetrofit() {
retrofit = new Retrofit.Builder()
.baseUrl(Apis.HOST)
private static ZhihuApis getZhihuApiService() {
Retrofit zhihuRetrofit = new Retrofit.Builder()
.baseUrl(ZhihuApis.HOST)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
return zhihuRetrofit.create(ZhihuApis.class);
}

public Observable<DailyListBean> fetchDailyListInfo() {
return zhihuApiService.getDailyList();
}

public Observable<HttpResponse<UserCardInfo>> fetchUserCardInfo(int uid,String token,int otherId) {
return apiService.getUserCardInfo(uid,token,otherId);
public Observable<DailyBeforeListBean> fetchDailyBeforeListInfo(String date) {
return zhihuApiService.getDailyBeforeList(date);
}
}
Loading

0 comments on commit aa9d472

Please sign in to comment.