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
4aed3d16
Commit
4aed3d16
authored
May 15, 2023
by
Kazuyuki Hida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ログアウト処理をLogoutHelperに移設
parent
2a3ce8ba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
31 deletions
+50
-31
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/LogoutHelper.java
+48
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ABookSettingFragment.java
+2
-31
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/helper/LogoutHelper.java
0 → 100644
View file @
4aed3d16
package
jp
.
agentec
.
abook
.
abv
.
ui
.
common
.
helper
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.widget.Toast
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity
;
import
jp.agentec.abook.abv.ui.home.activity.LoginActivity
;
public
class
LogoutHelper
{
public
static
void
logout
(
Activity
activity
)
{
try
{
// modify by Jang 2013.06.20
UserAuthenticateLogic
user
=
AbstractLogic
.
getLogic
(
UserAuthenticateLogic
.
class
);
// ログイン情報がある場合のみログアウト処理を行う
if
(
user
.
getMemberInfo
()
!=
null
)
{
user
.
signoutUser
();
// Widgetへ通知
Intent
intent
=
new
Intent
();
activity
.
sendBroadcast
(
intent
);
}
}
catch
(
Exception
e
)
{
Logger
.
w
(
"signoutUser failed at callLoginActivity"
,
e
);
ABVToastUtil
.
showMakeText
(
activity
,
R
.
string
.
ERROR
,
Toast
.
LENGTH_SHORT
);
}
// 新着更新が実行されている場合停止
((
ABookSettingActivity
)
activity
).
stopContentRefresher
();
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
();
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ABookSettingFragment.java
View file @
4aed3d16
...
...
@@ -56,6 +56,7 @@ 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.UserPrefKey
;
import
jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog
;
import
jp.agentec.abook.abv.ui.common.helper.LogoutHelper
;
import
jp.agentec.abook.abv.ui.common.helper.ProgressDialogHelper
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
...
...
@@ -176,43 +177,13 @@ public class ABookSettingFragment extends PreferenceFragment {
logoutAkert
.
setButton
(
DialogInterface
.
BUTTON_POSITIVE
,
getResources
().
getString
(
R
.
string
.
confirm
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
logout
(
);
LogoutHelper
.
logout
(
getActivity
()
);
}
});
logoutAkert
.
setButton
(
DialogInterface
.
BUTTON_NEGATIVE
,
getResources
().
getString
(
R
.
string
.
cancel
),
(
DialogInterface
.
OnClickListener
)
null
);
showAlertDialog
(
logoutAkert
);
}
private
void
logout
()
{
try
{
// modify by Jang 2013.06.20
UserAuthenticateLogic
user
=
AbstractLogic
.
getLogic
(
UserAuthenticateLogic
.
class
);
// ログイン情報がある場合のみログアウト処理を行う
if
(
user
.
getMemberInfo
()
!=
null
)
{
user
.
signoutUser
();
// Widgetへ通知
Intent
intent
=
new
Intent
();
getActivity
().
sendBroadcast
(
intent
);
}
}
catch
(
Exception
e
)
{
Logger
.
w
(
"signoutUser failed at callLoginActivity"
,
e
);
ABVToastUtil
.
showMakeText
(
getActivity
(),
R
.
string
.
ERROR
,
Toast
.
LENGTH_SHORT
);
}
// 新着更新が実行されている場合停止
((
ABookSettingActivity
)
getActivity
()).
stopContentRefresher
();
SharedPreferences
sharedPreferences
=
getActivity
().
getSharedPreferences
(
AppDefType
.
PrefName
.
USER_PREFERENCE
,
Context
.
MODE_PRIVATE
);
sharedPreferences
.
edit
().
remove
(
AppDefType
.
UserPrefKey
.
GUEST_LOGIN
).
commit
();
Intent
intent
=
new
Intent
(
getActivity
(),
LoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
startActivity
(
intent
);
getActivity
().
finish
();
}
private
void
setLogInfoSetting
()
{
PreferenceGroup
logInfo
=
(
PreferenceGroup
)
findPreference
(
LOG_INFO
);
// ログExport
...
...
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