Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
caa90eef
Commit
caa90eef
authored
Sep 18, 2025
by
Kang Donghun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#67472 画面の上と下にあるボタンが、端末のボタンに覆われ操作できない(Android15対応)
parent
95e80a19
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
72 deletions
+83
-72
ABVJE_Launcher_Android/AndroidManifest.xml
+2
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVActivity.java
+0
-7
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+0
-26
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/util/DisplayUtil.java
+25
-3
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/GuideViewActivity.java
+7
-8
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/ContentViewActivity.java
+13
-13
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/view/ThumbnailSeekBarLayout.java
+36
-13
No files found.
ABVJE_Launcher_Android/AndroidManifest.xml
View file @
caa90eef
...
@@ -166,8 +166,8 @@
...
@@ -166,8 +166,8 @@
<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=
"
fals
e"
android:hardwareAccelerated=
"
tru
e"
android:theme=
"@
style/Theme_fits_full
"
/>
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"
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVActivity.java
View file @
caa90eef
...
@@ -28,7 +28,6 @@ import android.provider.MediaStore;
...
@@ -28,7 +28,6 @@ import android.provider.MediaStore;
import
android.provider.Settings
;
import
android.provider.Settings
;
import
android.provider.Settings.SettingNotFoundException
;
import
android.provider.Settings.SettingNotFoundException
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.DisplayMetrics
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater.Factory
;
import
android.view.LayoutInflater.Factory
;
...
@@ -802,12 +801,6 @@ public abstract class ABVActivity extends Activity {
...
@@ -802,12 +801,6 @@ public abstract class ABVActivity extends Activity {
return
(
int
)(
getResources
().
getDisplayMetrics
().
density
*
size
);
return
(
int
)(
getResources
().
getDisplayMetrics
().
density
*
size
);
}
}
protected
int
convertBarRatio
()
{
DisplayMetrics
metrics
=
getResources
().
getDisplayMetrics
();
int
screenHeight
=
isOrientationPortrait
()
?
metrics
.
heightPixels
:
metrics
.
widthPixels
;
return
(
int
)
(
screenHeight
*
0.0015
);
}
/**
/**
* アプリを終了orバックグラウンドに行った場合の時間を記録
* アプリを終了orバックグラウンドに行った場合の時間を記録
*/
*/
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
caa90eef
...
@@ -8,7 +8,6 @@ import android.content.pm.ActivityInfo;
...
@@ -8,7 +8,6 @@ import android.content.pm.ActivityInfo;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.location.Location
;
import
android.location.Location
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
...
@@ -95,10 +94,6 @@ import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportS
...
@@ -95,10 +94,6 @@ import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportS
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskKey
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskKey
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskReportId
;
import
static
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
.
OperationDataJSON
.
TaskReportId
;
import
androidx.core.view.OnApplyWindowInsetsListener
;
import
androidx.core.view.ViewCompat
;
import
androidx.core.view.WindowInsetsCompat
;
public
abstract
class
ABVContentViewActivity
extends
ABVAuthenticatedActivity
{
public
abstract
class
ABVContentViewActivity
extends
ABVAuthenticatedActivity
{
private
static
final
String
TAG
=
"ABVContentViewActivity"
;
private
static
final
String
TAG
=
"ABVContentViewActivity"
;
...
@@ -158,7 +153,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -158,7 +153,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected
boolean
mAddReport
;
// 作業追加区分
protected
boolean
mAddReport
;
// 作業追加区分
private
boolean
mLocationSendResult
;
// GPS送信フラグ
private
boolean
mLocationSendResult
;
// GPS送信フラグ
protected
boolean
isOver35
=
false
;
@SuppressLint
(
"SourceLockedOrientationActivity"
)
@SuppressLint
(
"SourceLockedOrientationActivity"
)
@Override
@Override
...
@@ -174,7 +168,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -174,7 +168,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
path
=
intent
.
getStringExtra
(
"path"
);
path
=
intent
.
getStringExtra
(
"path"
);
isLinkedContent
=
intent
.
getBooleanExtra
(
"isLinkedContent"
,
false
);
isLinkedContent
=
intent
.
getBooleanExtra
(
"isLinkedContent"
,
false
);
mOperationId
=
intent
.
getLongExtra
(
ABookKeys
.
OPERATION_ID
,
-
1
);
mOperationId
=
intent
.
getLongExtra
(
ABookKeys
.
OPERATION_ID
,
-
1
);
isOver35
=
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
UPSIDE_DOWN_CAKE
;
if
(!
isLinkedContent
)
{
if
(!
isLinkedContent
)
{
operationDto
=
AbstractLogic
.
getLogic
(
OperationLogic
.
class
).
getOperation
(
mOperationId
);
operationDto
=
AbstractLogic
.
getLogic
(
OperationLogic
.
class
).
getOperation
(
mOperationId
);
...
@@ -1392,23 +1385,4 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
...
@@ -1392,23 +1385,4 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
return
null
;
return
null
;
}
}
}
}
/**
* Android15以上バージョンOSでPDFのサムネイルが覆われ操作できないこと対応
*
* @param view
*/
protected
void
setLayoutInsets
(
View
view
)
{
ViewCompat
.
setOnApplyWindowInsetsListener
(
view
,
new
OnApplyWindowInsetsListener
()
{
@Override
public
WindowInsetsCompat
onApplyWindowInsets
(
View
v
,
WindowInsetsCompat
insets
)
{
int
navBarHeight
=
insets
.
getSystemWindowInsetBottom
();
RelativeLayout
.
LayoutParams
lp
=
(
RelativeLayout
.
LayoutParams
)
v
.
getLayoutParams
();
lp
.
bottomMargin
=
navBarHeight
;
v
.
setLayoutParams
(
lp
);
return
insets
;
}
});
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/util/DisplayUtil.java
View file @
caa90eef
...
@@ -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
);
int
displayWidth
;
int
displayHeight
;
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
()
);
displayWidth
=
bounds
.
width
()
-
(
insets
.
left
+
insets
.
right
);
displayHeight
=
bounds
.
height
()
-
(
insets
.
top
+
insets
.
bottom
);
}
else
{
Display
display
=
wm
.
getDefaultDisplay
();
Display
display
=
wm
.
getDefaultDisplay
();
Point
outSize
=
new
Point
();
Point
size
=
new
Point
();
display
.
getSize
(
outSize
);
display
.
getSize
(
size
);
return
outSize
;
displayWidth
=
size
.
x
;
displayHeight
=
size
.
y
;
}
return
new
Point
(
displayWidth
,
displayHeight
);
}
}
public
static
Size
getDisplaySize2
(
Context
context
)
{
public
static
Size
getDisplaySize2
(
Context
context
)
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/GuideViewActivity.java
View file @
caa90eef
...
@@ -467,21 +467,20 @@ public class GuideViewActivity extends ABVContentViewActivity {
...
@@ -467,21 +467,20 @@ public class GuideViewActivity extends ABVContentViewActivity {
hasMultiPages
=
mAllPageCount
>
1
;
hasMultiPages
=
mAllPageCount
>
1
;
if
(
hasMultiPages
)
{
// サムネイルバーとページ番号表示
if
(
hasMultiPages
)
{
// サムネイルバーとページ番号表示
mPageNumberLayout
=
(
RelativeLayout
)
getLayoutInflater
().
inflate
(
R
.
layout
.
page_number
,
null
);
mPageNumberLayout
=
(
RelativeLayout
)
getLayoutInflater
().
inflate
(
R
.
layout
.
page_number
,
null
);
int
height
=
isOver35
?
(
int
)
(
isNormalSize
()
?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
*
getResources
().
getDisplayMetrics
().
density
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
*
convertBarRatio
())
int
height
=
(
int
)
((
isNormalSize
()?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
)
*
getResources
().
getDisplayMetrics
().
density
);
// サムネイルバーの高さ
:
(
int
)
((
isNormalSize
()
?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
)
*
getResources
().
getDisplayMetrics
().
density
);
mLThumViewSize
=
(
int
)
(
200
*
(
float
)
height
/
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
);
// 大サムネイル表示領域の設定
mLThumViewSize
=
(
int
)
((
isOver35
?
150
:
200
)
*
(
float
)
height
/
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
);
// 大サムネイル表示領域の設定
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
);
if
(
isOver35
&&
isNormalSize
())
{
mMainLayout
.
setFitsSystemWindows
(
true
);
setLayoutInsets
(
mSeekBarLayout
);
}
mPageNumberLayout
.
setVisibility
(
View
.
INVISIBLE
);
mPageNumberLayout
.
setVisibility
(
View
.
INVISIBLE
);
RelativeLayout
.
LayoutParams
param
=
createParam
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
(
int
)
((
isOver35
?
50
*
convertBarRatio
()
:
convertDensitySize
(
50
)
)
+
0.5f
));
RelativeLayout
.
LayoutParams
param
=
createParam
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
(
int
)(
convertDensitySize
(
50
)
+
0.5f
));
param
.
setMargins
(
0
,
0
,
0
,
10
);
param
.
setMargins
(
0
,
0
,
0
,
10
);
param
.
addRule
(
RelativeLayout
.
ABOVE
,
mSeekBarLayout
.
getId
());
param
.
addRule
(
RelativeLayout
.
ABOVE
,
mSeekBarLayout
.
getId
());
mMainLayout
.
addView
(
mPageNumberLayout
,
param
);
mMainLayout
.
addView
(
mPageNumberLayout
,
param
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/ContentViewActivity.java
View file @
caa90eef
...
@@ -23,7 +23,6 @@ import android.graphics.RectF;
...
@@ -23,7 +23,6 @@ import android.graphics.RectF;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.preference.PreferenceManager
;
import
android.preference.PreferenceManager
;
...
@@ -41,6 +40,8 @@ import android.view.View.OnKeyListener;
...
@@ -41,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
;
...
@@ -606,15 +607,15 @@ public class ContentViewActivity extends ABVContentViewActivity {
...
@@ -606,15 +607,15 @@ 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
));
...
@@ -628,21 +629,20 @@ public class ContentViewActivity extends ABVContentViewActivity {
...
@@ -628,21 +629,20 @@ public class ContentViewActivity extends ABVContentViewActivity {
hasMultiPages
=
mAllPageCount
>
1
;
hasMultiPages
=
mAllPageCount
>
1
;
if
(
hasMultiPages
)
{
// サムネイルバーとページ番号表示
if
(
hasMultiPages
)
{
// サムネイルバーとページ番号表示
mPageNumberLayout
=
(
RelativeLayout
)
getLayoutInflater
().
inflate
(
R
.
layout
.
page_number
,
null
);
mPageNumberLayout
=
(
RelativeLayout
)
getLayoutInflater
().
inflate
(
R
.
layout
.
page_number
,
null
);
int
height
=
isOver35
?
(
int
)
(
isNormalSize
()
?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
*
getResources
().
getDisplayMetrics
().
density
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
*
convertBarRatio
())
int
height
=
(
int
)
((
isNormalSize
()?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
)
*
getResources
().
getDisplayMetrics
().
density
);
// サムネイルバーの高さ
:
(
int
)
((
isNormalSize
()
?
ThumbnailSeekBarLayout
.
NORMAL_HEIGHT
:
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
)
*
getResources
().
getDisplayMetrics
().
density
);
mLThumViewSize
=
(
int
)
(
200
*
(
float
)
height
/
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
);
// 大サムネイル表示領域の設定
mLThumViewSize
=
(
int
)
((
isOver35
?
150
:
200
)
*
(
float
)
height
/
ThumbnailSeekBarLayout
.
LARGE_HEIGHT
);
// 大サムネイル表示領域の設定
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
);
if
(
isOver35
&&
isNormalSize
())
{
mMainLayout
.
setFitsSystemWindows
(
true
);
setLayoutInsets
(
mSeekBarLayout
);
}
mPageNumberLayout
.
setVisibility
(
View
.
INVISIBLE
);
mPageNumberLayout
.
setVisibility
(
View
.
INVISIBLE
);
RelativeLayout
.
LayoutParams
param
=
createParam
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
(
int
)
((
isOver35
?
50
*
convertBarRatio
()
:
convertDensitySize
(
50
)
)
+
0.5f
));
RelativeLayout
.
LayoutParams
param
=
createParam
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
(
int
)(
convertDensitySize
(
50
)
+
0.5f
));
param
.
setMargins
(
0
,
0
,
0
,
10
);
param
.
setMargins
(
0
,
0
,
0
,
10
);
param
.
addRule
(
RelativeLayout
.
ABOVE
,
mSeekBarLayout
.
getId
());
param
.
addRule
(
RelativeLayout
.
ABOVE
,
mSeekBarLayout
.
getId
());
mMainLayout
.
addView
(
mPageNumberLayout
,
param
);
mMainLayout
.
addView
(
mPageNumberLayout
,
param
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/view/ThumbnailSeekBarLayout.java
View file @
caa90eef
...
@@ -21,6 +21,7 @@ import android.graphics.Bitmap;
...
@@ -21,6 +21,7 @@ import android.graphics.Bitmap;
import
android.graphics.Bitmap.Config
;
import
android.graphics.Bitmap.Config
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory.Options
;
import
android.graphics.BitmapFactory.Options
;
import
android.graphics.PointF
;
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.Build
;
...
@@ -31,6 +32,9 @@ import android.view.LayoutInflater;
...
@@ -31,6 +32,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
;
...
@@ -88,7 +92,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -88,7 +92,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
private
boolean
isReady
;
private
boolean
isReady
;
private
boolean
mSeekingFlag
=
false
;
private
boolean
mSeekingFlag
=
false
;
private
boolean
isOver35
=
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
)
{
public
ThumbnailSeekBarLayout
(
Context
context
,
FoxitPdfCore
foxitPdfCore
,
long
contentId
,
int
maxPageCount
,
boolean
isLandscapeView
,
int
displayWidth
,
int
displayHeight
,
boolean
isNormalSize
,
RelativeLayout
pageNumberLayout
)
{
...
@@ -102,9 +106,9 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -102,9 +106,9 @@ 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
);
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
UPSIDE_DOWN_CAKE
)
{
//
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
isOver35
=
true
;
//
isOver35 = true;
}
//
}
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
));
...
@@ -114,9 +118,11 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -114,9 +118,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
;
...
@@ -221,23 +227,42 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -221,23 +227,42 @@ 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
:
// 中サイズのサムネイル表示
// 中サイズのサムネイル表示
showMidThum
(
page
,
(
isOver35
?
v
.
getLeft
()
:
((
View
)
v
.
getParent
()).
getLeft
()
+
v
.
getLeft
())
-
(
isLandscapeView
?
landWidthDiffMS:
portWidthDiffMS
)
/
2
);
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
)
{
if
(
getContext
()
instanceof
ContentViewActivity
)
{
int
left
=
((
View
)
v
.
getParent
()).
getLeft
()
+
v
.
getLeft
()
+
v
.
getWidth
()
/
2
-
((
ContentViewActivity
)
getContext
()).
getLThumViewSize
()
/
2
;
int
left
=
((
View
)
v
.
getParent
()).
getLeft
()
+
v
.
getLeft
()
+
v
.
getWidth
()
/
2
-
((
ContentViewActivity
)
getContext
()).
getLThumViewSize
()
/
2
;
...
@@ -258,7 +283,6 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -258,7 +283,6 @@ 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
);
}
}
...
@@ -268,7 +292,6 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -268,7 +292,6 @@ 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
));
...
@@ -538,7 +561,8 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -538,7 +561,8 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
}
}
else
{
else
{
ImageView
imageView
=
(
ImageView
)
linearLayout
.
getChildAt
(
pageIndex
);
ImageView
imageView
=
(
ImageView
)
linearLayout
.
getChildAt
(
pageIndex
);
showMidThum
(
page
,
(
isOver35
?
imageView
.
getLeft
()
:
linearLayout
.
getLeft
()
+
imageView
.
getLeft
())
-
(
isLandscapeView
?
landWidthDiffMS:
portWidthDiffMS
)
/
2
);
showMidThum
(
page
,
linearLayout
.
getLeft
()
+
imageView
.
getLeft
()
-
(
isLandscapeView
?
landWidthDiffMS:
portWidthDiffMS
)
/
2
);
// showMidThum(page, (isOver35 ? imageView.getLeft() : linearLayout.getLeft() + imageView.getLeft()) - (isLandscapeView?landWidthDiffMS:portWidthDiffMS) / 2);
}
}
}
}
...
@@ -566,7 +590,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -566,7 +590,7 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
private
void
loadInterval
()
{
private
void
loadInterval
()
{
ImageView
firstView
=
(
ImageView
)
linearLayout
.
getChildAt
(
0
);
ImageView
firstView
=
(
ImageView
)
linearLayout
.
getChildAt
(
0
);
ImageView
lastView
=
(
ImageView
)
linearLayout
.
getChildAt
(
linearLayout
.
getChildCount
()
-
1
);
ImageView
lastView
=
(
ImageView
)
linearLayout
.
getChildAt
(
linearLayout
.
getChildCount
()
-
1
);
firstLeftX
=
isOver35
?
(
linearLayout
.
getLeft
()
>
firstView
.
getLeft
()
?
linearLayout
.
getLeft
()
:
firstView
.
getLeft
())
:
firstView
.
getLeft
();
firstLeftX
=
firstView
.
getLeft
();
firstCenterX
=
firstLeftX
+
firstView
.
getWidth
()
/
2
;
firstCenterX
=
firstLeftX
+
firstView
.
getWidth
()
/
2
;
lastCenterX
=
lastView
.
getLeft
()
+
lastView
.
getWidth
()
/
2
;
lastCenterX
=
lastView
.
getLeft
()
+
lastView
.
getWidth
()
/
2
;
interval
=
(
lastCenterX
-
firstCenterX
)
/
(
float
)(
maxPageCount
-
1
);
interval
=
(
lastCenterX
-
firstCenterX
)
/
(
float
)(
maxPageCount
-
1
);
...
@@ -596,5 +620,4 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
...
@@ -596,5 +620,4 @@ public class ThumbnailSeekBarLayout extends LinearLayout {
public
boolean
isSeeking
()
{
public
boolean
isSeeking
()
{
return
mSeekingFlag
;
return
mSeekingFlag
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment