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
6bc8d530
Commit
6bc8d530
authored
Jun 01, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
課題5を修正
parent
58d6e72f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
22 deletions
+45
-22
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVNoAuthenticatedActivity.java
+11
-17
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/AgreementToTermsHelper.java
+18
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/LogoutHelper.java
+16
-5
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVNoAuthenticatedActivity.java
View file @
6bc8d530
package
jp
.
agentec
.
abook
.
abv
.
ui
.
common
.
activity
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager.Request
;
import
android.content.Context
;
...
...
@@ -78,8 +79,14 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
protected
void
onStop
()
{
super
.
onStop
();
ABVViewUnbindHelper
.
unbindReferences
(
getContentViewId
());
AlertDialog
dialog
=
AgreementToTermsHelper
.
getCurrentDialog
();
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
dialog
.
dismiss
();
LogoutHelper
.
logout
(
this
,
false
);
}
}
protected
abstract
View
getContentViewId
();
/**
...
...
@@ -279,6 +286,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
private
void
showMain
()
{
try
{
ContractLogic
contractLogic
=
AbstractLogic
.
getLogic
(
ContractLogic
.
class
);
contractLogic
.
initializeContractServiceOption
();
try
{
final
ABVDataCache
dataCache
=
ABVDataCache
.
getInstance
();
dataCache
.
refreshServiceOptions
();
...
...
@@ -437,22 +446,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
AgreementToTermsHelper
.
AgreementListener
listener
=
new
AgreementToTermsHelper
.
AgreementListener
()
{
@Override
public
void
onDisabled
()
{
try
{
// fixme とってつけたような処理なので、もう少しいい感じのタイミングで処理したい
ContractLogic
contractLogic
=
AbstractLogic
.
getLogic
(
ContractLogic
.
class
);
contractLogic
.
initializeContractServiceOption
();
if
(
ABVDataCache
.
getInstance
().
serviceOption
.
isUsableAgreementToTerms
())
{
// サービスオプションが無効としてスルーするという場合には、
// 前回ログインだけしている状態で終了してしまった時に
// サービスオプションが読み込まれていなかったというパターンがあるので、
// 改めて読み込み直して有効だったら、ログアウトする
LogoutHelper
.
logout
(
ABVNoAuthenticatedActivity
.
this
);
}
else
{
onAgreed
();
}
}
catch
(
Exception
e
)
{
Logger
.
e
(
TAG
,
e
);
}
onAgreed
();
}
@Override
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/AgreementToTermsHelper.java
View file @
6bc8d530
...
...
@@ -48,6 +48,17 @@ public class AgreementToTermsHelper {
void
onError
(
Exception
e
);
}
private
static
AlertDialog
currentDialog
=
null
;
private
static
synchronized
void
setCurrentDialog
(
AlertDialog
dialog
)
{
currentDialog
=
dialog
;
}
public
static
synchronized
AlertDialog
getCurrentDialog
()
{
return
currentDialog
;
}
/**
* 同意規約情報を読み込んで、バージョンが異なっていたら、ダイアログを表示
* バージョンが同じだったら何もしない
...
...
@@ -122,6 +133,13 @@ public class AgreementToTermsHelper {
params
.
width
=
disp
.
getWidth
()
*
4
/
5
;
}
dialog
.
getWindow
().
setAttributes
(
params
);
dialog
.
setOnDismissListener
(
new
DialogInterface
.
OnDismissListener
()
{
@Override
public
void
onDismiss
(
DialogInterface
dialog
)
{
setCurrentDialog
(
null
);
}
});
setCurrentDialog
(
dialog
);
}
catch
(
Exception
e
)
{
listener
.
onError
(
e
);
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/LogoutHelper.java
View file @
6bc8d530
...
...
@@ -27,6 +27,16 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ
*/
public
static
void
logout
(
Activity
activity
)
{
logout
(
activity
,
true
);
}
/**
* ログアウトして、ログイン画面に遷移する
*
* @param activity 呼び出し元アクティビティ
* @param launchLogin trueならLoginActivityをstart
*/
public
static
void
logout
(
Activity
activity
,
boolean
launchLogin
)
{
try
{
// modify by Jang 2013.06.20
UserAuthenticateLogic
user
=
AbstractLogic
.
getLogic
(
UserAuthenticateLogic
.
class
);
...
...
@@ -50,10 +60,11 @@ public class LogoutHelper {
SharedPreferences
sharedPreferences
=
activity
.
getSharedPreferences
(
AppDefType
.
PrefName
.
USER_PREFERENCE
,
Context
.
MODE_PRIVATE
);
sharedPreferences
.
edit
().
remove
(
AppDefType
.
UserPrefKey
.
GUEST_LOGIN
).
apply
();
Intent
intent
=
new
Intent
(
activity
,
LoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
activity
.
startActivity
(
intent
);
activity
.
finish
();
if
(
launchLogin
)
{
Intent
intent
=
new
Intent
(
activity
,
LoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
activity
.
startActivity
(
intent
);
activity
.
finish
();
}
}
}
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