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
2119dc38
Commit
2119dc38
authored
Jul 08, 2019
by
Jeong Gilmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#33721 手書きパレット機能の追加
- 課題表のNo.37 スマートフォンで報告画面からフォームを開き、 添付画像を縦画像で添付して手書きパレット表示時、下の部分が切れて表示される。 について修正
parent
ecd97466
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
27 deletions
+26
-27
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PhotoEditActivity.java
+26
-27
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PhotoEditActivity.java
View file @
2119dc38
...
...
@@ -37,6 +37,7 @@ public class PhotoEditActivity extends Dialog {
private
final
String
TAG
=
"PhotoEditActivity"
;
private
final
String
editToolPath
=
"file:///android_asset/Drawing/index.html"
;
//EditToolのパス。
private
final
String
editToolName
=
"Drawing"
;
//EditToolの名
private
final
float
screenToDialogRatio
=
0.8f
;
// 編集画面のタイアローグに表示するイメージの比率
private
WebView
editPageWebView
;
//ダイアローグの上に編集画面をロード
private
Bitmap
bitmapOfPhoto
;
//写真のBitmap情報
private
int
photoWidth
;
...
...
@@ -44,7 +45,6 @@ public class PhotoEditActivity extends Dialog {
private
String
photoFilePath
;
//ロードして修正するファイルのパス
private
JsInf
jsInf
=
new
JsInf
();
//Javascript Interface
private
Context
context
;
private
int
screenRequestedOrientation
;
/**
* 生成される時、イメージパスを取得。
...
...
@@ -80,25 +80,29 @@ public class PhotoEditActivity extends Dialog {
Window
window
=
((
Activity
)
context
).
getWindow
();
window
.
getDecorView
().
getWindowVisibleDisplayFrame
(
displayRectangle
);
//画面の方向によってダイアローグのサイズを決定
int
screenOrientation
=
context
.
getResources
().
getConfiguration
().
orientation
;
//画面の方向
switch
(
screenOrientation
){
case
Surface
.
ROTATION_0
:
case
Surface
.
ROTATION_180
:
//横
float
photoRatio
=
(
float
)
photoWidth
/
(
float
)
photoHeight
;
//画面の横と縦の割合
float
displayHeight
=
displayRectangle
.
height
()
*
0.9f
;
//画面の縦幅の90パーセント
float
displayWidth
=
displayRectangle
.
width
()
*
0.9f
;
//画面の横幅の90パーセント
int
dialogWidth
=
(
int
)
(
displayHeight
*
photoRatio
);
//ダイアローグの横幅を計算
if
(
dialogWidth
<
displayWidth
){
//計算した横幅が画面より小さい場合はそのまま設定
getWindow
().
setLayout
(
dialogWidth
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
else
{
//計算した横幅が画面より大き場合は画面の横幅に設定
if
(
getWindow
()
!=
null
)
{
//画面の方向によってダイアローグのサイズを決定
int
screenOrientation
=
context
.
getResources
().
getConfiguration
().
orientation
;
//画面の方向
switch
(
screenOrientation
)
{
case
Surface
.
ROTATION_0
:
case
Surface
.
ROTATION_180
:
//横
float
photoRatio
=
(
float
)
photoWidth
/
(
float
)
photoHeight
;
//画面の横と縦の割合
float
displayHeight
=
(
float
)
displayRectangle
.
height
()
*
screenToDialogRatio
;
//画面の縦幅の90パーセント
float
displayWidth
=
(
float
)
displayRectangle
.
width
()
*
screenToDialogRatio
;
//画面の横幅の90パーセント
int
dialogWidth
=
(
int
)
(
displayHeight
*
photoRatio
);
//ダイアローグの横幅を計算
if
(
dialogWidth
<
displayWidth
)
{
//計算した横幅が画面より小さい場合はそのまま設定
getWindow
().
setLayout
(
dialogWidth
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
//ViewGroup.LayoutParams.WRAP_CONTENT);
}
else
{
//計算した横幅が画面より大き場合は画面の横幅に設定
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
break
;
case
Surface
.
ROTATION_90
:
case
Surface
.
ROTATION_270
:
//縦
//画面方向が縦の場合、画面の横幅に設定
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
break
;
case
Surface
.
ROTATION_90
:
case
Surface
.
ROTATION_270
:
//縦
//画面方向が縦の場合、画面の横幅に設定
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
break
;
break
;
}
}
//クローズボタン
...
...
@@ -134,7 +138,7 @@ public class PhotoEditActivity extends Dialog {
if
(
url
.
contains
(
editToolName
))
{
//最初ページロードの場合
//ページロードの終了後のCanvas設定
float
photoRatio
=
(
float
)
(
bitmapOfPhoto
.
getHeight
())
/
(
float
)
bitmapOfPhoto
.
getWidth
()
;
//写真の割合を計算
float
photoRatio
=
(
float
)
photoHeight
/
(
float
)
photoWidth
;
//写真の割合を計算
view
.
loadUrl
(
String
.
format
(
"javascript:resizeCanvasToRatio(%f);"
,
photoRatio
));
//写真の割合によってCanvasのサイズを決める。
view
.
loadUrl
(
String
.
format
(
"javascript:setBackground('%s');"
,
photoFilePath
));
//Canvasの背景をイメージにする
}
...
...
@@ -239,6 +243,7 @@ public class PhotoEditActivity extends Dialog {
ABookAlertDialog
aBookAlertDialog
=
AlertDialogUtil
.
createAlertDialog
(
context
,
title
,
message
);
aBookAlertDialog
.
setIcon
(
R
.
drawable
.
icon
);
aBookAlertDialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
//OKボタンを押すと編集画面を閉じる
superDismiss
();
...
...
@@ -307,7 +312,7 @@ public class PhotoEditActivity extends Dialog {
* @param newHeight 新しい縦幅
* @return 変更したイメージを返す。
*/
p
ublic
static
Bitmap
scaleBitmap
(
Bitmap
bitmap
,
int
newWidth
,
int
newHeight
)
{
p
rivate
static
Bitmap
scaleBitmap
(
Bitmap
bitmap
,
int
newWidth
,
int
newHeight
)
{
Bitmap
scaledBitmap
=
Bitmap
.
createBitmap
(
newWidth
,
newHeight
,
Bitmap
.
Config
.
ARGB_8888
);
float
scaleX
=
newWidth
/
(
float
)
bitmap
.
getWidth
();
...
...
@@ -324,9 +329,4 @@ public class PhotoEditActivity extends Dialog {
return
scaledBitmap
;
}
@Override
public
void
onWindowAttributesChanged
(
WindowManager
.
LayoutParams
params
)
{
return
;
}
}
\ 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