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
090132ea
Commit
090132ea
authored
Apr 15, 2021
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #41332 「イメージプレビュー」を設定したアクションボタンをタップしても反応がない
parent
3d1d8b46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
13 deletions
+60
-13
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/ContentViewActivity.java
+2
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PreviewActivity.java
+58
-13
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/ContentViewActivity.java
View file @
090132ea
...
@@ -3693,6 +3693,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
...
@@ -3693,6 +3693,8 @@ public class ContentViewActivity extends ABVContentViewActivity {
for
(
int
i
=
0
;
i
<
imagefile
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
imagefile
.
size
();
i
++)
{
intent_
.
putExtra
(
"FILEPATH"
+
(
i
+
1
),
mContentDir
+
"/"
+
imagefile
.
get
(
i
));
intent_
.
putExtra
(
"FILEPATH"
+
(
i
+
1
),
mContentDir
+
"/"
+
imagefile
.
get
(
i
));
}
}
intent_
.
putExtra
(
"imageSize"
,
imagefile
.
size
());
intent_
.
putExtra
(
"Position"
,
0
);
intent_
.
putExtra
(
"Position"
,
0
);
intent_
.
putExtra
(
ABookKeys
.
CONTENT_ID
,
getContentId
());
intent_
.
putExtra
(
ABookKeys
.
CONTENT_ID
,
getContentId
());
intent_
.
putExtra
(
"pageNumber"
,
mCurrentPageNumber
);
intent_
.
putExtra
(
"pageNumber"
,
mCurrentPageNumber
);
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PreviewActivity.java
View file @
090132ea
...
@@ -8,6 +8,7 @@ import jp.agentec.abook.abv.cl.util.ContentLogUtil;
...
@@ -8,6 +8,7 @@ import jp.agentec.abook.abv.cl.util.ContentLogUtil;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity
;
import
jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.DisplayUtil
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.viewer.view.ActionZoomLayout
;
import
jp.agentec.abook.abv.ui.viewer.view.ActionZoomLayout
;
...
@@ -16,7 +17,8 @@ import org.json.adf.JSONObject;
...
@@ -16,7 +17,8 @@ import org.json.adf.JSONObject;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap.Config
;
import
android.graphics.Bitmap.Config
;
import
android.net.Uri
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Point
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
...
@@ -47,6 +49,10 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -47,6 +49,10 @@ public class PreviewActivity extends ABVContentViewActivity {
private
int
mHistoryImageIndex
[]
=
new
int
[
2
];
private
int
mHistoryImageIndex
[]
=
new
int
[
2
];
private
int
objectLogId
;
private
int
objectLogId
;
// 実際に描画するBitmap
// Androidの仕様で100MB以上のBitmapは扱えないため、アスペクト比を保存した状態でリサイズしたもの)
private
Bitmap
FripperBitmap
[];
@Override
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
public
void
onCreate
(
Bundle
savedInstanceState
)
{
Logger
.
i
(
TAG
,
"onCreate"
);
Logger
.
i
(
TAG
,
"onCreate"
);
...
@@ -60,8 +66,7 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -60,8 +66,7 @@ public class PreviewActivity extends ABVContentViewActivity {
LinearLayout
.
LayoutParams
paramMain
=
new
LinearLayout
.
LayoutParams
(
matchParent
,
matchParent
);
LinearLayout
.
LayoutParams
paramMain
=
new
LinearLayout
.
LayoutParams
(
matchParent
,
matchParent
);
mZoomLayout
.
addView
(
getLayoutInflater
().
inflate
(
R
.
layout
.
ac_preview
,
null
),
paramMain
);
mZoomLayout
.
addView
(
getLayoutInflater
().
inflate
(
R
.
layout
.
ac_preview
,
null
),
paramMain
);
setContentView
(
mZoomLayout
);
setContentView
(
mZoomLayout
);
mMaxImg
=
0
;
// 画像数の取得
// 画像数の取得
Intent
intent
=
getIntent
();
Intent
intent
=
getIntent
();
if
(
objectId
!=
-
1
||
ABVEnvironment
.
getInstance
().
disableLogSend
)
{
if
(
objectId
!=
-
1
||
ABVEnvironment
.
getInstance
().
disableLogSend
)
{
...
@@ -70,14 +75,7 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -70,14 +75,7 @@ public class PreviewActivity extends ABVContentViewActivity {
}
}
objectLogId
=
intent
.
getIntExtra
(
"objectLogId"
,
-
1
);
objectLogId
=
intent
.
getIntExtra
(
"objectLogId"
,
-
1
);
mPosition
=
intent
.
getIntExtra
(
"Position"
,
0
);
mPosition
=
intent
.
getIntExtra
(
"Position"
,
0
);
mMaxImg
=
intent
.
getIntExtra
(
"imageSize"
,
0
);
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
if
(
intent
.
getStringExtra
(
"FILEPATH"
+
(
i
+
1
))
==
null
)
{
break
;
}
else
{
mMaxImg
++;
}
}
mViewFlipper
=
(
ViewFlipper
)
findViewById
(
R
.
id
.
viewFlipperPreview
);
mViewFlipper
=
(
ViewFlipper
)
findViewById
(
R
.
id
.
viewFlipperPreview
);
mLayoutThumbnail
=
(
LinearLayout
)
findViewById
(
R
.
id
.
layoutThumbnail
);
mLayoutThumbnail
=
(
LinearLayout
)
findViewById
(
R
.
id
.
layoutThumbnail
);
...
@@ -96,6 +94,7 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -96,6 +94,7 @@ public class PreviewActivity extends ABVContentViewActivity {
finishActivity
();
finishActivity
();
return
;
return
;
}
else
{
}
else
{
// 画面下の画像ボタン作成
float
tmpDensity
=
getResources
().
getDisplayMetrics
().
density
;
float
tmpDensity
=
getResources
().
getDisplayMetrics
().
density
;
Bitmap
resized
=
BitmapUtil
.
getResizedBitmap
(
mFilePath
[
i
],
(
int
)(
50
*
tmpDensity
+
0.5f
),
(
int
)(
50
*
tmpDensity
+
0.5f
),
Config
.
RGB_565
,
false
);
Bitmap
resized
=
BitmapUtil
.
getResizedBitmap
(
mFilePath
[
i
],
(
int
)(
50
*
tmpDensity
+
0.5f
),
(
int
)(
50
*
tmpDensity
+
0.5f
),
Config
.
RGB_565
,
false
);
imgBtn
[
i
].
setImageBitmap
(
resized
);
imgBtn
[
i
].
setImageBitmap
(
resized
);
...
@@ -109,10 +108,13 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -109,10 +108,13 @@ public class PreviewActivity extends ABVContentViewActivity {
mLayoutThumbnail
.
addView
(
imgBtn
[
i
],
paramThumbnail
);
mLayoutThumbnail
.
addView
(
imgBtn
[
i
],
paramThumbnail
);
setBtnClick
(
imgBtn
[
i
],
i
);
setBtnClick
(
imgBtn
[
i
],
i
);
}
}
// 数が多い可能性もあるので、最初の1枚目のみBitmap作成してViewに追加する
ImageView
flipperImageView
=
new
ImageView
(
this
);
ImageView
flipperImageView
=
new
ImageView
(
this
);
flipperImageView
.
setScaleType
(
ScaleType
.
CENTER_INSIDE
);
flipperImageView
.
setScaleType
(
ScaleType
.
CENTER_INSIDE
);
flipperImageView
.
setAdjustViewBounds
(
true
);
flipperImageView
.
setAdjustViewBounds
(
true
);
flipperImageView
.
setImageURI
(
Uri
.
parse
(
mFilePath
[
0
]));
FripperBitmap
=
new
Bitmap
[
mMaxImg
];
FripperBitmap
[
0
]
=
resizeBitmap
(
mFilePath
[
0
]);
flipperImageView
.
setImageBitmap
(
FripperBitmap
[
0
]);
LinearLayout
.
LayoutParams
param
=
new
LinearLayout
.
LayoutParams
(
wrapContent
,
wrapContent
);
LinearLayout
.
LayoutParams
param
=
new
LinearLayout
.
LayoutParams
(
wrapContent
,
wrapContent
);
mFlipperLayout
[
0
].
addView
(
flipperImageView
,
param
);
mFlipperLayout
[
0
].
addView
(
flipperImageView
,
param
);
mHistoryImageIndex
[
0
]
=
1
;
mHistoryImageIndex
[
0
]
=
1
;
...
@@ -228,7 +230,11 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -228,7 +230,11 @@ public class PreviewActivity extends ABVContentViewActivity {
ImageView
flipperImageView
=
new
ImageView
(
this
);
ImageView
flipperImageView
=
new
ImageView
(
this
);
flipperImageView
.
setScaleType
(
ScaleType
.
FIT_CENTER
);
//CENTER_INSIDE
flipperImageView
.
setScaleType
(
ScaleType
.
FIT_CENTER
);
//CENTER_INSIDE
flipperImageView
.
setAdjustViewBounds
(
true
);
flipperImageView
.
setAdjustViewBounds
(
true
);
flipperImageView
.
setImageURI
(
Uri
.
parse
(
mFilePath
[
index
]));
if
(
FripperBitmap
[
index
]
==
null
)
{
// 表示用Bitmapがない時は作成。
FripperBitmap
[
index
]
=
resizeBitmap
(
mFilePath
[
index
]);
}
flipperImageView
.
setImageBitmap
(
FripperBitmap
[
index
]);
int
MP
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
int
MP
=
ViewGroup
.
LayoutParams
.
MATCH_PARENT
;
LinearLayout
.
LayoutParams
param
=
new
LinearLayout
.
LayoutParams
(
MP
,
MP
);
LinearLayout
.
LayoutParams
param
=
new
LinearLayout
.
LayoutParams
(
MP
,
MP
);
mFlipperLayout
[
index
].
removeAllViews
();
mFlipperLayout
[
index
].
removeAllViews
();
...
@@ -318,4 +324,42 @@ public class PreviewActivity extends ABVContentViewActivity {
...
@@ -318,4 +324,42 @@ public class PreviewActivity extends ABVContentViewActivity {
super
.
onStop
();
super
.
onStop
();
ContentLogUtil
.
getInstance
().
endObjectLog
(
getContentId
(),
objectLogId
);
ContentLogUtil
.
getInstance
().
endObjectLog
(
getContentId
(),
objectLogId
);
}
}
/**
* アスペクト比を維持して、横に引き延ばしたBitmapを作成する
* @param filePath ファイルパス
* @return リサイズしたBitmap
*/
private
Bitmap
resizeBitmap
(
String
filePath
)
{
// ディスプレイ情報取得
Point
point
=
DisplayUtil
.
getDisplaySize
(
this
);
int
dispWidth
=
point
.
x
;
int
dispHeight
=
point
.
y
;
// Bitmap情報取得
BitmapFactory
.
Options
options
=
BitmapUtil
.
getBitmapDimensions
(
filePath
);
int
bitmapWidth
=
options
.
outWidth
;
int
bitmpaHeight
=
options
.
outHeight
;
// 変更するサイズを計算
int
targetW
;
int
targetH
;
if
(
bitmapWidth
>
bitmpaHeight
)
{
targetW
=
dispWidth
;
targetH
=
(
int
)
((
float
)
bitmpaHeight
*
(
float
)
dispWidth
/
(
float
)
bitmapWidth
);
if
(
targetH
>
dispHeight
)
{
targetH
=
dispHeight
;
targetW
=
(
int
)
((
float
)
bitmapWidth
*
(
float
)
dispHeight
/
(
float
)
bitmpaHeight
);
}
}
else
{
targetH
=
dispHeight
;
targetW
=
(
int
)
((
float
)
bitmapWidth
*
(
float
)
dispHeight
/
(
float
)
bitmpaHeight
);
if
(
targetW
>
dispWidth
)
{
targetW
=
dispWidth
;
targetH
=
(
int
)
((
float
)
bitmpaHeight
*
(
float
)
dispWidth
/
(
float
)
bitmapWidth
);
}
}
return
BitmapUtil
.
getResizedBitmap
(
filePath
,
targetW
,
targetH
,
Config
.
RGB_565
,
true
);
}
}
}
\ No newline at end of file
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