package com.yuji.ef;
+
//package com.evernote.android.sample;
import java.io.File;
private String fileName;
private boolean isInit = true;
-
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.oauth);
-// msgArea = (TextView) findViewById(R.id.message);
-// btnAuth = (Button) findViewById(R.id.auth_button);
-// btnSelect = (Button) findViewById(R.id.select_button);
-// btnSave = (Button) findViewById(R.id.save_button);
+ // msgArea = (TextView) findViewById(R.id.message);
+ // btnAuth = (Button) findViewById(R.id.auth_button);
+ // btnSelect = (Button) findViewById(R.id.select_button);
+ // btnSave = (Button) findViewById(R.id.save_button);
setupSession();
}
// Complete the Evernote authentication process if necessary
// TODO
- //if (!session.completeAuthentication()) {
+ // if (!session.completeAuthentication()) {
if (!isInit && !session.completeAuthentication()) {
// We only want to do this when we're resuming after
// authentication...
}
updateUi();
-
+
// ADD
- if (isInit){
+ if (isInit) {
isInit = false;
- }
- else {
- EvernoteUtil util = EvernoteUtil.getInstance();
- util.setSession(session);
+ } else {
+ if (session.completeAuthentication()) {
+ EvernoteUtil util = EvernoteUtil.getInstance();
+ util.setSession(session);
+ }
finish();
}
}
}
updateUi();
-
+
// ADD
try {
startAuth(null);
- }
- catch (Throwable t){
+ } catch (Throwable t) {
t.printStackTrace();
}
}
*/
private void updateUi() {
if (session.isLoggedIn()) {
-// btnAuth.setText(R.string.label_log_out);
-// btnSave.setEnabled(true);
-// btnSelect.setEnabled(true);
+ // btnAuth.setText(R.string.label_log_out);
+ // btnSave.setEnabled(true);
+ // btnSelect.setEnabled(true);
} else {
-// btnAuth.setText(R.string.label_log_in);
-// btnSave.setEnabled(false);
-// btnSelect.setEnabled(false);
+ // btnAuth.setText(R.string.label_log_in);
+ // btnSave.setEnabled(false);
+ // btnSelect.setEnabled(false);
}
}
* Sends the user to the image gallery to choose an image to share.
*/
public void startAuth(View view) {
-// if (session.isLoggedIn()) {
-// session.logOut();
-// } else {
-// session.authenticate(this);
-// }
+ // if (session.isLoggedIn()) {
+ // session.logOut();
+ // } else {
+ // session.authenticate(this);
+ // }
if (session.isLoggedIn()) {
session.logOut();
}
if (requestCode == SELECT_IMAGE) {
// Callback from our 'startSelectImage' action
if (resultCode == Activity.RESULT_OK) {
-// endSelectImage(data);
+ // endSelectImage(data);
}
}
}