调整缩略图模式布局

This commit is contained in:
seven332 committed 2014-12-25 21:32:02 +08:00
1 parent f90bd465fb
commit af4398cecd
4 files changed
+38 -19

No files matched your search

+2 -2
View File
@@ -30,7 +30,7 @@
android:id="@+id/category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/thumb"
android:layout_alignBottom="@id/thumb"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/primary_text_light" />
@@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/holo_blue_light"
android:background="#ca80cbc4"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white" />
+8 -1
View File
@@ -76,7 +76,6 @@ public class GalleryInfo implements Parcelable {
"[(\\[]dutch[)\\]]",
};
public int gid;
public String token;
public String title;
@@ -85,6 +84,14 @@ public class GalleryInfo implements Parcelable {
public String thumb;
public String uploader;
public float rating;
/**
* Will not be recond
*/
public int thumbWidth;
/**
* Will not be recond
*/
public int thumbHeight;
/**
* language get from title
*/
@@ -134,7 +134,7 @@ public class ListParser {
p = Pattern.compile("<td class=\"itdc\">(?:<a.+?>)?<img.+?alt=\"(.+?)\".+?/>(?:</a>)?</td>" // category
+ "<td.+?>(.+?)</td>" // posted
+ "<td.+?><div.+?><div.+?>"
+ "<td.+?><div.+?><div.+?height:(\\d+)px; width:(\\d+)px\">"
+ "(?:<img.+?src=\"(.+?)\".+?alt=\"(.+?)\" style.+?/>"
+ "|init~([^<>\"~]+~[^<>\"~]+)~([^<>]+))" // thumb and title
+ "</div>"
@@ -150,26 +150,29 @@ public class ListParser {
gi.category = EhUtils.getCategory(m.group(1));
gi.posted = m.group(2);
if (m.group(3) == null) {
gi.thumbHeight = Integer.parseInt(m.group(3));
gi.thumbWidth = Integer.parseInt(m.group(4));
if (m.group(5) == null) {
gi.thumb = Utils.unescapeXml("http://"
+ m.group(5).replace('~', '/'));
gi.title = Utils.unescapeXml(m.group(6));
+ m.group(7).replace('~', '/'));
gi.title = Utils.unescapeXml(m.group(8));
} else {
gi.thumb = Utils.unescapeXml(m.group(3));
gi.title = Utils.unescapeXml(m.group(4));
gi.thumb = Utils.unescapeXml(m.group(5));
gi.title = Utils.unescapeXml(m.group(6));
}
Pattern pattern = Pattern
.compile("/(\\d+)/(\\w+)");
Matcher matcher = pattern.matcher(m.group(7));
Matcher matcher = pattern.matcher(m.group(9));
if (matcher.find()) {
gi.gid = Integer.parseInt(matcher.group(1));
gi.token = matcher.group(2);
} else
continue;
gi.rating = Float.parseFloat(getRate(m.group(9)));
gi.uploader = m.group(10);
gi.rating = Float.parseFloat(getRate(m.group(11)));
gi.uploader = m.group(12);
gi.generateSLang();
giList.add(gi);
@@ -738,13 +738,6 @@ public class GalleryListView extends FrameLayout implements RefreshLayout.OnFoot
mImageLoader.add(gi.thumb, String.valueOf(gi.gid),
new LoadImageView.SimpleImageGetListener(thumb).setFixScaleType(true));
}
// Set category
TextView category = holder.category;
String newText = Ui.getCategoryText(gi.category);
if (!newText.equals(category.getText())) {
category.setText(newText);
category.setBackgroundColor(Ui.getCategoryColor(gi.category));
}
// Set simple language
TextView simpleLanguage = holder.simpleLanguage;
if (gi.simpleLanguage == null) {
@@ -756,6 +749,13 @@ public class GalleryListView extends FrameLayout implements RefreshLayout.OnFoot
// For detail mode
if (holder.viewType == LIST_MODE_DETAIL) {
// Set category
TextView category = holder.category;
String newText = Ui.getCategoryText(gi.category);
if (!newText.equals(category.getText())) {
category.setText(newText);
category.setBackgroundColor(Ui.getCategoryColor(gi.category));
}
// Set manga title
TextView title = holder.title;
title.setText(gi.title);
@@ -768,6 +768,15 @@ public class GalleryListView extends FrameLayout implements RefreshLayout.OnFoot
// set posted
TextView posted = holder.posted;
posted.setText(gi.posted);
} else {
// Set category
TextView category = holder.category;
String newText = Ui.getCategoryText(gi.category);
if (!newText.equals(category.getText())) {
category.setText(newText);
category.setBackgroundColor(Ui.getCategoryColor(gi.category)
& 0x00ffffff | 0xca000000);
}
}
}