Adjust layout for table
This commit is contained in:
1 parent
3f8e872d55
commit
b3881f8562
13 files changed
+94
-46
No files matched your search
@@ -33,9 +33,9 @@ import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SimpleItemAnimator;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.util.SparseBooleanArray;
|
||||
@@ -60,6 +60,7 @@ import com.hippo.app.CheckBoxDialogBuilder;
|
||||
import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.FastScroller;
|
||||
import com.hippo.easyrecyclerview.HandlerDrawable;
|
||||
import com.hippo.easyrecyclerview.MarginItemDecoration;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.EhDB;
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -83,6 +84,7 @@ import com.hippo.util.DrawableManager;
|
||||
import com.hippo.view.ViewTransition;
|
||||
import com.hippo.widget.FabLayout;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
import com.hippo.yorozuya.LongList;
|
||||
@@ -131,7 +133,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
@Nullable
|
||||
private DownloadAdapter mAdapter;
|
||||
@Nullable
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private AutoStaggeredGridLayoutManager mLayoutManager;
|
||||
|
||||
private ShowcaseView mShowcaseView;
|
||||
|
||||
@@ -278,6 +280,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(content);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
Drawable drawable = DrawableManager.getDrawable(context, R.drawable.big_download);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
@@ -286,7 +289,9 @@ public class DownloadsScene extends ToolbarScene
|
||||
mAdapter = new DownloadAdapter();
|
||||
mAdapter.setHasStableIds(true);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mLayoutManager = new LinearLayoutManager(context);
|
||||
mLayoutManager = new AutoStaggeredGridLayoutManager(0, StaggeredGridLayoutManager.VERTICAL);
|
||||
mLayoutManager.setColumnSize(resources.getDimensionPixelOffset(R.dimen.gallery_list_column_width));
|
||||
mLayoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setDrawSelectorOnTop(true);
|
||||
@@ -301,9 +306,12 @@ public class DownloadsScene extends ToolbarScene
|
||||
if (itemAnimator instanceof SimpleItemAnimator) {
|
||||
((SimpleItemAnimator) itemAnimator).setSupportsChangeAnimations(false);
|
||||
}
|
||||
int paddingH = context.getResources().getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = context.getResources().getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
mRecyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
int interval = resources.getDimensionPixelOffset(R.dimen.gallery_list_interval);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_v);
|
||||
MarginItemDecoration decoration = new MarginItemDecoration(interval, paddingH, paddingV, paddingH, paddingV);
|
||||
mRecyclerView.addItemDecoration(decoration);
|
||||
decoration.applyPaddings(mRecyclerView);
|
||||
if (mInitPosition >= 0) {
|
||||
mRecyclerView.scrollToPosition(mInitPosition);
|
||||
mInitPosition = -1;
|
||||
@@ -351,7 +359,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
guideDownloadLabels();
|
||||
return;
|
||||
}
|
||||
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
int position = mLayoutManager.findFirstCompletelyVisibleItemPositions(null)[0];
|
||||
if (position < 0) {
|
||||
guideDownloadLabels();
|
||||
return;
|
||||
|
||||
@@ -244,7 +244,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.list_padding_top_search_bar);
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
|
||||
|
||||
mHelper = new FavoritesHelper();
|
||||
mHelper.setEmptyString(resources.getString(R.string.gallery_list_empty_hit));
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.hippo.ehviewer.client.EhUtils;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.widget.TileThumb;
|
||||
import com.hippo.util.ApiHelper;
|
||||
import com.hippo.widget.recyclerview.AutoGridLayoutManager;
|
||||
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -70,7 +69,7 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
|
||||
mResources = resources;
|
||||
mRecyclerView = recyclerView;
|
||||
mLayoutManager = new AutoStaggeredGridLayoutManager(0, StaggeredGridLayoutManager.VERTICAL);
|
||||
mPaddingTopSB = resources.getDimensionPixelOffset(R.dimen.list_padding_top_search_bar);
|
||||
mPaddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
|
||||
|
||||
mRecyclerView.setAdapter(this);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
@@ -100,14 +99,14 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
|
||||
case GalleryAdapter.TYPE_LIST: {
|
||||
int columnWidth = mResources.getDimensionPixelOffset(R.dimen.gallery_list_column_width);
|
||||
mLayoutManager.setColumnSize(columnWidth);
|
||||
mLayoutManager.setStrategy(AutoGridLayoutManager.STRATEGY_MIN_SIZE);
|
||||
mLayoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
|
||||
if (null != mGirdDecoration) {
|
||||
recyclerView.removeItemDecoration(mGirdDecoration);
|
||||
}
|
||||
if (null == mListDecoration) {
|
||||
int interval = mResources.getDimensionPixelOffset(R.dimen.list_content_interval);
|
||||
int paddingH = mResources.getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = mResources.getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
int interval = mResources.getDimensionPixelOffset(R.dimen.gallery_list_interval);
|
||||
int paddingH = mResources.getDimensionPixelOffset(R.dimen.gallery_list_margin_h);
|
||||
int paddingV = mResources.getDimensionPixelOffset(R.dimen.gallery_list_margin_v);
|
||||
mListDecoration = new MarginItemDecoration(interval, paddingH, paddingV, paddingH, paddingV);
|
||||
}
|
||||
recyclerView.addItemDecoration(mListDecoration);
|
||||
@@ -119,7 +118,7 @@ abstract class GalleryAdapter extends RecyclerView.Adapter<GalleryHolder> {
|
||||
case GalleryAdapter.TYPE_GRID: {
|
||||
int columnWidth = mResources.getDimensionPixelOffset(Settings.getThumbSizeResId());
|
||||
mLayoutManager.setColumnSize(columnWidth);
|
||||
mLayoutManager.setStrategy(AutoGridLayoutManager.STRATEGY_SUITABLE_SIZE);
|
||||
mLayoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_SUITABLE_SIZE);
|
||||
if (null != mListDecoration) {
|
||||
recyclerView.removeItemDecoration(mListDecoration);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
Context context = getContext2();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.list_padding_bottom_fab);
|
||||
int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab);
|
||||
|
||||
Drawable drawable = DrawableManager.getDrawable(context, R.drawable.big_weird_face);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
|
||||
@@ -400,8 +400,8 @@ public final class GalleryListScene extends BaseScene
|
||||
mFabLayout = (FabLayout) ViewUtils.$$(mainLayout, R.id.fab_layout);
|
||||
mSearchFab = ViewUtils.$$(mainLayout, R.id.search_fab);
|
||||
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.list_padding_top_search_bar);
|
||||
int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.list_padding_bottom_fab);
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
|
||||
int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab);
|
||||
|
||||
mViewTransition = new ViewTransition(contentLayout, mSearchLayout);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@@ -46,6 +46,7 @@ import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractSwipeableItemView
|
||||
import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.FastScroller;
|
||||
import com.hippo.easyrecyclerview.HandlerDrawable;
|
||||
import com.hippo.easyrecyclerview.MarginItemDecoration;
|
||||
import com.hippo.ehviewer.EhDB;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
@@ -62,6 +63,7 @@ import com.hippo.util.ApiHelper;
|
||||
import com.hippo.util.DrawableManager;
|
||||
import com.hippo.view.ViewTransition;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.ResourcesUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
@@ -119,7 +121,10 @@ public class HistoryScene extends ToolbarScene
|
||||
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
|
||||
AutoStaggeredGridLayoutManager layoutManager = new AutoStaggeredGridLayoutManager(
|
||||
0, StaggeredGridLayoutManager.VERTICAL);
|
||||
layoutManager.setColumnSize(resources.getDimensionPixelOffset(R.dimen.gallery_list_column_width));
|
||||
layoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
|
||||
mRecyclerView.setDrawSelectorOnTop(true);
|
||||
@@ -127,9 +132,12 @@ public class HistoryScene extends ToolbarScene
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.setOnItemClickListener(this);
|
||||
mRecyclerView.setOnItemLongClickListener(this);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
mRecyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
int interval = resources.getDimensionPixelOffset(R.dimen.gallery_list_interval);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_v);
|
||||
MarginItemDecoration decoration = new MarginItemDecoration(interval, paddingH, paddingV, paddingH, paddingV);
|
||||
mRecyclerView.addItemDecoration(decoration);
|
||||
decoration.applyPaddings(mRecyclerView);
|
||||
guardManager.attachRecyclerView(mRecyclerView);
|
||||
swipeManager.attachRecyclerView(mRecyclerView);
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
|
||||
setAdapter(mAdapter);
|
||||
setHasFixedSize(true);
|
||||
setClipToPadding(false);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.list_content_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.list_content_margin_v);
|
||||
int paddingH = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_h);
|
||||
int paddingV = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_v);
|
||||
setPadding(paddingV, paddingH, paddingV, paddingH);
|
||||
|
||||
// Create normal view
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
<com.hippo.widget.LoadImageView
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="@dimen/list_thumb_width"
|
||||
android:layout_height="@dimen/list_thumb_height"/>
|
||||
android:layout_width="@dimen/gallery_list_thumb_width"
|
||||
android:layout_height="@dimen/gallery_list_thumb_height"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
<com.hippo.widget.LoadImageView
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="@dimen/list_thumb_width"
|
||||
android:layout_height="@dimen/list_thumb_height"
|
||||
android:layout_width="@dimen/gallery_list_thumb_width"
|
||||
android:layout_height="@dimen/gallery_list_thumb_height"
|
||||
app:retryType="none"/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/list_search_bar_margin"
|
||||
android:layout_marginRight="@dimen/list_search_bar_margin"
|
||||
android:layout_marginTop="8dp"/>
|
||||
android:layout_marginLeft="@dimen/gallery_search_bar_margin_h"
|
||||
android:layout_marginRight="@dimen/gallery_search_bar_margin_h"
|
||||
android:layout_marginTop="@dimen/gallery_search_bar_margin_v"/>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/list_search_bar_margin"
|
||||
android:layout_marginRight="@dimen/list_search_bar_margin"
|
||||
android:layout_marginTop="8dp"/>
|
||||
android:layout_marginLeft="@dimen/gallery_search_bar_margin_h"
|
||||
android:layout_marginRight="@dimen/gallery_search_bar_margin_h"
|
||||
android:layout_marginTop="@dimen/gallery_search_bar_margin_v"/>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2016 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
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<dimen name="keyline_margin">24dp</dimen>
|
||||
<dimen name="single_max_width">360dp</dimen>
|
||||
|
||||
<dimen name="gallery_list_interval">4dp</dimen>
|
||||
<dimen name="gallery_list_margin_h">20dp</dimen>
|
||||
<dimen name="gallery_list_margin_v">4dp</dimen>
|
||||
<dimen name="gallery_grid_interval">8dp</dimen>
|
||||
<dimen name="gallery_grid_margin_h">24dp</dimen>
|
||||
<dimen name="gallery_grid_margin_v">8dp</dimen>
|
||||
|
||||
<dimen name="gallery_search_bar_margin_h">20dp</dimen>
|
||||
<dimen name="gallery_search_bar_margin_v">16dp</dimen>
|
||||
<dimen name="gallery_padding_top_search_bar">72dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -17,9 +17,7 @@
|
||||
<resources>
|
||||
|
||||
<dimen name="keyline_margin">16dp</dimen>
|
||||
|
||||
<dimen name="single_max_width">260dp</dimen>
|
||||
|
||||
<dimen name="drawer_max_width">280dp</dimen>
|
||||
|
||||
<dimen name="dialog_padding_top_material">18dp</dimen>
|
||||
@@ -37,19 +35,20 @@
|
||||
<dimen name="rating_size">16dp</dimen>
|
||||
<dimen name="rating_interval">1dp</dimen>
|
||||
|
||||
<dimen name="list_thumb_height">120dp</dimen>
|
||||
<dimen name="list_thumb_width">80dp</dimen>
|
||||
<dimen name="list_content_margin_h">4dp</dimen>
|
||||
<dimen name="list_content_margin_v">4dp</dimen>
|
||||
<dimen name="list_content_interval">0dp</dimen>
|
||||
<dimen name="list_search_bar_margin">4dp</dimen>
|
||||
<dimen name="list_padding_top_search_bar">64dp</dimen>
|
||||
<dimen name="list_padding_bottom_fab">80dp</dimen>
|
||||
|
||||
<dimen name="gallery_list_thumb_height">120dp</dimen>
|
||||
<dimen name="gallery_list_thumb_width">80dp</dimen>
|
||||
<dimen name="gallery_list_interval">0dp</dimen>
|
||||
<dimen name="gallery_list_margin_h">4dp</dimen>
|
||||
<dimen name="gallery_list_margin_v">4dp</dimen>
|
||||
<dimen name="gallery_grid_interval">8dp</dimen>
|
||||
<dimen name="gallery_grid_margin_h">8dp</dimen>
|
||||
<dimen name="gallery_grid_margin_v">8dp</dimen>
|
||||
|
||||
<dimen name="gallery_search_bar_margin_h">4dp</dimen>
|
||||
<dimen name="gallery_search_bar_margin_v">8dp</dimen>
|
||||
<dimen name="gallery_padding_top_search_bar">64dp</dimen>
|
||||
<dimen name="gallery_padding_bottom_fab">80dp</dimen>
|
||||
|
||||
<dimen name="gallery_list_column_width">320dp</dimen>
|
||||
<dimen name="gallery_grid_column_width_large">160dp</dimen>
|
||||
<dimen name="gallery_grid_column_width_middle">120dp</dimen>
|
||||
|
||||
Reference in new issue
Block a user