当前位置: 首页>>代码示例>>Java>>正文


Java LogOutCallback类代码示例

本文整理汇总了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));
                }
            }
        });
    }
}
 
开发者ID:ralphpina,项目名称:ActivityMapper,代码行数:25,代码来源:Account.java

示例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();
            }
        }
    });
}
 
开发者ID:LibertACAO,项目名称:libertacao-android,代码行数:24,代码来源:PerfilFragment.java

示例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);
}
 
开发者ID:teamOSC,项目名称:Studddinv2_android,代码行数:29,代码来源:MainActivity.java

示例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);
            }
        }
    });
}
 
开发者ID:SCCapstone,项目名称:diet,代码行数:18,代码来源:MainActivity.java

示例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);
}
 
开发者ID:oudavid,项目名称:fortunae,代码行数:32,代码来源:BaseActivity.java


注:本文中的com.parse.LogOutCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。