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
8d3866b7
Commit
8d3866b7
authored
Jul 08, 2019
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'features/1.0.500_#33721' into 'feature/1.1.0'
Features/1.0.500 #33721 See merge request
!17
parents
f819c828
3ea100c1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PhotoEditActivity.java
+17
-18
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/PhotoEditActivity.java
View file @
8d3866b7
...
@@ -37,6 +37,7 @@ public class PhotoEditActivity extends Dialog {
...
@@ -37,6 +37,7 @@ public class PhotoEditActivity extends Dialog {
private
final
String
TAG
=
"PhotoEditActivity"
;
private
final
String
TAG
=
"PhotoEditActivity"
;
private
final
String
editToolPath
=
"file:///android_asset/Drawing/index.html"
;
//EditToolのパス。
private
final
String
editToolPath
=
"file:///android_asset/Drawing/index.html"
;
//EditToolのパス。
private
final
String
editToolName
=
"Drawing"
;
//EditToolの名
private
final
String
editToolName
=
"Drawing"
;
//EditToolの名
private
final
float
screenToDialogRatio
=
0.8f
;
// 編集画面のタイアローグに表示するイメージの比率
private
WebView
editPageWebView
;
//ダイアローグの上に編集画面をロード
private
WebView
editPageWebView
;
//ダイアローグの上に編集画面をロード
private
Bitmap
bitmapOfPhoto
;
//写真のBitmap情報
private
Bitmap
bitmapOfPhoto
;
//写真のBitmap情報
private
int
photoWidth
;
private
int
photoWidth
;
...
@@ -44,7 +45,6 @@ public class PhotoEditActivity extends Dialog {
...
@@ -44,7 +45,6 @@ public class PhotoEditActivity extends Dialog {
private
String
photoFilePath
;
//ロードして修正するファイルのパス
private
String
photoFilePath
;
//ロードして修正するファイルのパス
private
JsInf
jsInf
=
new
JsInf
();
//Javascript Interface
private
JsInf
jsInf
=
new
JsInf
();
//Javascript Interface
private
Context
context
;
private
Context
context
;
private
int
screenRequestedOrientation
;
/**
/**
* 生成される時、イメージパスを取得。
* 生成される時、イメージパスを取得。
...
@@ -80,26 +80,30 @@ public class PhotoEditActivity extends Dialog {
...
@@ -80,26 +80,30 @@ public class PhotoEditActivity extends Dialog {
Window
window
=
((
Activity
)
context
).
getWindow
();
Window
window
=
((
Activity
)
context
).
getWindow
();
window
.
getDecorView
().
getWindowVisibleDisplayFrame
(
displayRectangle
);
window
.
getDecorView
().
getWindowVisibleDisplayFrame
(
displayRectangle
);
if
(
getWindow
()
!=
null
)
{
//画面の方向によってダイアローグのサイズを決定
//画面の方向によってダイアローグのサイズを決定
int
screenOrientation
=
context
.
getResources
().
getConfiguration
().
orientation
;
//画面の方向
int
screenOrientation
=
context
.
getResources
().
getConfiguration
().
orientation
;
//画面の方向
switch
(
screenOrientation
){
switch
(
screenOrientation
)
{
case
Surface
.
ROTATION_0
:
case
Surface
.
ROTATION_180
:
//横
case
Surface
.
ROTATION_0
:
case
Surface
.
ROTATION_180
:
//横
float
photoRatio
=
(
float
)
photoWidth
/
(
float
)
photoHeight
;
//画面の横と縦の割合
float
photoRatio
=
(
float
)
photoWidth
/
(
float
)
photoHeight
;
//画面の横と縦の割合
float
displayHeight
=
displayRectangle
.
height
()
*
0.9f
;
//画面の縦幅の90パーセント
float
displayHeight
=
(
float
)
displayRectangle
.
height
()
*
screenToDialogRatio
;
//画面の縦幅の90パーセント
float
displayWidth
=
displayRectangle
.
width
()
*
0.9f
;
//画面の横幅の90パーセント
float
displayWidth
=
(
float
)
displayRectangle
.
width
()
*
screenToDialogRatio
;
//画面の横幅の90パーセント
int
dialogWidth
=
(
int
)
(
displayHeight
*
photoRatio
);
//ダイアローグの横幅を計算
int
dialogWidth
=
(
int
)
(
displayHeight
*
photoRatio
);
//ダイアローグの横幅を計算
if
(
dialogWidth
<
displayWidth
){
//計算した横幅が画面より小さい場合はそのまま設定
getWindow
().
setLayout
(
dialogWidth
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
if
(
dialogWidth
<
displayWidth
)
{
//計算した横幅が画面より小さい場合はそのまま設定
}
getWindow
().
setLayout
(
dialogWidth
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
//ViewGroup.LayoutParams.WRAP_CONTENT);
else
{
//計算した横幅が画面より大き場合は画面の横幅に設定
}
else
{
//計算した横幅が画面より大き場合は画面の横幅に設定
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
}
break
;
break
;
case
Surface
.
ROTATION_90
:
case
Surface
.
ROTATION_270
:
//縦
case
Surface
.
ROTATION_90
:
case
Surface
.
ROTATION_270
:
//縦
//画面方向が縦の場合、画面の横幅に設定
//画面方向が縦の場合、画面の横幅に設定
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
getWindow
().
setLayout
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
break
;
break
;
}
}
}
//クローズボタン
//クローズボタン
final
ImageButton
imageButton
=
findViewById
(
R
.
id
.
edit_page_close_btn
);
final
ImageButton
imageButton
=
findViewById
(
R
.
id
.
edit_page_close_btn
);
...
@@ -134,7 +138,7 @@ public class PhotoEditActivity extends Dialog {
...
@@ -134,7 +138,7 @@ public class PhotoEditActivity extends Dialog {
if
(
url
.
contains
(
editToolName
))
{
if
(
url
.
contains
(
editToolName
))
{
//最初ページロードの場合
//最初ページロードの場合
//ページロードの終了後のCanvas設定
//ページロードの終了後の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:resizeCanvasToRatio(%f);"
,
photoRatio
));
//写真の割合によってCanvasのサイズを決める。
view
.
loadUrl
(
String
.
format
(
"javascript:setBackground('%s');"
,
photoFilePath
));
//Canvasの背景をイメージにする
view
.
loadUrl
(
String
.
format
(
"javascript:setBackground('%s');"
,
photoFilePath
));
//Canvasの背景をイメージにする
}
}
...
@@ -239,6 +243,7 @@ public class PhotoEditActivity extends Dialog {
...
@@ -239,6 +243,7 @@ public class PhotoEditActivity extends Dialog {
ABookAlertDialog
aBookAlertDialog
=
AlertDialogUtil
.
createAlertDialog
(
context
,
title
,
message
);
ABookAlertDialog
aBookAlertDialog
=
AlertDialogUtil
.
createAlertDialog
(
context
,
title
,
message
);
aBookAlertDialog
.
setIcon
(
R
.
drawable
.
icon
);
aBookAlertDialog
.
setIcon
(
R
.
drawable
.
icon
);
aBookAlertDialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
aBookAlertDialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
//OKボタンを押すと編集画面を閉じる
//OKボタンを押すと編集画面を閉じる
superDismiss
();
superDismiss
();
...
@@ -307,7 +312,7 @@ public class PhotoEditActivity extends Dialog {
...
@@ -307,7 +312,7 @@ public class PhotoEditActivity extends Dialog {
* @param newHeight 新しい縦幅
* @param newHeight 新しい縦幅
* @return 変更したイメージを返す。
* @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
);
Bitmap
scaledBitmap
=
Bitmap
.
createBitmap
(
newWidth
,
newHeight
,
Bitmap
.
Config
.
ARGB_8888
);
float
scaleX
=
newWidth
/
(
float
)
bitmap
.
getWidth
();
float
scaleX
=
newWidth
/
(
float
)
bitmap
.
getWidth
();
...
@@ -324,9 +329,4 @@ public class PhotoEditActivity extends Dialog {
...
@@ -324,9 +329,4 @@ public class PhotoEditActivity extends Dialog {
return
scaledBitmap
;
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