Commit 2ed6b474 by yuichiro ogawa

Chat機能移植及びリファクタリング

parent 7218f80e
......@@ -625,19 +625,21 @@ public class AcmsClient implements AcmsClientResponseListener {
/**
* パノラマで使用するシーンを登録
* @param sid
* @param contentId
* @param FormFile シーンで使用する画像
* @return
* @throws IOException
* @throws AcmsException
*/
public SceneEntryJSON sceneEntry(String sid, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
public SceneEntryJSON sceneEntry(String sid, Long contentId, File FormFile) throws IOException, AcmsException, NetworkDisconnectedException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException();
}
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSceneEntry);
HttpMultipart part1 = new HttpMultipart(ABookKeys.SID, sid);
HttpMultipart part2 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2});
HttpMultipart part2 = new HttpMultipart(ABookKeys.CONTENT_ID, StringUtil.toString(contentId));
HttpMultipart part3 = new HttpMultipart(ABookKeys.FORM_FILE, FormFile);
HttpResponse result = HttpRequestSender.post(apiUrl, new HttpMultipart[]{part1, part2, part3});
SceneEntryJSON json = new SceneEntryJSON(result.httpResponseBody);
if (json.httpStatus != 200) {
if (json.errorMessage != null) {
......
......@@ -1391,11 +1391,12 @@ public class OperationLogic extends AbstractLogic {
/**
* シーンの登録
* @param file
* @param contentId
* @throws IOException
* @throws AcmsException
*/
public Integer sendScene(File file) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, file);
public Integer sendScene(File file, Long contentId) throws IOException, AcmsException, NetworkDisconnectedException {
SceneEntryJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sceneEntry(cache.getMemberInfo().sid, contentId, file);
return json.resourceId;
}
......
......@@ -344,7 +344,6 @@
<string name="operation_related_content">関連資料</string>
<string name="new_content">新着</string>
<string name="save_all">一括保存</string>
<string name="content_update">更新</string>
<string name="remote_support">遠隔支援</string>
<string name="remote_support_list">遠隔支援一覧</string>
<string name="new_make">新規作成</string>
......
......@@ -168,6 +168,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected PushMessageListAdapter mPushMessageListAdapter;
protected ListView mFixPushMessageListView;
protected Dialog mPushMessageSendDialog;
protected ImageButton communicationButton; // コミュニケーションボタン
protected int mSelectedFixPuchMessagePosition;
protected int mSendType;
protected PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
......@@ -978,6 +979,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else {
showPushMessageDetailView(dto);
}
// プッシュメッセージで未読がなければ、下辺ツールバーのコミュニケーションボタンのバッジを外す
List<PushMessageDto> checkPushMessageList = mPushMessageListAdapter.getItems();
if (!checkUnReadCommunication(checkPushMessageList)) {
communicationButton.setImageResource(R.drawable.ic_communication_menu);
}
}
});
mPushMessageListView.invalidate();
......@@ -1238,4 +1244,28 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
ProgressDialogHelper.closeProgressPopup();
}
}
// コミュニケーションのアイコン設定(未既読があれば、バッチ付きアイコンでセット)
protected void setCommunicationImageButton() {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = checkUnReadCommunication(pushMessageDtoList);
communicationButton.setImageResource(existUnreadFlg ? R.drawable.ic_communication_menu_with_badge : R.drawable.ic_communication_menu);
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
* @return
*/
private boolean checkUnReadCommunication(List<PushMessageDto> pushMessageDtoList) {
boolean existUnreadFlg = false;
for (PushMessageDto pushMessageDto : pushMessageDtoList) {
if (!pushMessageDto.readingFlg) {
existUnreadFlg = true;
break;
}
}
return existUnreadFlg;
}
}
......@@ -90,6 +90,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
private static final String TAG ="ABVContentViewActivity";
public final static int ABOOK_CHECK_TASK_IMAGE = 103;
public final static int ABOOK_CHECK_TASK_VIDEO = 104;
protected final static int ABOOK_CHECK_SELECT_SCENE = 105;
protected long contentId;// 表示中のコンテンツID
protected long objectId; // オブジェクトID(オブジェクト用のActivityのときのみ使用)
......
......@@ -37,6 +37,7 @@ import java.io.FileOutputStream;
import java.io.OutputStream;
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;
......@@ -83,10 +84,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
private ImageButton mOperationHomeButton; // ホームボタン
private ImageButton mOperationRelatedContentButton; // 関連資料ボタン
private ImageButton mCommunicationButton; // コミュニケーションボタン
protected PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Dialog mCommunicationMenuDialog;
private BroadcastReceiver receiver;
......@@ -281,7 +278,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
mChatWebView.loadUrl("javascript:dismissLoadingIndicator()");
}
}
......@@ -303,7 +300,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
Logger.d("url", "url : " + url);
Uri uri = Uri.parse(url);
String fileName = new File(uri.getPath()).getName();
String fileName = new File(Objects.requireNonNull(uri.getPath())).getName();
// イメージをダウンロードする(png, jpg, jpeg, mp4, mov)
if (url.toLowerCase().endsWith(".png") || url.toLowerCase().endsWith(".jpg") || url.toLowerCase().endsWith(".jpeg")
......@@ -315,6 +312,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName); request.setDescription("Downloading ...");
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationUri(Uri.fromFile(destinationFile));
assert mdDownloadManager != null;
mdDownloadManager.enqueue(request);
} else { // その他のファイルはurlのみ確認
Logger.d("download ", "download URL :" + url);
......@@ -349,7 +347,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
showCommonContent();
}
});
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
communicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
// Toolbar
settingBottomToolbar();
......@@ -385,7 +383,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// コミュニケーションボタン
mCommunicationButton.setOnClickListener(new View.OnClickListener() {
communicationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ABVUIActivity activity = ActivityHandlingHelper.getInstance().getPreviousOfSettingActivity();
......@@ -643,13 +641,6 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
mUploadMessage = null;
}
// コミュニケーションのアイコン設定(未既読があれば、バッチ付きアイコンでセット)
private void setCommunicationImageButton() {
List<PushMessageDto> pushMessageDtoList = pushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = checkUnReadCommunication(pushMessageDtoList);
mCommunicationButton.setImageResource(existUnreadFlg ? R.drawable.ic_communication_menu_with_badge : R.drawable.ic_communication_menu);
}
/**
* 未読のプッシュメッセージが存在するかチェック
* @param pushMessageDtoList チェックするリスト
......@@ -761,7 +752,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName = directory.list();
if (fileName == null) break;
if (fileName == null) {
break;
}
n = 0;
while(fileName.length > n){
......@@ -806,7 +799,9 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// java.io.File クラスのメソッド list()
// 指定したディレクトリに含まれるファイル、ディレクトリの一覧を String 型の配列で返す。
fileName = directory.list();
if (fileName == null) break;
if (fileName == null) {
break;
}
n = 0;
while(fileName.length > n){
......
......@@ -398,7 +398,12 @@ public class LoginActivity extends ABVLoginActivity {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
fcmRegister();
if (oldMemberInfoDto != null && oldMemberInfoDto.loginStatus == LoginStatus.LimitLogin.statusCode()) {
// アプリロックの場合サーバ認証せずにログイン
offlineLogin();
} else {
fcmRegister();
}
}
});
}
......
......@@ -364,7 +364,14 @@ public class CheckOZDViewActivity extends ABVContentViewActivity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode != KeyEvent.KEYCODE_BACK) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mAddReport) {
ozdCancelProcess(); // Ozd作業画面を閉じる
} else {
// 作業追加区分がなしの場合
goToMain(); // 一覧画面に遷移
}
} else {
return super.onKeyUp(keyCode, event);
}
return false;
......
......@@ -1535,6 +1535,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Logger.d(TAG, "KeyEvent.KEYCODE_BACK");
if (mOperationId != null && mOperationId > -1) {
putUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, mOperationId);
}
if (isVideoMax) {
videoMaxToDefault();
} else if (isMarking) {
......
......@@ -709,6 +709,10 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
return;
}
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result[0]);
}
}
mUploadMessage = null;
}
......
......@@ -729,6 +729,10 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
}
// 動画
mUploadMessage.onReceiveValue(result);
} else if (requestCode == ABOOK_CHECK_SELECT_SCENE) {
if (intent != null && result != null) {
confirmEntrySceneDialog(result);
}
}
mUploadMessage = null;
}
......
......@@ -58,7 +58,7 @@ public class SceneSendHelper {
if (isBaseSceneUpload && !isBaseSceneUploadSuccess && firstFilePath.equals(filePath)) {
AbstractLogic.getLogic(OperationLogic.class).sendPanoContent(operationId, OperationName, file);
} else {
AbstractLogic.getLogic(OperationLogic.class).sendScene(file);
AbstractLogic.getLogic(OperationLogic.class).sendScene(file, null);
}
needSendImages.remove(filePath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment