本文整理汇总了Java中com.parse.LogOutCallback类的典型用法代码示例。如果您正苦于以下问题:Java LogOutCallback类的具体用法?Java LogOutCallback怎么用?Java LogOutCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogOutCallback类属于com.parse包,在下文中一共展示了LogOutCallback类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logout
import com.parse.LogOutCallback; //导入依赖的package包/类
public void logout() {
if (mMockParse != null) {
mMockParse.setIsLoggedIn(false);
if (isInstrumentationTest()) {
LocationTrackingService.stop();
EventBus.getDefault()
.post(new LogoutEvent(null));
}
} else {
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
EventBus.getDefault()
.post(new LogoutEvent(e));
} else {
LocationTrackingService.stop();
EventBus.getDefault()
.post(new LogoutEvent(null));
}
}
});
}
}
示例2: actuallyLogout
import com.parse.LogOutCallback; //导入依赖的package包/类
private void actuallyLogout() {
final ProgressDialog pd = new ProgressDialog(getContext());
pd.setMessage(getContext().getString(R.string.performingLogout));
pd.setCancelable(false);
pd.show();
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
pd.dismiss();
pd.cancel();
if(e != null) {
Toast.makeText(getContext(), getContext().getString(R.string.performedLogoutError), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getContext(), getContext().getString(R.string.performedLogoutSuccess), Toast.LENGTH_SHORT).show();
LoginManager.getInstance().logout();
((MainActivity) getActivity()).updateDrawer();
((MainActivity)getActivity()).openDrawer();
((MainActivity)getActivity()).setupEventFragment();
}
}
});
}
示例3: onOptionsItemSelected
import com.parse.LogOutCallback; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_signout) {
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if(e == null){
Intent i = new Intent(getApplicationContext(), SignOnActivity.class);
startActivity(i);
finish();
}
else{
//couldn't log out
e.printStackTrace();
}
}
});
return true;
}
return super.onOptionsItemSelected(item);
}
示例4: logout
import com.parse.LogOutCallback; //导入依赖的package包/类
/**
* Logs out the current user and starts the new account activity.
* Just starts the new account activity is no user is logged in
*/
private void logout(){
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if(e == null){
startLoginActivity();
} else{
updateToast(e.getMessage(), Toast.LENGTH_LONG);
}
}
});
}
示例5: onOptionsItemSelected
import com.parse.LogOutCallback; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
Intent newGoalIntent = new Intent(this, SettingsActivity.class);
startActivityForResult(newGoalIntent, SETTINGS_REQUEST);
return true;
}
if (id == R.id.action_sign_out) {
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
// Show a simple Toast message upon successful registration
Toast.makeText(BaseActivity.this, "Signing out...", Toast.LENGTH_LONG).show();
// Send user to LauncherActivity.class
Intent intent = new Intent(BaseActivity.this, LauncherActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
return true;
}
return super.onOptionsItemSelected(item);
}