Skip to content

Commit

Permalink
added cover-focus-point flags; updated .so url; updated to v0.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
PureDark committed Mar 17, 2018
1 parent 0f35844 commit 0438ce8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/ml/puredark/hviewer/beans/Site.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/ml/puredark/hviewer/configs/UrlConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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/<ABIS>/libijkffmpeg.so";
public final static String libijkplayerUrl = "https://raw.githubusercontent.com/CarGuo/GSYVideoPlayer/master/gsyVideoPlayer/libs/<ABIS>/libijkplayer.so";
public final static String libijksdlUrl = "https://raw.githubusercontent.com/CarGuo/GSYVideoPlayer/master/gsyVideoPlayer/libs/<ABIS>/libijksdl.so";
public final static String libijkffmpegUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs/<ABIS>/libijkffmpeg.so";
public final static String libijkplayerUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs/<ABIS>/libijkplayer.so";
public final static String libijksdlUrl = "https://raw.githubusercontent.com/PureDark/GSYVideoPlayer/master/gsyVideoPlayer/libs/<ABIS>/libijksdl.so";

public static String getBingAPIUrl() {
// Random random = new Random();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_collection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

</RelativeLayout>

Expand Down

0 comments on commit 0438ce8

Please sign in to comment.