tngou) {
34 | this.tngou = tngou;
35 | }
36 |
37 | public static class TngouBean {
38 | private int count;
39 | private String description;
40 | private int fcount;
41 | private String fromname;
42 | private String fromurl;
43 | private int id;
44 | private String img;
45 | private String keywords;
46 | private int rcount;
47 | private long time;
48 | private String title;
49 | private int topclass;
50 |
51 | public int getCount() {
52 | return count;
53 | }
54 |
55 | public void setCount(int count) {
56 | this.count = count;
57 | }
58 |
59 | public String getDescription() {
60 | return description;
61 | }
62 |
63 | public void setDescription(String description) {
64 | this.description = description;
65 | }
66 |
67 | public int getFcount() {
68 | return fcount;
69 | }
70 |
71 | public void setFcount(int fcount) {
72 | this.fcount = fcount;
73 | }
74 |
75 | public String getFromname() {
76 | return fromname;
77 | }
78 |
79 | public void setFromname(String fromname) {
80 | this.fromname = fromname;
81 | }
82 |
83 | public String getFromurl() {
84 | return fromurl;
85 | }
86 |
87 | public void setFromurl(String fromurl) {
88 | this.fromurl = fromurl;
89 | }
90 |
91 | public int getId() {
92 | return id;
93 | }
94 |
95 | public void setId(int id) {
96 | this.id = id;
97 | }
98 |
99 | public String getImg() {
100 | return img;
101 | }
102 |
103 | public void setImg(String img) {
104 | this.img = img;
105 | }
106 |
107 | public String getKeywords() {
108 | return keywords;
109 | }
110 |
111 | public void setKeywords(String keywords) {
112 | this.keywords = keywords;
113 | }
114 |
115 | public int getRcount() {
116 | return rcount;
117 | }
118 |
119 | public void setRcount(int rcount) {
120 | this.rcount = rcount;
121 | }
122 |
123 | public long getTime() {
124 | return time;
125 | }
126 |
127 | public void setTime(long time) {
128 | this.time = time;
129 | }
130 |
131 | public String getTitle() {
132 | return title;
133 | }
134 |
135 | public void setTitle(String title) {
136 | this.title = title;
137 | }
138 |
139 | public int getTopclass() {
140 | return topclass;
141 | }
142 |
143 | public void setTopclass(int topclass) {
144 | this.topclass = topclass;
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/WebViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui;
2 |
3 | import android.graphics.Bitmap;
4 | import android.os.Bundle;
5 | import android.text.TextUtils;
6 | import android.view.KeyEvent;
7 | import android.view.View;
8 | import android.webkit.WebResourceError;
9 | import android.webkit.WebResourceRequest;
10 | import android.webkit.WebResourceResponse;
11 | import android.webkit.WebSettings;
12 | import android.webkit.WebView;
13 | import android.webkit.WebViewClient;
14 |
15 | import com.wuxiaolong.androidutils.library.LogUtil;
16 | import com.wuxiaolong.wewin.utils.AppConstants;
17 | import com.xiaomolongstudio.wewin.R;
18 |
19 | import butterknife.BindView;
20 | import butterknife.ButterKnife;
21 |
22 | public class WebViewActivity extends BaseActivity {
23 | private String webviewTitle;
24 | private String webviewUrl;
25 | private String webviewUrlData;
26 | @BindView(R.id.webview)
27 | WebView webview;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_web_view);
33 | ButterKnife.bind(this);
34 | webviewTitle = this.getIntent().getStringExtra(AppConstants.WEBVIEW_TITLE);
35 | webviewUrl = this.getIntent().getStringExtra(AppConstants.WEBVIEW_URL);
36 | webviewUrlData = this.getIntent().getStringExtra(AppConstants.WEBVIEW_URL_DATA);
37 | initToolbar(webviewTitle);
38 | if (!TextUtils.isEmpty(webviewUrl)) {
39 | webview.loadUrl(webviewUrl);
40 | }
41 | if (!TextUtils.isEmpty(webviewUrlData)) {
42 | webview.loadData(webviewUrlData, "text/html; charset=UTF-8", null);
43 | }
44 | LogUtil.d("webviewUrl=" + webviewUrl);
45 | WebSettings webSettings = webview.getSettings();
46 | webSettings.setJavaScriptEnabled(true);
47 | webview.setWebViewClient(
48 | new WebViewClient() {
49 |
50 | @Override
51 | public void onPageStarted(WebView view, String url, Bitmap favicon) {
52 | super.onPageStarted(view, url, favicon);
53 | }
54 |
55 | @Override
56 | public void onPageFinished(WebView view, String url) {
57 | super.onPageFinished(view, url);
58 | LogUtil.d("onPageFinished=");
59 | }
60 |
61 | @Override
62 | public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
63 | super.onReceivedHttpError(view, request, errorResponse);
64 | LogUtil.d("onReceivedHttpError");
65 | }
66 |
67 | @Override
68 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
69 | webview.setVisibility(View.VISIBLE);
70 | LogUtil.d("shouldOverrideUrlLoading");
71 | // view.loadUrl(url);
72 | // return super.shouldOverrideUrlLoading(view, url);
73 | return true;
74 | }
75 |
76 | @Override
77 | public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
78 | // Handle the error
79 | LogUtil.d("onReceivedError errorCode=" + errorCode);
80 | webview.setVisibility(View.GONE);
81 |
82 | }
83 |
84 | @Override
85 | public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
86 | super.onReceivedError(view, request, error);
87 | //表示此方法无效
88 | }
89 | }
90 | );
91 | }
92 |
93 | public boolean onKeyDown(int keyCode, KeyEvent event) {
94 | if ((KeyEvent.KEYCODE_BACK == keyCode) && webview.canGoBack()) {
95 | webview.goBack();
96 | return true;
97 | }
98 | return super.onKeyDown(keyCode, event);
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/aboutus.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
16 |
17 |
21 |
22 |
29 |
30 |
37 |
38 |
46 |
47 |
55 |
56 |
57 |
62 |
63 |
68 |
69 |
77 |
78 |
86 |
87 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/set/SetActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.set;
2 |
3 | import android.app.AlertDialog.Builder;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.text.Html;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 |
13 | import com.wuxiaolong.wewin.ui.BaseActivity;
14 | import com.wuxiaolong.wewin.ui.MainActivity;
15 | import com.wuxiaolong.wewin.ui.WorksShowActivity;
16 | import com.wuxiaolong.wewin.utils.AppUtils;
17 | import com.xiaomolongstudio.wewin.R;
18 |
19 | /**
20 | * 设置
21 | */
22 | public class SetActivity extends BaseActivity implements OnClickListener {
23 |
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_set);
27 | initToolbar(getString(R.string.set));
28 | initView();
29 | }
30 |
31 | private void initView() {
32 | findViewById(R.id.recommend).setOnClickListener(this);
33 | findViewById(R.id.good).setOnClickListener(this);
34 | findViewById(R.id.sign_out).setOnClickListener(this);
35 | findViewById(R.id.works_show).setOnClickListener(this);
36 | findViewById(R.id.sponsored_author).setOnClickListener(this);
37 | findViewById(R.id.aboutus).setOnClickListener(this);
38 | findViewById(R.id.circle).setOnClickListener(this);
39 | }
40 |
41 | @Override
42 | public void onClick(View v) {
43 | Builder builder = new Builder(SetActivity.this);
44 | switch (v.getId()) {
45 | case R.id.good:
46 | AppUtils.marketDownload(SetActivity.this, "com.xiaomolongstudio.wewin");
47 |
48 | break;
49 | case R.id.recommend:
50 | String shareContent = SetActivity.this.getResources().getString(
51 | R.string.share_content);
52 | Intent intent = new Intent(Intent.ACTION_SEND); // 启动分享发送的属性
53 | intent.setType("text/plain"); // 分享发送的数据类型
54 | intent.putExtra(Intent.EXTRA_TEXT, shareContent); // 分享的内容
55 | startActivity(Intent.createChooser(intent, "选择分享"));// 目标应用选择对话框的标题
56 | break;
57 | case R.id.aboutus:
58 |
59 | startActivity(new Intent(SetActivity.this, AboutUsActivity.class));
60 |
61 | break;
62 | case R.id.works_show:
63 |
64 | startActivity(new Intent(SetActivity.this, WorksShowActivity.class));
65 |
66 | break;
67 | case R.id.circle:
68 |
69 | startActivity(new Intent(SetActivity.this, CircleActivity.class));
70 |
71 | break;
72 | case R.id.sponsored_author:
73 |
74 | builder.setMessage(Html
75 | .fromHtml("好的产品需要更多的赞助,来奉献您的一份力量。开发者支付宝账号:1413129987@qq.com,作者在此谢过。"));
76 | builder.setTitle("邀请赞助");
77 | builder.setPositiveButton("确认",
78 | new DialogInterface.OnClickListener() {
79 | @Override
80 | public void onClick(DialogInterface dialog, int which) {
81 |
82 | dialog.dismiss();
83 | }
84 | });
85 | builder.create().show();
86 |
87 | break;
88 |
89 | default:
90 | break;
91 | }
92 |
93 | }
94 |
95 | @Override
96 | public boolean onCreateOptionsMenu(Menu menu) {
97 | // Inflate the menu; this adds items to the action bar if it is present.
98 | getMenuInflater().inflate(R.menu.set, menu);
99 | return true;
100 | }
101 |
102 | @Override
103 | public boolean onOptionsItemSelected(MenuItem item) {
104 | // Handle action bar item clicks here. The action bar will
105 | // automatically handle clicks on the Home/Up button, so long
106 | // as you specify a parent activity in AndroidManifest.xml.
107 | int id = item.getItemId();
108 | if (id == R.id.action_old) {
109 | startActivity(new Intent(mActivity, MainActivity.class));
110 | return true;
111 | }
112 | return super.onOptionsItemSelected(item);
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/model/TngouNewsDetailModel.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.model;
2 |
3 | /**
4 | * Created by Administrator
5 | * on 2016/11/3.
6 | */
7 |
8 | public class TngouNewsDetailModel extends BaseModel {
9 |
10 | /**
11 | * count : 675
12 | * description : 原标题:【图】广东高速公路收费调整哪些车涨价哪些车降价据悉由于广东省高速公路6月底前将接入全国ETC联网,因此6月底起高速收费将要调整
13 | * fcount : 0
14 | * fromname : 人们政协网
15 | * fromurl : http://www.rmzxb.com.cn/sqmy/nywy/2015/06/11/515590.shtml
16 | * id : 100
17 | * img : /top/default.jpg
18 | * keywords : 广东高速收费将调整
19 | * message :
20 | 原标题:【图】广东高速公路收费调整 哪些车涨价哪些车降价
21 | 据悉由于广东省高速公路6月底前将接入全国ETC联网,因此6月底起高速收费将要调整。那么届时哪些车收费降价,哪些车收费升价?
22 |
23 | ![1 1]()
24 |
25 | 伊秀新闻讯,6月11日,广东高速公路收费调整哪些车涨价哪些车降价。据悉由于广东省高速公路6月底前将接入全国ETC联网,因此6月底起高速收费将要调整。那么届时哪些车收费降价,哪些车收费升价?
26 | 据悉届时大部分小车的通行费不变,但也有一部分车自费调整。上升的有:车头高度小于1.3米,座位数大于或等于8的小轿车由原一类车上升为二类;40座及以上的大型客车由原三类车上升为四类。但是上调为四类车的40座以上大型客车实施降档收费,即按三类车收费。
27 | 下调的有:车头高度大于或等于1.3米的,但座位数小于7座的面包车和小型客车由原二类车下调为一类,单车收费额下降1/3;2轴6轮,10座及以上、19座以下的中型客车,19座大型客车由原三类车下调为二类,单车收费额下降1/4.而货车全部计重收费,总体降价1.7%.一些网友表示,这次降价调整不痛不痒,并没有想象中那么强大啊。而大部分网友还是表示支持,有得降一点就不错了,还想怎么样?
28 |
29 | * rcount : 0
30 | * time : 1434002582000
31 | * title : 【图】广东高速公路收费调整 哪些车涨价哪些车降价
32 | * topclass : 1
33 | * url : http://www.tngou.net/top/show/100
34 | */
35 |
36 | private int count;
37 | private String description;
38 | private int fcount;
39 | private String fromname;
40 | private String fromurl;
41 | private int id;
42 | private String img;
43 | private String keywords;
44 | private String message;
45 | private int rcount;
46 | private long time;
47 | private String title;
48 | private int topclass;
49 | private String url;
50 |
51 | public int getCount() {
52 | return count;
53 | }
54 |
55 | public void setCount(int count) {
56 | this.count = count;
57 | }
58 |
59 | public String getDescription() {
60 | return description;
61 | }
62 |
63 | public void setDescription(String description) {
64 | this.description = description;
65 | }
66 |
67 | public int getFcount() {
68 | return fcount;
69 | }
70 |
71 | public void setFcount(int fcount) {
72 | this.fcount = fcount;
73 | }
74 |
75 | public String getFromname() {
76 | return fromname;
77 | }
78 |
79 | public void setFromname(String fromname) {
80 | this.fromname = fromname;
81 | }
82 |
83 | public String getFromurl() {
84 | return fromurl;
85 | }
86 |
87 | public void setFromurl(String fromurl) {
88 | this.fromurl = fromurl;
89 | }
90 |
91 | public int getId() {
92 | return id;
93 | }
94 |
95 | public void setId(int id) {
96 | this.id = id;
97 | }
98 |
99 | public String getImg() {
100 | return img;
101 | }
102 |
103 | public void setImg(String img) {
104 | this.img = img;
105 | }
106 |
107 | public String getKeywords() {
108 | return keywords;
109 | }
110 |
111 | public void setKeywords(String keywords) {
112 | this.keywords = keywords;
113 | }
114 |
115 | public String getMessage() {
116 | return message;
117 | }
118 |
119 | public void setMessage(String message) {
120 | this.message = message;
121 | }
122 |
123 | public int getRcount() {
124 | return rcount;
125 | }
126 |
127 | public void setRcount(int rcount) {
128 | this.rcount = rcount;
129 | }
130 |
131 | public long getTime() {
132 | return time;
133 | }
134 |
135 | public void setTime(long time) {
136 | this.time = time;
137 | }
138 |
139 | public String getTitle() {
140 | return title;
141 | }
142 |
143 | public void setTitle(String title) {
144 | this.title = title;
145 | }
146 |
147 | public int getTopclass() {
148 | return topclass;
149 | }
150 |
151 | public void setTopclass(int topclass) {
152 | this.topclass = topclass;
153 | }
154 |
155 | public String getUrl() {
156 | return url;
157 | }
158 |
159 | public void setUrl(String url) {
160 | this.url = url;
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/model/TngouGirlDetailModel.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Administrator
7 | * on 2016/11/3.
8 | */
9 |
10 | public class TngouGirlDetailModel {
11 |
12 | /**
13 | * count : 213
14 | * fcount : 0
15 | * galleryclass : 3
16 | * id : 997
17 | * img : /ext/161031/8e4063576efa51e1f92f444b0a322ac5.jpg
18 | * list : [{"gallery":997,"id":15250,"src":"/ext/161031/8e4063576efa51e1f92f444b0a322ac5.jpg"},{"gallery":997,"id":15251,"src":"/ext/161031/70ae430dcabc05cdb34f40bf63a77a3b.jpg"},{"gallery":997,"id":15252,"src":"/ext/161031/88b628f6f0c2efd98877f82bbd353e0c.jpg"},{"gallery":997,"id":15253,"src":"/ext/161031/46b707cbf09e3ae45eece2f1e722e5b0.jpg"},{"gallery":997,"id":15254,"src":"/ext/161031/c6c20d437fe8d403989b6cfee3b5d76f.jpg"},{"gallery":997,"id":15255,"src":"/ext/161031/f8a01d2669362e95827be280fb98ff50.jpg"},{"gallery":997,"id":15256,"src":"/ext/161031/39be3cc4a4a0f3d855a8f16500551416.jpg"},{"gallery":997,"id":15257,"src":"/ext/161031/4d721ec6ee136c47a3ab1517a4a643c6.jpg"},{"gallery":997,"id":15258,"src":"/ext/161031/6d594960e51e93895d6f21c091e4d328.jpg"},{"gallery":997,"id":15259,"src":"/ext/161031/1038b2200b02d094a2b8c4441a031c20.jpg"}]
19 | * rcount : 0
20 | * size : 10
21 | * status : true
22 | * time : 1477919562000
23 | * title : beautyleg红艳国韵旗袍美女性感高清美腿
24 | * url : http://www.tngou.net/tnfs/show/997
25 | */
26 |
27 | private int count;
28 | private int fcount;
29 | private int galleryclass;
30 | private int id;
31 | private String img;
32 | private int rcount;
33 | private int size;
34 | private boolean status;
35 | private long time;
36 | private String title;
37 | private String url;
38 | /**
39 | * gallery : 997
40 | * id : 15250
41 | * src : /ext/161031/8e4063576efa51e1f92f444b0a322ac5.jpg
42 | */
43 |
44 | private List list;
45 |
46 | public int getCount() {
47 | return count;
48 | }
49 |
50 | public void setCount(int count) {
51 | this.count = count;
52 | }
53 |
54 | public int getFcount() {
55 | return fcount;
56 | }
57 |
58 | public void setFcount(int fcount) {
59 | this.fcount = fcount;
60 | }
61 |
62 | public int getGalleryclass() {
63 | return galleryclass;
64 | }
65 |
66 | public void setGalleryclass(int galleryclass) {
67 | this.galleryclass = galleryclass;
68 | }
69 |
70 | public int getId() {
71 | return id;
72 | }
73 |
74 | public void setId(int id) {
75 | this.id = id;
76 | }
77 |
78 | public String getImg() {
79 | return img;
80 | }
81 |
82 | public void setImg(String img) {
83 | this.img = img;
84 | }
85 |
86 | public int getRcount() {
87 | return rcount;
88 | }
89 |
90 | public void setRcount(int rcount) {
91 | this.rcount = rcount;
92 | }
93 |
94 | public int getSize() {
95 | return size;
96 | }
97 |
98 | public void setSize(int size) {
99 | this.size = size;
100 | }
101 |
102 | public boolean isStatus() {
103 | return status;
104 | }
105 |
106 | public void setStatus(boolean status) {
107 | this.status = status;
108 | }
109 |
110 | public long getTime() {
111 | return time;
112 | }
113 |
114 | public void setTime(long time) {
115 | this.time = time;
116 | }
117 |
118 | public String getTitle() {
119 | return title;
120 | }
121 |
122 | public void setTitle(String title) {
123 | this.title = title;
124 | }
125 |
126 | public String getUrl() {
127 | return url;
128 | }
129 |
130 | public void setUrl(String url) {
131 | this.url = url;
132 | }
133 |
134 | public List getList() {
135 | return list;
136 | }
137 |
138 | public void setList(List list) {
139 | this.list = list;
140 | }
141 |
142 | public static class ListBean {
143 | private int gallery;
144 | private int id;
145 | private String src;
146 |
147 | public int getGallery() {
148 | return gallery;
149 | }
150 |
151 | public void setGallery(int gallery) {
152 | this.gallery = gallery;
153 | }
154 |
155 | public int getId() {
156 | return id;
157 | }
158 |
159 | public void setId(int id) {
160 | this.id = id;
161 | }
162 |
163 | public String getSrc() {
164 | return src;
165 | }
166 |
167 | public void setSrc(String src) {
168 | this.src = src;
169 | }
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
28 |
29 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
47 |
48 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
63 |
66 |
70 |
74 |
78 |
83 |
84 |
87 |
88 |
91 |
92 |
93 |
94 |
97 |
98 |
101 |
102 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.MenuItem;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import com.umeng.analytics.MobclickAgent;
13 | import com.wuxiaolong.wewin.retrofit.ApiStores;
14 | import com.wuxiaolong.wewin.retrofit.AppClient;
15 | import com.xiaomolongstudio.wewin.R;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | import retrofit2.Call;
21 |
22 |
23 | public class BaseActivity extends AppCompatActivity {
24 |
25 | private List calls;
26 | public ApiStores apiStores = AppClient.retrofit().create(ApiStores.class);
27 | public Activity mActivity;
28 |
29 | @Override
30 | protected void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_base);
33 | mActivity = this;
34 | }
35 |
36 | public Toolbar initToolbarAsHome(CharSequence title) {
37 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
38 | TextView mTitleView = (TextView) toolbar.findViewById(R.id.toolbar_title);
39 | mTitleView.setText(title);
40 | setSupportActionBar(toolbar);
41 | android.support.v7.app.ActionBar actionBar = getSupportActionBar();
42 | if (actionBar != null) {
43 | actionBar.setDisplayHomeAsUpEnabled(false);
44 | actionBar.setDisplayShowTitleEnabled(false);
45 |
46 | }
47 | return toolbar;
48 | }
49 |
50 | public Toolbar initToolbar(CharSequence title) {
51 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
52 | // toolbar.setTitle(title);
53 | TextView mTitleView = (TextView) toolbar.findViewById(R.id.toolbar_title);
54 | mTitleView.setText(title);
55 | // toolbar.setTitleTextColor(getResources().getColor(R.color.white));
56 | setSupportActionBar(toolbar);
57 | android.support.v7.app.ActionBar actionBar = getSupportActionBar();
58 | if (actionBar != null) {
59 | actionBar.setDisplayHomeAsUpEnabled(true);
60 | actionBar.setDisplayShowTitleEnabled(false);
61 | }
62 | return toolbar;
63 | }
64 |
65 | public Toolbar initToolbar(int title) {
66 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
67 | toolbar.setTitle(title);
68 | toolbar.setTitleTextColor(getResources().getColor(R.color.white));
69 | setSupportActionBar(toolbar);
70 | android.support.v7.app.ActionBar actionBar = getSupportActionBar();
71 | if (actionBar != null) {
72 | actionBar.setDisplayHomeAsUpEnabled(true);
73 | }
74 | return toolbar;
75 | }
76 |
77 | public void addCalls(Call call) {
78 | if (calls == null) {
79 | calls = new ArrayList<>();
80 | }
81 | calls.add(call);
82 | }
83 |
84 | private void callCancel() {
85 | if (calls != null && calls.size() > 0) {
86 | for (Call call : calls) {
87 | if (!call.isCanceled())
88 | call.cancel();
89 | }
90 | calls.clear();
91 | }
92 | }
93 |
94 | @Override
95 | protected void onDestroy() {
96 | callCancel();
97 | super.onDestroy();
98 | }
99 |
100 | public void onResume() {
101 | super.onResume();
102 | //统计页面(仅有Activity的应用中SDK自动调用,不需要单独写。"SplashScreen"为页面名称,可自定义)
103 | MobclickAgent.onPageStart(this.getClass().getSimpleName());
104 | //统计时长
105 | MobclickAgent.onResume(this);
106 | }
107 |
108 | public void onPause() {
109 | super.onPause();
110 | // (仅有Activity的应用中SDK自动调用,不需要单独写)保证 onPageEnd 在onPause 之前调用,因为 onPause 中会保存信息。
111 | // "SplashScreen"为页面名称,可自定义
112 | MobclickAgent.onPageEnd(this.getClass().getSimpleName());
113 | MobclickAgent.onPause(this);
114 | }
115 |
116 | @Override
117 | public boolean onOptionsItemSelected(MenuItem item) {
118 |
119 | switch (item.getItemId()) {
120 | case android.R.id.home:
121 | super.onBackPressed();
122 | break;
123 | default:
124 | //对没有处理的事件,交给父类来处理
125 | return super.onOptionsItemSelected(item);
126 |
127 | }
128 |
129 | return true;
130 | }
131 |
132 | public void toastShow(int resId) {
133 | Toast.makeText(mActivity, resId, Toast.LENGTH_SHORT).show();
134 | }
135 |
136 | public void toastShow(String resId) {
137 | Toast.makeText(mActivity, resId, Toast.LENGTH_SHORT).show();
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/model/TngouGirlModel.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by WuXiaolong
8 | * on 2016/11/2.
9 | */
10 |
11 | public class TngouGirlModel implements Serializable {
12 |
13 | /**
14 | * status : true
15 | * total : 983
16 | * tngou : [{"count":189,"fcount":0,"galleryclass":3,"id":997,"img":"/ext/161031/8e4063576efa51e1f92f444b0a322ac5.jpg","rcount":0,"size":10,"time":1477919562000,"title":"beautyleg红艳国韵旗袍美女性感高清美腿"},{"count":236,"fcount":0,"galleryclass":1,"id":996,"img":"/ext/161031/02b5547ab0f10831a4cec27995b3d793.jpg","rcount":0,"size":9,"time":1477919443000,"title":"都市极品巨乳女神李妍静私房妩媚动人性感"},{"count":520,"fcount":0,"galleryclass":3,"id":995,"img":"/ext/161027/c3f11f510ab9bc302739140cef619be6.jpg","rcount":0,"size":11,"time":1477575845000,"title":"OL白领美女秘书大胆肉丝美腿高跟迷人养眼写真"},{"count":332,"fcount":0,"galleryclass":5,"id":994,"img":"/ext/161027/6d4d0d7a02be668b4830904ad2c094f3.jpg","rcount":0,"size":8,"time":1477575744000,"title":"极品女秘书孙允珠大长腿性感美女酒店写真"},{"count":693,"fcount":0,"galleryclass":1,"id":993,"img":"/ext/161027/5b2b08f2e757d3de84fb4c1fa8e92f23.jpg","rcount":0,"size":6,"time":1477575688000,"title":"极品大胸美女腿模连体泳装大白腿美胸爆乳性感"},{"count":347,"fcount":0,"galleryclass":3,"id":992,"img":"/ext/161027/aa48f5ac5ce6e454efbe16cbfae4f617.jpg","rcount":0,"size":10,"time":1477575544000,"title":"大胆空姐LO制服诱惑巨乳喷血诱人黑丝美腿性感"},{"count":362,"fcount":0,"galleryclass":6,"id":991,"img":"/ext/161025/b2af6fd0a88d8979f8e957794c1ae270.jpg","rcount":0,"size":8,"time":1477400647000,"title":"模特美女白嫩美腿性感私房照图片"},{"count":340,"fcount":0,"galleryclass":3,"id":990,"img":"/ext/161025/e1bf044ccef5ce3e4e0b7abe37e5d7a8.jpg","rcount":0,"size":9,"time":1477400547000,"title":"大长腿美女性感蕾丝裙黑丝高跟美腿"},{"count":306,"fcount":0,"galleryclass":4,"id":989,"img":"/ext/161025/43a23ffb1b589354bcf479d6c9e6d032.jpg","rcount":0,"size":9,"time":1477400299000,"title":"气质嫩模蕾丝透视朦胧撩人性感"},{"count":679,"fcount":0,"galleryclass":5,"id":988,"img":"/ext/161022/adc5c851b1adafe140303b6d06dd4c00.jpg","rcount":0,"size":13,"time":1477137202000,"title":"风韵美女少妇文静美乳丝袜翘臀妖娆"}]
17 | */
18 |
19 | private boolean status;
20 | private int total;
21 | /**
22 | * count : 189
23 | * fcount : 0
24 | * galleryclass : 3
25 | * id : 997
26 | * img : /ext/161031/8e4063576efa51e1f92f444b0a322ac5.jpg
27 | * rcount : 0
28 | * size : 10
29 | * time : 1477919562000
30 | * title : beautyleg红艳国韵旗袍美女性感高清美腿
31 | */
32 |
33 | private List tngou;
34 |
35 | public boolean isStatus() {
36 | return status;
37 | }
38 |
39 | public void setStatus(boolean status) {
40 | this.status = status;
41 | }
42 |
43 | public int getTotal() {
44 | return total;
45 | }
46 |
47 | public void setTotal(int total) {
48 | this.total = total;
49 | }
50 |
51 | public List getTngou() {
52 | return tngou;
53 | }
54 |
55 | public void setTngou(List tngou) {
56 | this.tngou = tngou;
57 | }
58 |
59 | public static class TngouEntity implements Serializable{
60 | private int count;
61 | private int fcount;
62 | private int galleryclass;
63 | private int id;
64 | private String img;
65 | private int rcount;
66 | private int size;
67 | private long time;
68 | private String title;
69 |
70 | public int getCount() {
71 | return count;
72 | }
73 |
74 | public void setCount(int count) {
75 | this.count = count;
76 | }
77 |
78 | public int getFcount() {
79 | return fcount;
80 | }
81 |
82 | public void setFcount(int fcount) {
83 | this.fcount = fcount;
84 | }
85 |
86 | public int getGalleryclass() {
87 | return galleryclass;
88 | }
89 |
90 | public void setGalleryclass(int galleryclass) {
91 | this.galleryclass = galleryclass;
92 | }
93 |
94 | public int getId() {
95 | return id;
96 | }
97 |
98 | public void setId(int id) {
99 | this.id = id;
100 | }
101 |
102 | public String getImg() {
103 | return img;
104 | }
105 |
106 | public void setImg(String img) {
107 | this.img = img;
108 | }
109 |
110 | public int getRcount() {
111 | return rcount;
112 | }
113 |
114 | public void setRcount(int rcount) {
115 | this.rcount = rcount;
116 | }
117 |
118 | public int getSize() {
119 | return size;
120 | }
121 |
122 | public void setSize(int size) {
123 | this.size = size;
124 | }
125 |
126 | public long getTime() {
127 | return time;
128 | }
129 |
130 | public void setTime(long time) {
131 | this.time = time;
132 | }
133 |
134 | public String getTitle() {
135 | return title;
136 | }
137 |
138 | public void setTitle(String title) {
139 | this.title = title;
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/juzimi/RecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.juzimi;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.graphics.Bitmap;
6 | import android.graphics.drawable.BitmapDrawable;
7 | import android.os.Build;
8 | import android.support.v4.app.ActivityCompat;
9 | import android.support.v4.app.ActivityOptionsCompat;
10 | import android.support.v4.view.ViewCompat;
11 | import android.support.v7.widget.RecyclerView;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.ImageView;
15 | import android.widget.TextView;
16 |
17 | import com.squareup.picasso.Picasso;
18 | import com.wuxiaolong.wewin.model.MainModel;
19 | import com.wuxiaolong.wewin.utils.AppConstants;
20 | import com.wuxiaolong.wewin.utils.AppUtils;
21 | import com.xiaomolongstudio.wewin.R;
22 |
23 | import java.io.Serializable;
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | import butterknife.BindView;
28 | import butterknife.ButterKnife;
29 |
30 | /**
31 | * Created by 吴小龙同學
32 | * on 2015/11/22.
33 | */
34 | public class RecyclerViewAdapter extends RecyclerView.Adapter {
35 | private List mMainList = new ArrayList<>();
36 | private Activity activity;
37 | private boolean hasTitle;
38 |
39 | public RecyclerViewAdapter(Activity activity, boolean hasTitle) {
40 | this.activity = activity;
41 | this.hasTitle = hasTitle;
42 | }
43 |
44 | public List getmMainList() {
45 | return mMainList;
46 | }
47 |
48 | @Override
49 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
50 | View view = View.inflate(parent.getContext(), R.layout.recycler_view_item, null);
51 | return new ViewHolder(view);
52 | }
53 |
54 | @Override
55 | public void onBindViewHolder(ViewHolder holder, int position) {
56 | Picasso.with(activity)
57 | .load(mMainList.get(position).getIamgeUrl())
58 | .placeholder(R.drawable.downloading)
59 | .error(R.drawable.downloading)
60 | .into(holder.imageView);
61 | if (hasTitle) {
62 | holder.title.setVisibility(View.VISIBLE);
63 | holder.title.setText(mMainList.get(position).getTitle());
64 | } else {
65 | holder.title.setVisibility(View.GONE);
66 | }
67 | holder.imageView.setTag(mMainList.get(position).getIamgeUrl());
68 | ViewCompat.setTransitionName(holder.imageView, mMainList.get(position).getIamgeUrl());
69 | }
70 |
71 | @Override
72 | public int getItemCount() {
73 | return mMainList.size();
74 | }
75 |
76 | public class ViewHolder extends RecyclerView.ViewHolder {
77 | @BindView(R.id.imgView)
78 | ImageView imageView;
79 | @BindView(R.id.title)
80 | TextView title;
81 |
82 | public ViewHolder(final View itemView) {
83 | super(itemView);
84 | ButterKnife.bind(this, itemView);
85 | itemView.setOnClickListener(
86 | new View.OnClickListener() {
87 | @Override
88 | public void onClick(View v) {
89 | Bitmap bitmap = null;
90 | BitmapDrawable bitmapDrawable = (BitmapDrawable) imageView.getDrawable();
91 | if (bitmapDrawable != null) {
92 | bitmap = bitmapDrawable.getBitmap();
93 | }
94 | Intent intent = new Intent(activity, ShowImageActivity.class);
95 | intent.putExtra("mainList", (Serializable) mMainList);
96 | intent.putExtra("position", getLayoutPosition());
97 | intent.putExtra(AppConstants.COLOR, AppUtils.getPaletteColor(bitmap));
98 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
99 | // Pair pair1 = Pair.create((View) imageView, mMainList.get(getLayoutPosition()).getIamgeUrl());
100 | // Pair pair2 = Pair.create((View) title, mMainList.get(getLayoutPosition()).getTitle());
101 | // Log.d("wxl", "title===" + mMainList.get(getLayoutPosition()).getTitle());
102 | // ActivityOptionsCompat options;
103 | // options = ActivityOptionsCompat
104 | // .makeSceneTransitionAnimation(activity, pair1, pair2);
105 | ActivityOptionsCompat options = ActivityOptionsCompat
106 | .makeSceneTransitionAnimation(activity, itemView, mMainList.get(getLayoutPosition()).getIamgeUrl());
107 | // ActivityOptionsCompat options = ActivityOptionsCompat
108 | // .makeSceneTransitionAnimation(activity, itemView, AppConstants.TRANSIT_PIC);
109 | ActivityCompat.startActivity(activity, intent, options.toBundle());
110 | } else {
111 | activity.startActivity(intent);
112 | }
113 |
114 | }
115 | }
116 |
117 | );
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v4.app.FragmentTransaction;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 | import android.view.animation.AnimationUtils;
10 | import android.widget.AdapterView;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.ImageView;
13 | import android.widget.ListView;
14 | import android.widget.TextView;
15 |
16 | import com.nineoldandroids.view.ViewHelper;
17 | import com.romainpiel.shimmer.Shimmer;
18 | import com.romainpiel.shimmer.ShimmerTextView;
19 | import com.wuxiaolong.wewin.draglayout.DragLayout;
20 | import com.wuxiaolong.wewin.draglayout.DragLayout.DragListener;
21 | import com.wuxiaolong.wewin.ui.juzimi.MainFragment;
22 | import com.wuxiaolong.wewin.ui.set.SetActivity;
23 | import com.wuxiaolong.wewin.utils.AppConstants;
24 | import com.wuxiaolong.wewin.utils.AppUtils;
25 | import com.xiaomolongstudio.wewin.R;
26 |
27 | import butterknife.BindView;
28 | import butterknife.ButterKnife;
29 |
30 | /**
31 | * 首页,侧滑菜单
32 | * 作者:吴小龙同學
33 | * github:https://github.com/WuXiaolong
34 | * 微信公众号:吴小龙同学
35 | */
36 | public class MainActivity extends BaseActivity {
37 |
38 |
39 | private String[] mPlanetTitles;
40 | @BindView(R.id.left_drawer)
41 | ListView mDrawerList;
42 | @BindView(R.id.dl)
43 | DragLayout mDragLayout;
44 | @BindView(R.id.main_title)
45 | ShimmerTextView main_title;
46 | @BindView(R.id.tv_set)
47 | TextView tv_set;
48 | @BindView(R.id.iv_icon)
49 | ImageView iv_icon;
50 |
51 |
52 | @Override
53 | protected void onCreate(Bundle savedInstanceState) {
54 | super.onCreate(savedInstanceState);
55 | setContentView(R.layout.activity_main);
56 | ButterKnife.bind(this);
57 | initDragLayout();
58 | initView();
59 | AppUtils.getWeekAndDay(this);//邀请评论
60 | }
61 |
62 |
63 | private void initDragLayout() {
64 | mDragLayout.setmDragListener(new DragListener() {
65 | public void onOpen() {
66 | // mDrawerList.smoothScrollToPosition(new Random().nextInt(30));
67 | }
68 |
69 | public void onClose() {
70 | shake();
71 | }
72 |
73 | public void onDrag(float percent) {
74 | ViewHelper.setAlpha(iv_icon, 1 - percent);
75 | }
76 | });
77 | }
78 |
79 | private void shake() {
80 | iv_icon.startAnimation(AnimationUtils.loadAnimation(this, R.anim.shake));
81 | }
82 |
83 | private void initView() {
84 | main_title.setReflectionColor(R.color.primary);
85 | Shimmer shimmer = new Shimmer();
86 | shimmer.start(main_title);
87 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
88 | setSupportActionBar(toolbar);
89 | toolbar.setNavigationIcon(null);
90 | android.support.v7.app.ActionBar actionBar = getSupportActionBar();
91 | if (actionBar != null) {
92 | actionBar.setDisplayHomeAsUpEnabled(false);
93 | actionBar.setDisplayShowTitleEnabled(false);
94 | }
95 | iv_icon = (ImageView) findViewById(R.id.iv_icon);
96 | mPlanetTitles = getResources().getStringArray(R.array.planets_array);
97 | mDrawerList.setAdapter(new ArrayAdapter(this,
98 | R.layout.drawer_list_item, mPlanetTitles));
99 | mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
100 |
101 | iv_icon.setOnClickListener(new View.OnClickListener() {
102 | public void onClick(View arg0) {
103 | mDragLayout.open();
104 | }
105 | });
106 | tv_set.setOnClickListener(new View.OnClickListener() {
107 | public void onClick(View arg0) {
108 | startActivity(new Intent(MainActivity.this, SetActivity.class));
109 | }
110 | });
111 | selectItem(0);
112 | }
113 |
114 | /* The click listner for ListView in the navigation drawer */
115 | private class DrawerItemClickListener implements
116 | ListView.OnItemClickListener {
117 | @Override
118 | public void onItemClick(AdapterView> parent, View view, int position,
119 | long id) {
120 | selectItem(position);
121 | }
122 | }
123 |
124 | /**
125 | * 切换Fragment
126 | */
127 |
128 | public void switchFragment(Fragment newFragment, int position) {
129 | FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
130 | Bundle args = new Bundle();
131 | args.putInt(AppConstants.POSITION, position);
132 | newFragment.setArguments(args);
133 | fragmentTransaction.replace(R.id.content_frame, newFragment).commit();
134 | }
135 |
136 |
137 | /**
138 | * 跳转页面
139 | *
140 | * @param position
141 | */
142 | private void selectItem(int position) {
143 | switchFragment(new MainFragment(), position);
144 |
145 | // update selected item and title, then close the drawer
146 | mDrawerList.setItemChecked(position, true);
147 | // setTitle(mPlanetTitles[position]);
148 | main_title.setText(mPlanetTitles[position]);
149 | // mDrawerLayout.closeDrawer(mDrawerList);
150 | mDragLayout.close();
151 | }
152 |
153 |
154 | }
155 |
--------------------------------------------------------------------------------
/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 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/juzimi/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.juzimi;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;
9 | import com.wuxiaolong.wewin.model.MainModel;
10 | import com.wuxiaolong.wewin.retrofit.RetrofitCallback;
11 | import com.wuxiaolong.wewin.ui.BaseFragment;
12 | import com.wuxiaolong.wewin.utils.AppConstants;
13 | import com.xiaomolongstudio.wewin.R;
14 |
15 | import org.jsoup.Jsoup;
16 | import org.jsoup.nodes.Document;
17 | import org.jsoup.nodes.Element;
18 | import org.jsoup.select.Elements;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | import butterknife.BindView;
24 | import okhttp3.ResponseBody;
25 | import retrofit2.Call;
26 |
27 | import static com.xiaomolongstudio.wewin.R.id.pullLoadMoreRecyclerView;
28 |
29 | /**
30 | * 美图美句
31 | */
32 | public class MainFragment extends BaseFragment {
33 | private RecyclerViewAdapter mRecyclerViewAdapter = null;
34 | private int mPage = 1;
35 | private int position = 0;
36 | private String url = "http://www.juzimi.com/meitumeiju?page=";
37 | private boolean hasTitle = true;
38 | @BindView(pullLoadMoreRecyclerView)
39 | PullLoadMoreRecyclerView mPullLoadMoreRecyclerView;
40 |
41 | public void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | if (getArguments() != null) {
44 | position = getArguments().getInt(AppConstants.POSITION);
45 | url = getArguments().getString("url");
46 | if (position == 0) {
47 | hasTitle = true;
48 | } else {
49 | hasTitle = false;
50 | }
51 | }
52 | }
53 |
54 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
55 | Bundle savedInstanceState) {
56 | return inflater.inflate(R.layout.main_fragment, container, false);
57 | }
58 |
59 | @Override
60 | public void onViewCreated(View view, Bundle savedInstanceState) {
61 | super.onViewCreated(view, savedInstanceState);
62 |
63 | mPullLoadMoreRecyclerView.setStaggeredGridLayout(2);//参数为列数
64 | mPullLoadMoreRecyclerView.setRefreshing(true);
65 | mRecyclerViewAdapter = new RecyclerViewAdapter(getActivity(), hasTitle);
66 | mPullLoadMoreRecyclerView.setAdapter(mRecyclerViewAdapter);
67 | mPullLoadMoreRecyclerView.setOnPullLoadMoreListener(new PullLoadMoreRecyclerView.PullLoadMoreListener() {
68 | @Override
69 | public void onRefresh() {
70 | mPage = 1;
71 | loadData();
72 | }
73 |
74 | @Override
75 | public void onLoadMore() {
76 | mPage = mPage + 1;
77 | loadData();
78 |
79 | }
80 | });
81 | loadData();
82 | }
83 |
84 |
85 | private void loadData() {
86 | Call call;
87 | if (position == 0) {
88 | call = apiStores.loadMainData(mPage);
89 | } else if (position == 1) {
90 | call = apiStores.loadMainData("shouxiemeiju", mPage);
91 | } else {
92 | call = apiStores.loadMainData("jingdianduibai", mPage);
93 | }
94 | call.enqueue(new RetrofitCallback() {
95 | @Override
96 | public void onSuccess(ResponseBody responseBody) {
97 | try {
98 | String doc = new String(responseBody.bytes(), "UTF-8");
99 | Document mDocument = Jsoup.parse(doc);
100 | List titleData = null;
101 | if (hasTitle) {
102 | titleData = new ArrayList<>();
103 | Elements es = mDocument.getElementsByClass("xlistju");
104 | for (Element e : es) {
105 | titleData.add(e.text());
106 | }
107 | }
108 | List hrefData = new ArrayList<>();
109 | Elements es1 = mDocument.getElementsByClass("chromeimg");
110 | for (Element e : es1) {
111 | hrefData.add(e.attr("src"));
112 | }
113 | List mainList = new ArrayList<>();
114 | for (int i = 0; i < hrefData.size(); i++) {
115 | MainModel mainModel = new MainModel();
116 | if (hasTitle) {
117 | mainModel.setTitle(titleData.get(i));
118 | }
119 | mainModel.setIamgeUrl(hrefData.get(i));
120 | mainList.add(mainModel);
121 | }
122 | if (mPage == 1) {
123 | mRecyclerViewAdapter.getmMainList().clear();
124 | }
125 | mRecyclerViewAdapter.getmMainList().addAll(mainList);
126 | mRecyclerViewAdapter.notifyDataSetChanged();
127 |
128 | } catch (Exception e) {
129 | e.printStackTrace();
130 | }
131 | }
132 |
133 | @Override
134 | public void onFailure(int code, String msg) {
135 | toastShow(msg);
136 | }
137 |
138 | @Override
139 | public void onThrowable(Throwable t) {
140 | toastShow(t.getMessage());
141 | }
142 |
143 | @Override
144 | public void onFinish() {
145 | mPullLoadMoreRecyclerView.setPullLoadMoreCompleted();
146 | }
147 | });
148 | addCalls(call);
149 | }
150 |
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/tngougirl/TngouGirlFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.tngougirl;
2 |
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.ActivityCompat;
8 | import android.support.v4.app.ActivityOptionsCompat;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ImageView;
14 | import android.widget.TextView;
15 |
16 | import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;
17 | import com.wuxiaolong.wewin.model.TngouGirlModel;
18 | import com.wuxiaolong.wewin.retrofit.RetrofitCallback;
19 | import com.wuxiaolong.wewin.ui.BaseFragment;
20 | import com.wuxiaolong.wewin.utils.AppConstants;
21 | import com.wuxiaolong.wewin.utils.ImageLoader;
22 | import com.xiaomolongstudio.wewin.R;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 | import java.util.Random;
27 |
28 | import butterknife.BindView;
29 | import butterknife.ButterKnife;
30 | import retrofit2.Call;
31 |
32 | public class TngouGirlFragment extends BaseFragment {
33 |
34 | private DataAdapter dataAdapter;
35 | @BindView(R.id.pullLoadMoreRecyclerView)
36 | PullLoadMoreRecyclerView pullLoadMoreRecyclerView;
37 | private int page = 1;
38 | private int rows = 20;
39 |
40 | @Override
41 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
42 | Bundle savedInstanceState) {
43 | // Inflate the layout for this fragment
44 | return inflater.inflate(R.layout.fragment_tngou_girl, container, false);
45 | }
46 |
47 | @Override
48 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
49 | super.onViewCreated(view, savedInstanceState);
50 | ButterKnife.bind(this, view);
51 | initView();
52 | page = new Random().nextInt(45);
53 | loadTngouGirl();
54 | }
55 |
56 | private void initView() {
57 | pullLoadMoreRecyclerView.setStaggeredGridLayout(2);//参数为列数
58 | pullLoadMoreRecyclerView.setRefreshing(true);
59 | dataAdapter = new DataAdapter();
60 | pullLoadMoreRecyclerView.setAdapter(dataAdapter);
61 | pullLoadMoreRecyclerView.setOnPullLoadMoreListener(new PullLoadMoreRecyclerView.PullLoadMoreListener() {
62 | @Override
63 | public void onRefresh() {
64 | page = 1;
65 | loadTngouGirl();
66 | }
67 |
68 | @Override
69 | public void onLoadMore() {
70 | page = new Random().nextInt(45);
71 | loadTngouGirl();
72 | }
73 | });
74 | }
75 |
76 | private void loadTngouGirl() {
77 | Call call = apiStores.loadTngouGirl(page + 1, rows);
78 | call.enqueue(new RetrofitCallback() {
79 | @Override
80 | public void onSuccess(TngouGirlModel model) {
81 | if (model.isStatus()) {
82 | if (page == 1) {
83 | dataAdapter.clear();
84 | }
85 | dataAdapter.addAll(model.getTngou());
86 | }
87 |
88 | }
89 |
90 | @Override
91 | public void onFailure(int code, String msg) {
92 | toastShow(msg);
93 | }
94 |
95 | @Override
96 | public void onThrowable(Throwable t) {
97 | toastShow(t.getMessage());
98 | }
99 |
100 | @Override
101 | public void onFinish() {
102 | pullLoadMoreRecyclerView.setPullLoadMoreCompleted();
103 | }
104 | });
105 | addCalls(call);
106 | }
107 |
108 | public class DataAdapter extends RecyclerView.Adapter {
109 |
110 | private List dataList = new ArrayList<>();
111 |
112 |
113 | public void addAll(List dataList) {
114 | this.dataList.addAll(dataList);
115 | notifyDataSetChanged();
116 | }
117 |
118 | public void clear() {
119 | this.dataList.clear();
120 | }
121 |
122 | @Override
123 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
124 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.tngou_girl_item, parent, false);
125 | return new ViewHolder(v);
126 | }
127 |
128 | @Override
129 | public void onBindViewHolder(ViewHolder holder, int position) {
130 | TngouGirlModel.TngouEntity tngouEntity = dataList.get(position);
131 | holder.title.setText(tngouEntity.getTitle());
132 | ImageLoader.load(mActivity, AppConstants.API_SERVER_IMAGE_URL + tngouEntity.getImg(), holder.imageView);
133 | }
134 |
135 | @Override
136 | public int getItemCount() {
137 | return dataList.size();
138 | }
139 |
140 | public class ViewHolder extends RecyclerView.ViewHolder {
141 | @BindView(R.id.imgView)
142 | ImageView imageView;
143 | @BindView(R.id.title)
144 | TextView title;
145 |
146 | public ViewHolder(final View itemView) {
147 | super(itemView);
148 | ButterKnife.bind(this, itemView);
149 | itemView.setOnClickListener(new View.OnClickListener() {
150 | @Override
151 | public void onClick(View v) {
152 | TngouGirlModel.TngouEntity tngouEntity = dataList.get(getLayoutPosition());
153 | Intent intent = new Intent(mActivity, TngouGirlDetailActivity.class);
154 | intent.putExtra(AppConstants.ID, tngouEntity.getId());
155 | ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mActivity, itemView, tngouEntity.getImg());
156 | ActivityCompat.startActivity(mActivity, intent, options.toBundle());
157 | }
158 | });
159 | }
160 | }
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/tngounews/TngouNewsFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.tngounews;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;
14 | import com.wuxiaolong.wewin.model.TngouNewsModel;
15 | import com.wuxiaolong.wewin.retrofit.RetrofitCallback;
16 | import com.wuxiaolong.wewin.ui.BaseFragment;
17 | import com.wuxiaolong.wewin.utils.AppConstants;
18 | import com.wuxiaolong.wewin.utils.ImageLoader;
19 | import com.xiaomolongstudio.wewin.R;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | import butterknife.BindView;
25 | import butterknife.ButterKnife;
26 | import retrofit2.Call;
27 |
28 | public class TngouNewsFragment extends BaseFragment {
29 | DataAdapter dataAdapter;
30 | @BindView(R.id.pullLoadMoreRecyclerView)
31 | PullLoadMoreRecyclerView pullLoadMoreRecyclerView;
32 | private int page = 1;
33 | int rows = 20;
34 |
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
37 | Bundle savedInstanceState) {
38 | // Inflate the layout for this fragment
39 | return inflater.inflate(R.layout.fragment_tngou_news, container, false);
40 | }
41 |
42 | @Override
43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
44 | super.onViewCreated(view, savedInstanceState);
45 | ButterKnife.bind(this, view);
46 | initView();
47 | loadData();
48 | }
49 |
50 | private void initView() {
51 | pullLoadMoreRecyclerView.setLinearLayout();
52 | pullLoadMoreRecyclerView.setRefreshing(true);
53 | dataAdapter = new DataAdapter();
54 | pullLoadMoreRecyclerView.setAdapter(dataAdapter);
55 | pullLoadMoreRecyclerView.setOnPullLoadMoreListener(new PullLoadMoreRecyclerView.PullLoadMoreListener() {
56 | @Override
57 | public void onRefresh() {
58 | page = 1;
59 | loadData();
60 | }
61 |
62 | @Override
63 | public void onLoadMore() {
64 | page++;
65 | loadData();
66 | }
67 | });
68 | }
69 |
70 | private void loadData() {
71 | Call call = apiStores.loadTngouNews(page, rows);
72 | call.enqueue(new RetrofitCallback() {
73 | @Override
74 | public void onSuccess(TngouNewsModel model) {
75 | if (model.isStatus()) {
76 | if (page == 1) {
77 | dataAdapter.clear();
78 | }
79 | dataAdapter.addAll(model.getTngou());
80 | if (model.getTngou().size() < rows) {
81 | pullLoadMoreRecyclerView.setHasMore(false);
82 | } else {
83 | pullLoadMoreRecyclerView.setHasMore(true);
84 | }
85 | }
86 |
87 | }
88 |
89 | @Override
90 | public void onFailure(int code, String msg) {
91 | toastShow(msg);
92 | }
93 |
94 | @Override
95 | public void onThrowable(Throwable t) {
96 | toastShow(t.getMessage());
97 | }
98 |
99 | @Override
100 | public void onFinish() {
101 | pullLoadMoreRecyclerView.setPullLoadMoreCompleted();
102 | }
103 | });
104 | addCalls(call);
105 | }
106 |
107 | public class DataAdapter extends RecyclerView.Adapter {
108 |
109 |
110 | private List dataList = new ArrayList<>();
111 |
112 |
113 | public void addAll(List dataList) {
114 | this.dataList.addAll(dataList);
115 | notifyDataSetChanged();
116 | }
117 |
118 | public void clear() {
119 | this.dataList.clear();
120 | }
121 |
122 | @Override
123 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
124 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.tngou_new_item, parent, false);
125 | return new ViewHolder(v);
126 | }
127 |
128 | @Override
129 | public void onBindViewHolder(ViewHolder holder, int position) {
130 | TngouNewsModel.TngouBean tngouEntity = dataList.get(position);
131 | holder.title.setText(tngouEntity.getTitle());
132 | holder.fromname.setText(tngouEntity.getFromname());
133 | holder.description.setText(tngouEntity.getDescription());
134 | ImageLoader.load(mActivity, AppConstants.API_SERVER_IMAGE_URL + tngouEntity.getImg(), holder.imageView);
135 | }
136 |
137 | @Override
138 | public int getItemCount() {
139 | return dataList.size();
140 | }
141 |
142 | public class ViewHolder extends RecyclerView.ViewHolder {
143 | @BindView(R.id.imageView)
144 | ImageView imageView;
145 | @BindView(R.id.title)
146 | TextView title;
147 | @BindView(R.id.fromname)
148 | TextView fromname;
149 | @BindView(R.id.description)
150 | TextView description;
151 |
152 | public ViewHolder(final View itemView) {
153 | super(itemView);
154 | ButterKnife.bind(this, itemView);
155 | itemView.setOnClickListener(new View.OnClickListener() {
156 | @Override
157 | public void onClick(View v) {
158 | TngouNewsModel.TngouBean tngouEntity = dataList.get(getLayoutPosition());
159 | Intent intent = new Intent(mActivity, TngouNewsDetailActivity.class);
160 | intent.putExtra(AppConstants.ID, tngouEntity.getId());
161 | mActivity.startActivity(intent);
162 | }
163 | });
164 | }
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/works_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
14 |
15 |
19 |
20 |
24 |
25 |
32 |
33 |
40 |
41 |
47 |
48 |
54 |
55 |
62 |
63 |
64 |
71 |
72 |
81 |
82 |
83 |
84 |
88 |
89 |
96 |
97 |
104 |
105 |
111 |
112 |
118 |
119 |
126 |
127 |
128 |
135 |
136 |
145 |
146 |
147 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/app/src/main/java/com/wuxiaolong/wewin/ui/myblog/MyBlogFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuxiaolong.wewin.ui.myblog;
2 |
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.text.Html;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.TextView;
13 |
14 | import com.wuxiaolong.androidutils.library.LogUtil;
15 | import com.wuxiaolong.pullloadmorerecyclerview.PullLoadMoreRecyclerView;
16 | import com.wuxiaolong.wewin.retrofit.RetrofitCallback;
17 | import com.wuxiaolong.wewin.ui.BaseFragment;
18 | import com.wuxiaolong.wewin.ui.WebViewActivity;
19 | import com.wuxiaolong.wewin.utils.AppConstants;
20 | import com.xiaomolongstudio.wewin.R;
21 |
22 | import org.jsoup.Jsoup;
23 | import org.jsoup.nodes.Document;
24 | import org.jsoup.nodes.Element;
25 | import org.jsoup.select.Elements;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | import butterknife.BindView;
31 | import butterknife.ButterKnife;
32 | import okhttp3.ResponseBody;
33 | import retrofit2.Call;
34 |
35 | public class MyBlogFragment extends BaseFragment {
36 |
37 | private DataAdapter dataAdapter;
38 | @BindView(R.id.pullLoadMoreRecyclerView)
39 | PullLoadMoreRecyclerView pullLoadMoreRecyclerView;
40 | private int page = 1;
41 |
42 | @Override
43 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
44 | Bundle savedInstanceState) {
45 | // Inflate the layout for this fragment
46 | View view = inflater.inflate(R.layout.fragment_my_blog, container, false);
47 |
48 | ButterKnife.bind(this, view);
49 | return view;
50 | }
51 |
52 | @Override
53 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
54 | super.onViewCreated(view, savedInstanceState);
55 | ButterKnife.bind(this, view);
56 | initView();
57 | loadMyBlog();
58 | }
59 |
60 | private void initView() {
61 | pullLoadMoreRecyclerView.setRefreshing(true);
62 | pullLoadMoreRecyclerView.setLinearLayout();
63 | dataAdapter = new DataAdapter();
64 | pullLoadMoreRecyclerView.setAdapter(dataAdapter);
65 | pullLoadMoreRecyclerView.setOnPullLoadMoreListener(new PullLoadMoreRecyclerView.PullLoadMoreListener() {
66 | @Override
67 | public void onRefresh() {
68 | page = 1;
69 | loadMyBlog();
70 | }
71 |
72 | @Override
73 | public void onLoadMore() {
74 | page++;
75 | loadMyBlog();
76 | }
77 | });
78 |
79 |
80 | }
81 |
82 | private void loadMyBlog() {
83 | Call call;
84 | if (page == 1) {
85 | call = apiStores.loadMyBlog();
86 | } else {
87 | call = apiStores.loadMyBlog(page);
88 | }
89 | call.enqueue(new RetrofitCallback() {
90 | @Override
91 | public void onSuccess(ResponseBody responseBody) {
92 | try {
93 | Document document = Jsoup.parse(new String(responseBody.bytes(), "UTF-8"));
94 | List titleElementList = new ArrayList<>();
95 | Elements titleElements = document.getElementsByClass("post-title-link");
96 | for (Element element : titleElements) {
97 | titleElementList.add(element);
98 | //LogUtil.d("text=" + element.text());
99 | //LogUtil.d("href=" + element.attr("href"));
100 | }
101 | List timeElementList = new ArrayList<>();
102 | Elements timeElements = document.getElementsByClass("post-time");
103 | for (Element element : timeElements) {
104 | //LogUtil.d("time=" + element.getElementsByTag("time").text());
105 | timeElementList.add(element);
106 | }
107 | //Elements categoryElements = document.getElementsByClass("post-category");
108 | //for (Element element : categoryElements) {
109 | // LogUtil.d("category=" + element.getElementsByTag("a").text());
110 | //}
111 | List bodyElementList = new ArrayList<>();
112 | Elements bodyElements = document.getElementsByClass("post-body");
113 | for (Element element : bodyElements) {
114 | LogUtil.d("body=" + element.html());
115 | bodyElementList.add(element);
116 | }
117 | if (page == 1) {
118 | dataAdapter.clear();
119 | }
120 | dataAdapter.addAll(titleElementList, timeElementList, bodyElementList);
121 | if (titleElementList.size() < 8) {
122 | //因为我的博客一页8条数据,当小于8时,说明没有下一页了
123 | pullLoadMoreRecyclerView.setHasMore(false);
124 | } else {
125 | pullLoadMoreRecyclerView.setHasMore(true);
126 | }
127 |
128 | } catch (Exception e) {
129 | e.printStackTrace();
130 | }
131 |
132 | }
133 |
134 | @Override
135 | public void onFailure(int code, String msg) {
136 | toastShow(msg);
137 | }
138 |
139 | @Override
140 | public void onThrowable(Throwable t) {
141 | toastShow(t.getMessage());
142 | }
143 |
144 | @Override
145 | public void onFinish() {
146 | pullLoadMoreRecyclerView.setPullLoadMoreCompleted();
147 | }
148 | });
149 | addCalls(call);
150 | }
151 |
152 |
153 | public class DataAdapter extends RecyclerView.Adapter {
154 |
155 | private List titleElementList = new ArrayList<>();
156 | private List timeElementList = new ArrayList<>();
157 | private List bodyElementList = new ArrayList<>();
158 |
159 |
160 | public void addAll(List titleElementList, List timeElementList, List bodyElementList) {
161 | this.titleElementList.addAll(titleElementList);
162 | this.timeElementList.addAll(timeElementList);
163 | this.bodyElementList.addAll(bodyElementList);
164 | notifyDataSetChanged();
165 | }
166 |
167 | public void clear() {
168 | this.titleElementList.clear();
169 | this.timeElementList.clear();
170 | this.bodyElementList.clear();
171 | }
172 |
173 | @Override
174 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
175 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.my_blog_item, parent, false);
176 | return new ViewHolder(v);
177 | }
178 |
179 | @Override
180 | public void onBindViewHolder(ViewHolder holder, int position) {
181 | Element titleElement = titleElementList.get(position);
182 | holder.title.setText(titleElement.text());
183 | Element timeElement = timeElementList.get(position);
184 | holder.time.setText(timeElement.getElementsByTag("time").text());
185 | Element bodyElement = bodyElementList.get(position);
186 | holder.body.setText(Html.fromHtml(bodyElement.html()));
187 | }
188 |
189 | @Override
190 | public int getItemCount() {
191 | return titleElementList.size();
192 | }
193 |
194 | public class ViewHolder extends RecyclerView.ViewHolder {
195 | @BindView(R.id.title)
196 | TextView title;
197 | @BindView(R.id.time)
198 | TextView time;
199 | @BindView(R.id.body)
200 | TextView body;
201 |
202 | public ViewHolder(View itemView) {
203 | super(itemView);
204 | ButterKnife.bind(this, itemView);
205 | itemView.setOnClickListener(new View.OnClickListener() {
206 | @Override
207 | public void onClick(View v) {
208 | Element titleElement = titleElementList.get(getLayoutPosition());
209 | startActivity(new Intent(mActivity, WebViewActivity.class)
210 | .putExtra(AppConstants.WEBVIEW_TITLE, titleElement.text())
211 | .putExtra(AppConstants.WEBVIEW_URL, AppConstants.MY_Blog_URL + titleElement.attr("href")));
212 | LogUtil.d("uuu=" + AppConstants.MY_Blog_URL + titleElement.attr("href"));
213 | }
214 | });
215 | }
216 | }
217 | }
218 | }
219 |
--------------------------------------------------------------------------------