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


Java VKSdk.isLoggedIn方法代码示例

本文整理汇总了Java中com.vk.sdk.VKSdk.isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:Java VKSdk.isLoggedIn方法的具体用法?Java VKSdk.isLoggedIn怎么用?Java VKSdk.isLoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vk.sdk.VKSdk的用法示例。


在下文中一共展示了VKSdk.isLoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shareVK

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
private void shareVK() {
    if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession()) {
        new VKShareDialog()
                .setText(getString(R.string.like_text))
                .setAttachmentLink(getString(R.string.like_url_title), getString(R.string.like_url))
                .setShareDialogListener(new VKShareDialog.VKShareDialogListener() {
                    @Override
                    public void onVkShareComplete(int i) {
                        showThankYouToast();

                        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                                .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("OK").build());
                    }

                    @Override
                    public void onVkShareCancel() {
                        ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER)
                                .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("Cancel").build());
                    }
                })
                .show(getFragmentManager(), "SHARE");

    } else
        VKSdk.authorize(NavigationActivity.vkScope, true, false);
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:26,代码来源:NavigationDrawerFragment.java

示例2: logout

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public void logout() {
    if (AccessToken.getCurrentAccessToken() != null) {
        LoginManager.getInstance().logOut();
        Logger.printInfo(LOG_TAG, "Loged out from facebook");
    }
    if (Twitter.getSessionManager().getActiveSession() != null) {
        Twitter.getSessionManager().clearActiveSession();
        Twitter.logOut();
        Logger.printInfo(LOG_TAG, "Loged out from twitter");
    }
    if (VKSdk.isLoggedIn()) {
        VKSdk.logout();
        Logger.printInfo(LOG_TAG, "Loged out from vk");
    }
    Prefs.remove(SyncMaster.GLOBAL_TOKEN);
    userProfile = new UserProfile();
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:18,代码来源:LoginMaster.java

示例3: initUserProfile

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public void initUserProfile(final IOperationFinishWithDataCallback profileFetched, boolean isForceUpdate) {
    if (userProfile != null && !isForceUpdate) {
        profileFetched.operationFinished(userProfile);
    } else if (!isLogedIn()) {
        userProfile = new UserProfile();
        profileFetched.operationFinished(userProfile);
    } else {
        if (AccessToken.getCurrentAccessToken() != null) {
            fetchFacebookUserData(profileFetched);
        } else if (Twitter.getSessionManager().getActiveSession() != null) {
            fetchTwitterUserData(profileFetched);
        } else if (VKSdk.isLoggedIn()) {
            fetchVkUserData(profileFetched);
        }
    }
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:17,代码来源:LoginMaster.java

示例4: onResume

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onResume() {
    if(internetConnection.isNetworkConnected(getApplicationContext())){
    if (VKSdk.isLoggedIn()) {
        new VkSdkHelper(getApplicationContext()).setPhoto(vkimage, vkLoginButton);
    }
    else {
        vkimage.setVisibility(View.GONE);
        vkLoginButton.setVisibility(View.VISIBLE);
    }
    if (AccessToken.getCurrentAccessToken() != null) {
        new FacebookSdkHelper(getApplicationContext()).setPhoto(facebookImage,facebookLoginButton);
    }
    else {
        facebookImage.setVisibility(View.GONE);
        facebookLoginButton.setVisibility(View.VISIBLE);
    }}
    super.onResume();
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:20,代码来源:MainActivity.java

示例5: onClick

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which){
        case Dialog.BUTTON_POSITIVE:
            VKSdk.logout();

            if (!VKSdk.isLoggedIn()) {
                // останавливаем проигрывание музыки
                Intent musicServiceIntent = new Intent(getActivity(), MusicService.class);
                musicServiceIntent.setAction(MusicService.ACTION_STOP);
                getActivity().startService(musicServiceIntent);

                // очищаем кэш
                PlayListManager.getInstance().clearAll();
                CacheData.getInstance().clearAll();
                // сброс настроек
                UserPreferences.getInstance().reset();

                // переходим в окно логина
                Intent intent = new Intent(getActivity(), LoginActivity.class);
                startActivity(intent);
            }
            break;
    }
}
 
开发者ID:DmitriyG1,项目名称:vk-music-player-android,代码行数:26,代码来源:SettingsFragment.java

示例6: initVkPref

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
private void initVkPref() {
    if (VKSdk.isLoggedIn())
        vkLoginPref.setTitle(R.string.logout_vk);
    else
        vkLoginPref.setTitle(R.string.login_vk);

    vkLoginPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (VKSdk.isLoggedIn()){
                VKSdk.logout();
                Log.d(TAG, "vk logout "+VKSdk.isLoggedIn());
            }
            else
                VKSdk.authorize(VkManager.VK_PERMISSIONS_SCOPE);

            initVkPref();
            return true;
        }
    });
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:22,代码来源:SettingsFragment.java

示例7: onResume

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession())
        update(isNeedUpdate());
    else
        VKSdk.authorize(NavigationActivity.vkScope, true, false);
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:10,代码来源:VKAudioFragment.java

示例8: onCreate

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (VKSdk.isLoggedIn()) {
        createUserComponentAndLaunchMainActivity();
        return;
    }

    setTitle(R.string.log_in);

    ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
    binding.login.setOnClickListener(v -> VKSdk.login(LoginActivity.this, "audio", "offline"));
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:15,代码来源:LoginActivity.java

示例9: onResume

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    Log.i(LOG_TAG, "onResume, isLoggedIn: " + VKSdk.isLoggedIn());

    if (VKSdk.isLoggedIn()) {
        loadUser("onResume");
    } else {
        showLogin();
    }

}
 
开发者ID:DmitriyG1,项目名称:vk-music-player-android,代码行数:14,代码来源:LoginActivity.java

示例10: loginIfNeeded

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
private boolean loginIfNeeded() {
    boolean isLoggedIn = VKSdk.isLoggedIn();
    Log.d(TAG, "initVK is loggedIn ? " + isLoggedIn);

    if (!isLoggedIn)
        VKSdk.authorize(VK_PERMISSIONS_SCOPE);

    return isLoggedIn;
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:10,代码来源:VkManager.java

示例11: shareOrLogin

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
private boolean shareOrLogin(final String url, final String comment, final String imageUrl)
{
    this.cordova.setActivityResultCallback(this);
    final String[] scope = new String[]{VKScope.WALL, VKScope.PHOTOS};
    if(!VKSdk.isLoggedIn()) {
        savedUrl = url;
        savedComment = comment;
        savedImageUrl = imageUrl;
        VKSdk.login(getActivity(), scope);
    } else {
        share(url, comment, imageUrl);
    }
    return true;
}
 
开发者ID:DrMoriarty,项目名称:cordova-social-vk,代码行数:15,代码来源:SocialVk.java

示例12: onResume

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    isResumed = true;
    if (VKSdk.isLoggedIn()) {
        showLogout();
    } else {
        showLogin();
    }
}
 
开发者ID:VKCOM,项目名称:vk-android-sdk,代码行数:11,代码来源:LoginActivity.java

示例13: isLogedIn

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public boolean isLogedIn() {
    return AccessToken.getCurrentAccessToken() != null || Twitter.getSessionManager().getActiveSession() != null || VKSdk.isLoggedIn();
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:4,代码来源:LoginMaster.java

示例14: onCreate

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if(sharedPreferences.contains(Constants.Settings.THEME_CHECK)){
        if(sharedPreferences.getString(Constants.Settings.THEME_CHECK,"").equals(Constants.Settings.THEME_GRAY)){
            this.setTheme(R.style.GrayTheme);

        }
        if(sharedPreferences.getString(Constants.Settings.THEME_CHECK,"").equals(Constants.Settings.THEME_GREEN)){
            this.setTheme(R.style.GreenTheme);
        }
    }
    super.onCreate(savedInstanceState);
    callbackManager = CallbackManager.Factory.create();
    setContentView(R.layout.activity_main);
    initItems();
    internetConnection = new InternetConnection();
    new ThemeManager(getApplicationContext()).setToolbar(toolBarView);
    new ThemeManager(getApplicationContext()).setCalendarCells(vkLoginButton);
    new ThemeManager(getApplicationContext()).setCalendarCells(facebookLoginButton);

    editor = sharedPreferences.edit();
    if(internetConnection.isNetworkConnected(getApplicationContext())){
    if (AccessToken.getCurrentAccessToken() != null) {
        new FacebookSdkHelper(getApplicationContext()).setPhoto(facebookImage,facebookLoginButton);
    }
    else {
        facebookImage.setVisibility(View.GONE);
        facebookLoginButton.setVisibility(View.VISIBLE);
    }
    if (VKSdk.isLoggedIn()) {
        new VkSdkHelper(getApplicationContext()).setPhoto(vkimage, vkLoginButton);
    }
    else{
        vkimage.setVisibility(View.GONE);
        vkLoginButton.setVisibility(View.VISIBLE);
    }
    }
    Calendar calendar = Calendar.getInstance(Locale.getDefault());
    final int[] month = {calendar.get(Calendar.MONTH) + 1};
    final int[] year = {calendar.get(Calendar.YEAR)};

    facebookLoginButton.setReadPermissions("public_profile");
    clickListeners();
    adapter = new GridCellAdapter(getApplicationContext(), month[0], year[0]);
    currentMonth.setText(adapter.getMonthAsString(month[0]) + Constants.OtherConstants.SPACE + year[0]);
    calendarView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:50,代码来源:MainActivity.java

示例15: authed

import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public boolean authed(){
    return VKSdk.isLoggedIn();
}
 
开发者ID:PhilipPavo,项目名称:VK-Files,代码行数:4,代码来源:User.java


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