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
979e70fa
Commit
979e70fa
authored
Sep 02, 2020
by
yuichiro ogawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
不要になった処理を削除
parent
2a2a26b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
283 deletions
+0
-283
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
+0
-283
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebviewActivity.java
View file @
979e70fa
...
...
@@ -9,22 +9,15 @@ import android.content.DialogInterface;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.res.Configuration
;
import
android.graphics.Bitmap
;
import
android.media.Image
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Looper
;
import
android.security.NetworkSecurityPolicy
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.Window
;
import
android.webkit.CookieManager
;
import
android.webkit.DownloadListener
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.JsResult
;
import
android.webkit.URLUtil
;
import
android.webkit.ValueCallback
;
import
android.webkit.WebChromeClient
;
import
android.webkit.WebSettings
;
...
...
@@ -36,26 +29,15 @@ import android.widget.LinearLayout;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.constant.ABookKeys
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.ABVDataCache
;
import
jp.agentec.abook.abv.bl.dto.CategoryContentDto
;
import
jp.agentec.abook.abv.bl.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.PushMessageDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.PushMessageLogic
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorCode
;
import
jp.agentec.abook.abv.ui.common.constant.ErrorMessage
;
...
...
@@ -63,10 +45,8 @@ import jp.agentec.abook.abv.ui.common.constant.NaviConsts;
import
jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
import
jp.agentec.abook.abv.ui.home.helper.ABookCheckWebViewHelper
;
import
jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper
;
import
jp.agentec.abook.abv.ui.viewer.activity.ParentWebViewActivity
;
import
jp.agentec.adf.util.FileUtil
;
/**
* Created by AIS-NB-048 on 2019/07/31.
...
...
@@ -92,10 +72,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private
BroadcastReceiver
receiver
;
// ユーザプロファイルの保存場所パス
private
static
final
String
ProfileDirFormat
=
"%s/ABook/operation/profileimages"
;
// private static final String ProfileImgDirFormat = "%s/ABook/operation/profileimages/images";
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -345,18 +321,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
return
false
;
}
// @Override
// public void onPageFinished(WebView view, String url) {
// //ページロードの終了後の処理
// super.onPageFinished(view, url);
// if (url.contains("newstart")) {
// //最初ページロードの場合
// //ページロードの終了後のCanvas設定
// view.loadUrl(String.format("javascript:roomInfo(%s, %s, %s, %s, %s);", sid, loginId, shopName, roomId, roomName)); //写真の割合によってCanvasのサイズを決める。
// }
// }
});
// ホームボタン(作業一覧へ遷移ボタン)
...
...
@@ -412,9 +376,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
communicationButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
// ABVUIActivity activity = ActivityHandlingHelper.getInstance().getPreviousOfSettingActivity();
// new ABVUIActivity().showCommunicationMenuDialog();
// showCommonDialog();
showCommunicationMenuDialog
();
}
});
...
...
@@ -532,95 +493,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}
}
// #36170
// ユーザプロファイルのイメージを求める
public
void
getrofileImagesJsonFilePath
(
String
promiseId
,
String
loginId
,
String
timeStamp
,
String
shopMemberId
,
String
profileImage
)
{
String
mimeType
=
""
;
String
javascript
=
""
;
// Binary からファイルフォマットを取る
if
(
profileImage
.
contains
(
"jpg"
))
{
mimeType
=
"jpg"
;
}
else
if
(
profileImage
.
contains
(
"jpeg"
))
{
mimeType
=
"jpeg"
;
}
else
if
(
profileImage
.
contains
(
"png"
))
{
mimeType
=
"png"
;
}
// ファイルパースを生成する。
String
profileImagesPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
)
+
File
.
separator
+
loginId
+
'_'
+
timeStamp
+
"."
+
mimeType
;
// 差分があるアルバあい既存ファイルを確認する
File
file
=
new
File
(
profileImagesPath
);
if
(
file
.
exists
())
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
);
mChatWebView
.
loadUrl
(
javascript
);
return
;
}
// 差分がある場合既存ファイルを削除する
// String differceImageFilePath = searchDifferceImageFiles(userID + "_", timeStamp);
// if (deleteTargetFilePath.length() > 0) {
// // ファイルがある場合のみ、削除
// FileUtil.delete(deleteTargetFilePath);
// }
String
isError
=
null
;
try
{
ABookCheckWebViewHelper
.
getInstance
().
decodeToImage
(
profileImage
,
profileImagesPath
);
}
catch
(
Exception
e
)
{
isError
=
"Error"
;
Logger
.
e
(
TAG
,
e
);
}
if
(
isError
!=
null
)
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', '%s');"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
,
isError
);
}
else
{
javascript
=
String
.
format
(
"javascript:fileSaveResolvePromise('%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
shopMemberId
);
}
mChatWebView
.
loadUrl
(
javascript
);
}
// ユーザプロファイルの差分のためファイル検索
public
void
getFileHandler
(
String
promiseId
,
String
loginId
,
String
timeStamp
,
String
shopMemberId
)
{
String
javascript
=
""
;
// timeStampが「0」の場合、そのまま値を返す
if
(
timeStamp
.
equals
(
"0"
))
{
//ここに既存のイメージの削除logicが必要だ
String
deleteImageFilePath
=
searchImageFiles
(
loginId
+
"_"
);
if
(
deleteImageFilePath
.
length
()
>
0
)
{
// ファイルがある場合のみ、削除
if
(
FileUtil
.
delete
(
deleteImageFilePath
))
{
Logger
.
d
(
"Delete imageFile "
,
"delete file path :"
+
deleteImageFilePath
);
}
}
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
""
,
"0"
,
shopMemberId
);
// default
}
else
{
//差分を確認し差分がある場合、差分対象のファイルのtimeStampを返す
String
searchFileInfo
=
searchDifferceImageFiles
(
loginId
+
"_"
,
timeStamp
);
String
profileImagesPath
=
""
;
// 差分がない場合、同じファイルで
if
(
searchFileInfo
.
lastIndexOf
(
"."
)
>
0
)
{
profileImagesPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
)
+
File
.
separator
+
searchFileInfo
;
searchFileInfo
=
"0"
;
}
// 差分がある場合、既存ファイルのTimeStampでsearchFileInfoにoldTimeStampとして返す
else
if
(
searchFileInfo
.
length
()
>
1
)
{
profileImagesPath
=
""
;
// 差分がない、ファイルがない場合
}
else
if
(
searchFileInfo
.
equals
(
"0"
))
{
profileImagesPath
=
""
;
searchFileInfo
=
"20000101121211"
;
// サーバに差分のファイルを要求するためダミー日付を渡す
}
String
error
=
null
;
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', '%s', '%s', null);"
,
promiseId
,
loginId
,
profileImagesPath
,
searchFileInfo
,
shopMemberId
);
}
mChatWebView
.
loadUrl
(
javascript
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
...
...
@@ -703,161 +575,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
});
}
// #36170
@JavascriptInterface
public
void
requestProfileImagesJsonFilePath
(
final
String
promiseId
,
final
String
loginId
,
final
String
timeStamp
,
final
String
shopMemberId
,
final
String
profileImage
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getrofileImagesJsonFilePath
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
,
profileImage
);
}
});
}
@JavascriptInterface
public
String
getProfileImage
(
String
loginId
)
{
String
profileImage
=
searchImageFiles
(
loginId
+
"_"
);
if
(
profileImage
.
length
()
>
0
)
{
return
profileImage
;
}
else
{
profileImage
=
""
;
}
return
profileImage
;
// logidId, profileimagePath, timestamp
}
@JavascriptInterface
// public String getProfileimageDifference(String loginId, String timeStamp) {
public
void
getfileimageDifference
(
String
promiseId
,
String
loginId
,
String
timeStamp
)
{
String
profileImageStamp
=
searchDifferceImageFiles
(
loginId
+
"_"
,
timeStamp
);
if
(
profileImageStamp
.
length
()
>
0
)
{
// return profileImageStamp;
}
else
{
profileImageStamp
=
""
;
}
String
javascript
=
String
.
format
(
"javascript:resolvePromise('%s', '%s', '%s', null, null);"
,
promiseId
,
loginId
,
profileImageStamp
);
mChatWebView
.
loadUrl
(
javascript
);
}
@JavascriptInterface
public
void
readFileHandler
(
final
String
promiseId
,
final
String
loginId
,
final
String
timeStamp
,
final
String
shopMemberId
)
{
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
getFileHandler
(
promiseId
,
loginId
,
timeStamp
,
shopMemberId
);
}
});
}
}
// 保存されているユーザプロファイルの場所からファイルを検索
private
String
searchImageFiles
(
String
loginId
)
{
String
profileImagePath
=
""
;
String
profileImagesJsonPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
);
List
<
String
>
listDirectory
=
new
ArrayList
<>();
listDirectory
.
add
(
profileImagesJsonPath
);
int
m
=
0
;
int
n
=
0
;
String
[]
fileName
;
String
imgPath
=
null
;
// dirList.size() は動的変化あり注意
while
(
listDirectory
.
size
()
>
m
){
// get(m) リスト内の指定された位置 m にある要素を返す
File
directory
=
new
File
(
listDirectory
.
get
(
m
));
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName
=
directory
.
list
();
if
(
fileName
==
null
)
{
break
;
}
n
=
0
;
while
(
fileName
.
length
>
n
){
File
subFile
;
subFile
=
new
File
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
if
(
subFile
.
isDirectory
())
{
listDirectory
.
add
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
}
else
if
(
subFile
.
getName
().
startsWith
(
loginId
))
{
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
profileImagePath
=
imgPath
;
break
;
}
else
{
profileImagePath
=
""
;
}
n
++;
}
m
++;
}
return
profileImagePath
;
}
// User Profile ついて差分を確認する
private
String
searchDifferceImageFiles
(
String
loginId
,
String
timeStamp
)
{
String
profileImageTimeStamp
=
"0"
;
String
profileImagesJsonPath
=
String
.
format
(
ProfileDirFormat
,
ABVEnvironment
.
getInstance
().
rootDirectory
);
List
<
String
>
listDirectory
=
new
ArrayList
<>();
listDirectory
.
add
(
profileImagesJsonPath
);
int
m
=
0
;
int
n
=
0
;
String
[]
fileName
;
String
imgPath
=
null
;
// dirList.size() は動的変化あり注意
while
(
listDirectory
.
size
()
>
m
){
// get(m) リスト内の指定された位置 m にある要素を返す
File
directory
=
new
File
(
listDirectory
.
get
(
m
));
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName
=
directory
.
list
();
if
(
fileName
==
null
)
{
break
;
}
n
=
0
;
while
(
fileName
.
length
>
n
){
File
subFile
;
subFile
=
new
File
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
if
(
subFile
.
isDirectory
())
{
listDirectory
.
add
(
directory
.
getPath
()
+
"/"
+
fileName
[
n
]);
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
}
else
if
(
subFile
.
getName
().
startsWith
(
loginId
))
{
imgPath
=
directory
.
getPath
()
+
"/"
+
fileName
[
n
];
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
));
// 拡張子を抜けて比較する
if
(!
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
)).
equals
(
loginId
+
timeStamp
))
{
// loginId だけ同じファイルの場合timeStampを返す
profileImageTimeStamp
=
fileName
[
n
].
substring
(
fileName
[
n
].
indexOf
(
"_"
)+
1
,
fileName
[
n
].
lastIndexOf
(
"."
));
}
else
if
(
fileName
[
n
].
substring
(
0
,
fileName
[
n
].
lastIndexOf
(
"."
)).
equals
(
loginId
+
timeStamp
))
{
// loginId + timestamp と同じファイルの場合、拡張子を抜けた値を返す
profileImageTimeStamp
=
fileName
[
n
];
}
break
;
}
else
{
profileImageTimeStamp
=
"0"
;
}
n
++;
}
m
++;
}
return
profileImageTimeStamp
;
}
/**
...
...
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