Skip to content

Commit 2bb3d37

Browse files
committed
adapt ui to pad
1 parent 2a0f533 commit 2bb3d37

File tree

6 files changed

+49
-36
lines changed

6 files changed

+49
-36
lines changed

app/src/main/java/com/brian/csdnblog/activity/BlogContentActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private void initPopupMenu() {
230230
menu.add(Menu.NONE, Menu.FIRST + 1, 1, "收藏");
231231
menu.add(Menu.NONE, Menu.FIRST + 2, 2, "博主列表");
232232

233-
if (mBlogInfo.blogerID.equalsIgnoreCase(BlogerManager.getsInstance().getCurrBloger().blogerID)) {
233+
if (BlogerManager.getsInstance().getCurrBloger().blogerID.equalsIgnoreCase(mBlogInfo.blogerID)) {
234234
mPopupMenu.getMenu().getItem(2).setVisible(false);
235235
}
236236

app/src/main/java/com/brian/csdnblog/parser/CSDNHtmlParser.java

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,43 @@ private List<BlogInfo> doGetBlogerItemList(int type, String str) {
145145
// 获取class="article_item"的所有元素
146146
Elements blogList = doc.getElementsByClass("article_item");//.get(0).children()
147147
if (blogList == null || blogList.size() <= 0) {
148-
return list;
149-
}
148+
blogList = doc.getElementsByClass("skin_list").get(0).children();
149+
if (blogList == null || blogList.size() <= 0) {
150+
return list;
151+
}
152+
for (Element blogItem : blogList) {
153+
BlogInfo item = new BlogInfo();
154+
item.title = blogItem.getElementsByClass("list_c_t").get(0).text(); // 得到标题
155+
item.summary = blogItem.getElementsByClass("list_c_c").get(0).text();
156+
item.extraMsg = blogItem.getElementsByClass("list_c_b_l").get(0).text();
157+
item.link = blogItem.getElementsByClass("list_c_t").get(0).select("a").attr("href");
158+
if (item.link.startsWith("/")) {
159+
item.link = URL_CSDN_BLOG_BASE + item.link;
160+
}
161+
item.blogId = Md5.getMD5ofStr(item.link);
162+
item.type = type;
163+
item.dateStamp = String.valueOf(System.currentTimeMillis());
150164

151-
for (Element blogItem : blogList) {
152-
BlogInfo item = new BlogInfo();
153-
item.title = blogItem.getElementsByClass("article_title").get(0).text(); // 得到标题
154-
item.summary = blogItem.getElementsByClass("article_description").get(0).text();
155-
item.extraMsg = blogItem.getElementsByClass("article_manage").get(0).text();
156-
item.link = blogItem.getElementsByClass("article_title").get(0).select("a").attr("href");
157-
item.blogId = Md5.getMD5ofStr(item.link);
158-
item.type = type;
159-
item.dateStamp = String.valueOf(System.currentTimeMillis());
165+
list.add(item);
166+
}
167+
} else {
168+
for (Element blogItem : blogList) {
169+
BlogInfo item = new BlogInfo();
170+
item.title = blogItem.getElementsByClass("article_title").get(0).text(); // 得到标题
171+
item.summary = blogItem.getElementsByClass("article_description").get(0).text();
172+
item.extraMsg = blogItem.getElementsByClass("article_manage").get(0).text();
173+
item.link = blogItem.getElementsByClass("article_title").get(0).select("a").attr("href");
174+
if (item.link.startsWith("/")) {
175+
item.link = URL_CSDN_BLOG_BASE + item.link;
176+
}
177+
item.blogId = Md5.getMD5ofStr(item.link);
178+
item.type = type;
179+
item.dateStamp = String.valueOf(System.currentTimeMillis());
160180

161-
list.add(item);
181+
list.add(item);
182+
}
162183
}
184+
163185
return list;
164186
}
165187

641 Bytes
Loading

app/src/main/res/drawable/ic_menu.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/src/main/res/layout/activity_main_tab.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
android:layout_height="24dp"
1717
android:layout_alignParentLeft="true"
1818
android:layout_centerVertical="true"
19-
android:layout_marginLeft="3dp"
19+
android:layout_marginLeft="10dp"
2020
/>
2121

2222
<!-- 中间标题 -->
2323
<android.support.design.widget.TabLayout
2424
xmlns:app="http://schemas.android.com/apk/res-auto"
2525
android:id="@+id/tabs"
26-
android:layout_width="200dp"
26+
android:layout_width="match_parent"
2727
android:layout_height="wrap_content"
28+
android:layout_toRightOf="@+id/left_menu"
29+
android:layout_toLeftOf="@+id/right_search"
30+
android:layout_marginLeft="20dp"
31+
android:layout_marginRight="20dp"
2832
android:layout_alignParentTop="true"
2933
android:layout_centerHorizontal="true"
3034
app:tabTextAppearance="@style/TabLayoutTextAppearance"
@@ -40,7 +44,7 @@
4044
android:layout_centerVertical="true"
4145
android:src="@drawable/ic_search"
4246
android:background="?android:attr/selectableItemBackground"
43-
android:layout_marginRight="5dp" />
47+
android:layout_marginRight="10dp" />
4448
</RelativeLayout>
4549

4650
<android.support.v4.view.ViewPager

app/src/main/res/layout/layout_common_title_bar.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
android:layout_height="24dp"
2323
android:layout_alignParentLeft="true"
2424
android:layout_centerVertical="true"
25-
android:layout_marginLeft="3dp"
25+
android:layout_marginLeft="7dp"
2626
android:src="@drawable/ic_back"
2727
android:background="?android:attr/selectableItemBackground"
2828
android:ellipsize="end"
@@ -33,9 +33,13 @@
3333
<!-- 中间标题 -->
3434
<TextView
3535
android:id="@+id/title_text"
36-
android:layout_width="240dp"
36+
android:layout_width="match_parent"
3737
android:layout_height="wrap_content"
3838
android:layout_centerInParent="true"
39+
android:layout_toRightOf="@+id/left_text"
40+
android:layout_toLeftOf="@+id/right_text"
41+
android:layout_marginLeft="30dp"
42+
android:layout_marginRight="30dp"
3943
android:gravity="center"
4044
android:ellipsize="marquee"
4145
android:marqueeRepeatLimit="marquee_forever"
@@ -54,7 +58,7 @@
5458
android:layout_height="24dp"
5559
android:layout_alignParentRight="true"
5660
android:layout_centerVertical="true"
57-
android:layout_marginRight="5dp"
61+
android:layout_marginRight="10dp"
5862
android:src="@drawable/ic_share"
5963
android:background="?android:attr/selectableItemBackground"
6064
android:ellipsize="end"

0 commit comments

Comments
 (0)