|
|
@@ -82,11 +82,12 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
companion object { |
|
|
companion object { |
|
|
const val NOTE_FOLDER_DIR = "/mnt/sdcard/ebook/" |
|
|
const val NOTE_FOLDER_DIR = "/mnt/sdcard/ebook/" |
|
|
const val REQ_CODE = 0x98 |
|
|
const val REQ_CODE = 0x98 |
|
|
fun active(act: Activity, title: String, noteInfo: String) { |
|
|
|
|
|
|
|
|
fun active(act: Activity, title: String, noteInfo: String, can_add_page: Int = 1) { |
|
|
act.startActivityForResult<NoteActivity>( |
|
|
act.startActivityForResult<NoteActivity>( |
|
|
REQ_CODE, |
|
|
REQ_CODE, |
|
|
"note_info" to noteInfo, |
|
|
"note_info" to noteInfo, |
|
|
"title" to title |
|
|
|
|
|
|
|
|
"title" to title, |
|
|
|
|
|
"can_add_page" to can_add_page |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@@ -149,7 +150,10 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
} |
|
|
} |
|
|
//加纸 |
|
|
//加纸 |
|
|
new_add.setOnClickListener { |
|
|
new_add.setOnClickListener { |
|
|
notList.add(Note()) |
|
|
|
|
|
|
|
|
val lastBGid = notList[notList.size-1].BGid |
|
|
|
|
|
val note = Note() |
|
|
|
|
|
note.BGid = lastBGid |
|
|
|
|
|
notList.add(note) |
|
|
tv_page_index.text = "${currIndex + 1}/${notList.size}" |
|
|
tv_page_index.text = "${currIndex + 1}/${notList.size}" |
|
|
indexBox.visibility = if (notList.size > 1) { |
|
|
indexBox.visibility = if (notList.size > 1) { |
|
|
View.VISIBLE |
|
|
View.VISIBLE |
|
|
@@ -206,7 +210,6 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("SetTextI18n") |
|
|
@SuppressLint("SetTextI18n") |
|
|
override fun initData() { |
|
|
override fun initData() { |
|
|
val json = intent.getStringExtra("note_info") |
|
|
val json = intent.getStringExtra("note_info") |
|
|
@@ -244,6 +247,13 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
} else { |
|
|
} else { |
|
|
View.GONE |
|
|
View.GONE |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val canAddPage = intent.getIntExtra("can_add_page", 1) |
|
|
|
|
|
if (canAddPage == 1) { |
|
|
|
|
|
new_add.visibility = View.VISIBLE |
|
|
|
|
|
}else{ |
|
|
|
|
|
new_add.visibility = View.GONE |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun loadImage(index: Int = 0) { |
|
|
private fun loadImage(index: Int = 0) { |
|
|
@@ -255,7 +265,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
note.key = Date().time.toString() |
|
|
note.key = Date().time.toString() |
|
|
note_view.showExistPage( |
|
|
note_view.showExistPage( |
|
|
"", |
|
|
"", |
|
|
mBGDrawableList[0] |
|
|
|
|
|
|
|
|
mBGDrawableList[bgId] |
|
|
) |
|
|
) |
|
|
currKey = note.key |
|
|
currKey = note.key |
|
|
currIndex = index |
|
|
currIndex = index |
|
|
@@ -326,7 +336,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
note.key = Date().time.toString() |
|
|
note.key = Date().time.toString() |
|
|
note_view.showExistPage( |
|
|
note_view.showExistPage( |
|
|
"", |
|
|
"", |
|
|
mBGDrawableList[0] |
|
|
|
|
|
|
|
|
mBGDrawableList[bgId] |
|
|
) |
|
|
) |
|
|
currKey = note.key |
|
|
currKey = note.key |
|
|
currIndex = index |
|
|
currIndex = index |
|
|
@@ -419,7 +429,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() { |
|
|
private fun copyList(): MutableList<Note> { |
|
|
private fun copyList(): MutableList<Note> { |
|
|
val list = mutableListOf<Note>() |
|
|
val list = mutableListOf<Note>() |
|
|
notList.forEach { |
|
|
notList.forEach { |
|
|
if(!TextUtils.isEmpty(it.key)&&!TextUtils.isEmpty(it.identity)){ |
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(it.key) && !TextUtils.isEmpty(it.identity)) { |
|
|
val item = Note() |
|
|
val item = Note() |
|
|
item.key = it.key |
|
|
item.key = it.key |
|
|
item.identity = it.identity |
|
|
item.identity = it.identity |
|
|
|