本文整理汇总了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);
}
示例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();
}
示例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);
}
}
}
示例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();
}
示例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;
}
}
示例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;
}
});
}
示例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);
}
示例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"));
}
示例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();
}
}
示例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;
}
示例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;
}
示例12: onResume
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
isResumed = true;
if (VKSdk.isLoggedIn()) {
showLogout();
} else {
showLogin();
}
}
示例13: isLogedIn
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public boolean isLogedIn() {
return AccessToken.getCurrentAccessToken() != null || Twitter.getSessionManager().getActiveSession() != null || VKSdk.isLoggedIn();
}
示例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();
}
示例15: authed
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
public boolean authed(){
return VKSdk.isLoggedIn();
}