Update
This commit is contained in:
1 parent
755354a8fe
commit
96f3b027e5
18 files changed
+631
-118
No files matched your search
@@ -87,8 +87,14 @@
|
||||
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="imagepipeline-0.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="svg-android-2.0.6" level="project" />
|
||||
<orderEntry type="library" exported="" name="fresco-0.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="bolts-android-1.1.4" level="project" />
|
||||
<orderEntry type="library" exported="" name="drawee-0.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="fbcore-0.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="recyclerview-v7-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
|
||||
</component>
|
||||
|
||||
@@ -28,5 +28,6 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:22.1.1'
|
||||
compile 'com.android.support:recyclerview-v7:22.1.1'
|
||||
compile 'com.github.japgolly.android:svg-android:2.0.6'
|
||||
compile 'com.facebook.fresco:fresco:0.4.0'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
@@ -17,6 +17,7 @@ package com.hippo.ehviewer;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.hippo.content.VectorContext;
|
||||
import com.hippo.scene.SceneApplication;
|
||||
import com.hippo.util.Log;
|
||||
@@ -26,6 +27,8 @@ public class EhApplication extends SceneApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Fresco.initialize(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,7 +37,9 @@ public class EhApplication extends SceneApplication {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory (int level) {
|
||||
public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
|
||||
if (level == TRIM_MEMORY_UI_HIDDEN) {
|
||||
Log.d("Application hiden");
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class EhClient {
|
||||
}
|
||||
|
||||
public abstract static class OnGetGalleryListListener implements EhClientListener {
|
||||
public abstract void onSuccess(List<GalleryInfo> glArray, int pageNum);
|
||||
public abstract void onSuccess(List<GalleryInfo> glList, int pageNum);
|
||||
}
|
||||
|
||||
private void doBgJob(BgJobHelper bjh) {
|
||||
|
||||
@@ -43,13 +43,11 @@ public class ListUrlBuilder {
|
||||
private int mPageIndex = 0;
|
||||
|
||||
private int mCategory = EhUtils.NONE;
|
||||
private String mSearchKey = null;
|
||||
private String mKeyword = null;
|
||||
|
||||
private int mAdvanceSearch = -1;
|
||||
private int mMinRating = -1;
|
||||
|
||||
private String mSearchTag = null;
|
||||
|
||||
public int getMode() {
|
||||
return mMode;
|
||||
}
|
||||
@@ -74,12 +72,12 @@ public class ListUrlBuilder {
|
||||
mCategory = category;
|
||||
}
|
||||
|
||||
public String getSearchKey() {
|
||||
return mSearchKey;
|
||||
public String getKeyword() {
|
||||
return mKeyword;
|
||||
}
|
||||
|
||||
public void setSearchKey(String searchKey) {
|
||||
mSearchKey = searchKey;
|
||||
public void setKeyword(String keyword) {
|
||||
mKeyword = keyword;
|
||||
}
|
||||
|
||||
public int getAdvanceSearch() {
|
||||
@@ -98,14 +96,6 @@ public class ListUrlBuilder {
|
||||
mMinRating = minRating;
|
||||
}
|
||||
|
||||
public String getSearchTag() {
|
||||
return mSearchTag;
|
||||
}
|
||||
|
||||
public void setSearchTag(String searchTag) {
|
||||
mSearchTag = searchTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make them the same
|
||||
* @param glub The template
|
||||
@@ -114,10 +104,9 @@ public class ListUrlBuilder {
|
||||
mMode = glub.mMode;
|
||||
mPageIndex = glub.mPageIndex;
|
||||
mCategory = glub.mCategory;
|
||||
mSearchKey = glub.mSearchKey;
|
||||
mKeyword = glub.mKeyword;
|
||||
mAdvanceSearch = glub.mAdvanceSearch;
|
||||
mMinRating = glub.mMinRating;
|
||||
mSearchTag = glub.mSearchTag;
|
||||
}
|
||||
|
||||
public String build(int source) throws UnsupportedSearch {
|
||||
@@ -141,9 +130,9 @@ public class ListUrlBuilder {
|
||||
filter = true;
|
||||
}
|
||||
// Search key
|
||||
if (mSearchKey != null) {
|
||||
if (mKeyword != null) {
|
||||
try {
|
||||
ub.addQuery("f_search", URLEncoder.encode(mSearchKey, "UTF-8"));
|
||||
ub.addQuery("f_search", URLEncoder.encode(mKeyword, "UTF-8"));
|
||||
filter = true;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Empty
|
||||
@@ -184,7 +173,7 @@ public class ListUrlBuilder {
|
||||
StringBuilder sb = new StringBuilder(EhClient.getUrlHeader(source));
|
||||
sb.append("tag/");
|
||||
try {
|
||||
sb.append(URLEncoder.encode(mSearchTag, "UTF-8"));
|
||||
sb.append(URLEncoder.encode(mKeyword, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
@@ -21,27 +21,33 @@ import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.hippo.animation.SimpleAnimatorListener;
|
||||
import com.hippo.drawable.AddDeleteDrawable;
|
||||
import com.hippo.effect.ViewTransition;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.ListParser;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.ui.ContentActivity;
|
||||
import com.hippo.ehviewer.util.EhUtils;
|
||||
import com.hippo.ehviewer.widget.ContentLayout;
|
||||
import com.hippo.ehviewer.widget.OffsetLayout;
|
||||
import com.hippo.ehviewer.widget.RatingView;
|
||||
import com.hippo.ehviewer.widget.SearchBar;
|
||||
import com.hippo.ehviewer.widget.SearchDatabase;
|
||||
import com.hippo.ehviewer.widget.SearchLayout;
|
||||
@@ -56,6 +62,7 @@ import com.hippo.widget.FloatingActionButton;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO Must refresh when change source
|
||||
// TODO disable click action when animating
|
||||
public class GalleryListScene extends Scene implements SearchBar.Helper,
|
||||
View.OnClickListener, FabLayout.OnCancelListener,
|
||||
@@ -134,7 +141,9 @@ public class GalleryListScene extends Scene implements SearchBar.Helper,
|
||||
ViewUtils.removeOnGlobalLayoutListener(mSearchBar.getViewTreeObserver(), this);
|
||||
mSearchBarOriginalTop = mSearchBar.getTop();
|
||||
mSearchBarOriginalBottom = mSearchBar.getBottom();
|
||||
mSearchLayout.setFitPaddingTop(mSearchBar.getHeight() + mResources.getDimensionPixelOffset(R.dimen.search_bar_padding_vertical));
|
||||
int fitPaddingTop = mSearchBar.getHeight() + mResources.getDimensionPixelOffset(R.dimen.search_bar_padding_vertical);
|
||||
mContentLayout.setFitPaddingTop(fitPaddingTop);
|
||||
mSearchLayout.setFitPaddingTop(fitPaddingTop);
|
||||
}
|
||||
});
|
||||
mSearchLayout.setHelper(this);
|
||||
@@ -142,7 +151,6 @@ public class GalleryListScene extends Scene implements SearchBar.Helper,
|
||||
// Content Layout
|
||||
mGalleryListHelper = new GalleryListHelper();
|
||||
mContentLayout.setHelper(mGalleryListHelper);
|
||||
mContentLayout.showContent();
|
||||
|
||||
// Fab Layout
|
||||
mFabLayout.setOnCancelListener(this);
|
||||
@@ -159,8 +167,10 @@ public class GalleryListScene extends Scene implements SearchBar.Helper,
|
||||
mSearchDrawable = mResources.getDrawable(R.drawable.ic_search_dark);
|
||||
mCornerFab.setDrawable(mAddDeleteDrawable);
|
||||
|
||||
// TEST
|
||||
mGalleryListHelper.refresh();
|
||||
// When scene start
|
||||
if (savedInstanceState == null) {
|
||||
mGalleryListHelper.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -488,42 +498,103 @@ public class GalleryListScene extends Scene implements SearchBar.Helper,
|
||||
|
||||
private class GalleryHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public SimpleDraweeView thumb;
|
||||
public TextView title;
|
||||
public TextView uploader;
|
||||
public RatingView rating;
|
||||
public TextView category;
|
||||
public TextView posted;
|
||||
public TextView simpleLanguage;
|
||||
|
||||
public GalleryHolder(View itemView) {
|
||||
super(itemView);
|
||||
thumb = (SimpleDraweeView) itemView.findViewById(R.id.thumb);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
uploader = (TextView) itemView.findViewById(R.id.uploader);
|
||||
rating = (RatingView) itemView.findViewById(R.id.rating);
|
||||
category = (TextView) itemView.findViewById(R.id.category);
|
||||
posted = (TextView) itemView.findViewById(R.id.posted);
|
||||
simpleLanguage = (TextView) itemView.findViewById(R.id.simple_language);
|
||||
}
|
||||
}
|
||||
|
||||
private class GalleryListHelper extends ContentLayout.ContentHelper<GalleryInfo, GalleryHolder> {
|
||||
|
||||
@Override
|
||||
protected StaggeredGridLayoutManager generateLayoutManager() {
|
||||
return new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public GalleryListHelper() {
|
||||
super();
|
||||
mInflater = mActivity.getLayoutInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getPageData(final int taskId, int page) {
|
||||
EhClient.getInstance().getGalleryList(EhClient.SOURCE_LOFI, "http://lofi.e-hentai.org/", new EhClient.OnGetGalleryListListener() {
|
||||
@Override
|
||||
public void onSuccess(List<GalleryInfo> glArray, int pageNum) {
|
||||
setPageSize(pageNum);
|
||||
onGetPageData(taskId, glArray);
|
||||
}
|
||||
protected RecyclerView.LayoutManager generateLayoutManager() {
|
||||
// TODO StaggeredGridLayoutManager item dislocation for setPaddingTop
|
||||
return new LinearLayoutManager(mActivity);
|
||||
//return new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
Log.d("onFailure", e);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
protected void getPageData(int taskId, int type, int page) {
|
||||
GalleryListListener listener = new GalleryListListener(taskId, type, page, EhClient.SOURCE_LOFI);
|
||||
EhClient.getInstance().getGalleryList(EhClient.SOURCE_LOFI, "http://lofi.e-hentai.org/", listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new GalleryHolder(new TextView(mActivity));
|
||||
View view = mInflater.inflate(R.layout.item_gallery_list_detail, parent, false);
|
||||
return new GalleryHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(GalleryHolder holder, int position) {
|
||||
((TextView) holder.itemView).setText(getDataAt(position).title);
|
||||
GalleryInfo gi = getDataAt(position);
|
||||
holder.thumb.setImageURI(Uri.parse(gi.thumb));
|
||||
holder.title.setText(gi.title);
|
||||
holder.uploader.setText(gi.uploader);
|
||||
holder.rating.setRating(gi.rating);
|
||||
TextView category = holder.category;
|
||||
String newCategoryText = EhUtils.getCategory(gi.category);
|
||||
if (!newCategoryText.equals(category.getText())) {
|
||||
category.setText(newCategoryText);
|
||||
category.setBackgroundColor(EhUtils.getCategoryColor(gi.category));
|
||||
}
|
||||
holder.posted.setText(gi.posted);
|
||||
holder.simpleLanguage.setText(gi.simpleLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
private class GalleryListListener extends EhClient.OnGetGalleryListListener {
|
||||
|
||||
private int mTaskId;
|
||||
private int mTaskType;
|
||||
private int mTargetPage;
|
||||
private int mSource;
|
||||
|
||||
public GalleryListListener(int taskId, int taskType, int targetPage, int source) {
|
||||
mTaskId = taskId;
|
||||
mTaskType = taskType;
|
||||
mTargetPage = targetPage;
|
||||
mSource = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GalleryInfo> glList, int pageNum) {
|
||||
if (mSource == EhClient.SOURCE_LOFI) {
|
||||
if (pageNum == ListParser.CURRENT_PAGE_IS_LAST) {
|
||||
mGalleryListHelper.setPageSize(mTargetPage);
|
||||
} else if (mTaskType == ContentLayout.ContentHelper.TYPE_REFRESH) {
|
||||
mGalleryListHelper.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
} else {
|
||||
mGalleryListHelper.setPageSize(pageNum);
|
||||
}
|
||||
mGalleryListHelper.onGetPageData(mTaskId, glList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
mGalleryListHelper.onGetPageData(mTaskId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
package com.hippo.ehviewer.util;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
public final class EhUtils {
|
||||
|
||||
public static final String EH_DOWNLOAD_FILENAME = ".ehviewer";
|
||||
@@ -32,6 +34,18 @@ public final class EhUtils {
|
||||
public static final int WESTERN = 0x200;
|
||||
public static final int UNKNOWN = 0x400;
|
||||
|
||||
public static final int BG_COLOR_DOUJINSHI = 0xfff44336;
|
||||
public static final int BG_COLOR_MANGA = 0xffff9800;
|
||||
public static final int BG_COLOR_ARTIST_CG = 0xfffbc02d;
|
||||
public static final int BG_COLOR_GAME_CG = 0xff4caf50;
|
||||
public static final int BG_COLOR_WESTERN = 0xff8bc34a;
|
||||
public static final int BG_COLOR_NON_H = 0xff2196f3;
|
||||
public static final int BG_COLOR_IMAGE_SET = 0xff3f51b5;
|
||||
public static final int BG_COLOR_COSPLAY = 0xff9c27b0;
|
||||
public static final int BG_COLOR_ASIAN_PORN = 0xff9575cd;
|
||||
public static final int BG_COLOR_MISC = 0xfff06292;
|
||||
public static final int BG_COLOR_UNKNOWN = Color.BLACK;
|
||||
|
||||
private static final int[] CATEGORY_VALUES = {
|
||||
MISC,
|
||||
DOUJINSHI,
|
||||
@@ -78,4 +92,31 @@ public final class EhUtils {
|
||||
}
|
||||
return CATEGORY_STRINGS[i][0];
|
||||
}
|
||||
|
||||
public static int getCategoryColor(int category) {
|
||||
switch (category) {
|
||||
case DOUJINSHI:
|
||||
return BG_COLOR_DOUJINSHI;
|
||||
case MANGA:
|
||||
return BG_COLOR_MANGA;
|
||||
case ARTIST_CG:
|
||||
return BG_COLOR_ARTIST_CG;
|
||||
case GAME_CG:
|
||||
return BG_COLOR_GAME_CG;
|
||||
case WESTERN:
|
||||
return BG_COLOR_WESTERN;
|
||||
case NON_H:
|
||||
return BG_COLOR_NON_H;
|
||||
case IMAGE_SET:
|
||||
return BG_COLOR_IMAGE_SET;
|
||||
case COSPLAY:
|
||||
return BG_COLOR_COSPLAY;
|
||||
case ASIAN_PORN:
|
||||
return BG_COLOR_ASIAN_PORN;
|
||||
case MISC:
|
||||
return BG_COLOR_MISC;
|
||||
default:
|
||||
return BG_COLOR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -28,7 +27,8 @@ import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.util.IntIdGenerator;
|
||||
import com.hippo.util.Log;
|
||||
import com.hippo.util.LayoutManagerUtils;
|
||||
import com.hippo.util.UiUtils;
|
||||
import com.hippo.util.ViewUtils;
|
||||
import com.hippo.widget.Snackbar;
|
||||
import com.hippo.widget.recyclerview.EasyRecyclerView;
|
||||
@@ -47,10 +47,8 @@ public class ContentLayout extends FrameLayout {
|
||||
private TextView mTextView;
|
||||
private Snackbar mSnackbar;
|
||||
|
||||
private StaggeredGridLayoutManager mLayoutManager;
|
||||
|
||||
private ContentHelper mHelper;
|
||||
|
||||
private int mRecyclerViewOriginTop;
|
||||
private int mRecyclerViewOriginBottom;
|
||||
private int mSnackbarOriginBottom;
|
||||
|
||||
public ContentLayout(Context context) {
|
||||
@@ -79,12 +77,16 @@ public class ContentLayout extends FrameLayout {
|
||||
mImageView = mItView.getChildAt(0);
|
||||
mTextView = (TextView) mItView.getChildAt(1);
|
||||
|
||||
//
|
||||
mRecyclerViewOriginTop = mRecyclerView.getPaddingTop();
|
||||
mRecyclerViewOriginBottom = mRecyclerView.getPaddingBottom();
|
||||
|
||||
// Snackbar
|
||||
mSnackbarOriginBottom = mSnackbar.getPaddingBottom();
|
||||
mSnackbar.setAction(context.getString(R.string.retry), new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
// TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -94,39 +96,29 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void setHelper(ContentHelper helper) {
|
||||
mHelper = helper;
|
||||
mLayoutManager = helper.generateLayoutManager();
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(helper);
|
||||
helper.init(mRefreshLayout, mRecyclerView, mLayoutManager);
|
||||
mRefreshLayout.setOnHeaderRefreshListener(helper);
|
||||
mRefreshLayout.setOnFooterRefreshListener(helper);
|
||||
mRecyclerView.addOnScrollListener(helper.getOnScrollListener());
|
||||
helper.init(this);
|
||||
}
|
||||
|
||||
public void setFitPaddingTop(int fitPaddingTop) {
|
||||
// RecyclerView
|
||||
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(),
|
||||
mRecyclerViewOriginTop + fitPaddingTop,
|
||||
mRecyclerView.getPaddingRight(),
|
||||
mRecyclerView.getPaddingBottom());
|
||||
// RefreshLayout
|
||||
mRefreshLayout.setProgressViewOffset(false, fitPaddingTop,
|
||||
fitPaddingTop + UiUtils.dp2pix(getContext(), 32)); // TODO
|
||||
}
|
||||
|
||||
public void setFitPaddingBottom(int fitPaddingBottom) {
|
||||
// RecyclerView
|
||||
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(),
|
||||
mRecyclerView.getPaddingTop(), mRecyclerView.getPaddingRight(),
|
||||
mRecyclerViewOriginBottom + fitPaddingBottom);
|
||||
// Snackbar
|
||||
mSnackbar.setPadding(mSnackbar.getPaddingLeft(), mSnackbar.getPaddingTop(), mSnackbar.getPaddingRight(), mSnackbarOriginBottom + fitPaddingBottom);
|
||||
}
|
||||
|
||||
public void showProgressBar() {
|
||||
ViewUtils.setVisibility(mProgressBar, View.VISIBLE);
|
||||
ViewUtils.setVisibility(mItView, View.GONE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.GONE);
|
||||
}
|
||||
|
||||
public void showText(CharSequence text) {
|
||||
ViewUtils.setVisibility(mProgressBar, View.GONE);
|
||||
ViewUtils.setVisibility(mItView, View.VISIBLE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.GONE);
|
||||
|
||||
mTextView.setText(text);
|
||||
}
|
||||
|
||||
public void showContent() {
|
||||
ViewUtils.setVisibility(mProgressBar, View.GONE);
|
||||
ViewUtils.setVisibility(mItView, View.GONE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.VISIBLE);
|
||||
mSnackbar.setPadding(mSnackbar.getPaddingLeft(),
|
||||
mSnackbar.getPaddingTop(), mSnackbar.getPaddingRight(),
|
||||
mSnackbarOriginBottom + fitPaddingBottom);
|
||||
}
|
||||
|
||||
public abstract static class ContentHelper<E, VH extends RecyclerView.ViewHolder>
|
||||
@@ -134,16 +126,21 @@ public class ContentLayout extends FrameLayout {
|
||||
implements RefreshLayout.OnHeaderRefreshListener,
|
||||
RefreshLayout.OnFooterRefreshListener {
|
||||
|
||||
private static final int TYPE_REFRESH = 0;
|
||||
private static final int TYPE_PRE_PAGE = 1;
|
||||
private static final int TYPE_PRE_PAGE_KEEP_POS = 2;
|
||||
private static final int TYPE_NEXT_PAGE = 3;
|
||||
private static final int TYPE_NEXT_PAGE_KEEP_POS = 4;
|
||||
private static final int TYPE_SOMEWHERE = 5;
|
||||
public static final int TYPE_REFRESH = 0;
|
||||
public static final int TYPE_PRE_PAGE = 1;
|
||||
public static final int TYPE_PRE_PAGE_KEEP_POS = 2;
|
||||
public static final int TYPE_NEXT_PAGE = 3;
|
||||
public static final int TYPE_NEXT_PAGE_KEEP_POS = 4;
|
||||
public static final int TYPE_SOMEWHERE = 5;
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private ViewGroup mItView;
|
||||
private RefreshLayout mRefreshLayout;
|
||||
private RecyclerView mRecyclerView;
|
||||
private StaggeredGridLayoutManager mLayoutManager;
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
private View mImageView;
|
||||
private TextView mTextView;
|
||||
private Snackbar mSnackbar;
|
||||
private RecyclerView.LayoutManager mLayoutManager;
|
||||
|
||||
private RecyclerView.OnScrollListener mOnScrollListener = new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
@@ -191,18 +188,48 @@ public class ContentLayout extends FrameLayout {
|
||||
mIdGenerator = IntIdGenerator.create();
|
||||
}
|
||||
|
||||
private void init(RefreshLayout refreshLayout, RecyclerView recyclerView,
|
||||
StaggeredGridLayoutManager layoutManager) {
|
||||
mRefreshLayout = refreshLayout;
|
||||
mRecyclerView = recyclerView;
|
||||
mLayoutManager = layoutManager;
|
||||
private void init(ContentLayout contentLayout) {
|
||||
mProgressBar = contentLayout.mProgressBar;
|
||||
mItView = contentLayout.mItView;
|
||||
mRefreshLayout = contentLayout.mRefreshLayout;
|
||||
mSnackbar = contentLayout.mSnackbar;
|
||||
mRecyclerView = contentLayout.mRecyclerView;
|
||||
mImageView = contentLayout.mImageView;
|
||||
mTextView = contentLayout.mTextView;
|
||||
mLayoutManager = generateLayoutManager();
|
||||
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(this);
|
||||
mRecyclerView.addOnScrollListener(mOnScrollListener);
|
||||
mRefreshLayout.setOnHeaderRefreshListener(this);
|
||||
mRefreshLayout.setOnFooterRefreshListener(this);
|
||||
}
|
||||
|
||||
private RecyclerView.OnScrollListener getOnScrollListener() {
|
||||
return mOnScrollListener;
|
||||
}
|
||||
|
||||
protected abstract StaggeredGridLayoutManager generateLayoutManager();
|
||||
protected abstract RecyclerView.LayoutManager generateLayoutManager();
|
||||
|
||||
public void showProgressBar() {
|
||||
ViewUtils.setVisibility(mProgressBar, View.VISIBLE);
|
||||
ViewUtils.setVisibility(mItView, View.GONE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.GONE);
|
||||
}
|
||||
|
||||
public void showText(CharSequence text) {
|
||||
ViewUtils.setVisibility(mProgressBar, View.GONE);
|
||||
ViewUtils.setVisibility(mItView, View.VISIBLE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.GONE);
|
||||
|
||||
mTextView.setText(text);
|
||||
}
|
||||
|
||||
public void showContent() {
|
||||
ViewUtils.setVisibility(mProgressBar, View.GONE);
|
||||
ViewUtils.setVisibility(mItView, View.GONE);
|
||||
ViewUtils.setVisibility(mRefreshLayout, View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws IndexOutOfBoundsException
|
||||
@@ -218,13 +245,22 @@ public class ContentLayout extends FrameLayout {
|
||||
* @param taskId task id
|
||||
* @param page the page to get
|
||||
*/
|
||||
protected abstract void getPageData(int taskId, int page);
|
||||
protected abstract void getPageData(int taskId, int type, int page);
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
mPageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return mPageSize;
|
||||
}
|
||||
|
||||
public void resetPageSize() {
|
||||
mPageSize = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public void onGetPageData(int taskId, List<E> data) {
|
||||
showContent();
|
||||
int pageVolume = data.size();
|
||||
mPageVolume = pageVolume;
|
||||
if (mCurrentTaskId == taskId) {
|
||||
@@ -241,7 +277,7 @@ public class ContentLayout extends FrameLayout {
|
||||
notifyDataSetChanged();
|
||||
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(0, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, 0, 0);
|
||||
break;
|
||||
case TYPE_PRE_PAGE:
|
||||
case TYPE_PRE_PAGE_KEEP_POS:
|
||||
@@ -259,7 +295,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mLastIndex = pageVolume;
|
||||
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(0, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, 0, 0);
|
||||
}
|
||||
break;
|
||||
case TYPE_NEXT_PAGE:
|
||||
@@ -275,7 +311,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mLastIndex = mData.size();
|
||||
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(mFirstIndex, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, mFirstIndex, 0);
|
||||
}
|
||||
break;
|
||||
case TYPE_SOMEWHERE:
|
||||
@@ -290,7 +326,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mLastIndex = pageVolume;
|
||||
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(0, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -299,6 +335,14 @@ public class ContentLayout extends FrameLayout {
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
}
|
||||
|
||||
public void onGetPageData(int taskId, Exception e) {
|
||||
if (mCurrentTaskId == taskId) {
|
||||
mRefreshLayout.setHeaderRefreshing(false);
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
showText(e.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFooterRefresh() {
|
||||
if (mLastPage >= mPageSize) {
|
||||
@@ -307,7 +351,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_NEXT_PAGE_KEEP_POS;
|
||||
mCurrentTaskPage = mLastPage;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -318,21 +362,24 @@ public class ContentLayout extends FrameLayout {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_PRE_PAGE_KEEP_POS;
|
||||
mCurrentTaskPage = mFirstPage - 1;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
} else {
|
||||
doRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void doRefresh() {
|
||||
Log.d("doRefresh");
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_REFRESH;
|
||||
mCurrentTaskPage = 0;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show progress bar first, than do refresh
|
||||
*/
|
||||
public void refresh() {
|
||||
showProgressBar();
|
||||
mRefreshLayout.setHeaderRefreshing(true);
|
||||
doRefresh();
|
||||
}
|
||||
@@ -346,22 +393,22 @@ public class ContentLayout extends FrameLayout {
|
||||
mLastIndex = mFirstIndex + mPageVolume;
|
||||
int position = mFirstIndex;
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(position, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, position, 0);
|
||||
} else if (page == mFirstPage - 1) {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_PRE_PAGE;
|
||||
mCurrentTaskPage = page;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
} else if (page == mLastPage) {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_NEXT_PAGE;
|
||||
mCurrentTaskPage = page;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
} else {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_SOMEWHERE;
|
||||
mCurrentTaskPage = page;
|
||||
getPageData(mCurrentTaskId, mCurrentTaskPage);
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +418,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mFirstIndex = 0;
|
||||
mLastIndex = mPageVolume;
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(0, 0);
|
||||
LayoutManagerUtils.scrollToPositionWithOffset(mLayoutManager, 0, 0);
|
||||
}
|
||||
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class RatingView extends View {
|
||||
|
||||
private Drawable mStarDrawable;
|
||||
private Drawable mStarHalfDrawable;
|
||||
private int mRatingSize;
|
||||
private int mRatingInterval;
|
||||
|
||||
private float mRating;
|
||||
private int mRatingInt;
|
||||
|
||||
public RatingView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public RatingView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public RatingView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
Resources resources = context.getResources();
|
||||
mStarDrawable = resources.getDrawable(R.drawable.ic_star);
|
||||
mStarHalfDrawable = resources.getDrawable(R.drawable.ic_star_half);
|
||||
mRatingSize = resources.getDimensionPixelOffset(R.dimen.rating_size);
|
||||
mRatingInterval = resources.getDimensionPixelOffset(R.dimen.rating_interval);
|
||||
|
||||
mStarDrawable.setBounds(0, 0, mRatingSize, mRatingSize);
|
||||
mStarHalfDrawable.setBounds(0, 0, mRatingSize, mRatingSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(mRatingSize * 5 + mRatingInterval * 4, mRatingSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
int ratingInt = mRatingInt;
|
||||
int step = mRatingSize + mRatingInterval;
|
||||
int numStar = ratingInt / 2;
|
||||
int numStarHalf = ratingInt % 2;
|
||||
int saved = canvas.save();
|
||||
while (numStar-- > 0) {
|
||||
mStarDrawable.draw(canvas);
|
||||
canvas.translate(step, 0);
|
||||
}
|
||||
if (numStarHalf == 1) {
|
||||
mStarHalfDrawable.draw(canvas);
|
||||
}
|
||||
canvas.restoreToCount(saved);
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
if (mRating != rating) {
|
||||
mRating = rating;
|
||||
int ratingInt = Math.round(rating * 2);
|
||||
if (mRatingInt != ratingInt) {
|
||||
mRatingInt = ratingInt;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getRating() {
|
||||
return mRating;
|
||||
}
|
||||
}
|
||||
@@ -75,10 +75,6 @@ public class HttpHelper {
|
||||
|
||||
private int mResponseCode = -1;
|
||||
|
||||
static {
|
||||
System.setProperty("file.encoding", DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
mResponseCode = -1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.util;
|
||||
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
|
||||
public final class LayoutManagerUtils {
|
||||
|
||||
public static void scrollToPositionWithOffset(
|
||||
RecyclerView.LayoutManager layoutManager,int position, int offset) {
|
||||
if (layoutManager instanceof LinearLayoutManager) {
|
||||
((LinearLayoutManager) layoutManager).scrollToPositionWithOffset(position, offset);
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
((StaggeredGridLayoutManager) layoutManager).scrollToPositionWithOffset(position, offset);
|
||||
} else {
|
||||
throw new IllegalStateException("Can't do scrollToPositionWithOffset for " +
|
||||
layoutManager.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (C) 2015 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
tools:targetApi="21"
|
||||
|
||||
auto:width="24dp"
|
||||
auto:height="24dp"
|
||||
auto:viewportWidth="24"
|
||||
auto:viewportHeight="24"
|
||||
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
auto:pathData="@string/pd_star"
|
||||
auto:fillColor="@color/primary_drawable_light"
|
||||
|
||||
android:pathData="@string/pd_star"
|
||||
android:fillColor="@color/primary_drawable_light"/>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (C) 2015 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
tools:targetApi="21"
|
||||
|
||||
auto:width="24dp"
|
||||
auto:height="24dp"
|
||||
auto:viewportWidth="24"
|
||||
auto:viewportHeight="24"
|
||||
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
auto:pathData="@string/pd_star_half"
|
||||
auto:fillColor="@color/primary_drawable_light"
|
||||
|
||||
android:pathData="@string/pd_star_half"
|
||||
android:fillColor="@color/primary_drawable_light"/>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2015 Hippo Seven
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
auto:forceNoElevation="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="@dimen/list_thumb_width"
|
||||
android:layout_height="@dimen/list_thumb_height"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_toRightOf="@id/thumb"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/title"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginTop="2dp"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
<com.hippo.ehviewer.widget.RatingView
|
||||
android:id="@+id/rating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/title"
|
||||
android:layout_below="@id/uploader"
|
||||
android:layout_marginTop="2dp"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/title"
|
||||
android:layout_alignBottom="@id/thumb"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textAllCaps="true"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/posted"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/thumb"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
tools:ignore="RelativeOverlap,RtlHardcoded"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/simple_language"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/posted"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="6dp"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@@ -17,10 +17,11 @@
|
||||
<!--suppress Annotator -->
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ProgressBar
|
||||
style="@style/ProgressBar.Large"
|
||||
style="@style/ProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
@@ -51,21 +52,24 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.hippo.widget.recyclerview.EasyRecyclerView
|
||||
<com.hippo.widget.recyclerview.MonoRecyclerView
|
||||
android:id="@+id/content_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/content_padding_start"
|
||||
android:paddingRight="@dimen/content_padding_end"
|
||||
android:clipToPadding="false"
|
||||
auto:space="@dimen/search_layout_space"
|
||||
auto:spaceLeft="@dimen/search_layout_space_vertical"
|
||||
auto:spaceRight="@dimen/search_layout_space_vertical"
|
||||
tools:ignore="RtlHardcoded"/>
|
||||
|
||||
</com.hippo.widget.refreshlayout.RefreshLayout>
|
||||
|
||||
<com.hippo.widget.Snackbar
|
||||
xmlns:auto="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/snackbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:visibility="gone"
|
||||
auto:message="@string/refresh_snackbar_message"/>
|
||||
|
||||
</merge>
|
||||
@@ -15,6 +15,10 @@
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<!-- RatingView -->
|
||||
<dimen name="rating_size">16dp</dimen>
|
||||
<dimen name="rating_interval">1dp</dimen>
|
||||
|
||||
<!-- StatsActivity -->
|
||||
<dimen name="stats_text_view_padding_top">24dp</dimen>
|
||||
<dimen name="stats_text_view_padding_right">16dp</dimen>
|
||||
@@ -26,6 +30,9 @@
|
||||
<dimen name="snackbar_padding_bottom">14dp</dimen>
|
||||
<dimen name="snackbar_interval">24dp</dimen>
|
||||
|
||||
<dimen name="list_thumb_width">80dp</dimen>
|
||||
<dimen name="list_thumb_height">120dp</dimen>
|
||||
|
||||
<!-- FloatingActionBarLayout -->
|
||||
<dimen name="floating_action_bar_layout_interval">16dp</dimen>
|
||||
|
||||
@@ -49,6 +56,10 @@
|
||||
<dimen name="search_layout_space">8dp</dimen>
|
||||
<dimen name="search_layout_space_vertical">8dp</dimen>
|
||||
|
||||
<!-- Content Layout Space -->
|
||||
<dimen name="content_layout_space">8dp</dimen>
|
||||
<dimen name="content_layout_space_vertical">8dp</dimen>
|
||||
|
||||
<!-- Corner fab -->
|
||||
<dimen name="corner_fab_padding_right">16dp</dimen>
|
||||
<dimen name="corner_fab_padding_bottom">16dp</dimen>
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
<string name="pd_help_circle" translatable="false">M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z</string>
|
||||
<string name="pd_arrow_up" translatable="false">M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z</string>
|
||||
<string name="pd_go_to" translatable="false">M10.5,7A6.5,6.5 0 0,0 4,13.5A6.5,6.5 0 0,0 10.5,20H14V18H10.5C8,18 6,16 6,13.5C6,11 8,9 10.5,9H16.17L13.09,12.09L14.5,13.5L20,8L14.5,2.5L13.08,3.91L16.17,7H10.5M18,18H16V20H18V18Z</string>
|
||||
<string name="pd_star" translatable="false">M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z</string>
|
||||
<string name="pd_star_half" translatable="false">M12,15.89V6.59L13.71,10.63L18.09,11L14.77,13.88L15.76,18.16M22,9.74L14.81,9.13L12,2.5L9.19,9.13L2,9.74L7.45,14.47L5.82,21.5L12,17.77L18.18,21.5L16.54,14.47L22,9.74Z</string>
|
||||
|
||||
</resources>
|
||||
@@ -93,6 +93,28 @@
|
||||
<item name="android:indeterminateDrawable">@drawable/progress_large_material</item>
|
||||
</style>
|
||||
|
||||
<!-- Card -->
|
||||
<style name="TextAppearance.CardTitle">
|
||||
<item name="@android:textSize">@dimen/text_little_small</item>
|
||||
</style>
|
||||
|
||||
<style name="CardTitle">
|
||||
<item name="@android:textAppearance">@style/TextAppearance.CardTitle</item>
|
||||
<item name="@android:ellipsize">end</item>
|
||||
<item name="@android:maxLines">2</item>
|
||||
<item name="@android:lineSpacingExtra">0sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.CardMessage">
|
||||
<item name="@android:textColor">@color/secondary_text_light</item>
|
||||
</style>
|
||||
|
||||
<style name="CardMessage">
|
||||
<item name="@android:textAppearance">@style/TextAppearance.CardMessage</item>
|
||||
<item name="@android:ellipsize">end</item>
|
||||
<item name="@android:singleLine">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Text.Dialog.Title" parent="TextAppearance.AppCompat">
|
||||
<item name="android:textColor">@color/primary_text_light</item>
|
||||
<item name="android:textSize">@dimen/text_little_large</item>
|
||||
|
||||
Reference in new issue
Block a user