本文整理汇总了Java中com.evernote.client.android.EvernoteSession类的典型用法代码示例。如果您正苦于以下问题:Java EvernoteSession类的具体用法?Java EvernoteSession怎么用?Java EvernoteSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EvernoteSession类属于com.evernote.client.android包,在下文中一共展示了EvernoteSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
});
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:21,代码来源:LoginActivity.java
示例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);
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:18,代码来源:EvernoteLoginActivity.java
示例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);
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:19,代码来源:EvernoteLoginFragment.java
示例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());
}
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:26,代码来源:RxUser.java
示例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());
}
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:25,代码来源:RxUser.java
示例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;
}
}
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:19,代码来源:UserCenterActivity.java
示例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;
}
}
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:19,代码来源:LoginActivity.java
示例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;
}
}
开发者ID:duanze,项目名称:PureNote,代码行数:19,代码来源:StartActivity.java
示例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());
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:32,代码来源:AppendToEvernoteNote.java
示例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;
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:11,代码来源:NoteListFragment.java
示例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();
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:10,代码来源:LoginChecker.java
示例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));
}
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:12,代码来源:LoginChecker.java
示例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;
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:14,代码来源:ViewHtmlActivity.java
示例15: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected String checkedExecute() throws Exception {
return EvernoteSession.getInstance()
.getEvernoteClientFactory()
.getLinkedNotebookHelper(mLinkedNotebook)
.getCorrespondingNotebook()
.getName();
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:9,代码来源:NotesActivity.java
示例16: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected Notebook checkedExecute() throws Exception {
EvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();
Notebook notebook = new Notebook();
notebook.setName(mName);
return noteStoreClient.createNotebook(notebook);
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:10,代码来源:CreateNewNotebookTask.java
示例17: createNote
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
protected Note createNote(Note note) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException {
if (mNotebook == null && mLinkedNotebook != null) {
EvernoteLinkedNotebookHelper linkedNotebookHelper = EvernoteSession.getInstance().getEvernoteClientFactory().getLinkedNotebookHelper(mLinkedNotebook);
return linkedNotebookHelper.createNoteInLinkedNotebook(note);
} else {
EvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();
return noteStoreClient.createNote(note);
}
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:11,代码来源:CreateNewNoteTask.java
示例18: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected Result checkedExecute() throws Exception {
EvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();
noteStoreClient.deleteNote(mNoteRef.getGuid());
return Result.SUCCESS;
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:8,代码来源:DeleteNoteTask.java
示例19: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected List<NoteRef> checkedExecute() throws Exception {
EvernoteSearchHelper.Result searchResult = EvernoteSession.getInstance()
.getEvernoteClientFactory()
.getEvernoteSearchHelper()
.execute(mSearch);
return searchResult.getAllAsNoteRef();
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:10,代码来源:FindNotesTask.java
示例20: checkedExecute
import com.evernote.client.android.EvernoteSession; //导入依赖的package包/类
@Override
protected String checkedExecute() throws Exception {
EvernoteClientFactory clientFactory = EvernoteSession.getInstance().getEvernoteClientFactory();
EvernoteHtmlHelper htmlHelper;
if (mNoteRef.isLinked()) {
htmlHelper = clientFactory.getLinkedHtmlHelper(mNoteRef.loadLinkedNotebook());
} else {
htmlHelper = clientFactory.getHtmlHelperDefault();
}
Response response = htmlHelper.downloadNote(mNoteRef.getGuid());
return htmlHelper.parseBody(response);
}
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:15,代码来源:GetNoteHtmlTask.java
注:本文中的com.evernote.client.android.EvernoteSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论