Commit 78a945b2 by Kang Donghun

コード整理

parent 576e38ac
......@@ -22,15 +22,15 @@ public class DisplayUtil {
public static Point getDisplaySize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
int displayWidth;
int displayHeight;
int displayHeight;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowMetrics metrics = wm.getCurrentWindowMetrics();
Rect bounds = metrics.getBounds();
WindowInsets windowInsets = metrics.getWindowInsets();
android.graphics.Insets insets = windowInsets.getInsets(
WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout()
WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout()
);
displayWidth = bounds.width() - (insets.left + insets.right);
......
......@@ -22,7 +22,6 @@ import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
......
......@@ -630,19 +630,19 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (hasMultiPages) { // サムネイルバーとページ番号表示
mPageNumberLayout = (RelativeLayout)getLayoutInflater().inflate(R.layout.page_number, null);
int height = (int) ((isNormalSize()? ThumbnailSeekBarLayout.NORMAL_HEIGHT: ThumbnailSeekBarLayout.LARGE_HEIGHT) * getResources().getDisplayMetrics().density); // サムネイルバーの高さ
mLThumViewSize = (int) (200 * (float)height / ThumbnailSeekBarLayout.LARGE_HEIGHT); // 大サムネイル表示領域の設定
int height = (int) ((isNormalSize()? ThumbnailSeekBarLayout.NORMAL_HEIGHT: ThumbnailSeekBarLayout.LARGE_HEIGHT) * getResources().getDisplayMetrics().density); // サムネイルバーの高さ
mLThumViewSize = (int) (200 * (float)height / ThumbnailSeekBarLayout.LARGE_HEIGHT); // 大サムネイル表示領域の設定
mSeekBarLayout = new ThumbnailSeekBarLayout(this, mFoxitPdfCore, getContentId(), mAllPageCount, isLandscapeView, mDisplaySize.width, mDisplaySize.height, isNormalSize(), mPageNumberLayout);
mSeekBarLayout.setId(id.seekbar_layout_id); // 番号は適当
mSeekBarLayout.setVisibility(View.INVISIBLE);
mSeekBarLayout.setFitsSystemWindows(true);
mSeekBarLayout.setFitsSystemWindows(true);
RelativeLayout.LayoutParams param2 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, height);
param2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mMainLayout.addView(mSeekBarLayout, param2);
mMainLayout.setFitsSystemWindows(true);
mMainLayout.setFitsSystemWindows(true);
mPageNumberLayout.setVisibility(View.INVISIBLE);
RelativeLayout.LayoutParams param = createParam(ViewGroup.LayoutParams.MATCH_PARENT, (int)(convertDensitySize(50) + 0.5f));
RelativeLayout.LayoutParams param = createParam(ViewGroup.LayoutParams.MATCH_PARENT, (int)(convertDensitySize(50) + 0.5f));
param.setMargins(0, 0, 0, 10);
param.addRule(RelativeLayout.ABOVE, mSeekBarLayout.getId());
mMainLayout.addView(mPageNumberLayout, param);
......
......@@ -92,7 +92,6 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
private boolean isReady;
private boolean mSeekingFlag = false;
// private boolean isOver35 = false;
public ThumbnailSeekBarLayout(Context context, FoxitPdfCore foxitPdfCore, long contentId, int maxPageCount, boolean isLandscapeView, int displayWidth, int displayHeight, boolean isNormalSize, RelativeLayout pageNumberLayout) {
......@@ -106,9 +105,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
this.mPageNumberLayout = pageNumberLayout;
mPdfThumbnailProvider = new PdfThumbnailProvider(context, foxitPdfCore, contentId, isNormalSize);
mPdfThumbnailProvider.setIsLandscape(isLandscapeView);
// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
// isOver35 = true;
// }
landWidthDiffMS = mPdfThumbnailProvider.landWidthM - mPdfThumbnailProvider.landWidthS;
portWidthDiffMS = mPdfThumbnailProvider.portWidthM - mPdfThumbnailProvider.portWidthS;
marginL = (int) (marginL * mPdfThumbnailProvider.getRatio(isNormalSize));
......@@ -239,12 +236,12 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
);
insetLeft = systemBars.left;
insetTop = systemBars.top;
} else {
} else {
insetTop = 0;
insetLeft = 0;
}
for (int i=0; i < maxThumCount; i++) {
for (int i=0; i < maxThumCount; i++) {
ImageView smallImageView = new ImageView(getContext());
final int page = indexToPages[i];
smallImageView.setLayoutParams(params);
......@@ -262,7 +259,6 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
case MotionEvent.ACTION_DOWN:
// 中サイズのサムネイル表示
showMidThum(page, ((View)v.getParent()).getLeft() + v.getLeft() - (isLandscapeView?landWidthDiffMS:portWidthDiffMS) / 2);
// showMidThum(page, (isOver35 ? v.getLeft() : ((View)v.getParent()).getLeft() + v.getLeft()) - (isLandscapeView?landWidthDiffMS:portWidthDiffMS) / 2);
// 大サイズのサムネイル表示
if (getContext() instanceof ContentViewActivity) {
int left = ((View)v.getParent()).getLeft() + v.getLeft() + v.getWidth() / 2 - ((ContentViewActivity)getContext()).getLThumViewSize() / 2;
......@@ -283,6 +279,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
}
int pageX = (int) (firstCenterX + newPage * interval); // 現在ページ(大サムネイルの表示ページ)のx座標(さらに正確にするには各小サムネイル間のページ数で割って計算すべきだが)
Logger.d(TAG, "newPage=" + newPage+ " x=" + x + " y=" + y + " firstX=" + firstCenterX + " lastX=" + lastCenterX + " interval=" + interval + " pageX=" + pageX);
if (x < pageX - interval && newPage > 0) { // 前のページ
newPage = (int) ((x - firstCenterX + interval) / interval);
}
......@@ -292,6 +289,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
else {
break;
}
if (newPage >= 0 && newPage < maxPageCount) {
// 中サイズのサムネイル表示
showMidThum(newPage, (int) (x - (isLandscapeView? mPdfThumbnailProvider.landWidthM: mPdfThumbnailProvider.portWidthM) / 2));
......@@ -622,4 +620,5 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
public boolean isSeeking() {
return mSeekingFlag;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment