@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_memo); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); saveButton = (ImageButton) findViewById(R.id.bottom_save); editText = (EditText) findViewById(R.id.memo_edit); editText.addTextChangedListener(this); String htmlText = getIntent().getStringExtra(EXTRA_HTMLTEXT); editText.setText(TextConverter.toCharSequence(htmlText, editText)); editText.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { editText.setCursorVisible(true); } }); long memoTime = getIntent().getLongExtra(EXTRA_TIME, 0); memoId = getIntent().getLongExtra(EXTRA_MEMO_ID, 0); memoDateTime = Calendar.getInstance(); memoDateTime.setTime(new Date(memoTime)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); updateTitle(); realm = Realm.getDefaultInstance(); memoBo = new MemoBo(realm); tagPopupMenuHelper = new TagPopupMenuHelper(this, realm, editText); updateSaveButton(false); }
public void onClickSaveButton(View view) { memoBo.update( memoId, TextConverter.toTextSpanInfo(editText.getText()), memoDateTime.getTimeInMillis(), new Realm.Transaction.Callback() { @Override public void onSuccess() { super.onSuccess(); finish(); } }); }