本文整理汇总了Java中com.evernote.client.android.EvernoteSession类的典型用法代码示例。如果您正苦于以下问题:Java EvernoteSession类的具体用法?Java EvernoteSession怎么用?Java EvernoteSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EvernoteSession类属于com.evernote.client.android包,在下文中一共展示了EvernoteSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.tb_text));
setSupportActionBar(toolbar);
mButton = (Button) findViewById(R.id.button_login);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EvernoteSession.getInstance().authenticate(LoginActivity.this);
mButton.setEnabled(false);
}
});
}
示例2: onCreate
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
Bundle args = getIntent().getExtras();
EvernoteOAuthHelper helper = new EvernoteOAuthHelper(EvernoteSession.getInstance(), args.getString(EXTRA_CONSUMER_KEY),
args.getString(EXTRA_CONSUMER_SECRET), args.getBoolean(EXTRA_SUPPORT_APP_LINKED_NOTEBOOKS, true),
(Locale) args.getSerializable(EXTRA_LOCALE));
mTaskKey = TaskExecutor.getInstance().execute(new EvernoteLoginTask(helper, false), this);
} else {
mTaskKey = savedInstanceState.getInt(KEY_TASK, -1);
mResultPosted = savedInstanceState.getBoolean(KEY_RESULT_POSTED, false);
}
}
示例3: onActivityCreated
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState == null) {
Bundle args = getArguments();
EvernoteOAuthHelper helper = new EvernoteOAuthHelper(EvernoteSession.getInstance(), args.getString(ARG_CONSUMER_KEY),
args.getString(ARG_CONSUMER_SECRET), args.getBoolean(ARG_SUPPORT_APP_LINKED_NOTEBOOKS, true),
(Locale) args.getSerializable(ARG_LOCALE));
mTaskKey = TaskExecutor.getInstance().execute(new EvernoteLoginTask(helper, true), this);
} else {
mTaskKey = savedInstanceState.getInt(KEY_TASK, -1);
mResultPosted = savedInstanceState.getBoolean(KEY_RESULT_POSTED, false);
}
}
示例4: logoutEvernote
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
public Observable<Boolean> logoutEvernote() {
return Observable.create(new Observable.OnSubscribe<Boolean>() {
@Override
public void call(Subscriber<? super Boolean> subscriber) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString(EVERNOTE_NAME, NULL);
editor.commit();
if (mEvernoteSession == null) {
mEvernoteSession = new EvernoteSession.Builder(mContext)
.setLocale(Locale.SIMPLIFIED_CHINESE)
.setEvernoteService(EVERNOTE_SERVICE)
.setSupportAppLinkedNotebooks(SUPPORT_APP_LINKED_NOTEBOOKS)
.setForceAuthenticationInThirdPartyApp(true)
.build(BuildConfig.EVERNOTE_CONSUMER_KEY, BuildConfig.EVERNOTE_CONSUMER_SECRET)
.asSingleton();
}
if (mEvernoteSession.isLoggedIn()) {
mEvernoteSession.logOut();
}
mEvernoteUser = null;
subscriber.onNext(true);
subscriber.onCompleted();
}
}).subscribeOn(Schedulers.io());
}
示例5: loginEvernote
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
public Observable<Boolean> loginEvernote(Activity activity) {
if (mEvernoteActivity != null) {
mEvernoteActivity.clear();
mEvernoteActivity = null;
}
mEvernoteActivity = new WeakReference<>(activity);
return Observable.create(new Observable.OnSubscribe<Boolean>() {
@Override
public void call(Subscriber<? super Boolean> subscriber) {
if (mEvernoteSession == null) {
mEvernoteSession = new EvernoteSession.Builder(mContext)
.setLocale(Locale.SIMPLIFIED_CHINESE)
.setEvernoteService(EVERNOTE_SERVICE)
.setSupportAppLinkedNotebooks(SUPPORT_APP_LINKED_NOTEBOOKS)
.setForceAuthenticationInThirdPartyApp(true)
.build(BuildConfig.EVERNOTE_CONSUMER_KEY, BuildConfig.EVERNOTE_CONSUMER_SECRET)
.asSingleton();
}
mEvernoteSession.authenticate(mEvernoteActivity.get());
subscriber.onNext(true);
subscriber.onCompleted();
}
}).subscribeOn(Schedulers.io());
}
示例6: onActivityResult
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case EvernoteSession.REQUEST_CODE_LOGIN:
if (resultCode == RESULT_OK) {
// handle success
mUserCenterPresenter.onEvernoteLoginFinished(true);
} else {
// handle failure
mUserCenterPresenter.onEvernoteLoginFinished(false);
}
break;
default:
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
示例7: onActivityResult
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case EvernoteSession.REQUEST_CODE_LOGIN:
if (resultCode == RESULT_OK) {
// handle success
mLoginPresenter.onEvernoteLoginFinished(true);
} else {
// handle failure
mLoginPresenter.onEvernoteLoginFinished(false);
}
break;
default:
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
示例8: onActivityResult
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
/**
* Called when the control returns from an activity that we launched.
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
//Update UI when oauth activity returns result
case EvernoteSession.REQUEST_CODE_OAUTH:
mEvernote.onAuthFinish(resultCode);
break;
case Password.REQUEST_VALIDATE_PWD:
if (RESULT_OK == resultCode) {
// isUnLocked = true;
}
break;
}
}
示例9: onActivityResult
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
switch (requestCode) {
case EvernoteSession.REQUEST_CODE_OAUTH:
if (resultCode == RESULT_OK) {
switchUI();
} else {
Toast.makeText(this, "OAuth失敗", Toast.LENGTH_LONG).show();
}
break;
}
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:17,代码来源:EvernoteSDKAndroidSampleActivity.java
示例10: onCreate
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
String consumerKey;
if ("Your consumer key".equals(CONSUMER_KEY)) {
consumerKey = BuildConfig.EVERNOTE_CONSUMER_KEY;
} else {
// isn't the default value anymore
consumerKey = CONSUMER_KEY;
}
String consumerSecret;
if ("Your consumer secret".equals(CONSUMER_SECRET)) {
consumerSecret = BuildConfig.EVERNOTE_CONSUMER_SECRET;
} else {
// isn't the default value anymore
consumerSecret = CONSUMER_SECRET;
}
//Set up the Evernote singleton session, use EvernoteSession.getInstance() later
new EvernoteSession.Builder(this)
.setEvernoteService(EVERNOTE_SERVICE)
.setSupportAppLinkedNotebooks(SUPPORT_APP_LINKED_NOTEBOOKS)
.setForceAuthenticationInThirdPartyApp(true)
// .setLocale(Locale.SIMPLIFIED_CHINESE)
.build(consumerKey, consumerSecret)
.asSingleton();
registerActivityLifecycleCallbacks(new LoginChecker());
}
示例11: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected String checkedExecute() throws Exception {
EvernoteClientFactory clientFactory = EvernoteSession.getInstance().getEvernoteClientFactory();
String shardId = clientFactory.getUserStoreClient().getUser().getShardId();
String shareKey = clientFactory.getNoteStoreClient().shareNote(mNoteRef.getGuid());
return "https://" + EvernoteSession.getInstance().getAuthenticationResult().getEvernoteHost()
+ "/shard/" + shardId + "/sh/" + mNoteRef.getGuid() + "/" + shareKey;
}
示例12: onActivityCreated
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
if (!EvernoteSession.getInstance().isLoggedIn() && !isIgnored(activity)) {
mCachedIntent = activity.getIntent();
LoginActivity.launch(activity);
activity.finish();
}
}
示例13: onActivityPaused
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
public void onActivityPaused(Activity activity) {
if (activity instanceof LoginActivity && EvernoteSession.getInstance().isLoggedIn()) {
if (mCachedIntent != null) {
activity.startActivity(mCachedIntent);
mCachedIntent = null;
} else {
activity.startActivity(new Intent(activity, MainActivity.class));
}
}
}
示例14: getEvernoteHtmlHelper
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
protected EvernoteHtmlHelper getEvernoteHtmlHelper() throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException {
if (mEvernoteHtmlHelper == null) {
EvernoteClientFactory clientFactory = EvernoteSession.getInstance().getEvernoteClientFactory();
if (mNoteRef.isLinked()) {
mEvernoteHtmlHelper = clientFactory.getLinkedHtmlHelper(mNoteRef.loadLinkedNotebook());
} else {
mEvernoteHtmlHelper = clientFactory.getHtmlHelperDefault();
}
}
return mEvernoteHtmlHelper;
}
示例15: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected String checkedExecute() throws Exception {
return EvernoteSession.getInstance()
.getEvernoteClientFactory()
.getLinkedNotebookHelper(mLinkedNotebook)
.getCorrespondingNotebook()
.getName();
}