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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
16 deletions
+39
-16
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVNoAuthenticatedActivity.java
+9
-15
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
+12
-1
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
;
package
jp
.
agentec
.
abook
.
abv
.
ui
.
common
.
activity
;
import
android.app.AlertDialog
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager
;
import
android.app.DownloadManager.Request
;
import
android.app.DownloadManager.Request
;
import
android.content.Context
;
import
android.content.Context
;
...
@@ -78,6 +79,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
...
@@ -78,6 +79,12 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
protected
void
onStop
()
{
protected
void
onStop
()
{
super
.
onStop
();
super
.
onStop
();
ABVViewUnbindHelper
.
unbindReferences
(
getContentViewId
());
ABVViewUnbindHelper
.
unbindReferences
(
getContentViewId
());
AlertDialog
dialog
=
AgreementToTermsHelper
.
getCurrentDialog
();
if
(
dialog
!=
null
&&
dialog
.
isShowing
())
{
dialog
.
dismiss
();
LogoutHelper
.
logout
(
this
,
false
);
}
}
}
protected
abstract
View
getContentViewId
();
protected
abstract
View
getContentViewId
();
...
@@ -279,6 +286,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
...
@@ -279,6 +286,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
private
void
showMain
()
{
private
void
showMain
()
{
try
{
try
{
ContractLogic
contractLogic
=
AbstractLogic
.
getLogic
(
ContractLogic
.
class
);
contractLogic
.
initializeContractServiceOption
();
try
{
try
{
final
ABVDataCache
dataCache
=
ABVDataCache
.
getInstance
();
final
ABVDataCache
dataCache
=
ABVDataCache
.
getInstance
();
dataCache
.
refreshServiceOptions
();
dataCache
.
refreshServiceOptions
();
...
@@ -437,23 +446,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
...
@@ -437,23 +446,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
AgreementToTermsHelper
.
AgreementListener
listener
=
new
AgreementToTermsHelper
.
AgreementListener
()
{
AgreementToTermsHelper
.
AgreementListener
listener
=
new
AgreementToTermsHelper
.
AgreementListener
()
{
@Override
@Override
public
void
onDisabled
()
{
public
void
onDisabled
()
{
try
{
// fixme とってつけたような処理なので、もう少しいい感じのタイミングで処理したい
ContractLogic
contractLogic
=
AbstractLogic
.
getLogic
(
ContractLogic
.
class
);
contractLogic
.
initializeContractServiceOption
();
if
(
ABVDataCache
.
getInstance
().
serviceOption
.
isUsableAgreementToTerms
())
{
// サービスオプションが無効としてスルーするという場合には、
// 前回ログインだけしている状態で終了してしまった時に
// サービスオプションが読み込まれていなかったというパターンがあるので、
// 改めて読み込み直して有効だったら、ログアウトする
LogoutHelper
.
logout
(
ABVNoAuthenticatedActivity
.
this
);
}
else
{
onAgreed
();
onAgreed
();
}
}
}
catch
(
Exception
e
)
{
Logger
.
e
(
TAG
,
e
);
}
}
@Override
@Override
public
void
onEmpty
()
{
public
void
onEmpty
()
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/AgreementToTermsHelper.java
View file @
6bc8d530
...
@@ -48,6 +48,17 @@ public class AgreementToTermsHelper {
...
@@ -48,6 +48,17 @@ public class AgreementToTermsHelper {
void
onError
(
Exception
e
);
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 {
...
@@ -122,6 +133,13 @@ public class AgreementToTermsHelper {
params
.
width
=
disp
.
getWidth
()
*
4
/
5
;
params
.
width
=
disp
.
getWidth
()
*
4
/
5
;
}
}
dialog
.
getWindow
().
setAttributes
(
params
);
dialog
.
getWindow
().
setAttributes
(
params
);
dialog
.
setOnDismissListener
(
new
DialogInterface
.
OnDismissListener
()
{
@Override
public
void
onDismiss
(
DialogInterface
dialog
)
{
setCurrentDialog
(
null
);
}
});
setCurrentDialog
(
dialog
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
listener
.
onError
(
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 {
...
@@ -27,6 +27,16 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ
* @param activity 呼び出し元アクティビティ
*/
*/
public
static
void
logout
(
Activity
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
{
try
{
// modify by Jang 2013.06.20
// modify by Jang 2013.06.20
UserAuthenticateLogic
user
=
AbstractLogic
.
getLogic
(
UserAuthenticateLogic
.
class
);
UserAuthenticateLogic
user
=
AbstractLogic
.
getLogic
(
UserAuthenticateLogic
.
class
);
...
@@ -50,10 +60,11 @@ public class LogoutHelper {
...
@@ -50,10 +60,11 @@ public class LogoutHelper {
SharedPreferences
sharedPreferences
=
activity
.
getSharedPreferences
(
AppDefType
.
PrefName
.
USER_PREFERENCE
,
Context
.
MODE_PRIVATE
);
SharedPreferences
sharedPreferences
=
activity
.
getSharedPreferences
(
AppDefType
.
PrefName
.
USER_PREFERENCE
,
Context
.
MODE_PRIVATE
);
sharedPreferences
.
edit
().
remove
(
AppDefType
.
UserPrefKey
.
GUEST_LOGIN
).
apply
();
sharedPreferences
.
edit
().
remove
(
AppDefType
.
UserPrefKey
.
GUEST_LOGIN
).
apply
();
if
(
launchLogin
)
{
Intent
intent
=
new
Intent
(
activity
,
LoginActivity
.
class
);
Intent
intent
=
new
Intent
(
activity
,
LoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
activity
.
startActivity
(
intent
);
activity
.
startActivity
(
intent
);
activity
.
finish
();
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