Exemplo n.º 1
0
 @SuppressLint("NewApi")
 private void enableWebDebugging(boolean enable) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
     AppLog.i(T.EDITOR, "Enabling web debugging");
     WebView.setWebContentsDebuggingEnabled(enable);
   }
 }
Exemplo n.º 2
0
  public boolean hasChanges(NoteDetail otherNote) {

    AppLog.i("title equals:" + !StringUtils.equals(title, otherNote.title));
    AppLog.i("content equals:" + !StringUtils.equals(content, otherNote.content));
    AppLog.i("notebookid equals:" + !StringUtils.equals(noteBookId, otherNote.noteBookId));
    AppLog.i("isMarkDown equal:" + (isMarkDown != otherNote.isMarkDown));
    AppLog.i("tags equals:" + !StringUtils.equals(tags, otherNote.tags));
    AppLog.i("isblog equals:" + (isPublicBlog != otherNote.isPublicBlog));

    return otherNote == null
        || !StringUtils.equals(title, otherNote.title)
        || !StringUtils.equals(content, otherNote.content)
        || !StringUtils.equals(noteBookId, otherNote.noteBookId)
        || isMarkDown != otherNote.isMarkDown
        || !StringUtils.equals(tags, otherNote.tags)
        || isPublicBlog != otherNote.isPublicBlog;
  }
Exemplo n.º 3
0
 @Override
 public void onImageLoaded(String localFileId) {
   AppLog.i("download, reload webview...");
   mWebView.reload();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_share_note);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setElevation(0.0f);
      actionBar.setDisplayHomeAsUpEnabled(true);
      actionBar.setHomeButtonEnabled(true);
    }

    FragmentManager fragmentManager = getFragmentManager();
    Bundle extras = getIntent().getExtras();
    String action = getIntent().getAction();

    if (savedInstanceState == null) {
      if (extras != null) {
        // Load post from the postId passed in extras
        long localNoteId = extras.getLong(EXTRA_NOTEID, 0L);

        mNote = Leanote.leaDB.getLocalNoteById(localNoteId);
        AppLog.i("mnote:" + mNote);
      } else {
        // A postId extra must be passed to this activity
        showErrorAndFinish(R.string.note_not_found);
        return;
      }
    }

    // Ensure we have a valid post
    if (mNote == null) {
      showErrorAndFinish(R.string.note_not_found);
      return;
    }

    setTitle(StringUtils.unescapeHTML("Share Notes"));

    publishToLeaBlog = (Button) findViewById(R.id.share_note_blog_btn);
    publishToLeaBlog.setOnClickListener(
        new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
            mNote.setIsPublicBlog(true);
            Leanote.leaDB.updateNote(mNote);
            Toast.makeText(getApplicationContext(), "Publish to Lea++ Blog", Toast.LENGTH_LONG)
                .show();
          }
        });

    sendMailBtn = (Button) findViewById(R.id.share_note_mail_btn);
    //        mailAddrEditText = (EditText) findViewById(R.id.sourceview_mail_addr);
    //        pwdEditText = (EditText) findViewById(R.id.sourceview_mail_pwd);
    sendMailBtn.setOnClickListener(
        new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
            //                if( mailAddrEditText.getText().length() == 0 ) {
            //                    Toast.makeText(getApplicationContext(), "Please input you e-mail
            // address", Toast.LENGTH_LONG).show();
            //                }
            //
            //                if( pwdEditText.getText().length() == 0 ) {
            //                    Toast.makeText(getApplicationContext(), "Please input you e-mail
            // password", Toast.LENGTH_LONG).show();
            //                }

            Intent data = new Intent(Intent.ACTION_SENDTO);
            data.setData(Uri.parse("mailto:"));
            data.putExtra(Intent.EXTRA_SUBJECT, mNote.getTitle());
            data.putExtra(Intent.EXTRA_TEXT, mNote.getContent());
            startActivity(data);
          }
        });
  }