diff --git a/src/app/build.gradle b/src/app/build.gradle
deleted file mode 100644
index 5e44a82..0000000
--- a/src/app/build.gradle
+++ /dev/null
@@ -1,45 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdk 30
- buildToolsVersion '30.0.3'
- useLibrary'org.apache.http.legacy'
- defaultConfig {
- applicationId "net.micode.notes"
- minSdkVersion 22
- //noinspection ExpiredTargetSdkVersion
- targetSdkVersion 30
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
- sourceSets{
- main(){
- jniLibs.srcDirs = ['libs']
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-dependencies {
- implementation 'com.android.support:appcompat-v7:28.0.0'
- implementation 'com.android.support.constraint:constraint-layout:2.0.4'
- implementation files('libs\\Msc.jar')
- implementation "androidx.drawerlayout:drawerlayout:1.1.1"
- implementation 'com.android.support:design:29.1.1'
- implementation 'com.zhihu.android:matisse:0.5.2-beta4'
- implementation 'com.github.bumptech.glide:glide:4.8.0'
- annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
- implementation 'com.simple:spiderman:1.0.2'
- implementation 'com.android.support.constraint:constraint-layout:2.0.4'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
-}
-
diff --git a/src/app/src/main/AndroidManifest.xml b/src/app/src/main/AndroidManifest.xml
index 1b18d15..502020b 100644
--- a/src/app/src/main/AndroidManifest.xml
+++ b/src/app/src/main/AndroidManifest.xml
@@ -84,6 +84,9 @@
android:resource="@xml/searchable" />
+
+
sBgSelectorBtnsMap = new HashMap();
@@ -153,14 +170,22 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private View mNoteBgColorSelector;
+ //private View mDraw = findViewById(R.id.img);
+
private View mFontSizeSelector;
private EditText mNoteEditor;
+ private Vector mHistory = new Vector(10);
+
private View mNoteEditorPanel;
+ //private final static int REQUEST_CODE_NEW_NODE = 103;
+
private WorkingNote mWorkingNote;
+ private boolean mIsRevort;
+
private SharedPreferences mSharedPrefs;
private int mFontSizeId;
@@ -174,8 +199,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private LinearLayout mEditTextList;
private String mUserQuery;
+
private Pattern mPattern;
+ private TextToSpeech mTTS;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -398,8 +426,56 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
+ mNoteHeaderHolder.startDraw = (ImageButton) findViewById(R.id.imageButton2);
+ mNoteHeaderHolder.note_Read = (ImageButton) findViewById(R.id.menu_note_read);
+ mNoteHeaderHolder.note_revote = (Button) findViewById(R.id.action_undo);
+ mNoteHeaderHolder.note_revote.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ backTrack();
+ }
+ });
+ mNoteHeaderHolder.note_Read.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ readText();
+ }
+ });
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
+ mNoteHeaderHolder.startDraw.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ {
+ saveNote();
+ Intent intent = new Intent();
+ intent.setClass(NoteEditActivity.this, DrawActivity.class);
+ startActivity(intent);
+
+ }
+ }
+ });
+
mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
+ mNoteEditor.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void afterTextChanged(Editable editable) {
+ if (!mIsRevort){
+ saveHistory();
+ }else{
+ mIsRevort = false;
+ }
+ }
+ });
mNoteEditorPanel = findViewById(R.id.sv_note_edit);
mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
for (int id : sBgSelectorBtnsMap.keySet()) {
@@ -423,6 +499,20 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
}
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
+
+ mTTS = new TextToSpeech(this, new OnInitListener() {
+ @Override
+ public void onInit(int i) {
+ if (i == TextToSpeech.SUCCESS){
+ int result = mTTS.setLanguage(Locale.US);
+ if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE
+ && result != TextToSpeech.LANG_AVAILABLE){
+ //Toast.makeText(NoteEditActivity.this,"暂不支持此种语言", Toast.LENGTH_LONG);
+ return;
+ }
+ }
+ }
+ });
}
@Override
@@ -434,6 +524,33 @@ public class NoteEditActivity extends Activity implements OnClickListener,
clearSettingState();
}
+ private void saveHistory(){
+ SpannableString input_text = new SpannableString(mNoteEditor.getText());
+ if (mHistory.size() >= 10){
+ mHistory.removeElementAt(0);
+ mHistory.add(input_text);
+ }else{
+ mHistory.add(input_text);
+ }
+ mNoteHeaderHolder.note_revote.setEnabled(true);
+ }
+
+ private void backTrack(){
+ int stack_size = mHistory.size();
+ mIsRevort = true;
+ if (stack_size <= 1){
+ mNoteHeaderHolder.note_revote.setEnabled(false);
+ return;
+ }else{
+ mNoteEditor.setText((CharSequence) mHistory.elementAt(stack_size - 2));
+ mHistory.removeElementAt(stack_size - 1);
+ if (stack_size == 2){
+ mNoteHeaderHolder.note_revote.setEnabled(false);
+ }
+ }
+
+ }
+
private void updateWidget() {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) {
@@ -478,6 +595,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
mFontSizeSelector.setVisibility(View.GONE);
}
+ if (id == R.id.imageButton2){
+ //mDraw.setVisibility(View.VISIBLE);
+
+ }
}
@Override
@@ -622,6 +743,11 @@ public class NoteEditActivity extends Activity implements OnClickListener,
});
}
+ public void readText(){
+ mTTS.speak(mNoteEditor.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);
+ }
+
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
diff --git a/src/app/src/main/res/layout/activity_second.xml b/src/app/src/main/res/layout/activity_second.xml
new file mode 100644
index 0000000..4e4fa13
--- /dev/null
+++ b/src/app/src/main/res/layout/activity_second.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/src/main/res/layout/note_edit.xml b/src/app/src/main/res/layout/note_edit.xml
index 2ccc786..ce3cc12 100644
--- a/src/app/src/main/res/layout/note_edit.xml
+++ b/src/app/src/main/res/layout/note_edit.xml
@@ -15,7 +15,8 @@
limitations under the License.
-->
-
+
+
+
+
+
+
+ android:background="@drawable/title_alert"
+ />
+
+ android:textAppearance="@style/TextAppearancePrimaryItem" />
+ android:layout_height="wrap_content"
+ android:layout_gravity="top|right"
+ android:background="@drawable/bg_color_btn_mask" />