|
|
|
|
@ -30,6 +30,8 @@ import android.content.SharedPreferences;
|
|
|
|
|
import android.graphics.Paint;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
|
import android.text.Editable;
|
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
|
import android.text.Spannable;
|
|
|
|
|
import android.text.SpannableString;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
@ -91,6 +93,8 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
public TextView tvAlertDate;
|
|
|
|
|
|
|
|
|
|
public ImageView ibSetBgColor;
|
|
|
|
|
|
|
|
|
|
public TextView tvCharCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
|
|
|
|
|
@ -312,10 +316,29 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
mNoteHeaderHolder.tvAlertDate = findViewById(R.id.tv_alert_date);
|
|
|
|
|
mNoteHeaderHolder.ibSetBgColor = findViewById(R.id.btn_set_bg_color);
|
|
|
|
|
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
|
|
|
|
|
mNoteHeaderHolder.tvCharCount = findViewById(R.id.tv_char_count);
|
|
|
|
|
|
|
|
|
|
mNoteEditor = findViewById(R.id.note_edit_view);
|
|
|
|
|
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
|
|
|
|
|
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
|
|
|
|
|
|
|
|
|
|
mNoteEditor.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
@Override
|
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
if (mNoteHeaderHolder != null && mNoteHeaderHolder.tvCharCount != null) {
|
|
|
|
|
mNoteHeaderHolder.tvCharCount.setText(String.valueOf(s.length()) + " 字");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 设置背景颜色选择器的点击事件
|
|
|
|
|
for (int id : sBgSelectorBtnsMap.keySet()) {
|
|
|
|
|
ImageView iv = findViewById(id);
|
|
|
|
|
@ -1062,6 +1085,10 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
|
|
|
|
|
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
|
|
|
|
|
mEditTextList.setVisibility(View.GONE);
|
|
|
|
|
mNoteEditor.setVisibility(View.VISIBLE);
|
|
|
|
|
if (mNoteHeaderHolder != null && mNoteHeaderHolder.tvCharCount != null) {
|
|
|
|
|
mNoteHeaderHolder.tvCharCount.setVisibility(View.VISIBLE);
|
|
|
|
|
mNoteHeaderHolder.tvCharCount.setText(String.valueOf(mNoteEditor.getText().length()) + " 字");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|