Commit 36fd7757 by Yujin Seo

Merge branch 'contract/sato/1.0.620_67472' into 'contract/sato/1.0.630'

Contract/sato/1.0.620 67472

See merge request !333
parents 46bb4157 ca5601ac
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
android:name="jp.agentec.abook.abv.ui.home.activity.PreSplashActivity" android:name="jp.agentec.abook.abv.ui.home.activity.PreSplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:exported="true" > android:theme="@style/Theme_fits_full" android:exported="true" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
...@@ -157,45 +157,45 @@ ...@@ -157,45 +157,45 @@
<activity <activity
android:name="jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity" android:name="jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> android:theme="@style/Theme_fits_full" />
<activity <activity
android:name="jp.agentec.abook.abv.ui.home.activity.LoginActivity" android:name="jp.agentec.abook.abv.ui.home.activity.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="LoginActivity" android:label="LoginActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> android:theme="@style/Theme_fits_full" />
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.ContentViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="false" android:hardwareAccelerated="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.HTMLWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar" > android:theme="@style/Theme_fits" >
</activity> </activity>
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.EnqueteWebViewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.EnqueteWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar" > android:theme="@style/Theme_fits" >
</activity> </activity>
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.PreviewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.PreviewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@style/Theme_fits_full" >
</activity> </activity>
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.VideoViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@style/Theme_fits_full" >
</activity> </activity>
<activity <activity
android:name="jp.agentec.abook.abv.ui.home.activity.LoginPasswordChangeActivity" android:name="jp.agentec.abook.abv.ui.home.activity.LoginPasswordChangeActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="LoginPasswordChangeActivity" android:label="LoginPasswordChangeActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@style/Theme_fits_full" >
</activity> </activity>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity" android:theme="@android:style/Theme.NoTitleBar"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity" android:theme="@style/Theme_fits"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivity" android:theme="@style/Theme_fits_full"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.ChangePasswordActivityDialog" android:theme="@style/Theme.MyTheme.ModalDialog"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.HelpActivity" android:configChanges="orientation|screenSize"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.HelpActivity" android:configChanges="orientation|screenSize"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.GuideViewActivity" android:configChanges="orientation|screenSize"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.GuideViewActivity" android:configChanges="orientation|screenSize"/>
...@@ -204,11 +204,11 @@ ...@@ -204,11 +204,11 @@
<activity android:name="jp.agentec.abook.abv.ui.viewer.activity.AudioPlayActivity" <activity android:name="jp.agentec.abook.abv.ui.viewer.activity.AudioPlayActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> android:theme="@style/Theme_fits_full" />
<activity android:name="jp.agentec.abook.abv.ui.viewer.activity.ImageViewActivity" <activity android:name="jp.agentec.abook.abv.ui.viewer.activity.ImageViewActivity"
android:hardwareAccelerated="false" android:hardwareAccelerated="false"
android:configChanges="keyboardHidden" android:configChanges="keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> android:theme="@style/Theme_fits_full" />
<activity android:name="jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="true"> <activity android:name="jp.agentec.abook.abv.ui.common.activity.ShowPushMessageDailogActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -237,10 +237,10 @@ ...@@ -237,10 +237,10 @@
<activity <activity
android:name="jp.agentec.abook.abv.ui.viewer.activity.OnlineHTMLWebViewActivity" android:name="jp.agentec.abook.abv.ui.viewer.activity.OnlineHTMLWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > android:theme="@style/Theme_fits_full" >
</activity> </activity>
<!-- @Form QRコードリーダー --> <!-- @Form QRコードリーダー -->
<activity android:name="jp.agentec.abook.abv.ui.home.activity.CaptureQRCodeActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.CaptureQRCodeActivity" android:theme="@style/Theme_fits_full"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.CaptureQRCodeActivityDialog" android:theme="@android:style/Theme.Holo.Dialog.NoActionBar"/> <activity android:name="jp.agentec.abook.abv.ui.home.activity.CaptureQRCodeActivityDialog" android:theme="@android:style/Theme.Holo.Dialog.NoActionBar"/>
</application> </application>
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<item name="android:windowBackground">@color/transparent</item> <item name="android:windowBackground">@color/transparent</item>
</style> </style>
<style name="AppTheme" parent="android:Theme.Light" /> <style name="AppTheme" parent="android:Theme.Light">
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme_Contentdetailview" parent="android:style/Theme.Translucent"> <style name="Theme_Contentdetailview" parent="android:style/Theme.Translucent">
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
......
...@@ -21,4 +21,13 @@ ...@@ -21,4 +21,13 @@
<dimen name="operation_title_text_size">20sp</dimen> <dimen name="operation_title_text_size">20sp</dimen>
<dimen name="operation_title_normal_width">200dp</dimen> <dimen name="operation_title_normal_width">200dp</dimen>
<dimen name="operation_title_large_width">400dp</dimen> <dimen name="operation_title_large_width">400dp</dimen>
<dimen name="opeartion_title_text_size" />
<dimen name="report_status_height_1">48dp</dimen>
<dimen name="report_status_height_2">32dp</dimen>
<dimen name="report_status_height_3">24dp</dimen>
<dimen name="report_status_width_1">80dp</dimen>
<dimen name="report_status_width_2">36dp</dimen>
</resources> </resources>
...@@ -6,35 +6,41 @@ ...@@ -6,35 +6,41 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/setting_bg" android:background="@drawable/setting_bg"
android:orientation="vertical" android:orientation="vertical"
android:padding="20dp" > android:fitsSystemWindows="true" >
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_vertical" android:orientation="vertical"
android:paddingBottom="10dp" > android:padding="20dp">
<ImageButton <LinearLayout
android:id="@+id/app_icon" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/icon" android:gravity="center_vertical"
android:src="@null" /> android:paddingBottom="10dp" >
<TextView <ImageButton
android:id="@+id/textView1" android:id="@+id/app_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="20dp" android:background="@drawable/icon"
android:text="@string/setting" android:src="@null" />
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<fragment <TextView
android:id="@+id/pref_fragment" android:id="@+id/textView1"
android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingFragment" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="match_parent" android:paddingLeft="20dp"
tools:layout="@layout/setting_fragment" /> android:text="@string/setting"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<fragment
android:id="@+id/pref_fragment"
android:name="jp.agentec.abook.abv.ui.home.activity.ABookSettingFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/setting_fragment" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="opeartion_title_text_size" />
<dimen name="report_status_height_1">48dp</dimen>
<dimen name="report_status_height_2">32dp</dimen>
<dimen name="report_status_height_3">24dp</dimen>
<dimen name="report_status_width_1">80dp</dimen>
<dimen name="report_status_width_2">36dp</dimen>
</resources>
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<item name="android:textViewStyle">@style/TextViewABook</item> <item name="android:textViewStyle">@style/TextViewABook</item>
<item name="android:alertDialogStyle">@style/Theme_ABookAlertDialog</item> <item name="android:alertDialogStyle">@style/Theme_ABookAlertDialog</item>
<item name="android:fitsSystemWindows">true</item>
</style> </style>
</resources> </resources>
\ No newline at end of file
...@@ -69,5 +69,10 @@ ...@@ -69,5 +69,10 @@
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@drawable/translucent_background</item> <item name="android:windowBackground">@drawable/translucent_background</item>
</style> --> </style> -->
<style name="Theme_fits_full" parent="android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:fitsSystemWindows">true</item>
</style>
<style name="Theme_fits" parent="android:style/Theme.NoTitleBar">
<item name="android:fitsSystemWindows">true</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -4,10 +4,13 @@ import jp.agentec.abook.abv.bl.common.log.Logger; ...@@ -4,10 +4,13 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.ui.common.vo.Size; import jp.agentec.abook.abv.ui.common.vo.Size;
import android.content.Context; import android.content.Context;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build; import android.os.Build;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Display; import android.view.Display;
import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.WindowMetrics;
public class DisplayUtil { public class DisplayUtil {
...@@ -18,10 +21,29 @@ public class DisplayUtil { ...@@ -18,10 +21,29 @@ public class DisplayUtil {
*/ */
public static Point getDisplaySize(Context context) { public static Point getDisplaySize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay(); int displayWidth;
Point outSize = new Point(); int displayHeight;
display.getSize(outSize);
return outSize; 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.navigationBars() | WindowInsets.Type.displayCutout()
);
displayWidth = bounds.width() - (insets.left + insets.right);
displayHeight = bounds.height() - (insets.top + insets.bottom);
} else {
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
displayWidth = size.x;
displayHeight = size.y;
}
return new Point(displayWidth, displayHeight);
} }
public static Size getDisplaySize2(Context context) { public static Size getDisplaySize2(Context context) {
......
...@@ -472,9 +472,11 @@ public class GuideViewActivity extends ABVContentViewActivity { ...@@ -472,9 +472,11 @@ public class GuideViewActivity extends ABVContentViewActivity {
mSeekBarLayout = new ThumbnailSeekBarLayout(this, mFoxitPdfCore, getContentId(), mAllPageCount, isLandscapeView, mDisplaySize.width, mDisplaySize.height, isNormalSize(), mPageNumberLayout); mSeekBarLayout = new ThumbnailSeekBarLayout(this, mFoxitPdfCore, getContentId(), mAllPageCount, isLandscapeView, mDisplaySize.width, mDisplaySize.height, isNormalSize(), mPageNumberLayout);
mSeekBarLayout.setId(id.seekbar_layout_id); // 番号は適当 mSeekBarLayout.setId(id.seekbar_layout_id); // 番号は適当
mSeekBarLayout.setVisibility(View.INVISIBLE); mSeekBarLayout.setVisibility(View.INVISIBLE);
mSeekBarLayout.setFitsSystemWindows(true);
RelativeLayout.LayoutParams param2 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, height); RelativeLayout.LayoutParams param2 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, height);
param2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); param2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mMainLayout.addView(mSeekBarLayout, param2); mMainLayout.addView(mSeekBarLayout, param2);
mMainLayout.setFitsSystemWindows(true);
mPageNumberLayout.setVisibility(View.INVISIBLE); 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));
......
...@@ -40,6 +40,8 @@ import android.view.View.OnKeyListener; ...@@ -40,6 +40,8 @@ import android.view.View.OnKeyListener;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowInsetsController;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
...@@ -605,17 +607,17 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -605,17 +607,17 @@ public class ContentViewActivity extends ABVContentViewActivity {
configureSize(); configureSize();
mMainLayout = new MmainLayout(getApplicationContext()); mMainLayout = new MmainLayout(this);
// ダミーのSurfaceViewを追加する。これを行わないとコンテンツの2ページ目に埋め込み動画がある場合は画面が一瞬真っ黒になる。 // ダミーのSurfaceViewを追加する。これを行わないとコンテンツの2ページ目に埋め込み動画がある場合は画面が一瞬真っ黒になる。
// SurfaceViewをLayoutにaddViewするタイミングで起きるが、大きさ0のSurfaceViewをここでセットすることで避けられる。 // SurfaceViewをLayoutにaddViewするタイミングで起きるが、大きさ0のSurfaceViewをここでセットすることで避けられる。
mMainLayout.addView(new SurfaceView(this), new ViewGroup.LayoutParams(0, 0)); mMainLayout.addView(new SurfaceView(this), new ViewGroup.LayoutParams(0, 0));
mMainLayout.setFitsSystemWindows(true);
mContentWrapLayout = new RelativeLayout(this);
mContentWrapLayout = new RelativeLayout(getApplicationContext()); mPageScrollView = new PageScrollView(this);
mPageScrollView = new PageScrollView(getApplicationContext());
mPageScrollView.setHorizontalScrollBarEnabled(false); // ScrollBarを非表示 mPageScrollView.setHorizontalScrollBarEnabled(false); // ScrollBarを非表示
mPageScrollView.addView(mContentWrapLayout, new ViewGroup.LayoutParams(mAllPageCount * mDisplaySize.width, FP)); mPageScrollView.addView(mContentWrapLayout, new ViewGroup.LayoutParams(mAllPageCount * mDisplaySize.width, FP));
RelativeLayout.LayoutParams param0 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); RelativeLayout.LayoutParams param0 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
param0.addRule(RelativeLayout.CENTER_IN_PARENT); param0.addRule(RelativeLayout.CENTER_IN_PARENT);
...@@ -633,9 +635,11 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -633,9 +635,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
mSeekBarLayout = new ThumbnailSeekBarLayout(this, mFoxitPdfCore, getContentId(), mAllPageCount, isLandscapeView, mDisplaySize.width, mDisplaySize.height, isNormalSize(), mPageNumberLayout); mSeekBarLayout = new ThumbnailSeekBarLayout(this, mFoxitPdfCore, getContentId(), mAllPageCount, isLandscapeView, mDisplaySize.width, mDisplaySize.height, isNormalSize(), mPageNumberLayout);
mSeekBarLayout.setId(id.seekbar_layout_id); // 番号は適当 mSeekBarLayout.setId(id.seekbar_layout_id); // 番号は適当
mSeekBarLayout.setVisibility(View.INVISIBLE); mSeekBarLayout.setVisibility(View.INVISIBLE);
mSeekBarLayout.setFitsSystemWindows(true);
RelativeLayout.LayoutParams param2 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, height); RelativeLayout.LayoutParams param2 = createParam(ViewGroup.LayoutParams.MATCH_PARENT, height);
param2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); param2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mMainLayout.addView(mSeekBarLayout, param2); mMainLayout.addView(mSeekBarLayout, param2);
mMainLayout.setFitsSystemWindows(true);
mPageNumberLayout.setVisibility(View.INVISIBLE); 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));
...@@ -1476,6 +1480,10 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -1476,6 +1480,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
return false; return false;
} }
if (mSeekBarLayout != null && mSeekBarLayout.isSeeking()) {
return false;
}
if (mPageScrollView.isZooming() == false && !isEnqueteOpening) { if (mPageScrollView.isZooming() == false && !isEnqueteOpening) {
stopVideo(); stopVideo();
} }
......
...@@ -23,6 +23,7 @@ import android.graphics.BitmapFactory; ...@@ -23,6 +23,7 @@ import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options; import android.graphics.BitmapFactory.Options;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Process; import android.os.Process;
import android.view.Gravity; import android.view.Gravity;
...@@ -30,6 +31,9 @@ import android.view.LayoutInflater; ...@@ -30,6 +31,9 @@ import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.WindowMetrics;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
...@@ -100,7 +104,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -100,7 +104,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
this.mPageNumberLayout = pageNumberLayout; this.mPageNumberLayout = pageNumberLayout;
mPdfThumbnailProvider = new PdfThumbnailProvider(context, foxitPdfCore, contentId, isNormalSize); mPdfThumbnailProvider = new PdfThumbnailProvider(context, foxitPdfCore, contentId, isNormalSize);
mPdfThumbnailProvider.setIsLandscape(isLandscapeView); mPdfThumbnailProvider.setIsLandscape(isLandscapeView);
landWidthDiffMS = mPdfThumbnailProvider.landWidthM - mPdfThumbnailProvider.landWidthS; landWidthDiffMS = mPdfThumbnailProvider.landWidthM - mPdfThumbnailProvider.landWidthS;
portWidthDiffMS = mPdfThumbnailProvider.portWidthM - mPdfThumbnailProvider.portWidthS; portWidthDiffMS = mPdfThumbnailProvider.portWidthM - mPdfThumbnailProvider.portWidthS;
marginL = (int) (marginL * mPdfThumbnailProvider.getRatio(isNormalSize)); marginL = (int) (marginL * mPdfThumbnailProvider.getRatio(isNormalSize));
...@@ -110,9 +114,11 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -110,9 +114,11 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
seekBarLayout = (RelativeLayout)layoutInflater.inflate(R.layout.thumb_seekbar, null); seekBarLayout = (RelativeLayout)layoutInflater.inflate(R.layout.thumb_seekbar, null);
seekBarLayout.setFitsSystemWindows(true);
addView(seekBarLayout); addView(seekBarLayout);
linearLayout = (LinearLayout)seekBarLayout.findViewById(id.seekbar_liner); linearLayout = (LinearLayout)seekBarLayout.findViewById(id.seekbar_liner);
linearLayout.setFitsSystemWindows(true);
width = isLandscapeView? mPdfThumbnailProvider.landWidthS: mPdfThumbnailProvider.portWidthS; width = isLandscapeView? mPdfThumbnailProvider.landWidthS: mPdfThumbnailProvider.portWidthS;
height = isLandscapeView? mPdfThumbnailProvider.landHeightS: mPdfThumbnailProvider.portHeightS; height = isLandscapeView? mPdfThumbnailProvider.landHeightS: mPdfThumbnailProvider.portHeightS;
...@@ -217,19 +223,38 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -217,19 +223,38 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
params.setMargins(marginS, marginS, marginS, marginS); params.setMargins(marginS, marginS, marginS, marginS);
params.gravity = Gravity.CENTER_VERTICAL; params.gravity = Gravity.CENTER_VERTICAL;
int insetLeft;
int insetTop;
WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
if (wm != null && Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
WindowMetrics metrics = wm.getCurrentWindowMetrics();
WindowInsets insets = metrics.getWindowInsets();
android.graphics.Insets systemBars = insets.getInsets(
WindowInsets.Type.systemBars() | WindowInsets.Type.displayCutout()
);
insetLeft = systemBars.left;
insetTop = systemBars.top;
} else {
insetTop = 0;
insetLeft = 0;
}
for (int i=0; i < maxThumCount; i++) { for (int i=0; i < maxThumCount; i++) {
ImageView smallImageView = new ImageView(getContext()); ImageView smallImageView = new ImageView(getContext());
final int page = indexToPages[i]; final int page = indexToPages[i];
smallImageView.setLayoutParams(params); smallImageView.setLayoutParams(params);
smallImageView.setImageBitmap(dummyThumWhite); smallImageView.setImageBitmap(dummyThumWhite);
smallImageView.setFitsSystemWindows(true);
smallImageView.setOnTouchListener(new OnTouchListener() { smallImageView.setOnTouchListener(new OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent ev) { public boolean onTouch(View v, MotionEvent ev) {
float x = ev.getRawX(); float x = ev.getRawX() - insetLeft;
float y = ev.getRawY(); float y = ev.getRawY() - insetTop;
Logger.d(TAG, "[onTouch]:page:" + page + " action=" + str(ev.getAction()) + ", count=" + ev.getPointerCount()+ " x=" + x + " y=" + y); Logger.d(TAG, "[onTouch]:page:" + page + " action=" + str(ev.getAction()) + ", count=" + ev.getPointerCount()+ " x=" + x + " y=" + y);
switch (ev.getAction() & MotionEvent.ACTION_MASK) { switch (ev.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
// 中サイズのサムネイル表示 // 中サイズのサムネイル表示
...@@ -254,7 +279,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -254,7 +279,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
} }
int pageX = (int) (firstCenterX + newPage * interval); // 現在ページ(大サムネイルの表示ページ)のx座標(さらに正確にするには各小サムネイル間のページ数で割って計算すべきだが) int pageX = (int) (firstCenterX + newPage * interval); // 現在ページ(大サムネイルの表示ページ)のx座標(さらに正確にするには各小サムネイル間のページ数で割って計算すべきだが)
Logger.d(TAG, "newPage=" + newPage+ " x=" + x + " y=" + y + " firstX=" + firstCenterX + " lastX=" + lastCenterX + " interval=" + interval + " pageX=" + pageX); Logger.d(TAG, "newPage=" + newPage+ " x=" + x + " y=" + y + " firstX=" + firstCenterX + " lastX=" + lastCenterX + " interval=" + interval + " pageX=" + pageX);
if (x < pageX - interval && newPage > 0) { // 前のページ if (x < pageX - interval && newPage > 0) { // 前のページ
newPage = (int) ((x - firstCenterX + interval) / interval); newPage = (int) ((x - firstCenterX + interval) / interval);
} }
...@@ -264,7 +289,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -264,7 +289,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
else { else {
break; break;
} }
if (newPage >= 0 && newPage < maxPageCount) { if (newPage >= 0 && newPage < maxPageCount) {
// 中サイズのサムネイル表示 // 中サイズのサムネイル表示
showMidThum(newPage, (int) (x - (isLandscapeView? mPdfThumbnailProvider.landWidthM: mPdfThumbnailProvider.portWidthM) / 2)); showMidThum(newPage, (int) (x - (isLandscapeView? mPdfThumbnailProvider.landWidthM: mPdfThumbnailProvider.portWidthM) / 2));
...@@ -276,10 +301,9 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -276,10 +301,9 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
} }
} }
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
mSeekingFlag = false;
if (getContext() instanceof ContentViewActivity) { if (getContext() instanceof ContentViewActivity) {
((ContentViewActivity)getContext()).jumpToPage(newPage>=0 && newPage<maxPageCount? newPage: page); // ページ遷移 ((ContentViewActivity)getContext()).jumpToPage(newPage>=0 && newPage<maxPageCount? newPage: page); // ページ遷移
((ContentViewActivity)getContext()).setToolbarVisable(false); ((ContentViewActivity)getContext()).setToolbarVisable(false);
...@@ -289,6 +313,9 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -289,6 +313,9 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
((GuideViewActivity)getContext()).setToolbarVisable(false); ((GuideViewActivity)getContext()).setToolbarVisable(false);
((GuideViewActivity)getContext()).removeLargeThumView(); ((GuideViewActivity)getContext()).removeLargeThumView();
} }
v.post(() -> {
mSeekingFlag = false;
});
clearImageView(); clearImageView();
newPage = -1; newPage = -1;
break; break;
...@@ -444,7 +471,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout { ...@@ -444,7 +471,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
else { else {
clearImageView(); clearImageView();
} }
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(midWidth, midHeight); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(midWidth, midHeight);
params.setMargins(left, marginM, marginM, marginM); params.setMargins(left, marginM, marginM, marginM);
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
......
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