Commit 9422fab7 by Kazuyuki Hida

中途半端だけれど、できるところまでWarningつぶしを行った。

parent 9922d073
......@@ -30,7 +30,7 @@
<inspection_tool class="ComparatorMethodParameterNotUsed" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CompareToUsesNonFinalVariable" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ConstantAssertCondition" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ConstantConditions" enabled="true" level="ERROR" enabled_by_default="true">
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
......@@ -39,7 +39,7 @@
<inspection_tool class="CovariantCompareTo" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CovariantEquals" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CyclomaticComplexity" enabled="true" level="TODO" enabled_by_default="true">
<option name="m_limit" value="10" />
<option name="m_limit" value="40" />
</inspection_tool>
<inspection_tool class="EmptyInitializer" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="EmptyStatementBody" enabled="false" level="ERROR" enabled_by_default="false">
......@@ -155,6 +155,7 @@
<option name="ignoreEqualsMethod" value="false" />
<option name="m_limit" value="1" />
</inspection_tool>
<inspection_tool class="MultipleVariablesInDeclaration" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="NegatedIfElse" enabled="true" level="ERROR" enabled_by_default="true">
<option name="m_ignoreNegatedNullComparison" value="true" />
<option name="m_ignoreNegatedZeroComparison" value="false" />
......@@ -169,7 +170,7 @@
<option name="onlyWarnOnBaseMethods" value="true" />
</inspection_tool>
<inspection_tool class="NonCommentSourceStatements" enabled="true" level="TODO" enabled_by_default="true">
<option name="m_limit" value="30" />
<option name="m_limit" value="100" />
</inspection_tool>
<inspection_tool class="NonShortCircuitBoolean" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="NullArgumentToVariableArgMethod" enabled="true" level="ERROR" enabled_by_default="true" />
......@@ -239,6 +240,9 @@
<inspection_tool class="SuspiciousNameCombination" enabled="false" level="ERROR" enabled_by_default="false">
<group names="x,width,left,right" />
<group names="y,height,top,bottom" />
<ignored>
<option name="METHOD_MATCHER_CONFIG" value="java.io.PrintStream,println,java.io.PrintWriter,println,java.lang.System,identityHashCode,java.sql.PreparedStatement,set.*,java.sql.ResultSet,update.*,java.sql.SQLOutput,write.*,java.lang.Integer,compare.*,java.lang.Long,compare.*,java.lang.Short,compare,java.lang.Byte,compare,java.lang.Character,compare,java.lang.Boolean,compare,java.lang.Math,.*,java.lang.StrictMath,.*" />
</ignored>
</inspection_tool>
<inspection_tool class="SuspiciousSystemArraycopy" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="SuspiciousToArrayCall" enabled="true" level="ERROR" enabled_by_default="true" />
......
package jp.agentec.abook.abv.ui.common.activity;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Color;
......@@ -70,7 +64,6 @@ import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.launcher.android.ABVUIDataCache;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.PrefName;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
......@@ -103,7 +96,6 @@ public abstract class ABVActivity extends Activity {
protected AlertDialog mAlertDialog = null;
private static boolean IsAppPaused = false;
private static boolean IsAppVisible = false;
private static boolean isVisible = false;
public static final String CID="cid";
......@@ -116,15 +108,7 @@ public abstract class ABVActivity extends Activity {
protected static final int WC = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
protected static final int R_FP = ViewGroup.LayoutParams.MATCH_PARENT;
private HomeButtonReceiver mHomeButtonReceiver;
protected Uri imageUri;
private class HomeButtonReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
onClickHomeButton();
}
}
@Override
protected void onUserLeaveHint() {
......@@ -170,10 +154,7 @@ public abstract class ABVActivity extends Activity {
* @return true:表示、false:非表示
*/
public boolean progressDialogHorizontalShowing() {
if (!isFinishing() && progressDialogHorizontal != null && !progressDialogHorizontal.isShowing()) {
return false;
}
return true;
return isFinishing() || progressDialogHorizontal == null || progressDialogHorizontal.isShowing();
}
public void showProgressPopup() {
......@@ -327,9 +308,6 @@ public abstract class ABVActivity extends Activity {
sendBroadcast(new Intent("jp.agentec.abook.saas.signage.off"));
closeAlertDialog();
isVisible = false;
if (mHomeButtonReceiver != null) {
unregisterReceiver(mHomeButtonReceiver);
}
}
protected void startActivity(Intent intend, NaviConsts ABVNavi) {
......@@ -349,12 +327,13 @@ public abstract class ABVActivity extends Activity {
return super.onPrepareOptionsMenu(menu);
}
@SuppressLint("PrivateApi")
protected void setMenuBackground(Menu menu) {
LayoutInflater service = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
final Factory orgFactory = service.getFactory();
if (orgFactory == null) {
final Factory factory = new Factory() {
@Override
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
if (name.equals("com.android.internal.view.menu.IconMenuView")) {
......@@ -372,19 +351,19 @@ public abstract class ABVActivity extends Activity {
return vg;
}
catch (ClassNotFoundException e) {
Logger.w(TAG, e);
Logger.w(TAG, "ClassNotFoundException", e);
} catch (SecurityException e) {
Logger.w(TAG, e);
Logger.w(TAG, "SecurityException", e);
} catch (NoSuchMethodException e) {
Logger.w(TAG, e);
Logger.w(TAG, "NoSuchMethodException", e);
} catch (IllegalArgumentException e) {
Logger.w(TAG, e);
Logger.w(TAG, "IllegalArgumentException", e);
} catch (InstantiationException e) {
Logger.w(TAG, e);
Logger.w(TAG, "InstantiationException", e);
} catch (IllegalAccessException e) {
Logger.w(TAG, e);
Logger.w(TAG, "IllegalAccessException", e);
} catch (InvocationTargetException e) {
Logger.w(TAG, e);
Logger.w(TAG, "InvocationTargetException", e);
}
}
return null;
......@@ -401,17 +380,18 @@ public abstract class ABVActivity extends Activity {
Method method = c.getDeclaredMethod("getItemView", paramTypesGetItemView);
method.setAccessible(true);
TextView view = (TextView) method.invoke(item, 0, null);
assert view != null;
view.setTextColor(Color.WHITE);
} catch (SecurityException e) {
Logger.w(TAG, e);
Logger.w(TAG, "SecurityException", e);
} catch (NoSuchMethodException e) {
//Logger.w(Tag, e);
//Logger.w(Tag, "NoSuchMethodException", e);
} catch (IllegalArgumentException e) {
Logger.w(TAG, e);
Logger.w(TAG, "IllegalArgumentException", e);
} catch (IllegalAccessException e) {
Logger.w(TAG, e);
Logger.w(TAG, "IllegalAccessException", e);
} catch (InvocationTargetException e) {
Logger.w(TAG, e);
Logger.w(TAG, "InvocationTargetException", e);
}
}
}
......@@ -421,13 +401,10 @@ public abstract class ABVActivity extends Activity {
public boolean onKeyUp(int keyCode, KeyEvent event) {
boolean eventPrevent = false;
switch(keyCode) {
case KeyEvent.KEYCODE_BACK:
super.finish();
overridePendingTransition(R.anim.viewin_right_to_left, R.anim.viewout_right_to_left);
eventPrevent = true;
if (keyCode == KeyEvent.KEYCODE_BACK) {
super.finish();
overridePendingTransition(R.anim.viewin_right_to_left, R.anim.viewout_right_to_left);
eventPrevent = true;
}
return eventPrevent;
......@@ -447,7 +424,6 @@ public abstract class ABVActivity extends Activity {
super.onStop();
if (getClass().getName().equals(getABVUIDataCache().visibleActivityName)) {
// IsAppPaused = !IsAppVisible;
IsAppPaused = true;
}
......@@ -464,7 +440,6 @@ public abstract class ABVActivity extends Activity {
if (getClass().getName().equals(getABVUIDataCache().visibleActivityName)) {
//Logger.d("focus", getClass().getName() + " " + hasFocus);
IsAppVisible = hasFocus;
if (IsAppPaused) {
new Handler().post(new Runnable() {
......@@ -481,7 +456,7 @@ public abstract class ABVActivity extends Activity {
// つまり、Activity間の遷移により、hasFocusはfalseになったりtrueになったりするが、
// 最終的にtrueになったということは、アプリ自体は画面に表示されていることを示す。
// falseの状態で、onStopが呼び出されると、このアプリはバックグラウンドになったが、またが終了したことを示す。
if (IsAppVisible) {
if (hasFocus) {
IsAppPaused = false;
}
}
......@@ -513,7 +488,6 @@ public abstract class ABVActivity extends Activity {
}
}
} catch (Exception e) {
result = false;
Logger.e("Exception LoginTimeOutCheck", e);
}
return result;
......@@ -596,6 +570,7 @@ public abstract class ABVActivity extends Activity {
return result;
}
@SuppressWarnings("unused")
private void showChangePasswordDialog(final int title, final SecurityPolicyType securityPolicyType, final String loginId, final String password, final DialogInterface.OnClickListener cancelListener) {
ABookAlertDialog passwordChangeDialog = AlertDialogUtil.createAlertDialog(this, title);
View passwordChangeView = null;
......@@ -608,15 +583,13 @@ public abstract class ABVActivity extends Activity {
break;
case Enforcement:
passwordChangeView = getLayoutInflater().inflate(R.layout.ac_setting_password_change_enforcement, null);
EditText edtLoginId = (EditText)passwordChangeView.findViewById(R.id.edt_id);
EditText edtLoginId = passwordChangeView.findViewById(R.id.edt_id);
edtLoginId.setText(loginId);
passwordChangeDialog.setCancelable(false);
passwordChangeDialog.setView(passwordChangeView);
break;
case None:
break;
default:
break;
}
final EditText edtPwdNow = (EditText) (passwordChangeView != null ? passwordChangeView.findViewById(R.id.edt_pwd_now) : null);
......@@ -670,6 +643,8 @@ public abstract class ABVActivity extends Activity {
showChangePasswordDialog(R.string.pwd_change, securityPolicyType, loginId, password, cancelListener);
}
}
});
showAlertDialog(passwordChangeDialog);
......@@ -782,10 +757,12 @@ public abstract class ABVActivity extends Activity {
return getResources().getBoolean(id);
}
@SuppressWarnings("deprecation")
protected Drawable getRDrawable(int id) {
return getResources().getDrawable(id);
}
@SuppressWarnings("deprecation")
protected int getRColor(int id) {
return getResources().getColor(id);
}
......@@ -812,6 +789,7 @@ public abstract class ABVActivity extends Activity {
}
public void showSimpleAlertDialog(final String title, final String body) {
final int DELAY = 500;
handler.postDelayed(new Runnable() {
@Override
public void run() {
......@@ -819,7 +797,7 @@ public abstract class ABVActivity extends Activity {
alertDialog.setPositiveButton(R.string.ok, null);
showAlertDialog(alertDialog);
}
}, 500);
}, DELAY);
}
public static boolean isVisible() {
......@@ -882,6 +860,7 @@ public abstract class ABVActivity extends Activity {
}
}
@SuppressWarnings("unused")
protected void showToastOnDebug(String... msgs) {
if (msgs == null || msgs.length == 0) {
return;
......@@ -892,9 +871,9 @@ public abstract class ABVActivity extends Activity {
msg = msgs[0];
}
else {
String[] param = new String[msgs.length - 1];
Object[] param = new String[msgs.length - 1];
System.arraycopy(msgs, 1, param, 0, param.length);
msg = String.format(msgs[0], (Object[])param);
msg = String.format(msgs[0], param);
}
handleErrorMessageToast(msg);
}
......@@ -927,6 +906,7 @@ public abstract class ABVActivity extends Activity {
return true;
}
@SuppressLint("IntentReset")
private void showCameraOrAlbumSelectView(int requestCode , String title, String type, boolean cameraFlg) {
if (type.toLowerCase().equals(ABookKeys.IMAGE)) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
......@@ -952,7 +932,8 @@ public abstract class ABVActivity extends Activity {
startActivityForResult(chooser, requestCode);
} else if(type.toLowerCase().equals(ABookKeys.VIDEO)) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
@SuppressLint("IntentReset")
Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
galleryIntent.setType("video/*");
Intent chooser = new Intent(Intent.ACTION_CHOOSER);
chooser.putExtra(Intent.EXTRA_INTENT, galleryIntent);
......
......@@ -4,57 +4,26 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.InputType;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CheckedTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
//import com.google.firebase.iid.FirebaseInstanceId;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.zxing.WriterException;
import org.xwalk.core.XWalkView;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
import jp.agentec.abook.abv.bl.acms.type.DeliveryType;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.acms.type.UpdateSelect;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
......@@ -71,39 +40,28 @@ import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.MemberInfoDao;
import jp.agentec.abook.abv.bl.download.ContentDownloadListener;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BookmarkLogic;
import jp.agentec.abook.abv.bl.logic.CategoryLogic;
import jp.agentec.abook.abv.bl.logic.ContentLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.billing.Purchase;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.push.FcmManager;
import jp.agentec.abook.abv.cl.util.AndroidStringUtil;
import jp.agentec.abook.abv.cl.util.BitmapUtil;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.cl.util.RawResourceUtil;
import jp.agentec.abook.abv.cl.util.StorageUtil;
import jp.agentec.abook.abv.launcher.android.ABVApplication;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
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.common.util.DisplayUtil;
import jp.agentec.abook.abv.ui.common.util.Initializer;
......@@ -111,10 +69,8 @@ import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.HelpActivity;
import jp.agentec.abook.abv.ui.home.activity.LoginActivity;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.abook.abv.ui.viewer.foxitPdf.PdfImageProvider;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.util.StringUtil;
......@@ -122,6 +78,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
private final static String TAG = "ABVAuthenticatedActivity";
public static final String FILEPATH = "FILEPATH";
public static final int WAIT_FOR_START_CONTENT_ACTIVITY = 500;
protected ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
......@@ -130,8 +87,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected ContentDownloader contentDownloader = ContentDownloader.getInstance();
protected ContentRefresher contentRefresher = ContentRefresher.getInstance();
private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
@SuppressWarnings("unused")
private final ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
@SuppressWarnings("unused")
protected ImageButton btnDownload;
protected ActivityHandlingHelper activityHandlingHelper;
protected Size mDisplaySize;
......@@ -140,12 +99,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
/**
* メッセージ表示タイプ
*/
@SuppressWarnings("unused")
public interface MessageType {
int TYPE_SHOW_NONE = 0;
int TYPE_SHOW_TOAST = 1;
int TYPE_SHOW_ALERT = 2;
}
@SuppressWarnings("unused")
public interface ContentCheckResultType {
int NETWORK_ERROR = -2;
int ERROR = -1;
......@@ -187,10 +148,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
try {
// 既にMacAddress使用に同意している場合はMacAddressを使う
// 認証なしの場合はUUIDを使用する
if (ABVEnvironment.getInstance().deviceIdType != Constant.DeviceIdType.MAC_ADDRESS) {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByUUID(fcmToken);
} else {
if (ABVEnvironment.getInstance().deviceIdType == Constant.DeviceIdType.MAC_ADDRESS) {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken);
} else {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByUUID(fcmToken);
}
isSendSuccess = true;
} catch (NetworkDisconnectedException e) {
......@@ -300,7 +261,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// コンテンツアラートのサービスオプションがYの時はアラートを表示
if (AbstractLogic.getLogic(ContractLogic.class).getContentAlert()) {
contentViewActivityMoveWithContentAlert(intent, contentId, NaviConsts.Right);
contentViewActivityMoveWithContentAlert(intent, contentId);
} else {
contentViewActivityMoveWithAccessLocationAlert(intent, contentId, NaviConsts.Right);
}
......@@ -310,42 +271,36 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
* 360コンテンツ使用可能かのチェック
* バーチャルツアー:OS4.4以上
* 360動画:OS5.0以上
* @param contentId
* @return
* @param contentId コンテントID
* @return check360Contentかどうか
*/
private boolean checkPanoContent(long contentId) {
int ret = ContentViewHelper.getInstance().check360Content(contentId);
return ret == 0 ? false : true;
return ret != 0;
}
private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId) {
ContentDto contentDto = contentDao.getContent(contentId);
// コンテンツ表示制限チェック
switch (contentDto.alertMessageLevel) {
case AlertMessageLevel.NONE :
contentViewActivityMoveWithAccessLocationAlert(intent, contentId, ABVNavi);
contentViewActivityMoveWithAccessLocationAlert(intent, contentId, NaviConsts.Right);
break;
case AlertMessageLevel.MESSAGE :
showContentMessageDialog(intent, contentId, contentDto.alertMessage, ABVNavi);
showContentMessageDialog(intent, contentId, contentDto.alertMessage, NaviConsts.Right);
break;
case AlertMessageLevel.PASSWORD :
showPasswordCheckDialog(intent, contentId, null, ABVNavi);
showPasswordCheckDialog(intent, contentId, null, NaviConsts.Right);
break;
}
}
@SuppressWarnings("unused")
private void contentViewActivityMoveWithAccessLocationAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
contentViewActivityMove(intent, contentId, ABVNavi);
//位置情報のアプリ内の許可しないように修正
// if (!getABVUIDataCache().isShowedPermissionAccessLocationAlert() && ( AbstractLogic.getLogic(ContractLogic.class).getUsableReadinglogGps())) {
// // 位置情報取得許可アラートを一度も表示していない場合表示する
// putUserPref(UserPrefKey.SHOWED_PERMISSION_ACCESS_LOCATION_ALERT, true);
// showPermissionAccessLocationAlert(intent, contentId, ABVNavi);
// } else {
// contentViewActivityMove(intent, contentId, ABVNavi);
// }
}
@SuppressWarnings("unused")
private void showPermissionAccessLocationAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
ABookAlertDialog dialog = AlertDialogUtil.createAlertDialog(this, R.string.app_name);
dialog.setMessage(String.format(getString(R.string.access_location_message), getString(R.string.app_name)));
......@@ -377,7 +332,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
public void run() {
try {
Thread.sleep(500);
Thread.sleep(WAIT_FOR_START_CONTENT_ACTIVITY);
activityHandlingHelper.startContentActivity(context, intent, ABVNavi, null, contentId);
} catch (FileNotFoundException e) {
Logger.e(TAG, "startContentActivity " + contentId, e);
......@@ -521,8 +476,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
/**
* メッセージを表示しないコンテンツチェック
* 呼び出し元でチェック結果の処理を行う
* @param contentId
* @return
* @param contentId コンテントID
* @return チェック結果 int {@link ContentCheckResultType}
*/
//CustomUrlでダウンロードまたは権限のないコンテンツをダウンロードする前にコンテンツの有効性をチェックするため、(ActivityHandlingHelperで使う)protectedからpublicに変更
public int contentValidCheck(long contentId) {
......@@ -531,7 +486,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
/**
* コンテンツの有効性のチェックを行う
* @param contentId
* @param contentId コンテントID
* @param showMessageType {@link MessageType}
* @return チェック結果 int {@link ContentCheckResultType}
*/
......@@ -611,16 +566,16 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return contentDownload(contentId, true);
}
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag) {
protected boolean contentDownload(final long contentId, @SuppressWarnings("unused") boolean needCheckWifiFlag) {
return contentDownload(contentId, true, true);
}
/**
* ダウンロード処理
* @param contentId
* @param needCheckWifiFlag
* @param isShowToast
* @return
* @param contentId コンテントID
* @param needCheckWifiFlag Wi-Fiのチェックを行うかどうか
* @param isShowToast エラー時にToastを出すかどうか
* @return 失敗したらfalse
*/
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag, final boolean isShowToast) {
boolean result = true;
......@@ -684,10 +639,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
alertDialog.setTitle(titleId);
View checkBoxAlert = getLayoutInflater().inflate(R.layout.item_check_box_alert, null);
alertDialog.setView(checkBoxAlert);
TextView message = (TextView) checkBoxAlert.findViewById(R.id.message);
TextView message = checkBoxAlert.findViewById(R.id.message);
message.setText(getString(messageId));
final CheckBox checkBox = (CheckBox) checkBoxAlert.findViewById(R.id.check_box);
final CheckBox checkBox = checkBoxAlert.findViewById(R.id.check_box);
alertDialog.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
......@@ -703,7 +658,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
});
TextView checkBoxMessage = (TextView) checkBoxAlert.findViewById(R.id.check_box_message);
TextView checkBoxMessage = checkBoxAlert.findViewById(R.id.check_box_message);
checkBoxMessage.setText(getString(R.string.not_show_nexttime));
checkBoxMessage.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -719,8 +674,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
@SuppressWarnings("unused")
public abstract boolean contentValidCheckAndDownload(long contentId);
@SuppressWarnings("unused")
public void startContentViewActivity(long contentId) {
startContentViewActivity(contentId, 0);
}
......@@ -771,7 +728,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
/**
* 一括同期処理中であるか確認
* @return
* @return BatchSyncが見えているかどうか
*/
public boolean isShowingBatchSync() {
return batchSyncView != null && batchSyncView.isShowing();
......
package jp.agentec.abook.abv.ui.common.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
......@@ -9,12 +10,10 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.AssetFileDescriptor;
import android.location.LocationManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.nfc.NdefMessage;
import android.nfc.NfcAdapter;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.Settings;
......@@ -32,8 +31,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant.ABookPermissionType;
......@@ -52,7 +49,6 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil;
public class ABVCheckContentViewActivity extends ABVContentViewActivity {
......@@ -119,7 +115,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
private NfcAdapter mNfcAdapter;
// SPP通信端末のデータベース管理クラス
private SppDeviceDao mSppDeviceDao = AbstractDao.getDao(SppDeviceDao.class);
private final SppDeviceDao mSppDeviceDao = AbstractDao.getDao(SppDeviceDao.class);
// SPP通信機器のデバイスID(t_spp_device)
private Integer mSppDeviceId;
......@@ -132,14 +128,12 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
protected void onReceiveScanResult(BeaconData data) {
//選択されたデバイスIDから端末検索
if (data.getExtraId() == mScaningDeviceId) {
String value = "-1";
String value;
switch (mScaningServiceId) {
case OKUDAKE_SERVICE_ID_TEMPERATURE:
value = String.valueOf(data.getTemperature());
break;
case OKUDAKE_SERVICE_ID_HUMIDITY:
value = String.valueOf(data.getHumidity());
break;
case OKUDAKE_SERVICE_ID_TEMPERATURE:
default:
value = String.valueOf(data.getTemperature());
break;
......@@ -156,29 +150,29 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
StringBuilder sb = new StringBuilder();
sb.append(LOG_SEPARATOR);
sb.append("\nビーコンスキャン結果");
sb.append("\n通知時刻: " + SDF.format(new Date()));
sb.append("\n検出時刻: " + SDF.format(new Date(data.getTimestamp())));
sb.append("\nベンダ識別子: " + data.getVendorId());
sb.append("\n個別番号: " + data.getExtraId());
sb.append("\nRSSI値: " + data.getRssi());
sb.append("\nバージョン: " + data.getVersion());
sb.append("\n距離種別: " + data.getDistance());
sb.append("\nTxパワー: " + data.getTxPower());
sb.append("\n温度(℃): " + data.getTemperature());
sb.append("\n湿度(%): " + data.getHumidity());
sb.append("\n気圧(hPa): " + data.getAtmosphericPressure());
sb.append("\n電池残量低下(要充電)フラグ: " + data.getLowBattery());
sb.append("\n電池残量(%): " + data.getBatteryPower());
sb.append("\nボタン識別子: " + data.getButtonId());
sb.append("\n開閉フラグ: " + data.getOpenCloseSensor());
sb.append("\n人感反応有無フラグ: " + data.getHumanSensor());
sb.append("\nRawデータ(ビーコンサービスID 8): " + data.getRawData8());
sb.append("\nRawデータ(ビーコンサービスID 9): " + data.getRawData9());
sb.append("\nRawデータ(ビーコンサービスID 10): " + data.getRawData10());
sb.append("\nRawデータ(ビーコンサービスID 11): " + data.getRawData11());
sb.append("\nRawデータ(ビーコンサービスID 12): " + data.getRawData12());
sb.append("\nRawデータ(ビーコンサービスID 13): " + data.getRawData13());
sb.append("\nRawデータ " + data.getRawData());
sb.append("\n通知時刻: ").append(SDF.format(new Date()));
sb.append("\n検出時刻: ").append(SDF.format(new Date(data.getTimestamp())));
sb.append("\nベンダ識別子: ").append(data.getVendorId());
sb.append("\n個別番号: ").append(data.getExtraId());
sb.append("\nRSSI値: ").append(data.getRssi());
sb.append("\nバージョン: ").append(data.getVersion());
sb.append("\n距離種別: ").append(data.getDistance());
sb.append("\nTxパワー: ").append(data.getTxPower());
sb.append("\n温度(℃): ").append(data.getTemperature());
sb.append("\n湿度(%): ").append(data.getHumidity());
sb.append("\n気圧(hPa): ").append(data.getAtmosphericPressure());
sb.append("\n電池残量低下(要充電)フラグ: ").append(data.getLowBattery());
sb.append("\n電池残量(%): ").append(data.getBatteryPower());
sb.append("\nボタン識別子: ").append(data.getButtonId());
sb.append("\n開閉フラグ: ").append(data.getOpenCloseSensor());
sb.append("\n人感反応有無フラグ: ").append(data.getHumanSensor());
sb.append("\nRawデータ(ビーコンサービスID 8): ").append(data.getRawData8());
sb.append("\nRawデータ(ビーコンサービスID 9): ").append(data.getRawData9());
sb.append("\nRawデータ(ビーコンサービスID 10): ").append(data.getRawData10());
sb.append("\nRawデータ(ビーコンサービスID 11): ").append(data.getRawData11());
sb.append("\nRawデータ(ビーコンサービスID 12): ").append(data.getRawData12());
sb.append("\nRawデータ(ビーコンサービスID 13): ").append(data.getRawData13());
sb.append("\nRawデータ ").append(data.getRawData());
sb.append('\n');
Logger.d(sb.toString());
}
......@@ -187,7 +181,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** 置くだけセンサーデバイス関連 開始 **/
/* 置くだけセンサーデバイス関連 開始 */
//ビーコンスキャナー
mScanner = new BeaconScanner(this);
......@@ -201,9 +195,9 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
//Beacon受信開始
registerReceiver(mReceiver, filter);
/** 置くだけセンサーデバイス関連 終了 **/
/* 置くだけセンサーデバイス関連 終了 */
/** 中心温度計デバイス関連 開始 **/
/* 中心温度計デバイス関連 開始 */
bleManagerUtil = new BleManagerUtil(this, new BleManagerUtil.BleManagerUtilListener() {
@Override
public void onConnectionError(int status) { //bluetooth接続エラー
......@@ -290,7 +284,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
});
bleManagerUtil.startDeviceInfo();
/** 中心温度計デバイス関連 終了 **/
/* 中心温度計デバイス関連 終了 */
// アダプタのインスタンスを取得
......@@ -333,7 +327,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
* onPause処理でnfc検知を受け取らない処理が入っているため、
* nfc検知処理を受け取らない処理を入れなくてもいい
*
* @param intent
* @param intent 院展と
*/
@Override
protected void onNewIntent(Intent intent) {
......@@ -368,7 +362,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
/**
* インテントからデータを読み込み、データを取得
* @param intent
* @param intent インテント
* @return 変換したデータ
*/
private String readFromIntent(Intent intent) {
......@@ -377,7 +371,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
|| NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
|| NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
NdefMessage[] msgs = null;
NdefMessage[] msgs;
if (rawMsgs != null) {
msgs = new NdefMessage[rawMsgs.length];
for (int i = 0; i < rawMsgs.length; i++) {
......@@ -394,8 +388,11 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
* @param msgs
* @return 変換したデータ
*/
@SuppressWarnings("magic_number")
private String parseNdfMessageString(NdefMessage[] msgs) {
if (msgs == null || msgs.length == 0) return null;
if (msgs == null || msgs.length == 0) {
return null;
}
String text = "";
byte[] payload = msgs[0].getRecords()[0].getPayload();
......@@ -465,7 +462,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
protected void getDeviceInfo(Map<String, String> abookCheckParam) {
if (abookCheckParam.containsKey(ABookKeys.TASK_DEVICE_TYPE)) {
mDeviceType = Integer.valueOf(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE)); // ディバイスのタイプ取得
mDeviceType = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_DEVICE_TYPE)); // ディバイスのタイプ取得
mQid = abookCheckParam.get(ABookKeys.TASK_QUESTION_ID); // 設問ID取得
// 1:中心温度計 2:置くだけセンサー 3:バーコード 4:放射温度計 5: SPP通信機器 6: NFC通信
......@@ -481,8 +478,8 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
return;
}
try {
mScaningDeviceId = Integer.valueOf(param1); // デバイスID取得
mScaningServiceId = Integer.valueOf(param2); // ServiceId ID取得
mScaningDeviceId = Integer.parseInt(param1); // デバイスID取得
mScaningServiceId = Integer.parseInt(param2); // ServiceId ID取得
} catch (NumberFormatException e) {
Logger.e("param is not Int", e);
errorAfterAbookCheckAip(getString(R.string.msg_fraud_parameter));
......@@ -513,7 +510,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
/**
* HTML側にNFC機器からのデータを転送する
* @param strTemp
* @param strTemp 機器から来た数値
*/
public void setNfcData(final String strTemp) {
Logger.i("setNfcData");
......@@ -762,7 +759,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
private void setNfcDeviceInfo() {
if (mNfcAdapter == null) {
// デバイスがNFCをサポートしてないと見做す。
errorAfterAbookCheckAip(String.format(getString(R.string.msg_no_support_nfc)));
errorAfterAbookCheckAip(getString(R.string.msg_no_support_nfc));
return; // 以下の処理にかからないようにreturnする
}
......@@ -802,7 +799,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
/**
* SPP通信エラー処理
* @param deviceName
* @param deviceName デバイス名
*/
private void connectErrorSppDevice(String deviceName, boolean dataFormatErrorFlg) {
if (!mDisConnectSppBluetoothFlg) {
......@@ -823,6 +820,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
* Android端末のBluetooth機能の有効化要求
* @return true:bluetooth ON, false:bluetooth OFF
*/
@SuppressLint("MissingPermission")
private boolean requestBluetoothFeature(int requestCode) {
if(bleManagerUtil.mBluetoothAdapter.isEnabled()) {
return true;
......@@ -912,7 +910,7 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
/**
* mediaPlayerにmp3ファイルをセット
* @return
* @return 成功したらtrue
*/
private boolean audioSetup() {
boolean fileCheck = false;
......
......@@ -15,7 +15,6 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
......@@ -25,6 +24,8 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import org.json.adf.JSONObject;
import java.io.File;
......@@ -47,8 +48,6 @@ import jp.agentec.abook.abv.bl.common.Constant;
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.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.MydataDto;
......@@ -150,7 +149,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public boolean isLinkedContent;
public int pageNo;
public int mButtonStatus; // 保存ボタンチェック
protected boolean mAddReport; // 作業追加区分
private boolean mLocationSendResult; // GPS送信フラグ
......@@ -351,14 +349,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public static void errorMessageDialog(final Context context,final int title, final ErrorCode value) {
// アラート内レイアウト
TextView txtMsg = new TextView(context);
final int TEXT_SIZE = 20;
TextView txtMsg = new TextView(context);
txtMsg.setText(R.string.delete_message);
txtMsg.setTextSize(20);
txtMsg.setTextSize(TEXT_SIZE);
txtMsg.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
txtMsg.setText(ErrorMessage.getMessageByErrorCode(context, value));
int WC = ViewGroup.LayoutParams.WRAP_CONTENT;
int FP = ViewGroup.LayoutParams.MATCH_PARENT;
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(FP, WC);
params.leftMargin = 10;
LinearLayout layout = new LinearLayout(context);
......@@ -568,7 +565,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
protected void setMeetingParticipantCount(boolean isVisible, View toolBar) {
final TextView textView = (TextView)toolBar.findViewById(R.id.txt_meeting_participant);
final TextView textView = toolBar.findViewById(R.id.txt_meeting_participant);
if (textView == null) {
return;
}
......@@ -581,13 +578,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void run() {
final int count = meetingManager.getParticipantCount();
handler.post(new Runnable() {
@SuppressLint("SetTextI18n")
@Override
public void run() {
textView.setText(getRString(R.string.meeting_participant_count) + ":" + count);
}
});
}
});
});
}
}
......@@ -664,14 +662,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
@SuppressLint("SourceLockedOrientationActivity")
protected void createCheckToolbar() {
final RelativeLayout fl;
if (operationDto != null && operationDto.operationType == OperationType.PDF && mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
fl = (RelativeLayout) findViewById(R.id.RelativeLayout2);
if ((operationDto != null) && (operationDto.operationType == OperationType.PDF) && (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT)) {
fl = findViewById(R.id.RelativeLayout2);
} else {
fl = (RelativeLayout) findViewById(R.id.frameTopbar);
fl = findViewById(R.id.frameTopbar);
}
fl.setBackgroundColor(getResources().getColor(R.color.operation_color));
operationHomeButton = (Button) findViewById(R.id.btn_operation_home);
fl.setBackgroundColor(ContextCompat.getColor(this, R.color.operation_color));
operationHomeButton = findViewById(R.id.btn_operation_home);
operationHomeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -703,7 +700,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
});
operationHomeButton.setVisibility(View.VISIBLE);
taskListButton = (ImageButton) findViewById(R.id.btn_show_task_list);
taskListButton = findViewById(R.id.btn_show_task_list);
taskListButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -730,7 +727,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mStatusCode = 0;
}
operationNameTitle = (TextView) findViewById(R.id.title);
operationNameTitle = findViewById(R.id.title);
operationNameTitle.setText(operationDto.operationName);
if (isNormalSize()) {
operationNameTitle.setWidth(getRDimensionSize(R.dimen.operation_title_normal_width));
......@@ -770,6 +767,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected void finishActivity() {}
protected void webViewLoadUrl(String url){}
@SuppressWarnings("unused")
public void onClickOperationHome(View v) {
if (mXWalkOpenType == Constant.XWalkOpenType.PANO_EDIT) {
// リソースパターンの適用
......@@ -878,7 +876,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public void commonShouldOverrideUrlLoading (Uri uri, final OperationTaskDto operationTaskDto) {
//parent method
Map<String, String> abookCheckParam = new HashMap<String, String>();
Map<String, String> abookCheckParam = new HashMap<>();
for (String key : uri.getQueryParameterNames()) {
abookCheckParam.put(key, uri.getQueryParameter(key));
}
......@@ -896,15 +894,13 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 定期点検の場合、以下のフラグを変更しない(mAddReport trueのみ)
if (abookCheckParam.containsKey(ABookKeys.ADD_REPORT)) {
mAddReport = Integer.parseInt(abookCheckParam.get(ABookKeys.ADD_REPORT)) > 0 ? true : false;
mAddReport = Integer.parseInt(abookCheckParam.get(ABookKeys.ADD_REPORT)) > 0;
}
long taskReportId = 0;
String reportStartDate = "";
if (operationDto.reportType == Constant.ReportType.RoutineTask && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Long.parseLong(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
......@@ -928,9 +924,10 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (abookCheckParam.get(ABookKeys.TASK_REPORT) != null) {
JSONObject tastReportJson = new JSONObject(abookCheckParam.get(ABookKeys.TASK_REPORT));
JSONObject taskJson = tastReportJson.getJSONObject(ABookKeys.TASK);
Iterator taskKeys = taskJson.keys();
@SuppressWarnings("unchecked")
Iterator<String> taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next();
String itemKey = taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskCode = taskJson.getString(itemKey);
}
......@@ -1034,7 +1031,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
}
} else if (mCmd.equals(ABookKeys.CMD_CHANGE_DISPLAY_STATUS)) {
mStatusCode = Integer.valueOf(abookCheckParam.get(ABookKeys.STATUS_CODE));
mStatusCode = Integer.parseInt(abookCheckParam.get(ABookKeys.STATUS_CODE));
commonConfigureHeader();
if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
......@@ -1049,6 +1046,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 帳票コンポーネントを削除したので、ダイアログを表示するだけで何もしない
showOzFileOpenErrorDialog();
} else if (mCmd.equals(ABookKeys.CMD_CONTENT_EDIT_CLOSE)) {
final int DELAY = 5000;
showProgressPopup();
handler.postDelayed(new Runnable() {
@Override
......@@ -1056,10 +1054,10 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
closeProgressPopup();
finish();
}
}, 5000);
}, DELAY);
} else if (mCmd.equals(ABookKeys.CMD_GET_GPS_INFO)) {
// #32926 作業報告画面改善 start
setLocation((Integer.valueOf(abookCheckParam.get(ABookKeys.GPS_TYPE)) != 1));
setLocation((Integer.parseInt(abookCheckParam.get(ABookKeys.GPS_TYPE)) != 1));
// #32926 作業報告画面改善 end
} else if (mCmd.equals(ABookKeys.CMD_SCENE_REGIST)) {
String successFlg = abookCheckParam.get(ABookKeys.SUCCESS_FLG);
......@@ -1091,8 +1089,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
} else if (mCmd.equals(ABookKeys.CMD_SHOW_RELATED_CONTENT)) {
try {
long linkedContentId = Long.valueOf(abookCheckParam.get(ABookKeys.CONTENT_ID));
int pageNum = Integer.valueOf(abookCheckParam.get(ABookKeys.CMD_PAGE_NUM));
long linkedContentId = Long.parseLong(abookCheckParam.get(ABookKeys.CONTENT_ID));
int pageNum = Integer.parseInt(abookCheckParam.get(ABookKeys.CMD_PAGE_NUM));
//ダウンロード完了後、開く時に必要
isLinkedContent = true;
......@@ -1111,17 +1109,16 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
getDeviceInfo(abookCheckParam);
} else if (mCmd.equals(ABookKeys.CMD_LOCK_REPORT)) {
String taskKey = abookCheckParam.get(TaskKey);
Date startDate = dateOrNull(abookCheckParam.get("reportStartDate"));
TaskReportDao dao = AbstractDao.getDao(TaskReportDao.class);
Date startDate = dateOrNull(abookCheckParam.get(ReportStartDate));
// ロック
LockReportLogic.Result r = LockReportLogic.newInstance().lock(taskKey, taskReportId, startDate);
// JSコールバック
afterABookCheckApi(mCmd, mTaskKey, r.getResult(), r.getMessage(), r.getExtParam().json());
} else if (mCmd.equals(ABookKeys.CMD_UNLOCK_REPORT)) {
String taskKey = abookCheckParam.get(TaskKey);
Date startDate = dateOrNull(abookCheckParam.get("reportStartDate"));
Date startDate = dateOrNull(abookCheckParam.get(ReportStartDate));
// アンロック
UnlockReportLogic.Result r = UnlockReportLogic.newInstance().unlock(taskKey, taskReportId, startDate);
UnlockReportLogic.newInstance().unlock(taskKey, taskReportId, startDate);
// JSコールバック
JSONObject extParam = new JSONObject();
extParam.put(ReportStatus, 0);
......@@ -1201,13 +1198,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (extParam != null) {
Logger.i(TAG, String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s', %s)", finalParent, cmd, taskKey, result, message, extParam));
webViewLoadUrl(String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s', %s)", finalParent, cmd, taskKey, result, message, extParam));
} else {
Logger.i(TAG, String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
webViewLoadUrl(String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message));
}
final String formatted;
if (extParam != null) {
formatted = String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s', %s)", finalParent, cmd, taskKey, result, message, extParam);
} else {
formatted = String.format("javascript:%sCHK.afterABookCheckApi('%s', '%s', '%s', '%s')", finalParent, cmd, taskKey, result, message);
}
Logger.i(TAG, formatted);
webViewLoadUrl(formatted);
}
});
}
......@@ -1229,7 +1227,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/**
* 位置情報取得
* @param showPermissionDialogFlg
* @param showPermissionDialogFlg ダイアログ表示するかどうか
*/
// #32926 作業報告画面改善 start
protected void setLocation(final boolean showPermissionDialogFlg) {
......@@ -1261,7 +1259,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
json.put("latitude", latitude);
json.put("longitude", longitude);
afterABookCheckApi(mCmd, "", 0, "", json.toString());
};
}
});
mLocationSendResult = true;
}
......@@ -1283,7 +1281,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/**
* 報告可能フラグ
* @return
* @return 編集可能かどうか
*/
public boolean isReportEdit() {
return mEnableReportEdit == Constant.EnableReportEdit.YES;
......@@ -1291,9 +1289,9 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/**
* PDF操作インスタンスを作成
* @param pdfFileName
* @return
* @throws Exception
* @param pdfFileName ファイル名
* @return PDFデータ
* @throws Exception PDF処理失敗
*/
public FoxitPdfCore initPdf(String pdfFileName) throws Exception {
Logger.d(TAG, "post intent to open file pdfFileName=" + pdfFileName);
......@@ -1305,6 +1303,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
// 保存処理
@SuppressWarnings("unused")
public void ozdSaveProcess() {
runOnUiThread(new Runnable() {
@Override
......@@ -1317,6 +1316,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
// 一時保存処理
@SuppressWarnings("unused")
public void ozdLocalSaveProcess() {
runOnUiThread(new Runnable() {
@Override
......@@ -1329,6 +1329,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
// 閉じる処理
@SuppressWarnings("unused")
public void ozdCancelProcess() {
runOnUiThread(new Runnable() {
@Override
......@@ -1341,6 +1342,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
// 削除処理
@SuppressWarnings("unused")
public void ozdDeleteProcess() {
runOnUiThread(new Runnable() {
@Override
......@@ -1358,11 +1360,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
// 押したボタンによってHTML側の処理を行う
@SuppressWarnings("unused")
public void doProcess() {
}
// 作業終了する時、作業ID設定し、画面遷移処理
public void closeCurrentScreen(int reportType) {
public void closeCurrentScreen( @SuppressWarnings("unused") int reportType) {
if (mAddReport) { // 作業追加あり
if (ActivityHandlingHelper.getInstance().searchOzdActivityStack()) { // OZD画面で画面遷移処理
......
......@@ -248,6 +248,7 @@ public class DashboardActivity extends OperationActivity {
private class JsInf {
@SuppressWarnings("unused")
@JavascriptInterface
public void existSetLocation(String ret) {
Logger.d(TAG, "existSetLocation=%s", ret);
......@@ -263,6 +264,7 @@ public class DashboardActivity extends OperationActivity {
}
}
@SuppressWarnings("unused")
@JavascriptInterface
public void existSendLog(String ret) {
Logger.d(TAG, "existSendLog=%s", ret);
......@@ -282,11 +284,13 @@ public class DashboardActivity extends OperationActivity {
}
}
@SuppressWarnings("unused")
@JavascriptInterface
public String getCachePath() {
return getCacheDir().getAbsolutePath();
}
@SuppressWarnings("unused")
@JavascriptInterface
public void sendParam(String param) {
Logger.i(TAG, "sendParam: %s", param);
......@@ -300,6 +304,7 @@ public class DashboardActivity extends OperationActivity {
});
}
@SuppressWarnings("unused")
@JavascriptInterface
public void getAttachedDataUrl(String taskKey, String data) {}
}
......
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