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
110e8801
Commit
110e8801
authored
Aug 02, 2019
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
位置情報の権限チェック処理修正(ABookPermissionHelperのActivity→contextに変更)
parent
9edf332f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
35 deletions
+39
-35
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/ContentLogUtil.java
+4
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
+35
-34
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/ContentLogUtil.java
View file @
110e8801
...
...
@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.cl.util;
import
jp.agentec.abook.abv.bl.acms.client.json.content.MediaInfoJSON
;
import
jp.agentec.abook.abv.bl.acms.client.json.content.PageObjectJSON
;
import
jp.agentec.abook.abv.bl.common.Constant
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.dao.AbstractDao
;
import
jp.agentec.abook.abv.bl.data.dao.ContentObjectLogDao
;
...
...
@@ -13,6 +14,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import
jp.agentec.abook.abv.bl.logic.ContractLogic
;
import
jp.agentec.abook.abv.bl.websocket.MeetingManager
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper
;
import
jp.agentec.adf.util.DateTimeUtil
;
import
org.json.adf.JSONException
;
...
...
@@ -51,7 +53,8 @@ public class ContentLogUtil {
int
readingLogId
=
contentReadingLogLogic
.
startContentReadLog
(
contentId
);
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if
(
permissionAccessLocation
&&
checkUsableReadinglogGps
(
contentId
))
{
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
context
,
Constant
.
ABookPermissionType
.
AccessFineLocation
,
null
);
if
(
checkUsableReadinglogGps
(
contentId
)
&&
helper
.
checkMultiPermissions
(
false
))
{
//20190529 アプリ側の位置情報許可チェックはしない
// 位置情報取得
locationManagerUtil
=
new
LocationManagerUtil
(
context
,
new
LocationManagerUtil
.
LocationManagerUtilListener
()
{
@Override
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
View file @
110e8801
...
...
@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.ui.home.helper;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
...
...
@@ -32,19 +33,19 @@ import static org.chromium.base.ContextUtils.getApplicationContext;
* Created by kim jinsung on 2018/09/21.
*/
public
class
ABookPermissionHelper
{
private
Activity
mActivity
;
private
Context
mContext
;
private
int
mPermitionType
;
private
AlertDialog
mAlertDialog
;
private
Callback
mCallback
;
public
ABookPermissionHelper
(
Activity
activity
,
int
permissionType
,
Callback
callback
)
{
m
Activity
=
activity
;
public
ABookPermissionHelper
(
Context
context
,
int
permissionType
,
Callback
callback
)
{
m
Context
=
context
;
mPermitionType
=
permissionType
;
mCallback
=
callback
;
}
public
ABookPermissionHelper
(
Activity
activity
)
{
m
Activity
=
activity
;
m
Context
=
activity
;
}
public
ArrayList
<
String
>
checkMultiPermissions
()
{
...
...
@@ -55,30 +56,30 @@ public class ABookPermissionHelper {
return
reqPermissions
;
}
// 位置情報
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
);
}
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
);
}
// ストレージ
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
);
}
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
}
// カメラ
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
CAMERA
);
}
// マイク(オーディオ)
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
RECORD_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
RECORD_AUDIO
);
}
...
...
@@ -95,77 +96,77 @@ public class ABookPermissionHelper {
switch
(
mPermitionType
)
{
case
Constant
.
ABookPermissionType
.
ReadExternalStorage
:
// ストレージ
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
m
Activity
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
)
{
if
(
m
Activity
instanceof
HTMLWebViewActivity
||
mActivity
instanceof
HTMLXWalkWebViewActivity
||
mActivity
instanceof
OperationListActivity
)
{
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
)
{
if
(
m
Context
instanceof
HTMLWebViewActivity
||
mContext
instanceof
HTMLXWalkWebViewActivity
||
mContext
instanceof
OperationListActivity
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_storage_album
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
else
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_storage_update
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
}
break
;
case
Constant
.
ABookPermissionType
.
AccessFineLocation
:
// 位置情報
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_location
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_location
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
break
;
case
Constant
.
ABookPermissionType
.
Camera
:
// カメラ
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
CAMERA
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_camera
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
break
;
case
Constant
.
ABookPermissionType
.
Audio
:
// マイク(オーディオ)
if
(
ContextCompat
.
checkSelfPermission
(
m
Activity
,
if
(
ContextCompat
.
checkSelfPermission
(
m
Context
,
android
.
Manifest
.
permission
.
RECORD_AUDIO
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
getApplicationContext
()
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_mic
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
break
;
}
if
(
permitionTextResourceId
>
0
)
{
if
(
showDialogFlg
)
{
ABookAlertDialog
dialog
=
AlertDialogUtil
.
createABookAlertDialog
(
m
Activity
);
ABookAlertDialog
dialog
=
AlertDialogUtil
.
createABookAlertDialog
(
m
Context
);
// リソースパターンの適用
dialog
.
setTitle
(
PatternStringUtil
.
patternToString
(
getApplicationContext
()
,
dialog
.
setTitle
(
PatternStringUtil
.
patternToString
(
mContext
,
R
.
string
.
title_permission_dialog
,
getUserPref
(
getApplicationContext
()
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
)));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
)));
dialog
.
setMessage
(
permitionTextResourceId
);
dialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
Intent
intent
=
new
Intent
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
);
Uri
uri
=
Uri
.
fromParts
(
"package"
,
m
Activity
.
getPackageName
(),
null
);
Uri
uri
=
Uri
.
fromParts
(
"package"
,
m
Context
.
getPackageName
(),
null
);
intent
.
setData
(
uri
);
m
Activity
.
startActivity
(
intent
);
m
Context
.
startActivity
(
intent
);
if
(
mCallback
!=
null
)
{
mCallback
.
callback
(
true
);
}
...
...
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