diff --git a/app/build.gradle b/app/build.gradle index f0234cc..369592a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,8 +37,8 @@ android { resValue "string", "app_name", "H-Viewer" minSdkVersion 17 targetSdkVersion 25 - versionCode 90 - versionName "0.12.2" + versionCode 91 + versionName "0.12.3" flavorDimensions "channel" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/ml/puredark/hviewer/beans/Site.java b/app/src/main/java/ml/puredark/hviewer/beans/Site.java index 2841aea..9a0b556 100644 --- a/app/src/main/java/ml/puredark/hviewer/beans/Site.java +++ b/app/src/main/java/ml/puredark/hviewer/beans/Site.java @@ -36,6 +36,9 @@ public class Site extends AbstractExpandableDataProvider.ChildData { public final static String FLAG_POST_GALLERY = "postGallery"; public final static String FLAG_POST_PICTURE = "postPicture"; public final static String FLAG_LOGIN_REQUIRED = "loginRequired"; + public final static String FLAG_COVER_LEFT = "coverLeft"; + public final static String FLAG_COVER_RIGHT = "coverRight"; + public final static String FLAG_COVER_CENTER = "coverCenter"; public int sid, gid; public String title = ""; diff --git a/app/src/main/java/ml/puredark/hviewer/configs/UrlConfig.java b/app/src/main/java/ml/puredark/hviewer/configs/UrlConfig.java index 713a1fd..08092b5 100644 --- a/app/src/main/java/ml/puredark/hviewer/configs/UrlConfig.java +++ b/app/src/main/java/ml/puredark/hviewer/configs/UrlConfig.java @@ -8,9 +8,9 @@ public class UrlConfig { public final static String updateUrl = "https://api.github.com/repos/PureDark/H-Viewer/releases/latest"; public final static String siteSourceUrl = "https://raw.githubusercontent.com/H-Viewer-Sites/Index/master/source.json"; public final static String bingApiUrl = "https://bing.ioliu.cn/v1/rand?type=json"; - public final static String libijkffmpegUrl = "https://raw.githubusercontent.com/CarGuo/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijkffmpeg.so"; - public final static String libijkplayerUrl = "https://raw.githubusercontent.com/CarGuo/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijkplayer.so"; - public final static String libijksdlUrl = "https://raw.githubusercontent.com/CarGuo/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijksdl.so"; + public final static String libijkffmpegUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijkffmpeg.so"; + public final static String libijkplayerUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijkplayer.so"; + public final static String libijksdlUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs//libijksdl.so"; public static String getBingAPIUrl() { // Random random = new Random(); diff --git a/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java b/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java index 9c84c26..26aa096 100644 --- a/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java +++ b/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java @@ -504,6 +504,7 @@ public void onResultGot(String html, String url, int page) { if (HViewerApplication.DEBUG) SimpleFileUtil.writeString("/sdcard/html.txt", html, "utf-8"); Rule applyRule = (currGalleryUrl != null && currGalleryUrl.equals(site.galleryUrl)) ? site.galleryRule : site.extraRule; + Logger.d("CollectionActivity", "applyRule:"+(applyRule.equals(site.galleryRule) ? "galleryRule" : "extraRule")); myCollection = new LocalCollection(RuleParser.getCollectionDetail(myCollection, html, applyRule, url), site); if (myCollection.videos != null && myCollection.videos.size() > 0) { @@ -528,10 +529,12 @@ public void onResultGot(String html, String url, int page) { if (myCollection.pictures != null && myCollection.pictures.size() > 0) { // 当前页获取到的第一个图片 final Picture picture = myCollection.pictures.get(0); + Logger.d("CollectionActivity", "picture.url:"+picture.url); // 如果有FLAG_SECOND_LEVEL_GALLERY的特殊处理 if (site.isFirstLoadSecondLevelGallery(myCollection.pictures)) { Logger.d("CollectionActivity", "site.hasFlag(Site.FLAG_SECOND_LEVEL_GALLERY)"); currGalleryUrl = picture.url; + parseUrl(currGalleryUrl); getCollectionDetail(currPage); // HViewerHttpClient.get(picture.url, site.getHeaders(), new HViewerHttpClient.OnResponseListener() { // @Override diff --git a/app/src/main/java/ml/puredark/hviewer/ui/adapters/CollectionAdapter.java b/app/src/main/java/ml/puredark/hviewer/ui/adapters/CollectionAdapter.java index f31d22d..df251eb 100644 --- a/app/src/main/java/ml/puredark/hviewer/ui/adapters/CollectionAdapter.java +++ b/app/src/main/java/ml/puredark/hviewer/ui/adapters/CollectionAdapter.java @@ -1,6 +1,7 @@ package ml.puredark.hviewer.ui.adapters; import android.content.Context; +import android.graphics.PointF; import android.graphics.drawable.Animatable; import android.graphics.drawable.BitmapDrawable; import android.support.annotation.Nullable; @@ -20,6 +21,7 @@ import com.balysv.materialripple.MaterialRippleLayout; import com.facebook.common.logging.FLog; import com.facebook.drawee.controller.BaseControllerListener; +import com.facebook.drawee.drawable.ScalingUtils; import com.facebook.drawee.view.SimpleDraweeView; import com.facebook.imagepipeline.image.ImageInfo; @@ -118,6 +120,9 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { holder.tvSubmittime.setText(collection.datetime); if (site != null) { checkSiteFlags(position, site, collection); + if ((collection.tags==null||collection.tags.size()<3) && holder.rvTags != null) { + holder.rvTags.setLayoutManager(new StaggeredGridLayoutManager(1, OrientationHelper.HORIZONTAL)); + } } else if (collection instanceof LocalCollection) { holder.layoutCover.setVisibility(View.VISIBLE); holder.tvTitle.setVisibility(View.VISIBLE); @@ -126,7 +131,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { checkSiteFlags(holder, ((LocalCollection) collection).site); checkSiteFlags(position, ((LocalCollection) collection).site, collection); } - int emptySpaceCount = (collection.tags==null)? 1 : 0; + int emptySpaceCount = (collection.tags==null||collection.tags.size()<3)? 1 : 0; emptySpaceCount += (TextUtils.isEmpty(collection.uploader))? 1 : 0; emptySpaceCount += (TextUtils.isEmpty(collection.category))? 1 : 0; Logger.d("CollectionAdapter", "emptySpaceCount : " + emptySpaceCount); @@ -283,6 +288,21 @@ private void checkSiteFlags(CollectionViewHolder holder, Site site) { new CollectionTagAdapter(new ListDataProvider<>(new ArrayList())) ); } + if (site.hasFlag(Site.FLAG_COVER_LEFT)) { + ((SimpleDraweeView)holder.ivCover) + .getHierarchy() + .setActualImageFocusPoint(new PointF(0f, 0.5f)); + } + if (site.hasFlag(Site.FLAG_COVER_RIGHT)) { + ((SimpleDraweeView)holder.ivCover) + .getHierarchy() + .setActualImageFocusPoint(new PointF(1f, 0.5f)); + } + if (site.hasFlag(Site.FLAG_COVER_CENTER)) { + ((SimpleDraweeView)holder.ivCover) + .getHierarchy() + .setActualImageFocusPoint(new PointF(0.5f, 0.5f)); + } } private void checkSiteFlags(CollectionWaterfallViewHolder holder, Site site) { diff --git a/app/src/main/res/layout/item_collection.xml b/app/src/main/res/layout/item_collection.xml index 0018d69..2448ce7 100644 --- a/app/src/main/res/layout/item_collection.xml +++ b/app/src/main/res/layout/item_collection.xml @@ -41,7 +41,7 @@ android:id="@+id/iv_cover" android:layout_width="match_parent" android:layout_height="match_parent" - fresco:actualImageScaleType="centerCrop"/> + fresco:actualImageScaleType="focusCrop"/>